query_id
stringlengths
32
32
query
stringlengths
7
29.6k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
15155d2c0760a6cc0055105d729bd8e6
This assumes the class performance chart has a range, interquartile range, and average line and removes all other series
[ { "docid": "8cd87b26bd808334d0eae84479e612c4", "score": "0.6649568", "text": "function removeExtraneousSeries() {\n while(chartAveragePerformance.series.length > 3) {\n chartAveragePerformance.series[3].remove(false);\n }\n}", "title": "" } ]
[ { "docid": "5fee24dc9af6876b0b8b6eb08c3f9a24", "score": "0.6074956", "text": "trim(timeRange) {\n if (this._seisDataList) {\n this._seisDataList = this._seisDataList.filter(function(d) {\n return d.timeRange.overlaps(timeRange);\n });\n if (this._seisDataList.length > 0) {\n this.recheckAmpScaleDomain();\n this.drawSeismograms();\n }\n }\n }", "title": "" }, { "docid": "75207a818631152191c70411d744b673", "score": "0.58675164", "text": "function removeChart() {\n svg.selectAll(\"g.lineChart\").remove();\n}", "title": "" }, { "docid": "cdc18a36b24a72ea44d6b87b4491db9c", "score": "0.5804187", "text": "function clean(data) {\n var cleaned;\n var range = [];\n\n data.forEach(function(d) {\n range.push(d.response);\n });\n range.sort(function(a,b) { return (a-b) });\n cutoff = d3.quantile(range, 0.99) //FIXME: this exlcudes the 99th percentile, kind of arbitrarily\n\n for(var i = data.length -1; i >= 0 ; i--){\n if(data[i].response < 0 || data[i].response > cutoff ){\n data.splice(i, 1);\n }\n }\n data = cleaned;\n }", "title": "" }, { "docid": "615ad92892a405d3245a4b4fa0d396c3", "score": "0.5778243", "text": "function cleanDataPointHighlights() {\n verticalMarkerContainer.selectAll('.circle-container').remove();\n }", "title": "" }, { "docid": "9c59d13bc66cf567bb3b6aabcf7cfeb8", "score": "0.57341254", "text": "function removeOutliersUsingDBSCAN(associatedChartId) {\n var myChart = $('#' + associatedChartId).highcharts();\n var allValuesArray = getAllSeriesData(myChart);\n\n $.get(\"http://localhost:3000/home/filteroutliers/[\" + allValuesArray + \"]\", function (data) {\n //remove all series, replace by new one\n var seriesLength = myChart.series.length;\n for (var i = seriesLength - 1; i > -1; i--) {\n myChart.series[i].remove();\n }\n\n var seriesWithoutOutliers = parseJSONClusterData(data);\n for (var j = 0; j < seriesWithoutOutliers.length; j++)\n myChart.addSeries(seriesWithoutOutliers[j]);\n\n myChart.redraw();\n });\n}", "title": "" }, { "docid": "056521c4590155ee3a2c382cb6d616a4", "score": "0.57198447", "text": "function clearChartSeries() {\r\n chart.series = [{\r\n type: 'radarArea'\r\n }];\r\n chart.refresh();\r\n }", "title": "" }, { "docid": "57d6e8e1aee8907ae342bbec6388c9ca", "score": "0.55970377", "text": "function emptyLineChart() {\n d3.selectAll(\"svg#graph > *\").remove();\n }", "title": "" }, { "docid": "08592c74e00c2f394eb6d51d7a7b9cbc", "score": "0.55743974", "text": "drawPoints() {\n let series = this, points = series.points, options = series.options, chart = series.chart, renderer = chart.renderer, q1Plot, q3Plot, highPlot, lowPlot, medianPlot, medianPath, crispCorr, crispX = 0, boxPath, width, left, right, halfWidth, \n // error bar inherits this series type but doesn't do quartiles\n doQuartiles = series.doQuartiles !== false, pointWiskerLength, whiskerLength = series.options.whiskerLength;\n points.forEach(function (point) {\n let graphic = point.graphic, verb = graphic ? 'animate' : 'attr', shapeArgs = point.shapeArgs, boxAttr = {}, stemAttr = {}, whiskersAttr = {}, medianAttr = {}, color = point.color || series.color;\n if (typeof point.plotY !== 'undefined') {\n // crisp vector coordinates\n width = Math.round(shapeArgs.width);\n left = Math.floor(shapeArgs.x);\n right = left + width;\n halfWidth = Math.round(width / 2);\n q1Plot = Math.floor(doQuartiles ? point.q1Plot : point.lowPlot);\n q3Plot = Math.floor(doQuartiles ? point.q3Plot : point.lowPlot);\n highPlot = Math.floor(point.highPlot);\n lowPlot = Math.floor(point.lowPlot);\n if (!graphic) {\n point.graphic = graphic = renderer.g('point')\n .add(series.group);\n point.stem = renderer.path()\n .addClass('highcharts-boxplot-stem')\n .add(graphic);\n if (whiskerLength) {\n point.whiskers = renderer.path()\n .addClass('highcharts-boxplot-whisker')\n .add(graphic);\n }\n if (doQuartiles) {\n point.box = renderer.path(boxPath)\n .addClass('highcharts-boxplot-box')\n .add(graphic);\n }\n point.medianShape = renderer.path(medianPath)\n .addClass('highcharts-boxplot-median')\n .add(graphic);\n }\n if (!chart.styledMode) {\n // Stem attributes\n stemAttr.stroke =\n point.stemColor || options.stemColor || color;\n stemAttr['stroke-width'] = pick(point.stemWidth, options.stemWidth, options.lineWidth);\n stemAttr.dashstyle = (point.stemDashStyle ||\n options.stemDashStyle ||\n options.dashStyle);\n point.stem.attr(stemAttr);\n // Whiskers attributes\n if (whiskerLength) {\n whiskersAttr.stroke = (point.whiskerColor ||\n options.whiskerColor ||\n color);\n whiskersAttr['stroke-width'] = pick(point.whiskerWidth, options.whiskerWidth, options.lineWidth);\n whiskersAttr.dashstyle = (point.whiskerDashStyle ||\n options.whiskerDashStyle ||\n options.dashStyle);\n point.whiskers.attr(whiskersAttr);\n }\n if (doQuartiles) {\n boxAttr.fill = (point.fillColor ||\n options.fillColor ||\n color);\n boxAttr.stroke = options.lineColor || color;\n boxAttr['stroke-width'] = options.lineWidth || 0;\n boxAttr.dashstyle = (point.boxDashStyle ||\n options.boxDashStyle ||\n options.dashStyle);\n point.box.attr(boxAttr);\n }\n // Median attributes\n medianAttr.stroke = (point.medianColor ||\n options.medianColor ||\n color);\n medianAttr['stroke-width'] = pick(point.medianWidth, options.medianWidth, options.lineWidth);\n medianAttr.dashstyle = (point.medianDashStyle ||\n options.medianDashStyle ||\n options.dashStyle);\n point.medianShape.attr(medianAttr);\n }\n let d;\n // The stem\n crispCorr = (point.stem.strokeWidth() % 2) / 2;\n crispX = left + halfWidth + crispCorr;\n d = [\n // stem up\n ['M', crispX, q3Plot],\n ['L', crispX, highPlot],\n // stem down\n ['M', crispX, q1Plot],\n ['L', crispX, lowPlot]\n ];\n point.stem[verb]({ d });\n // The box\n if (doQuartiles) {\n crispCorr = (point.box.strokeWidth() % 2) / 2;\n q1Plot = Math.floor(q1Plot) + crispCorr;\n q3Plot = Math.floor(q3Plot) + crispCorr;\n left += crispCorr;\n right += crispCorr;\n d = [\n ['M', left, q3Plot],\n ['L', left, q1Plot],\n ['L', right, q1Plot],\n ['L', right, q3Plot],\n ['L', left, q3Plot],\n ['Z']\n ];\n point.box[verb]({ d });\n }\n // The whiskers\n if (whiskerLength) {\n crispCorr = (point.whiskers.strokeWidth() % 2) / 2;\n highPlot = highPlot + crispCorr;\n lowPlot = lowPlot + crispCorr;\n pointWiskerLength = (/%$/).test(whiskerLength) ?\n halfWidth * parseFloat(whiskerLength) / 100 :\n whiskerLength / 2;\n d = [\n // High whisker\n ['M', crispX - pointWiskerLength, highPlot],\n ['L', crispX + pointWiskerLength, highPlot],\n // Low whisker\n ['M', crispX - pointWiskerLength, lowPlot],\n ['L', crispX + pointWiskerLength, lowPlot]\n ];\n point.whiskers[verb]({ d });\n }\n // The median\n medianPlot = Math.round(point.medianPlot);\n crispCorr = (point.medianShape.strokeWidth() % 2) / 2;\n medianPlot = medianPlot + crispCorr;\n d = [\n ['M', left, medianPlot],\n ['L', right, medianPlot]\n ];\n point.medianShape[verb]({ d });\n }\n });\n }", "title": "" }, { "docid": "c0fe7258b6c2356cf94068972f277e38", "score": "0.553334", "text": "function removeIndicatorAxis() {\r\n var axis = chart.get('indicator-axis');\r\n if (axis) {\r\n axis.remove();\r\n }\r\n chart.get('price-axis').update({ height: '100%' }, false);\r\n }", "title": "" }, { "docid": "6f0e414b1e1bc434b1689a28075e51b9", "score": "0.5532764", "text": "function onAfterSetScale() {\n this.series.forEach(function (series) {\n series.hasProcessed = false;\n });\n }", "title": "" }, { "docid": "9a1ffd239b0227b1599bc5dfd3f13a0a", "score": "0.55286205", "text": "function onChartBeforeRedraw() {\n if (this.allDataPoints) {\n delete this.allDataPoints;\n }\n }", "title": "" }, { "docid": "7c027e4edcccc0470504a72c1f910482", "score": "0.55028766", "text": "function aggregate_line_all(raw_data, width, height, target_id, min_hour, max_hour) {\n var empty = new Array(24+1).join('0').split('').map(parseFloat);\n\n var chart_data = {\n labels: [\"00\", \"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"07\", \"08\", \"09\", \"10\", \"11\",\n \"12\", \"13\", \"14\", \"15\", \"16\", \"17\", \"18\", \"19\", \"20\", \"21\", \"22\", \"23\"],\n datasets: [ {data: empty.slice(0), fillColor: \"rgba(0,0,0,.5)\", pointColor: \"rgba(0,0,0,.8)\",\n pointStrokeColor: \"rgba(0,0,0,0)\"},\n {data: empty.slice(0), fillColor: \"rgba(0,127,0,.5)\", pointColor: \"rgba(0,127,0,0)\",\n pointStrokeColor: \"rgba(0,0,0,0)\"},\n {data: empty.slice(0), fillColor: \"rgba(127,0,0,.5)\", pointColor: \"rgba(127,0,0,0)\",\n pointStrokeColor: \"rgba(0,0,0,0)\"} ]};\n \n if (width == null) width = DEFAULT_WIDTH;\n if (height == null) height = DEFAULT_HEIGHT;\n \n sortByKey(raw_data, SCHEDULED);\n \n var bucket_count = empty.slice(0);\n \n // format data\n raw_data.forEach(function(val) {\n var hour = (new Date(Date.parse( val[SCHEDULED] ))).getHours();\n \n var delta = parseInt(val[DELTA]) / 60.0;\n if (delta < 0) {\n chart_data.datasets[1].data[hour] += delta;\n } else {\n chart_data.datasets[2].data[hour] += delta;\n }\n \n chart_data.datasets[0].data[hour] += Number(val[POPULATION]);\n \n bucket_count[hour] += 1;\n } );\n \n // average each bucket (hour)\n for (var i = 0; i < 24; i++) {\n if (bucket_count[i] == 0) continue;\n \n chart_data.datasets[0].data[i] /= bucket_count[i];\n chart_data.datasets[1].data[i] /= bucket_count[i];\n chart_data.datasets[2].data[i] /= bucket_count[i];\n }\n \n // slice the hours we want\n if (min_hour == null) min_hour = 0;\n if (max_hour == null) max_hour = 24;\n if (min_hour != 0 || max_hour != 24) {\n chart_data.labels = chart_data.labels.slice(min_hour, max_hour);\n chart_data.datasets[0].data = chart_data.datasets[0].data.slice(min_hour, max_hour);\n chart_data.datasets[1].data = chart_data.datasets[1].data.slice(min_hour, max_hour);\n chart_data.datasets[2].data = chart_data.datasets[2].data.slice(min_hour, max_hour);\n }\n \n return insert_chart(chart_data, \"line\", width, height, target_id);\n}", "title": "" }, { "docid": "b75c858e96715fdeaf5bb1b0b755ee61", "score": "0.5471472", "text": "function removeChartFilter(){\n\n\tfor (i=0;i<retailFundGroupUpperLimits.length; i++){\n\t\t//if (typeof(contactList[i]) != \"undefined\")\n\t\tif (typeof contactList[i] != 'undefined')\n\t\t{\t\n\t\t\tcontactList[i].filter();\n\t\t}\n\t\t$(\"#fundsGroup\"+i).show();\n\t\t$(\"#productGroup\"+i).show();\n\t}\n}", "title": "" }, { "docid": "d5b0a3250f244eb4c85683a8796ac2cc", "score": "0.54537493", "text": "destroy(keepEventsForUpdate) {\n const series = this, chart = series.chart, issue134 = /AppleWebKit\\/533/.test(win.navigator.userAgent), data = series.data || [];\n let destroy, i, point, axis;\n // add event hook\n fireEvent(series, 'destroy', { keepEventsForUpdate });\n // remove events\n this.removeEvents(keepEventsForUpdate);\n // erase from axes\n (series.axisTypes || []).forEach(function (AXIS) {\n axis = series[AXIS];\n if (axis && axis.series) {\n erase(axis.series, series);\n axis.isDirty = axis.forceRedraw = true;\n }\n });\n // remove legend items\n if (series.legendItem) {\n series.chart.legend.destroyItem(series);\n }\n // destroy all points with their elements\n i = data.length;\n while (i--) {\n point = data[i];\n if (point && point.destroy) {\n point.destroy();\n }\n }\n if (series.clips) {\n series.clips.forEach((clip) => clip.destroy());\n }\n // Clear the animation timeout if we are destroying the series\n // during initial animation\n U.clearTimeout(series.animationTimeout);\n // Destroy all SVGElements associated to the series\n objectEach(series, function (val, prop) {\n // Survive provides a hook for not destroying\n if (val instanceof SVGElement && !val.survive) {\n // issue 134 workaround\n destroy = issue134 && prop === 'group' ?\n 'hide' :\n 'destroy';\n val[destroy]();\n }\n });\n // remove from hoverSeries\n if (chart.hoverSeries === series) {\n chart.hoverSeries = void 0;\n }\n erase(chart.series, series);\n chart.orderSeries();\n // clear all members\n objectEach(series, function (val, prop) {\n if (!keepEventsForUpdate || prop !== 'hcEvents') {\n delete series[prop];\n }\n });\n }", "title": "" }, { "docid": "819f47e195339917dbae7dfc39818e8f", "score": "0.5427613", "text": "function aggregate_line_adhere(raw_data, width, height, target_id, min_hour, max_hour) {\n var empty = new Array(24+1).join('0').split('').map(parseFloat);\n\n var chart_data = {\n labels: [\"00\", \"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"07\", \"08\", \"09\", \"10\", \"11\",\n \"12\", \"13\", \"14\", \"15\", \"16\", \"17\", \"18\", \"19\", \"20\", \"21\", \"22\", \"23\"],\n datasets: [ {data: empty.slice(0), fillColor: \"rgba(0,127,0,.5)\", pointColor: \"rgba(0,127,0,0)\",\n pointStrokeColor: \"rgba(0,0,0,0)\"},\n {data: empty.slice(0), fillColor: \"rgba(127,0,0,.5)\", pointColor: \"rgba(127,0,0,0)\",\n pointStrokeColor: \"rgba(0,0,0,0)\"} ]};\n \n if (width == null) width = DEFAULT_WIDTH;\n if (height == null) height = DEFAULT_HEIGHT;\n \n sortByKey(raw_data, SCHEDULED);\n \n var bucket_count = empty.slice(0);\n \n // format data\n raw_data.forEach(function(val) {\n var hour = (new Date(Date.parse( val[SCHEDULED] ))).getHours();\n \n var delta = parseInt(val[DELTA]) / 60.0;\n if (delta < 0) {\n chart_data.datasets[0].data[hour] += delta;\n } else {\n chart_data.datasets[1].data[hour] += delta;\n }\n \n bucket_count[hour] += 1;\n } );\n \n // average each bucket (hour)\n for (var i = 0; i < 24; i++) {\n if (bucket_count[i] == 0) continue;\n \n chart_data.datasets[0].data[i] /= bucket_count[i];\n chart_data.datasets[1].data[i] /= bucket_count[i];\n }\n \n // slice the hours we want\n if (min_hour == null) min_hour = 0;\n if (max_hour == null) max_hour = 24;\n if (min_hour != 0 || max_hour != 24) {\n chart_data.labels = chart_data.labels.slice(min_hour, max_hour);\n chart_data.datasets[0].data = chart_data.datasets[0].data.slice(min_hour, max_hour);\n chart_data.datasets[1].data = chart_data.datasets[1].data.slice(min_hour, max_hour);\n }\n \n return insert_chart(chart_data, \"line\", width, height, target_id);\n}", "title": "" }, { "docid": "3848941a002f4164908ad587ab7664b8", "score": "0.54169446", "text": "function drawTimeSeries()\r\n\t\t\t{\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\t// initialise canvas area for drawing graphs on\r\n\t\t\t\tvar canvasArea = { width : 365, height : 300 };\r\n\t\t\t\tvar margin = { left : 15 , right : 5 , top : 15 , bottom : 5 };\r\n\t\t\t\tvar xAxis = { xStart : 30 , xEnd : 310 , yStart : 250 , yEnd : 250 };\r\n\t\t\t\tvar yAxis = { xStart : 30 , xEnd : 30 , yStart : 250 , yEnd : 30 };\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t// initialise local temporary array names for handling data and other local variables\r\n\t\t\t\tvar tempArray = [];\r\n\t\t\t\tvar tempSubArray = [];\t\t\t\t\t\t\t\r\n\t\t\t\tvar tickFrequency = 1;\r\n\t\t\t\tvar MaxValToUse = -1;\r\n\t\t\t\tvar yearOfMax = -1;\t\r\n\t\t\t\tvar MaxVal = -1;\r\n\t\t\t\tvar isBuildingRect = false;\r\n\t\t\t\tvar band = numColorDivs;\r\n\t\t\t\tvar patt1=new RegExp(\",,\");\r\n\t\t\t\tvar selectedGEOUNITVariablesStr = selectedGEOUNITVariables.toString();\t\t\r\n\t\t\t\tvar checkTest = patt1.test(selectedGEOUNITVariablesStr);\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t// determine new values and update global variables from selection lists and sliders\r\n\t\t\t\tneedToRecalculateNumberInGrps = false;\r\n\t\t\t\tselectedDatasetIndex = drop.indexOf(document.getElementById(\"dv-drop\").value);\t\r\n\t\t\t\tvar usableGEOUNITCount = EffectiveGEOUNITCount[selectedDatasetIndex][selectedYearIndex];\r\n\t\t\t\tindexOfCurrentHoverOverGEOUNIT_CD = GEOUNIT_Code.indexOf(currentHoverOverGEOUNIT_CD);\r\n\t\t\t\tindexOfCurrentHoverOverGEOUNIT_NM = GEOUNIT_Name.indexOf(currentHoverOverGEOUNIT_NM);\t\t\t\t\r\n\t\t\t\tstartYear = $('#timeSlider').slider( 'option', 'min' );\t\t\r\n\t\t\t\tyearInterval = $('#timeSlider').slider( 'option', 'step' );\r\n\t\t\t\tselectedYear = $('#timeSlider').slider( 'option', 'value' );\r\n\t\t\t\tselectedYearIndex = (selectedYear - startYear)/yearInterval;\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t// determine frequency of tick marking on graphs based on number of geography units lsited in 'data.js'\r\n\t\t\t\tif ( numElements >= 0 ) { tickFrequency = 1; }\r\n\t\t\t\tif ( numElements >= 50 ) { tickFrequency = 5; }\r\n\t\t\t\tif ( numElements >= 100 ) { tickFrequency = 10; }\r\n\t\t\t\tif ( numElements >= 250 ) { tickFrequency = 25; }\r\n\t\t\t\tif ( numElements >= 500 ) { tickFrequency = 50; }\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t// remove old D3 graph elements in advance of drawing new ones based on new user selections\t\t\t\t\r\n\t\t\t\td3.select(\"#mainChart\").remove();\r\n\t\t\t\td3.select(\"#geoName\").remove();\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t// redraw new canvas area for graphing statistics\r\n\t\t\t\td3.select(\"#graphSVGDiv\")\r\n\t\t\t\t\t.append(\"svg\")\r\n\t\t\t\t\t.attr(\"id\",\"mainChart\")\r\n\t\t\t\t\t.attr(\"width\", canvasArea.width)\r\n\t\t\t\t\t.attr(\"height\", canvasArea.height)\r\n\t\t\t\t\t.append(\"g\")\t\t\t\t\r\n\t\t\t\t\t.attr(\"id\",\"mainChart\");\r\n\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t// Default starting position for graph area (top-right of frame). Also entered if user mouseover's an area ... \r\n\t\t\t\t// graphing area opens up to ranking graph, and returns to this graph when user is NOT interacting with map layer,\r\n\t\t\t\t// and will remain as ranking graph if user selects other option from 'graph-drop' until user interacts with map/geosearch tool/area selection list\r\n\t\t\t\tif ( ( hasHovered == false && highlightedGEOUNIT == false ) || ( ( hasHovered == true || highlightedGEOUNIT == true ) && graphType==\"Rank\" ) )\r\n\t\t\t\t{\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t// \tinitialise local variables\r\n\t\t\t\t\tvar tempNullGEOUNITListing = new Array();\r\n\t\t\t\t\tvar tempGEOUNITListing = new Array();\r\n\t\t\t\t\tvar GEOUNITValueObj = {}; //create object containing key(geoName):value(value) pairs' disciminates beween usuable values and unusable/null values\t\t\t\t\t\t\t\r\n\t\t\t\t\tvar NullGEOUNITValueObj = {}; //create object containing key(geoName):value(value) pairs' disciminates beween usuable values and unusable/null values\r\n\t\t\t\t\tvar grades = new Array();\t\r\n\t\t\t\t\tvar p = new Array();\r\n\t\t\t\t\tvar q = new Array();\r\n\t\t\t\t\tvar\tcumulativeColWidth = 0;\t\r\n\t\t\t\t\tvar\trectTopLeftY = 0.0;\t\t\r\n\t\t\t\t\tvar colWidth = 0.0;\r\n\t\t\t\t\tvar selectedBand = 0;\t\r\n\t\t\t\t\tvar rectNumber = 0;\t\r\n\t\t\t\t\tvar geoRank = -1;\t\t\r\n\t\t\t\t\tvar j=0; \t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// boolean check to detemine which array of data divisions to access and use depending on what users have selected to define data limits.\r\n\t\t\t\t\t// Either standard set of divisions (contained by array 'divisions') if user has not checked ON the 'Fixed Data Ranges' checkbox, or\r\n\t\t\t\t\t// the specific set contained by array fixedDataRanges that is populated when user checks ON.\r\n\t\t\t\t\tif ( fixedValCheck == true ) { grades = fixedDataRanges; }\r\n\t\t\t\t\telse if ( customCheck == true ) { grades = customDivisions; }\r\n\t\t\t\t\telse { grades = divisions; }\r\n\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t// remove name label of previously selected GEOUNIT\r\n\t\t\t\t\td3.select(\"#geoName\").remove();\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// define constaints of viewbox area\r\n\t\t\t\t\tvar vbBufferTop = 10;\r\n\t\t\t\t\tvar vbBufferBottom = 10;\r\n\t\t\t\t\tvar vbBufferLeft = 30;\r\n\t\t\t\t\tvar vbBufferRight = 30;\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// local array to hold x coordinate of x-Axis ranking text label; accessed onmouseover\r\n\t\t\t\t\tvar RankingX = new Array();\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// define dimensions of viewbox\r\n\t\t\t\t\tvar viewBoxWidth = canvasArea.width - vbBufferRight - vbBufferLeft;\r\n\t\t\t\t\tvar viewBoxHeight = canvasArea.height - vbBufferTop - vbBufferBottom;\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// define dimensions of x and y-axis based on viewbox dimensions/constraints\r\n\t\t\t\t\txAxis = { xStart : vbBufferLeft , xEnd : viewBoxWidth - vbBufferRight , yStart : 250 , yEnd : 250 };\r\n\t\t\t\t\tyAxis = { xStart : vbBufferLeft , xEnd : vbBufferLeft , yStart : 250 , yEnd : 65 };\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// global variables set later to mouseovered bar height and bar top to use when user interacts with legend\r\n\t\t\t\t\tglblHghlghtBarHgt = yAxis.yStart - yAxis.yEnd;\r\n\t\t\t\t\tglblHghlghtBarTop = yAxis.yEnd;\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// define extent and positions of viewbox within SVG area\r\n\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t.attr(\"viewBox\", \"0 0 \" + viewBoxWidth + \" \" + viewBoxHeight);\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t// determine and populate main data array built from data.js; make exact local copies of these to use later, and eecute their creation. \r\n\t\t\t\t\t// sort tempArray,in decsending fashion (used to build visible components of ranking graph)\r\n\t\t\t\t\tvar mainArray = arrayNames[selectedDatasetIndex];\r\n\t\t\t\t\tvar subArray = mainArray + \"[\" + selectedYearIndex + \"]\";\t\t\t\t\r\n\t\t\t\t\tvar sliceArrayStr = \"tempArray = \" + subArray + \".slice()\";\t//array, later sorted descending ....\r\n\t\t\t\t\tvar sliceArrayStr2 = \"tempArray2 = \" + subArray + \".slice()\"; //copy of array, in original 'data.js' order ...\t\t\t\t\t\t\r\n\t\t\t\t\teval(sliceArrayStr);\r\n\t\t\t\t\teval(sliceArrayStr2);\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\ttempArray.sort(function(a,b){return b-a});\t\t\t\t\r\n\t\t\t\t\tMaxValToUse = tempArray[0];\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// calculate sizes and dimensions specific to this instane of drawing the ranking graph,\r\n\t\t\t\t\t// based on predefined axis diemnsions, number of geography units (GEOUNITs), maximum data value\r\n\t\t\t\t\tvar geoUnitColumnIntervalWidth = ( xAxis.xEnd-xAxis.xStart ) / (numElements);\r\n\t\t\t\t\tvar\tyScale = (yAxis.yStart - yAxis.yEnd) / MaxValToUse;\t\r\n\t\t\t\t\tvar\tprevRectTopLeftX = xAxis.xStart;\r\n\t\t\t\t\tvar\trectTopLeftX = xAxis.xStart;\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// determine frequency of drawing tick marks on y-Axis based on the returned maximum value\t\t\t\t\r\n\t\t\t\t\r\n//\t\t\t\t\tif ( MaxValToUse >= 0 ) { tickFrequency = 1; }\r\n//\t\t\t\t\tif ( MaxValToUse >= 10 ) { tickFrequency = 2; }\r\n//\t\t\t\t\tif ( MaxValToUse >= 25 ) { tickFrequency = 5; }\r\n//\t\t\t\t\tif ( MaxValToUse >= 50 ) { tickFrequency = 10; }\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\tif ( MaxValToUse >= 0 ) { tickFrequency = 5; }\r\n\t\t\t\t\tif ( MaxValToUse >= 100 ) { tickFrequency = 50; }\r\n\t\t\t\t\tif ( MaxValToUse >= 200 ) { tickFrequency = 100; }\r\n\t\t\t\t\tif ( MaxValToUse >= 500 ) { tickFrequency = 200; }\r\n\t\t\t\t\tif ( MaxValToUse >= 1000 ) { tickFrequency = 1000; }\r\n\t\t\t\t\tif ( MaxValToUse >= 2000 ) { tickFrequency = 2000; }\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// draw y-Axis labels and tick marks ...\r\n\t\t\t\t\tfor ( var i=0; i<=MaxValToUse; i++ )\r\n\t\t\t\t\t{\t\t\t\r\n\t\t\t\t\t\tif ( (i)%tickFrequency==0 )\r\n\t\t\t\t\t\t{\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// determine Y-axis scaling factor for placing axis tick marks/labels\r\n\t\t\t\t\t\t\tvar yVal = (yAxis.yStart-(yScale*i));\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tvar numZeros;\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tvar valnew = i;\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif ( selectedDatasetIndex == 5 ) { valnew = i/100; }\r\n\t\t\t\t\t\t\t\r\n/*\t\t\t\t\t\t\t\r\n/*\t\t\t\t\t\t\tvar numZeros;\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tvar prefix = d3.formatPrefix(i);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// http://en.wikipedia.org/wiki/Metric_prefix\r\n\t\t\t\t\t\t\tif(prefix.symbol==\"\")\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tnumZeros = 0;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif(prefix.symbol===\"k\")\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tnumZeros = 3;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif(prefix.symbol===\"M\")\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tnumZeros = 6;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif(prefix.symbol===\"G\")\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tnumZeros = 9;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif(prefix.symbol===\"T\")\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tnumZeros = 12;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n//\t\t\t\t\t\t\t\r\n//\t\t\t\t\t\t\tvar valnew = addCommas(i);\r\n\t\t\t\t\t\t\tvar valnew = i.toString();\r\n\t\t\t\t\t\t\tvalnew = valnew.slice(0,valnew.length-numZeros);\t*/\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\r\n//\t\t\t\t\t\t\tvar valnew = addCommas(i.toFixed(0));\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n/*\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"div\")\r\n\t\t\t\t\t\t\t\t.attr(\"class\",\"yAxisTickLabelHolder\")\r\n\t\t\t\t\t\t\t\t.attr(\"id\",\"labelHolder_\" + i)\r\n\t\t\t\t\t\t\t\t.attr(\"x\", 50 )\r\n\t\t\t\t\t\t\t\t.attr(\"y\", 50 )\r\n\t\t\t\t\t\t\t\t.attr(\"width\",100)\r\n\t\t\t\t\t\t\t\t.attr(\"height\",100)\r\n\t\t\t\t\t\t\t\t.attr(\"border-style\", \"solid\")\r\n\t\t\t\t\t\t\t\t.attr(\"border-width\",\"5px\")\r\n\t\t\t\t\t\t\t\t.attr(\"border-color\",\"red\");\t\t\t// ERROR*/\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tvar valnew = addCommas(i);\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tvar LabelX = xAxis.xStart-35;\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif ( valnew < 10 ) { LabelX = xAxis.xStart-20; }\r\n\t\t\t\t\t\t\telse if ( valnew < 100 ) { LabelX = xAxis.xStart-25; }\r\n\t\t\t\t\t\t\telse if ( valnew < 1000 ) { LabelX = xAxis.xStart-30; }\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// Y-axis labels\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t.attr(\"class\",\"yAxisLabels\")\r\n\t\t\t\t\t\t\t\t.text(valnew)\r\n\t\t\t\t\t\t\t\t.attr(\"x\", LabelX )\r\n\t\t\t\t\t\t\t\t.attr(\"y\", yVal+3 )\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"#909090\")\r\n\t\t\t\t\t\t\t\t.attr(\"font-size\", \"9\");\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// Y-axis tick marks\t\t\t\t\t\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"line\")\r\n\t\t\t\t\t\t\t\t.attr(\"class\",\"yAxisTicks\")\r\n\t\t\t\t\t\t\t\t.attr(\"x1\", xAxis.xEnd+1)\r\n\t\t\t\t\t\t\t\t.attr(\"y1\", yVal)\r\n\t\t\t\t\t\t\t\t.attr(\"x2\", xAxis.xStart-5)\r\n\t\t\t\t\t\t\t\t.attr(\"y2\", yVal)\r\n\t\t\t\t\t\t\t\t.attr(\"stroke\", \"#C8C8C8\")\r\n\t\t\t\t\t\t\t\t.attr(\"stroke-width\", \"1\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// for each GEOUNIT feature ...\t\t\t\t\t\r\n\t\t\t\t\tfor ( var i=0; i<numElements; i++ )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// if GEOUNITs data value is NOT a true value (not null or undefined)\r\n\t\t\t\t\t\tif ( tempArray2[i] == undefined )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tNullGEOUNITValueObj[GEOUNIT_Name[i]] = tempArray2[i]; // 'GEOUNIT_Name' is array of GEOUNIT names as ordered in data.js ..., NOT ranked descending ...\r\n\t\t\t\t\t\t\ttempGEOUNITListing[i] = GEOUNIT_Name[i];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// otherwise value is usable and GEOUNIT should be included and visible in ranking graph\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tGEOUNITValueObj[GEOUNIT_Name[i]] = tempArray2[i]; // 'GEOUNIT_Name' is array of GEOUNIT names as ordered in data.js ..., NOT ranked descending ...\r\n\t\t\t\t\t\t\ttempGEOUNITListing[i] = GEOUNIT_Name[i];\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// re-initialise specific dimension variables to recalculate later\r\n\t\t\t\t\t\trectTopLeftY = 0.0;\r\n\t\t\t\t\t\tcolWidth = 0.0;\r\n\t\t\t\t\t\tcolHeight = 0;\r\n\r\n\r\n\t\t\t\t\t\t// recalculate variables based on ranked GEOUNIT instance being considered as 'i'\r\n\t\t\t\t\t\trectTopLeftX = vbBufferLeft+(i*geoUnitColumnIntervalWidth);\t\r\n\t\t\t\t\t\tcolWidth = geoUnitColumnIntervalWidth;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// if data value for GEOUNIT is null/undefined, give vertical bar proxy height and top values,\r\n\t\t\t\t\t\t// and make clear so is not visible at right hand of ranking graph\r\n\t\t\t\t\t\tif ( tempArray[i] == null )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tcolHeight = (yAxis.yStart-yAxis.yEnd);\t\t\t\r\n\t\t\t\t\t\t\trectTopLeftY = (yAxis.yEnd);\r\n\t\t\t\t\t\t\topcty = 0.0;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//other wise, give it opacity and specific height/top values\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tcolHeight = (tempArray[i]*yScale);\t\t\t\r\n\t\t\t\t\t\t\trectTopLeftY = (xAxis.yStart-(tempArray[i]*yScale));\r\n\t\t\t\t\t\t\topcty = $('#opacitySlider').slider('value');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t// determines which data band [from the legend] the GEOUNIT/value falls in. Build new ID code string\r\n\t\t\t\t\t\tvar band_ID = 0;\r\n\t\t\t\t\t\tvar divisionValue = 0;\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// for each data division value defined by user-selected settings\r\n\t\t\t\t\t\tfor ( var k=0; k<grades.length; k++ )\r\n\t\t\t\t\t\t{\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// define special case if division value is the lower bound to the lowest band (grades[0]). Reset to '-Inifinity'\r\n\t\t\t\t\t\t\tif ( k == 0 ) { divisionValue = -Infinity; }\r\n\t\t\t\t\t\t\telse { divisionValue = grades[k]; }\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// if value is actually found in a given data band\r\n\t\t\t\t\t\t\tif ( parseFloat(tempArray[i]) >= divisionValue )\r\n\t\t\t\t\t\t\t{\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tband_ID = k;\r\n\t\t\t\t\t\t\t\tband = \"Band_\" + k;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// otherwise value must be null/undefined\r\n\t\t\t\t\t\t\t// set band to proxy value of total number of divisions considered\r\n\t\t\t\t\t\t\telse if ( tempArray[i] == null )\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tband_ID = k;\r\n\t\t\t\t\t\t\t\tband = \"Band_\" + grades.length;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// populate array with x coordinate value to dynamically place ranking text under X-axis\r\n\t\t\t\t\t\tRankingX[i] = Math.ceil(rectTopLeftX);\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// draw vertical coloured bar/rectangle for GEOUNIT. Coloured according to data band GEOUNIT falls in\r\n\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t.append(\"rect\")\r\n\t\t\t\t\t\t\t.attr(\"value\", tempArray[i] )\r\n\t\t\t\t\t\t\t.attr(\"x\", Math.ceil(rectTopLeftX) )\r\n\t\t\t\t\t\t\t.attr(\"y\", Math.ceil(rectTopLeftY) )\r\n\t\t\t\t\t\t\t.attr(\"width\", Math.ceil(colWidth) )\r\n\t\t\t\t\t\t\t.attr(\"height\", colHeight )\r\n\t\t\t\t\t\t\t.attr(\"stroke\", getColor(tempArray[i], \"drawTimeSeries\") )\r\n\t\t\t\t\t\t\t.attr(\"fill\", getColor(tempArray[i], \"drawTimeSeries\") )\r\n\t\t\t\t\t\t\t.attr(\"opacity\", opcty )\r\n\t\t\t\t\t\t\t.attr(\"stroke-width\", \"0\" )\r\n\t\t\t\t\t\t\t.attr(\"shape-rendering\", \"geometricPrecision\" );\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// draw vertical CLEAR bar on top of each GEOUNIT bar, that user's interact with on mouseover with Ranking graph\r\n\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t.append(\"rect\")\r\n\t\t\t\t\t\t\t.attr(\"id\", rectNumber )\r\n\t\t\t\t\t\t\t.attr(\"class\", band)\r\n\t\t\t\t\t\t\t.attr(\"x\", Math.ceil(rectTopLeftX) )\r\n\t\t\t\t\t\t\t.attr(\"y\", Math.ceil(yAxis.yEnd) )\r\n\t\t\t\t\t\t\t.attr(\"width\", Math.ceil(colWidth) )\r\n\t\t\t\t\t\t\t.attr(\"height\", (Math.ceil(yAxis.yStart) - Math.ceil(yAxis.yEnd))+10 )\r\n\t\t\t\t\t\t\t.attr(\"opacity\", 0.0 )\r\n\t\t\t\t\t\t\t.attr(\"stroke-width\", \"0\")\r\n\t\t\t\t\t\t\t.attr(\"shape-rendering\", \"geometricPrecision\" )\r\n\t\t\t\t\t\t\t.on(\"mouseover\", function() {\r\n\r\n\r\n\t\t\t\t\t\t\t\t// necessary to avoid display conflict with 'geoname'\r\n\t\t\t\t\t\t\t\t$( \"#hoverPrompt\" ).css( \"display\", \"none\" );\t\t\r\n\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t// Fix for users of IE when the select GEOUNIT on map, and mouseout over coast line. Resets all highlighted components on map, legend and graph areas\r\n\t\t\t\t\t\t\t\t// to allow interaction wih next element.\r\n\t\t\t\t\t\t\t\tif ( previousSelection == true && highlightedGEOUNIT == false )\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tgeojson.resetStyle(previous);\r\n\t\t\t\t\t\t\t\t\td3.select(\"#geoName\").remove();\r\n\t\t\t\t\t\t\t\t\td3.select(\"#rankingText1\").remove();\r\n\t\t\t\t\t\t\t\t\td3.select(\"#rankingText2\").remove();\r\n\t\t\t\t\t\t\t\t\td3.select(\"#valbg\").remove();\r\n\t\t\t\t\t\t\t\t\td3.select(\"#highlightedVertBar\").remove();\r\n\t\t\t\t\t\t\t\t\td3.select(\"#rankGeneratedLegendHighlightBox\").remove();\r\n\t\t/*\t\t\t\t\t\t\td3.select(\"#rankGeneratedGraphHighlightBox\").remove();*/\r\n\t\t\t\t\t\t\t\t\td3.select(\"#rankGeneratedLegendHighlightBoxBorder\").remove();\r\n\t\t\t\t\t\t\t\t\t$('.toRemove').remove();\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\thighlightedGEOUNIT = false;\r\n\t\t\t\t\t\t\t\t\thasHovered = false;\r\n\t\t\t\t\t\t\t\t\tneedToRecalculateNumberInGrps = false;\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\trankMouseOver = true;\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tupdateSimpleGraph();\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t// clear local arrays \r\n\t\t\t\t\t\t\t\tp.length = 0;\r\n\t\t\t\t\t\t\t\tq.length = 0;\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t// if user has NOT selected a specific GEOUNIT via mouse click, selection list or geosearch tool\r\n\t\t\t\t\t\t\t\tif ( highlightedGEOUNIT == false )\r\n\t\t\t\t\t\t\t\t{\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t// GEOUNITValueObj is ordered as in data.js ..., NOT ranked ascending or descending ...\r\n\t\t\t\t\t\t\t\t\tfor ( var geoUnit in GEOUNITValueObj ) { p.push([geoUnit, GEOUNITValueObj[geoUnit]]); }\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t// NullGEOUNITValueObj is ordered as in data.js ..., NOT ranked ascending or descending ...\r\n\t\t\t\t\t\t\t\t\tfor ( var geoUnit in NullGEOUNITValueObj ) { q.push([geoUnit, NullGEOUNITValueObj[geoUnit]]); }\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t// populate and sort each local array into required order (one ascending, one descending)\r\n\t\t\t\t\t\t\t\t\tp.sort(function(a, b) {return b[1] - a[1]}); // ranked/ordered\t\r\n\t\t\t\t\t\t\t\t\tq.sort(function(a, b) {return a[0] - b[0]}); // ranked/ordered ascending alphabetically ...\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tp = p.concat(q);\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t// determine selected GEOUNIT feature, and its correct CD and NM\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tvar featureIndex = tempGEOUNITListing.indexOf(p[this.id][0].toString());\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tcurrentHoverOverGEOUNIT_CD = ukData.features[featureIndex].properties.GEOUNIT_CD;\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tcurrentHoverOverGEOUNIT_NM = p[this.id][0].toString();\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t// determine the selected feature's data value and geometry information from 'data.js'\r\n\t\t\t\t\t\t\t\t\tvar featureIndexVal = ukData.features[featureIndex].properties.datavalues[selectedDatasetIndex][selectedYearIndex];\r\n\t\t\t\t\t\t\t\t\tgeomType = ukData.features[featureIndex].geometry;\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t// calculate x coordinate for x-axis ranking text\r\n\t\t\t\t\t\t\t\t\trankingX = Math.ceil(rectTopLeftX);\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t// call routine to highlight selected GEOUNIT on map. allows fast interaction by user with map layer\r\n\t\t\t\t\t\t\t\t\tfixHighlightPoly();\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t// highlight vertical clear bar with complamentary colour extracted from 'colorbrewer.js'\r\n\t\t\t\t\t\t\t\t\td3.select(this)\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"opacity\", 1.0)\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"stroke\", compColour )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"fill\", compColour )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"stroke-width\", \"0\" )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"shape-rendering\", \"geometricPrecision\" );\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tvar f_size;\r\n\t\t\t\t\t\t\t\t\tvar top_pos;\r\n\t\t\t\t\t\t\t\t\tvar left_pos;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\tif ( currentHoverOverGEOUNIT_NM.length >= 0 )\r\n\t\t\t\t\t\t\t\t\t{\t\r\n\t\t\t\t\t\t\t\t\t\tf_size = \"17px\";\r\n\t\t\t\t\t\t\t\t\t\tleft_pos = \"15px\";\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tif ( currentHoverOverGEOUNIT_NM.length >= 37 )\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\tf_size = \"11px\";\r\n\t\t\t\t\t\t\t\t\t\ttop_pos = \"19px\";\r\n\t\t\t\t\t\t\t\t\t\tleft_pos = \"15px\";\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\td3.select(\"#graphSVGDiv\")\r\n\t\t\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"id\",\"geoName\")\r\n\t\t\t\t\t\t\t\t\t\t.text(currentHoverOverGEOUNIT_NM)\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"fill\", \"#0581c9\")\t\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"top\", top_pos)\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"left\", left_pos)\t\r\n\t\t\t\t\t\t\t\t\t\t.style(\"font-size\", f_size)\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"z-index\", \"+13\");\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t \tvar Ex;\r\n\t\t\t\t\t\t\t\t \tvar BgEx;\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tif ( featureIndexVal == null )\r\n\t\t\t\t\t\t\t\t\t{\t\r\n\t\t\t\t\t\t\t\t\t\t// redraw background to name label\r\n\t\t\t\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t\t\t\t.append(\"rect\")\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"id\", \"valbg\" )\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"x\", 197 )\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"y\", 55 )\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"width\", 80 )\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"height\", 30 )\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"stroke\", \"white\" )\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"fill\", \"white\" )\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"opacity\", 1.0 )\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"stroke-width\", \"0\" );\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t//\tdraw data value of selected GEOUNIT\r\n\t\t\t\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"id\",\"\")\r\n\t\t\t\t\t\t\t\t\t\t\t.text(\"No data\")\t\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"x\", xAxis.xEnd-69 )\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"y\", yAxis.yEnd+10 )\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"fill\", \"#0581c9\")\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"font-size\", \"15\");\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\telse \r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\tGEOUNITtext = featureIndexVal.toFixed(1) + variableUnitGraphRankSelectedValue[selectedDatasetIndex];\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\tif ( selectedDatasetIndex == 5 ) {\r\n\t\t\t\t\t\t\t\t\t\t\tEx = xAxis.xEnd-215;\r\n\t\t\t\t\t\t\t\t\t\t\tBgEx = xAxis.xEnd-225;\r\n\t\t\t\t\t\t\t\t\t\t\tBgW = 425;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\t\t\tEx = xAxis.xEnd-40;\r\n\t\t\t\t\t\t\t\t\t\t\tBgEx = xAxis.xEnd-50;\r\n\t\t\t\t\t\t\t\t\t\t\tBgW = 120;\r\n\t\t\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t// redraw background to name label\r\n\t\t\t\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t\t\t\t.append(\"rect\")\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"id\", \"valbg\" )\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"x\", /*131*/BgEx )\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"y\", 55 )\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"width\", /*160*/BgW )\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"height\", 30 )\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"stroke\", \"white\" )\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"fill\", \"white\" )\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"opacity\", 1.0 )\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"stroke-width\", \"0\" );\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t//\tdraw data value of selected GEOUNIT\r\n\t\t\t\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"id\",\"rankingText1\")\r\n\t\t\t\t\t\t\t\t\t\t\t.text(GEOUNITtext)\t\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"x\", /*xAxis.xEnd-136*/Ex )\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"y\", yAxis.yEnd+10 )\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"fill\", \"#0581c9\")\r\n\t\t\t\t\t\t\t\t\t\t\t.attr(\"font-size\", \"14\");\t\r\n\t\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t//\tdraw ranking text label below x-axis using rankingX[] array populated earlier\r\n\t\t\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"id\",\"rankingText2\")\r\n\t\t\t\t\t\t\t\t\t\t.text((Number(this.id)+1 + \"/\" + numElements)) // uses numElements\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"x\", RankingX[this.id]-15 )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"y\", yAxis.yStart+25 )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"fill\", \"#0581c9\")\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"font-size\", \"10\");\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t// determine required fill colour (reqFill) based on selected feature's data valueand teh data band it falls inside\r\n\t\t\t\t\t\t\t\t\t // ColorBrewer colour arrays are ordered light [array element 0] to dark [array element 'Length-1']\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tvar reqFill;\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\tif ( featureIndexVal != null )\r\n\t\t\t\t\t\t\t\t\t{\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t// initialise and set values for local variables to determine positioning of decimal place in number strings\r\n\t\t\t\t\t\t\t\t\t\tvar valueDecimalPlace = (featureIndexVal.toString()).indexOf('.');\r\n\t\t\t\t\t\t\t\t\t\tvar ValLength = (featureIndexVal.toString()).length;\r\n\t\t\t\t\t\t\t\t\t\tvar interimVal;\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t// for each data band division value\r\n\t\t\t\t\t\t\t\t\t\tfor ( var k=0; k<grades.length; k++ )\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t{\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t// determine index positions within number string that decimal place falls.\r\n\t\t\t\t\t\t\t\t\t\t\t// compare this to equivalent positons in data band divison value to\r\n\t\t\t\t\t\t\t\t\t\t\tvar checkDecimalPlace = (grades[k].toString()).indexOf('.');\r\n\t\t\t\t\t\t\t\t\t\t\tvar checkLength = (grades[k].toString()).length;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t// evaluate if data value falls inside/outside data band\r\n\t\t\t\t\t\t\t\t\t\t\tif ( (ValLength-valueDecimalPlace) > (checkLength-checkDecimalPlace) )\r\n\t\t\t\t\t\t\t\t\t\t\t{\t\r\n\t\t\t\t\t\t\t\t\t\t\t\tvar toFixedLen = checkLength-checkDecimalPlace-2;\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\tinterimVal = featureIndexVal.toFixed(toFixedLen);\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\tinterimVal = featureIndexVal;\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t// check if value is actually unusable (null/undefined)\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\tif ( interimVal != null )\r\n\t\t\t\t\t\t\t\t\t\t\t{\t\r\n\t\t\t\t\t\t\t\t\t\t\t\tvar val;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\tif ( k == 0 ) { val = -Infinity; } \r\n\t\t\t\t\t\t\t\t\t\t\t\telse { val = grades[k]; } \r\n\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\tif ( parseFloat( featureIndexVal ) >= parseFloat(val) ) \r\n\t\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tband = k;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\treqFill = getColor((grades[band]), \"drawTimeSeries\");\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t// otherwise data value is null/undefined and defaults to grey/highest band number\r\n\t\t\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\tband = grades.length;\r\n\t\t\t\t\t\t\t\t\t\t\t\treqFill = '#CCC';\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t// otherwise data value is null/undefined and defaults to grey/highest band number\r\n\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\tband = grades.length;\r\n\t\t\t\t\t\t\t\t\t\treqFill = '#CCC';\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t// draw proxy highlight box correctly positioned to overlay true legend box\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\td3.select(\"#simpleChart\")\r\n\t\t\t\t\t\t\t\t\t\t.append(\"rect\")\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"id\", \"rankGeneratedLegendHighlightBox\" )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"position\", \"absolute\" )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"x\", -4 )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"y\", 28+(18*band) )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"width\", 14 )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"height\", 14 )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"padding\", 0 )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"opacity\", $('opacitySlider').slider(\"value\") ) \t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"stroke-style\", \"solid\" )\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"stroke-width\", 0 )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"stroke\", reqFill )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"fill\", reqFill );\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t// draw proxy highlight box correctly positioned to overlay true legend box\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\td3.select(\"#simpleChart\")\r\n\t\t\t\t\t\t\t\t\t\t.append(\"rect\")\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"id\", \"rankGeneratedLegendHighlightBoxBorder\" )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"position\", \"absolute\" )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"x\", -4 )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"y\", 28+(18*band) )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"width\", 14 )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"height\", 14 )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"padding\", 0 )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"opacity\", $('opacitySlider').slider(\"value\") ) \t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"stroke-style\", \"solid\" )\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"stroke-width\", 2 )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"stroke\", compColour )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"fill\", \"none\" ); \r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t// draw proxy vertical highlight bar correctly positioned inside legend\r\n\t\t\t\t\t\t\t\t\t// vertical highlight bar to simple count graph\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\td3.select(\"#simpleChart\")\r\n\t\t\t\t\t\t\t\t\t\t.append(\"rect\")\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"id\", \"rankGeneratedGraphHighlightBox\" )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"position\", \"absolute\" )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"x\", 83 )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"y\", 27+(18*band) )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"width\", 5 )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"height\", 16 )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"padding\", 0 )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"opacity\", $('opacitySlider').slider(\"value\") ) \t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"stroke-style\", \"solid\" )\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"stroke-width\", 0 )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"stroke\", compColour )\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"fill\", compColour); \r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t})\r\n\t\t\t\t\t\t\t.on(\"mouseout\", function() {\r\n\r\n\r\n\t\t\t\t\t\t\t\t// necessary to avoid display conflict with 'geoname'\r\n\t\t\t\t\t\t\t\tif ( graphType != \"Rank\" ) {\r\n\t\t\t\t\t\t\t\t\t$( \"#hoverPrompt\" ).css( \"display\", \"inline\" );\t\t\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\trankMouseOver = false;\r\n\t\t\t\t\t\t\t\tpreviousSelection = false;\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t// after user exits interaction with ranking graph, reset highlight/opacity to null of overlain vertical bar\r\n\t\t\t\t\t\t\t\t// remove relevant text labels\r\n\t\t\t\t\t\t\t\t// remove highlighting polygon on map\r\n\t\t\t\t\t\t\t\tif ( highlightedGEOUNIT == false )\r\n\t\t\t\t\t\t\t\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\td3.select(this)\r\n\t\t\t\t\t\t\t\t\t\t.attr(\"opacity\", 0.0);\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\td3.select(\"#geoName\").remove();\t \r\n\t\t\t\t\t\t\t\t\td3.select(\"#valbg\").remove();\r\n\t\t\t\t\t\t\t\t\td3.select(\"#rankingText1\").remove();\r\n\t\t\t\t\t\t\t\t\td3.select(\"#rankingText2\").remove();\r\n\t\t\t\t\t\t\t\t\td3.select(\"#rankGeneratedLegendHighlightBox\").remove();\r\n\t\t\t\t\t\t\t\t\td3.select(\"#rankGeneratedGraphHighlightBox\").remove();\r\n\t\t\t\t\t\t\t\t\td3.select(\"#rankGeneratedLegendHighlightBoxBorder\").remove();\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tmap.removeLayer(unitPolygon);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t});\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// increment j in certain circumstances\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t if ( tempArray[i] == tempArray[i-1] ) {} \r\n\t\t\t\t\t\t\telse if ( tempArray[i] != tempArray[i-1] ) { j++; }\r\n\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\trectNumber++; \r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// redraw maximum value on top of y-axis\t\t\t\t\t\t\t\r\n\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t.attr(\"id\",\"maxVal\")\r\n\t\t\t\t\t\t.text(/*MaxValToUse.toFixed(1) + */variableUnitGraphRankSelectedValue[selectedDatasetIndex])\r\n\t\t\t\t\t\t.attr(\"x\", yAxis.xEnd-32 )\r\n\t\t\t\t\t\t.attr(\"y\", yAxis.yEnd-10 )\r\n\t\t\t\t\t\t.attr(\"fill\", \"#909090\")\r\n\t\t\t\t\t\t.attr(\"font-size\", \"10\");\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// redraw number of considered units on end of x-Axis\t\t\t\t\t\t\r\n\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t.attr(\"id\",\"GEOUNITCount\")\r\n\t\t\t\t\t\t.text(numElements) \r\n\t\t\t\t\t\t.attr(\"x\", xAxis.xEnd+5 )\r\n\t\t\t\t\t\t.attr(\"y\", yAxis.yStart )\r\n\t\t\t\t\t\t.attr(\"fill\", \"#909090\")\r\n\t\t\t\t\t\t.attr(\"font-size\", \"10\");\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t// redraw X-Axis to rank graph ...\r\n\t\t\t\t\td3.select(\"#mainChart\")\t\r\n\t\t\t\t\t\t.append(\"line\")\r\n\t\t\t\t\t\t.attr(\"id\",\"xAxis\")\r\n\t\t\t\t\t\t.attr(\"x1\", xAxis.xStart)\r\n\t\t\t\t\t\t.attr(\"y1\", xAxis.yStart)\r\n\t\t\t\t\t\t.attr(\"x2\", xAxis.xEnd+1)\r\n\t\t\t\t\t\t.attr(\"y2\", xAxis.yEnd)\r\n\t\t\t\t\t\t.attr(\"stroke\", \"#909090\")\r\n\t\t\t\t\t\t.attr(\"stroke-width\", \"1\");\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t// redraw Y-Axis to rank graph ...\t\t\t\t\t\t\r\n\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t.append(\"line\")\r\n\t\t\t\t\t\t.attr(\"id\",\"yAxis\")\r\n\t\t\t\t\t\t.attr(\"x1\", yAxis.xStart)\r\n\t\t\t\t\t\t.attr(\"y1\", yAxis.yStart)\r\n\t\t\t\t\t\t.attr(\"x2\", yAxis.xEnd)\r\n\t\t\t\t\t\t.attr(\"y2\", yAxis.yEnd)\r\n\t\t\t\t\t\t.attr(\"stroke\", \"#909090\")\r\n\t\t\t\t\t\t.attr(\"stroke-width\", \"1\");\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t// redraw horizontal trendline for dataset/data year selected by user\r\n\t\t\t\t\tif ( trendLine[selectedDatasetIndex][selectedYearIndex] != null )\r\n\t\t\t\t\t{\t\t\t\t\t\t\t\r\n\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t.append(\"line\")\r\n\t\t\t\t\t\t\t.attr(\"id\",\"trendLine\")\r\n\t\t\t\t\t\t\t.attr(\"x1\", xAxis.xStart) \r\n\t\t\t\t\t\t\t.attr(\"y1\", yAxis.yStart-(trendLine[selectedDatasetIndex][selectedYearIndex]*yScale) ) \r\n\t\t\t\t\t\t\t.attr(\"x2\", xAxis.xEnd)\r\n\t\t\t\t\t\t\t.attr(\"y2\", yAxis.yStart-(trendLine[selectedDatasetIndex][selectedYearIndex]*yScale) )\r\n\t\t\t\t\t\t\t.attr(\"stroke\",compColour)\r\n\t\t\t\t\t\t\t.attr(\"stroke-width\", \"1\");\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// write geocoverage abbrevation taken from config.js file\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t.attr(\"id\", \"geoCoverageLabel\")\r\n\t\t\t\t\t\t\t.text(geoCoverageAbbrev)\r\n\t\t\t\t\t\t\t.attr(\"x\", (xAxis.xEnd)+5 )\r\n\t\t\t\t\t\t\t.attr(\"y\", yAxis.yStart-(trendLine[selectedDatasetIndex][selectedYearIndex]*yScale)+3 )\r\n\t\t\t\t\t\t\t.attr(\"fill\", \"#909090\")\r\n\t\t\t\t\t\t\t.style(\"font-size\", \"10\");\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// write additional sufix text to geocoverage abbrevation taken from config.js file\t\t\t\t\t\t\t\r\n\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t.attr(\"id\", \"addText\")\r\n\t\t\t\t\t\t\t.text(addText)\r\n\t\t\t\t\t\t\t.attr(\"x\", (xAxis.xEnd)+18 )\r\n\t\t\t\t\t\t\t.attr(\"y\", yAxis.yStart-(trendLine[selectedDatasetIndex][selectedYearIndex]*yScale)+3 )\r\n\t\t\t\t\t\t\t.attr(\"fill\", \"#909090\")\r\n\t\t\t\t\t\t\t.attr(\"font-size\", \"10px\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// write \"No data available\" string\t\t\t\t\t\t\t\r\n\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t.attr(\"id\", \"NoDataStr\")\r\n\t\t\t\t\t\t\t.text(\"No data available\")\r\n\t\t\t\t\t\t\t.attr(\"x\", 90 )\r\n\t\t\t\t\t\t\t.attr(\"y\", 150 )\r\n\t\t\t\t\t\t\t.attr(\"fill\", \"#909090\")\r\n\t\t\t\t\t\t\t.style(\"font-size\", \"18px\");\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t}// END DEFAULT GRAPH DRAWING; RANKING GRAPH, INCLUDING INVISIBLE COLUMNS TO AID INTERACTION\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t// entered if user interacts with map and time-seies is selected in 'graph-drop' (and a time-series graph is required).\t\t\t\t\t\t\t\r\n\t\t\t\tif( ( hasHovered == true || highlightedGEOUNIT == true ) && graphType==\"Time-series\" && subDataArrayLength > 1 )\r\n\t\t\t\t{ \r\n\t\t\t\t\t\r\n\t\r\n\t\t\t\t\t$( \"#hoverPrompt\" ).css( \"display\", \"none\" );\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t// innitialize specific buffer sizes for mgraphing area\t\r\n\t\t\t\t\t// define constaints of viewbox area\r\n\t\t\t\t\tvar vbBufferTop = 10;\r\n\t\t\t\t\tvar vbBufferBottom = 10;\r\n\t\t\t\t\tvar vbBufferLeft = 30;\r\n\t\t\t\t\tvar vbBufferRight = 30;\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// iniitalise local arrays for holding line vertex coordinates\r\n\t\t\t\t\tvar lineXCoords = [];\r\n\t\t\t\t\tvar lineYCoords = [];\r\n\t\t\t\t\tvar AvelineXCoords= [];\r\n\t\t\t\t\t\r\n\t\t\t\t\tvar f_size;\r\n\t\t\t\t\tvar top_pos;\r\n\t\t\t\t\tvar left_pos;\r\n\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\tif ( currentHoverOverGEOUNIT_NM.length >= 0 )\r\n\t\t\t\t\t{\t\r\n\t\t\t\t\t\tf_size = \"17px\";\r\n\t\t\t\t\t\tleft_pos = \"15px\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( currentHoverOverGEOUNIT_NM.length >= 37 )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tf_size = \"11px\";\r\n\t\t\t\t\t\ttop_pos = \"19px\";\r\n\t\t\t\t\t\tleft_pos = \"15px\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\td3.select(\"#graphSVGDiv\")\r\n\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t.attr(\"id\",\"geoName\")\r\n\t\t\t\t\t\t.text(currentHoverOverGEOUNIT_NM)\r\n\t\t\t\t\t\t.attr(\"fill\", \"#0581c9\")\t\r\n\t\t\t\t\t\t.attr(\"top\", top_pos)\r\n\t\t\t\t\t\t.attr(\"left\", left_pos)\t\r\n\t\t\t\t\t\t.style(\"font-size\", f_size)\r\n\t\t\t\t\t\t.attr(\"z-index\", \"+13\");\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// determine viewbox dimensions based on canvas and buffer sizes\t\t\t\t\t\r\n\t\t\t\t\tvar viewBoxWidth = canvasArea.width - vbBufferRight - vbBufferLeft;\r\n\t\t\t\t\tvar viewBoxHeight = canvasArea.height - vbBufferTop - vbBufferBottom;\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// define y- and x-axis dimensions\r\n\t\t\t\t\txAxis = { xStart : vbBufferLeft , xEnd : viewBoxWidth - vbBufferRight , yStart : 250 , yEnd : 250 };\r\n\t\t\t\t\tyAxis = { xStart : vbBufferLeft , xEnd : vbBufferLeft , yStart : 250 , yEnd : 65 };\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// declare main chart area viewbox specification\r\n\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t.attr(\"viewBox\", \"0 0 \" + viewBoxWidth + \" \" + viewBoxHeight);\r\n\t\t\t\t\tvar AvelineYCoords= [];\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t//\tconstruct and execute string to generate required main array of data values; make copy\r\n\t\t\t\t\tvar mainArray = arrayNames[selectedDatasetIndex];\r\n\t\t\t\t\tvar storeAsTempArray = \"tempArray = \" + mainArray;\r\n\t\t\t\t\teval(storeAsTempArray);\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t// start building string to generate max value array to determine max Val of data considered to draw y-axis\r\n\t\t\t\t\tvar maxArray = arrayMaxNames[selectedDatasetIndex];\r\n\t\t\t\t\tvar storeArrayMaxAsMaxVal = \"MaxVal = \" + maxArray + \"[\";\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// determine frequency of tick marking on graphs based on number of geography units lsited in 'data.js'\r\n\t\t\t\t\tif ( (endYear-startYear) >= 0 ) { tickFrequency = 1; }\r\n\t\t\t\t\tif ( (endYear-startYear) >= 10 ) { tickFrequency = 2; }\r\n\t\t\t\t\tif ( (endYear-startYear) >= 20 ) { tickFrequency = 5; }\r\n\t\t\t\t\tif ( (endYear-startYear) >= 50 ) { tickFrequency = 10; }\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t// for each year\r\n\t\t\t\t\tfor (var i=0; i<subDataArrayLength; i++) \r\n\t\t\t\t\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t// construct interative string to build max array, and execute\r\n\t\t\t\t\t\tstoreArrayMaxAsMaxVal = storeArrayMaxAsMaxVal + i + \"]\";\t\t\t\t\t\t\r\n\t\t\t\t\t\teval(storeArrayMaxAsMaxVal);\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// logical checek to check and update maxmimum data value if required.\r\n\t\t\t\t\t\t// calculate y axis scaling accoridng to 'MaxVal'\r\n\t\t\t\t\t\tif( MaxVal > MaxValToUse) { MaxValToUse = MaxVal; }\t\t\t\t\t\t\r\n//\t\t\t\t\t\tyScale = (yAxis.yStart - yAxis.yEnd) / Math.ceil(MaxValToUse);\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// calculate time parameters required\r\n\t\t\t\t\t\tvar yearIntervalWidth = ( xAxis.xEnd-xAxis.xStart ) / (subDataArrayLength-1);\r\n\t\t\t\t\t\tvar year = startYear + (i*yearInterval);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\tif ( (i)%tickFrequency==0 )\r\n\t\t\t\t\t\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// add x-axis 'year' label\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t.attr(\"class\",\"xAxisLabels\")\r\n\t\t\t\t\t\t\t\t.text(year)\r\n\t\t\t\t\t\t\t\t.attr(\"x\", (margin.left+(yearIntervalWidth*i))+5 )\r\n\t\t\t\t\t\t\t\t.attr(\"y\", yAxis.yStart+25 )\r\n\t\t\t\t\t\t\t\t.attr(\"font-size\", \"10px\")\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"#909090\");\r\n\r\n\t\t\t\t\t\t\t//draw x-Axis tick marks\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"line\")\r\n\t\t\t\t\t\t\t\t.attr(\"class\",\"tickMarks\")\r\n\t\t\t\t\t\t\t\t.attr(\"x1\", (margin.left+(yearIntervalWidth*i))+15 )\r\n\t\t\t\t\t\t\t\t.attr(\"y1\", yAxis.yStart)\r\n\t\t\t\t\t\t\t\t.attr(\"x2\", (margin.left+(yearIntervalWidth*i))+15 )\r\n\t\t\t\t\t\t\t\t.attr(\"y2\", yAxis.yStart+5)\r\n\t\t\t\t\t\t\t\t.attr(\"stroke\", \"#CCC\")\r\n\t\t\t\t\t\t\t\t.attr(\"stroke-width\", \"3\")\r\n\t\t\t\t\t\t\t\t.style(\"stroke-dasharray\", (\"5, 2\"));\r\n\t\t\t\t\t\t}\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// executed if year selected on time-slider equals current iteration year\r\n\t\t\t\t\t\tif( i == selectedYearIndex )\r\n\t\t\t\t\t\t{\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t//draw vertical highlight-year line\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t.append(\"line\")\r\n\t\t\t\t\t\t\t\t.attr(\"id\",\"highlightLine\")\r\n\t\t\t\t\t\t\t\t.attr(\"x1\", xAxis.xStart+(yearIntervalWidth*i))\r\n\t\t\t\t\t\t\t\t.attr(\"y1\", yAxis.yEnd-1)\r\n\t\t\t\t\t\t\t\t.attr(\"x2\", xAxis.xStart+(yearIntervalWidth*i))\r\n\t\t\t\t\t\t\t\t.attr(\"y2\", yAxis.yStart+10)\r\n\t\t\t\t\t\t\t\t.attr(\"stroke\", \"#CCC\")\r\n\t\t\t\t\t\t\t\t.attr(\"stroke-width\", \"3\")\r\n\t\t\t\t\t\t\t\t.style(\"stroke-dasharray\", (\"5, 2\"));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n//\t\t\t\t\t\t// fix for DVC163 - does not calculate coordinates for final value (as is null)\r\n//\t\t\t\t\t\tif ( tempArray[i][indexOfCurrentHoverOverGEOUNIT_CD] == null )\r\n//\t\t\t\t\t\t{\r\n//\t\t\t\t\t\t\tlineXCoords[i] = lineXCoords[i-1];\r\n//\t\t\t\t\t\t\tlineYCoords[i] = lineYCoords[i-1];\r\n//\t\t\t\t\t\t\tcontinue;\r\n//\t\t\t\t\t\t} \r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t//store coordinates for time-series line to plot in 'for' loop below \r\n//\t\t\t\t\t\tlineXCoords[i] = xAxis.xStart+(yearIntervalWidth*i);\r\n//\t\t\t\t\t\tlineYCoords[i] = (xAxis.yStart-(tempArray[i][indexOfCurrentHoverOverGEOUNIT_CD]*yScale));\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\tstoreArrayMaxAsMaxVal = \"MaxVal = \" + maxArray + \"[\";\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\r\n\r\n\r\n\t\t\t\t\t// to fix bug found with scaling of multiple years across a dataset. Moved from outside the previous for lop\r\n\t\t\t\t\tyScale = (yAxis.yStart - yAxis.yEnd) / Math.ceil(MaxValToUse);\r\n\t\t\t\t\t\r\n\r\n\t\t\t\t\tfor (var i=0; i<subDataArrayLength; i++) \r\n\t\t\t\t\t{ \r\n\t\t\t\t\t\t//store coordinates for time-series line to plot in 'for' loop below \r\n\t\t\t\t\t\tlineXCoords[i] = xAxis.xStart+(yearIntervalWidth*i);\r\n\t\t\t\t\t\tlineYCoords[i] = (xAxis.yStart-(tempArray[i][indexOfCurrentHoverOverGEOUNIT_CD]*yScale));\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t//store coordinates for 'mean' trend line if values exist to plot in 'for' loop below\r\n\t\t\t\t\tif ( trendLine.length != 0 )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tfor(var t=0; t<trendLine[selectedDatasetIndex].length; t++ ) \r\n\t\t\t\t\t\t{\t\r\n\t\t\t\t\t\t\tif ( trendLine[selectedDatasetIndex][t] == null )\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tAvelineXCoords[t] = AvelineXCoords[t-1];\r\n\t\t\t\t\t\t\t\tAvelineYCoords[t] = AvelineYCoords[t-1];\r\n\t\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t\t} \r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tvar trendLineValue = trendLine[selectedDatasetIndex][t];\r\n\t\t\t\t\t\t\tAvelineXCoords[t] = xAxis.xStart+(yearIntervalWidth*t);\r\n\t\t\t\t\t\t\tAvelineYCoords[t] = (xAxis.yStart-(trendLineValue*yScale));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t//\teach element/year in data sub-array, except the final one\r\n\t\t\t\t\tfor(i=0; i<subDataArrayLength-1; i++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t// fudge for DVC163 - avoids printing time-series for NI areas with null values for whole time-series\r\n\t\t\t\t\t\tif ( currentHoverOverGEOUNIT_CD == 'UKN01' || currentHoverOverGEOUNIT_CD == 'UKN02' || currentHoverOverGEOUNIT_CD == 'UKN03' || currentHoverOverGEOUNIT_CD == 'UKN04' || currentHoverOverGEOUNIT_CD == 'UKN05' ) {\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// don't draw any lines, but instead text strings stating area has null/undefined values\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t.attr(\"id\",\"noDataAvailableLabel\")\r\n\t\t\t\t\t\t\t\t.text(\"No data available\")\r\n\t\t\t\t\t\t\t\t.attr(\"x\", xAxis.xStart+((xAxis.xEnd-xAxis.xStart)/5) )\r\n\t\t\t\t\t\t\t\t.attr(\"y\", yAxis.yEnd+((yAxis.yStart-yAxis.yEnd)/2) )\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"#A8A8A8\")\r\n\t\t\t\t\t\t\t\t.attr(\"font-size\", \"20px\");\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// if user has selected a GEOUNIT by clicking mouse, using seelction list or using geosearch tool,\r\n\t\t\t\t\t\t// and data exists to plot trend/value lines\r\n\t\t\t\t\t\tif( ( hasHovered == true || highlightedGEOUNIT == true ) && checkTest == false )\r\n\t\t\t\t\t\t{\t\r\n\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\t// plot component of GEOUNIT time-series line, between current point and next point\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\").append(\"line\")\r\n\t\t\t\t\t\t\t\t.attr(\"id\", \"timeSeriesLine\")\r\n\t\t\t\t\t\t\t\t.attr(\"x1\", lineXCoords[i] )\r\n\t\t\t\t\t\t\t\t.attr(\"y1\", lineYCoords[i] )\r\n\t\t\t\t\t\t\t\t.attr(\"x2\", lineXCoords[i+1] )\r\n\t\t\t\t\t\t\t\t.attr(\"y2\", lineYCoords[i+1] )\r\n\t\t\t\t\t\t\t\t.attr(\"stroke\", compColour)\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", compColour)\r\n\t\t\t\t\t\t\t\t.attr(\"stroke-width\", \"2\");\r\n\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\t// plot component of mean line, between current point and next point\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\").append(\"line\")\r\n\t\t\t\t\t\t\t\t.attr(\"id\", \"trendLine\")\r\n\t\t\t\t\t\t\t\t.attr(\"x1\", AvelineXCoords[i] )\r\n\t\t\t\t\t\t\t\t.attr(\"y1\", AvelineYCoords[i] )\r\n\t\t\t\t\t\t\t\t.attr(\"x2\", AvelineXCoords[i+1] )\r\n\t\t\t\t\t\t\t\t.attr(\"y2\", AvelineYCoords[i+1] )\r\n\t\t\t\t\t\t\t\t.attr(\"stroke\", \"black\")\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"black\")\r\n\t\t\t\t\t\t\t\t.attr(\"stroke-width\", \"2\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// area has null/undefined values\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// don't draw any lines, but instead text strings stating area has null/undefined values\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t.attr(\"id\",\"noDataAvailableLabel\")\r\n\t\t\t\t\t\t\t\t.text(\"No data available\")\r\n\t\t\t\t\t\t\t\t.attr(\"x\", xAxis.xStart+((xAxis.xEnd-xAxis.xStart)/5) )\r\n\t\t\t\t\t\t\t\t.attr(\"y\", yAxis.yEnd+((yAxis.yStart-yAxis.yEnd)/2) )\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"#A8A8A8\")\r\n\t\t\t\t\t\t\t\t.attr(\"font-size\", \"20px\");\r\n\t\t\t\t\t\t}\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t// if data exists for selected GEOUNIT\t\t\t\t\t\r\n\t\t\t\t\tif( ( hasHovered == true || highlightedGEOUNIT == true ) && checkTest == false ) \r\n\t\t\t\t\t{\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t// draw geographic extent abbreviation at right hand end of trend line - flexible for lines not ending at final year value\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t.attr(\"id\", \"geoCoverageLabel\")\r\n\t\t\t\t\t\t\t\t.text(geoCoverageAbbrev)\r\n\t\t\t\t\t\t\t\t.attr(\"x\", (lineXCoords[lineXCoords.length-1])+5 )\r\n\t\t\t\t\t\t\t\t.attr(\"y\", AvelineYCoords[AvelineYCoords.length-1]+3 )\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"#909090\")\r\n\t\t\t\t\t\t\t\t.style(\"font-size\", \"10\");\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t// write additional sufix text to geocoverage abbrevation taken from config.js file\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t.attr(\"id\", \"addText\")\r\n\t\t\t\t\t\t\t\t.text(addText)\r\n\t\t\t\t\t\t\t\t.attr(\"x\", (lineXCoords[lineXCoords.length-1])+18 )\r\n\t\t\t\t\t\t\t\t.attr(\"y\", AvelineYCoords[AvelineYCoords.length-1]+3 )\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"#909090\")\r\n\t\t\t\t\t\t\t\t.attr(\"font-size\", \"10px\");\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t// redraw maximum value on top of y-axis\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t.attr(\"id\",\"maxVal\")\r\n\t\t\t\t\t\t\t\t.text(/*MaxValToUse.toFixed(1) + */variableUnitGraphYAxis[selectedDatasetIndex])\r\n\t\t\t\t\t\t\t\t.attr(\"x\", yAxis.xEnd-32 )\r\n\t\t\t\t\t\t\t\t.attr(\"y\", yAxis.yEnd-10 )\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"#909090\")\r\n\t\t\t\t\t\t\t\t.attr(\"font-size\", \"10\");\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// determine tick frequency for y-axis based on max value detemiend from all data\t\t\t\t\t\r\n\t\t\t\t\tif ( MaxValToUse >= 0 ) { tickFrequency = 1; }\r\n\t\t\t\t\tif ( MaxValToUse >= 10 ) { tickFrequency = 2; }\r\n\t\t\t\t\tif ( MaxValToUse >= 25 ) { tickFrequency = 5; }\r\n\t\t\t\t\tif ( MaxValToUse >= 50 ) { tickFrequency = 10; }\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// draw y-axis labels and tick marks\r\n\t\t\t\t\tfor ( var i=0; i<=MaxValToUse; i++ )\r\n\t\t\t\t\t{\t\t\t\r\n\t\t\t\t\t\tif ( (i)%tickFrequency==0 )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// calculate y-coordinate to draw axis label and tick mark at\r\n\t\t\t\t\t\t\t// draw y-axis labels\t\t\t\t\r\n\t\t\t\t\t\t\tvar yVal = (yAxis.yStart-(yScale*i));\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t.attr(\"class\",\"yAxisLabels\")\r\n\t\t\t\t\t\t\t\t.text(i.toFixed(1))\r\n\t\t\t\t\t\t\t\t.attr(\"x\", xAxis.xStart-33 )\r\n\t\t\t\t\t\t\t\t.attr(\"y\", yVal+3 )\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"#909090\")\r\n\t\t\t\t\t\t\t\t.attr(\"font-size\", \"9px\");\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t// draw y-axis ticks\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\").append(\"line\")\r\n\t\t\t\t\t\t\t\t.attr(\"class\",\"yAxisTicks\")\r\n\t\t\t\t\t\t\t\t.attr(\"x1\", xAxis.xStart)\r\n\t\t\t\t\t\t\t\t.attr(\"y1\", yVal)\r\n\t\t\t\t\t\t\t\t.attr(\"x2\", xAxis.xStart-5)\r\n\t\t\t\t\t\t\t\t.attr(\"y2\", yVal)\r\n\t\t\t\t\t\t\t\t.attr(\"stroke\", \"#707070\")\r\n\t\t\t\t\t\t\t\t.attr(\"stroke-width\", \"1\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t// draw X-axis\r\n\t\t\t\t\td3.select(\"#mainChart\")\t\r\n\t\t\t\t\t\t.append(\"line\")\r\n\t\t\t\t\t\t.attr(\"id\",\"xAxis\")\r\n\t\t\t\t\t\t.attr(\"x1\", xAxis.xStart)\r\n\t\t\t\t\t\t.attr(\"y1\", xAxis.yStart)\r\n\t\t\t\t\t\t.attr(\"x2\", xAxis.xEnd+1)\r\n\t\t\t\t\t\t.attr(\"y2\", xAxis.yEnd)\r\n\t\t\t\t\t\t.attr(\"stroke\", \"#909090\")\r\n\t\t\t\t\t\t.attr(\"stroke-width\", \"2\");\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t// draw Y-axis\r\n\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t.append(\"line\")\r\n\t\t\t\t\t\t.attr(\"id\",\"yAxis\")\r\n\t\t\t\t\t\t.attr(\"x1\", yAxis.xStart)\r\n\t\t\t\t\t\t.attr(\"y1\", yAxis.yStart)\r\n\t\t\t\t\t\t.attr(\"x2\", yAxis.xEnd)\r\n\t\t\t\t\t\t.attr(\"y2\", yAxis.yEnd)\r\n\t\t\t\t\t\t.attr(\"stroke\", \"#909090\")\r\n\t\t\t\t\t\t.attr(\"stroke-width\", \"2\");\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t} // END DRAW TIME-SERIES GRAPH ...\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t// draws vertical GEOUNIT Highlight bar when user hover overs map, and 'Rank\" is selected in 'graph-drop'\r\n\t\t\t\telse if( ( hasHovered == true || highlightedGEOUNIT == true ) && graphType==\"Rank\" )\t\t\r\n\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\td3.select(\"#geoName\").remove();\r\n\t\t\t\t\t\r\n\t\t\t\t\tvar f_size;\r\n\t\t\t\t\tvar top_pos;\r\n\t\t\t\t\tvar left_pos;\r\n\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\tif ( currentHoverOverGEOUNIT_NM.length >= 0 )\r\n\t\t\t\t\t{\t\r\n\t\t\t\t\t\tf_size = \"17px\";\r\n\t\t\t\t\t\tleft_pos = \"15px\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( currentHoverOverGEOUNIT_NM.length >= 37 )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tf_size = \"11px\";\r\n\t\t\t\t\t\ttop_pos = \"19px\";\r\n\t\t\t\t\t\tleft_pos = \"15px\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\td3.select(\"#graphSVGDiv\")\r\n\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t.attr(\"id\",\"geoName\")\r\n\t\t\t\t\t\t.text(currentHoverOverGEOUNIT_NM)\r\n\t\t\t\t\t\t.attr(\"fill\", \"#0581c9\")\t\r\n\t\t\t\t\t\t.attr(\"top\", top_pos)\r\n\t\t\t\t\t\t.attr(\"left\", left_pos)\t\r\n\t\t\t\t\t\t.style(\"font-size\", f_size)\r\n\t\t\t\t\t\t.attr(\"z-index\", \"+13\");\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// if true usable dta exists for selected GEOUNIT\r\n\t\t\t\t\tif ( checkTest == false )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// initialise local variables\r\n\t\t\t\t\t\tvar HighlightRectDimensions = new Array();\r\n\t\t\t\t\t\tvar p = []; \t\r\n\t\t\t\t\t\tvar\tcumulativeColWidth = 0;\t\r\n\t\t\t\t\t\tvar\trectTopLeftY = 0.0;\r\n\t\t\t\t\t\tvar rectNumber = -1;\t\t\t\r\n\t\t\t\t\t\tvar colWidth = 0.0;\t\r\n\t\t\t\t\t\tvar geoRank = -1;\t\t\r\n\t\t\t\t\t\tvar j=0;\r\n\t\t\t\t\t\tvar GEOUNITValueObjRank = {}; //create object containing key(geoName):value(value) pairs' disciminates beween usuable values and unusable/null values\t\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t// for each geography unit listed in 'data.js'\t\t\t\t\t\r\n\t\t\t\t\t\tfor ( var i=0; i<numElements; i++ )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// initialise local variables\r\n\t\t\t\t\t\t\trectTopLeftY = 0.0;\r\n\t\t\t\t\t\t\tcolWidth = 0.0;\r\n\t\t\t\t\t\t\tcolHeight = 0;\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// copy current feature's data values into object\r\n\t\t\t\t\t\t\tGEOUNITValueObjRank[GEOUNIT_Name[i]] = tempArray2[i];\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// if feature object does not have any data values associated with it , loop to next interation\r\n\t\t\t\t\t\t\tif ( tempArray[i] == undefined ) { continue; }\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// otherwise, check to see it array specifc to hold parameters for highlighting specific transparent vertical bar in ranking graph\r\n\t\t\t\t\t\t\tif ( typeof HighlightRectDimensions === 'undefined' ) { HighlightRectDimensions = new Array(7); }\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t// recalculate dimensions specific to instance of vertical bar \r\n\t\t\t\t\t\t\trectTopLeftX = vbBufferLeft+(i*geoUnitColumnIntervalWidth);\t\t\t\r\n\t\t\t\t\t\t\trectTopLeftY = (xAxis.yStart-(tempArray[i]*yScale));\r\n\t\t\t\t\t\t\tcolWidth = geoUnitColumnIntervalWidth;\r\n\t\t\t\t\t\t\tcolHeight = (tempArray[i]*yScale);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// if data value of current iteration equals that of selected GEOUNIT, this must be the GEOUNIT to highlight in map/ranking graph\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif ( tempArray[i] == selectedGEOUNITVariables[selectedDatasetIndex] )\r\n\t\t\t\t\t\t\t{\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t// define specific parameters specific to highlighting vertical bar\r\n\t\t\t\t\t\t\t\tHighlightRectDimensions[0] = rectNumber; // specific ID for highlight bar\r\n\t\t\t\t\t\t\t\tHighlightRectDimensions[1] = tempArray[i]; // GEOUNIT value\r\n\t\t\t\t\t\t\t\tHighlightRectDimensions[2] = Math.ceil(rectTopLeftX); // rect top left x coordinate value\r\n\t\t\t\t\t\t\t\tHighlightRectDimensions[3] = Math.ceil(yAxis.yEnd);\t// rect top left y coordinate value\t\t\t \r\n\t\t\t\t\t\t\t\tHighlightRectDimensions[4] = Math.ceil(colWidth); // rect width\r\n\t\t\t\t\t\t\t\tHighlightRectDimensions[5] = Math.ceil(yAxis.yStart) - Math.ceil(yAxis.yEnd)+10;\t\r\n\t\t\t\t\t\t\t\tHighlightRectDimensions[6] = compColour; // complamentary colour\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\trectNumber++; \t\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// draw specific vertical highlight bar over coloured representation of GEOUNIT selected \r\n\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t .append(\"rect\")\r\n\t\t\t\t\t\t .attr(\"id\", \"highlightedVertBar\" /*HighlightRectDimensions[0]*/ )\r\n\t\t\t\t\t\t .attr(\"x\", HighlightRectDimensions[2] )\r\n\t\t\t\t\t\t .attr(\"y\", HighlightRectDimensions[3] )\r\n\t\t\t\t\t\t .attr(\"width\", HighlightRectDimensions[4] )\r\n\t\t\t\t\t\t .attr(\"height\", HighlightRectDimensions[5] )\r\n\t\t\t\t\t\t .attr(\"stroke\", HighlightRectDimensions[6] )\r\n\t\t\t\t\t\t .attr(\"fill\", HighlightRectDimensions[6] )\r\n\t\t\t\t\t\t .attr(\"opacity\", 1.0 )\r\n\t\t\t\t\t\t .attr(\"stroke-width\", \"0\" )\r\n\t\t\t\t\t\t .attr(\"shape-rendering\", \"geometricPrecision\" );\r\n\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t// push object key:value pairs into temporary array to determine ranking of selected GEOUNIT from all GEOUNITs ranking in descending fashion\r\n\t\t\t\t\t\tfor ( var geoUnit in GEOUNITValueObjRank ) { p.push([geoUnit, GEOUNITValueObjRank[geoUnit]]); }\r\n\t\t\t\t\t\tp.sort(function(a, b) {return b[1] - a[1]});\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tvar selectedRank = -1;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// for each element in array\r\n\t\t\t\t\t\tfor (var key in p)\r\n\t\t\t\t\t\t{\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// if key is tru object value\r\n\t\t\t\t\t\t\tif (p.hasOwnProperty(key))\r\n\t\t\t\t\t\t\t{\t\t\t\t\t\t\t\t\r\n\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t// p[key][0] = selected GEOUNIT_NA\r\n\t\t\t\t\t\t\t\tif(\tcurrentHoverOverGEOUNIT_NM == p[key][0].toString() ) { selectedRank = parseInt(key)+1; }\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t \tvar Ex;\r\n\t\t\t\t\t \tvar BgEx;\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif ( (selectedGEOUNITVariables[selectedDatasetIndex]) != null )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif ( selectedDatasetIndex == 5 ) {\r\n\t\t\t\t\t\t\t\tEx = xAxis.xEnd-215;\r\n\t\t\t\t\t\t\t\tBgEx = xAxis.xEnd-225;\r\n\t\t\t\t\t\t\t\tBgW = 425;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\tEx = xAxis.xEnd-40;\r\n\t\t\t\t\t\t\t\tBgEx = xAxis.xEnd-50;\r\n\t\t\t\t\t\t\t\tBgW = 120;\r\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// redraw background to name label\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"rect\")\r\n\t\t\t\t\t\t\t\t.attr(\"id\", \"valbg\" )\r\n\t\t\t\t\t\t\t\t.attr(\"x\", /*131*/BgEx )\r\n\t\t\t\t\t\t\t\t.attr(\"y\", 55 )\r\n\t\t\t\t\t\t\t\t.attr(\"width\", /*160*/BgW )\r\n\t\t\t\t\t\t\t\t.attr(\"height\", 30 )\r\n\t\t\t\t\t\t\t\t.attr(\"stroke\", \"white\" )\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"white\" )\r\n\t\t\t\t\t\t\t\t.attr(\"opacity\", 1.0 )\r\n\t\t\t\t\t\t\t\t.attr(\"stroke-width\", \"0\" );\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t//\tdraw data value of selected GEOUNIT\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t.attr(\"id\",\"rankingText1\")\r\n\t\t\t\t\t\t\t\t.text((selectedGEOUNITVariables[selectedDatasetIndex]).toFixed(1) + variableUnitGraphRankSelectedValue[selectedDatasetIndex])\t\r\n\t\t\t\t\t\t\t\t.attr(\"x\", /*xAxis.xEnd-136*/Ex )\r\n\t\t\t\t\t\t\t\t.attr(\"y\", yAxis.yEnd+10 )\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"#0581c9\")\r\n\t\t\t\t\t\t\t\t.attr(\"font-size\", \"14\");\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse \r\n\t\t\t\t\t\t{\t\r\n\t\t\t\t\t\t\t// redraw background to name label\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"rect\")\r\n\t\t\t\t\t\t\t\t.attr(\"id\", \"valbg\" )\r\n\t\t\t\t\t \t\t\t.attr(\"x\", 197 )\r\n\t\t\t\t\t\t \t\t.attr(\"y\", 45 )\r\n\t\t\t\t\t\t \t\t.attr(\"width\", 80 )\r\n\t\t\t\t\t\t\t\t.attr(\"height\", 30 )\r\n\t\t\t\t\t\t\t\t.attr(\"stroke\", \"white\" )\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"white\" )\r\n\t\t\t\t\t\t\t\t.attr(\"opacity\", 1.0 )\r\n\t\t\t\t\t\t\t\t.attr(\"stroke-width\", \"0\" );\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t//\tdraw data value of selected GEOUNIT\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t.attr(\"id\",\"rankingText1\")\r\n\t\t\t\t\t\t\t\t.text(\"No data\")\t\r\n\t\t\t\t\t\t\t\t.attr(\"x\", xAxis.xEnd-69 )\r\n\t\t\t\t\t\t\t\t.attr(\"y\", yAxis.yEnd )\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"#0581c9\")\r\n\t\t\t\t\t\t\t\t.attr(\"font-size\", \"15\");\t\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//\tdraw ranking value string below x-axis. Positioned under newly drawn highlight bar\r\n\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t.attr(\"id\",\"rankingText2\")\r\n\t\t\t\t\t\t\t.text(selectedRank + \"/\" + numElements)\r\n\t\t\t\t\t\t\t.attr(\"x\", HighlightRectDimensions[2]-15)\r\n\t\t\t\t\t\t\t.attr(\"y\", yAxis.yStart+25 )\r\n\t\t\t\t\t\t\t.attr(\"fill\", \"#0581c9\")\r\n\t\t\t\t\t\t\t.attr(\"font-size\", \"10\");\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\r\n\r\n\t\t\t\t\t//\treinitialise 'selectedRank'\r\n\t\t\t\t\tselectedRank = 0;\r\n\t\t\t\t\tGEOUNITValueObjRank = [];\t\t\r\n\t\t\t\t\tp = [];\r\n\t\t\t\t\tq = [];\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t} // END DRAWING OF INTERACTIVE COMPONENTS TO RANKING GRAPH\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t//\tif user interacts with map layer and 'Details' is selected in 'graph-drop'\r\n\t\t\t\telse if( ( hasHovered == true || highlightedGEOUNIT == true ) && graphType==\"Details\" && drop.length > 1 )\t\r\n\t\t\t\t{\r\n\t\t\t\t\t$( \"#hoverPrompt\" ).css( \"display\", \"none\" );\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t// define axis limits\r\n\t\t\t\t\txAxis = { xStart : 100 , xEnd : 310 , yStart : 275 , yEnd : 275 };\r\n\t\t\t\t\tyAxis = { xStart : 100 , xEnd : 100, yStart : 275 , yEnd : 50 };\r\n\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t// draw geography unit label at head of graph\t\t\t\t\r\n\t\t\t\t\tvar f_size;\r\n\t\t\t\t\tvar top_pos;\r\n\t\t\t\t\tvar left_pos;\r\n\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\tif ( currentHoverOverGEOUNIT_NM.length >= 0 )\r\n\t\t\t\t\t{\t\r\n\t\t\t\t\t\tf_size = \"17px\";\r\n\t\t\t\t\t\tleft_pos = \"15px\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( currentHoverOverGEOUNIT_NM.length >= 37 )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tf_size = \"11px\";\r\n\t\t\t\t\t\ttop_pos = \"19px\";\r\n\t\t\t\t\t\tleft_pos = \"15px\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\td3.select(\"#graphSVGDiv\")\r\n\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t.attr(\"id\",\"geoName\")\r\n\t\t\t\t\t\t.text(currentHoverOverGEOUNIT_NM)\r\n\t\t\t\t\t\t.attr(\"fill\", \"#0581c9\")\t\r\n\t\t\t\t\t\t.attr(\"top\", top_pos)\r\n\t\t\t\t\t\t.attr(\"left\", left_pos)\t\r\n\t\t\t\t\t\t.style(\"font-size\", f_size)\r\n\t\t\t\t\t\t.attr(\"z-index\", \"+13\");\r\n\t\r\n\t\r\n\t\t\t\t\t// make copy of main data array to consider\t\t\t\t\r\n\t\t\t\t\tvar tempArray = selectedGEOUNITVariables.slice();\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t// for each dataset defined in 'data.js', determine maximum value across all datasets. Use this to build static x-axis\r\n\t\t\t\t\tfor (var i=0; i<NumberOfDataSets; i++ )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif ( skippedVariables[i] == 1 ) { continue; }\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tvar maxArray = arrayMaxNames[i];\r\n\t\t\t\t\t\tvar sliceArrayStr = \"maxVal = \" + maxArray + \".slice(\" + selectedYearIndex + \",\" + (selectedYearIndex+1) + \")\";\r\n\t\t\t\t\t\teval(sliceArrayStr);\r\n\r\n\t\t\t\t\t\tif ( parseFloat(maxVal) > parseFloat(MaxValToUse) ) { MaxValToUse = parseFloat(maxVal) ; }\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// calculate scaling value for x-axis based on maxVal\t\t\t\t\t\r\n\t\t\t\t\tvar\txScale = (xAxis.xEnd - xAxis.xStart) / MaxValToUse;\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// determine frequency of ticks on x-axis based on MaxValToUse\r\n\t\t\t\t\tif ( MaxValToUse >= 0 ) { tickFrequency = 1; }\r\n\t\t\t\t\tif ( MaxValToUse >= 10 ) { tickFrequency = 3; }\r\n\t\t\t\t\tif ( MaxValToUse >= 25 ) { tickFrequency = 4; }\r\n\t\t\t\t\tif ( MaxValToUse >= 50 ) { tickFrequency = 10; }\r\n\t\t\t\t\tif ( MaxValToUse >= 75 ) { tickFrequency = 20; }\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// draw ticks and labels for x-axis\r\n\t\t\t\t\tfor ( var i=0; i<=MaxValToUse; i++ )\r\n\t\t\t\t\t{\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t// does tick/label need to be drawn?\r\n\t\t\t\t\t\tif ( (i)%tickFrequency==0 )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// calculate specific x-coordinate for label/tick \r\n\t\t\t\t\t\t\tvar xVal = (xAxis.xStart+(xScale*i));\r\n\t\t\t\t\t\t\tvar numZeros;\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tvar prefix = d3.formatPrefix(i);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// http://en.wikipedia.org/wiki/Metric_prefix\r\n\t\t\t\t\t\t\tif(prefix.symbol==\"\")\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tnumZeros = 0;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif(prefix.symbol===\"k\")\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tnumZeros = 3;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif(prefix.symbol===\"M\")\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tnumZeros = 6;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif(prefix.symbol===\"G\")\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tnumZeros = 9;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif(prefix.symbol===\"T\")\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tnumZeros = 12;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n//\t\t\t\t\t\t\t\r\n//\t\t\t\t\t\t\tvar valnew = addCommas(i);\r\n\t\t\t\t\t\t\tvar valnew = i.toString();\r\n\t\t\t\t\t\t\tvalnew = valnew.slice(0,valnew.length-numZeros);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// draw tick value\t\t\t\t\t\t\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t.attr(\"class\",\"xAxisLabels\")\r\n\t\t\t\t\t\t\t\t.text(valnew)\r\n\t\t\t\t\t\t\t\t.attr(\"x\", xVal-3 )\r\n\t\t\t\t\t\t\t\t.attr(\"y\", yAxis.yStart+15 )\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"#909090\")\r\n\t\t\t\t\t\t\t\t.attr(\"font-size\", \"8\");\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t// draw tick marks\t\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"line\")\r\n\t\t\t\t\t\t\t\t.attr(\"class\",\"xAxisTicks\")\r\n\t\t\t\t\t\t\t\t.attr(\"x1\", xVal)\r\n\t\t\t\t\t\t\t\t.attr(\"y1\", yAxis.yStart+5)\r\n\t\t\t\t\t\t\t\t.attr(\"x2\", xVal)\r\n\t\t\t\t\t\t\t\t.attr(\"y2\", yAxis.yStart)\r\n\t\t\t\t\t\t\t\t.attr(\"stroke\", \"#909090\")\r\n\t\t\t\t\t\t\t\t.attr(\"stroke-width\", \"2px\");\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t// draw maximum data value determined from all GEOUNIT's datasets at right end of x-axis \r\n\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t.attr(\"id\", \"maxVal\")\r\n\t\t\t\t\t\t.text(/*MaxValToUse.toFixed(1) + \" \" + variableUnitSymbol[selectedDatasetIndex]*/\"\")\r\n\t\t\t\t\t\t.attr(\"x\", xAxis.xEnd+5 )\r\n\t\t\t\t\t\t.attr(\"y\", yAxis.yStart )\r\n\t\t\t\t\t\t.attr(\"fill\", \"#909090\")\r\n\t\t\t\t\t\t.attr(\"font-size\", \"12\");\r\n\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t// draw variable unit string underneath x-axis\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t.attr(\"id\",\"xAxisTitle\")\r\n\t\t\t\t\t\t.text(variableUnitGraphDetailsXAxis[0])\r\n/*\t\t\t\t\t\t.text(variableUnitGraphDetailsXAxis[selectedDatasetIndex])*/\r\n\t\t\t\t\t\t.attr(\"x\", 300 )\r\n\t\t\t\t\t\t.attr(\"y\", yAxis.yStart+25 )\r\n\t\t\t\t\t\t.attr(\"fill\", \"#909090\")\r\n\t\t\t\t\t\t.attr(\"font-size\", \"8\");\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// determine number of data variables to skip drawing graph bards for in 'details' graph\r\n\t\t\t\t\tvar count = 0;\r\n\t\t\t\t\tvar count_deficit = 0;\t\t\t\t\r\n\t\t\t\t\tfor( var i=0; i<skippedVariables.length; i++ )\r\n\t\t\t\t\t{\r\n\t\t\t\t \tif( skippedVariables[i] == 1 ) { count++; }\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tvar count_deficit = 0;\r\n\t\t\t\t\t\r\n\t\t\t\t\t// initialise and calculate size and spacing values based on number of datasets\r\n\t\t\t\t\t// considered and number to exclude from drawing\r\n\t\t\t\t\tvar vertGap = ((1/(NumberOfDataSets-count)).toFixed(1))*10;\t\r\n\t\t\t\t\tvar barHeight = ((yAxis.yStart - yAxis.yEnd) / (NumberOfDataSets-count))-(vertGap*2);\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tvar barColor = \"#C8C8C8\";\r\n\t\t\t\t\tvar horiBarColor = \"#FFF\";\r\n\t\t\t\t\tvar highlightBar;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// for each dataset\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\tfor (var i=0; i<NumberOfDataSets; i++ )\r\n\t\t\t\t\t{\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t// refernece array denoting of dataset should be excluded from drawing .... if value == 1 , ship iteration\r\n\t\t\t\t\t\tif ( skippedVariables[i] == 1 )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tcount_deficit++;\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// set GEOUNITs specific value to local variable\r\n\t\t\t\t\t\tvar value = selectedGEOUNITVariables[i];\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// calculate scaled value for data value\t\t\t\t\t\t\r\n\t\t\t\t\t\tvar scaledValue = Number(parseFloat(value) * ((xAxis.xEnd-xAxis.xStart)/parseFloat(MaxValToUse)));\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t// if this value is a true usable value (not null/undefined)\r\n\t\t\t\t\t\tif( value != null )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// if selected dataset is equal to iteration through dataset listing, highlight graph bar with colorbrewer.js colour\r\n\t\t\t\t\t\t\tif ( i == selectedDatasetIndex )\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t// redefine bar color since this is the selected dataset \r\n\t\t\t\t\t\t\t\tbarColor = getColor(value, \"drawTimeSeries\");\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t// draw highlight-coloured bar\t\r\n\t\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t\t.append(\"rect\")\r\n\t\t\t\t\t\t\t\t\t.attr(\"class\", \"GEOUNITRectGroup\")\r\n\t\t\t\t\t\t\t\t\t.attr(\"x\", xAxis.xStart )\r\n\t\t\t\t\t\t\t\t\t.attr(\"y\", yAxis.yEnd+((i-count_deficit)*(barHeight+(2*vertGap))) )\r\n\t\t\t\t\t\t\t\t\t.attr(\"width\", scaledValue )\r\n\t\t\t\t\t\t\t\t\t.attr(\"height\", barHeight )\r\n\t\t\t\t\t\t\t\t\t.attr(\"stroke\", \"#E00000\")\r\n\t\t\t\t\t\t\t\t\t.attr(\"fill\", barColor)\r\n\t\t\t\t\t\t\t\t\t.attr(\"opacity\", $('#opacitySlider').slider('value') )\r\n\t\t\t\t\t\t\t\t\t.attr(\"stroke-width\", \"0\")\r\n\t\t\t\t\t\t\t\t\t.attr(\"z-index\", 0);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// data bar relates to non-selected dataset, so draw as solid grey\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t\t.append(\"rect\")\r\n\t\t\t\t\t\t\t\t\t.attr(\"class\", \"GEOUNITRectGroup\")\r\n\t\t\t\t\t\t\t\t\t.attr(\"x\", xAxis.xStart )\r\n\t\t\t\t\t\t\t\t\t.attr(\"y\", yAxis.yEnd+((i-count_deficit)*(barHeight+(2*vertGap))) )\r\n\t\t\t\t\t\t\t\t\t.attr(\"width\", scaledValue )\r\n\t\t\t\t\t\t\t\t\t.attr(\"height\", barHeight )\r\n\t\t\t\t\t\t\t\t\t.attr(\"stroke\", \"#E00000\")\r\n\t\t\t\t\t\t\t\t\t.attr(\"fill\", barColor)\r\n\t\t\t\t\t\t\t\t\t.attr(\"opacity\", $('#opacitySlider').slider('value'))\r\n\t\t\t\t\t\t\t\t\t.attr(\"stroke-width\", \"0\")\r\n\t\t\t\t\t\t\t\t\t.attr(\"z-index\", 0);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// draw dataset trendLine for each datase for sepected GEOUNIT\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"line\")\r\n\t\t\t\t\t\t\t\t.attr(\"class\",\"trendLines\")\r\n\t\t\t\t\t\t\t\t.attr(\"x1\", xAxis.xStart+(xScale*trendLine[i][selectedYearIndex]) )\r\n\t\t\t\t\t\t\t\t.attr(\"y1\", yAxis.yEnd+((i-count_deficit)*(barHeight+(2*vertGap))) )\r\n\t\t\t\t\t\t\t\t.attr(\"x2\", xAxis.xStart+(xScale*trendLine[i][selectedYearIndex]) )\r\n\t\t\t\t\t\t\t\t.attr(\"y2\", yAxis.yEnd+((i-count_deficit)*(barHeight+(2*vertGap))) + barHeight )\r\n\t\t\t\t\t\t\t\t.attr(\"stroke\", compColour)\r\n\t\t\t\t\t\t\t\t.attr(\"stroke-width\", \"2\")\r\n\t\t\t\t\t\t\t\t.attr(\"opacity\", opcty);\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\r\n\t\r\n\t\t\t\t\t\t\t// draw mini legend example trend line to right of graphing area\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"line\")\r\n\t\t\t\t\t\t\t\t.attr(\"id\",\"trendInfoLine\")\r\n\t\t\t\t\t\t\t\t.attr(\"x1\", xAxis.xEnd)\r\n\t\t\t\t\t\t\t\t.attr(\"y1\", (yAxis.yStart-yAxis.yEnd)/2+17)\r\n\t\t\t\t\t\t\t\t.attr(\"x2\", xAxis.xEnd)\r\n\t\t\t\t\t\t\t\t.attr(\"y2\", (yAxis.yStart-yAxis.yEnd)/2+37)\r\n\t\t\t\t\t\t\t\t.attr(\"stroke\", compColour)\r\n\t\t\t\t\t\t\t\t.attr(\"stroke-width\", \"2\");\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\r\n\t\r\n\t\t\t\t\t\t\t// draw mini legend text to right of graphing area\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t.attr(\"id\",\"trendInfoLabel1\")\r\n\t\t\t\t\t\t\t\t.text(geoCoverageAbbrev)\r\n\t\t\t\t\t\t\t\t.attr(\"x\", xAxis.xEnd+5 )\r\n\t\t\t\t\t\t\t\t.attr(\"y\", (yAxis.yStart-yAxis.yEnd)/2+30 )\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"#909090\")\r\n\t\t\t\t\t\t\t\t.style(\"font-size\", \"10\")\r\n\t\t\t\t\t\t\t\t.attr(\"font-weight\", \"normal\");\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\r\n\t\r\n\t\t\t\t\t\t\t// draw mini legend text to right of graphing area\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t.attr(\"id\",\"addText\")\r\n\t\t\t\t\t\t\t\t.text(addText)\r\n\t\t\t\t\t\t\t\t.attr(\"x\", xAxis.xEnd+18 )\r\n\t\t\t\t\t\t\t\t.attr(\"y\", (yAxis.yStart-yAxis.yEnd)/2+30 )\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"#909090\")\r\n\t\t\t\t\t\t\t\t.attr(\"font-size\", \"10\")\r\n\t\t\t\t\t\t\t\t.attr(\"font-weight\", \"normal\");\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\r\n\t\r\n\t\t\t\t\t\t\t// draw mini legend example trend line to right of graphing area\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t.attr(\"id\",\"trendInfoLabel2\")\r\n\t\t\t\t\t\t\t\t.text(\"\")\r\n\t\t\t\t\t\t\t\t.attr(\"x\", xAxis.xEnd+5 )\r\n\t\t\t\t\t\t\t\t.attr(\"y\", (yAxis.yStart-yAxis.yEnd)/2+35)\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"#909090\")\r\n\t\t\t\t\t\t\t\t.attr(\"font-size\", \"9\")\r\n\t\t\t\t\t\t\t\t.attr(\"font-weight\", \"normal\");\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\r\n\t\r\n\t\t\t\t\t\t\t// draw dataset variable values alongside y-axis\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t.attr(\"class\",\"GEOUNITDataLabels\")\r\n\t\t\t\t\t\t\t\t.text(value.toFixed(1))\r\n\t\t\t\t\t\t\t\t.attr(\"x\", xAxis.xStart-28 )\r\n\t\t\t\t\t\t\t\t.attr(\"y\", (yAxis.yEnd+((i-count_deficit)*(barHeight+(2*vertGap)))+(barHeight/2))+3 )\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"#909090\")\r\n\t\t\t\t\t\t\t\t.attr(\"font-size\", \"10\");\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\r\n\t\r\n\t\t\t\t\t\t\t// draw abbreviated dataset variable name alongside y-axis\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t.attr(\"class\",\"DatasetLabels\")\r\n\t\t\t\t\t\t\t\t.text(abrrevdrop[i])\r\n\t\t\t\t\t\t\t\t.attr(\"x\", xAxis.xStart-100 )\r\n\t\t\t\t\t\t\t\t.attr(\"y\", (yAxis.yEnd+((i-count_deficit)*(barHeight+(2*vertGap)))+(barHeight/2))+3 )\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"black\")\r\n\t\t\t\t\t\t\t\t.attr(\"font-size\", \"10\");\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\r\n\r\n\t\t\t\t\t\t// otherwise selected GEOUNIT name has no data to report\t\t\t\t\t\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\r\n\t\r\n\t\t\t\t\t\t\t// draw abbreviated dataset variable name alongside y-axis\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t.attr(\"class\",\"DatasetLabels\")\r\n\t\t\t\t\t\t\t\t.text(abrrevdrop[i])\r\n\t\t\t\t\t\t\t\t.attr(\"x\", xAxis.xStart-100 )\r\n\t\t\t\t\t\t\t\t.attr(\"y\", (yAxis.yEnd+((i-count)*(barHeight+(2*vertGap)))+(barHeight/2))+3 )\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"black\")\r\n\t\t\t\t\t\t\t\t.attr(\"font-size\", \"10\");\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// draw text inplace of non-existent value bar.\r\n\t\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t\t.append(\"text\")\r\n\t\t\t\t\t\t\t\t.attr(\"class\",\"GEOUNITNoDataLabels\")\r\n\t\t\t\t\t\t\t\t.text(\"No data available\")\r\n\t\t\t\t\t\t\t\t.attr(\"x\", xAxis.xStart+5 )\r\n\t\t\t\t\t\t\t\t.attr(\"y\", (yAxis.yEnd+((i-count)*(barHeight+(2*vertGap)))+(barHeight/2))+3 )\r\n\t\t\t\t\t\t\t\t.attr(\"fill\", \"black\")\r\n\t\t\t\t\t\t\t\t.attr(\"font-size\", \"12\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// reset barcolor to default grey\r\n\t\t\t\t\t\tbarColor = \"#C8C8C8\";\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// draw\tx-axis\r\n\t\t\t\t\t\td3.select(\"#mainChart\")\t\r\n\t\t\t\t\t\t\t.append(\"line\")\r\n\t\t\t\t\t\t\t.attr(\"id\",\"xAxis\")\r\n\t\t\t\t\t\t\t.attr(\"x1\", xAxis.xStart)\r\n\t\t\t\t\t\t\t.attr(\"y1\", xAxis.yStart)\r\n\t\t\t\t\t\t\t.attr(\"x2\", xAxis.xEnd+1)\r\n\t\t\t\t\t\t\t.attr(\"y2\", xAxis.yEnd)\r\n\t\t\t\t\t\t\t.attr(\"stroke\", \"#909090\")\r\n\t\t\t\t\t\t\t.attr(\"stroke-width\", \"1\");\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// draw\ty-axis\r\n\t\t\t\t\t\td3.select(\"#mainChart\")\r\n\t\t\t\t\t\t\t.append(\"line\")\r\n\t\t\t\t\t\t\t.attr(\"id\",\"yAxis\")\r\n\t\t\t\t\t\t\t.attr(\"x1\", yAxis.xStart)\r\n\t\t\t\t\t\t\t.attr(\"y1\", yAxis.yStart)\r\n\t\t\t\t\t\t\t.attr(\"x2\", yAxis.xEnd)\r\n\t\t\t\t\t\t\t.attr(\"y2\", yAxis.yEnd)\r\n\t\t\t\t\t\t\t.attr(\"stroke\", \"#909090\")\r\n\t\t\t\t\t\t\t.attr(\"stroke-width\", \"1\");\r\n\t\t\t\t\t}\t\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t} // END DRAWING OF DETAILS BAR GRAPH\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t// else do nothing .. \r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\treturn;\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\t}", "title": "" }, { "docid": "1869171aaffebe333f57ba2e20e38c51", "score": "0.5414661", "text": "getSeriesExtremes() {\n const axis = this, chart = axis.chart;\n let xExtremes;\n fireEvent(this, 'getSeriesExtremes', null, function () {\n axis.hasVisibleSeries = false;\n // Reset properties in case we're redrawing (#3353)\n axis.dataMin = axis.dataMax = axis.threshold = null;\n axis.softThreshold = !axis.isXAxis;\n // Loop through this axis' series\n axis.series.forEach(function (series) {\n if (series.visible ||\n !chart.options.chart.ignoreHiddenSeries) {\n const seriesOptions = series.options;\n let xData, threshold = seriesOptions.threshold, seriesDataMin, seriesDataMax;\n axis.hasVisibleSeries = true;\n // Validate threshold in logarithmic axes\n if (axis.positiveValuesOnly && threshold <= 0) {\n threshold = null;\n }\n // Get dataMin and dataMax for X axes\n if (axis.isXAxis) {\n xData = series.xData;\n if (xData && xData.length) {\n xData = axis.logarithmic ?\n xData.filter((x) => x > 0) :\n xData;\n xExtremes = series.getXExtremes(xData);\n // If xData contains values which is not numbers,\n // then filter them out. To prevent performance hit,\n // we only do this after we have already found\n // seriesDataMin because in most cases all data is\n // valid. #5234.\n seriesDataMin = xExtremes.min;\n seriesDataMax = xExtremes.max;\n if (!isNumber(seriesDataMin) &&\n // #5010:\n !(seriesDataMin instanceof Date)) {\n xData = xData.filter(isNumber);\n xExtremes = series.getXExtremes(xData);\n // Do it again with valid data\n seriesDataMin = xExtremes.min;\n seriesDataMax = xExtremes.max;\n }\n if (xData.length) {\n axis.dataMin = Math.min(pick(axis.dataMin, seriesDataMin), seriesDataMin);\n axis.dataMax = Math.max(pick(axis.dataMax, seriesDataMax), seriesDataMax);\n }\n }\n // Get dataMin and dataMax for Y axes, as well as handle\n // stacking and processed data\n }\n else {\n // Get this particular series extremes\n const dataExtremes = series.applyExtremes();\n // Get the dataMin and dataMax so far. If percentage is\n // used, the min and max are always 0 and 100. If\n // seriesDataMin and seriesDataMax is null, then series\n // doesn't have active y data, we continue with nulls\n if (isNumber(dataExtremes.dataMin)) {\n seriesDataMin = dataExtremes.dataMin;\n axis.dataMin = Math.min(pick(axis.dataMin, seriesDataMin), seriesDataMin);\n }\n if (isNumber(dataExtremes.dataMax)) {\n seriesDataMax = dataExtremes.dataMax;\n axis.dataMax = Math.max(pick(axis.dataMax, seriesDataMax), seriesDataMax);\n }\n // Adjust to threshold\n if (defined(threshold)) {\n axis.threshold = threshold;\n }\n // If any series has a hard threshold, it takes\n // precedence\n if (!seriesOptions.softThreshold ||\n axis.positiveValuesOnly) {\n axis.softThreshold = false;\n }\n }\n }\n });\n });\n fireEvent(this, 'afterGetSeriesExtremes');\n }", "title": "" }, { "docid": "6f7a96be25f6d44265ad535c036f605a", "score": "0.5406252", "text": "updateMinMaxRecordedValues() {\n let minValue = Number.POSITIVE_INFINITY;\n let maxValue = Number.NEGATIVE_INFINITY;\n this.dynamicSeriesArray.forEach( dynamicSeries => {\n if ( dynamicSeries.getLength() > 0 ) {\n const seriesMinValue = dynamicSeries.getDataPoint( 0 ).x;\n const seriesMaxValue = dynamicSeries.getDataPoint( dynamicSeries.getLength() - 1 ).x;\n if ( seriesMinValue < minValue ) {\n minValue = seriesMinValue;\n }\n if ( seriesMaxValue > maxValue ) {\n maxValue = seriesMaxValue;\n }\n }\n } );\n\n this.minRecordedXValue = minValue;\n this.maxRecordedXValue = maxValue;\n }", "title": "" }, { "docid": "c0725412e6c7937e84ee3b96b405768f", "score": "0.54045874", "text": "function filterOutliers(someArray, key, resultObj) {\n\n // Copy the values, rather than operating on references to existing values\n var values = someArray;\n\n // Then sort\n values.sort(function(a, b) {\n return parseFloat(a[key]) - parseFloat(b[key]);\n });\n\n /* Then find a generous IQR. This is generous because if (values.length / 4) \n * is not an int, then really you should average the two elements on either \n * side to find q1.\n */\n var q1 = values[Math.floor((values.length / 4))];\n // Likewise for q3. \n var ceilVar = Math.ceil((values.length * (3 / 4)));\n var q3 = values[ceilVar > values.length - 1 ? values.length - 1 : ceilVar];\n var iqr = parseFloat(q3[key]) - parseFloat(q1[key]);\n\n // Then find min and max values - mild outliers are those data points which lay between 1.5 * IRQ and 3 * IRQ\n var maxValue = parseFloat(q3[key]) + iqr * 1.5;\n var minValue = parseFloat(q1[key]) - iqr * 1.5;\n\n // Then filter anything beyond or beneath these values.\n // var filteredValues = [];\n var averagecalc = 0.0;\n var countAverage = 0;\n for (var i = values.length - 1; i >= 0; i--) {\n tmp = parseFloat(values[i][key]);\n if ((tmp <= maxValue) && (tmp >= minValue)) {\n var valAux = parseFloat(values[i][key]).toFixed(2);\n averagecalc += valAux * 1;\n countAverage++;\n\n if (resultObj.Max * 1 < valAux * 1) {\n resultObj.dateOfMax = utils.dateTimeFormat(values[i].readingDate);\n resultObj.Max = valAux;\n }\n\n if (resultObj.Min * 1 > valAux * 1) {\n resultObj.dateOfMin = utils.dateTimeFormat(values[i].readingDate);\n resultObj.Min = valAux;\n }\n }\n }\n resultObj.lowerRangeOfReadingDate = utils.dateTimeFormat(someArray[0].readingDate);\n resultObj.upperRangeOfReadingDate = utils.dateTimeFormat(someArray[values.length - 1].readingDate);\n resultObj.Average = (averagecalc / countAverage).toFixed(2);\n return resultObj;\n}", "title": "" }, { "docid": "8d7681f54892505244c3327bbae1fe17", "score": "0.5404426", "text": "function indexify(idx, data) {\n return data.map(function(line, i) {\n var v = lines.y()(line.values[idx], idx);\n\n //TODO: implement check below, and disable series if series loses 100% or more cause divide by 0 issue\n if (v < -.95) {\n //if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically correct till it hits 100)\n line.tempDisabled = true;\n return line;\n }\n\n line.tempDisabled = false;\n\n line.values = line.values.map(function(point, pointIndex) {\n point.display = {'y': (lines.y()(point, pointIndex) - v) / (1 + v) };\n return point;\n })\n\n return line;\n })\n }", "title": "" }, { "docid": "096c2b6a8f557dd6808707a05ed61ec8", "score": "0.5392115", "text": "cleanChart() {\n for(var i = 0; i < this.chart.series.length; i++) {\n this.chart.series[i].setData([]);\n }\n this.chart.yAxis[0].isDirty = true;\n this.chart.redraw();\n }", "title": "" }, { "docid": "201e586b87241e9876997996e77ea14b", "score": "0.5387697", "text": "function indexify(idx, data) {\n return data.map(function(line, i) {\n if (!line.values) {\n return line;\n }\n var v = lines.y()(line.values[idx], idx);\n\n //TODO: implement check below, and disable series if series loses 100% or more cause divide by 0 issue\n if (v < -.95 && !noErrorCheck) {\n //if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically correct till it hits 100)\n\n line.tempDisabled = true;\n return line;\n }\n\n line.tempDisabled = false;\n\n line.values = line.values.map(function(point, pointIndex) {\n point.display = {'y': (lines.y()(point, pointIndex) - v) / (1 + v) };\n return point;\n })\n\n return line;\n })\n }", "title": "" }, { "docid": "201e586b87241e9876997996e77ea14b", "score": "0.5387697", "text": "function indexify(idx, data) {\n return data.map(function(line, i) {\n if (!line.values) {\n return line;\n }\n var v = lines.y()(line.values[idx], idx);\n\n //TODO: implement check below, and disable series if series loses 100% or more cause divide by 0 issue\n if (v < -.95 && !noErrorCheck) {\n //if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically correct till it hits 100)\n\n line.tempDisabled = true;\n return line;\n }\n\n line.tempDisabled = false;\n\n line.values = line.values.map(function(point, pointIndex) {\n point.display = {'y': (lines.y()(point, pointIndex) - v) / (1 + v) };\n return point;\n })\n\n return line;\n })\n }", "title": "" }, { "docid": "201e586b87241e9876997996e77ea14b", "score": "0.5387697", "text": "function indexify(idx, data) {\n return data.map(function(line, i) {\n if (!line.values) {\n return line;\n }\n var v = lines.y()(line.values[idx], idx);\n\n //TODO: implement check below, and disable series if series loses 100% or more cause divide by 0 issue\n if (v < -.95 && !noErrorCheck) {\n //if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically correct till it hits 100)\n\n line.tempDisabled = true;\n return line;\n }\n\n line.tempDisabled = false;\n\n line.values = line.values.map(function(point, pointIndex) {\n point.display = {'y': (lines.y()(point, pointIndex) - v) / (1 + v) };\n return point;\n })\n\n return line;\n })\n }", "title": "" }, { "docid": "13b4fc2de307a12696e94d3236942e49", "score": "0.532801", "text": "remove() {\n const series = this, chart = series.chart;\n // column and bar series affects other series of the same type\n // as they are either stacked or grouped\n if (chart.hasRendered) {\n chart.series.forEach(function (otherSeries) {\n if (otherSeries.type === series.type) {\n otherSeries.isDirty = true;\n }\n });\n }\n Series.prototype.remove.apply(series, arguments);\n }", "title": "" }, { "docid": "0ed14eca883fc9364580f1182cd8e302", "score": "0.5316038", "text": "function removeTooltipsAndCrosshairs() {\n var i = 0, j = 0;\n for (; i < charts.length; i++) {\n charts[i].tooltip.hide();\n charts[i].xAxis[0].hideCrosshair();\n }\n }", "title": "" }, { "docid": "3ea6c25504d1e5af36e3ea195b846cf7", "score": "0.5292288", "text": "function drawIndividualChart() {\n $.get(\"trendSelf\", {\n login: myId,\n },\n function(data, status) {\n var formattedData = [['Checkin', data.name]];\n\n //the chart displays at most 10 checkins\n var earliest = 10;\n if(data.score.length < 10){\n earliest = data.score.length;\n }\n \n for(var i = earliest; i >= 0; i--){\n var row = [earliest - i, Math.floor(data.score[i])];\n formattedData.push(row);\n }\n\n var data = google.visualization.arrayToDataTable(formattedData);\n var chart = new google.visualization.AreaChart(document.getElementById('chart_div_line'));\n chart.draw(data, options);\n });\n}", "title": "" }, { "docid": "d55159dd548e75a42952598096a8b1f2", "score": "0.5290803", "text": "function chartLineHistorical(statesTrue, statesFuture, quantiles, q, state_code) {\n\n // This gets the last known date and adds it to the future guesses as to connect the line\n futureStateWithPrevious = statesFuture[state_code]\n futureStateWithPrevious.unshift(statesTrue[state_code][statesTrue[state_code][\"length\"] - 1])\n\n Highcharts.chart('graph', {\n\n chart: {\n zoomType: 'x'\n },\n\n title: {\n text: 'Reported ' + (activeType > 0 ? 'New Weekly' : 'Total') + ' Deaths by Week For ' + state_code\n },\n\n subtitle: {\n text: 'Click and drag cursor over a selected timeframe to zoom into the timeframe'\n },\n \n yAxis: {\n title: {\n text: 'Deaths'\n }\n },\n\n xAxis: {\n title: {\n text: 'Date'\n },\n type: 'datetime',\n dateTimeLabelFormats: {\n day: '%b %e'\n }\n },\n\n legend: {\n layout: 'vertical',\n align: 'right',\n verticalAlign: 'middle'\n },\n\n tooltip: {\n crosshairs: false,\n shared: true,\n useHTML: true,\n formatter() {\n if (this.x == futureStateWithPrevious[0][0]) { // Gets the pseudoguess point from the historical data\n var output = `<span style=font-size:10px>${ Highcharts.dateFormat('%A, %b %e', new Date(this.x))}</span><br/>`\n \n // If the point is historical, show, otherwise, hide\n this.points.forEach(point => {\n if (point.color == lineColor) {\n return false\n } else {\n output += `<span style=color:${point.color}>●</span> ${point.series.name}: <b>${Math.round(point.y)}</b><br/>`\n }\n })\n return output\n } else {\n var output = `<span style=font-size:10px>${ Highcharts.dateFormat('%A, %b %e', new Date(this.x))}</span><br/>`\n \n this.points.forEach(point => {\n if (point.color == quantileColor) {\n output += `<span style=color:${point.color}>●</span> ${point.series.name}: <b>${Math.round(point.point.low)}</b> - <b>${Math.round(point.point.high)}</b><br/>`\n } else {\n output += `<span style=color:${point.color}>●</span> ${point.series.name}: <b>${Math.round(point.y)}</b><br/>`\n }\n })\n return output\n }\n }\n },\n \n series: [\n {\n name: \"Forecasted Data\",\n data: futureStateWithPrevious,\n color: forecastColor, \n zIndex: 1,\n marker: {\n fillColor: 'white',\n lineWidth: 2,\n enabledThreshold: 0,\n lineColor: Highcharts.getOptions().colors[0]\n }\n },\n {\n name: \"Quantiles\",\n data: quantiles[q][state_code],\n type: 'arearange',\n lineWidth: 0,\n linkedTo: ':previous',\n color: quantileColor,\n fillOpacity: 0.3,\n zIndex: 0,\n marker: {\n enabled: false\n }\n },\n {\n name: \"Reported Data\",\n data: statesTrue[state_code],\n zIndex: 2,\n color: lineColor\n }],\n\n credits: {\n enabled: false\n },\n \n \n responsive: {\n rules: [{\n condition: {\n maxWidth: 500\n },\n chartOptions: {\n legend: {\n layout: 'horizontal',\n align: 'center',\n verticalAlign: 'bottom'\n }\n }\n }]\n }\n \n });\n}", "title": "" }, { "docid": "169aa71b49b9d6b57b10898519fafe96", "score": "0.5289208", "text": "function cleanBrushInterval() {\n //d3.event.selection looks like [622,698] for example\n //b is then an array of 2 dates: [from, to]\n var b = d3.event.selection === null ? brushXScale.domain() : d3.event.selection.map(x=>{\n return brushXScale.invert(x)\n });\n\n //first we make sure that we cannot zoom too much\n b = getCleanedInterval(b)\n timeIntervalSelected = b\n onBrush()\n\n }", "title": "" }, { "docid": "5dd308ba5007bc30ddc3d1f7f0d40e33", "score": "0.52871984", "text": "modifyBaseAxisExtremes() {\n const baseXAxis = this, navigator = baseXAxis.chart.navigator, baseExtremes = baseXAxis.getExtremes(), baseMin = baseExtremes.min, baseMax = baseExtremes.max, baseDataMin = baseExtremes.dataMin, baseDataMax = baseExtremes.dataMax, range = baseMax - baseMin, stickToMin = navigator.stickToMin, stickToMax = navigator.stickToMax, overscroll = pick(baseXAxis.options.overscroll, 0), navigatorSeries = navigator.series && navigator.series[0], hasSetExtremes = !!baseXAxis.setExtremes, \n // When the extremes have been set by range selector button, don't\n // stick to min or max. The range selector buttons will handle the\n // extremes. (#5489)\n unmutable = baseXAxis.eventArgs &&\n baseXAxis.eventArgs.trigger === 'rangeSelectorButton';\n let newMax, newMin;\n if (!unmutable) {\n // If the zoomed range is already at the min, move it to the right\n // as new data comes in\n if (stickToMin) {\n newMin = baseDataMin;\n newMax = newMin + range;\n }\n // If the zoomed range is already at the max, move it to the right\n // as new data comes in\n if (stickToMax) {\n newMax = baseDataMax + overscroll;\n // If stickToMin is true, the new min value is set above\n if (!stickToMin) {\n newMin = Math.max(baseDataMin, // don't go below data extremes (#13184)\n newMax - range, navigator.getBaseSeriesMin(navigatorSeries && navigatorSeries.xData ?\n navigatorSeries.xData[0] :\n -Number.MAX_VALUE));\n }\n }\n // Update the extremes\n if (hasSetExtremes && (stickToMin || stickToMax)) {\n if (isNumber(newMin)) {\n baseXAxis.min = baseXAxis.userMin = newMin;\n baseXAxis.max = baseXAxis.userMax = newMax;\n }\n }\n }\n // Reset\n navigator.stickToMin =\n navigator.stickToMax = null;\n }", "title": "" }, { "docid": "a18f17a10a337e086244bf9064754f2d", "score": "0.52850205", "text": "adjustForMinRange() {\n const axis = this, options = axis.options, log = axis.logarithmic;\n let min = axis.min, max = axis.max, zoomOffset, spaceAvailable, closestDataRange = 0, i, distance, xData, loopLength, minArgs, maxArgs, minRange;\n // Set the automatic minimum range based on the closest point distance\n if (axis.isXAxis &&\n typeof axis.minRange === 'undefined' &&\n !log) {\n if (defined(options.min) ||\n defined(options.max) ||\n defined(options.floor) ||\n defined(options.ceiling)) {\n axis.minRange = null; // don't do this again\n }\n else {\n // Find the closest distance between raw data points, as opposed\n // to closestPointRange that applies to processed points\n // (cropped and grouped)\n axis.series.forEach(function (series) {\n xData = series.xData;\n loopLength = series.xIncrement ? 1 : xData.length - 1;\n if (xData.length > 1) {\n for (i = loopLength; i > 0; i--) {\n distance = xData[i] - xData[i - 1];\n if (!closestDataRange ||\n distance < closestDataRange) {\n closestDataRange = distance;\n }\n }\n }\n });\n axis.minRange = Math.min(closestDataRange * 5, axis.dataMax - axis.dataMin);\n }\n }\n // if minRange is exceeded, adjust\n if (max - min < axis.minRange) {\n spaceAvailable =\n axis.dataMax - axis.dataMin >=\n axis.minRange;\n minRange = axis.minRange;\n zoomOffset = (minRange - max + min) / 2;\n // if min and max options have been set, don't go beyond it\n minArgs = [\n min - zoomOffset,\n pick(options.min, min - zoomOffset)\n ];\n // If space is available, stay within the data range\n if (spaceAvailable) {\n minArgs[2] = axis.logarithmic ?\n axis.logarithmic.log2lin(axis.dataMin) :\n axis.dataMin;\n }\n min = arrayMax(minArgs);\n maxArgs = [\n min + minRange,\n pick(options.max, min + minRange)\n ];\n // If space is availabe, stay within the data range\n if (spaceAvailable) {\n maxArgs[2] = log ?\n log.log2lin(axis.dataMax) :\n axis.dataMax;\n }\n max = arrayMin(maxArgs);\n // now if the max is adjusted, adjust the min back\n if (max - min < minRange) {\n minArgs[0] = max - minRange;\n minArgs[1] = pick(options.min, max - minRange);\n min = arrayMax(minArgs);\n }\n }\n // Record modified extremes\n axis.min = min;\n axis.max = max;\n }", "title": "" }, { "docid": "52b3f987e8c4b1c16ef4f4ef4ed85d22", "score": "0.52817655", "text": "function brushed(event) {\n if (event.sourceEvent && event.sourceEvent.type === \"zoom\") {\n return;\n }\n var s = event.selection || xScale2.range();\n console.log(s)\n xScale.domain(s.map(xScale2.invert, xScale2));\n x_axis.call(xAxiss,xScale);\n line_chart.selectAll(\"path\")\n .attr(\"d\", d => makeLine(xScale)(d.values));\n }", "title": "" }, { "docid": "3d3974f1f6ff7163f28cc415a1b3f66d", "score": "0.5281379", "text": "function drawChart() {\n if (draw) {\n $(\"#wrapper\").show();\n var data = new google.visualization.DataTable();\n data.addColumn('string', 'Month');\n data.addColumn('number', 'Global Sentiment');\n data.addColumn({id:'min', type:'number', role:'interval'}); // value - variance\n data.addColumn({id:'max', type:'number', role:'interval'}); // value + variance\n\n var sum = 0;\n count = 0;\n\n for (i = 0; i < chartData[1].length; i++) {\n var month = \"\";\n var value = -1;\n var variance = -1;\n\n if (chartData[1][i].hasOwnProperty('Month')) {\n month = chartData[1][i].Month;\n }\n\n if (chartData[1][i].hasOwnProperty('Value')) {\n value = chartData[1][i].Value;\n }\n\n if (chartData[1][i].hasOwnProperty('Variance')) {\n variance = chartData[1][i].Variance;\n }\n\n if (month != \"\" && (value != -1 && variance != -1)) {\n sum += value;\n count += 1;\n\n data.addRow([month, value, value - variance, value + variance]);\n }\n }\n\n var options = {\n title : 'Predicted global sentiment over time',\n hAxis: {\n title: 'Time'\n },\n series: {\n 0: {\n color: '#604460',\n lineWidth: 3\n }\n },\n intervals: {\n 'style':'area',\n },\n vAxis: {\n title: 'Global Sentiment',\n minValue: 0,\n maxValue: 100\n },\n legend: {\n position: 'bottom'\n },\n backgroundColor: {\n fill:'transparent'\n },\n curveType: 'function'\n };\n\n var chart = new google.visualization.LineChart(document.getElementById('graph'));\n chart.draw(data,options);\n\n var data = google.visualization.arrayToDataTable([['Indicator', 'Value'], ['Average Global Sentiment', count != 0 ? Math.round(sum/count) : 0]]);\n\n var options = {\n title: 'Predicted average global sentiment',\n legend: 'none',\n pieSliceText: 'value',\n pieSliceTextStyle: {\n fontSize: 20,\n },\n colors:['#604460'],\n backgroundColor: {\n fill:'transparent'\n },\n tooltip: { trigger: 'none' },\n };\n\n var chart = new google.visualization.PieChart(document.getElementById('pie'));\n chart.draw(data, options);\n\n } else {\n return;\n }\n}", "title": "" }, { "docid": "aad4c67da35a73ca5eb714cb9bdf1a2c", "score": "0.5271026", "text": "function ChartData(chart){/** @private */this.currentPoints=[];/** @private */this.previousPoints=[];this.insideRegion=false;this.chart=chart;this.lierIndex=0;}", "title": "" }, { "docid": "fae4a61bbae6187a00c47a302bb96d96", "score": "0.52661115", "text": "removeAll() {\n\t\tlet chartKeys = this.charts.keys();\n\t\tlet chartDetail = this.charts.get(chartKeys.next().value);\n\t\twhile (chartDetail) {\n\t\t\t// Never remove chart0 because it's tied to the UI\n\t\t\tif (chartDetail.id !== \"chart0\") {\n\t\t\t\tthis.remove(chartDetail);\n\t\t\t}\n\t\t\tchartDetail = this.charts.get(chartKeys.next().value);\n\t\t}\n\t}", "title": "" }, { "docid": "a053e789f0b30cb0da8b57c3b90fc7e7", "score": "0.5252826", "text": "function a0(){return traces.map(function(){return undefined;});}// for autoranging multiple axes", "title": "" }, { "docid": "2cf956b2ff080833d68c96a39cb3c87c", "score": "0.5251884", "text": "function removeLine(data, start, end, round) {\n var startData = data.filter(d => {return (d.year < start)});\n var endData = data.filter(d => {return (d.year < end)});\n\n const l = pathLength(line(data));\n const l_start = pathLength(line(startData));\n const l_end = pathLength(line(endData));\n\n d3.selectAll(\"path.line-graph\")\n .attr(\"stroke-dasharray\", `${l_start},${l-l_start}`)\n .transition().duration((l_start-l_end)*2)\n .ease(d3.easeLinear)\n .attr(\"stroke-dasharray\", `${l_end},${l-l_end}`);\n\n d3.selectAll(\".year-label.labels-\" + round)\n .transition()\n .delay((d, i) => pathLength(line(data.slice(0, i + 1))) / (l_end-l_start) * 2000)\n .attr(\"opacity\", 0);\n}", "title": "" }, { "docid": "930db25c33035b6e29202df5e13dda87", "score": "0.5245206", "text": "function mpchart05a(graphDiv, seriesData1, dateRange1) {\n\n var option = null;\n\n var colors = ['#5D8B41', '#0A4DF2', '#B55C4F'];\n var dateRange = dateRange1;\n\n var seriesName = ['440 Volts', '220/110 Volts'];\n var seriesData = seriesData1;\n //var seriesData = [\n // ['At Port', 'At Port', 'At Port', 'At Sea', 'At Sea', 'At Sea', 'At Sea'], // Vessel Status\n // ['Ballast', 'Ballast', 'Ballast', 'Laden', 'Laden', 'Laden', 'Laden'], // Vessel Condition\n // [2.15, 2.30, 2.25, 2.15, 1.97, 1.90, 1.96], // new field in DNR R L1 (2)\n // [1.96, 1.26, 0.86, 2.00, 1.90, 1.96, 1.93], // new field in DNR S L2 (3)\n //];\n\n let maxResLimit = Math.max(Math.max(...seriesData[2]), Math.max(...seriesData[3]));\n let maxResLimitData = maxResLimit + maxResLimit * 0.1;\n\n\n option = {\n\n title: {\n text: 'Main Switchboard 3Phase Earth Fault Monitor Readings',\n textStyle: {\n color: '#C2417C'\n },\n subtext: '440 Volts - 220/110 Volts',\n subtextStyle: {\n color: '#bf6d92',\n fontSize: 15\n },\n left: 'center'\n\n },\n legend: {\n data: seriesName,\n bottom: 0\n },\n color: colors,\n grid: [{\n top: 80,\n bottom: 100,\n left: 80,\n right: 80\n }],\n tooltip: {\n trigger: 'axis',\n triggerOn: \"click\",\n axisPointer: {\n type: 'shadow'\n },\n formatter: function (params) {\n\n var insrt = [];\n var result = params[0].dataIndex;\n\n for (var i in seriesData) {\n var obj = seriesData[i];\n insrt[i] = obj[result];\n }\n\n var tip = \"\";\n tip = '<table class=\"tooltipTable\" style=\"width: 100%\"><tr><td class=\"tooltpstyle\" align=\"center\" width=\"40%\"><b>' + insrt[0] + '</b></td><td class=\"tooltpstyle\" align=\"center\" width=\"30 %\">' + insrt[1] + '</td></tr></table><table class=\"tooltipTable\" style=\"margin - bottom:10px; width: 200px\"><tr><td class=\"tooltpStyle\" align=\"left\" style=\"background: #555; color: #fff\" width=\"\">Earth Fault Monitor</td><td class=\"tooltpStyle\" align=\"left\" style=\"background: #555; color: #fff\" width=\"\"> Resistance </td></tr><tr><td class=\"tooltpStyle\" align=\"left\">440 Volts </td><td align=\"left\"><span style=\"color: #fff; background: ' + colors[0] + '; padding: 0 5px\">' + insrt[2] + '</span> MΩ</td></tr><tr><td class=\"tooltpStyle\" align=\"left\">220/110 Volts</td><td align=\"left\"><span style=\"color: #fff; background:' + colors[1] + '; padding: 0 5px\">' + insrt[3] + '</span> MΩ</td></tr></table>';\n\n return tip;\n },\n\n backgroundColor: '#ecf0f1',\n borderColor: 'black',\n padding: 5,\n backgroundColor: 'rgba(245, 245, 245, 0.9)',\n borderWidth: 2,\n borderColor: '#999',\n textStyle: {\n color: '#000'\n },\n\n position: function (pos, params, el, elRect, size) {\n var obj = {\n top: 60\n };\n obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 160;\n return obj;\n },\n\n shared: true,\n extraCssText: 'width: auto; height: auto'\n },\n toolbox: {\n feature: {\n restore: {\n show: true,\n title: 'Refresh'\n },\n saveAsImage: {\n show: true,\n title: 'Save'\n }\n }\n },\n dataZoom: [{\n bottom: 30,\n type: 'slider',\n show: 'true',\n start: 0,\n end: 100,\n dataBackground: {\n areaStyle: {\n color: '#7ECFF2'\n }\n },\n fillerColor: 'rgba(78,119,166,0.2)',\n handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',\n handleSize: '70%',\n handleStyle: {\n color: '#3D7C7F'\n }\n }],\n xAxis: [\n\n {\n type: 'category',\n data: dateRange,\n splitLine: {\n show: true,\n lineStyle: {\n type: 'dashed'\n }\n },\n axisPointer: {\n show: true,\n label: {\n show: true\n }\n },\n }\n\n ],\n\n yAxis: [{\n name: 'Resistance (MΩ)',\n nameLocation: 'center',\n min: 0,\n max: maxResLimitData,\n nameRotate: 90,\n nameTextStyle: {\n padding: 30,\n fontWeight: 700,\n fontSize: 14\n },\n axisPointer: {\n show: true,\n label: {\n show: true\n }\n },\n type: 'value'\n }],\n series: [{\n name: seriesName[0],\n type: 'bar',\n label: {\n normal: {\n //show: true,\n distance: 15,\n align: 'center',\n verticalAlign: 'middle',\n position: 'insideBottom',\n formatter: '{c}'\n // formatter: '{c} MΩ'\n }\n },\n barGap: '0%',\n data: seriesData[2]\n },\n {\n name: seriesName[1],\n type: 'bar',\n label: {\n normal: {\n //show: true,\n distance: 15,\n align: 'center',\n verticalAlign: 'middle',\n position: 'insideBottom',\n formatter: '{c}'\n }\n },\n barGap: '0%',\n data: seriesData[3]\n },\n {\n type: 'line',\n itemStyle: {\n normal: {\n opacity: 0\n }\n },\n lineStyle: {\n normal: {\n opacity: 0\n }\n },\n markLine: {\n data: [{\n name: 'Markline between two points',\n yAxis: resLimitVal // resistance limit applied to the marker line.\n }],\n label: {\n normal: {\n show: true,\n formatter: ' \\n{c} MΩ\\nResistance\\nLimit'\n }\n },\n lineStyle: {\n normal: {\n color: 'red'\n }\n }\n }\n }\n ]\n };\n\n\n\n require.config({\n paths: {\n echarts3: '../js/echartsAll3'\n }\n });\n\n require(\n ['echarts3'],\n function (ec) {\n var graphFilDivName = graphDiv + \"Graph\";\n var graphFilDiv = document.getElementById(graphFilDivName);\n var myChartPerf = ec.init(graphFilDiv);\n myChartPerf.setOption(option);\n cpGraphState5a = myChartPerf;\n }\n );\n}", "title": "" }, { "docid": "c33447e1d164e05bb0a4895e1725d03e", "score": "0.5244933", "text": "function postInit(target, data, options) {\n for (var i=0; i<this.series.length; i++) {\n if (this.series[i].renderer.constructor == $.jqplot.LineRenderer) {\n // don't allow mouseover and mousedown at same time.\n if (this.series[i].highlightMouseOver) {\n this.series[i].highlightMouseDown = false;\n }\n }\n }\n }", "title": "" }, { "docid": "48c2503acf002415b1f41e06ac3494ed", "score": "0.5244315", "text": "function removeChartSection() {\n $('#poll-chart').remove();\n}", "title": "" }, { "docid": "e3b59f94440e940e54f2826b73a7ee0b", "score": "0.5239641", "text": "function cleanIndicatorArray() {\n let time = new Date().getTime(); //current time\n for (var i = 0; i < indicatorArray.length; i++) {\n if (indicatorArray[i].endTime < time) { //if the endtime is in the past\n indicatorArray.splice(i, 1); //remove the indicator from the array\n }\n }\n }", "title": "" }, { "docid": "55aa363e721862b9cf003c41d86652f0", "score": "0.5238326", "text": "function WhatMySpendBreakdownChart(options) {\n var filteringValues = options.filterData;\n if(filteringValues){\n filteringValues.forEach(function(filterData, i){\n options.data.dataset.map(function(actualData, index){\n if (filterData === actualData.name) {\n options.data.dataset.splice(index, 1);\n }\n })\n })\n }\n d3.selectAll(\".what-my-spend-breakdown-container\").remove();\n var margin = options.margin;\n var width = $(options.appendTo).width() - margin.left - margin.right;\n var height = options.height - margin.top - margin.bottom;\n\n var chartContainer = d3.select(options.appendTo)\n .append('div')\n .attr('class', 'chart-container what-my-spend-breakdown-container');\n\n // The main svg.\n var svg = chartContainer.append('svg')\n .attr('width', width + margin.left + margin.right)\n .attr('height', height + margin.top + margin.bottom)\n .append('g')\n .attr('transform', 'translate(' + margin.left + ', ' + margin.top + ')');\n\n // An element that holds the stuff in the SVG that can change.\n // We need this because we cannot clear the SVG on IE11 using .html('')\n // because IE11 doesn't support innerHTML on SVGs.\n var chartSvg = null;\n\n renderRaw({\n colors: options.data.colors,\n y: {\n 'min': 0,\n 'max': options.data.total\n },\n data: options.data.dataset\n });\n\n\n // The core rendering function. Handles almost everything.\n function renderRaw(data) {\n // Clear old data. IE11 hack.\n if (chartSvg) {\n chartSvg.remove();\n }\n chartSvg = svg.append('g');\n\n var maxValue = data.y.max;\n var leftValue = maxValue;\n data.data.forEach(function(item) {\n item.leftValue = leftValue;\n leftValue -= item.value;\n });\n var newDataSet = [\n {'name': 'TOTAL', 'value': maxValue, 'leftValue': maxValue}\n ].concat(data.data);\n newDataSet.push(\n {'name': 'OTHER', 'value': leftValue, 'leftValue': leftValue}\n );\n\n // var dataSeries = data.series;\n var xScale = d3.scale.ordinal()\n .domain(newDataSet.map(function(item) {\n return item.name;\n }))\n .rangeRoundBands([0, width], 0.2);\n var yScale = d3.scale.linear()\n .domain([data.y.min, maxValue])\n .rangeRound([height, 0]);\n\n // Create X-axis labels.\n var xAxis = d3.svg.axis()\n .orient('buttom')\n .outerTickSize(0)\n .innerTickSize(0)\n .scale(xScale);\n chartSvg.append('g')\n .attr('class', 'x axis')\n .attr('transform', 'translate(0, ' + (height + 10) + ')')\n .call(xAxis)\n .selectAll('text')\n .attr('class', 'axis-text');\n\n // Create Y-axis labels.\n var yAxis = d3.svg.axis()\n .outerTickSize(0)\n .innerTickSize(-width - margin.left + 10)\n .scale(yScale)\n .ticks(5)\n .tickFormat(function(d) {\n if (d === 0) {\n return '';\n } else if (d >= 1000) {\n return '$' + Math.round(d / 1000) + 'K';\n }\n return '';\n })\n .orient('left');\n chartSvg.append('g')\n .attr('class', 'y axis')\n .attr('transform', 'translate(' + (-margin.left + 10) + ', 0)')\n .call(yAxis)\n .selectAll('text')\n .attr('class', 'axis-text')\n .attr('x', 0)\n .attr('y', -8)\n .style('text-anchor', 'start');\n\n\n // Plot the actual data.\n chartSvg.selectAll('p')\n .data(newDataSet)\n .enter()\n .append('rect')\n .attr('x', function(d) {\n return xScale(d.name);\n })\n .attr('width', xScale.rangeBand())\n .attr('y', function(d) {\n return yScale(d.leftValue);\n })\n .attr('height', function(d) {\n return yScale(maxValue - d.value);\n })\n .style('fill', function(d) {\n if (d.name === 'TOTAL') {\n return data.colors.TOTAL;\n }\n\n return data.colors.OTHERS;\n });\n }\n}", "title": "" }, { "docid": "88081adc8bae32bb68660277c1e98ac5", "score": "0.52379274", "text": "function mpchart09a(graphDiv, seriesData1, dateRange1) {\n\n var option = null;\n var colors = ['#FF605A', '#524FFF', '#E8403D']; //'#0631FF'];\n var dateRange = dateRange1;\n\n\n var seriesName = ['Crankcase Oil ROB (Ltr)', 'Expected Feed Rate (g/BHP h)'];\n var seriesData = seriesData1;\n //var seriesData = [\n\n // ['At Port', 'At Port', 'At Port', 'At Sea', 'At Sea', 'At Sea', 'At Sea'], // Vessel Status (0)\n // ['Laden', 'Laden', 'Laden', 'Laden', 'Laden', 'Laden', 'Laden'], // Vessel Condition (1)\n\n // [14600, 14600, 14600, 14600, 14600, 14600, 14600], // ME Crankcase Oil - Prev ROB (2)\n // [600, 0, 0, 0, 0, 100, 0], // ME Crankcase Oil (3)\n // [14000, 14000, 14000, 14000, 14000, 13900, 13900], // ME Crankcase Oil - ROB (4)\n // [20, 20, 20, 20, 20, 20, 20], // ME Crankcase Oil - Capacity (m3) (5) \n //];\n\n\n // setting the max value for the graph\n\n var minROB = Number(Math.min(Math.min.apply(null, seriesData[4]))) - Number(Math.min(Math.min.apply(null, seriesData[4]))) * 0.05;\n var maxROB = Number(Math.max(Math.max.apply(null, seriesData[4]))) + Number(Math.max(Math.max.apply(null, seriesData[4]))) * 0.05;\n var maxcapacity = Math.max(Math.max.apply(null, seriesData[5]));\n if (maxROB < maxcapacity)\n maxROB = maxcapacity;\n if (minROB > maxcapacity)\n minROB = maxcapacity;\n\n option = {\n title: {\n text: 'M/E Crankcase Lubricating Oil',\n textStyle: {\n color: '#C2417C'\n },\n subtext: 'Consumption & Inventory (Ltr/Day)',\n subtextStyle: {\n fontSize: 16,\n color: '#BF6D92'\n },\n left: 'center'\n\n },\n color: colors,\n grid: [{\n top: 80,\n bottom: 100\n }],\n tooltip: {\n trigger: 'axis',\n triggerOn: \"click\",\n axisPointer: {\n type: 'shadow'\n },\n formatter: function (params) {\n\n /*---------------------Code for ballast and air sea---------------------------------*/\n\n\n var insrt = [];\n var result = params[0].dataIndex;\n\n for (var i in seriesData) {\n var obj = seriesData[i];\n insrt[i] = obj[result];\n }\n /*----------------------------------------------------------------------------------*/\n\n var tip = \"\";\n tip = '<table class=\"tooltipTable\" style=\"margin-bottom: 10px;\"><tr><td class=\"tooltpstyle\" align=\"center\"><b>' + insrt[0] + '</b></td><td class=\"tooltpstyle\" align=\"center\"><b>' + insrt[1] + '</b></td></tr></table><table class=\"tooltipTable\" style=\"margin - bottom:10px;\"> <tr> <td class=\"tooltpStyle\" align=\"center\" colspan=\"2\" style=\"background: #777; color: white\">Crankcase Oil</td></tr><tr> <td class=\"tooltpStyle\" align=\"left\">Previous ROB</td><td align=\"right\"> ' + insrt[2] + ' Ltr</td></tr><tr> <td class=\"tooltpStyle\" align=\"left\">Consumption</td><td align=\"right\">' + insrt[3] + ' Ltr/Day</td></tr><tr> <td class=\"tooltpStyle\" align=\"left\">ROB</td><td align=\"right\"><span style=\"color: white; background:' + colors[0] + '; padding: 0 5px\">' + insrt[4] + '</span> Ltr</td></tr></table>';\n\n return tip;\n },\n\n backgroundColor: '#ecf0f1',\n borderColor: 'black',\n padding: 5,\n backgroundColor: 'rgba(245, 245, 245, 0.9)',\n borderWidth: 2,\n borderColor: '#999',\n textStyle: {\n color: '#000'\n },\n\n position: function (pos, params, el, elRect, size) {\n var obj = {\n top: 55\n };\n obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 160;\n return obj;\n },\n\n shared: true,\n extraCssText: 'width: auto; height: auto'\n },\n toolbox: {\n feature: {\n restore: {\n show: true,\n title: 'Refresh'\n },\n saveAsImage: {\n show: true,\n title: 'Save'\n }\n }\n },\n dataZoom: [{\n bottom: 30,\n type: 'slider',\n show: 'true',\n start: 0,\n end: 100,\n dataBackground: {\n areaStyle: {\n color: '#7ECFF2'\n }\n },\n fillerColor: 'rgba(78,119,166,0.2)',\n handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',\n handleSize: '70%',\n handleStyle: {\n color: '#3D7C7F'\n }\n }],\n\n legend: {\n\n\n left: 'center',\n width: 1200,\n bottom: 0,\n itemGap: 30,\n data: [{\n name: seriesName[0]\n },\n\n {\n name: seriesName[1]\n }\n\n ],\n textStyle: {\n fontWeight: 'bold'\n }\n\n },\n xAxis: {\n type: 'category',\n data: dateRange,\n axisPointer: {\n show: true,\n label: {\n show: true\n }\n },\n },\n yAxis: [{\n name: seriesName[0],\n min: minROB,\n max: maxROB,\n nameLocation: 'center',\n nameRotate: 90,\n nameTextStyle: {\n padding: 50,\n fontWeight: 700,\n fontSize: 14\n },\n axisPointer: {\n show: true,\n label: {\n show: true\n }\n },\n type: 'value'\n }],\n series: [{\n name: seriesName[0],\n type: 'bar',\n barGap: '0%',\n label: {\n normal: {\n //show: true,\n distance: 15,\n color: '#fff',\n align: 'center',\n verticalAlign: 'middle',\n position: 'insideBottom',\n formatter: '{c}'\n }\n },\n data: seriesData[4]\n }\n ,\n {\n type: 'line',\n itemStyle: {\n normal: {\n opacity: 0\n }\n },\n lineStyle: {\n normal: {\n opacity: 0\n }\n },\n markLine: {\n data: [{\n name: 'Markline between two points',\n yAxis: maxcapacity\n }],\n label: {\n normal: {\n show: true,\n position: 'middle',\n formatter: '{c} M/E Oil Sump Tank Capacity'\n }\n },\n lineStyle: {\n normal: {\n color: 'blue'\n }\n }\n }\n }\n ]\n };\n\n\n require.config({\n paths: {\n echarts3: '../js/echartsAll3'\n },\n });\n\n require(\n ['echarts3'],\n function (ec) {\n var graphFilDivName = graphDiv + \"Graph\";\n var graphFilDiv = document.getElementById(graphFilDivName);\n var myChartPerf = ec.init(graphFilDiv);\n myChartPerf.setOption(option);\n cpGraphState9a = myChartPerf;\n }\n );\n}", "title": "" }, { "docid": "189468733eac5dcb4161edb0c22be725", "score": "0.52357566", "text": "backgroundTraces() {\n\n // here we combine all data for the chosen parameter & location\n // and use it to calculate a 95% confidence interval\n // which we will use as a grey background in the graph\n\n let allTrace = {};\n\n if (this.traces.length > 0) {\n for (let trace of this.traces) {\n\n let times = trace.x;\n let vals = trace.y;\n\n for (let i = 0; i < times.length; i++) {\n let t = times[i];\n let y = vals[i];\n\n if (Object.keys(allTrace).includes(t)) {\n allTrace[t].push(y);\n } else {\n allTrace[t] = [y];\n }\n }\n }\n\n let times = Object.keys(allTrace).sort((a,b) => new Date(b) - new Date(a));\n let x = [];\n let n_arr = [];\n let y_low = [];\n let y_high = [];\n\n for (let t of times) {\n\n let n = allTrace[t].length;\n let mean = allTrace[t].reduce((a,b) => a + b)/n ;\n\n let variance = allTrace[t].map(e => e - mean).map(e => e*e).reduce((a,b) => a + b);\n let stddev = Math.sqrt(variance);\n let stderr = stddev/Math.sqrt(n);\n\n n_arr.push(n);\n x.push(t);\n y_low.push(Math.max(mean - 1.96 * stderr,0));\n y_high.push(Math.max(mean + 1.96 * stderr,0));\n\n }\n\n\n return [\n // WHO limit\n {\n x: x,\n y: this.parameter == 'pm25' ? x.map(e => 25) : [],\n type: \"scatter\",\n mode: \"lines\",\n fill: \"tozeroy\",\n name: \"WHO PM 2.5 daily average guideline\",\n fillcolor: \"rgba(50, 170, 50, 0.3)\",\n line: {color: \"transparent\"},\n hoverinfo: 'none'\n },\n\n // upper limit of 95% confidence interval\n {\n x: x.filter((e,i) => n_arr[i] > 1),\n y: y_high.filter((e,i) => n_arr[i] > 1),\n name: 'Upper Bound',\n type: 'scatter',\n mode: 'lines',\n line: {color: \"transparent\"}\n },\n\n // lower limit of 95% confidence interval\n {\n x: x.filter((e,i) => n_arr[i] > 1),\n y: y_low.filter((e,i) => n_arr[i] > 1),\n name: 'Lower Bound',\n type: 'scatter',\n mode: 'lines',\n fill: \"tonexty\",\n fillcolor: \"rgba(68, 68, 68, 0.3)\",\n line: {color: \"transparent\"}\n },\n\n ];\n\n\n } else {\n return []\n }\n }", "title": "" }, { "docid": "a3465977027bcb8e5ac0417307a6ca68", "score": "0.52290326", "text": "function rescale() {\n min = 0;\n max = 0;\n for (var i = 1; i < MetaData.length; i++) {\n if (graph.series[i].disabled != true) {\n min = min < MetaData[i][0] ? min : MetaData[i][0];\n max = max > MetaData[i][1] ? max : MetaData[i][1];\n }\n }\n Scales[1] = d3.scale.linear().domain([min, max]).nice();\n graph.update();\n}", "title": "" }, { "docid": "27cb871b0392c058ec7f4e573290f239", "score": "0.5225986", "text": "function onSeriesDestroy() {\n var series = this,\n chart = series.chart;\n if (chart.boost &&\n chart.boost.markerGroup === series.markerGroup) {\n series.markerGroup = null;\n }\n if (chart.hoverPoints) {\n chart.hoverPoints = chart.hoverPoints.filter(function (point) {\n return point.series === series;\n });\n }\n if (chart.hoverPoint && chart.hoverPoint.series === series) {\n chart.hoverPoint = null;\n }\n }", "title": "" }, { "docid": "6ed23986a357cee01e2a8cb6dde6f9e9", "score": "0.52106833", "text": "_cleanChart() {\n select(this.node).selectAll('*').remove();\n select(this.node.parentNode).select('div').remove();\n }", "title": "" }, { "docid": "e2a3d52029b956c903a009442db5f841", "score": "0.519927", "text": "function onChartAfterAddSeries() {\n if (this.navigator) {\n // Recompute which series should be shown in navigator, and add them\n this.navigator.setBaseSeries(null, false);\n }\n }", "title": "" }, { "docid": "f4f572ae651a5d2f75995459e84e8e49", "score": "0.5170281", "text": "getUnionExtremes(returnFalseOnNoBaseSeries) {\n const baseAxis = this.chart.xAxis[0], navAxis = this.xAxis, navAxisOptions = navAxis.options, baseAxisOptions = baseAxis.options;\n let ret;\n if (!returnFalseOnNoBaseSeries || baseAxis.dataMin !== null) {\n ret = {\n dataMin: pick(// #4053\n navAxisOptions && navAxisOptions.min, numExt('min', baseAxisOptions.min, baseAxis.dataMin, navAxis.dataMin, navAxis.min)),\n dataMax: pick(navAxisOptions && navAxisOptions.max, numExt('max', baseAxisOptions.max, baseAxis.dataMax, navAxis.dataMax, navAxis.max))\n };\n }\n return ret;\n }", "title": "" }, { "docid": "63a089d924afe7285c8a734151488ac0", "score": "0.51455295", "text": "function chartFun1() {\n\n var data = new google.visualization.DataTable();\n data.addColumn('number', 'X');\n data.addColumn('number', 'Temp');\n\n\n data.addRows([\n [0, tempArray[59]], [1, tempArray[58]], [2, tempArray[57]], [3, tempArray[56]], [4, tempArray[55]], [5, tempArray[54]],\n [6, tempArray[53]], [7, tempArray[52]], [8, tempArray[51]], [9, tempArray[50]], [10, tempArray[49]], [11, tempArray[48]],\n [12, tempArray[47]], [13, tempArray[46]], [14, tempArray[45]], [15, tempArray[44]], [16, tempArray[43]], [17, tempArray[42]],\n [18, tempArray[41]], [19, tempArray[40]], [20, tempArray[39]], [21, tempArray[38]], [22, tempArray[37]], [23, tempArray[36]],\n [24, tempArray[35]], [25, tempArray[34]], [26, tempArray[33]], [27, tempArray[32]], [28, tempArray[31]], [29, tempArray[30]],\n [30, tempArray[29]], [31, tempArray[28]], [32, tempArray[27]], [33, tempArray[26]], [34, tempArray[25]], [35, tempArray[24]],\n [36, tempArray[23]], [37, tempArray[22]], [38, tempArray[21]], [39, tempArray[20]], [40, tempArray[19]], [41, tempArray[18]],\n [42, tempArray[17]], [43, tempArray[16]], [44, tempArray[15]], [45, tempArray[14]], [46, tempArray[13]], [47, tempArray[12]],\n [48, tempArray[11]], [49, tempArray[10]], [50, tempArray[9]], [51, tempArray[8]], [52, tempArray[7]], [53, tempArray[6]],\n [54, tempArray[5]], [55, tempArray[4]], [56, tempArray[3]], [57, tempArray[2]], [58, tempArray[1]], [59, tempArray[0]]\n ]);\n\n var options = {\n hAxis: {\n title: 'Time (Mins)'\n },\n curveType: 'function',\n vAxis: {\n title: 'Temp'\n },\n backgroundColor: '#f1f8e9'\n };\n\n var chart = new google.visualization.LineChart(document.getElementById('chart_temp1'));\n chart.draw(data, options);\n }", "title": "" }, { "docid": "3cf93a943dcc40373fc5f1ae037f55b6", "score": "0.5145459", "text": "getChartInverterPerformance() {\n let self = this;\n let curItem = this.state.curItem, paramsFilter = this.state.paramsFilter;\n paramsFilter.id = curItem.id;\n paramsFilter.start_date = Libs.convertAllFormatDate(Libs.dateFormat(curItem.start_date, \"MM/DD/YYYY\", \"MM/DD/YYYY\") + \" 00:00:00\");\n // paramsFilter.start_date = \"2020-11-02 00:00:00\";\n if (Libs.dateFormat(curItem.current_time, \"MM/DD/YYYY\", \"MM/DD/YYYY\") == Libs.dateFormat(curItem.end_date, \"MM/DD/YYYY\", \"MM/DD/YYYY\")) {\n paramsFilter.end_date = Libs.convertAllFormatDate(curItem.end_date); // '2020-11-01 23:59:59';\n } else {\n paramsFilter.end_date = Libs.convertAllFormatDate(Libs.dateFormat(curItem.end_date, \"MM/DD/YYYY\", \"MM/DD/YYYY\") + \" 23:59:59\");\n }\n paramsFilter.offset_timezone = Libs.getOffsetTimeZone(curItem.end_date);\n\n MiniSiteService.instance.getChartInverterPerformance(paramsFilter, (data) => {\n if (!Libs.isObjectEmpty(data)) {\n\n var dataIrradiance = [], dataPower = [], dataEnergy = [], categories = [], titleEnergy = \"\", xAxisTitle = null;\n switch (paramsFilter.filterBy) {\n case \"threeDay\":\n if (Libs.isArrayData(data.irradiance)) {\n var dataListIrradiance = data.irradiance;\n for (var j = 0; j < dataListIrradiance.length; j++) {\n if (j == 0) { xAxisTitle = dataListIrradiance[j].xAxisTitle; }\n var itemArr = [Date.parse(dataListIrradiance[j].string_time + \" UTC\"), dataListIrradiance[j].sensor1_data < 0 ? 0 : dataListIrradiance[j].sensor1_data];\n dataIrradiance.push(itemArr);\n }\n }\n\n if (Libs.isArrayData(data.energy)) {\n var dataListThreeDayEnergy = data.energy;\n for (var k = 0; k < dataListThreeDayEnergy.length; k++) {\n if (k == 0) {\n titleEnergy = dataListThreeDayEnergy[k].devicename;\n } else {\n if (dataListThreeDayEnergy[k].ytd_kwh_total <= 0 || dataListThreeDayEnergy[k - 1].ytd_kwh_total <= 0) {\n dataEnergy.push([Date.parse(dataListThreeDayEnergy[k].string_time + \" UTC\"), 0]);\n } else {\n var energy = (dataListThreeDayEnergy[k].ytd_kwh_total - dataListThreeDayEnergy[k - 1].ytd_kwh_total) < 0 ? 0 : Libs.round(dataListThreeDayEnergy[k].ytd_kwh_total - dataListThreeDayEnergy[k - 1].ytd_kwh_total, 2);\n dataEnergy.push([Date.parse(dataListThreeDayEnergy[k].string_time + \" UTC\"), energy]);\n }\n //ac_power \n var itemArrPower = [Date.parse(dataListThreeDayEnergy[k].string_time + \" UTC\"), dataListThreeDayEnergy[k].ac_power < 0 ? 0 : dataListThreeDayEnergy[k].ac_power];\n dataPower.push(itemArrPower);\n }\n\n }\n }\n\n break;\n case \"month\":\n if (Libs.isArrayData(data.energy)) {\n var dataListMonth = data.energy;\n for (var m = 0; m < dataListMonth.length; m++) {\n if (m == 0) { titleEnergy = dataListMonth[m].devicename; xAxisTitle = dataListMonth[m].xAxisTitle; }\n categories.push(dataListMonth[m].convert_time);\n // Energy\n dataEnergy.push([dataListMonth[m].full_time, dataListMonth[m].energy_month_kw]);\n // Power\n dataPower.push([dataListMonth[m].full_time, dataListMonth[m].avg_ac_power]);\n // Irradiance\n dataIrradiance.push([dataListMonth[m].full_time, dataListMonth[m].avg_month_sensor1_data]);\n }\n }\n\n break;\n case \"year\":\n if (Libs.isArrayData(data.energy)) {\n var dataListYear = data.energy;\n for (var n = 0; n < dataListYear.length; n++) {\n if (n == 0) { titleEnergy = dataListYear[n].devicename; xAxisTitle = dataListYear[n].xAxisTitle; }\n categories.push(dataListYear[n].convert_time);\n // Energy\n dataEnergy.push([dataListYear[n].full_time, dataListYear[n].energy_month_kw]);\n // Power\n dataPower.push([dataListYear[n].full_time, dataListYear[n].avg_ac_power]);\n // Irradiance\n dataIrradiance.push([dataListYear[n].full_time, dataListYear[n].avg_month_sensor1_data]);\n }\n }\n break;\n case \"lifetime\":\n if (Libs.isArrayData(data.energy)) {\n var dataListLifetime = data.energy;\n for (var h = 0; h < dataListLifetime.length; h++) {\n if (h == 0) { titleEnergy = dataListLifetime[h].devicename; xAxisTitle = dataListLifetime[h].xAxisTitle }\n categories.push(dataListLifetime[h].convert_time);\n // Energy\n dataEnergy.push([dataListLifetime[h].full_time, dataListLifetime[h].energy_month_kw]);\n // Power\n dataPower.push([dataListLifetime[h].full_time, dataListLifetime[h].avg_ac_power]);\n // Irradiance\n dataIrradiance.push([dataListLifetime[h].full_time, dataListLifetime[h].avg_month_sensor1_data]);\n }\n }\n break;\n default:\n if (Libs.isArrayData(data.irradiance)) {\n var dataListDayIrradiance = data.irradiance;\n for (var i = 0; i < dataListDayIrradiance.length; i++) {\n if (i == 0) { xAxisTitle = dataListDayIrradiance[i].xAxisTitle; }\n dataIrradiance.push([dataListDayIrradiance[i].time, dataListDayIrradiance[i].sensor1_data < 0 ? 0 : dataListDayIrradiance[i].sensor1_data]);\n }\n }\n\n if (Libs.isArrayData(data.energy)) {\n var dataListEnergy = data.energy;\n for (var u = 0; u < dataListEnergy.length; u++) {\n if (u == 0) {\n titleEnergy = dataListEnergy[u].devicename;\n categories.push([dataListEnergy[u].time]);\n } else {\n if (dataListEnergy[u].ytd_kwh_total <= 0 || dataListEnergy[u - 1].ytd_kwh_total <= 0) {\n dataEnergy.push([0]);\n } else {\n dataEnergy.push([(dataListEnergy[u].ytd_kwh_total - dataListEnergy[u - 1].ytd_kwh_total) < 0 ? 0 : Libs.round(dataListEnergy[u].ytd_kwh_total - dataListEnergy[u - 1].ytd_kwh_total, 2)]);\n }\n categories.push([dataListEnergy[u].time]);\n\n //ac_power \n dataPower.push([dataListEnergy[u].time, dataListEnergy[u].ac_power < 0 ? 0 : dataListEnergy[u].ac_power]);\n }\n\n }\n }\n\n break;\n }\n\n self.setState({\n dataCategories: categories,\n dataIrradiance: dataIrradiance,\n dataPower: dataPower,\n dataEnergy: dataEnergy,\n titleEnergy: titleEnergy,\n xAxisTitle: xAxisTitle\n }, () => {\n self.loadChartOption();\n });\n }\n });\n }", "title": "" }, { "docid": "5d6f14c0ba41f7e283582ba0e2c27e83", "score": "0.5119866", "text": "function removeBarGraph() {\n chart.selectAll('rect').remove();\n chart.selectAll('.y.axis').remove();\n chart.selectAll('.x.axis').remove();\n }", "title": "" }, { "docid": "3f1ded480ffe6033ea2950ebbac7cfe5", "score": "0.511868", "text": "modifyNavigatorAxisExtremes() {\n const xAxis = this.xAxis;\n if (typeof xAxis.getExtremes !== 'undefined') {\n const unionExtremes = this.getUnionExtremes(true);\n if (unionExtremes &&\n (unionExtremes.dataMin !== xAxis.min ||\n unionExtremes.dataMax !== xAxis.max)) {\n xAxis.min = unionExtremes.dataMin;\n xAxis.max = unionExtremes.dataMax;\n }\n }\n }", "title": "" }, { "docid": "8fdacf6fc3b58830ca9f7381c0268842", "score": "0.5111391", "text": "resetChart() {\n this.loadingQueue.drain();\n\n let props = this.properties;\n //extract all the props that need\n //to be passed on to each chart\n const {\n xScale,\n xAccessor,\n data,\n xExtents\n } = props;\n\n //extract start and end from extents\n let extents;\n if(typeof xExtents == \"function\") {\n extents = d3Extents(data, xExtents);\n }\n else {\n extents = xExtents;\n }\n\n const [start, end] = extents;\n let plotData = plotDataProcessor(data, xAccessor, start, end);\n\n this.xScale = xScale.copy();\n this.xScale.domain([start, end]);\n this.fullData = data;\n this.plotData = plotData; //plotData\n //console.log(this.fullData);\n this.firstItem = undefined;\n\n for(let i = 0; i < this.charts.length; i++) {\n let chart = this.charts[i];\n\n //set the x scales here\n //let { xScale } = chart.properties;;\n //xScale.domain([start, end]);\n\n chart.setProperties({\n xScale: this.xScale,\n //set extents instead of scale\n xExtents: [start, end],\n xAccessor: xAccessor,\n plotData: this.plotData,\n fullData: this.fullData\n });\n\n const { width, height } = this.properties;\n //pass them on if only one chart exists\n if(chart.properties.width == undefined) {\n chart.setProperties({\n width: width\n });\n }\n if(chart.properties.height == undefined) {\n chart.setProperties({\n height: height\n });\n }\n chart.updateScales(xAccessor, this.plotData, this.fullData);\n }\n\n //the ranges are still not set\n }", "title": "" }, { "docid": "ec1ee6f24e5572e5978419cad0735d2e", "score": "0.5099259", "text": "addBaseSeriesEvents() {\n const navigator = this, baseSeries = navigator.baseSeries || [];\n // Bind modified extremes event to first base's xAxis only.\n // In event of > 1 base-xAxes, the navigator will ignore those.\n // Adding this multiple times to the same axis is no problem, as\n // duplicates should be discarded by the browser.\n if (baseSeries[0] && baseSeries[0].xAxis) {\n baseSeries[0].eventsToUnbind.push(addEvent(baseSeries[0].xAxis, 'foundExtremes', this.modifyBaseAxisExtremes));\n }\n baseSeries.forEach((base) => {\n // Link base series show/hide to navigator series visibility\n base.eventsToUnbind.push(addEvent(base, 'show', function () {\n if (this.navigatorSeries) {\n this.navigatorSeries.setVisible(true, false);\n }\n }));\n base.eventsToUnbind.push(addEvent(base, 'hide', function () {\n if (this.navigatorSeries) {\n this.navigatorSeries.setVisible(false, false);\n }\n }));\n // Respond to updated data in the base series, unless explicitily\n // not adapting to data changes.\n if (this.navigatorOptions.adaptToUpdatedData !== false) {\n if (base.xAxis) {\n base.eventsToUnbind.push(addEvent(base, 'updatedData', this.updatedDataHandler));\n }\n }\n // Handle series removal\n base.eventsToUnbind.push(addEvent(base, 'remove', function () {\n if (this.navigatorSeries) {\n erase(navigator.series, this.navigatorSeries);\n if (defined(this.navigatorSeries.options)) {\n this.navigatorSeries.remove(false);\n }\n delete this.navigatorSeries;\n }\n }));\n });\n }", "title": "" }, { "docid": "e69b6354142f3505afcbf63ae396a03d", "score": "0.5093669", "text": "function cleanBarData(d) {\n d.forEach(function(d) {\n d.datum = new Date(d.datum);\n d.km_lopend = Number(d.km_lopend);\n d.km_ov = Number(d.km_ov);\n });\n }", "title": "" }, { "docid": "9bb3f2848634952ad73cffbe0f94f9c3", "score": "0.5085591", "text": "function removeHistogramChart() {\n histogramChart.selectAll('.bin-bar').remove();\n histogramChart.selectAll('.line').remove();\n histogramChart.selectAll('.y.axis').remove();\n histogramChart.selectAll('.x.axis').remove();\n d3.select(selectorHist)\n .attr('width', 0)\n .attr('height', 0);\n }", "title": "" }, { "docid": "f207a8b3f628d9c87b15645be1cac370", "score": "0.5082159", "text": "function processPoint(d, i) {\n var chartDestroyed = typeof chart.index === 'undefined';\n var x,\n y,\n clientX,\n plotY,\n percentage,\n low = false,\n isYInside = true;\n if (typeof d === 'undefined') {\n return true;\n }\n if (!chartDestroyed) {\n if (useRaw) {\n x = d[0];\n y = d[1];\n }\n else {\n x = d;\n y = yData[i];\n }\n // Resolve low and high for range series\n if (isRange) {\n if (useRaw) {\n y = d.slice(1, 3);\n }\n low = y[0];\n y = y[1];\n }\n else if (isStacked) {\n x = d.x;\n y = d.stackY;\n low = y - d.y;\n percentage = d.percentage;\n }\n // Optimize for scatter zooming\n if (!requireSorting) {\n isYInside = (y || 0) >= yMin && y <= yMax;\n }\n if (y !== null && x >= xMin && x <= xMax && isYInside) {\n clientX = xAxis.toPixels(x, true);\n if (sampling) {\n if (typeof minI === 'undefined' ||\n clientX === lastClientX) {\n if (!isRange) {\n low = y;\n }\n if (typeof maxI === 'undefined' ||\n y > maxVal) {\n maxVal = y;\n maxI = i;\n }\n if (typeof minI === 'undefined' ||\n low < minVal) {\n minVal = low;\n minI = i;\n }\n }\n // Add points and reset\n if (!compareX || clientX !== lastClientX) {\n // maxI is number too:\n if (typeof minI !== 'undefined') {\n plotY =\n yAxis.toPixels(maxVal, true);\n yBottom =\n yAxis.toPixels(minVal, true);\n addKDPoint(clientX, plotY, maxI, percentage);\n if (yBottom !== plotY) {\n addKDPoint(clientX, yBottom, minI, percentage);\n }\n }\n minI = maxI = void 0;\n lastClientX = clientX;\n }\n }\n else {\n plotY = Math.ceil(yAxis.toPixels(y, true));\n addKDPoint(clientX, plotY, i, percentage);\n }\n }\n }\n return !chartDestroyed;\n }", "title": "" }, { "docid": "ec788d019579a28f7579155750109d5d", "score": "0.5076461", "text": "function InitChart(arrayData) {\n\t\t\t\t\tvar minY=0;\n\t\t\t\t\tvar maxY=0;\n\t\t\t\t\tvar minY2=0;\n\t\t\t\t\tvar maxY2=0;\n\t\t\t\t\tvar d3Extent=[];\n\t\t\t\t\tvar chartSerialNum=0\n\t\t\t\t\tvar isTemp=false;\n\t\t\t\t\t//Calculating Min And Max Range for Chart Axis\n\t\t\t\t\tfor(var i in arrayData){\n\t\t\t\t\t\tvar maxSoil;\n\t\t\t\t\t\tvar minSoil\n\t\t\t\t\t\tvar minTemp;\n\t\t\t\t\t\tvar maxTemp;\n\t\t\t\t\t\tif(arrayData[i].length == 0){\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(assetsFactory.checkAssetMetricType(arrayData[i][0].metricCode, ['t1','t2','temp'])){\n\t\t\t\t\t\t\tisTemp=true;\n\t\t\t\t\t\t\t maxTemp=d3.max(arrayData[i], function (d) {\n\t\t\t\t\t\t\t\treturn +d.metricValue;\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t minTemp=d3.min(arrayData[i], function (d) {\n\t\t\t\t\t\t\t\treturn +d.metricValue;\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t if (minTemp<minY){\n\t\t\t\t\t\t\t\tminY=minTemp;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(maxTemp>maxY){\n\t\t\t\t\t\t\t\tmaxY=maxTemp;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t maxSoil=d3.max(arrayData[i], function (d) {\n\t\t\t\t\t\t\t\treturn +d.metricValue;\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t minSoil=d3.min(arrayData[i], function (d) {\n\t\t\t\t\t\t\t\treturn +d.metricValue;\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tif(minSoil<minY2){\n\t\t\t\t\t\t\t\tminY2=minSoil;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(maxSoil>maxY2){\n\t\t\t\t\t\t\t\tmaxY2=maxSoil;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar minD=d3.min(arrayData[i], function(d) { return new Date(d.detectionTime); });\n\t\t\t\t\t\tvar maxD=d3.max(arrayData[i], function(d) { return new Date(d.detectionTime); });\n\t\t\t\t\t\tif(!(undefined === minD))\n\t\t\t\t\t\t\td3Extent.push(minD);\n\t\t\t\t\t\tif(!(undefined === maxD))\n\t\t\t\t\t\t\td3Extent.push(maxD);\n\n\n/*\t\t\t\t\t\tvar localMiny= d3.min(arrayData[i], function (d) {\n\t\t\t\t\t\t\treturn +d.metricValue;\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tvar localMaxy= d3.max(arrayData[i], function (d) {\n\t\t\t\t\t\t\treturn +d.metricValue;\n\t\t\t\t\t\t});*/\n\t\t\t\t\t\t/*if(localMiny<minY){\n\t\t\t\t\t\t\tminY=localMiny;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(localMaxy>maxY){\n\t\t\t\t\t\t\tmaxY=localMaxy;\n\t\t\t\t\t\t} */\n\t\t\t\t\t}\n\t\t\t\t if (minY<-55){\n\t\t\t\t \tminY=-55;\n\t\t\t\t }\n\t\t\t\t if (maxY>70){\n\t\t\t\t \tmaxY=70;\n\t\t\t\t\t }\n\t\t\t\t if (minY2<0){\n\t\t\t\t\t\t minY2=0;\n\t\t\t\t\t }\n\t\t\t\t if (maxY2>100){\n\t\t\t\t\t\t maxY2=100;\n\t\t\t\t\t }\n\t\t\t\t d3Extent.sort(function(a, b){return a-b}) //Sorting Date in Assending Order\n\t\t\t\t\tvar minDateSensor = d3Extent[0];\n\t\t\t\t\tvar maxDateSensor = d3Extent[d3Extent.length-1];\n\t\t\t\t\tvar formateddatemin= new Date(minDateSensor);\n\t\t\t\t\tvar formateddatemax= new Date(maxDateSensor);\n\t\t\t\t\tvar date1 = new Date(minDateSensor);\n\t\t\t\t\tvar date2 = new Date(maxDateSensor);\n\t\t\t\t\tvar timeDiff = Math.abs(date2.getTime() - date1.getTime());\n\n\t\t\t var vis = d3.select(\"#compareChartDiv\"),\n\t\t\t\t\t\t\t\tWIDTH = (98 * window.innerWidth)/100,\n\t\t\t\t\t\t\t\tHEIGHT = (36 * window.innerHeight)/100, //250,\n\t\t\t\t\t\t\t\tMARGINS = { top: 20,right: 15,bottom: 20,left: 25},\n\t\t\t\t\t\t//Adding Scale ,Range,Domain of Axes\n\t\t\t\t\t xRange = d3.time.scale()\n\t\t\t\t\t\t\t\t.range([MARGINS.left, WIDTH - MARGINS.right-10 ])\n\t\t\t\t\t\t\t\t.domain([getPreviousDaysdate(7),new Date()]),\n\t\t\t\t\t yRange = d3.scale.linear()\n\t\t\t\t\t\t\t\t.range([HEIGHT - MARGINS.top, MARGINS.bottom])\n\t\t\t\t\t\t\t\t.domain([minY,maxY]),\n\t\t\t\t\t yRange2 = d3.scale.linear()//add\n\t\t\t\t\t\t\t\t.range([HEIGHT - MARGINS.top, MARGINS.bottom])\n\t\t\t\t\t\t\t\t.domain([minY2, maxY2]),\n\t\t\t\t\tyAxisRight= d3.svg.axis()//add\n\t\t\t\t\t\t\t\t.scale(yRange2)\n\t\t\t\t\t\t\t\t.orient(\"right\")\n\t\t\t\t\t\t\t\t.ticks(6)\n\t\t\t\t\t\t\t\t.tickSize(1),\n\t\t\t\t\t yAxis = d3.svg.axis()\n\t\t\t\t\t\t\t\t.scale(yRange)\n\t\t\t\t\t\t\t\t.orient(\"left\")\n\t\t\t\t\t\t\t\t.ticks(6)\n\t\t\t\t\t\t\t\t.tickSize(1);\n\t\t\t\t if(!isTemp){\n\t\t\t\t \tyRange.domain([minY2, maxY2]);\n\t\t\t\t }\n\t\t\t\t //Calculating Tickformat for Date Axis(X-Axis)\n\t\t\t\t\t// if(timeDiff < 86400000){\n\t\t\t\t\t// \t var xAxis = d3.svg.axis()\n\t\t\t\t\t// \t\t\t\t\t.scale(xRange)\n\t\t\t\t\t// \t\t\t\t\t.orient(\"bottom\")\n\t\t\t\t\t// \t\t\t\t\t.ticks(7)\n\t\t\t\t\t// \t\t\t\t\t.tickFormat(d3.time.format(\"%I:%M %p\"))\n\t\t\t\t\t// \t\t\t\t\t.tickSize(1);\n //\n\t\t\t\t\t// }else{\n\t\t\t\t\t\tvar xAxis = d3.svg.axis()\n\t\t\t\t\t\t\t\t\t\t.scale(xRange)\n\t\t\t\t\t\t\t\t\t\t.orient(\"bottom\")\n\t\t\t\t\t\t\t\t\t\t.ticks(7)\n\t\t\t\t\t\t\t\t\t\t//.tickValues(newData.map(function(d) { return d.Date; }));\n\t\t\t\t\t\t\t\t\t\t.tickFormat(d3.time.format(\"%b %d\"))\n\t\t\t\t\t\t\t\t\t\t.tickSize(1);\n\t\t\t\t\t // }\n\n\t\t\t\t\t//Line Function for Y1 Axis\n\t\t\t\t\tvar lineFunc = d3.svg.line()\n\t\t\t\t\t\t\t\t\t\t.interpolate(\"monotone\")\n\t\t\t\t\t\t\t\t\t\t.x(function (d) {return xRange(new Date(d.detectionTime));})\n\t\t\t\t\t\t\t\t\t\t.y(function (d) {return yRange(+d.metricValue); })\n\t\t\t\t\t\t\t\t\t\t.defined(function(d) { return !isNaN(d.metricValue) });\n\n\t\t\t\t\t//Line Function for Y2 Axis\n\t\t\t\t\tvar lineFunc2 = d3.svg.line()//add....................................\n\t\t\t\t\t\t\t\t\t\t.interpolate(\"monotone\")\n\t\t\t\t\t\t\t\t\t\t.x(function (d) {return xRange(new Date(d.detectionTime));})\n\t\t\t\t\t\t\t\t\t\t.y(function (d) {return yRange2(+d.metricValue); })\n\t\t\t\t\t\t\t\t\t\t.defined(function(d) {return !isNaN(d.metricValue)});\n\t\t\t\t\t//Adding backgorud image to chart\n\t\t\t\t\tvis.append(\"svg:rect\")\n .attr(\"width\", \"84%\")\n .attr(\"height\", \"75%\")\n .attr(\"fill\", \"#000\")\n .attr(\"fill-opacity\",\"0.2\")\n .attr(\"transform\", \"translate(\" + MARGINS.left + \",\" + MARGINS.top + \")\");;\n\n\t\t\t\t\t//Rotation of x-axis Date\n\t\t\t\t\tvis.append(\"svg:g\")\n\t\t\t\t\t\t\t\t\t.attr(\"class\", \"x axis\")\n\t\t\t\t\t\t\t\t\t.attr(\"transform\", \"translate(0,\" + (HEIGHT - (MARGINS.bottom)) + \")\")\n\t\t\t\t\t\t\t\t\t.call(xAxis)\n\t\t\t\t\t\t\t\t\t.selectAll(\"text\")\n\t\t\t\t\t\t\t\t\t.style(\"text-anchor\", \"end\")\n\t\t\t\t\t\t\t\t\t.style(\"font-size\",\"8px\")\n\t\t\t\t\t\t\t\t\t.style(\"font-family\",\"Halvetica_light_neue\")\n\t\t\t\t\t\t\t\t\t.attr(\"dx\", \"0.4em\")\n\t\t\t\t\t\t\t\t\t.attr(\"dy\", \"1em\")\n\t\t\t\t\t\t\t\t\t.attr(\"transform\", function(d) {\n\t\t\t\t\t\t\t\t\treturn \"rotate(-40)\"\n\t\t\t\t\t\t\t\t\t});\n\n/*\t\t\t\t\tvis.append(\"svg:g\")\n\t\t\t\t\t\t\t\t\t.attr(\"class\", \"y axis\")\n\t\t\t\t\t\t\t\t\t.attr(\"transform\", \"translate(\" + (MARGINS.left) + \",0)\")\n\t\t\t\t\t\t\t\t\t.call(yAxis)\n\t\t\t\t\t\t\t\t\t.selectAll(\"text\")\n\t\t\t\t\t\t\t\t\t.style(\"text-anchor\", \"end\")\n\t\t\t\t\t\t\t\t\t.style(\"font-size\",\"8px\")\n\t\t\t\t\t\t\t\t\t.style(\"font-family\",\"Halvetica_light_neue\");\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*/\n\t\t\t\t\tfor (var k in arrayData){\n\t\t\t\t\t\t\t\t\tif(arrayData[k].length == 0){\n\t\t\t\t\t\t\t\t\t\tvis.append(\"svg:g\")\n\t\t\t\t\t\t\t\t\t\t.attr(\"class\", \"y axis\")\n\t\t\t\t\t\t\t\t\t\t.attr(\"transform\", \"translate(\" + (MARGINS.left) + \",0)\")\n\t\t\t\t\t\t\t\t\t\t.call(yAxis)\n\t\t\t\t\t\t\t\t\t\t.selectAll(\"text\")\n\t\t\t\t\t\t\t\t\t\t.style(\"text-anchor\", \"end\")\n\t\t\t\t\t\t\t\t\t\t.style(\"font-size\",\"8px\")\n\t\t\t\t\t\t\t\t\t\t.style(\"font-family\",\"Halvetica_light_neue\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\t\t\t\tif(assetsFactory.checkAssetMetricType(arrayData[k][0].metricCode, ['sm','hum','soil'])){\n\t\t\t\t\t\t\t\t\t\t\t\tif(!isTemp){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//Adding Group\n\t\t\t\t\t\t\t\t\t\t\t\t\tvis.append(\"svg:g\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"class\", \"y axis\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"transform\", \"translate(\" + (MARGINS.left) + \",0)\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t.call(yAxis)\n\t\t\t\t\t\t\t\t\t\t\t\t\t.append(\"text\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"class\", \"label\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"y\", 15)\n\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"x\",0)\n\t\t\t\t\t\t\t\t\t\t\t\t\t.style(\"text-anchor\", \"end\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t.style(\"fill\", \"white\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t.text(\"%\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t//.text(function (d){if(assetsFactory.checkAssetMetricType(arrayData[k][0].metricCode, ['temp','t1','t2'])) return \"ºC\";else return \"%\";})\n\t\t\t\t\t\t\t\t\t\t\t\t\t.selectAll(\"text\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t.style(\"font-size\",\"8px\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t.style(\"font-family\",\"Halvetica_light_neue\");\n\t\t\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\t\t\tvis.append(\"svg:g\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"class\", \"y axis\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"transform\", \"translate(\" + (WIDTH - (MARGINS.right + 10)) + \",0)\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t.call(yAxisRight)\n\t\t\t\t\t\t\t\t\t\t\t\t\t.append(\"text\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"class\", \"label\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"y\", 15)\n\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"x\",8)\n\t\t\t\t\t\t\t\t\t\t\t\t\t.style(\"text-anchor\", \"end\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t.style(\"fill\", \"white\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t.text(\"%\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t.selectAll(\"text\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t.style(\"font-size\",\"8px\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t.style(\"font-family\",\"Halvetica_light_neue\");\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tvis.append(\"svg:path\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.attr('stroke',function (d){\n if (chartSerialNum==0) {\n return \"#C1AF65\";}\n else if(chartSerialNum==1){\n return \"#93d637\";}\n else if(chartSerialNum==2){\n return \"#7FA4BE\";}\n else if(chartSerialNum==3){\n return \"#737254\";} //'blue'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.attr('stroke-width', 1)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.attr('fill', 'none')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"d\", function(d){\tif(isTemp)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn lineFunc2(arrayData[k]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn lineFunc(arrayData[k]);\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\tchartSerialNum = chartSerialNum + 1;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\t\t\t\t\tvis.append(\"svg:g\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"class\", \"y axis\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"transform\", \"translate(\" + (MARGINS.left) + \",0)\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.call(yAxis)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.append(\"text\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"class\", \"label\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"y\", 15)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"x\",0)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.style(\"text-anchor\", \"end\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.style(\"fill\", \"white\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//.text(\"ºC\");\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.text(function (d){if(assetsFactory.checkAssetMetricType(arrayData[k][0].metricCode, ['temp','t1','t2'])) return \"ºC\";else return \"%\";})\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.selectAll(\"text\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.style(\"font-size\",\"8px\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.style(\"font-family\",\"Halvetica_light_neue\");\n\t\t\t\t\t\t\t\t\t\t\t\tvis.append(\"svg:path\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.attr('stroke',function (d){\n if (chartSerialNum==0) {\n return \"#C1AF65\";}\n else if(chartSerialNum==1) {\n return \"#93d637\";}\n else if(chartSerialNum==2) {\n return \"#7FA4BE\";}\n else if(chartSerialNum==3) {\n return \"#737254\";}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}) //'blue'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.attr('stroke-width', 1)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.attr('fill', 'none')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"d\",lineFunc(arrayData[k]));\n\t\t\t\t\t\t\t\t\t\t\t\tchartSerialNum = chartSerialNum + 1;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t} //for loop\n\t\t\t\t\t$ionicLoading.hide();\n}", "title": "" }, { "docid": "bbb366e54c581fbe3e27cb7d6255e7ab", "score": "0.5068763", "text": "constructor() {\r\n this.NUMERIC_MIN = -3;\r\n this.NUMERIC_MAX = 3;\r\n /* {Chart} The underlying chart. */\r\n this.chart = null;\r\n /* {Array<StudentRow>} An array of student objects. */\r\n this.students = [];\r\n /* {Array<QuestionRow>} An array of question objects. */\r\n this.questions = [];\r\n /* {Array<Divider>} An array of divider objects to drag on the chart. */\r\n this.dividers = [\r\n new Divider({\r\n dividerId: 'line-divider-ab',\r\n text: 'A/B',\r\n index: 2,\r\n fieldId: 'ab-boundary',\r\n y: parseFloat(document.getElementById('ab-boundary').value),\r\n position: 'left'\r\n }, this),\r\n new Divider({\r\n dividerId: 'line-divider-bc',\r\n text: 'B/C',\r\n index: 5,\r\n fieldId: 'bc-boundary',\r\n y: parseFloat(document.getElementById('bc-boundary').value),\r\n position: 'left'\r\n }, this),\r\n new Divider({\r\n dividerId: 'line-divider-cd',\r\n text: 'C/D',\r\n index: 8,\r\n fieldId: 'cd-boundary',\r\n y: parseFloat(document.getElementById('cd-boundary').value),\r\n position: 'left'\r\n }, this)\r\n ];\r\n\r\n /* {!Spinner} A spinner to display while the graph loads. */\r\n this.spinner = new Spinner(document.getElementById('canvas-container'));\r\n }", "title": "" }, { "docid": "528db36cc313224b03e0a070b11a7318", "score": "0.5067541", "text": "prepareData() {\n const series = [];\n\n this.model.year_1990_series().forEach((s) =>\n series.push({\n x: 1990,\n y: s.safe_present_value(),\n id: s.get('gquery_key'),\n })\n );\n\n this.model.non_target_series().forEach((s) => {\n series.push({\n x: this.startYear,\n y: s.safe_present_value(),\n id: s.get('gquery_key'),\n });\n\n series.push({\n x: this.endYear,\n y: s.safe_future_value(),\n id: s.get('gquery_key'),\n });\n });\n\n return series;\n }", "title": "" }, { "docid": "edfd30597c419c79f60024526f82c29e", "score": "0.5061715", "text": "function prepareSeries(data){\n var result = data.result;\n\n // Keep only series when needed\n if(seriesFilter && (!filtersOnlySampleSeries || result.supportsControllersDiscrimination)){\n // Insensitive case matching\n var regexp = new RegExp(seriesFilter, 'i');\n result.series = $.grep(result.series, function(series, index){\n return regexp.test(series.label);\n });\n }\n\n // Keep only controllers series when supported and needed\n if(result.supportsControllersDiscrimination && showControllersOnly){\n result.series = $.grep(result.series, function(series, index){\n return series.isController;\n });\n }\n\n // Sort data and mark series\n $.each(result.series, function(index, series) {\n series.data.sort(compareByXCoordinate);\n series.color = index;\n });\n}", "title": "" }, { "docid": "00122d50442bdcbf699d7a9a90529b2d", "score": "0.50610226", "text": "function chartPointSewage() {\nvar total_sewage_incomp = {\nonStatisticField: \"CASE WHEN (UtilType = 3 and Status = 0) THEN 1 ELSE 0 END\",\noutStatisticFieldName: \"total_sewage_incomp\",\nstatisticType: \"sum\"\n};\n\nvar total_sewage_comp = {\nonStatisticField: \"CASE WHEN (UtilType = 3 and Status = 1) THEN 1 ELSE 0 END\",\noutStatisticFieldName: \"total_sewage_comp\",\nstatisticType: \"sum\" \n};\n\n// Query\nvar query = testUtilPt.createQuery();\nquery.outStatistics = [total_sewage_incomp, total_sewage_comp];\nquery.returnGeometry = true;\n\ntestUtilPt.queryFeatures(query).then(function(response) {\n var stats = response.features[0].attributes;\n const sewage_incomp = stats.total_sewage_incomp;\n const sewage_comp = stats.total_sewage_comp;\n\n var chart = am4core.create(\"chartSewageDiv\", am4charts.XYChart);\n \n // Responsive to screen size\n chart.responsive.enabled = true;\n chart.responsive.useDefault = false\n chart.responsive.rules.push({\n relevant: function(target) {\n if (target.pixelWidth <= 400) {\n return true;\n }\n return false;\n },\n state: function(target, stateId) {\n\nif (target instanceof am4charts.Chart) {\nvar state = target.states.create(stateId);\nstate.properties.paddingTop = 0;\nstate.properties.paddingRight = 15;\nstate.properties.paddingBottom = 5;\nstate.properties.paddingLeft = 15;\nreturn state;\n}\n\n\nif (target instanceof am4charts.Legend) {\nvar state = target.states.create(stateId);\nstate.properties.paddingTop = 0;\nstate.properties.paddingRight = 0;\nstate.properties.paddingBottom = 0;\nstate.properties.paddingLeft = 0;\nstate.properties.marginLeft = 0;\nreturn state;\n}\n\nif (target instanceof am4charts.AxisRendererY) {\nvar state = target.states.create(stateId);\nstate.properties.inside = false;\nstate.properties.maxLabelPosition = 0.99;\nreturn state;\n}\n\nif ((target instanceof am4charts.AxisLabel) && (target.parent instanceof am4charts.AxisRendererY)) { \nvar state = target.states.create(stateId);\nstate.properties.dy = 0;\nstate.properties.paddingTop = 3;\nstate.properties.paddingRight = 5;\nstate.properties.paddingBottom = 3;\nstate.properties.paddingLeft = 5;\n\n// Create a separate state for background\n// target.setStateOnChildren = true;\n// var bgstate = target.background.states.create(stateId);\n// bgstate.properties.fill = am4core.color(\"#fff\");\n// bgstate.properties.fillOpacity = 0;\n\nreturn state;\n}\n\n// if ((target instanceof am4core.Rectangle) && (target.parent instanceof am4charts.AxisLabel) && (target.parent.parent instanceof am4charts.AxisRendererY)) { \n// var state = target.states.create(stateId);\n// state.properties.fill = am4core.color(\"#f00\");\n// state.properties.fillOpacity = 0.5;\n// return state;\n// }\n\nreturn null;\n}\n});\n\n\n chart.hiddenState.properties.opacity = 0;\n\n chart.data = [\n {\n category: \"Sewage\",\n value1: sewage_comp,\n value2: sewage_incomp\n }\n ];\n\n // Define chart setting\n chart.colors.step = 2;\n chart.padding(0, 0, 0, 0);\n \n // Axis Setting\n /// Category Axis\n var categoryAxis = chart.yAxes.push(new am4charts.CategoryAxis());\n categoryAxis.dataFields.category = \"category\";\n categoryAxis.renderer.grid.template.location = 0;\n categoryAxis.renderer.labels.template.fontSize = 0;\n categoryAxis.renderer.labels.template.fill = \"#ffffff\";\n categoryAxis.renderer.minGridDistance = 5; //can change label\n categoryAxis.renderer.grid.template.strokeWidth = 0;\n \n /// Value Axis\n var valueAxis = chart.xAxes.push(new am4charts.ValueAxis());\n valueAxis.min = 0;\n valueAxis.max = 100;\n valueAxis.strictMinMax = true;\n valueAxis.calculateTotals = true;\n valueAxis.renderer.minWidth = 50;\n valueAxis.renderer.labels.template.fontSize = 0;\n valueAxis.renderer.labels.template.fill = \"#ffffff\";\n valueAxis.renderer.grid.template.strokeWidth = 0;\n \n //valueAxis.disabled = true;\n //categoryAxis.disabled = true;\n let arrLviews = [];\n \n // Layerview and Expand\n function createSeries(field, name) {\n var series = chart.series.push(new am4charts.ColumnSeries());\n series.calculatePercent = true;\n series.dataFields.valueX = field;\n series.dataFields.categoryY = \"category\";\n series.stacked = true;\n series.dataFields.valueXShow = \"totalPercent\";\n series.dataItems.template.locations.categoryY = 0.5;\n \n // Bar chart line color and width\n series.columns.template.stroke = am4core.color(\"#FFFFFF\"); //#00B0F0\n series.columns.template.strokeWidth = 0.5;\n series.name = name;\n \n var labelBullet = series.bullets.push(new am4charts.LabelBullet());\n \n if (name == \"Incomplete\"){\n series.fill = am4core.color(\"#FF000000\");\n labelBullet.label.text = \"\";\n labelBullet.label.fill = am4core.color(\"#FFFFFFFF\");\n labelBullet.label.fontSize = 0;\n \n } else {\n // When completed value is zero, show no labels.\n if (sewage_comp === 0) {\n labelBullet.label.text = \"\";\n } else {\n labelBullet.label.text = \"{valueX.totalPercent.formatNumber('#.')}%\";\n };\n series.fill = am4core.color(\"#00B0F0\"); // Completed\n //labelBullet.label.text = \"{valueX.totalPercent.formatNumber('#.')}%\";\n labelBullet.label.fill = am4core.color(\"#ffffff\");\n labelBullet.label.fontSize = 20;\n\n }\n labelBullet.locationX = 0.5;\n labelBullet.interactionsEnabled = false;\n \n series.columns.template.width = am4core.percent(60);\n series.columns.template.tooltipText = \"[font-size:15px]{name}: {valueX.value.formatNumber('#.')} ({valueX.totalPercent.formatNumber('#.')}%)\"\n \n // Click chart and filter, update maps\n const chartElement = document.getElementById(\"chartPanel\");\n series.columns.template.events.on(\"hit\", filterByChart, this);\n\n function filterByChart(ev) {\n const selectedC = ev.target.dataItem.component.name;\n const selectedP = ev.target.dataItem.categoryY;\n \n // Layer\n if (selectedC === \"Incomplete\") {\n selectedLayer = 3;\n selectedStatus = 0;\n } else if (selectedC === \"Complete\") {\n selectedLayer = 3;\n selectedStatus = 1;\n } else {\n selectedLayer = null;\n }\n \n // Point 1:\n view.when(function() {\n view.whenLayerView(testUtilPt).then(function (layerView) {\n chartLayerView = layerView;\n arrLviews.push(layerView);\n chartElement.style.visibility = \"visible\";\n \n //testUtilPt1.definitionExpression = sqlExpression;\n testUtilPt.queryFeatures().then(function(results) {\n const ggg = results.features;\n const rowN = ggg.length;\n \n let objID = [];\n for (var i=0; i < rowN; i++) {\n var obj = results.features[i].attributes.OBJECTID;\n objID.push(obj);\n }\n \n var queryExt = new Query({\n objectIds: objID\n });\n \n testUtilPt.queryExtent(queryExt).then(function(result) {\n if (result.extent) {\n view.goTo(result.extent)\n }\n });\n \n view.on(\"click\", function() {\n layerView.filter = null;\n });\n }); // end of query features \n }); // end of when layerview\n\n // Point: 2\n view.whenLayerView(testUtilPt1).then(function (layerView) {\n chartLayerView = layerView;\n arrLviews.push(layerView);\n chartElement.style.visibility = \"visible\";\n \n view.on(\"click\", function() {\n layerView.filter = null;\n });\n }); // end of when layerview\n }); // end of view.when\n\n // Query view using compiled arrays\n for(var i = 0; i < arrLviews.length; i++) {\n arrLviews[i].filter = {\n where: \"UtilType = \" + selectedLayer + \" AND \" + \"Status = \" + selectedStatus\n }\n }\n } // End of filterByChart\n} // end of createSeries function\n\ncreateSeries(\"value1\", \"Complete\");\ncreateSeries(\"value2\", \"Incomplete\");\n\n}); // end of queryFeatures\n} // end of updateChartSewage", "title": "" }, { "docid": "a2f1a4df684594bc51c5627ec9111b82", "score": "0.50609076", "text": "function resetAxesMinMax(chart, axes) {\n\t if (chart.type === \"serial\" || chart.type === \"radar\" || chart.type === \"xy\") {\n\t each(chart.valueAxes, function (axis) {\n\t var info = axes[axis.id];\n\t\n\t if (info != null) {\n\t if (info.minimum == null) {\n\t delete axis.minimum;\n\t }\n\t\n\t if (info.maximum == null) {\n\t delete axis.maximum;\n\t }\n\t }\n\t });\n\t }\n\t }", "title": "" }, { "docid": "9cc9e4eac8712cb06ba65bbfbd645797", "score": "0.5057927", "text": "function drawDefaultChart2() {\n //Loop three times to build three charts of bar, area and line charts\n var start = new Date(netatmoStartDate);\n var data = new google.visualization.DataTable();\n data.addColumn('date', 'Date');\n for(var sensors in graphArrays) {\n if(sensors.includes('Avg') | sensors.includes('Count')) {\n data.addColumn('number', sensors);\n }\n };\n \n for(i=0;i<diffDays;i++) {//loop each sensor array item\n var row = [new Date(start)]; // First col been the date\n for(sensor in graphArrays) { // Loop each sensor value to add to chart col\n if(sensor.includes('Avg') | sensor.includes('Count')) { //Ignore sum and counter for avg\n row.push(graphArrays[sensor][i]);\n }\n };\n data.addRow(row);\n start.setTime(start.getTime()+oneDay); // increment the startDate object by mil sec so month change is made\n };\n //************************** column selector *******************\n var columnsTable = new google.visualization.DataTable();\n columnsTable.addColumn('number', 'colIndex');\n columnsTable.addColumn('string', 'colLabel');\n var initState= {selectedValues: []};\n // put the columns into this data table (skip column 0)\n for (var i = 1; i < data.getNumberOfColumns(); i++) {\n columnsTable.addRow([i, data.getColumnLabel(i)]);\n // you can comment out this next line if you want to have a default selection other than the whole list\n initState.selectedValues.push(data.getColumnLabel(i));\n }\n // you can set individual columns to be the default columns (instead of populating via the loop above) like this:\n // initState.selectedValues.push(data.getColumnLabel(4));\n var columnFilter = new google.visualization.ControlWrapper({\n controlType: 'CategoryFilter',\n containerId: 'colFilter_div'+graphCount, // sets new div for each graph\n dataTable: columnsTable,\n options: {\n filterColumnLabel: 'colLabel',\n ui: {\n label: '',\n caption: \"Select Sensors\",\n allowTyping: false,\n allowMultiple: true,\n allowNone: false,\n selectedValuesLayout: 'aside'\n }\n },\n state: initState\n });\n var chart = new google.visualization.ChartWrapper({\n chartType: 'AreaChart',\n containerId: 'chart_div'+graphCount,\n dataTable: data,\n options: {\n title: title, // Title variable set at start of submit func\n width: '100%',\n height: 200,\n pointSize: 3,\n hAxis: {\n title: 'Date(Month/date/year)',\n format: 'MMM/d/yy EEE' //show date format as ex Sep/4/16 Sun\n },\n vAxes: {\n 0: {title:'Sensor counter & Avg'}\n },\n explorer: {\n axis: 'horizontal'\n }\n }\n });\n\n function setChartView () {\n var state = columnFilter.getState();\n var row;\n var view = {\n columns: [0]\n };\n for (var i = 0; i < state.selectedValues.length; i++) {\n row = columnsTable.getFilteredRows([{column: 1, value: state.selectedValues[i]}])[0];\n view.columns.push(columnsTable.getValue(row, 0));\n }\n // sort the indices into their original order\n view.columns.sort(function (a, b) {\n return (a - b);\n });\n chart.setView(view);\n chart.draw();\n }\n //create new Divs to hold the graph filter and chart\n var newDom = \"<div id='\"+graphCount+\"' class='row chart'><div id='contentDetail\"+graphCount+\"' class='col-md-3'></div>\";\n newDom += \"<div class='col-sm-7 col-md-8'><span class='glyphicon glyphicon-remove' style='float: right;' onclick='removeDiv(\"+graphCount+\")'></span>\";\n newDom += \"<div id='colFilter_div\"+graphCount+\"'></div><div id='chart_div\"+graphCount+\"'></div></div></div>\";\n //add the Dom to the index page by added it to the graph container div.\n $('.graphContainer:last').append(newDom);\n $('#contentDetail'+graphCount).html(defaultContent);\n graphCount++; // increment the counter for the next graph\n google.visualization.events.addListener(columnFilter, 'statechange', setChartView);\n setChartView(); //draw chart\n columnFilter.draw(); // draw the column filter\n }", "title": "" }, { "docid": "a2fc8cc0a36d265b6da3683ec6982518", "score": "0.5054184", "text": "function drawDefaultChart3() {\n //Loop three times to build three charts of bar, area and line charts\n var start = new Date(netatmoStartDate);\n var data = new google.visualization.DataTable();\n data.addColumn('date', 'Date');\n for(var sensors in graphArrays) {\n if(sensors.includes('Avg') | sensors.includes('Count')) {\n data.addColumn('number', sensors);\n }\n };\n \n for(i=0;i<diffDays;i++) {//loop each sensor array item\n var row = [new Date(start)]; // First col been the date\n for(sensor in graphArrays) { // Loop each sensor value to add to chart col\n if(sensor.includes('Avg') | sensor.includes('Count')) { //Ignore sum and counter for avg\n row.push(graphArrays[sensor][i]);\n }\n };\n data.addRow(row);\n start.setTime(start.getTime()+oneDay); // increment the startDate object by mil sec so month change is made\n };\n //************************** column selector *******************\n var columnsTable = new google.visualization.DataTable();\n columnsTable.addColumn('number', 'colIndex');\n columnsTable.addColumn('string', 'colLabel');\n var initState= {selectedValues: []};\n // put the columns into this data table (skip column 0)\n for (var i = 1; i < data.getNumberOfColumns(); i++) {\n columnsTable.addRow([i, data.getColumnLabel(i)]);\n // you can comment out this next line if you want to have a default selection other than the whole list\n initState.selectedValues.push(data.getColumnLabel(i));\n }\n // you can set individual columns to be the default columns (instead of populating via the loop above) like this:\n // initState.selectedValues.push(data.getColumnLabel(4));\n var columnFilter = new google.visualization.ControlWrapper({\n controlType: 'CategoryFilter',\n containerId: 'colFilter_div'+graphCount, // sets new div for each graph\n dataTable: columnsTable,\n options: {\n filterColumnLabel: 'colLabel',\n ui: {\n label: '',\n caption: \"Select Sensors\",\n allowTyping: false,\n allowMultiple: true,\n allowNone: false,\n selectedValuesLayout: 'aside'\n }\n },\n state: initState\n });\n var chart = new google.visualization.ChartWrapper({\n chartType: 'LineChart',\n containerId: 'chart_div'+graphCount,\n dataTable: data,\n options: {\n title: title, // Title variable set at start of submit func\n width: '100%',\n height: 200,\n pointSize: 3,\n hAxis: {\n title: 'Date(Month/date/year)',\n format: 'MMM/d/yy EEE' //show date format as ex Sep/4/16 Sun\n },\n vAxes: {\n 0: {title:'Sensor counter & Avg'}\n },\n explorer: {\n axis: 'horizontal'\n }\n }\n });\n\n function setChartView () {\n var state = columnFilter.getState();\n var row;\n var view = {\n columns: [0]\n };\n for (var i = 0; i < state.selectedValues.length; i++) {\n row = columnsTable.getFilteredRows([{column: 1, value: state.selectedValues[i]}])[0];\n view.columns.push(columnsTable.getValue(row, 0));\n }\n // sort the indices into their original order\n view.columns.sort(function (a, b) {\n return (a - b);\n });\n chart.setView(view);\n chart.draw();\n }\n //create new Divs to hold the graph filter and chart\n var newDom = \"<div id='\"+graphCount+\"' class='row chart'><div id='contentDetail\"+graphCount+\"' class='col-md-3'></div>\";\n newDom += \"<div class='col-sm-7 col-md-8'><span class='glyphicon glyphicon-remove' style='float: right;' onclick='removeDiv(\"+graphCount+\")'></span>\";\n newDom += \"<div id='colFilter_div\"+graphCount+\"'></div><div id='chart_div\"+graphCount+\"'></div></div></div>\";\n //add the Dom to the index page by added it to the graph container div.\n $('.graphContainer:last').append(newDom);\n $('#contentDetail'+graphCount).html(defaultContent);\n graphCount++; // increment the counter for the next graph\n google.visualization.events.addListener(columnFilter, 'statechange', setChartView);\n setChartView(); //draw chart\n columnFilter.draw(); // draw the column filter\n }", "title": "" }, { "docid": "b7c6e6e5c6b4691d65ee5085add37e5f", "score": "0.5047334", "text": "function drawDefaultChart1() {\n //Loop three times to build three charts of bar, area and line charts\n var start = new Date(netatmoStartDate);\n var data = new google.visualization.DataTable();\n data.addColumn('date', 'Date');\n for(var sensors in graphArrays) {\n if(sensors.includes('Avg') | sensors.includes('Count')) {\n data.addColumn('number', sensors);\n }\n };\n \n for(i=0;i<diffDays;i++) {//loop each sensor array item\n var row = [new Date(start)]; // First col been the date\n for(sensor in graphArrays) { // Loop each sensor value to add to chart col\n if(sensor.includes('Avg') | sensor.includes('Count')) { //Ignore sum and counter for avg\n row.push(graphArrays[sensor][i]);\n }\n };\n data.addRow(row);\n start.setTime(start.getTime()+oneDay); // increment the startDate object by mil sec so month change is made\n };\n //************************** column selector *******************\n var columnsTable = new google.visualization.DataTable();\n columnsTable.addColumn('number', 'colIndex');\n columnsTable.addColumn('string', 'colLabel');\n var initState= {selectedValues: []};\n // put the columns into this data table (skip column 0)\n for (var i = 1; i < data.getNumberOfColumns(); i++) {\n columnsTable.addRow([i, data.getColumnLabel(i)]);\n // you can comment out this next line if you want to have a default selection other than the whole list\n initState.selectedValues.push(data.getColumnLabel(i));\n }\n // you can set individual columns to be the default columns (instead of populating via the loop above) like this:\n // initState.selectedValues.push(data.getColumnLabel(4));\n var columnFilter = new google.visualization.ControlWrapper({\n controlType: 'CategoryFilter',\n containerId: 'colFilter_div'+graphCount, // sets new div for each graph\n dataTable: columnsTable,\n options: {\n filterColumnLabel: 'colLabel',\n ui: {\n label: '',\n caption: \"Select Sensors\",\n allowTyping: false,\n allowMultiple: true,\n allowNone: false,\n selectedValuesLayout: 'aside'\n }\n },\n state: initState\n });\n var chart = new google.visualization.ChartWrapper({\n chartType: 'ColumnChart',\n containerId: 'chart_div'+graphCount,\n dataTable: data,\n options: {\n title: title, // Title variable set at start of submit func\n width: '100%',\n height: 200,\n pointSize: 3,\n hAxis: {\n title: 'Date(Month/date/year)',\n format: 'MMM/d/yy EEE' //show date format as ex Sep/4/16 Sun\n },\n vAxes: {\n 0: {title:'Sensor counter & Avg'}\n },\n explorer: {\n axis: 'horizontal'\n }\n }\n });\n\n function setChartView () {\n var state = columnFilter.getState();\n var row;\n var view = {\n columns: [0]\n };\n for (var i = 0; i < state.selectedValues.length; i++) {\n row = columnsTable.getFilteredRows([{column: 1, value: state.selectedValues[i]}])[0];\n view.columns.push(columnsTable.getValue(row, 0));\n }\n // sort the indices into their original order\n view.columns.sort(function (a, b) {\n return (a - b);\n });\n chart.setView(view);\n chart.draw();\n }\n //create new Divs to hold the graph filter and chart\n var newDom = \"<div id='\"+graphCount+\"' class='row chart'><div id='contentDetail\"+graphCount+\"' class='col-md-3'></div>\";\n newDom += \"<div class='col-sm-7 col-md-8'><span class='glyphicon glyphicon-remove' style='float: right;' onclick='removeDiv(\"+graphCount+\")'></span>\";\n newDom += \"<div id='colFilter_div\"+graphCount+\"'></div><div id='chart_div\"+graphCount+\"'></div></div></div>\";\n //add the Dom to the index page by added it to the graph container div.\n $('.graphContainer:last').append(newDom);\n $('#contentDetail'+graphCount).html(defaultContent);\n graphCount++; // increment the counter for the next graph\n google.visualization.events.addListener(columnFilter, 'statechange', setChartView);\n setChartView(); //draw chart\n columnFilter.draw(); // draw the column filter \n }", "title": "" }, { "docid": "cf147666ce7dd5a1ec4a50c08bebdfc7", "score": "0.5043004", "text": "function spLine(data) {\n var init = data;\n\n // create time parser\n var parseTime = d3.timeParse(\"%Y-%m-%d\");\n\n var dateFormatter = d3.timeFormat(\"%m/%d/%y\");\n var formatValue = d3.format(\",.2f\");\n\n // Modify data\n init.forEach(function(data) {\n data['date'] = parseTime(data['date']);\n data['close'] = +data['close'];\n\n });\n\n\n function marketRanges(spData, threshold) {\n\n var markets = [];\n\n var dates = spData.map(function(d) {\n return(d['date']);\n });\n\n var closePrices = spData.map(function(d) {\n return(d['close']);\n })\n\n var bearMarket = false;\n\n var bullStart = 0\n var bearStart = 0\n\n var currentHigh = closePrices[0];\n var currentLow = closePrices[0];\n\n for (var i = 0; i < spData.length; i++) {\n\n changeFromHigh = (closePrices[i] - currentHigh)/currentHigh * 100;\n changeFromLow = (closePrices[i] - currentLow)/currentLow * 100;\n\n if (bearMarket === false) {\n if (closePrices[i] > currentHigh) {\n currentHigh = closePrices[i];\n }\n }\n\n if (bearMarket === true) {\n if (closePrices[i] < currentLow) {\n currentLow = closePrices[i];\n }\n }\n\n if (bearMarket === false) {\n if (changeFromHigh <= (threshold * -1)) {\n var marketObject = {\n type: \"bull\",\n dateRange: dates.slice(bullStart, i + 1),\n priceRange: closePrices.slice(bullStart, i + 1),\n marketRange: spData.slice(bullStart, i + 1)\n };\n markets.push(marketObject);\n bearMarket = true;\n currentLow = closePrices[i];\n bearStart = i;\n // Needed to add the below line -- script immediately checks\n // for whether the bear market changes based on changeFromLow - \n // however the script doesn't allow a new value for currentLow, \n // which affects changeFromLow, so it is a faulty check without\n // updating changeFromLow here\n changeFromLow = 0;\n }\n }\n\n if (bearMarket === true) {\n if (changeFromLow >= threshold) {\n var marketObject = {\n type: \"bear\",\n dateRange: dates.slice(bearStart, i + 1),\n priceRange: closePrices.slice(bearStart, i + 1),\n marketRange: spData.slice(bearStart, i + 1)\n };\n markets.push(marketObject);\n bearMarket = false;\n currentHigh = closePrices[i];\n bullStart = i;\n }\n }\n\n if (bearMarket === false && i === (spData.length - 1)) {\n var marketObject = {\n type: \"bull\",\n dateRange: dates.slice(bullStart, i + 1),\n priceRange: closePrices.slice(bullStart, i + 1),\n marketRange: spData.slice(bullStart, i + 1)\n };\n markets.push(marketObject);\n }\n\n if (bearMarket === true && i === (spData.length -1)) {\n var marketObject = {\n type: \"bear\",\n dateRange: dates.slice(bearStart, i + 1),\n priceRange: closePrices.slice(bearStart, i + 1),\n marketRange: spData.slice(bearStart, i + 1)\n };\n markets.push(marketObject);\n }\n\n };\n\n return(markets);\n\n }\n\n var bisectDate = d3.bisector(function(d) { return d['date']; }).left;\n \n /*\n xTimeScale = d3.scaleTime()\n .domain(d3.extent(init, d => d['date']))\n .range([0, width]);\n */\n\n var endDate = new Date();\n xTimeScale = d3.scaleTime()\n .domain([d3.min(init, d => d['date']), endDate.setDate(d3.max(init, d => d['date']).getDate() + 10)])\n .range([0, width]);\n\n var yLinearScale = d3.scaleLinear()\n .domain(d3.extent(init, d => d['close']))\n .range([height, 0]);\n\n lineGenerator = d3.line()\n .x(d => xTimeScale(d['date']))\n .y(d => yLinearScale(d['close']))\n\n var bottomAxis = d3.axisBottom(xTimeScale)\n .tickFormat(d3.timeFormat(\"%m-%d-%Y\"));\n var leftAxis = d3.axisLeft(yLinearScale);\n\n // Append X Axis and Rotate Ticks\n chartGroup.append(\"g\")\n .classed(\"lineX\", true)\n .attr(\"transform\", `translate(0, ${height})`)\n .call(bottomAxis)\n .selectAll(\"text\")\n .attr(\"y\", 0)\n .attr(\"x\", 9)\n .attr(\"dy\", \".35em\")\n .attr(\"transform\", \"rotate(90)\")\n .style(\"text-anchor\", \"start\");\n\n // Append Y Axis\n chartGroup.append(\"g\")\n .classed(\"lineY\", true)\n .call(leftAxis);\n\n console.log(marketRanges(init, threshold));\n\n \n\n // Append Chart Lines\n var chartLines = chartGroup.selectAll('.line')\n .data(marketRanges(init, threshold))\n .enter()\n .append(\"path\")\n .attr(\"d\", function(d) {\n return lineGenerator(d.marketRange)\n })\n .classed(\"line\", true)\n .classed(\"bear\", function(d) {\n return d.type == \"bear\";\n })\n .classed(\"bull\", function(d) {\n return d.type == \"bull\";\n })\n //.style(\"stroke-width\", \"3px\")\n\n var focus = chartGroup.append(\"g\")\n .attr(\"class\", \"focus\")\n .style(\"display\", \"none\");\n\n focus.append(\"circle\")\n .attr(\"r\", 5);\n \n focus.append(\"rect\")\n .attr(\"class\", \"tooltip\")\n .attr(\"width\", 120)\n .attr(\"height\", 50)\n .attr(\"x\", 10)\n .attr(\"y\", -22)\n .attr(\"rx\", 4)\n .attr(\"ry\", 4);\n\n focus.append(\"text\")\n .attr(\"class\", \"tooltip-date\")\n .attr(\"x\", 18)\n .attr(\"y\", -2);\n\n focus.append(\"text\")\n .attr(\"x\", 18)\n .attr(\"y\", 18)\n .text(\"Close:\");\n\n focus.append(\"text\")\n .attr(\"class\", \"tooltip-close\")\n .attr(\"x\", 60)\n .attr(\"y\", 18);\n\n chartGroup.append(\"rect\")\n .attr(\"class\", \"overlay\")\n .attr(\"width\", width + 20)\n .attr(\"height\", height)\n .on(\"mouseover\", function() { focus.style(\"display\", null); })\n .on(\"mouseout\", function() { focus.style(\"display\", \"none\"); })\n .on(\"mousemove\", mousemove);\n\n\n // console.log(init);\n \n\n function mousemove() {\n // console.log(xTimeScale.invert(d3.mouse(this)[0]))\n\n var x0 = xTimeScale.invert(d3.mouse(this)[0]),\n i = bisectDate(init, x0),\n d0 = init[i - 1];\n\n var d1 = init[i];\n // console.log(d0);\n // console.log(d1);\n // console.log(x0);\n var d;\n if (d1 == null) {\n d = d0;\n } else {\n d1 = init[i];\n d = x0 - d0['date'] > d1['date'] - x0 ? d1: d0;\n }\n\n // console.log(x0 - d0['date'])\n // console.log(d1['date'] - x0)\n\n // console.log(i);\n // console.log(d0);\n // console.log(d1);\n // console.log(d3.mouse(this)[0])\n // console.log(x0)\n // console.log(d)\n\n focus.attr(\"transform\", \"translate(\" + xTimeScale(d['date']) + \", \" + yLinearScale(d['close']) + \")\");\n focus.select(\".tooltip-date\").text(dateFormatter(d['date']));\n focus.select(\".tooltip-close\").text(formatValue(d['close']));\n } \n\n\n chartGroup.append(\"text\")\n .attr(\"transform\", `translate(${width / 2}, ${height + margin.top + 70})`)\n .attr(\"text-anchor\", \"middle\")\n .attr(\"font-size\", \"18px\")\n .attr(\"fill\", d3.rgb(150,150,150))\n .attr(\"stroke\", \"black\")\n .attr(\"stroke-width\", \"1px\")\n .attr(\"font-family\", \"sans-serif\")\n .text(\"Year\");\n\n chartGroup.append(\"text\")\n .attr(\"transform\", `translate(0, ${height / 2}) rotate(270)`)\n .attr(\"y\", \"-50\")\n .attr(\"text-anchor\", \"middle\")\n .attr(\"font-size\", \"18px\")\n .attr(\"fill\", d3.rgb(150,150,150))\n .attr(\"stroke\", \"black\")\n .attr(\"stroke-width\", \"1px\")\n .attr(\"font-family\", \"sans-serif\")\n .text(\"Index Close Price\")\n\n chartGroup.append(\"text\")\n .attr(\"transform\", `translate(${width / 2}, ${margin.top})`)\n .attr(\"text-anchor\", \"middle\")\n .attr(\"font-size\", \"35px\")\n .attr(\"fill\", \"#c0faf4\")\n .attr(\"stroke\", \"black\")\n .attr(\"stroke-width\", \"1.5px\")\n .attr(\"font-family\", \"sans-serif\")\n .text(\"S&P 500 Bull and Bear Markets\")\n\n \n\n\n // console.log(marketRanges(spData, 20))\n}", "title": "" }, { "docid": "a1e843bfb33d99b3dc05e31fe6d88efb", "score": "0.50419134", "text": "function onDataLoaded(data) {\n var dataTable, totalRows, rangeRows, i, min, max, gaugeConfig,\n values = [], sliceOptions = [], isAllPositiveOrNegative,\n template, presentationChart, presentationContainerId;\n\n output.log(data);\n\n // Create a new visualization DataTable instance based on the data.\n dataTable = new google.visualization.DataTable(data);\n\n // If we're only looking for a top/bottom selection, make that selection now.\n if (chart.topBottomSplit) {\n\n // Get the total rows available, and the calculation of how many rows we need.\n totalRows = dataTable.getNumberOfRows();\n requiredRows = (chart.topBottomSplit * 2);\n\n // Only remove rows if there are more rows than required.\n if (totalRows > requiredRows) {\n rangeRows = totalRows - requiredRows;\n dataTable.removeRows(chart.topBottomSplit, rangeRows);\n }\n }\n\n // Loop round the columns, applying the formatter to 'number' columns.\n for (i = 0; i < dataTable.getNumberOfColumns(); i++) {\n if (dataTable.getColumnType(i) === 'number') {\n formatter.format(dataTable, i);\n }\n }\n\n // If we're rendering one of our custom number charts...\n if (type === 'CustomNumber') {\n\n // Remove any existing custom number controls.\n $('.customNumber').remove();\n\n // If we've actually got some data to display...\n if (dataTable.getNumberOfRows() > 0) {\n\n // ...create a template.\n template = '';\n\n // For each of the numbers required, create a DIV element containing the value and label.\n // NOTE: We start at 1 so that we avoid the 'Name' column.\n for (i = 1; i < dataTable.getNumberOfColumns(); i++) {\n template += '<div class=\"customNumber\">' +\n ' <span class=\"customNumberValue\">' + dataTable.getFormattedValue(0, i) + '</span>' +\n ' <span class=\"customNumberLabel\">' + dataTable.getColumnLabel(i) + '</span>' +\n '</div>';\n }\n\n // Write the elements into the main chart container.\n $('#' + containerId).append(template);\n\n // Call the onChartReady function to finish the render process.\n onChartReady({\n chartId: containerId,\n numRows: dataTable.getNumberOfRows() // Used to calculate the height of the chart later.\n });\n }\n\n } else {\n\n // Register the chart with the ready and error event listeners.\n google.visualization.events.addListener(chart, 'ready', function () {\n onChartReady({\n chartId: containerId,\n numRows: dataTable.getNumberOfRows() // Used to calculate the height of the chart later.\n });\n });\n\n presentationChart = chart.clone();\n presentationContainerId = 'presentation-' + chart.getContainerId();\n presentationChart.setContainerId(presentationContainerId);\n\n if (type === 'Table') {\n chart.setOption('height', '620px'); // chartDefaults.resizingSettings.calculateTableHeight(dataTable.getNumberOfRows()));\n chart.setOption('width', chartDefaults.resizingSettings.tableWidth);\n presentationChart.setOption('height', '560px !important;'); // presentationChart.setOption('height', '600px !important');\n presentationChart.setOption('width', 1000); // chartDefaults.resizingSettings.tableWidth); //'1024 !important; min-width: 1000px !important;');\n } else {\n presentationChart.setOption('height', 640);\n presentationChart.setOption('width', 1024);\n }\n\n // If our chart is a pie chart and we're displaying it as a heatmap...\n if (type === 'PieChart' && chart.isHeatMap) {\n\n // ...sort the data by our heatmap measure.\n dataTable.sort([{ column: 2}]);\n\n // Collate the heatmap measure from the datatable.\n for (i = 0; i < dataTable.getNumberOfRows(); i++) {\n values.push(dataTable.getValue(i, 2));\n }\n\n // Get the highest and lowest values from the heatmap measure values.\n min = Math.min.apply(Math, values);\n max = Math.max.apply(Math, values);\n\n // Initialise our gauge configuration object.\n gaugeConfig = {\n min: min,\n max: max,\n midGradientPosition: null\n };\n\n // Get the formatted values for our min and max values from the dataTable,\n // since they already have the correct decimal accuracy and localization.\n // If the min value somehow doesn't exist in the values collection, the\n // dataTable has given us a null value, which we take to mean zero.\n if ($.inArray(min, values) !== -1) {\n gaugeConfig.minDisplay = dataTable.getFormattedValue($.inArray(min, values), 2);\n } else {\n gaugeConfig.minDisplay = '0';\n }\n\n if ($.inArray(max, values) !== -1) {\n gaugeConfig.maxDisplay = dataTable.getFormattedValue($.inArray(max, values), 2);\n } else {\n gaugeConfig.maxDisplay = '0';\n }\n\n // Determine the colours we need to use for our gauge.\n gaugeConfig.minColor = colorManager.getColorInRange(min, min, max, chart.isGradientReversed);\n gaugeConfig.midColor = colorManager.getColorInRange(0, min, max, chart.isGradientReversed);\n gaugeConfig.maxColor = colorManager.getColorInRange(max, min, max, chart.isGradientReversed);\n\n // Determine if the values are all positive or all negative.\n isAllPositiveOrNegative = (min >= 0 && max >= 0) || (min <= 0 && max <= 0);\n\n // Calculate the percentage position of the mid gradient point if we'll need it.\n if (!isAllPositiveOrNegative) {\n gaugeConfig.midGradientPosition = 100 - (100 * ((0 - min) / (max - min)));\n }\n\n // Loop round the values, and use the colorManager to generate \n // a colour in the gradient range for that measure value.\n for (i = 0; i < values.length; i++) {\n sliceOptions.push({\n color: colorManager.getColorInRange(values[i], min, max, chart.isGradientReversed)\n });\n }\n\n // Set the colours as part of the 'slices' chart options.\n chart.setOption('slices', sliceOptions);\n presentationChart.setOption('slices', sliceOptions);\n\n // Attach an event handler to the 'ready' events of the chart and its presentation clone.\n google.visualization.events.addListener(chart, 'ready', function () {\n renderHeatMapGauge(chart, gaugeConfig);\n });\n\n google.visualization.events.addListener(presentationChart, 'ready', function () {\n renderHeatMapGauge(presentationChart, gaugeConfig);\n });\n }\n\n // Set the data table for the chart.\n chart.setDataTable(dataTable);\n presentationChart.setDataTable(dataTable);\n\n // Draw the chart.\n chart.draw();\n presentationChart.draw();\n }\n }", "title": "" }, { "docid": "1249a6b8a385c6c51cef4859d92e5e43", "score": "0.50398433", "text": "removeSprintBackgrounds () {\n debug && console.log(Util.timestamp(), 'D3CapacityPlanSprintHandler.removeSprintBackgrounds');\n let self = this,\n chart = this.chart;\n \n self.sprintBackgroundSelection.exit().remove();\n }", "title": "" }, { "docid": "e58cae8127f86a2b9c72fb9ce6f30832", "score": "0.5034455", "text": "function onBrushRange(dateRange) {\n\tfilterRange = dateRange;\n\tlet filtered = filterCategoryData(filterCategory, filterRange);\n\td3.select('#stacked-area-chart')\n\t\t.datum(filtered)\n\t\t.call(stackChart);\n}", "title": "" }, { "docid": "86855479c3f5404753caa4c16f9f0e72", "score": "0.50326914", "text": "initialize () {\n // this.updateGlobalExtremes();\n\n this.setType( SeriesTypes.line );\n }", "title": "" }, { "docid": "f8f0650610f555599060227bf53e90b1", "score": "0.5030715", "text": "function removeCharts(inFooter) {\n if (inFooter == false) {\n removeCostChart();\n }\n removeGlobalSpeedChart();\n removeGlobalCostChart();\n removeDonutChart();\n }", "title": "" }, { "docid": "49a3069b807d8d97495028ccac592a80", "score": "0.50287956", "text": "function updateSparkline() {\n arraysLoaded++;\n \t if (arraysLoaded >= 2)\n \t {\n \t \tvar minValuesArray = $.grep(sparkAppropTotalArray.concat(sparkExpendTotalArray), function(val) { return val != null; });\n\t \t arraysLoaded = 0;\n\t // Small chart\n\t sparkChart = new Highcharts.Chart({\n\t chart: {\n\t defaultSeriesType: \"area\",\n\t marginBottom: 15,\n\t marginRight: 0,\n\t renderTo: \"selected-chart\"\n\t },\n\t legend: { enabled: false },\n\t credits: { enabled: false },\n\t plotOptions: {\n\t area: { fillOpacity: 0.25 },\n\t series: {\n\t lineWidth: 2,\n\t point: {\n\t events: {\n\t click: function() {\n\t\t\t\t\t\tvar x = this.x;\n\t \tif (fundView == '' && officerView == '')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar clickedYear = new Date(x).getFullYear();\t\t\t\t \n\t\t\t\t\t\t\t$.address.parameter('year',clickedYear)\n\t\t\t\t\t\t\t$.address.parameter('fund',convertToQueryString($('.expanded-primary h2').html()));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t }\n\t }\n\t },\n pointInterval: 365 * 24 * 3600 * 1000,\n pointStart: Date.UTC(1993, 1, 1),\n\t shadow: false\n\t }\n\t },\n\t series: [\n {\n\t color: \"#264870\",\n\t data: sparkAppropTotalArray,\n marker: {\n radius: 4,\n symbol: \"circle\"\n },\n name: \"Budgeted\"\n\t }, {\n\t color: \"#7d9abb\",\n\t data: sparkExpendTotalArray,\n marker: {\n radius: 5,\n symbol: \"square\"\n },\n name: \"Spent\"\n\t }\n\t ],\n\t title: null,\n\t tooltip: {\n borderColor: \"#000\",\n formatter: function() {\n var s = \"<strong>\" + Highcharts.dateFormat(\"%Y\", this.x) + \"</strong>\";\n $.each(this.points, function(i, point) {\n s += \"<br /><span style=\\\"color: \" + point.series.color + \"\\\">\" + point.series.name + \":</span> $\" + Highcharts.numberFormat(point.y, 0);\n });\n return s;\n },\n shared: true\n },\n xAxis: {\n \t dateTimeLabelFormats: { year: \"%Y\" },\n \t gridLineWidth: 0,\n \t type: \"datetime\"\n \t },\n \t yAxis: {\n\t gridLineWidth: 0,\n\t labels: {\n \t formatter: function() {\n \t if (this.value >= 1000000000)\n \t return \"$\" + this.value / 1000000000 + \"B\";\n \t else if (this.value >= 1000000)\n \t return \"$\" + this.value / 1000000 + \"M\";\n \t else\n \t return \"$\" + this.value;\n \t }\n \t },\n \t lineWidth: 1,\n \t min: Math.min.apply( Math, minValuesArray ),\n\t title: { text: null }\n\t }\n\t });\n\t var selectedYearIndex = 18 - (2011 - loadYear);\n\t\tif (sparkChart.series[0].data[selectedYearIndex].y != null)\n\t\t\tsparkChart.series[0].data[selectedYearIndex].select(true,true);\n\t\tif (sparkChart.series[1].data[selectedYearIndex].y != null)\n\t\t\tsparkChart.series[1].data[selectedYearIndex].select(true,true);\n }\n }", "title": "" }, { "docid": "3b34f8a15d63afc200ebed8af9df9e44", "score": "0.5028595", "text": "clearMeasure() {\n this.manager_.plot.activateZoom();\n this.pStart_ = {};\n this.pEnd_ = {};\n\n const svg = d3.select('.gmf-lidarprofile-container svg.lidar-svg');\n svg.selectAll('#text_m').remove();\n svg.selectAll('#start_m').remove();\n svg.selectAll('#end_m').remove();\n svg.selectAll('#line_m').remove();\n\n svg.on('click', null);\n\n svg.style('cursor', 'default');\n }", "title": "" }, { "docid": "20f6e186c25df9501d75db0ad8dae74a", "score": "0.50284636", "text": "removeBaseline() {\n var self = this,\n onRemoveEnd;\n if (this._baselineShape) {\n onRemoveEnd = () => {\n self._container.removeChild(self._baselineShape);\n self._baselineShape = null;\n };\n this._gantt\n .getAnimationManager()\n .preAnimateTaskBaselineRemove(this._baselineShape, onRemoveEnd);\n }\n }", "title": "" }, { "docid": "136e5d3ea49b56d35f5c93e9efa11765", "score": "0.5027551", "text": "function visualize() {\n // setup watch for slider\n $scope.$watch('selection.threshold.value',updateThreshold);\n $scope.working = true;\n $q.all({\n average: $http.get($url('/npn_portal/stations/getTimeSeries.json'),{\n params:avg_params\n }),\n selected: $http.get(timeSeriesUrl,{\n params:params\n })\n }).then(function(results){\n if(results.selected.data.timeSeries != null) {\n results.selected.data = results.selected.data.timeSeries;\n }\n if(forecast) {\n // need to separate out <=today and >today\n // this is kind of quick and dirty for doy\n var todayString = date(new Date(),'yyyy-MM-dd'),\n processed = results.selected.data.reduce(function(map,d){\n if(!map.forecast) {\n map.selected.push(d);\n if(d.date === todayString) {\n // include the last day of the selected range\n // on the forecast so the two connect on the graph\n map.forecast = [d]; // forecast data starts here\n }\n } else {\n map.forecast.push(d);\n }\n return map;\n },{\n selected: []\n });\n if(!processed.forecast) {\n processed.forecast = [];\n }\n addData('selected',{\n year: start.getFullYear(),\n color: 'blue',\n data: processed.selected\n });\n addData('forecast',{\n year: start.getFullYear()+' forecast',\n color: 'red',\n data: processed.forecast\n });\n } else {\n addData('selected',{\n year: start.getFullYear(),\n color: 'blue',\n data: results.selected.data\n });\n }\n if(show30YearAvg) {\n addData('average',{\n color: 'black',\n data: results.average.data\n });\n }\n \n $log.debug('draw',data);\n\n doyTrim();\n updateAxes();\n\n if(show30YearAvg) {\n addLine('average');\n }\n addLine('selected');\n if(forecast) {\n addLine('forecast');\n }\n commonChartUpdates();\n delete $scope.working;\n\n });\n }", "title": "" }, { "docid": "2edc0715207096ed52a37062b62f7f6a", "score": "0.5024905", "text": "_setupChart()\n {\n super._setupChart();\n\n // N.B. Get local copy of climateData\n // This is veeeeeeeeery important! It drove me nuts, because I spent\n // more than 1 hour looking for the problem: Why did the global object\n // this._climateData change? Because it was referenced once instead of\n // copied properly...\n let climateData = this._main.modules.helpers.deepCopy(this._climateData);\n\n // Create boxplot group\n let svg = this._chart\n .append('g')\n .attr('id', 'boxplot-group'+ this._chartCollectionId);\n\n // For each subchart\n for (let datatypeIdx = 0; datatypeIdx < this._numSubcharts; datatypeIdx++)\n {\n // Error handling: Only setup the subcharts if there is data available\n if (!climateData['has_' + this._chartMain.subcharts[datatypeIdx].data])\n continue;\n\n // ----------------------------------------------------------------------\n // Prepare the data\n // Required format: array of arrays with data[m][2]\n // m = number of months (12)\n // data[i][0] = name of the ith column (month + data type)\n // data[i][1] = array of values for this month\n // ----------------------------------------------------------------------\n\n // Get climate data and min/max values (0: temp, 1: prec)\n let vizData = [];\n let vizMin = +Infinity;\n let vizMax = -Infinity;\n\n // For each month\n for (let monthIdx = 0; monthIdx < MONTHS_IN_YEAR.length; monthIdx++)\n {\n // Create empty array\n vizData[monthIdx] = [];\n\n // Name of month\n vizData[monthIdx][0] = MONTHS_IN_YEAR[monthIdx];\n\n // Get data values\n let values = this._main.modules.helpers.deepCopy(climateData\n [this._chartMain.subcharts[datatypeIdx].data + '_list']\n [monthIdx]\n );\n vizData[monthIdx][1] = values;\n\n // For each value\n for (let valueIdx = 0; valueIdx < values.length; valueIdx++)\n {\n let value = values[valueIdx];\n if (value > vizMax) vizMax = value;\n \t\tif (value < vizMin) vizMin = value\n }\n }\n\n // Update fixed maxRange, if for some reason it is not enough\n let maxRange = this._main.modules.helpers.deepCopy(\n this._chartMain.subcharts[datatypeIdx].maxRange\n );\n while (maxRange[0] > vizMin)\n maxRange[0] += this._chartMain.subcharts[datatypeIdx].maxRange[0];\n while (maxRange[1] < vizMax)\n maxRange[1] += this._chartMain.subcharts[datatypeIdx].maxRange[1];\n\n // Manipulation: extend min and max values to make the chart look better\n let stretch = (vizMax - vizMin) * this._chartMain.minMaxStretchFactor;\n vizMin -= stretch;\n vizMax += stretch;\n\n // For prec: clip min to zero\n if (this._chartMain.subcharts[datatypeIdx].data == 'prec')\n vizMin = Math.max(vizMin, 0);\n\n // Error handling: if empty month arrays, write value 0\n for (let monthData of vizData)\n if (monthData[1].length == 0)\n monthData[1] = [0];\n\n\n // ----------------------------------------------------------------------\n // Draw the visualization elements in the chart\n // ----------------------------------------------------------------------\n\n // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n // x-Axis\n // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n let xScale = d3.scale\n .ordinal()\n .domain(MONTHS_IN_YEAR)\n .rangeRoundBands([0 , this._chartPos.width[datatypeIdx]], 0.7, 0.3);\n\n let xAxis = d3.svg\n .axis()\n .scale(xScale)\n .orient('bottom');\n\n\n\n // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n // y-Axis\n // -> 2 switch state modi:\n // 0: reative - adapt scale to data values and distribute perfectly\n // 1: fixed - always the same scale to make charts comparable\n // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n let yDomain = null;\n if (this._chartMain.switch.activeState == 0) \n yDomain = [vizMin, vizMax];\n else if (this._chartMain.switch.activeState == 1)\n yDomain = maxRange;\n else { // No Y-Axis Scaling defined for activeState of switch => set to first option \n return this._chartMain.switch.activeState = 0;\n }\n \n\n let yScale = d3.scale\n .linear()\n .domain(yDomain)\n .range(\n [\n this._chartPos.bottom,\n this._chartPos.top\n ]\n );\n\n let yAxis = d3.svg\n .axis()\n .scale(yScale)\n .orient('left');\n\n\n\n // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n // Grid lines\n // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n // x-Direction\n\n let xGrid = d3.svg\n \t.axis()\n \t.scale(xScale)\n \t.tickSize(0\n + this._chartPos.top\n - this._chartPos.bottom\n )\n \t.tickSubdivide(true)\n \t.tickPadding(5)\n \t.tickFormat('');\n\n svg.append('svg:g')\n .attr('class', 'grid')\n .attr('transform', 'translate('\n + this._chartPos.left[datatypeIdx]\n + ','\n + this._chartPos.bottom\n + ')'\n )\n .call(xGrid);\n\n // y-Direction\n\n let yGrid = d3.svg\n \t.axis()\n \t.scale(yScale)\n \t.tickSize(0\n - this._chartPos.width[datatypeIdx]\n )\n \t.orient('left')\n \t.tickFormat('');\n\n svg.append('svg:g')\n .attr('class', 'grid')\n .attr('transform','translate('\n + this._chartPos.left[datatypeIdx]\n + ','\n + 0\n + ')'\n )\n .call(yGrid);\n\n\n // Styling\n\n svg.selectAll('.grid')\n .style('fill', 'none')\n .style('stroke', this._chartsMain.colors.grid)\n .style('stroke-width', this._chartMain.style.gridWidth + ' px')\n .attr('shape-rendering', 'crispEdges');\n\n\n // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n // Boxplots\n // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n let boxplots = d3.boxplot()\n .whiskers(this._iqr(1.5))\n .height(this._chartPos.height)\n .domain(yDomain)\n .showLabels(false);\n\n svg.selectAll('.boxplot')\n .data(vizData)\n .enter()\n .append('g')\n .attr('transform', (d) =>\n {\n return ('translate('\n + (xScale(d[0]) + this._chartPos.left[datatypeIdx])\n + ','\n + this._chartPos.top\n + ')'\n )\n }\n )\n .style('font-size', this._chartsMain.fontSizes.large + 'em')\n .style('fill', this._chartMain.subcharts[datatypeIdx].color)\n .style('opacity', this._chartMain.style.boxOpacity)\n .call(boxplots.width(xScale.rangeBand()));\n\n\n // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n // Draw Scales last \n // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n\n svg.append('g')\n .attr('class', 'x axis')\n .attr('transform', 'translate('\n + this._chartPos.left[datatypeIdx]\n + ','\n + this._chartPos.bottom\n + ')'\n )\n .style('font-size', this._chartsMain.fontSizes.small + 'em')\n .call(xAxis);\n\n svg.append('g')\n .attr('class', 'y axis')\n .attr('transform', 'translate('\n + this._chartPos.left[datatypeIdx]\n + ','\n + 0\n + ')'\n )\n .call(yAxis);\n\n\n // Styling\n\n svg.selectAll('.axis .domain')\n \t.style('fill', 'none')\n \t.style('stroke', 'black')\n \t.style('stroke-width', this._chartMain.style.axesWidth + 'px')\n \t.attr('shape-rendering', 'crispEdges');\n\n\n // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n // Title\n // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n svg.append('text')\n .attr('x', 0\n + this._chartPos.left[datatypeIdx]\n + (this._chartPos.width[datatypeIdx] / 2)\n )\n .attr('y', 0\n + this._chartPos.top\n - this._chartMain.margin.top\n )\n .attr('text-anchor', 'middle')\n .style('font-size', this._chartsMain.fontSizes.large + 'em')\n .text(this._chartMain.subcharts[datatypeIdx].title)\n\n }\n }", "title": "" }, { "docid": "4061977eb9610c3bd847f017c7c78d18", "score": "0.5016679", "text": "function drawFinalChart(data,jinfo){\n //conceal weather chart\n document.getElementById('timeline').style.visibility = 'hidden';\n //console.log(data);\n //console.log(jinfo);\n var intervals = jinfo.data.timelines[1].intervals\n //console.log(intervals)\n var insertJson = []\n for(var i = 0; i < intervals.length; i ++){\n var thistime = intervals[i].startTime;\n const uTime = parseFloat(dayjs(thistime).unix()* 1000);\n //console.log(uTime)\n const maxTemp = intervals[i].values.temperatureMax\n const minTemp = intervals[i].values.temperatureMin\n const addin = [uTime,maxTemp,minTemp]\n insertJson.push(addin)\n }\n \n Highcharts.getJSON(\n 'https://cdn.jsdelivr.net/gh/highcharts/[email protected]/samples/data/range.json',\n function(data) {\n data = insertJson\n Highcharts.chart('container2', {\n \n chart: {\n type: 'arearange',\n zoomType: 'x',\n scrollablePlotArea: {\n minWidth: 600,\n scrollPositionX: 1\n }\n },\n \n title: {\n text: 'Temperature Ranges(Min,Max)'\n },\n \n xAxis: {\n type: 'datetime',\n accessibility: {\n rangeDescription: 'Range: Jan 1st 2017 to Dec 31 2017.'\n }\n },\n \n yAxis: {\n title: {\n text: null\n }\n },\n \n tooltip: {\n crosshairs: true,\n shared: true,\n valueSuffix: '°C',\n xDateFormat: '%A, %b %e'\n },\n \n legend: {\n enabled: false\n },\n\n series: [{\n name: 'Temperatures',\n data: data,\n fillColor : '#F5B041'\n }]\n });\n }\n );\n\n // lets tidy data.\n\n\n var TodayDate = data.startTime;\n var intervals = jinfo.data.timelines[0].intervals;\n //console.log(intervals);\n //console.log(TodayDate)\n var TodayDate1 = dayjs().format('MM-DD');\n var FiveDaysLater = dayjs(TodayDate).add(6,'day');\n var FiveDaysLater1 = dayjs(FiveDaysLater).format('MM-DD');\n //console.log(TodayDate1)\n //console.log(FiveDaysLater1)\n\n\n //add inputData\n var inputData = {}\n \n\n var timeseries = []\n // TodayDate1, FiveDaysLater1\n //console.log(inputData);\n for(var i = 0; i < intervals.length; i ++){\n var cur = intervals[i];\n var curValues = cur.values;\n var curDate = intervals[i].startTime;\n var start = true;\n var curDate1 = dayjs(curDate).format('MM-DD');\n //stop after 5 days later. \n if(curDate1 == FiveDaysLater1){\n break;\n }\n if(start){\n //we add in data.\n var details = {} \n var apasl = curValues['pressureSeaLevel'];\n var at = curValues['temperature'];\n var caf = curValues['cloudCover'];\n var rh = curValues['humidity'];\n var wfd = curValues['windDirection'];\n var ws = curValues['windSpeed']\n details['air_pressure_at_sea_level'] = apasl;\n details['air_temperature'] = at;\n details['cloud_area_fraction'] = caf;\n details['relative_humidity'] = rh;\n details['wind_from_direction'] = wfd;\n details['wind_speed'] = ws;\n\n var instant = {}\n instant['details'] = details;\n \n\n var data = {'instant' : instant}\n data['next_12_hours'] = {\"summary\":{\"symbol_code\": \"clearsky\"}}\n data['next_1_hours'] = {\"summary\":{\"symbol_code\": \"clearsky\"},\"details\":{\"precipitation_amount\": 0}}\n data['next_6_hours'] = {\"summary\":{\"symbol_code\": \"clearsky\"},\"details\":{\"precipitation_amount\": 0}}\n var belowTimeseries = {}\n belowTimeseries['time'] = curDate;\n belowTimeseries['data'] = data;\n timeseries.push(belowTimeseries);\n }\n //break when the date is 6's day\n }\n var properties = {}\n properties[\"meta\"] = {\"units\":{\"air_pressure_at_sea_level\":\"hPa\", \n \"air_temperature\":\"celsius\",\"cloud_area_fraction\":\"%\",\n \"precipitation_amount\":\"mm\",\"relative_humidity\":\"%\",\n \"wind_from_direction\":\"degrees\",\"wind_speed\":\"m/s\"}};\n properties['timeseries'] = timeseries;\n inputData[\"properties\"] = properties;\n //console.log(inputData)\n\n \n \n\n\n\n\n\n\n Highcharts.ajax({\n url,\n dataType: 'json',\n success: json => {\n window.meteogram = new Meteogram(inputData, 'container');\n },\n error: Meteogram.prototype.error,\n headers: {\n // Override the Content-Type to avoid preflight problems with CORS\n // in the Highcharts demos\n 'Content-Type': 'text/plain'\n }\n });\n\n\n\n\n}", "title": "" }, { "docid": "8837aca3ef247a6444a861c757cfed65", "score": "0.5011975", "text": "function drawChart() {\n var data = new google.visualization.DataTable();\n data.addColumn('date', 'Date');\n for(var sensors in graphArrays) {\n if(sensors.includes('Avg') | sensors.includes('Count')) {\n data.addColumn('number', sensors);\n }\n };\n //reset startDate object from input\n startDate = new Date($('#start_date').val());\n\n for(i=0;i<diffDays;i++) {//loop each sensor array item\n\n var row = [new Date(startDate)]; // First col been the date\n\n for(sensor in graphArrays) { // Loop each sensor value to add to chart col\n if(sensor.includes('Avg') | sensor.includes('Count')) { //Ignore sum and counter for avg\n row.push(graphArrays[sensor][i]);\n }\n }\n data.addRow(row);\n startDate.setTime(startDate.getTime()+oneDay); // increment the startDate object by mil sec so month change is made\n }; \n //************************** column selector *****************************************************************************************\n var columnsTable = new google.visualization.DataTable();\n columnsTable.addColumn('number', 'colIndex');\n columnsTable.addColumn('string', 'colLabel');\n var initState= {selectedValues: []};\n // put the columns into this data table (skip column 0)\n for (var i = 1; i < data.getNumberOfColumns(); i++) {\n columnsTable.addRow([i, data.getColumnLabel(i)]);\n // you can comment out this next line if you want to have a default selection other than the whole list\n initState.selectedValues.push(data.getColumnLabel(i));\n }\n // you can set individual columns to be the default columns (instead of populating via the loop above) like this:\n // initState.selectedValues.push(data.getColumnLabel(4));\n var columnFilter = new google.visualization.ControlWrapper({\n controlType: 'CategoryFilter',\n containerId: 'colFilter_div'+graphCount, // sets new div for each graph\n dataTable: columnsTable,\n options: {\n filterColumnLabel: 'colLabel',\n ui: {\n label: '',\n caption: \"Select Sensors\",\n allowTyping: false,\n allowMultiple: true,\n allowNone: false,\n selectedValuesLayout: 'aside'\n }\n },\n state: initState\n });\n\n var chart = new google.visualization.ChartWrapper({\n chartType: chartType,\n containerId: 'chart_div'+graphCount,\n dataTable: data,\n options: {\n title: title, // Title variable set at start of submit func\n width: '100%',\n height: 200,\n pointSize: 3,\n hAxis: {\n title: 'Date(Month/date/year)',\n format: 'MMM/d/yy EEE' //show date format as ex Sep/4/16 Sun\n },\n vAxes: {\n 0: {title:'Sensor counter & Avg'}\n },\n explorer: {\n axis: 'horizontal',\n actions: ['dragToZoom', 'rightClickToReset'],\n keepInBounds: true\n }\n }\n });\n\n function setChartView () {\n \n var state = columnFilter.getState();\n var row;\n var view = {\n columns: [0]\n };\n for (var i = 0; i < state.selectedValues.length; i++) {\n row = columnsTable.getFilteredRows([{column: 1, value: state.selectedValues[i]}])[0];\n view.columns.push(columnsTable.getValue(row, 0));\n }\n // sort the indices into their original order\n view.columns.sort(function (a, b) {\n return (a - b);\n });\n chart.setView(view);\n chart.draw();\n }\n // clear the selection from the form fields after graph is setup\n $(\"input[type=text], textarea\").val(\"\");\n //Hide the draw graph button\n $(\"#draw\").toggle();\n //Hide the reset button\n $(\"#reset\").toggle();\n //show the get details button\n $(\"#details\").toggle();\n //create new Divs to hold the graph filter and chart\n var newDom = \"<div id='\"+graphCount+\"' class='row chart'><div id='contentDetail\"+graphCount+\"' class='col-md-3'></div>\";\n newDom += \"<div class='col-sm-7 col-md-8'><span class='glyphicon glyphicon-remove' style='float: right;' onclick='removeDiv(\"+graphCount+\")'></span>\";\n newDom += \"<div id='colFilter_div\"+graphCount+\"'></div><div id='chart_div\"+graphCount+\"'></div></div></div>\";\n //add the Dom to the index page by added it to the graph container div.\n $('.graphContainer:last').append(newDom);\n $('#contentDetail'+graphCount).html(detailContent);\n graphCount++; // increment the counter for the next graph\n \n google.visualization.events.addListener(columnFilter, 'statechange', setChartView);\n \n \n setChartView(); //draw chart\n columnFilter.draw(); // draw the column filter\n }", "title": "" }, { "docid": "254af125a7da14e8d849dd8e77937df2", "score": "0.50098103", "text": "drawGraph() {\n this.group[this.dense ? 'addClass' : 'removeClass']('highcharts-dense-data');\n }", "title": "" }, { "docid": "a4202adfa6bffe789371c1e3597e89aa", "score": "0.5008945", "text": "parseData(ser) {\n let w = this.w\n let cnf = w.config\n let gl = w.globals\n this.excludeCollapsedSeriesInYAxis()\n\n // If we detected string in X prop of series, we fallback to category x-axis\n this.fallbackToCategory = false\n\n this.ctx.core.resetGlobals()\n this.ctx.core.isMultipleY()\n\n if (gl.axisCharts) {\n // axisCharts includes line / area / column / scatter\n this.parseDataAxisCharts(ser)\n } else {\n // non-axis charts are pie / donut\n this.parseDataNonAxisCharts(ser)\n }\n\n this.coreUtils.getLargestSeries()\n\n // set Null values to 0 in all series when user hides/shows some series\n if (cnf.chart.type === 'bar' && cnf.chart.stacked) {\n const series = new Series(this.ctx)\n gl.series = series.setNullSeriesToZeroValues(gl.series)\n }\n\n this.coreUtils.getSeriesTotals()\n if (gl.axisCharts) {\n this.coreUtils.getStackedSeriesTotals()\n }\n\n this.coreUtils.getPercentSeries()\n\n if (\n !gl.dataFormatXNumeric &&\n (!gl.isXNumeric ||\n (cnf.xaxis.type === 'numeric' &&\n cnf.labels.length === 0 &&\n cnf.xaxis.categories.length === 0))\n ) {\n // x-axis labels couldn't be detected; hence try searching every option in config\n this.handleExternalLabelsData(ser)\n }\n\n // check for multiline xaxis\n const catLabels = this.coreUtils.getCategoryLabels(gl.labels)\n for (let l = 0; l < catLabels.length; l++) {\n if (Array.isArray(catLabels[l])) {\n gl.isMultiLineX = true\n break\n }\n }\n }", "title": "" }, { "docid": "044b8ed6adfaec8eb8d3f78cb469e203", "score": "0.5005846", "text": "function trim_curves(svg, data) {\n var kill = svg.selectAll(\"path\")\n .data(data)\n .exit()\n .remove();\n}", "title": "" }, { "docid": "9ffac015e9a576a77a31d5e172633dc3", "score": "0.5004259", "text": "function HUD_t_plot_hydrograph(index,scenario){\n\t\n\t\n\n\n\t\t\t\tif(index.length==0){\n\t\t\t\t\tindex='Not selected';\n\t\t\t\t}\n\t\t\t\t\n\n\t \n\t\t\t\tvar Xdata = new Array();\n\t\t\t\tvar Ydata = new Array();\n\t\t\t\t\n\t\t\t\tvar Ydata_r = new Array();\n\t\t\t\t\n\t\t\t\tvar YIndex=scenario+\"_\"+index;\n\t\t\t\tvar YIndex_r=scenario.replace(/LP|SP/gi, \"C\")+\"_\"+index;\n\t\t\t\tvar XIndex=\"date_\"+(scenario.split(\"_\"))[1];\n\t\t\t\t\n\t\t\t\tvar Ymax=0;\n\t\t\t\tvar Ymin=2000;\n\t\t\t\tvar Water_Stage= 0;\n\t\t\t\tvar Water_Surface = new Array();\n\n\t\t\t\tvar selectedPeak = \"#hud_t_u\"+index;\n\t\t\t\tvar referencePeak = \"#hud_t_l\"+index;\n\t\t\t\tvar selectedPeakNum = Number($(selectedPeak).html().replace(\",\", \"\"));\n\t\t\t\tvar referencePeak = Number($(referencePeak).html().replace(\",\", \"\"));\n\t\t\t\tvar peakReduction = (((referencePeak-selectedPeakNum)/referencePeak)*100).toFixed(1);\n\n\n\n\t\t\t\t\n\t\t\t\t\n\n\n\t\t\t\tvar csvArray2=document.hud_t_load_hydrography_data;\t\n\t\t\t\t\n\t\t\t\tfor(var i = 0; i < csvArray2.length; ++i){\n\t\t\t\t\n var row = csvArray2[i];\n\t\t\t\t \n\t\t\t\n\t\t\t\t\t \n\t\t\t\t \n\t\t\t\t Ydata[i]=Number(row[YIndex])/1000;\n\t\t\t\t Ydata_r[i]=Number(row[YIndex_r])/1000-Ydata[i];\n\t\t\t\t Xdata[i]=row[XIndex];\t\n\t\t\t\t //console.log(XIndex+\" \"+YIndex+\" \"+YIndex_r);\n\t\t\t\t// console.log(Xdata[i]+\" \"+Ydata_r[i]+\" \"+Ydata[i]);\n\t\t\t\t/* alert(Xdata+\" \"+Ydata+\" \"+Ymax+\" \"+Ymin);*/\n\t\t\t\t \n\t\t\t\t \n\t\t\t\t \t\t\t\t \n\t\t\t\t}\n\t\t\t\t// console.log(Ydata_r);\n\t\t\t\t// console.log(Ydata);\n\t\t\t\n\t\t\n\n//Highchars plot coding\n \n var chart = new Highcharts.Chart({\n chart: {\n\n\t\t\t\tzoomType: 'xy',\n type: 'line',\n\t\t\t\trenderTo: document.getElementById('hud_t_ploting_area')\n },\n\t\t legend: {\n enabled: true,\n\t\t\tstyle: {\n fontWeight: 'normal',\t\t\t\t\t\n\t\t\t\t\tcolor:'black',\n\t\t\t\t\tfontFamily:'Calibri',\n\t\t\t\t\tfontSize:'10px'\n \n }\n }, \n\t\t\t\n\t\t\n\t\t\n title: {\n text: '<b>Peak discharge reduction (cfs)</b><br> Site'+index+': <span style=\"color:#FF0000;\">'+peakReduction+' %</span>',\n\t\t\t\t style: {\n fontWeight: 'normal',\t\t\t\t\t\n\t\t\t\t\tcolor:'black',\n\t\t\t\t\tfontFamily:'Calibri',\n\t\t\t\t\tfontSize:'13px'\n \n }\n },\n xAxis: {\n categories: Xdata,\n tickmarkPlacement: 'on',\n\t\t\t\ttickInterval: 1500,\n title: {\n enabled: true,\n\t\t\t\t\ttext: 'Date (M/D/YYYY H:MM)'+'<br/>',\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t style: {\n fontWeight: 'normal',\n\t\t\t\t\tcolor:'black',\n\t\t\t\t\tfontFamily:'Calibri',\n\t\t\t\t\tfontSize:'12px'\n }\n\t\t\t\t\t\n },\n\t\t\t\n },\n yAxis: {\n\t\t\t\t\n\t\t\t\ttitle: {\n enabled: true,\n\t\t\t\t\ttext: 'Discharge x1000(cfs)',\n\t\t\t\t\t style: {\n fontWeight: 'normal',\n\t\t\t\t\tcolor:'black',\n\t\t\t\t\tfontFamily:'Calibri',\n\t\t\t\t\tfontSize:'12px'\n }\n },\n\t\t\t\tlabels:{\n\t\t\t\tformat: '{value}'\t\n\t\t\t\t},\n\t\t\t\t\n\t\t\t\tmin:0,\n\t\t\t\tmax:70,\n\t\t\t\t\t\t\t\t\t\n },\n\t\t\t\n tooltip: {\n \n\t\t\t\t\n valueSuffix: ' Discharge (cfs)',\n\t\t\t\t\n\t\tformatter: function() {\n return 'Peak Discharge <b>'+ this.y.toFixed(2)+'</b> (x1000 cfs)'+'<br> on <b>'+ this.x+'<br/>';\n }\n\t\t\t\t\n\t\t\t\t\n\n\t\t\t\n },\n plotOptions: {\n\t\t\t\t\n\t\t\t\tseries: {\n\t\t\t\t\tstacking:'normal'\n \n },\n line: {\n lineWidth: 2,\n marker: {\n\t\t\t\t\t\tenabled:false,\n lineWidth: 1,\n lineColor: '#666666'\n }\n },showInLegend: true\n },\n series: [ \n\t\t\t{\n\t\t\t\t name: 'Reference (No Pond)',\n\n\t\t\t\tcolor: 'green',\n data: Ydata_r\n \n },{\t\t\t\t\n\t\t\t\t name: 'Selected',\n\t\t\t\tcolor: 'blue',\n data: Ydata\n \n },\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t]\n });\n\t//\t });\n\t\t\t\n\t\n\n\t\n\t\n}", "title": "" }, { "docid": "f6009177f374f18d84a54ea202b3a19b", "score": "0.5001957", "text": "function componentAreaMultiSeries () {\n\n \t/* Default Properties */\n \tvar dimensions = { x: 40, y: 40, z: 40 };\n \tvar colors = [\"orange\", \"red\", \"yellow\", \"steelblue\", \"green\"];\n \tvar classed = \"d3X3dAreaMultiSeries\";\n \tvar smoothed = d3.curveMonotoneX;\n\n \t/* Scales */\n \tvar xScale = void 0;\n \tvar yScale = void 0;\n \tvar zScale = void 0;\n \tvar colorScale = void 0;\n \tvar colorDomain = [];\n\n \t/* Components */\n \tvar area = componentArea();\n\n \t/**\n * Unique Array\n *\n * @param {array} array1\n * @param {array} array2\n * @returns {array}\n */\n \tvar arrayUnique = function arrayUnique(array1, array2) {\n \t\tvar array = array1.concat(array2);\n\n \t\tvar a = array.concat();\n \t\tfor (var i = 0; i < a.length; ++i) {\n \t\t\tfor (var j = i + 1; j < a.length; ++j) {\n \t\t\t\tif (a[i] === a[j]) {\n \t\t\t\t\ta.splice(j--, 1);\n \t\t\t\t}\n \t\t\t}\n \t\t}\n\n \t\treturn a;\n \t};\n\n \t/**\n * Initialise Data and Scales\n *\n * @private\n * @param {Array} data - Chart data.\n */\n \tvar init = function init(data) {\n \t\tvar _dataTransform$summar = dataTransform(data).summary(),\n \t\t rowKeys = _dataTransform$summar.rowKeys,\n \t\t columnKeys = _dataTransform$summar.columnKeys,\n \t\t valueMax = _dataTransform$summar.valueMax;\n\n \t\tvar valueExtent = [0, valueMax];\n \t\tvar _dimensions = dimensions,\n \t\t dimensionX = _dimensions.x,\n \t\t dimensionY = _dimensions.y,\n \t\t dimensionZ = _dimensions.z;\n\n\n \t\txScale = d3.scalePoint().domain(columnKeys).range([0, dimensionX]);\n\n \t\tyScale = d3.scaleLinear().domain(valueExtent).range([0, dimensionY]);\n\n \t\tzScale = d3.scaleBand().domain(rowKeys).range([0, dimensionZ]).padding(0.4);\n\n \t\tcolorDomain = arrayUnique(colorDomain, rowKeys);\n \t\tcolorScale = d3.scaleOrdinal().domain(colorDomain).range(colors);\n \t};\n\n \t/**\n * Constructor\n *\n * @constructor\n * @alias areaMultiSeries\n * @param {d3.selection} selection - The chart holder D3 selection.\n */\n \tvar my = function my(selection) {\n \t\tselection.each(function (data) {\n \t\t\tinit(data);\n\n \t\t\tvar element = d3.select(this).classed(classed, true);\n\n \t\t\tarea.xScale(xScale).yScale(yScale).dimensions({\n \t\t\t\tx: dimensions.x,\n \t\t\t\ty: dimensions.y,\n \t\t\t\tz: zScale.bandwidth()\n \t\t\t}).smoothed(smoothed);\n\n \t\t\tvar addArea = function addArea(d) {\n \t\t\t\tvar color = colorScale(d.key);\n \t\t\t\tarea.color(color);\n \t\t\t\td3.select(this).call(area);\n \t\t\t};\n\n \t\t\tvar areaGroup = element.selectAll(\".areaGroup\").data(function (d) {\n \t\t\t\treturn d;\n \t\t\t}, function (d) {\n \t\t\t\treturn d.key;\n \t\t\t});\n\n \t\t\tareaGroup.enter().append(\"Transform\").classed(\"areaGroup\", true).merge(areaGroup).transition().attr(\"translation\", function (d) {\n \t\t\t\tvar x = 0;\n \t\t\t\tvar y = 0;\n \t\t\t\tvar z = zScale(d.key);\n \t\t\t\treturn x + \" \" + y + \" \" + z;\n \t\t\t}).each(addArea);\n\n \t\t\tareaGroup.exit().remove();\n \t\t});\n \t};\n\n \t/**\n * Dimensions Getter / Setter\n *\n * @param {{x: number, y: number, z: number}} _v - 3D object dimensions.\n * @returns {*}\n */\n \tmy.dimensions = function (_v) {\n \t\tif (!arguments.length) return dimensions;\n \t\tdimensions = _v;\n \t\treturn this;\n \t};\n\n \t/**\n * X Scale Getter / Setter\n *\n * @param {d3.scale} _v - D3 scale.\n * @returns {*}\n */\n \tmy.xScale = function (_v) {\n \t\tif (!arguments.length) return xScale;\n \t\txScale = _v;\n \t\treturn my;\n \t};\n\n \t/**\n * Y Scale Getter / Setter\n *\n * @param {d3.scale} _v - D3 scale.\n * @returns {*}\n */\n \tmy.yScale = function (_v) {\n \t\tif (!arguments.length) return yScale;\n \t\tyScale = _v;\n \t\treturn my;\n \t};\n\n \t/**\n * Z Scale Getter / Setter\n *\n * @param {d3.scale} _v - D3 scale.\n * @returns {*}\n */\n \tmy.zScale = function (_v) {\n \t\tif (!arguments.length) return zScale;\n \t\tzScale = _v;\n \t\treturn my;\n \t};\n\n \t/**\n * Color Scale Getter / Setter\n *\n * @param {d3.scale} _v - D3 color scale.\n * @returns {*}\n */\n \tmy.colorScale = function (_v) {\n \t\tif (!arguments.length) return colorScale;\n \t\tcolorScale = _v;\n \t\treturn my;\n \t};\n\n \t/**\n * Colors Getter / Setter\n *\n * @param {Array} _v - Array of colours used by color scale.\n * @returns {*}\n */\n \tmy.colors = function (_v) {\n \t\tif (!arguments.length) return colors;\n \t\tcolors = _v;\n \t\treturn my;\n \t};\n\n \t/**\n * Smooth Interpolation Getter / Setter\n *\n * Options:\n * d3.curveBasis\n * d3.curveLinear\n * d3.curveMonotoneX\n *\n * @param {d3.curve} _v.\n * @returns {*}\n */\n \tmy.smoothed = function (_v) {\n \t\tif (!arguments.length) return smoothed;\n \t\tsmoothed = _v;\n \t\treturn my;\n \t};\n\n \treturn my;\n }", "title": "" }, { "docid": "ee7d0be592dc8985f540d037e7bb8a70", "score": "0.49923986", "text": "updateAxis() {\n var myNums = this.data.map(d => d.last);\n this.y.overrideMin = Math.min(...myNums);\n this.y.overrideMax = Math.max(...myNums);\n }", "title": "" }, { "docid": "b0f14f7f13aedbbf40440b32034f7c32", "score": "0.49887872", "text": "function chart_sensor(sensor) {\n var data = new Array();\n var qtime, qval, deltax, deltat;\n var sumt, sumx;\n var lastt;\n var i, sec;\n data = [];\n deltax = 0;\n deltat = 0;\n sumx = 0;\n sumt = 0;\n // set length of \"rolling average\"\n switch (sensors[sensor].subtype) {\n case \"pplus\":\n case \"pminus\":\n case \"q1\":\n case \"q2\":\n case \"q3\":\n case \"q4\":\n case \"vrms\":\n case \"irms\":\n sec = 30;\n break;\n\n default:\n sec = 1;\n break;\n }\n // set timestamp on ms\n if (sensors[sensor].data.length > 0) lastt = sensors[sensor].data[0][0] * 1e3;\n // now compute the \"rolling average\"\n for (i = 1; i < sensors[sensor].data.length; i++) {\n qtime = sensors[sensor].data[i][0] * 1e3;\n qval = sensors[sensor].data[i][1];\n deltax = sensors[sensor].data[i][1] - sensors[sensor].data[i - 1][1];\n deltat = sensors[sensor].data[i][0] - sensors[sensor].data[i - 1][0];\n sumx += deltax;\n sumt += deltat;\n if (sumt >= sec || i == sensors[sensor].data.length - 1) {\n // compute the different sensor types\n switch (sensors[sensor].type) {\n case \"electricity\":\n // calculate the wattage from the given Wh values in time interval\n switch (sensors[sensor].subtype) {\n case \"pplus\":\n case \"pminus\":\n case \"q1\":\n case \"q2\":\n case \"q3\":\n case \"q4\":\n qval = 3600 * sumx / sumt;\n break;\n\n default:\n // just take qval as it is\n break;\n }\n break;\n\n case \"water\":\n case \"gas\":\n // sum up the volume flown during a time interval; no division here\n qval = sumx;\n break;\n\n default:\n qval = sumx;\n break;\n }\n // round on two digits\n qval = Math.round(qval * 100) / 100;\n sumx = 0;\n sumt = 0;\n if (deltat >= sec) data.push([ lastt, qval ]);\n data.push([ qtime, qval ]);\n }\n lastt = qtime;\n }\n // check if chart has to be altered or a new series has to be added\n var obj = chart.filter(function(o) {\n return o.label == sensors[sensor].name;\n });\n if (obj[0] == null) {\n obj = {};\n obj.label = sensors[sensor].name;\n obj.data = data;\n obj.color = color;\n color++;\n chart.push(obj);\n } else {\n obj[0].data = data;\n }\n // process the chart selection\n $(\"#choices\").find(\"input\").on(\"click\", plotSelChart);\n function plotSelChart() {\n selChart = [];\n $(\"#choices\").find(\"input:checked\").each(function() {\n var key = sensors[$(this).attr(\"id\")].name;\n var s = chart.filter(function(o) {\n return o.label == key;\n });\n if (s[0] !== undefined) selChart.push(s[0]);\n });\n $(\"#info\").html(\"\");\n // size the output area and plot the chart\n if (selChart.length > 0) {\n var width = $(\"#chartpanel\").width();\n var height = width * 3 / 4;\n height = height > 600 ? 600 : height;\n $(\"#chart\").width(width).height(height);\n $(\"#chart\").plot(selChart, chartOptions);\n } else {\n $(\"#chart\").html(\"\").height(0);\n }\n }\n // and finally plot the graph\n $(\"#info\").html(\"\");\n plotSelChart();\n // process hover\n $(\"#chart\").on(\"plothover\", function(event, pos, item) {\n if (item) {\n var itemTime = new Date(item.datapoint[0]);\n var hrs = itemTime.getHours();\n hrs = hrs < 10 ? \"0\" + hrs : hrs;\n var min = itemTime.getMinutes();\n min = min < 10 ? \"0\" + min : min;\n var sec = itemTime.getSeconds();\n sec = sec < 10 ? \"0\" + sec : sec;\n $(\"#tooltip\").html(hrs + \":\" + min + \":\" + sec + \" : \" + item.datapoint[1]).css({\n top: item.pageY + 7,\n left: item.pageX + 5\n }).fadeIn(200);\n } else $(\"#tooltip\").hide();\n });\n // process selection time interval\n $(\"#chart\").on(\"plotselected\", function(event, range) {\n var selFrom = range.xaxis.from.toFixed(0);\n var selTo = range.xaxis.to.toFixed(0);\n var details = new Array();\n // filter values within the selected time interval\n for (var i in selChart) {\n var selObj = {};\n selObj.color = selChart[i].color;\n selObj.label = selChart[i].label;\n selObj.data = selChart[i].data.filter(function(v) {\n return v[0] >= selFrom && v[0] <= selTo;\n });\n details.push(selObj);\n }\n // size the output area\n var width = $(\"#chartpanel\").width();\n var height = width * 3 / 4;\n height = height > 600 ? 600 : height;\n $(\"#chart\").width(width).height(height);\n $(\"#chart\").plot(details, chartOptions);\n $(\"#info\").html('<div align=\"center\"><button class=\"btn btn-primary btn-sm\" id=\"reset\">Reset</button></div>');\n // redraw the queried data\n $(\"#reset\").on(\"click\", function() {\n $(\"#chart\").plot(selChart, chartOptions);\n });\n });\n }", "title": "" }, { "docid": "b1ffb17245d25537ce639535210c85ee", "score": "0.49842143", "text": "drawEmpty() {\n const start = this.startAngleRad, end = this.endAngleRad, options = this.options;\n let centerX, centerY;\n // Draw auxiliary graph if there're no visible points.\n if (this.total === 0 && this.center) {\n centerX = this.center[0];\n centerY = this.center[1];\n if (!this.graph) {\n this.graph = this.chart.renderer\n .arc(centerX, centerY, this.center[1] / 2, 0, start, end)\n .addClass('highcharts-empty-series')\n .add(this.group);\n }\n this.graph.attr({\n d: Symbols.arc(centerX, centerY, this.center[2] / 2, 0, {\n start,\n end,\n innerR: this.center[3] / 2\n })\n });\n if (!this.chart.styledMode) {\n this.graph.attr({\n 'stroke-width': options.borderWidth,\n fill: options.fillColor || 'none',\n stroke: options.color || \"#cccccc\" /* Palette.neutralColor20 */\n });\n }\n }\n else if (this.graph) { // Destroy the graph object.\n this.graph = this.graph.destroy();\n }\n }", "title": "" }, { "docid": "ff0365c6b1696a25db0d79bc238c3690", "score": "0.49803242", "text": "function crop_prices_graph(crop_id) {\n var json_data = line_json_data.crop_prices;\n var dates = line_json_data.dates;\n var all_dates = [];\n\n var first_date = new Date(dates[0]['date']);\n while (first_date <= new Date(dates[dates.length - 1]['date'])) {\n all_dates.push(first_date.getTime());\n first_date.setDate(first_date.getDate() + 1);\n }\n\n var series = [{\n 'name': 'Range',\n 'type': 'boxplot'\n }, {\n 'name': 'Average Price',\n 'type': 'line'\n }];\n\n var ranges = [];\n var avgs = [];\n\n for (var i = 0; i < all_dates.length; i++) {\n ranges.push([all_dates[i], null, null, null, null, null]);\n avgs.push([all_dates[i], null]);\n }\n\n var max_vol = 0;\n //By default selecting the crop with max volume\n if (crop_id == -1) {\n for (var i = 0; i < json_data.length; i++) {\n if (json_data[i][QUANTITY__SUM] > max_vol) {\n max_vol = json_data[i][QUANTITY__SUM];\n crop_id = json_data[i]['crop__id'].toString();\n }\n }\n $('#crop_max_min_avg option[value=\"' + crop_id + '\"]').prop('selected', true);\n $('#crop_max_min_avg').material_select();\n }\n\n for (var i = 0; i < json_data.length; i++) {\n var index = all_dates.indexOf(new Date(json_data[i]['date']).getTime());\n\n if (json_data[i]['crop__id'].toString() == crop_id) {\n ranges[index][1] = json_data[i]['price__min'];\n var avg = json_data[i][AMOUNT__SUM] / json_data[i][QUANTITY__SUM];\n ranges[index][2] = avg;\n ranges[index][4] = avg;\n ranges[index][5] = json_data[i]['price__max'];\n avgs[index][1] = avg;\n }\n }\n\n series[1]['data'] = avgs;\n series[0]['data'] = ranges;\n\n plot_area_range_graph($(\"#container3\"), series);\n}", "title": "" }, { "docid": "0f14bda787efa85a8ada2f93e55b2e28", "score": "0.49745867", "text": "function EChartComponent({\n lowerYLimit,\n upperYLimit,\n data = [],\n colors = [],\n selectedX,\n}) {\n let chartRef = useRef(null);\n const [loading, setLoading] = useState(true);\n const [chartOption, setChartOption] = useState(getDefaultOption());\n useEffect(() => {\n const defaultOption = Object.assign({}, getDefaultOption());\n const selectedIndex = defaultOption.xAxis.data.indexOf(selectedX);\n const legendData = data.map(\n (item, index) => `Serie${index} - ${item[selectedIndex]}`,\n );\n defaultOption.legend.data = legendData;\n defaultOption.xAxis.data = defaultOption.xAxis.data.map(item => {\n return item !== selectedX\n ? {\n value: item,\n }\n : {\n value: item,\n textStyle: {\n padding: [0, 5],\n fontWeight: 'bold',\n fontSize: 14,\n backgroundColor: 'rgba(0,0,0,0.5)',\n rich: {\n p: {color: '#fff'},\n },\n },\n };\n });\n defaultOption.series = data.map((item, index) => ({\n ...serieOption,\n data: item,\n name: legendData[index],\n itemStyle: {\n color: colors[index] || '#fff',\n },\n }));\n if (lowerYLimit && upperYLimit) {\n const markAreaSerie = {\n name: 'Lower & Upper Limit',\n type: 'line',\n itemStyle: {\n normal: {\n color: 'rgba(0, 255, 0, 0.12)',\n },\n },\n markArea: {\n silent: true,\n data: [\n [\n {\n yAxis: lowerYLimit,\n },\n {\n yAxis: upperYLimit,\n },\n ],\n ],\n itemStyle: {\n borderType: 'dashed',\n },\n },\n };\n defaultOption.series.push(markAreaSerie);\n }\n // Get min of y axis dynamically\n const concatedData = data.reduce((result, item) => result.concat(item), []);\n const minValue = Math.min(...concatedData);\n const yMin = minValue * 0.75;\n defaultOption.yAxis.min = yMin;\n // if (chartRef) {\n // chartRef.setOption(defaultOption);\n // }\n setChartOption(Object.assign({}, defaultOption));\n }, [data, colors, lowerYLimit, upperYLimit, selectedX]);\n\n useEffect(() => {\n if (chartRef) {\n chartRef.setOption(chartOption, {\n notMerge: true,\n lazyUpdate: true,\n silent: true,\n });\n }\n }, [chartOption, loading]);\n\n const onRef = ref => {\n if (ref) {\n chartRef = ref;\n }\n };\n const onData = param => {};\n\n return (\n <View style={styles.chartContainer}>\n <SafeAreaView\n style={{opacity: loading ? 0 : 1, height: 240}} // eslint-disable-line react-native/no-inline-styles\n >\n <ECharts\n option={chartOption}\n ref={onRef}\n onData={onData}\n backgroundColor=\"#3a3a3a\"\n onLoadEnd={() => {\n setTimeout(() => setLoading(false), 100);\n }}\n />\n </SafeAreaView>\n </View>\n );\n}", "title": "" }, { "docid": "3b0b080337cbe1e3a5a1f8fdc087b443", "score": "0.49689323", "text": "function aggregate_bar_all(raw_data, width, height, target_id, min_hour, max_hour) {\n var empty = new Array(24+1).join('0').split('').map(parseFloat);\n\n var chart_data = {\n labels: [\"00\", \"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"07\", \"08\", \"09\", \"10\", \"11\",\n \"12\", \"13\", \"14\", \"15\", \"16\", \"17\", \"18\", \"19\", \"20\", \"21\", \"22\", \"23\"],\n datasets: [{data: empty.slice(0), fillColor: \"rgba(0,127,0,.5)\", strokeColor: \"rgba(0,127,0,.5)\"},\n {data: empty.slice(0), fillColor: \"rgba(0,0,0,.5)\", strokeColor: \"rgba(0,0,0,.8)\"},\n {data: empty.slice(0), fillColor: \"rgba(127,0,0,.5)\", strokeColor: \"rgba(127,0,0,.5)\"} ]};\n \n if (width == null) width = DEFAULT_WIDTH;\n if (height == null) height = DEFAULT_HEIGHT;\n \n sortByKey(raw_data, SCHEDULED);\n \n var bucket_count = empty.slice(0);\n \n // format data\n raw_data.forEach(function(val) {\n var hour = (new Date(Date.parse( val[SCHEDULED] ))).getHours();\n \n var delta = parseInt(val[DELTA]) / 60.0;\n if (delta < 0) {\n chart_data.datasets[0].data[hour] += delta;\n } else {\n chart_data.datasets[2].data[hour] += delta;\n }\n \n chart_data.datasets[1].data[hour] += Number(val[POPULATION]);\n \n bucket_count[hour] += 1;\n } );\n \n // average each bucket (hour)\n for (var i = 0; i < 24; i++) {\n if (bucket_count[i] == 0) continue;\n \n chart_data.datasets[0].data[i] /= bucket_count[i];\n chart_data.datasets[1].data[i] /= bucket_count[i];\n chart_data.datasets[2].data[i] /= bucket_count[i];\n }\n \n // slice the hours we want\n if (min_hour == null) min_hour = 0;\n if (max_hour == null) max_hour = 24;\n if (min_hour != 0 || max_hour != 24) {\n chart_data.labels = chart_data.labels.slice(min_hour, max_hour);\n chart_data.datasets[0].data = chart_data.datasets[0].data.slice(min_hour, max_hour);\n chart_data.datasets[1].data = chart_data.datasets[1].data.slice(min_hour, max_hour);\n chart_data.datasets[2].data = chart_data.datasets[2].data.slice(min_hour, max_hour);\n }\n \n return insert_chart(chart_data, \"bar\", width, height, target_id);\n}", "title": "" }, { "docid": "66f8bb81a8e3417bd0a55b062715bc69", "score": "0.49663845", "text": "function removeHighlight() {\n svg.selectAll(\".bar\")\n .classed(\"active\", function(d) {\n return false;\n })\n\n svg.selectAll(\".bar\")\n .classed(\"inactive\", function(d) {\n return false;\n })\n}", "title": "" }, { "docid": "08e8a452c560f307cd5ee39fdc61f8d5", "score": "0.49658644", "text": "applyZones() {\n const series = this, chart = this.chart, renderer = chart.renderer, zones = this.zones, clips = (this.clips || []), graph = this.graph, area = this.area, plotSizeMax = Math.max(chart.plotWidth, chart.plotHeight), axis = this[(this.zoneAxis || 'y') + 'Axis'], inverted = chart.inverted;\n let translatedFrom, translatedTo, clipAttr, extremes, reversed, horiz, pxRange, pxPosMin, pxPosMax, zoneArea, zoneGraph, ignoreZones = false;\n if (zones.length &&\n (graph || area) &&\n axis &&\n typeof axis.min !== 'undefined') {\n reversed = axis.reversed;\n horiz = axis.horiz;\n // The use of the Color Threshold assumes there are no gaps\n // so it is safe to hide the original graph and area\n // unless it is not waterfall series, then use showLine property\n // to set lines between columns to be visible (#7862)\n if (graph && !this.showLine) {\n graph.hide();\n }\n if (area) {\n area.hide();\n }\n // Create the clips\n extremes = axis.getExtremes();\n zones.forEach(function (threshold, i) {\n translatedFrom = reversed ?\n (horiz ? chart.plotWidth : 0) :\n (horiz ? 0 : (axis.toPixels(extremes.min) || 0));\n translatedFrom = clamp(pick(translatedTo, translatedFrom), 0, plotSizeMax);\n translatedTo = clamp(Math.round(axis.toPixels(pick(threshold.value, extremes.max), true) || 0), 0, plotSizeMax);\n if (ignoreZones) {\n translatedFrom = translatedTo =\n axis.toPixels(extremes.max);\n }\n pxRange = Math.abs(translatedFrom - translatedTo);\n pxPosMin = Math.min(translatedFrom, translatedTo);\n pxPosMax = Math.max(translatedFrom, translatedTo);\n if (axis.isXAxis) {\n clipAttr = {\n x: inverted ? pxPosMax : pxPosMin,\n y: 0,\n width: pxRange,\n height: plotSizeMax\n };\n if (!horiz) {\n clipAttr.x = chart.plotHeight - clipAttr.x;\n }\n }\n else {\n clipAttr = {\n x: 0,\n y: inverted ? pxPosMax : pxPosMin,\n width: plotSizeMax,\n height: pxRange\n };\n if (horiz) {\n clipAttr.y = chart.plotWidth - clipAttr.y;\n }\n }\n if (clips[i]) {\n clips[i].animate(clipAttr);\n }\n else {\n clips[i] = renderer.clipRect(clipAttr);\n }\n // when no data, graph zone is not applied and after setData\n // clip was ignored. As a result, it should be applied each\n // time.\n zoneArea = series['zone-area-' + i];\n zoneGraph = series['zone-graph-' + i];\n if (graph && zoneGraph) {\n zoneGraph.clip(clips[i]);\n }\n if (area && zoneArea) {\n zoneArea.clip(clips[i]);\n }\n // if this zone extends out of the axis, ignore the others\n ignoreZones = threshold.value > extremes.max;\n // Clear translatedTo for indicators\n if (series.resetZones && translatedTo === 0) {\n translatedTo = void 0;\n }\n });\n this.clips = clips;\n }\n else if (series.visible) {\n // If zones were removed, restore graph and area\n if (graph) {\n graph.show();\n }\n if (area) {\n area.show();\n }\n }\n }", "title": "" }, { "docid": "ce40765704ab951a2573426b3e3809da", "score": "0.4965234", "text": "function Filter2Chart(){}", "title": "" }, { "docid": "803af93a633b4a4a3afa063b75148db4", "score": "0.49639693", "text": "drawData () {\n // translate(x, y) specifies where bar begins, +1 to move right of y axis\n this.ddd.chart = this\n .createD3Element({\n data: this.d3Data.map(d => ({\n x: d.x,\n y: d.y,\n temperature: d.temperature,\n })),\n type: 'rect',\n })\n .attr('fill', d => this.color.scale(d.temperature))\n .attr('height', _ => this.barHeight)\n .attr('width', _ => this.axis.x.scale.bandwidth())\n .attr('x', d => this.axis.x.scale(d.x))\n .attr('y', d => this.axis.y.scale(d.y));\n // console.log('remove', this.d3Data.map(d => this.axis.y.scale(d.y)))\n // console.log('remove 2', this.axis.x.scale.bandwidth())\n }", "title": "" }, { "docid": "3cbacc470ca2f148c061f470f8b4f44d", "score": "0.4955783", "text": "function hideAxis() {\n g.select('.x.axis')\n .transition().duration(500)\n .style('opacity', 0);\n }", "title": "" }, { "docid": "85b572188aaf882e208c69d843fba3b8", "score": "0.49480286", "text": "function filterRangeGeoUnits(nullCheck, num, fromVal, toVal)\r\n\t\t\t{\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\t// create local variables\t\r\n\t\t\t\tvar legendPolygon;\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\t// for each GEOUNIT element listed in data.js\r\n\t\t\t\tfor(var i=0; i<numElements; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\t// certain conditions arise\r\n\t\t\t\t\tif ( /*( nullCheck == -1 && ukData.features[i].properties.datavalues[selectedDatasetIndex][selectedYearIndex] == null ) ||*/\r\n\t\t\t\t\t\t ( nullCheck != -1 && ukData.features[i].properties.datavalues[selectedDatasetIndex][selectedYearIndex] != null ) &&\r\n\t\t\t\t\t\t ( nullCheck == 0 && ukData.features[i].properties.datavalues[selectedDatasetIndex][selectedYearIndex] >= fromVal &&\r\n\t\t\t\t\t\t \tukData.features[i].properties.datavalues[selectedDatasetIndex][selectedYearIndex] < toVal ) )\r\n\t\t\t\t\t{\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t// pick out geometry information from data.js for GEOUNIT selected through iteration\r\n\t\t\t\t\t\tgeomType = ukData.features[i].geometry;\r\n\t\t\t\t\t\t\r\n\t\r\n\t\t\t\t\t\t // define new polygon and CSS attribution for highlight polygon\r\n\t\t\t\t\t\t // solid fill, no outline. Used to highlight polygons in the grade range over which user has hovered in LOWER RIGHT legend ...\r\n\t\t\t\t\t\tlegendPolygon = new L.GeoJSON(geomType);\r\n\t\t\t\t\t\tlegendPolygon.setStyle({\r\n\t\t\t\t\t\t\tweight: 0,\r\n\t\t\t\t\t\t\tcolor: compColour,\r\n\t\t\t\t\t\t\tdashArray: '',\r\n\t\t\t\t\t\t\tfillOpacity: 0.75,\r\n\t\t\t\t\t\t\topacity: 1.0\r\n\t\t\t\t\t\t});\r\n\t\r\n\t\r\n\t\t\t\t\t\t// if sub array of markedPolys array is not yet defined\r\n\t\t\t\t\t\tif ( typeof markedPolys[num] === 'undefined' ) { markedPolys[num] = new Array(); }\r\n\t\r\n\t\r\n\t\t\t\t\t\t// push new polygon onto markedPolys subu array\r\n\t\t\t\t\t\tmarkedPolys[num].push(legendPolygon);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// else if user hovers over null band in legend \r\n\t\t\t\t\telse if ( ( nullCheck == -1 && ukData.features[i].properties.datavalues[selectedDatasetIndex][selectedYearIndex] == null ) ) \r\n\t\t\t\t\t{\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t// pick out geometry information from data.js for GEOUNIT selected through iteration\r\n\t\t\t\t\t\tgeomType = ukData.features[i].geometry;\r\n\t\t\t\t\t\t\r\n\t\r\n\t\t\t\t\t\t // define new polygon and CSS attribution for highlight polygon\r\n\t\t\t\t\t\t // solid fill, no outline. Used to highlight polygons in the grade range over which user has hovered in LOWER RIGHT legend ...\r\n\t\t\t\t\t\tlegendPolygon = new L.GeoJSON(geomType);\r\n\t\t\t\t\t\tlegendPolygon.setStyle({\r\n\t\t\t\t\t\t\tweight: 0,\r\n\t\t\t\t\t\t\tcolor: compColour,\r\n\t\t\t\t\t\t\tdashArray: '',\r\n\t\t\t\t\t\t\tfillOpacity: 0.75,\r\n\t\t\t\t\t\t\topacity: 1.0\r\n\t\t\t\t\t\t});\r\n\t\r\n\t\r\n\t\t\t\t\t\t// if sub array of markedPolys array is not yet defined\r\n\t\t\t\t\t\tif ( typeof markedPolys[num] === 'undefined' ) { markedPolys[num] = new Array(); }\r\n\t\r\n\t\r\n\t\t\t\t\t\t// push new polygon onto markedPolys subu array\r\n\t\t\t\t\t\tmarkedPolys[num].push(legendPolygon);\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// else do nothing\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\t\r\n\t\t\t\t\t\t\t// else do nothing\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t}", "title": "" }, { "docid": "5cf20b740056304bb6748253f1e1d080", "score": "0.49420786", "text": "function draw_extremes(trace_data, dist, hdist) {\n ctx2.strokeStyle = 'green';\n ctx2.lineWidth = 0;\n\n //bounds\n if (sa_config.min_on) {\n ctx2.beginPath();\n ctx2.moveTo(0, -1 * hdist * (db_convert(min_data[0]) - sa_config.reference));\n for (var i = 1; i < trace_data.length; i++) {\n ctx2.lineTo(i * dist, -1 * hdist * (db_convert(min_data[i]) - sa_config.reference));\n }\n ctx2.stroke();\n }\n if (sa_config.max_on) {\n ctx2.beginPath();\n ctx2.moveTo(0, -1 * hdist * (db_convert(max_data[0]) - sa_config.reference));\n for (var i = 1; i < trace_data.length; i++) {\n ctx2.lineTo(i * dist, -1 * hdist * (db_convert(max_data[i]) - sa_config.reference));\n }\n ctx2.stroke();\n }\n}", "title": "" }, { "docid": "ec4acc46bae1e6c680a92921270ba541", "score": "0.49408823", "text": "function show_line_graphs() {\n var json_data = line_json_data.aggregator_data;\n // var farmer_data = line_json_data.farmer;\n var transport_data = line_json_data.transport_data;\n var dates_and_farmer_count = line_json_data.dates;\n var gaddidar_contribution = bar_graphs_json_data.gaddidar_contribution;\n var aggregator_incentive_cost = bar_graphs_json_data.aggregator_incentive_cost;\n var all_dates = [];\n\n try {\n var first_date = new Date(dates_and_farmer_count[0]['date']);\n while (first_date <= new Date(dates_and_farmer_count[dates_and_farmer_count.length - 1]['date'])) {\n all_dates.push(first_date.getTime());\n first_date.setDate(first_date.getDate() + 1);\n }\n time_series_volume_amount_farmers = [{\n 'name': \"Volume\",\n 'type': 'areaspline',\n 'data': [],\n // 'color': 'rgba(0,0,0,0.3)',\n 'pointStart': all_dates[0],\n 'pointInterval': 24 * 3600 * 1000\n }, {\n 'name': \"Amount\",\n 'type': 'areaspline',\n 'data': [],\n // 'color': 'rgba(0,0,255,0.3)',\n 'pointStart': all_dates[0],\n 'pointInterval': 24 * 3600 * 1000\n }, {\n 'name': \"Farmers\",\n 'type': 'column',\n 'data': [],\n // 'color': 'rgba(0,255,0,0.3)',\n 'pointStart': all_dates[0],\n 'pointInterval': 24 * 3600 * 1000\n }];\n\n time_series_cpk_spk = [{\n 'name': \"Cost per Kg\",\n 'type': 'areaspline',\n 'data': [],\n // 'color': 'rgba(0,0,255,0.3)',\n 'pointStart': all_dates[0],\n 'pointInterval': 24 * 3600 * 1000\n }, {\n 'name': \"Sustainability per Kg\",\n 'type': 'areaspline',\n 'data': [],\n // 'color': 'rgba(0,255,0,0.3)',\n 'pointStart': all_dates[0],\n 'pointInterval': 24 * 3600 * 1000\n }];\n\n for (var i = 0; i < all_dates.length; i++) {\n time_series_volume_amount_farmers[0]['data'].push([all_dates[i], null]);\n time_series_volume_amount_farmers[1]['data'].push([all_dates[i], null]);\n time_series_volume_amount_farmers[2]['data'].push([all_dates[i], null]);\n }\n for (var i = 0; i < json_data.length; i++) {\n var index = all_dates.indexOf(new Date(json_data[i]['date']).getTime());\n time_series_volume_amount_farmers[0]['data'][index][1] += json_data[i][QUANTITY__SUM];\n time_series_volume_amount_farmers[1]['data'][index][1] += json_data[i][AMOUNT__SUM];\n }\n\n aggregator_incentive_amount = new Array(all_dates.length).fill(0.0);\n var aggregator_incentive_cost_length = aggregator_incentive_cost.length;\n for (var i = 0; i < aggregator_incentive_cost_length; i++) {\n var date_index = all_dates.indexOf(new Date(aggregator_incentive_cost[i]['date']).getTime());\n aggregator_incentive_amount[date_index] += aggregator_incentive_cost[i][AMOUNT];\n }\n\n transport_cost = new Array(all_dates.length).fill(0);\n farmer_share = new Array(all_dates.length).fill(0);\n\n for (var i = 0; i < transport_data.length; i++) {\n var index = all_dates.indexOf(new Date(transport_data[i]['date']).getTime());\n transport_cost[index] += transport_data[i]['transportation_cost__sum'];\n farmer_share[index] += transport_data[i]['farmer_share__sum'];\n }\n\n var gaddidar_contribution_length = gaddidar_contribution.length;\n for (var i = 0; i < gaddidar_contribution_length; i++) {\n var index = all_dates.indexOf(new Date(gaddidar_contribution[i]['date']).getTime());\n farmer_share[index] += gaddidar_contribution[i]['amount'];\n }\n for (var i = 0; i < all_dates.length; i++) {\n //TODO : DONE - another for loop would be required to add AI values in amount\n time_series_cpk_spk[0]['data'].push([all_dates[i], time_series_volume_amount_farmers[0]['data'][i][1] > 0 ? ((transport_cost[i] + aggregator_incentive_amount[i]) / time_series_volume_amount_farmers[0]['data'][i][1]) : null]);\n\n time_series_cpk_spk[1]['data'].push([all_dates[i], time_series_volume_amount_farmers[0]['data'][i][1] > 0 ? (farmer_share[i] / time_series_volume_amount_farmers[0]['data'][i][1]) : null]);\n }\n\n for (var i = 0; i < dates_and_farmer_count.length; i++) {\n var index = all_dates.indexOf(new Date(dates_and_farmer_count[i]['date']).getTime());\n time_series_volume_amount_farmers[2]['data'][index][1] += dates_and_farmer_count[i]['farmer__count'];\n }\n createMasterForTimeSeries($('#detail_container_time_series'), $('#master_container_time_series'), time_series_volume_amount_farmers, MASTER_TIME_SERIES_VOL_AMT);\n createMasterForTimeSeries($('#detail_container_cpk'), $('#master_container_cpk'), time_series_cpk_spk, MASTER_TIME_SERIES_CPK_SPK);\n } catch (err) {\n alert(\"No Data is available for the current time period and filters applied.\");\n }\n}", "title": "" }, { "docid": "4a22ab2514a81ec8faf472f1666aa670", "score": "0.49318862", "text": "function brushed() {\n //console.log(\"brushed\");\n //algorithm to make ajax call:\n //once brushed, get the brush.extent(), and determine whether it is equal to\n //the entire range, in which case we do nothing. Else, find the smallest range that\n //encapsulates it (first find the start point, then loop through the array)\n //to find the ending point\n //then determine whether an ajax call is needed (by the ratio of brushed / range)\n //then making the ajax call, passing in the outer range & the brushed range and name of the line, and patient id\n //On server side, fetch the data and discard all data points out side the brushed range\n //then return the data and update the graph\n\n //only update when detail level < 10 seconds if 100 hz\n // < 4 seconds when 250 hz\n console.log(brush.extent());\n console.log(\"backup:\");\n console.log(backup);\n\n xScale.domain(brush.empty() ? xScale2.domain() : brush.extent()); // If brush is empty then reset the Xscale domain to default, if not then make it the brush extent \n\n svg.select(\".x.axis\") // replot xAxis with transition when brush used\n .transition()\n .call(xAxis);\n\n console.log(\"!!!!!!!!!\");\n //console.log(data);\n for(var k in backup) {\n if(options[k] === \"value\") {\n data[k] = backup[k];\n }\n }\n\n issue.select(\"path\") // Redraw lines based on brush xAxis scale and domain\n //.transition()\n .attr(\"d\", function(d) {\n var max = 0;\n\n if(backup[d.name] !== undefined) {\n max = findMaxY(backup[d.name]);\n } else {\n max = findMaxY(data[d.name]);\n }\n yScale.domain([0, max]);\n console.log(\"STEP-1\");\n return data[d.name] === undefined ? null : line(data[d.name]); //d.visible ? line(d.values) : null; // If d.visible is true then draw line for this d selection\n });\n \n d3.selectAll(\".circles\").remove();\n drawDots();\n\n console.log(\"STEP0\");\n\n //if (!brush.empty()) {\n var extent = brush.empty() ? xScale2.domain() : brush.extent();\n if(extent[1].getTime() - extent[0].getTime() <= THRESHOLD) {\n // do work to show more detailed data\n for(i = 0; i < ajaxQueue.length; ++i) {\n ajaxQueue[i].abort();\n }\n\n ajaxQueue.push(\n $.ajax({\n type: \"POST\",\n url: '/data/brush',\n data: {\n patient: patient_id,\n names: Object.keys(options),\n options: options,\n range: extent //brush.empty() ? xScale2.domain() : brush.extent()\n },\n success: function(resp) {\n console.log(resp);\n for(var name in data) {\n if(backup[name] === undefined) {\n backup[name] = data[name];\n }\n }\n transformData(resp);\n console.log(data);\n d3.selectAll(\".circles\").remove();\n issue.select(\"path\") // Redraw lines based on brush xAxis scale and domain\n //.transition()\n .attr(\"d\", function(d) {\n var max = 0;\n\n if(backup[d.name] !== undefined) {\n max = findMaxY(backup[d.name]);\n } else {\n max = findMaxY(data[d.name]);\n }\n yScale.domain([0, max]);\n console.log(\"STEP1\");\n return data[d.name] === undefined ? null : line(data[d.name]); //d.visible ? line(d.values) : null; // If d.visible is true then draw line for this d selection\n });\n drawDots();\n }\n })\n );\n } else {\n /*for (var k in backup) {\n data[k] = backup[k];\n }\n issue.select(\"path\")\n .transition()\n .attr(\"d\", function(d) {\n var max = findMaxY(data[d.name]);\n yScale.domain([0, max]);\n return data[d.name] === undefined ? null : line(data[d.name]);\n });*/\n var names = [];\n var alt_options = {};\n\n for(var k in options) {\n if(options[k] !== \"value\") {\n names.push(k);\n alt_options[k] = options[k];\n }\n }\n\n for(i = 0; i < ajaxQueue.length; ++i) {\n ajaxQueue[i].abort();\n }\n\n ajaxQueue.push(\n $.ajax({\n type: \"POST\",\n url: '/data/brush',\n data: {\n patient: patient_id,\n names: names,\n options: alt_options,\n range: extent //brush.empty() ? xScale2.domain() : brush.extent()\n },\n success: function(resp) {\n console.log(resp);\n for(var name in data) {\n if(backup[name] === undefined) {\n backup[name] = data[name];\n }\n }\n transformData(resp);\n console.log(data);\n d3.selectAll(\".circles\").remove();\n issue.select(\"path\") // Redraw lines based on brush xAxis scale and domain\n //.transition()\n .attr(\"d\", function(d) {\n var max = 0;\n\n if(backup[d.name] !== undefined) {\n max = findMaxY(backup[d.name]);\n } else {\n max = findMaxY(data[d.name]);\n }\n yScale.domain([0, max]);\n console.log(\"STEP1\");\n return data[d.name] === undefined ? null : line(data[d.name]); //d.visible ? line(d.values) : null; // If d.visible is true then draw line for this d selection\n });\n drawDots();\n }\n })\n );\n }\n //}\n\n }", "title": "" } ]
bcf86b1d783b97a778698176ec75860d
Animates the sidebar appearing onscreen
[ { "docid": "1d2ef8989229b1dd05746e4c01399a87", "score": "0.7207506", "text": "function animateInitSidebar($sidebar) {\n $sidebar.hide(0, function () {\n $sidebar.stop().animate({\n top: topPadding\n }, 0, function () {\n $sidebar.show(300, initSidebarFunction);\n });\n });\n}", "title": "" } ]
[ { "docid": "011952f7217ce6f3f80cc9d79a3a5d7d", "score": "0.79551286", "text": "function showSidebar() {\n closePanel.show();\n sidebarWrapper.animate({left: \"0px\"});\n showSidebarButton.addClass(\"morph-to-x\");\n}", "title": "" }, { "docid": "12c47dc300cf4822c8acdfbd8c365b0c", "score": "0.7594988", "text": "function animateSidebar() {\r\n $(\"#sidebar\").animate({\r\n width: \"toggle\"\r\n }, 350, function() {\r\n map.invalidateSize();\r\n });\r\n}", "title": "" }, { "docid": "8acbacf49e09e163021c3d557d418858", "score": "0.7238946", "text": "function sideShow() {\n side.style.display = \"block\";\n side.style.visibility = \"visible\";\n side.style.opacity = 1;\n side.style.animation = \"fade 1s\";\n}", "title": "" }, { "docid": "59565d98d910e9ee41e24674375885c0", "score": "0.7193503", "text": "function showSideMenu() {\n $(\"overlay\").style.display = \"block\";\n // Change the sidenav maxWidth for animation\n $(\"sidenav\").style.maxWidth = \"250px\";\n}", "title": "" }, { "docid": "4965ce689f5d44948cbfb50b70938b3e", "score": "0.690785", "text": "function openSidebar(){\r\n\r\n\t\t$close.removeClass('openIcon');\r\n\t\t$.cookie('sidebar_cookie_2', 'opened', {expires:7, path: '/'});\r\n\r\n\t\tif(!mobileIs){\r\n\r\n\t\t\tTweenMax.to($('#content')[0],\r\n\t\t\t \tsidebarTimeOut, \r\n\t\t\t\t{\r\n\t\t\t\t\tx: 280, \r\n\t\t\t\t\tease: sidebarEaseOut, \r\n\t\t\t\t\toverwrite: 'all'\r\n\t\t\t\t}\r\n\t\t\t);\r\n\r\n\t\t\tTweenMax.to([$supersized[0], $fSlide[0]],\r\n\t\t\t \tsidebarTimeOut, \r\n\t\t\t\t{\r\n\t\t\t\t\tx: 280, \r\n\t\t\t\t\tease: sidebarEaseOut, \r\n\t\t\t\t\toverwrite: 'all'\r\n\t\t\t\t}\r\n\t\t\t);\r\n\r\n\t\t\tTweenMax.to([$sidebar[0]],\r\n\t\t\t \tsidebarTimeOut, \r\n\t\t\t\t{\r\n\t\t\t\t\tx: 0, \r\n\t\t\t\t\tease: sidebarEaseOut, \r\n\t\t\t\t\toverwrite: 'all'\r\n\t\t\t\t}\r\n\t\t\t);\r\n\r\n\t\t}\r\n\r\n\t\tsetTimeout(function(){\r\n\t\t\tsidebarOpened = true;\r\n\t\t}, 600);\r\n\r\n\t}", "title": "" }, { "docid": "662316ef8c11877be6f4d211d816fcbb", "score": "0.678943", "text": "function showSidebar() {\n\n // Make sure we aren't already on portfolio page\n if(document.querySelector('#portfolio').classList.contains('active')) return;\n\n const gridDiv = document.querySelector('.container');\n\n // hide body content until the animation finishes\n document.querySelector('.content').style.display = 'none';\n\n // Set counter and interval\n let counter = 0;\n const interval = 1 / 15;\n\n // Animate last column of grid (sidebar) width up to 1fr for slide left effect\n const animation = setInterval(slideLeft, 15);\n function slideLeft() {\n if (counter >= 1) {\n gridDiv.style.gridTemplateColumns = `repeat(5, 1fr)`;\n // Show text in sidebar\n document.querySelector('.sidebar').style.fontSize = \"1em\";\n document.querySelector('.content').style.display = 'block';\n clearInterval(animation);\n } else {\n counter += interval;\n if (window.matchMedia('(max-device-width: 700px)').matches) {\n gridDiv.style.gridTemplateColumns = `1fr 1fr 1fr ${counter}fr ${counter}fr`;\n document.querySelector('.pagination.side').style.display = 'flex';\n } else {\n gridDiv.style.gridTemplateColumns = `1fr 1fr 1fr 1fr ${counter}fr`;\n }\n }\n }\n}", "title": "" }, { "docid": "10fa4f0581d7ef8d3655d30c89866f6d", "score": "0.6740856", "text": "function toggleNav() {\n let sidebarWidth = document.getElementById(\"sidebar\");\n if (sidebarWidth.style.width == \"\" || sidebarWidth.style.width == \"0px\") {\n $(sidebarWidth).animate(\n { width: '+=240px' }, { duration: 200, queue: false }\n );\n $(document.getElementsByClassName(\"sidenav-btn\")[0]).animate(\n { left: '+=240px' }, { duration: 200, queue: false }\n );\n $(document.getElementById(\"mapid\")).animate(\n { left: '+=12.5vw', width: '-=12.5vw'}, { duration: 200, queue: false }\n );\n } else {\n //sidebarWidth.style.width = \"\";\n $(sidebarWidth).animate(\n { width: '-=240px' }, { duration: 200, queue: false }\n );\n $(document.getElementsByClassName(\"sidenav-btn\")[0]).animate(\n { left: '-=240px' }, { duration: 200, queue: false }\n );\n $(document.getElementById(\"mapid\")).animate(\n { left: '-=12.5vw', width: '+=12.5vw'}, { duration: 200, queue: false }\n );\n } \n}", "title": "" }, { "docid": "965d8d4ec49bc9548f6679836ac5a591", "score": "0.66994023", "text": "function ocultarSidebar(){\n\tq('.overlay').style.display = 'none';\n\tq('#sidebar').className = 'sidebar-hidden';\n}", "title": "" }, { "docid": "6ed73103cc5896b66e9148d7d7030b1c", "score": "0.6693089", "text": "function showSideMenu(){\n $(\"#sideMenu\").show(500);\n}", "title": "" }, { "docid": "331813fad0381f4cf0d0c3392dcfd3ef", "score": "0.66845363", "text": "function openSidebar() {\n document.getElementById(\"sidebar\").style.display = \"block\";\n document.getElementById(\"overlay\").style.display = \"block\";\n}", "title": "" }, { "docid": "16c0320061877d5f3c7882a6067e4649", "score": "0.6663604", "text": "function w3_open() {\n if (mySidebar.style.display === 'block') {\n mySidebar.style.display = 'none';\n overlayBg.style.display = \"none\";\n } else {\n mySidebar.style.display = 'block';\n overlayBg.style.display = \"block\";\n }\n }", "title": "" }, { "docid": "b98670db7ba8493097ca775e6d7b8fdd", "score": "0.66364914", "text": "function w3_open() {\r\n if (mySidebar.style.display === 'block') {\r\n mySidebar.style.display = 'none';\r\n overlayBg.style.display = \"none\";\r\n } else {\r\n mySidebar.style.display = 'block';\r\n overlayBg.style.display = \"block\";\r\n }\r\n}", "title": "" }, { "docid": "9cf94751cf464de4df39190226c1ded4", "score": "0.66304475", "text": "function w3_open() {\n document.getElementById(\"mySidebar\").style.display = \"block\";\n}", "title": "" }, { "docid": "85d35f30857ef4573a4e2e479f7f5578", "score": "0.66288674", "text": "function w3_open() {\n if (mySidebar.style.display === 'block') {\n mySidebar.style.display = 'none';\n overlayBg.style.display = \"none\"; \n\n } else {\n mySidebar.style.display = 'block';\n overlayBg.style.display = \"block\";\n }\n}", "title": "" }, { "docid": "f9154b060dad8851a4934dff75bc08fc", "score": "0.662552", "text": "function w3_open() {\n if (mySidebar.style.display === 'block') {\n mySidebar.style.display = 'none';\n overlayBg.style.display = \"none\";\n } else {\n mySidebar.style.display = 'block';\n overlayBg.style.display = \"block\";\n }\n}", "title": "" }, { "docid": "f9154b060dad8851a4934dff75bc08fc", "score": "0.662552", "text": "function w3_open() {\n if (mySidebar.style.display === 'block') {\n mySidebar.style.display = 'none';\n overlayBg.style.display = \"none\";\n } else {\n mySidebar.style.display = 'block';\n overlayBg.style.display = \"block\";\n }\n}", "title": "" }, { "docid": "f9154b060dad8851a4934dff75bc08fc", "score": "0.662552", "text": "function w3_open() {\n if (mySidebar.style.display === 'block') {\n mySidebar.style.display = 'none';\n overlayBg.style.display = \"none\";\n } else {\n mySidebar.style.display = 'block';\n overlayBg.style.display = \"block\";\n }\n}", "title": "" }, { "docid": "6ed1fee295a23c69c27917175f8cc154", "score": "0.65986145", "text": "function w3_open() {\n\t\t if (mySidebar.style.display === 'block') {\n\t\t mySidebar.style.display = 'none';\n\t\t overlayBg.style.display = \"none\";\n\t\t } else {\n\t\t mySidebar.style.display = 'block';\n\t\t overlayBg.style.display = \"block\";\n\t\t }\n\t\t}", "title": "" }, { "docid": "54295eea2156bc36727e8e57f7f66b28", "score": "0.6598521", "text": "function openSidebar() {\n document.getElementById(\"mySidebar\").style.display = \"block\";\n document.getElementById(\"myOverlay\").style.display = \"block\";\n}", "title": "" }, { "docid": "50e2456e611f31855d614659fd587bab", "score": "0.6588281", "text": "function OpenSidebar() {\n body.classList.add(\"sidebar-is-open\");\n backdrop.classList.add(\"in\");\n backdrop.classList.remove(\"invisible\");\n}", "title": "" }, { "docid": "28056a9ac6064921fac76f490a020383", "score": "0.6586156", "text": "function openSidebar() {\n\tdocument.getElementById(\"mySidebar\").style.display = \"block\";\n\tdocument.getElementById(\"myOverlay\").style.display = \"block\";\n}", "title": "" }, { "docid": "bced7b4df8b013839a6c8e5b96e5b2d8", "score": "0.6581247", "text": "function toggleSidebarOpen() {\n\n\n\n }", "title": "" }, { "docid": "05addffbfb65c5d88ada33b5d07d3165", "score": "0.6580707", "text": "_showOrHideSidebar() {\n sidebar.classList.toggle('hidden');\n\n //display the show sidebar button\n btnHideSidebar.classList.toggle('hidden');\n\n //hide the button once it is pushed\n btnShowSidebar.classList.toggle('hidden');\n\n // //if sidebar is hidden\n // if (this._isSidebarHidden) {\n // //display the sidebar\n // sidebar.style.display = 'flex';\n\n // //display the hide sidebar button\n // btnHideSidebar.style.display = 'block';\n\n // //hide the button once it is pushed\n // btnShowSidebar.style.display = 'none';\n // } else {\n // //hide the sidebar\n // sidebar.style.display = 'none';\n\n // //display the show sidebar button\n // btnShowSidebar.style.display = 'block';\n\n // //hide the button once it is pushed\n // btnHideSidebar.style.display = 'none';\n // }\n\n //invert sidebar bool\n this._isSidebarHidden = !this._isSidebarHidden;\n\n //the map bugs out and shifts when sidebar gets shown or hidden, so resize it\n this._map.invalidateSize();\n }", "title": "" }, { "docid": "87d08f75e78e61fc9d140ec14bd482db", "score": "0.65745133", "text": "function w3_open() {\r\n\t\tif (mySidebar.style.display === 'block') {\r\n\t\t\tmySidebar.style.display = 'none';\r\n\t\t\toverlayBg.style.display = \"none\";\r\n\t\t} else {\r\n\t\t\tmySidebar.style.display = 'block';\r\n\t\t\toverlayBg.style.display = \"block\";\r\n\t\t}\r\n\t}", "title": "" }, { "docid": "ad268d65137d5eb6d5b867a7a8ea8120", "score": "0.65721416", "text": "function w3_open() {\n document.getElementById(\"mySidebar\").style.width = \"100%\";\n document.getElementById(\"mySidebar\").style.display = \"block\";\n}", "title": "" }, { "docid": "449339ba4981b698005d82a475f5e0bc", "score": "0.6567917", "text": "function vru_open() {\n document.getElementById(\"mySidebar\").style.display = \"block\";\n}", "title": "" }, { "docid": "8ab65c08a4a347b1b845d398cb661bbb", "score": "0.6555223", "text": "function showSidebar() {\n\n $('#partyTime').val('');\n $('#partyDate').val('');\n $('#partySize').val('');\n $('#partyName').val('');\n $('#partyPhone').val('');\n $('#partyEmail').val('');\n\n sidebarLeft.css('margin-left', '0');\n\n overlay.show(0, function() {\n overlay.fadeTo('500', 0.5);\n });\n }", "title": "" }, { "docid": "6ae91babfe35bb0671305d65c6fedd46", "score": "0.6540741", "text": "function rb_hide_sidebar_menu(with_animation)\n{\t\t\n\tif( ! with_animation)\n\t{\n\t\tpublic_vars.$pageContainer.addClass(public_vars.sidebarCollapseClass);\n\t}\n\telse\n\t{\n\t\tif(public_vars.$mainMenu.data('is-busy') || public_vars.$pageContainer.hasClass(public_vars.sidebarCollapseClass))\n\t\t\treturn;\n\t\t\n\t\tfit_main_content_height();\n\t\t\n\t\tvar current_padding = parseInt(public_vars.$pageContainer.css('padding-left'), 10);\n\t\t\n\t\t// Check\n\t\tpublic_vars.$pageContainer.addClass(public_vars.sidebarCollapseClass);\t\t\n\t\t\n\t\tvar padding_left = parseInt(public_vars.$pageContainer.css('padding-left'), 10),\n\t\t\t$span_elements = public_vars.$mainMenu.find('li a span'),\n\t\t\t$submenus = public_vars.$mainMenu.find('.has-sub > ul'),\n\t\t\t$search_input = public_vars.$mainMenu.find('#search .search-input'),\n\t\t\t$search_button = public_vars.$mainMenu.find('#search button'),\n\t\t\t$logo_env\t\t = public_vars.$sidebarMenu.find('.logo-env'),\n\t\t\t$collapse_icon\t = $logo_env.find('.sidebar-collapse'),\n\t\t\t$logo\t\t\t = $logo_env.find('.logo'),\n\t\t\t$sidebar_ulink\t = public_vars.$sidebarUser.find('span, strong'),\n\t\t\t\n\t\t\tlogo_env_padding = parseInt($logo_env.css('padding'), 10);\n\t\t\t\n\t\t\n\t\t// Return to normal state\n\t\tpublic_vars.$pageContainer.removeClass(public_vars.sidebarCollapseClass);\n\t\t\n\t\tvar padding_diff = current_padding - padding_left;\n\t\t\n\t\t// Start animation (1)\n\t\tpublic_vars.$mainMenu.data('is-busy', true);\n\t\t\n\t\t\n\t\t// Add Classes & Hide Span Elements\n\t\tpublic_vars.$pageContainer.addClass(public_vars.sidebarOnTransitionClass);\n\t\tsetTimeout(function(){ public_vars.$pageContainer.addClass(public_vars.sidebarOnHideTransitionClass); }, 1);\n\t\t\n\t\tTweenMax.to($submenus, public_vars.sidebarTransitionTime / 1100, {css: {height: 0}});\n\t\t\n\t\t$logo.transit({scale: [1,0], perspective: 300/*, opacity: 0*/}, public_vars.sidebarTransitionTime/2);\n\t\t$logo_env.transit({padding: logo_env_padding}, public_vars.sidebarTransitionTime);\n\t\t\n\t\t\n\t\tsetTimeout(function()\n\t\t{\n\t\t\tpublic_vars.$pageContainer.addClass('sidebar-collapsing-phase-2');\n\t\t\t\n\t\t\tsetTimeout(function()\n\t\t\t{\n\t\t\t\tpublic_vars.$mainMenu.data('is-busy', false);\n\t\t\t\tpublic_vars.$pageContainer.addClass(public_vars.sidebarCollapseClass);\n\t\t\t\tpublic_vars.$pageContainer.removeClass('sidebar-collapsing-phase-2');\n\t\t\t\t\n\t\t\t\tconsole.log(public_vars.sidebarTransitionTime);\n\t\t\t\t// In the end do some stuff\n\t\t\t\tpublic_vars.$pageContainer\n\t\t\t\t.add(public_vars.$sidebarMenu)\n\t\t\t\t.add($search_input)\n\t\t\t\t.add($search_button)\n\t\t\t\t.add($logo_env)\n\t\t\t\t.add($logo)\n\t\t\t\t.add($span_elements)\n\t\t\t\t.add($collapse_icon)\n\t\t\t\t.add($submenus)\n\t\t\t\t.add($sidebar_ulink)\n\t\t\t\t.add(public_vars.$mainMenu)\n\t\t\t\t.add($collapse_icon)\n\t\t\t\t.attr('style', '');\n\t\t\t\t\n\t\t\t\tpublic_vars.$pageContainer.removeClass(public_vars.sidebarOnTransitionClass).removeClass(public_vars.sidebarOnHideTransitionClass);\n\t\t\t\t\n\t\t\t\tfit_main_content_height();\n\t\t\t\t\n\t\t\t\t\n\t\t\t}, public_vars.sidebarTransitionTime);\n\t\t\t\n\t\t}, public_vars.sidebarTransitionTime / 2);\n\t}\n}", "title": "" }, { "docid": "00fbf6e3d168f735d6badc56645e5c65", "score": "0.65311176", "text": "function toggleSideBar(id){\r\n $(id).toggle(1000);\r\n}", "title": "" }, { "docid": "2940c3ea36b648e31d6dbfe4b66a8510", "score": "0.65137076", "text": "function showAside(){\n if (window.innerWidth < 1239)\n if (__aside.style.display === 'none' || __aside.style.display === \"\") {\n __main.style.position = 'fixed';\n __wall.style.display = 'inline';\n __asideBackground.style.display = 'inline-block';\n favMenuButton.src = \"img/favCloseIcon.png\";\n __aside.style.display = 'inline-block';\n MSI2020.style.position = 'fixed';\n } else {\n __main.style.position = 'absolute';\n __wall.style.display = 'none';\n __asideBackground.style.display = 'none';\n favMenuButton.src = \"img/favOpenIcon.png\";\n __aside.style.display = 'none';\n MSI2020.style.position = 'absolute';\n }\n}", "title": "" }, { "docid": "958273ffd4bf7fdd74d47ef9ba262ad4", "score": "0.651145", "text": "function showSide() {\n document.getElementById(\"mySideBar\").style.width = \"100%\";\n\t\tmap_callback();\n}", "title": "" }, { "docid": "2f5b4062bc404d373fb88ace93b8e3f3", "score": "0.6510493", "text": "function openSidebar() {\n sidebar.style.width = '250px';\n}", "title": "" }, { "docid": "5efdb0e2a27f83c0b11f6e338dcd5557", "score": "0.6506146", "text": "function w3Open() {\n if (mySidebar.style.display === 'block') {\n mySidebar.style.display = 'none';\n overlayBg.style.display = \"none\";\n } else {\n mySidebar.style.display = 'block';\n overlayBg.style.display = \"block\";\n }\n}", "title": "" }, { "docid": "df1b3374c722dd994f41acc71e646870", "score": "0.6503861", "text": "function nav_open() {\n if (mySidebar.style.display === 'block') {\n mySidebar.style.display = 'none';\n overlayBg.style.display = \"none\";\n } else {\n mySidebar.style.display = 'block';\n overlayBg.style.display = \"block\";\n }\n}", "title": "" }, { "docid": "93767c4a88e4bcf8da65ccc1c0e01716", "score": "0.6486746", "text": "function hideSideMenu() {\n $(\"overlay\").style.display = \"none\";\n // Change the sidenav maxWidth for animation\n $(\"sidenav\").style.maxWidth = \"0\";\n}", "title": "" }, { "docid": "7672d9bfe7956ef7eced1f9f4dde8a77", "score": "0.6486165", "text": "function sidebar() {\n if (width < 750) {\n $(\".sidebar\").addClass('d-none');\n\n } else if (width > 750) {\n $(\".sidebar\").removeClass('d-none');\n }\n }", "title": "" }, { "docid": "aff1e432f2bcf507b2603262009994e3", "score": "0.64729893", "text": "_hideSidebar(delay = true) {\n const delayAmount = delay ? 300 : 0;\n // Add a delay so close animation can play\n setTimeout(() => {\n // Remove the box-shadow\n this._renderer.setStyle(this._elementRef.nativeElement, 'box-shadow', 'none');\n // Make the sidebar invisible\n this._renderer.setStyle(this._elementRef.nativeElement, 'visibility', 'hidden');\n }, delayAmount);\n // Mark for check\n this._changeDetectorRef.markForCheck();\n }", "title": "" }, { "docid": "aff1e432f2bcf507b2603262009994e3", "score": "0.64729893", "text": "_hideSidebar(delay = true) {\n const delayAmount = delay ? 300 : 0;\n // Add a delay so close animation can play\n setTimeout(() => {\n // Remove the box-shadow\n this._renderer.setStyle(this._elementRef.nativeElement, 'box-shadow', 'none');\n // Make the sidebar invisible\n this._renderer.setStyle(this._elementRef.nativeElement, 'visibility', 'hidden');\n }, delayAmount);\n // Mark for check\n this._changeDetectorRef.markForCheck();\n }", "title": "" }, { "docid": "41a483c4c62a2e337853fef58b1f30b0", "score": "0.647083", "text": "sideBarVisibility() {\n this.sideBarVisible = !this.sideBarVisible;\n }", "title": "" }, { "docid": "d22e6dd1e3e8d1cf0a220b17a4c1c0b3", "score": "0.64641905", "text": "function toggleSidebar() {\n sidebar = document.getElementById(sidebarName);\n toggleButton = document.getElementById(toggleButtonName);\n toggleButton.classList.toggle(\"change\");\n if (isVisible) {\n sidebar.style.left = 0 + \"px\";\n isVisible = false;\n } else {\n sidebar.style.left = (-1 * linkPanelWidth) + \"px\";\n isVisible = true;\n }\n}", "title": "" }, { "docid": "ebfe1ac50f08548a779377a150554115", "score": "0.64641577", "text": "function closeSidebar() {\n closePanel.hide();\n sidebarWrapper.animate({left: \"-350px\"}); // the hideSidebarPosLeft variable do not works here :(\n showSidebarButton.removeClass(\"morph-to-x\");\n}", "title": "" }, { "docid": "7ae34a5c7f352d1015bd216ed7c99dea", "score": "0.6457942", "text": "function openNav() {\r\n sidebarContainer.classList.toggle(\"shown\");\r\n body.classList.toggle(\"slide-in\");\r\n setTimeout(function() {\r\n sidebarContainer.classList.toggle(\"slide-in\");\r\n }, 1);\r\n setTimeout(scrollDelay, 600);\r\n body.style.overflow = 'hidden';\r\n hamburger.classList.add(\"is-active\");\r\n hamburgerXs.classList.add(\"is-active\");\r\n}", "title": "" }, { "docid": "7b17906281373adc2a3b3c77c0d595ce", "score": "0.6447694", "text": "function sidebarSlideLeft() {\n stateModule.changeState(\"transition\");\n $(\".sidebarSlide\").removeClass('slideBack'); \n $(\".mainSlide\").removeClass('mainSlideBack'); \n $(\".sidebarSlide\").addClass('slideOver');\n $(\".mainSlide\").removeClass('fmSlideRight');\n $(\".mainSlide\").removeClass('fmSlideLeft');\n $(\".mainSlide\").addClass('mainSlideOver');\n $(\"#main\").width('74%');\n $(\"#siteName\").addClass('slideVertical');\n setTimeout( function() {\n getVidHeight()\n $(\"#sidebarIconContainer\").addClass('sidebarShow');\n stateModule.changeState(\"hidden\");\n }, 300);\n}", "title": "" }, { "docid": "e454468cc29d2a63f2268945bb6a6c95", "score": "0.64407885", "text": "function extendSidePreview(){\n\t$('#ne-list').animate({\n\t\twidth: '30%'\n\t}, 300, function(){\n\t\t$('#ne-side').show();\n\t\t$('#ne-side').animate({\n\t\t\topacity: 1\n\t\t}, 700);\n\t});\n}", "title": "" }, { "docid": "39bfc2e48abfd75fcecacf190d1df87d", "score": "0.64316624", "text": "function hideSidebar() {\n const gridDiv = document.querySelector('.container');\n const bodyDiv = document.querySelector('.body');\n\n //Hide side pagination\n document.querySelector('.pagination.side').style.display = 'none';\n\n // Hide text in sidebar so it doesn't look weird animating\n document.querySelector('.sidebar').style.fontSize = \"0\"\n\n // hide body content until the animation finishes\n document.querySelector('.content').style.display = 'none';\n\n // Get client width of sidebar\n let sidebarWidth = document.querySelector('.sidebar').clientWidth;\n const interval = sidebarWidth / 15;\n\n // Animate last column of grid (sidebar) width down to 0 for slide right effect\n const animation = setInterval(slideRight, 15);\n function slideRight() {\n if (sidebarWidth <= 0) {\n if (window.matchMedia('(max-device-width: 700px)').matches) {\n gridDiv.style.gridTemplateColumns = `1fr 1fr 1fr 0 0`;\n } else {\n gridDiv.style.gridTemplateColumns = `1fr 1fr 1fr 1fr 0`;\n }\n document.querySelector('.content').style.display = 'block';\n clearInterval(animation);\n } else {\n sidebarWidth -= interval;\n if (window.matchMedia('(max-device-width: 700px)').matches) {\n gridDiv.style.gridTemplateColumns = `1fr 1fr 1fr ${sidebarWidth/2}px ${sidebarWidth/2}px`;\n } else {\n gridDiv.style.gridTemplateColumns = `1fr 1fr 1fr 1fr ${sidebarWidth}px`;\n }\n }\n }\n}", "title": "" }, { "docid": "ffe01a42fa61033ea137e6f8a1d73cc2", "score": "0.6428375", "text": "function w3_open() {\n var mySidebar = byId(\"mySidebar\");\n var overlayBg = byId(\"myOverlay\");\n if (mySidebar.style.display === 'block') {\n mySidebar.style.display = 'none';\n overlayBg.style.display = \"none\";\n } else {\n mySidebar.style.display = 'block';\n overlayBg.style.display = \"block\";\n }\n}", "title": "" }, { "docid": "97d9f741f393d4b457ff0458ecfb3f1d", "score": "0.64268386", "text": "function w3_open() { // Toggle between showing and hiding the sidebar, and add overlay effect\n if (mySidebar.style.display === 'block') {\n mySidebar.style.display = 'none';\n overlayBg.style.display = \"none\";\n } else {\n mySidebar.style.display = 'block';\n overlayBg.style.display = \"block\";\n }\n}", "title": "" }, { "docid": "f92899bf2e33d432e167969f4fdeef89", "score": "0.64224505", "text": "_showSidebar() {\n // Remove the box-shadow style\n this._renderer.removeStyle(this._elementRef.nativeElement, 'box-shadow');\n // Make the sidebar invisible\n this._renderer.removeStyle(this._elementRef.nativeElement, 'visibility');\n // Mark for check\n this._changeDetectorRef.markForCheck();\n }", "title": "" }, { "docid": "f92899bf2e33d432e167969f4fdeef89", "score": "0.64224505", "text": "_showSidebar() {\n // Remove the box-shadow style\n this._renderer.removeStyle(this._elementRef.nativeElement, 'box-shadow');\n // Make the sidebar invisible\n this._renderer.removeStyle(this._elementRef.nativeElement, 'visibility');\n // Mark for check\n this._changeDetectorRef.markForCheck();\n }", "title": "" }, { "docid": "7cfe70c837ef4970ef176bb6030444c1", "score": "0.64222944", "text": "function onSidebar( ){\n if(sidebaropen == 0)\n {\n $( \"#demo_menu3\" ).mouseenter();\n $( \"#demo_menu3\" ).click();\n sidebaropen = 1;\n }\n else if (sidebaropen == 1)\n {\n $( \"#demo_menu3\" ).mouseleave();\n sidebaropen = 0;\n }\n \n\n\n }", "title": "" }, { "docid": "4ae3aa4e9dc52ad88b4dd798d0c61e13", "score": "0.64191973", "text": "function sideMenu(){\n const sideBar = document.getElementById('side-bar');\n const sideBarDisplay = window.getComputedStyle(sideBar).display;\n\n sideBar.style.display = sideBarDisplay === 'none' ?\n 'block' : 'none';\n}", "title": "" }, { "docid": "f4950bb7526902e87f06e5d0c7f32483", "score": "0.64162964", "text": "function openSidepage() {\n $('#mainpage').animate({\n left: '45%'\n }, 400, 'easeOutBack'); \n }", "title": "" }, { "docid": "454920d55db7da7d05494ee03cf3bd97", "score": "0.6382801", "text": "function navInnerShow() {\n $nav.show();\n $navInner.animate({\n width: '65%'\n }, animationSpeed);\n }", "title": "" }, { "docid": "cd1270c261f7f66a2388cffa4d612f5a", "score": "0.6377068", "text": "function toggleSidebar() {\n if (sidebarToggle.open == 1) {\n sidebarToggle.open = 0;\n sidebar.className = \"hidden\";\n sidebarToggle.className = \"fa fa-chevron-right fa-3x\";\n } else {\n sidebarToggle.open = 1;\n sidebar.className = \"shown\";\n sidebarToggle.className = \"fa fa-chevron-left fa-3x\";\n }\n }", "title": "" }, { "docid": "25798567d0965e7bb1cb4a5aac2f2d38", "score": "0.6374167", "text": "function initSidebarFunction() {\n $(function () {\n var $sidebar = $(\"#sidebar\"),\n $window = $(window),\n offset = $sidebar.offset()\n\n $window.scroll(function () {\n $sidebar.stop().animate({\n top: $window.scrollTop() + topPadding\n }, 0, \"swing\");\n });\n });\n $(window).scroll();\n toggleSidebar();\n}", "title": "" }, { "docid": "ef4970f4d886b92ca967b15899471800", "score": "0.6348095", "text": "function openNav() {\n document.getElementById(\"mySidebar\").style.width = \"60%\";\n // document.getElementById(\"main\").style.marginLeft = \"250px\";\n }", "title": "" }, { "docid": "570d398435a1cfc9ea5ff369b0bd7b38", "score": "0.63455606", "text": "function w3_open() {\n document.getElementById('mySidebar').style.display = 'block';\n document.getElementById('myOverlay').style.display = 'block';\n}", "title": "" }, { "docid": "10172dfb6fee868e76f60de5fb927a29", "score": "0.6343578", "text": "function openSidebar() {\n\t\t\tsidebarIsOpen = true;\n\n\t\t\t$( '.options' ).removeClass( 'closed' ).addClass( 'open' );\n\t\t\t$( '.press-this-actions, #scanbar' ).addClass( isHidden );\n\t\t\t$( '.options-panel-back' ).removeClass( isHidden );\n\n\t\t\t$( '.options-panel' ).removeClass( offscreenHidden )\n\t\t\t\t.one( transitionEndEvent, function() {\n\t\t\t\t\t$( '.post-option:first' ).focus();\n\t\t\t\t} );\n\t\t}", "title": "" }, { "docid": "2683775f62399472a2f004d70bab4746", "score": "0.63434684", "text": "displayUploadsSidebar() {\n\n\t\tthis.App.Debug.log('Uploads Sidebar Displayed');\n\n\t\tconst bodyElem = document.querySelector('body');\n\n\t\tbodyElem.classList.add('uploads-sidebar-visible');\n\n\t}", "title": "" }, { "docid": "a7e840df5fa0301789747071171bd341", "score": "0.6340031", "text": "function openNav() {\n $(\"#mySidebar\").css(\"width\", 380);\n $(\"#main\").css(\"margin-left\", 380);\n}", "title": "" }, { "docid": "868c1747f5180f2c797fc040a67c4d39", "score": "0.6339967", "text": "function openNav() {\n $(\"body\").css(\"overflow\", \"hidden\");\n $(\".sidenav\").css(\"opacity\", \"1\");\n document.getElementById(\"mySidenav\").style.width = \"250px\";\n document.body.style.backgroundColor = \"rgba(0,0,0,0.5)\";\n}", "title": "" }, { "docid": "9b3d268413887aa14e025d21dbc01296", "score": "0.63288826", "text": "function openSidepage() {\n $('#mainpage').animate({\n right: '350px'\n }, 400, 'easeOutBack');\n }", "title": "" }, { "docid": "36b71bf9aefed9260d35a7169c968823", "score": "0.63220817", "text": "toggleSidebar() {\n\n $( '#locator-wrapper' ).toggleClass( 'toggled' );\n\n }", "title": "" }, { "docid": "2c563966e591ecfd13fc144b2e57e03d", "score": "0.6321018", "text": "function toggleSideBar(){\n if ($(\"#logoarea\").css(\"display\") == \"block\") {\n $(\"#logoarea\").css(\"display\", \"none\");\n $(\"#main\").css(\"margin-left\", \"0\");\n } else {\n $(\"#logoarea\").css(\"display\", \"block\");\n $(\"#main\").css(\"margin-left\", \"270px\");\n }\n}", "title": "" }, { "docid": "5b071037673b5514bcd84c6403927ec3", "score": "0.63131875", "text": "function w3_open() {\r\n var x = document.getElementById(\"mySidebar\");\r\n x.style.width = \"300px\";\r\n x.style.paddingTop = \"10%\";\r\n x.style.display = \"block\";\r\n}", "title": "" }, { "docid": "a65bcdc5483f89b93b4749be83e9c26a", "score": "0.6313016", "text": "function w3_open() {\n document.getElementById(\"mySidebar\").style.display = \"block\";\n document.getElementById(\"myOverlay\").style.display = \"block\";\n}", "title": "" }, { "docid": "6805da978933d30921698d313f998eed", "score": "0.6307416", "text": "function w3_open() {\n document.getElementById(\"mySidebar\").style.display = \"block\";\n document.getElementById(\"myOverlay\").style.display = \"block\";\n}", "title": "" }, { "docid": "1a1c0e56eaeb76215f1dd2970a05e093", "score": "0.62877053", "text": "function sideBar_Close() {\n document.getElementById(\"sidebar\").style.marginLeft = \"0%\";\n document.getElementById(\"mySidebar\").style.display = \"none\";\n document.getElementById(\"openNav\").style.display = \"inline-block\";\n document.body.style.backgroundColor = \"white\";\n}", "title": "" }, { "docid": "a82305f2f4aea498a39ff3dd94af4c4a", "score": "0.6286059", "text": "function asideshow(){\n if (doctop() > 200){\n document.querySelector('aside').setAttribute('style',\n 'width: 100%; ' +\n 'position: fixed;' +\n 'top: 28px;' +\n 'z-index: 101;'\n )\n }\n else {\n document.querySelector('aside').setAttribute('style',\n\n 'width: 100%;' +\n 'position: absolute;' +\n 'top: 125px;' +\n 'left: 10%;' +\n 'z-index: 101;')\n }\n }", "title": "" }, { "docid": "1ccbc4199d1b3c4ff1add7a0f563f0e7", "score": "0.6282062", "text": "function openNav() {\n document.getElementById(\"side\").style.width = \"250px\";\n document.getElementById(\"main\").style.marginLeft = \"250px\";\n setTimeout(() => {document.getElementById(\"smallSide\").style.display = \"none\";}, 100)\n}", "title": "" }, { "docid": "b1001574f2edefa4779af345af9524a5", "score": "0.6281687", "text": "function openNav() {\n document.getElementById(\"mySidebar\").style.left = \"0\";\n}", "title": "" }, { "docid": "ca8439b6001b512bef8b925a46030f18", "score": "0.6279357", "text": "function openNav() {\ndocument.getElementById(\"mySidenav\").style.width = \"250px\";\ndocument.getElementById(\"main\").style.marginLeft = \"250px\";\n/* makes the right side fade to a dark gray */\ndocument.body.style.backgroundColor = \"rgba(0,0,0,0.25)\";\n}", "title": "" }, { "docid": "bf484be845e436e1bcb4b8de53b69137", "score": "0.62716496", "text": "function openNav()\n{\n $(\".side-nav\").css({\"visibility\" : \"visible\", \"width\" : \"100%\"});\n}", "title": "" }, { "docid": "84630ec068cb905b91f37e62e18a9168", "score": "0.6257272", "text": "function w3_open() {\r\n\t\tvar mySidebar = document.getElementById(\"mySidebar\");\r\n\tif (mySidebar.style.display === 'block') {\r\n\t\tmySidebar.style.display = 'none';\r\n\t\t\r\n\t} else {\r\n\t\tmySidebar.style.display = 'block';\r\n\t}\r\n\t}", "title": "" }, { "docid": "c4130f0b1f79ddc879b398336ca7dfd9", "score": "0.62551206", "text": "function showSidebar() {\r\n var sidebar = document.getElementById('sidebar');\r\n sidebar.style.display = 'inline';\r\n // change margin of wiki page content\r\n var wikipagecontent = document.getElementById('wikipagecontent');\r\n var cookie = fixedleft_get_cookie(\"FixedLeftThemeSidebar\");\r\n cookie = cookie.split('##');\r\n style = cookie[0];\r\n width = cookie[1];\r\n wikipagecontent.style.marginLeft = (20 + (width*1)) + 'px';\r\n sidebar.style.width = width + 'px';\r\n saveSidebarState(sidebar.style.display, width);\r\n // hide the show and menu icons\r\n var altWikiNavMenu = document.getElementById('altWikiNavMenu');\r\n altWikiNavMenu.style.display = 'none';\r\n // copy the sidebar navigation menu back to sidebar\r\n var wikiNavMenu = document.getElementById('wikiNavMenu');\r\n wikiNavMenu = wikiNavMenu.parentNode.removeChild(wikiNavMenu);\r\n var sidebarWikiMenu = document.getElementById('sidebarWikiMenu');\r\n sidebarWikiMenu.appendChild(wikiNavMenu);\r\n}", "title": "" }, { "docid": "dcd0ad2c34634d8573ef6d290200021d", "score": "0.62536967", "text": "function tglSideBar(){\r\n var sideBarOffset = $('.sideBar').offset().top;\r\n \r\n document.body.onscroll = function(){\r\n if(document.body.scrollTop > sideBarOffset\r\n && $('.sideBar').hasClass('open')){\r\n $('.sideBar').css({\r\n 'position':'fixed',\r\n 'top':'0'\r\n });\r\n }else{\r\n $('.sideBar').css({\r\n 'position':'absolute',\r\n 'top':'auto'\r\n });\r\n }////END ifelse\r\n }////END fn \r\n \r\n if($('.sideBar').hasClass('open')){\r\n $('.sideBar').animate({right:'100%',left:'-150px'} ,'fast', function(){\r\n $(this).removeClass('open');\r\n }); \r\n }else{ \r\n $('.sideBar').animate({left:'0'} ,'fast', function(){\r\n $(this).addClass('open'); \r\n }); \r\n }///END ifelse\r\n document.body.onclick = function(){\r\n if($('.sideBar').hasClass('open')){\r\n if(event.target.id !== 'sideBr' \r\n && event.target.className !== 'btn btn-lg btn-link'\r\n && event.target.className !== 'list-group-item list-group-item'){\r\n $('.sideBar').animate({right:'100%',left:'-150px'} ,'fast', function(){\r\n $(this).removeClass('open');\r\n }); \r\n }////END EVENT \r\n }///END if\r\n }///END fn\r\n}////END fn ", "title": "" }, { "docid": "d130174448ab6498a03e21f1d086bb6c", "score": "0.62487", "text": "function show() {\n Keyboard.dismiss();\n Onyx.set(ONYXKEYS.IS_SIDEBAR_SHOWN, true);\n}", "title": "" }, { "docid": "e6ea429672c62edeb33cd8fe0f8b7e8a", "score": "0.62458324", "text": "function w3_open() {\r\n\tdocument.getElementById(\"mySidebar\").style.display = \"block\";\r\n\tdocument.getElementById(\"myOverlay\").style.display = \"block\";\r\n}", "title": "" }, { "docid": "9f49d2e658a2a97d655f85eeeddc8be2", "score": "0.62342155", "text": "appear() {\n\t\tthis.active = this.show = true;\n\t\tthis.addAnimation(new Framework.Util.Animate(this, 'alpha', 1, runtime.getTicks(500)));\n\t}", "title": "" }, { "docid": "44370dc1123da07ae6356c2970856f4f", "score": "0.62338924", "text": "function menuslidein(){\n $('#yearbooktoggle').removeClass('open').addClass('closed');\n $('#yearbook-nav').animate({\"left\":\"-200px\"},500);\n $('body').animate({left:\"0\"},500);\n }", "title": "" }, { "docid": "9564bcbff216d7c3178e9b90cfb1f709", "score": "0.6233386", "text": "function drawIndex() {\n //animate header\n var header = document.getElementById(\"mainHeader\");\n header.classList.toggle(\"bounceDown\");\n\n var bodyContent = document.getElementById(\"bodyContent\");\n\n var bodyContentAbout = document.getElementById(\"bodyContentAbout\");\n\n bodyContentAbout.style.display = \"none\";\n bodyContent.style.display = \"block\"\n\n sidebarClose();\n}", "title": "" }, { "docid": "015642a7453dc17b46b4a21b79b7bd56", "score": "0.6230708", "text": "function toggleSidebar() {\n document.getElementById(\"sidebar-wrapper\").classList.toggle('open');\n isSideOpen = !isSideOpen;\n console.log('ckicked')\n}", "title": "" }, { "docid": "fb181ed0c860871d58467910a038f2ca", "score": "0.6229007", "text": "function toggle(){\n toggleClass( nav, 'sidebar-show' );\n toggleClass( layer, 'sidebar-layer-show' );\n }", "title": "" }, { "docid": "c2fb56acb1a28710fcdf43f1c1bfe9e5", "score": "0.6204667", "text": "function openNav() {\n document.getElementById(\"mySidebar\").style.width = \"250px\";\n document.getElementById(\"main\").style.marginLeft = \"250px\";\n }", "title": "" }, { "docid": "c5031a302fbfaefd6027dbcb9da1e0fd", "score": "0.62006146", "text": "function toggleSideBar(bHide){\n if ($(\"#logoarea\").css(\"display\") === \"block\" || bHide) {\n $(\"#logoarea\").css(\"display\", \"none\");\n $(\"#main\").css(\"margin-left\", \"0\");\n } else {\n $(\"#logoarea\").css(\"display\", \"block\");\n $(\"#main\").css(\"margin-left\", \"270px\");\n }\n}", "title": "" }, { "docid": "a662f777107a126a71a4be6868b08a79", "score": "0.6191624", "text": "function openNav() {\n document.getElementById(\"mySidebar\").style.width = \"200px\";\n document.getElementById(\"main\").style.marginLeft = \"200px\";\n }", "title": "" }, { "docid": "f97e631e12f5deb4d221a777a741c703", "score": "0.61878115", "text": "function togglePane() {\n\t\tif (isAnimating)\n\t\t\treturn;\n\t\tisAnimating = true;\n\t\tif (adminContentElem.style.display == \"none\") {\n\t\t\tadminContentElem.classList.add(\"showing\");\n\t\t\tadminContentElem.style.removeProperty(\"display\");\n\t\t} else {\n\t\t\tadminContentElem.classList.add(\"hiding\");\n\t\t}\n\t}", "title": "" }, { "docid": "86a4b9e838ee4889da94b031383704c9", "score": "0.6170579", "text": "function toggleSidebar()\n{\nsidebar.classList.toggle('active');\nconsole.log(\"sidebar toggled\");\n}", "title": "" }, { "docid": "7d44056e6dc65d95bc358e9271de8e7e", "score": "0.6152724", "text": "function openNav() {\n document.getElementById(\"mySidebar\").style.width = \"250px\";\n document.getElementById(\"main\").style.marginLeft = \"250px\";\n document.getElementById(\"openBtn\").style.display = \"none\";\n}", "title": "" }, { "docid": "051bb72bcce19fd27008c616e8d78c41", "score": "0.613944", "text": "function openNav() {\n document.getElementById(\"lectureSidebarExpanded\").style.width = \"250px\";\n document.getElementById(\"main\").style.marginLeft = \"250px\";\n //document.getElementById(\"main\").style.width = \"calc(100% - 18px)\";\n document.getElementById(\"lectureSidebarCollapsed\").style.visibility = \"hidden\";\n}", "title": "" }, { "docid": "f2f073e2cac1bd6687a524b3950c968f", "score": "0.61389214", "text": "function showNav() {\n let toggled = false;\n return function() {\n const navigation = document.querySelector('.sideBar');\n if (toggled) {\n navigation.style.height = '0px';\n toggled = false;\n } else {\n navigation.style.height = '100px';\n toggled = true;\n }\n }\n }", "title": "" }, { "docid": "7a5e50bfc08c9fbcbba857437cef97f7", "score": "0.6138465", "text": "function openNav() {\r\n document.getElementById(\"mySidebar\").style.width = \"250px\";\r\n document.getElementById(\"main\").style.marginLeft = \"250px\";\r\n nav = true;\r\n}", "title": "" }, { "docid": "45193f9de0aabe60dbd07ab3b1d2f6d3", "score": "0.61342573", "text": "function openSidebar() {\n let scoreContainer = document.getElementById('metric_configuration');\n scoreContainer.style.padding = '0rem 1rem 1rem 1rem';\n scoreContainer.style.width = 'auto';\n\n let width = scoreContainer.getBoundingClientRect().width;\n let pullTab = document.getElementById('configuration_tab');\n pullTab.style.marginLeft = width + 'px';\n pullTab.onclick = closeSidebar;\n document.getElementById('main_section').style.marginLeft = width + 'px';\n}", "title": "" }, { "docid": "0d234c70b02decad71aecddc7e39b757", "score": "0.61284775", "text": "function w3_open() {\n document.getElementById(\"mySidebar\").style.display = \"block\";\n document.getElementById(\"myOverlay\").style.display = \"block\";\n document.getElementById(\"menuIcon\").className = \"fa fa-remove fa-fw\";\n}", "title": "" }, { "docid": "f06e5b896917fd9115e0062d9fc828e8", "score": "0.61249155", "text": "showHideSidebar() {\n if (this.state.sidebarToggle) {\n this.setState({ sidebarToggle: false });\n } else {\n this.setState({ sidebarToggle: true });\n }\n }", "title": "" }, { "docid": "ce1859ba0bfcca82796a1fc0dca0768e", "score": "0.61189973", "text": "function toggle() {\n if (app.style.display === \"none\") {\n app.style.display = \"block\";\n injectFrame();\n } else {\n app.style.display = \"none\";\n }\n}", "title": "" }, { "docid": "b677ec181281a3902ab68204debf8edd", "score": "0.6115054", "text": "function showMenu(){\n $(\".side-menu\").width(\"250px\"); \n $(\".navbar-expand-toggle\").show(); \n $(\".side-menu .title\").show(); \n }", "title": "" }, { "docid": "cba6f398ae5ab9f4623041856d4bef0c", "score": "0.6110924", "text": "toggleSideBar(displaySideBar){\n if(this.state.displaySideBar === 'side-bar') {\n this.setState({displaySideBar:'side-bar open'})\n } else{\n this.setState({displaySideBar:'side-bar'})\n }\n }", "title": "" }, { "docid": "f777c89cdfb5446b9256ce7356737cae", "score": "0.61028975", "text": "function hidesidebar()\n{\n $(\"#facebook\").html(\"\");\n $(\"#gmail\").html(\"\");\n $(\"#twitter\").html(\"\");\n $(\"#linkedIn\").html(\"\");\n $(\"#sidepanelTitle\").html(\"\");\n $(\"#sidepanel\").hide();\n $(\"#cards\").empty();\n $(\".tabs\").empty();\n $(\"#backfromsidebar\").html(navbarReloadTextCondensed)\n if($(window).width()>=768){\n $(\"#overlay\").fadeOut(300, function() {\n $(\"#overlay\").hide();\n });\n }\n}", "title": "" }, { "docid": "c41c45b7c1367ec3a0a2c1089fca4d10", "score": "0.6098445", "text": "function openNav() {\n\n map.invalidateSize();\n var x = document.getElementById(\"content\");\n //if sidebar is open\n if (x.style.marginLeft == \"300px\") {\n //change left margin of content\n x.style.marginLeft= \"0\";\n } else {\n //change left margin of content\n x.style.marginLeft= \"300px\";\n }\n}", "title": "" } ]
070a0e7c8cc9e04c667c7a0c6299d932
Helper method to add an asset to the assets list.
[ { "docid": "c58d0c7ee706e75cc45a35ee37aaa46b", "score": "0.8444249", "text": "function addAsset(assets, asset) {\n if (asset) {\n assets.push(asset);\n }\n}", "title": "" } ]
[ { "docid": "b143fbcf7cec88213b2bb730bc7e4ebb", "score": "0.68749547", "text": "function AddAsset(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,d=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,e=c||function(){return null},f=d||function(){return null},g=(b?b+\"/\":\"\")+a;/* Callback defaults *//* Determine the final path to the asset *//* Prevent double-loading */if(a.startsWith(\"//\")&&(g=window.location.protocol+a),console.debug(a+\" @ \"+b+\" -> \"+g),ASSETS[g])throw new Error(\"Duplicate asset \"+g+\": \"+JSON.stringify(ASSETS[g]));/* Construct and load the asset */var h=ASSETS[g]={};return new Promise(function(c,d){console.info(\"About to load asset\",g),h.file=a,h.src=g,h.tree=b,h.loaded=!1,h.error=!1,h.script=document.createElement(\"script\"),h.script.setAttribute(\"type\",\"text/javascript\"),h.script.setAttribute(\"src\",h.src),h.script.onload=function(){console.log(h.src+\" loaded\"),h.loaded=!0,e(h),c(h)},h.script.onerror=function(a){console.error(\"Failed loading\",h,a),h.error=!0,f(h,a),d(a)},document.head.appendChild(h.script)})}", "title": "" }, { "docid": "4ee9eb7613836b3368181d3fef172767", "score": "0.64966315", "text": "function addAsset(contents, relPath, hash) {\n // XXX hack to strip out private and public directory names from app asset\n // paths\n if (! inputSourceArch.pkg.name) {\n relPath = relPath.replace(/^(private|public)\\//, '');\n }\n\n resources.push({\n type: \"asset\",\n data: contents,\n path: relPath,\n servePath: colonConverter.convert(\n files.pathJoin(inputSourceArch.pkg.serveRoot, relPath)),\n hash: hash\n });\n }", "title": "" }, { "docid": "ed85f66b24f78b1585e04e77294d2fa7", "score": "0.64316803", "text": "function add_asset(name, worth, type)\n{\n var asset_url = 'users/' + curr_user.uid + '/assets/' + assetsLen;\n\n var para = document.getElementById(\"profile_assets_box\");\n var child = document.getElementById(\"profile_add_assets_button\");\n document.getElementById('profile_assets_placeholder').appendChild(asset_bullet(name, worth, type, \"P\", \"profile_asset_bullet\"));\n para.scrollTop = para.scrollHeight;\n database.ref(asset_url).set({\n name_worth: (worth + \"_\" + name + \":\" + type),\n });\n var updates = {};\n updates['/users/' + curr_user.uid + '/assets_len/'] = assetsLen + 1;\n return database.ref().update(updates);\n}", "title": "" }, { "docid": "301afdb05754b676c274affcfa2841b2", "score": "0.61522907", "text": "function addAsset(req, res){\n assetService.addAsset(req.body).then(function(){\n\n res.sendStatus(200);\n })\n .catch(function (err) {\n res.status(400).send(err);\n });\n}", "title": "" }, { "docid": "e2df45ccb79380f1677987f413dfe083", "score": "0.61141396", "text": "function AddAsset(src, tree=null, loadcb=null, errcb=null) {\n /* Determine the final path to the asset */\n let path = src;\n switch (tree) {\n case MOD_TFC:\n path = PATH_TFC + \"/\" + src;\n break;\n case MOD_TWAPI:\n path = PATH_TWAPI + \"/\" + src;\n break;\n default:\n if (src.startsWith(\"//\")) {\n path = window.location.protocol + src;\n }\n break;\n }\n _console_debug(`${src} @ ${tree} -> ${path}`);\n\n /* Prevent double-loading */\n if (ASSETS[path]) {\n let astr = JSON.stringify(ASSETS[path]);\n throw new Error(`Asset ${path} already added: ${astr}`);\n }\n\n /* Construct and load the asset */\n ASSETS[path] = {};\n let asset = ASSETS[path];\n return new Promise(function(resolve, reject) {\n _console_info(\"About to load asset\", path);\n asset.file = src;\n asset.src = path;\n asset.tree = tree;\n asset.loaded = false;\n asset.error = false;\n asset.script = document.createElement(\"script\");\n asset.script.setAttribute(\"type\", \"text/javascript\");\n asset.script.setAttribute(\"src\", asset.src);\n asset.script.onload = function() {\n _console_debug(\"Loaded\", asset);\n _console_log(`${asset.src} loaded`);\n asset.loaded = true;\n if (loadcb) { loadcb(asset); }\n resolve(asset);\n };\n asset.script.onerror = function(e) {\n _console_error(\"Failed loading\", asset, e);\n asset.error = true;\n if (errcb) { errcb(asset, e); }\n reject(e);\n };\n document.head.appendChild(asset.script);\n });\n}", "title": "" }, { "docid": "928339ad29486003498ac590960704dd", "score": "0.6108354", "text": "function addAssetToFolder(frame)\n {\n // a hidden field contains the content id, retrieve it\n var assetContentId = frame.contents().find(\"[name=sys_contentid]\").val();\n if(assetContentId === undefined || assetContentId === \"\" )\n {\n $.perc_utils.alert_dialog({title: I18N.message(\"perc.ui.publish.title@Error\"), content: I18N.message(\"perc.ui.iframe.view@Unable To Create Asset\")});\n return;\n }\n\n // put the asset in the current folder\n assetContentId = \"-1-101-\" + assetContentId;\n let path = \"//Folders/$System$/Assets\" + assetPath;\n $.PercAssetController.putAssetInFolder(assetContentId, path, function(status, res)\n {\n // after putting the asset in the folder, open the finder\n // in the current folder to show the new asset\n loadAsset($.perc_paths.ASSETS_ROOT + assetPath,frame.contents().find(\"[name=sys_title]\").val(),res.AssetFolderRelationship.assetId);\n });\n }", "title": "" }, { "docid": "82b36781695f13e48af348b0d65aa4bc", "score": "0.5947261", "text": "get asset() {\n if (this.store('file:asset')) {\n return this.store('file:asset');\n }\n const asset = new asset_pipeline_1.AssetPipeline;\n this.store('file:asset', asset);\n this.assets.push(asset);\n return asset;\n }", "title": "" }, { "docid": "de4f4977d5ea9b3d504af8acc15632b2", "score": "0.5854329", "text": "function addMPDAsset(mpdFile, index = null) {\n let title = mpdFile.title;\n if (index) {\n title += \" (\" + index.toString() + \")\";\n }\n\n shakaAssets.enabledAssets.push({\n name: title, //TODO put explicit name\n manifestUri: host + mpdFile.filename,\n encoder: shakaAssets.Encoder.STREAMY,\n source: shakaAssets.Source.STREAMY,\n drm: [],\n features: [\n shakaAssets.Feature.HIGH_DEFINITION,\n shakaAssets.Feature.MP4,\n shakaAssets.Feature.SEGMENT_BASE,\n shakaAssets.Feature.SUBTITLES\n ]\n });\n}", "title": "" }, { "docid": "c3cb14ed4ce095e69fde4e006ba733b4", "score": "0.58441824", "text": "function assetInsertion (drawingList, assets) {\n\n\tfor (var asset in drawingTypes) {\n\n\t\tvar insertFunction = insert(drawingTypes[asset], drawingList);\n\t\tassets.click(asset, insertFunction);\n\n\t}\n\n}", "title": "" }, { "docid": "953fba45412b7814158e8cf8dacf9913", "score": "0.5843783", "text": "function visitAsset(asset, deps) {\n // Skip assets generated programmatically or by user (e.g. label texture)\n if (!asset._uuid) {\n return;\n }\n\n deps.push(asset._uuid);\n}", "title": "" }, { "docid": "8d70bdad87eafa60c3dffccc84f755c1", "score": "0.579156", "text": "_addToAssets() {\n var self = this;\n // this.assetsJson\n this.projectsJson.forEach(project => {\n if (project.images) {\n project.images.forEach(image => {\n self.assetsJson.push({\n \"title\" : image.title,\n \"alt\" : image.alt,\n \"mime\": image.mime,\n \"path\": \"/assets/projects/\" + project.slug + \"/images/\" + image.path,\n \"slug\": ((\"project/\" + project.slug) + \"/images/\" + image.slug)\n });\n });\n }\n });\n\n }", "title": "" }, { "docid": "af72e50d9b6d124431a761a8306598ef", "score": "0.5700406", "text": "function addAsset(type) {\n // Setting the iFrame to add a computer\n if(type === \"computer\") {\n changeIFrame(addComputerUrl);\n }\n // Setting the iFrame to add a networking device\n else if(type === \"networking\") {\n changeIFrame(addNetworkingUrl);\n }\n // Setting the iFrame to add a printer\n else if(type === \"printer\") {\n changeIFrame(addPrinterUrl);\n }\n\n // Ensuring the home button is not active\n let home = document.querySelector(\"#home\");\n home.setAttribute(\"class\", \"home\");\n\n // Setting the add button to be active\n let add = document.querySelector(\"#add-asset\");\n add.setAttribute(\"class\", \"dropbtn active\");\n\n // Ensruing the edit button is not active\n let edit = document.querySelector(\"#edit-asset\");\n edit.setAttribute(\"class\", \"dropbtn\");\n}", "title": "" }, { "docid": "6d7b17d883250def161d61eb7392517f", "score": "0.55883205", "text": "add(item) {\n if (item.attributes.type === \"gold\") return;\n this.inventory.push(item);\n }", "title": "" }, { "docid": "834f86a487f814c5939c5709e07c600b", "score": "0.5576349", "text": "createAssetDefinition(name, source) {\r\n const asset = { kind: \"asset\", name: name, source: source };\r\n this.add(asset);\r\n }", "title": "" }, { "docid": "a9200871c3ea442b6cad1d0ebd5faf89", "score": "0.5391736", "text": "function registerAsset(textpack, assetName) {\n\t\treturn new Promise(function(resolve) {\n\t\t\tvar Asset = hexo.model('Asset');\n\t\t\tvar path = (textpack.options.path + '/' + assetName).substr(hexo.base_dir.length);\n\t\t\tvar options = {\n\t\t\t\t_id: '-textpack-dynamic-/' + path,\n\t\t\t\tpath: '-textpack-dynamic-/' + path.substr((hexo.config.source_dir + \"/\").length),\n\t\t\t\tmodified: true,\n\t\t\t\trenderable: hexo.render.isRenderable(path)\n\t\t\t};\n\t\t\tAsset.save(options);\n\t\t\treturn resolve();\n\t\t});\n\t}", "title": "" }, { "docid": "af0d8d2c757fa86a18c7d41e5d130e58", "score": "0.5363969", "text": "function assets(asset) {\n return '/assets' + ('/' === asset[0] ? '' : '/') + asset + '?v=' + module.exports.version;\n }", "title": "" }, { "docid": "01232a785551199c45d7b33cdaaf27fe", "score": "0.53446317", "text": "function addNewItem(name, price, imageSource) {\n inventory.push(newItem(name, price, imageSource))\n}", "title": "" }, { "docid": "b577863e4daad8badc5692c884a0d98f", "score": "0.5315283", "text": "function AssetManager() {\n var managedAssets = {};\n var modifiedAssets = [];\n var revertedAssets = [];\n\n this.CreateAsset = function (asset) {\n window.scene.add(asset);\n var managedAsset = new ManagedAsset(asset);\n managedAssets[asset.uuid] = managedAsset;\n modifiedAssets.push(managedAsset);\n }\n\n //this should get triggered as any asset changes occur to an asset\n this.OnBeforeAlterAsset = function (asset) {\n managedAssets[asset.uuid].SaveCurrentState(asset);\n\n //Same asset being modified again (a 2nd or subsequent time)\n if (modifiedAssets.length > 0 && modifiedAssets[modifiedAssets.length - 1] == managedAssets[asset.uuid] ) {\n //TODO: do we need to do anything here?\n }\n else\n {\n modifiedAssets.push(managedAssets[asset.uuid]);\n }\n }\n\n this.UndoLast = function () {\n if (modifiedAssets.length > 0) {\n var modifiedAsset = modifiedAssets.pop();\n //Add it to the other array so that we can \"redo\"\n revertedAssets.push(modifiedAsset);\n var previousStateOfAsset = modifiedAsset.GetPreviousState();\n if (previousStateOfAsset)\n {\n previousStateOfAsset.visible = true;\n }\n else\n {\n window.scene.remove(modifiedAsset);\n }\n }\n }\n}", "title": "" }, { "docid": "602ec2fe58671e00dd09e196f6340d46", "score": "0.5284337", "text": "setAssets (state, data) {\n state.assets = []\n state.assets = data\n }", "title": "" }, { "docid": "ff3a44a93cab3218b770385a3240c009", "score": "0.52635574", "text": "addItem(index, location) {\n\t\tconst item = new ItemEdit({label: `${this.label} ${index}`, x: location.x, y: location.y, scenes: this.scenes});\n\t\titem.addJSON(this.json);\n\t\titem.origin = this.params.src;\n\t\titem.texture = this;\n\t\tif (this.frame == 'index') item.animation.createNewState(`index-${index}`, index, index);\n\t\telse if (this.frame == 'random') item.animation.randomFrames = true;\n\t\tthis.items.push(item);\n\t}", "title": "" }, { "docid": "e9763b5b4420fa097d626e2f9f076c76", "score": "0.52581084", "text": "function loadAssets() {\n\tfor (var key in ABILITIES) {\n\t\tABILITIES[key].img = new Image();\n\t\tABILITIES[key].img.src = ABILITIES[key].src;\n\t}\n}", "title": "" }, { "docid": "a758e63fc8a3d75483fd80bce178e193", "score": "0.5230177", "text": "addItem(item) {\n if(item) {\n this.items.unshift(item)\n }\n\n this.inventory()\n }", "title": "" }, { "docid": "5236c7489cc3288ac786c5820fe09767", "score": "0.5216004", "text": "function getAsset() {\r\n return asset;\r\n }", "title": "" }, { "docid": "53757ab51577a2dc3657a37694132621", "score": "0.5200768", "text": "function registerAssetType(type, klass) {\n//\tconsole.log(\"Registering asset type: \" + type + \" for class: \" + klass);\n\t_asset_types.add(type, klass);\n}", "title": "" }, { "docid": "1717d83d8af854e4366b45855821be40", "score": "0.51938206", "text": "add(path, image) {\n\t\tthis._wanted.add(path);\n\t\tlet texture = this._textures[path];\n\t\tif (texture === undefined) {\n\t\t\ttexture = create_texture(this._context, image);\n\t\t\tthis._textures[path] = texture;\n\t\t}\n\t\treturn texture;\n\t}", "title": "" }, { "docid": "9e9618b42580f9dcf55f5e6728469920", "score": "0.5181866", "text": "updateAssets(assetManager, useNewAssets){\n this.useNewAssets = useNewAssets;\n if(this.useNewAssets === true){\n this.setImage(assetManager.getAsset('assets/images/enemy.png'));\n }\n else{\n this.setImage(assetManager.getAsset('assets/images/Alien-1.png'));\n }\n }", "title": "" }, { "docid": "be664e681ba8bb9e5fd5a0487d8f059b", "score": "0.5178061", "text": "add(itemObject) {\n this.items.push(itemObject)\n }", "title": "" }, { "docid": "831aaac57cbabc9b1b1e5592ecf46304", "score": "0.51281655", "text": "function addItem(item) {\n\tstore.storage.items.push(item);\n}", "title": "" }, { "docid": "fe26cceb802adc85f93c46d9164e17b9", "score": "0.5111332", "text": "addMedia(media) {\n //Ajoute un nouveau media au tableau\n this.mediaList.push(media);\n }", "title": "" }, { "docid": "64b3de6b0b201dac33931046ddcaae2a", "score": "0.5109359", "text": "add(object, animator){\n \n this.list.push({object: object, animator: animator});\n \n }", "title": "" }, { "docid": "b47061d3fca7063365796dcccdfd68b3", "score": "0.510342", "text": "static createInstance(assetId) {\n return new Asset({assetId});\n }", "title": "" }, { "docid": "70d19d0537da3ce9298d45423c5e4f6f", "score": "0.5078863", "text": "register()\n\t{\n\t\tthis.log.debug('registering require() hooks for assets')\n\n\t\t// // a helper array for extension matching\n\t\t// const extensions = []\n\t\t//\n\t\t// // for each user specified asset type,\n\t\t// // for each file extension,\n\t\t// // create an entry in the extension matching array\n\t\t// for (let asset_type of Object.keys(this.options.assets))\n\t\t// {\n\t\t// \tconst description = this.options.assets[asset_type]\n\t\t//\t\n\t\t// \tfor (let extension of description.extensions)\n\t\t// \t{\n\t\t// \t\textensions.push([`.${extension}`, description])\n\t\t// \t}\n\t\t// }\n\t\t//\n\t\t// // registers a global require() hook which runs \n\t\t// // before the default Node.js require() logic\n\t\t// this.asset_hook = require_hacker.global_hook('webpack-asset', (path, module) =>\n\t\t// {\n\t\t// \t// for each asset file extension\n\t\t// \tfor (let extension of extensions)\n\t\t// \t{\n\t\t// \t\t// if the require()d path has this file extension\n\t\t// \t\tif (ends_with(path, extension[0]))\n\t\t// \t\t{\n\t\t// \t\t\t// then require() it using webpack-assets.json\n\t\t// \t\t\treturn this.require(require_hacker.resolve(path, module), extension[1])\n\t\t// \t\t}\n\t\t// \t}\n\t\t// })\n\n\t\t// for each user specified asset type,\n\t\t// register a require() hook for each file extension of this asset type\n\t\tfor (let asset_type of Object.keys(this.options.assets))\n\t\t{\n\t\t\tconst description = this.options.assets[asset_type]\n\t\t\t\n\t\t\tfor (let extension of description.extensions)\n\t\t\t{\n\t\t\t\tthis.register_extension(extension, description)\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\t// allows method chaining\n\t\treturn this\n\t}", "title": "" }, { "docid": "c0880a712a247f77e5df1c804c6938c1", "score": "0.5077224", "text": "addItem(name, description,imageUrl) {\n const item = {\n // Increment the currentId property\n id: this.currentId++,\n name: name,\n description: description,\n imageUrl: imageUrl\n };\n\n // Push the item to the items property\n this.items.push(item);\n }", "title": "" }, { "docid": "c0880a712a247f77e5df1c804c6938c1", "score": "0.5077224", "text": "addItem(name, description,imageUrl) {\n const item = {\n // Increment the currentId property\n id: this.currentId++,\n name: name,\n description: description,\n imageUrl: imageUrl\n };\n\n // Push the item to the items property\n this.items.push(item);\n }", "title": "" }, { "docid": "27cffba187c6fdf32a248f5f28be120e", "score": "0.50509804", "text": "add(item) {\n }", "title": "" }, { "docid": "c4af9917e412f28fa414595c357cfd1e", "score": "0.5045982", "text": "function addAssetsForLevel(level, onComplete) {\n loadImageAssets(level, onComplete);\n loadSoundAssets(level, onComplete);\n }", "title": "" }, { "docid": "0123e87f625a3b183431dc36253c4add", "score": "0.5034421", "text": "get asset() {\n return this._asset;\n }", "title": "" }, { "docid": "6479a0a8247881317408a2164d4a1e48", "score": "0.5034369", "text": "add(item) {\n if (item instanceof Resource) {\n this._addSafe(item);\n return;\n } else if (Array.isArray(item)) {\n for (var resource of item) {\n this.add(resource);\n }\n return;\n } else if (item instanceof ResourceList) {\n for (var resourceType of item._map.keys()) {\n this._ensureTypeExists(resourceType);\n for (var resource of item._map.get(resourceType)) {\n this._addSafe(resource);\n }\n }\n return;\n } else if (typeof(item) === \"string\") {\n const resourceType = pb.ResourceType[item];\n const resource = Resource.fromType(resourceType);\n this._addSafe(resource);\n return;\n } else if (typeof(item) === \"number\") {\n const resource = Resource.fromType(item);\n this._addSafe(resource);\n }\n }", "title": "" }, { "docid": "b511ee2fa1577572213d0b30f11e15b1", "score": "0.5009605", "text": "function attach(asset, path) {\n var file = URL.resolve(asset.file, path);\n var res = asset.attachments[path] = new FileResource(file);\n return Path.join(mapping, 'css', res.version, asset.name, path);\n}", "title": "" }, { "docid": "a2cced97a9d7523a04e44dbe1ef1e928", "score": "0.49990737", "text": "addItem (uid, type, coordinates, props, events, parentSectionChain) {\n this._cacheItem(uid, type, coordinates, props, events, parentSectionChain)\n }", "title": "" }, { "docid": "d1bf617dea5f04ea0126a0a02c18dc57", "score": "0.49950436", "text": "add() {\n // Early Exit: User disabled bundling\n if (bundle === false || bundle.enabled === false) return;\n // Early Exit: Running locally and `BUNDLE=true` not set\n if (process.env.NODE_ENV === 'development' && !process.env.BUNDLE) return;\n // Early Exit: File type not allowed\n const allowed = Util.isAllowedType(this.opts);\n if (!allowed) return;\n\n // Destructure options\n const { file } = this;\n\n // Make source traversable with JSDOM\n const dom = Util.jsdom.dom({src: file.src});\n const document = dom.window.document;\n \n // Find `<link>` or `<script>` tags with the `[data-bundle]` or `[bundle]` attributes\n const links = document.querySelectorAll('link[data-bundle], link[bundle]');\n const scripts = document.querySelectorAll('script[data-bundle], script[bundle]');\n this.totalAdd = links.length + scripts.length;\n \n // Early Exit: No targets found\n if (!this.totalAdd) return;\n\n // START LOGGING\n this.startLog('Finding Bundled Links and Scripts', true);\n\n // REPLACE INLINE CSS\n this.groupSrcAndInsertBundle(links, 'css');\n // REPLACE INLINE SCRIPT\n this.groupSrcAndInsertBundle(scripts, 'js');\n\n // Store updated file source\n file.src = Util.setSrc({dom});\n \n // END LOGGING\n this.endAddLog();\n }", "title": "" }, { "docid": "117af9779d0f6e0d1a6b503b25d6ca9d", "score": "0.49819687", "text": "function Asset(assets) {\n\n\t var promises = [], $url = (this.$url || Vue.url), _assets = [], promise;\n\n\t Object.keys(assets).forEach(function (type) {\n\n\t if (!Asset[type]) {\n\t return;\n\t }\n\n\t _assets = _.isArray(assets[type]) ? assets[type] : [assets[type]];\n\n\t for (var i = 0; i < _assets.length; i++) {\n\n\t if (!_assets[i]) {\n\t continue;\n\t }\n\n\t if (!cache[_assets[i]]) {\n\t cache[_assets[i]] = Asset[type]($url(_assets[i]));\n\t }\n\n\t promises.push(cache[_assets[i]]);\n\t }\n\n\t });\n\n\t return Vue.Promise.all(promises).bind(this);\n\t }", "title": "" }, { "docid": "7c0d85e94fa4ffcb5341b8b44534fcdd", "score": "0.49738646", "text": "addOBJ(resourcePath, resourceName, pos, material) {\n let that = this;\n (new THREE.OBJLoader()).load(resourcePath,\n function(object) {\n that.objects[resourceName] = object;\n object.position.copy(pos);\n object.scale.x = 0.01;\n object.scale.y = 0.01;\n object.scale.z = 0.01;\n object.traverse(function(child) {\n if (child instanceof THREE.Mesh) {\n child.material = material;\n that.clickableObjects.push(child);\n }\n });\n console.log(`adding object `, object);\n that.scene.add(object);\n }\n );\n }", "title": "" }, { "docid": "07d013aad35e78b8541a6c6400422463", "score": "0.49548313", "text": "function addItem(item){\r\n cart.push(item);\r\n }", "title": "" }, { "docid": "bb64e6c987c94fc3773239e40909a3e8", "score": "0.49347273", "text": "createAssets(assert){\r\n return axios.post(ASSET_REST_API_URL+'/create',assert);\r\n }", "title": "" }, { "docid": "56c314726709bb55e1edb7f6d6c4263e", "score": "0.49085587", "text": "set assetPath(value) {}", "title": "" }, { "docid": "664f52a71c4a7177ef7f22d55f674887", "score": "0.48992243", "text": "addItem(context, item) {\n context.commit('ADD_NEW_ITEM', item);\n }", "title": "" }, { "docid": "f10f44dc84647c82afadfdf2ebfb04ee", "score": "0.48886737", "text": "add(url, options = {}) {\n this.loader.add(url, options);\n }", "title": "" }, { "docid": "4b5007f2f11ca058b65d14218601758a", "score": "0.48864844", "text": "add(item) {\n Dispatcher.dispatch({\n actionType: ACTIONS_TYPES.ADD_STORAGE,\n item: item\n });\n }", "title": "" }, { "docid": "691c547c5a07a4eac4c37c2bae02d51a", "score": "0.48712698", "text": "set assetArr(imgFileArr) {\n this._assetArr = imgFileArr;\n }", "title": "" }, { "docid": "2e722966695c8260b1f55bc94dbf9771", "score": "0.4861278", "text": "function addLibraryEntry(entry) {\n library[entry.id] = entry\n status\n}", "title": "" }, { "docid": "256c9b27f3b0b9324082ba83fee21fa7", "score": "0.48497757", "text": "addElement(element) {\n this.scene.add(element);\n }", "title": "" }, { "docid": "ec3bd0c18269f6262e837461c629f7c1", "score": "0.48380926", "text": "addItem(object){\n this.renderItems.push(object);\n }", "title": "" }, { "docid": "5ef28423f127f596e9bb6e6cc932daaa", "score": "0.48366055", "text": "addToList(item) {\n this.items.push(item);\n }", "title": "" }, { "docid": "8a9617f67e8753a627e33be195b4d250", "score": "0.4835139", "text": "async CreateAsset(ctx, id, owner, reservedPrice, bidIncr, bidDecr) {\n const asset = {\n ID: id,\n Owner: owner,\n ReservedPrice: reservedPrice,\n BidIncrement: bidIncr,\n BidDecrement: bidDecr,\n };\n return ctx.stub.putState(id, Buffer.from(JSON.stringify(asset)));\n }", "title": "" }, { "docid": "985d274939afcaec7f56a1020e396734", "score": "0.48328984", "text": "function addItem ()\n {\n showEditItemModal(new Item()).then(\n function (item)\n {\n itemService.addItem(item).then(\n function (item)\n {\n vm.items.push(item);\n }\n );\n }\n );\n }", "title": "" }, { "docid": "6bfa78641fff511e985175a9aae4c1e5", "score": "0.48166436", "text": "function addShoot(data) {\r\n for (var i = 0; i < data.length; i++) {\r\n cat = loadImage(data[i]);\r\n console.log('assets/' + data[i])\r\n shoot[i] = cat;\r\n }\r\n}", "title": "" }, { "docid": "535899a6a0ce44bcbb32501508ed3d87", "score": "0.47960162", "text": "add(graphicObject) {\n this.components.push(graphicObject);\n }", "title": "" }, { "docid": "dc328377bd90507beaa989219c6782d6", "score": "0.47954574", "text": "addItemCreated() {\n this._addOneTo('stats-added-items');\n }", "title": "" }, { "docid": "6cd93b73d86c1425fd2f9b2f9e2a4e77", "score": "0.47790825", "text": "setNewIssuedAsset(state, asset) {\n state.newIssuedAsset = asset;\n }", "title": "" }, { "docid": "319cbac4614d3d607709814806183fc0", "score": "0.47781792", "text": "addItem(item) {\n if (typeof item === 'undefined' || item == null) {\n throw new Error('can\\'t add empty Book')\n }\n this._items.push(item);\n }", "title": "" }, { "docid": "081e353981b67cc71ffd968875db3819", "score": "0.4777884", "text": "function addItem(state, item) {\n state.items.push(item);\n}", "title": "" }, { "docid": "6f7ebbd9f59b6814b206def14e86372f", "score": "0.4772758", "text": "@action.bound\n async addToAttachments(\n user: User,\n file: File,\n downloadUrl: string,\n reference: string\n ) {\n return await UploadService.addToAttachments(\n user,\n file,\n downloadUrl,\n reference\n );\n }", "title": "" }, { "docid": "4b1b3683538af9d07696a24b9c3152f7", "score": "0.47588408", "text": "push(item) {\n this._items.push(item);\n }", "title": "" }, { "docid": "4b1b3683538af9d07696a24b9c3152f7", "score": "0.47588408", "text": "push(item) {\n this._items.push(item);\n }", "title": "" }, { "docid": "07b7185c61f11458e18ce0dee490ec3b", "score": "0.47571275", "text": "function AssetLoader()\n\t{\n\t\t// -- Private: --\n\t\tvar _ = this;\n\t\tvar root = '';\n\t\tvar assets = {};\n\t\tvar onProgress = function(){};\n\t\tvar onError = function(){};\n\t\tvar onComplete = function(){};\n\n\t\t/**\n\t\t * Run through the queued asset list and\n\t\t * load them as usable Asset instances\n\t\t */\n\t\tfunction load_assets()\n\t\t{\n\t\t\tvar images = assets.images.files || [];\n\t\t\tvar audio = assets.audio.files || [];\n\t\t\tvar _root = './' + root + '/';\n\t\t\tvar asset_count = images.length + audio.length;\n\t\t\tvar loaded = 0;\n\t\t\tvar asset_manager = new AssetManager( _root )\n\t\t\t\t.path( 'images', assets.images.folder )\n\t\t\t\t.path( 'audio', assets.audio.folder );\n\n\t\t\t/**\n\t\t\t * Temporary asset load handler callback\n\t\t\t */\n\t\t\tfunction INTERNAL_load_progress( asset )\n\t\t\t{\n\t\t\t\tasset_manager.store( asset );\n\t\t\t\tonProgress( Math.round( 100 * ( ++loaded / asset_count ) ) );\n\n\t\t\t\tif (loaded >= asset_count) {\n\t\t\t\t\t// Expose Asset Manager to the global scope\n\t\t\t\t\t// for use across any and all script files\n\t\t\t\t\tscope.Assets = asset_manager.lock();\n\t\t\t\t\tonComplete();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\timages.forEach( function( file ) {\n\t\t\t\tnew Asset( 'image' )\n\t\t\t\t\t.from( _root + assets.images.folder + '/' + file )\n\t\t\t\t\t.loaded( INTERNAL_load_progress )\n\t\t\t\t\t.fail( onError );\n\t\t\t} );\n\n\t\t\taudio.forEach( function( file ) {\n\t\t\t\tnew Asset( 'audio' )\n\t\t\t\t\t.from( _root + assets.audio.folder + '/' + file )\n\t\t\t\t\t.loaded( INTERNAL_load_progress )\n\t\t\t\t\t.fail( onError );\n\t\t\t} );\n\t\t}\n\n\t\t// -- Public: --\n\t\t/**\n\t\t * Set [root] assets directory\n\t\t */\n\t\tthis.root = function( _root )\n\t\t{\n\t\t\troot = _root;\n\t\t\treturn _;\n\t\t};\n\n\t\t/**\n\t\t * Save an Asset Manifest list to [assets]\n\t\t */\n\t\tthis.load = function( _assets )\n\t\t{\n\t\t\tassets = _assets;\n\t\t\treturn _;\n\t\t};\n\n\t\t/**\n\t\t * Set the asset load progress handler\n\t\t */\n\t\tthis.progress = function( callback )\n\t\t{\n\t\t\tonProgress = callback || onProgress;\n\t\t\treturn _;\n\t\t};\n\n\t\t/**\n\t\t * Set the asset load failure handler\n\t\t */\n\t\tthis.catch = function( callback )\n\t\t{\n\t\t\tonError = callback || onError;\n\t\t\treturn _;\n\t\t};\n\n\t\t/**\n\t\t * Set the asset list load completion\n\t\t * handler, and trigger the asset loader\n\t\t */\n\t\tthis.then = function( callback )\n\t\t{\n\t\t\tonComplete = callback || onComplete;\n\t\t\tload_assets();\n\t\t};\n\t}", "title": "" }, { "docid": "625797acdb16ccff7821c72b1ec93c1c", "score": "0.4749611", "text": "addItem($el, item, limit) {\n // Respect limit of items.\n if ($('> div', $el).length >= limit) {\n return;\n }\n\n // Add Item.\n var $img = $('<img>', {src: item.media, alt: item.title}),\n $link = $('<a>', {href: item.url, title: item.title})\n .addClass('js-img-to-bg')\n .css('background-image', 'url(' + item.media + ')')\n .append($img),\n $item = $('<div>').addClass('item').append($link);\n $el.append($item)\n }", "title": "" }, { "docid": "dfbb102ee3046f18c0988a0d965d1649", "score": "0.47426882", "text": "function attachItem(){}", "title": "" }, { "docid": "c5429b738797d93f1c6686e15327b0cd", "score": "0.47387856", "text": "function fileAdded(file)\n {\n // Prepare the temp file data for media list\n var uploadingFile = {\n id : file.uniqueIdentifier,\n file: file,\n type: 'uploading'\n };\n\n // Append it to the media list\n vm.product.images.unshift(uploadingFile);\n }", "title": "" }, { "docid": "c6547a0c2189d9a599d7e86261805e06", "score": "0.47377762", "text": "function addToolsMaterialsActivityItem(str){\n\tarrToolsMaterialsActivityDDL.push(str);\n}", "title": "" }, { "docid": "e5bedea9026190d68b9e0da755731105", "score": "0.47360504", "text": "function addLibraryItem(item) {\n item.expanded = false\n store.library.libraryItems.push(item)\n renders.removeLibrary()\n renders.updateUI()\n}", "title": "" }, { "docid": "8f51fe1489bf54ec493629ba15206683", "score": "0.4730563", "text": "function three_module_addUniform( container, uniformObject ) {\n\n\tcontainer.seq.push( uniformObject );\n\tcontainer.map[ uniformObject.id ] = uniformObject;\n\n}", "title": "" }, { "docid": "2cf41225e26c2293b8968ba697a71ae6", "score": "0.47301546", "text": "async CreateAsset(ctx, id, color, size, owner, appraisedValue) {\n const asset = {\n ID: id,\n Color: color,\n Size: size,\n Owner: owner,\n AppraisedValue: appraisedValue,\n };\n return ctx.stub.putState(id, Buffer.from(JSON.stringify(asset)));\n }", "title": "" }, { "docid": "1762c10679649a530c81c16b5f9c63d7", "score": "0.47273386", "text": "static addSprite (name)\n\t{\n\t\tthis.gameSprites.push(`sprites/${name}`);\n\t}", "title": "" }, { "docid": "4212cbd56be6d33d0ba4fd83c4d46ff0", "score": "0.47264588", "text": "addObject(object) {\n this.objects.push(object);\n }", "title": "" }, { "docid": "4212cbd56be6d33d0ba4fd83c4d46ff0", "score": "0.47264588", "text": "addObject(object) {\n this.objects.push(object);\n }", "title": "" }, { "docid": "63cf89c41e6e1c376c5e502534a454ba", "score": "0.47213545", "text": "function createAsset () {\n\t/* First, we specify the properties for your new entity:\n \n - The type property associates your entity with a collection. When the entity, \n is created, if the corresponding collection doesn't exist a new collection \n will automatically be created to hold any entities of the same type. In this\n case, we'll be creating an entity of type 'asset'\n \n Collection names are the pluralized version of the entity type,\n e.g. all entities of type book will be saved in the books collection. \n \n - Let's also specify some properties for your entity. Properties are formatted \n as key-value pairs. We've started you off with the required properties: type,\n name, path, and owner. You can add more properties as needed. */ \n var imageName='image_'+Math.round(Math.random()*100000)+'.jpg';\n\t\t\n\t\tvar properties = {\n type:'users',\n username:'assetUser', \n };\n \n /* Next, we create our asset. Notice that we are passing the dataClient to the asset. */\n dataClient.createEntity(properties, function(err, response, entity) {\n \tif (!err) {\n \t\tuser = entity;\n \t\tconsole.log(entity);\n \t} else {\n\n \t}\n }); \n}", "title": "" }, { "docid": "2b981e65f38c60d0ddf55eb324a4efaf", "score": "0.47177827", "text": "addSteal( player, item ){\n\n\t\titem = toArray(item);\n\t\tif( typeof player === \"object\" )\n\t\t\tplayer = player.id;\n\t\tif( !this.steals[player] )\n\t\t\tthis.steals[player] = [];\n\t\tthis.steals[player] = this.steals[player].concat(item);\n\n\t}", "title": "" }, { "docid": "e2baa6498597fce563a018d93232cb95", "score": "0.47170255", "text": "get Asset() {\n return this.assetName;\n }", "title": "" }, { "docid": "751a8a45530fd1cbb55e9ca869439c26", "score": "0.47113466", "text": "function addItem(resource, url) {\n $.ajax({\n type: 'POST',\n url: getApiURL(resource),\n data: JSON.stringify({ \"url\" : url, \"user\" : getResourceURI()}),\n contentType:'application/json',\n dataType: 'application/json',\n processData: false,\n });\n}", "title": "" }, { "docid": "66ac2bc480679507e9538f8261b70c4f", "score": "0.47038156", "text": "async initAsset(stub, args, thisClass) {\n if (args.length != 4) {\n throw new Error('Incorrect number of arguments. Expecting 4');\n }\n // ==== Input sanitation ====\n console.info('--- start init asset ---')\n if (args[0].lenth <= 0) {\n throw new Error('1st argument must be a non-empty string');\n }\n if (args[1].lenth <= 0) {\n throw new Error('2nd argument must be a non-empty string');\n }\n if (args[2].lenth <= 0) {\n throw new Error('3rd argument must be a non-empty string');\n }\n if (args[3].lenth <= 0) {\n throw new Error('4th argument must be a non-empty string');\n }\n let assetName = args[0];\n let assetType = args[1].toLowerCase();\n let owner = args[3].toLowerCase();\n let price = parseInt(args[2]);\n if (typeof price !== 'number') {\n throw new Error('3rd argument must be a numeric string');\n }\n\n // ==== Check if asset already exists ====\n let assetState = await stub.getState(assetName);\n if (assetState.toString()) {\n throw new Error('This asset already exists: ' + assetName);\n }\n\n // ==== Create asset object and marshal to JSON ====\n let asset = {};\n asset.docType = 'asset';\n asset.name = assetName;\n asset.assetType = assetType;\n asset.price = price;\n asset.owner = owner;\n\n // === Save asset to state ===\n await stub.putState(assetName, Buffer.from(JSON.stringify(asset)));\n let indexName = 'assetType~name'\n let assetNameIndexKey = await stub.createCompositeKey(indexName, [asset.assetType, asset.name]);\n console.info(assetNameIndexKey);\n // Save index entry to state. Only the key name is needed, no need to store a duplicate copy of the asset.\n // Note - passing a 'nil' value will effectively delete the key from state, therefore we pass null character as value\n await stub.putState(assetNameIndexKey, Buffer.from('\\u0000'));\n // ==== asset saved and indexed. Return success ====\n console.info('- end init asset');\n }", "title": "" }, { "docid": "20e8bbe0e0c04b8e7ad0fbcfc5ebe4ef", "score": "0.47021788", "text": "addItem(item){\n this.contents.push(bananas)\n}", "title": "" }, { "docid": "0c61918b1e841ec30f766f5edadcc39f", "score": "0.46987078", "text": "function addScriptToLoadList(FileURL){\r\n anArrayOfScriptsToLoad.push(FileURL);\r\n}", "title": "" }, { "docid": "a9638303deedb04a712029064fff9c81", "score": "0.46955067", "text": "addStaticAsset(src, dest, { permanent = false, exclude = [] } = {}) {\n dest = dest || path_1.relative(process.cwd(), src);\n permanent = permanent && process.env.LAYER0_DISABLE_PERMANENT_ASSETS !== 'true';\n const staticAssetDir = permanent ? this.permanentStaticAssetsDir : this.staticAssetsDir;\n const absoluteDest = path_1.join(staticAssetDir, dest);\n this.copySync(src, absoluteDest, {\n filter: file => !exclude.some(excludedFile => file.indexOf(excludedFile) >= 0),\n });\n if (fs_extra_1.existsSync(src) && fs_extra_1.lstatSync(src).isDirectory()) {\n // 'index.html' is not defined in constants, because it could very well become a parameter soon\n globby_1.default.sync(path_1.join(absoluteDest, '**', 'index.html')).forEach(indexFile => {\n const indexParentDirectory = path_1.dirname(indexFile);\n const relativeIndexFile = path_1.relative(staticAssetDir, indexFile);\n const relativeDirectory = path_1.relative(staticAssetDir, indexParentDirectory);\n this.assetAliases[relativeDirectory] = relativeIndexFile;\n });\n }\n return this;\n }", "title": "" }, { "docid": "f9e2210f4288e1606ec64dff77bbf8d1", "score": "0.4692988", "text": "add(overlayRef) {\n // Ensure that we don't get the same overlay multiple times.\n this.remove(overlayRef);\n this._attachedOverlays.push(overlayRef);\n }", "title": "" }, { "docid": "f9e2210f4288e1606ec64dff77bbf8d1", "score": "0.4692988", "text": "add(overlayRef) {\n // Ensure that we don't get the same overlay multiple times.\n this.remove(overlayRef);\n this._attachedOverlays.push(overlayRef);\n }", "title": "" }, { "docid": "71ab3b5785010b582f932a4b884dd601", "score": "0.46829075", "text": "function onAvatarAdded(uuid) {\n nameTagListManager.maybeAdd(uuid);\n}", "title": "" }, { "docid": "924c5d7534f60322e825d63836f7d81c", "score": "0.46807173", "text": "function load_assets()\n\t\t{\n\t\t\tvar images = assets.images.files || [];\n\t\t\tvar audio = assets.audio.files || [];\n\t\t\tvar _root = './' + root + '/';\n\t\t\tvar asset_count = images.length + audio.length;\n\t\t\tvar loaded = 0;\n\t\t\tvar asset_manager = new AssetManager( _root )\n\t\t\t\t.path( 'images', assets.images.folder )\n\t\t\t\t.path( 'audio', assets.audio.folder );\n\n\t\t\t/**\n\t\t\t * Temporary asset load handler callback\n\t\t\t */\n\t\t\tfunction INTERNAL_load_progress( asset )\n\t\t\t{\n\t\t\t\tasset_manager.store( asset );\n\t\t\t\tonProgress( Math.round( 100 * ( ++loaded / asset_count ) ) );\n\n\t\t\t\tif (loaded >= asset_count) {\n\t\t\t\t\t// Expose Asset Manager to the global scope\n\t\t\t\t\t// for use across any and all script files\n\t\t\t\t\tscope.Assets = asset_manager.lock();\n\t\t\t\t\tonComplete();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\timages.forEach( function( file ) {\n\t\t\t\tnew Asset( 'image' )\n\t\t\t\t\t.from( _root + assets.images.folder + '/' + file )\n\t\t\t\t\t.loaded( INTERNAL_load_progress )\n\t\t\t\t\t.fail( onError );\n\t\t\t} );\n\n\t\t\taudio.forEach( function( file ) {\n\t\t\t\tnew Asset( 'audio' )\n\t\t\t\t\t.from( _root + assets.audio.folder + '/' + file )\n\t\t\t\t\t.loaded( INTERNAL_load_progress )\n\t\t\t\t\t.fail( onError );\n\t\t\t} );\n\t\t}", "title": "" }, { "docid": "ce364fc22ffb110bc9f3c9c994b1cf64", "score": "0.46736282", "text": "addItem(newItem) {\n this.items.push(newItem);\n this.onInventoryUpdated();\n console.log(\"%c[Inventory] Added item '\" + newItem.name + \"' to inventory\", \"font-weight: bold;\");\n }", "title": "" }, { "docid": "bd0378617a782ce70aea936edcd57f02", "score": "0.46681327", "text": "addItemToList(name) {\n if (!this.products) return;\n if (!this.products[name]) throw `${name} is not a known product!`;\n let product = this.products[name];\n let sku = product.skus.data[0];\n this.lineItems.push({\n product: product.name,\n sku: sku.id,\n quantity: 1,\n });\n }", "title": "" }, { "docid": "f418d71d355b6792b6f4e43c7fec8c70", "score": "0.46625528", "text": "function setAsset(asset) {\n\n if (asset) {\n vm.previewAsset = asset;\n vm.isRemovable = !isRequired;\n vm.model = asset.documentAssetId;\n\n if (vm.updateAsset) {\n vm.asset = asset;\n }\n\n } else if (isAssetInitialized) {\n // Ignore if we are running this first time to avoid overwriting the model with a null vlaue\n vm.previewAsset = null;\n vm.isRemovable = false;\n\n if (vm.model) {\n vm.model = null;\n }\n if (vm.updateAsset) {\n vm.asset = null;\n }\n }\n\n setButtonText();\n\n isAssetInitialized = true;\n }", "title": "" }, { "docid": "bda0115f41ec6190eb27103b810252e1", "score": "0.4654999", "text": "addItem () {\r\n }", "title": "" }, { "docid": "d87afc81c7dc3c4f625cc7bdfd91b591", "score": "0.46539778", "text": "function Asset( type )\n\t{\n\t\t// -- Private: --\n\t\tvar _ = this;\n\t\tvar loaded = false;\n\t\tvar onComplete = function(){};\n\t\tvar onError = function(){};\n\n\t\t/**\n\t\t * Create a WebAudio buffer for sounds\n\t\t */\n\t\tfunction create_audio()\n\t\t{\n\t\t\tWebAudio.load( _.path.substring(2), {\n\t\t\t\tload: function( buffer ) {\n\t\t\t\t\t_.media = new AudioBuffer( buffer );\n\t\t\t\t\tload_complete();\n\t\t\t\t},\n\t\t\t\tfail: function() {\n\t\t\t\t\t_.media = -1;\n\t\t\t\t\tonError( _.path );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Check to see if the asset has already failed to load\n\t\t */\n\t\tfunction check_fail_state()\n\t\t{\n\t\t\treturn (\n\t\t\t\t( _.type === 'image' && _.media.complete && _.media.naturalWidth === 0 ) ||\n\t\t\t\t( _.type === 'audio' && _.media === -1 )\n\t\t\t);\n\t\t}\n\n\t\t/**\n\t\t * Called once Asset successfully loads\n\t\t */\n\t\tfunction load_complete()\n\t\t{\n\t\t\tloaded = true;\n\t\t\tonComplete( _ );\n\t\t}\n\n\t\t// -- Public: --\n\t\tthis.path;\n\t\tthis.type = type;\n\t\tthis.media = ( type === 'image' ? new Image() : null );\n\n\t\t/**\n\t\t * Set asset file [path]\n\t\t */\n\t\tthis.from = function( path )\n\t\t{\n\t\t\tif ( !loaded ) {\n\t\t\t\t_.path = path;\n\n\t\t\t\tif ( _.type === 'audio' ) {\n\t\t\t\t\tcreate_audio();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn _;\n\t\t};\n\n\t\t/**\n\t\t * Set asset load handler\n\t\t */\n\t\tthis.loaded = function( callback )\n\t\t{\n\t\t\tif ( !loaded ) {\n\t\t\t\tonComplete = callback;\n\n\t\t\t\tif ( _.type === 'image' ) {\n\t\t\t\t\t_.media.onload = load_complete;\n\t\t\t\t\t_.media.src = _.path;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn _;\n\t\t};\n\n\t\t/**\n\t\t * Set asset load failure handler\n\t\t */\n\t\tthis.fail = function( callback )\n\t\t{\n\t\t\tonError = callback;\n\n\t\t\tif ( check_fail_state() ) {\n\t\t\t\tonError( _.path );\n\t\t\t\treturn _;\n\t\t\t}\n\n\t\t\tif ( _.type === 'image') {\n\t\t\t\t_.media.onerror = function() {\n\t\t\t\t\tonError( _.path );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn _;\n\t\t};\n\t}", "title": "" }, { "docid": "4dbae10bd09cef11a2991c712af2c801", "score": "0.46516007", "text": "addAtivity(ativ){\r\n\t\t(this.activity).push(ativ)\r\n\t\tthis.quant++;\r\n\t}", "title": "" }, { "docid": "a7cb10c6b4550627323588ddfd4da263", "score": "0.46470347", "text": "push(element) {\n\n this._items.push(element);\n }", "title": "" }, { "docid": "5aef1e5bde3a552acaf8a7377f88559f", "score": "0.4644704", "text": "function loadAsset(folderPath, assetName, assetId)\n {\n $.PercNavigationManager.goToLocation(\n $.PercNavigationManager.VIEW_EDIT_ASSET,\n $.PercNavigationManager.getSiteName(),\n $.PercNavigationManager.getMode(),\n assetId,assetName,folderPath + \"/\" + assetName,$.PercNavigationManager.PATH_TYPE_ASSET);\n }", "title": "" }, { "docid": "4d050eca4bd7e079af703dc3c61eb76f", "score": "0.4637739", "text": "addItem(state, item) {\n state.items.push(item);\n }", "title": "" }, { "docid": "8fca23ab91fc851ebb80a44181106ba2", "score": "0.46297646", "text": "async CreateAsset(ctx, id, assetData) {\n // await ctx.stub.putState(id, Buffer.from(assetData));\n return ctx.stub.putState(id, Buffer.from(assetData));\n }", "title": "" }, { "docid": "e56d5fe6942fbcc13f6df57034f8eca9", "score": "0.46294698", "text": "addObject(obj) {\n\t\tif (!obj) return;\n\t\tif (this.#objects.includes(obj) || this.#objects.find(o => o?.name == obj.name)) {\n\t\t\tconsole.warn(`${obj.name} ${obj} already exists`);\n\t\t\treturn\n\t\t}\n\n\t\ttry {\n\t\t\tobj.init({ name: obj.name });\n\t\t\tthis._initObject(obj);\n\t\t\tthis.#objects.push(obj);\n\t\t\tthis.#observer.observe(obj);\n\t\t} catch (error) {\n\t\t\tconsole.warn('addObject:', error);\n\t\t}\n\n\t}", "title": "" }, { "docid": "1452ed5db93bdc1a0c08f0b5fa6b53df", "score": "0.4629211", "text": "function add(el) {\n const newCoords = getCoords(el);\n coords.set(el, newCoords);\n const pluginOrOptions = getOptions(el);\n if (!isEnabled(el))\n return;\n let animation;\n if (typeof pluginOrOptions !== \"function\") {\n animation = el.animate([\n { transform: \"scale(.98)\", opacity: 0 },\n { transform: \"scale(0.98)\", opacity: 0, offset: 0.5 },\n { transform: \"scale(1)\", opacity: 1 },\n ], {\n duration: pluginOrOptions.duration * 1.5,\n easing: \"ease-in\",\n });\n }\n else {\n animation = new Animation(pluginOrOptions(el, \"add\", newCoords));\n animation.play();\n }\n animations.set(el, animation);\n animation.addEventListener(\"finish\", updatePos.bind(null, el));\n}", "title": "" } ]
a33e35f30cf7cd33ce093c9bcf81055f
take the medname from the factory and pass it to the medListController
[ { "docid": "2154290c4b8f10cda0c44797cb70721c", "score": "0.59485996", "text": "function returnMedNames() {\n return medNames;\n }", "title": "" } ]
[ { "docid": "0cef66fe13c28189844b415c61994d34", "score": "0.5920554", "text": "function requestMedNames() {\n var promise = $http({\n method: 'GET',\n url: 'https://rxnav.nlm.nih.gov/REST/displaynames.json'\n }).then(function successfullCallback(response) {\n medNames = response.data.displayTermsList.term;\n }, function(error) {\n console.log(error);\n });\n return promise;\n }", "title": "" }, { "docid": "0f04653cd45cfb7b90c77b1591f58aad", "score": "0.56224924", "text": "function updateMedList(){\n return medicine;\n }", "title": "" }, { "docid": "78301b5a6f1a63976695ef024b432cea", "score": "0.54820263", "text": "function getMedication(){\n $http.post(\"getMedication.php\").sucess(function(data){\n $scope.medication = data;\n });\n }", "title": "" }, { "docid": "f288f8cd8543b9a9acdcebb614442b7d", "score": "0.5406883", "text": "assignMed(medication) {\r\n this.assignedMeds.push(medication);\r\n }", "title": "" }, { "docid": "dc663f55edf93a0b39a433be22a3dac5", "score": "0.54066485", "text": "function displayWords(storyData) { //storyData is the 'storage bin' variable that was declared in factory.js\n $scope.madLib = infoFactory.getInfo(storyData); //binding the storyData to the $scope\n console.log($scope.madLib);\n }", "title": "" }, { "docid": "175c3d3095ebab3b38b41d37d067f55e", "score": "0.5353002", "text": "function getMedListInfo(personsid) {\n var promise = $http({\n method: 'GET',\n url:'/meds/' + personsid,\n params: {\n personid: personsid\n }\n }).then(function successfulCallback(response){\n medicine = response.data;\n }, function(error){\n console.log(\"error\");\n });\n return promise;\n }", "title": "" }, { "docid": "6361cded50abfde5772222d26faa1021", "score": "0.50893795", "text": "function showPetCallback(data){\n\t\t$scope.pet = data;\n\t}", "title": "" }, { "docid": "c96b0c657036338d9e80c38e03f528c9", "score": "0.5053405", "text": "function getDealerName() {\n\t\t\tdkam_dealer_service.get_dealer_name().then(function (payload) {\n\t\t\t\tif (payload != undefined) {\n\t\t\t\t\t$scope.names = payload[dealer].data\n\t\t\t\t\tconsole.log(\"Getting Dealer name : success\")\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log(\"Getting Dealer name : Service unavailable\")\n\t\t\t\t}\n\t\t\t})\n\t\t}", "title": "" }, { "docid": "31fb00fc1536044e2ebd8725ea3fa7ce", "score": "0.5022606", "text": "function monsterName() {\n let monster = _state.monster\n let game = _state.game\n let index = 0;\n if (game.session.random < 4) {\n index = 0;\n } else if (game.session.random < 7) {\n index = 1;\n } else {\n index = 2;\n }\n monster.name = monster.names[index];\n}", "title": "" }, { "docid": "6dd63259a6ec6d33ed61d4b7b9e6b7e2", "score": "0.49571452", "text": "function MedRecord (fname, lname, medrec, medicalID, insInfo) {\n\tthis.firstName = fname;\n\tthis.lastName = lname;\n\tthis.medRecord = medrec;\n\tthis.medID = medicalID;\n\tthis.insuranceInfo = insInfo;\n}", "title": "" }, { "docid": "9a2b41683a34078f3049184e0b860050", "score": "0.49427718", "text": "removeMedFromPatient(patID, medID) {\r\n let pat;\r\n let med;\r\n if (this.doesMedExist(medID)) {\r\n med = this.listOfMedications.find(function(m) {\r\n return m.id === medID;\r\n })\r\n } else {\r\n throw 'Medicine does not exist.';\r\n }\r\n\r\n if (this.doesPatientExist(patID)) {\r\n pat = this.listOfPatients.find(function(p) {\r\n return p.id === patID;\r\n })\r\n } else {\r\n throw 'Patient does not exist.';\r\n }\r\n \r\n if (pat.isAssignedMed(med)) {\r\n pat.removeMed(med);\r\n } else {\r\n throw 'Cannot remove unassigned medicine.';\r\n } \r\n }", "title": "" }, { "docid": "68d9854aedac5b82b5ab24650f588d63", "score": "0.4920199", "text": "function getNames() {\n $scope.dataFactory.factoryGetNames().then(function () {\n $scope.getNames = $scope.dataFactory.factoryNames();\n });\n }", "title": "" }, { "docid": "68d9854aedac5b82b5ab24650f588d63", "score": "0.4920199", "text": "function getNames() {\n $scope.dataFactory.factoryGetNames().then(function () {\n $scope.getNames = $scope.dataFactory.factoryNames();\n });\n }", "title": "" }, { "docid": "5f91097514737bdde1d3b7bf942339a2", "score": "0.49163836", "text": "function displayMedication(meds) {\n med_list.innerHTML += \"<li> \" + meds + \"</li>\";\n}", "title": "" }, { "docid": "acc6a953338e529453d0465f2c8df438", "score": "0.49037817", "text": "function FilmController($routeParams,FilmFactory) {\n\tvar vm =this;\n var id = $routeParams.id;\n //more info, go to datafactory.js\n\tFilmFactory.getOneFilm(id).then(function(response){\n vm.film =response; \n //we no longer use response.data because\n //in the dataFactory.js, we has function complete(response) \n //that return response.data; already\n });\n}", "title": "" }, { "docid": "469d702187880843e4c5652fd597f10d", "score": "0.48674378", "text": "onNewMedkit(medkit){\n this.medkits[medkit.id] = medkit;\n let mk = this.physics.add.sprite(medkit.x-32, medkit.y-32, 'medkit');\n this.medkits[medkit.id].body = mk;\n mk.id = medkit.id;\n this.physics.add.overlap(this.player, mk, this.pickMedkit, null, this);\n }", "title": "" }, { "docid": "8bc8de189db323637a06f18fc7e1fa43", "score": "0.48569655", "text": "function addMedicine(med, personsid) {\n var promise = $http({\n method: 'POST',\n url:'/meds-add',\n data: {\n name: med.name,\n dosage: med.dosage,\n time: med.time,\n rxnumber: med.rxnumber,\n personid: personsid\n }\n }).then(function successfulCallback(response){\n medicine = response.data;\n }, function(error){\n console.log(\"error\");\n });\n return promise;\n return \"alert\";\n }", "title": "" }, { "docid": "5485d514c85f3bbc9dbe683f98e4ca61", "score": "0.483711", "text": "function createMedicalRecord() {\n var medicalrecord = new MedicalRecordsService();\n medicalrecord.patient = vm.patient._id;\n medicalrecord.$save(mrSuccessCallback, mrErrorCallback);\n function mrSuccessCallback(res) {\n $state.go('medicalrecords.view', {\n medicalrecordId: res._id\n });\n }\n function mrErrorCallback(res) {\n vm.error = res.data.message;\n }\n }", "title": "" }, { "docid": "2494a044335fc23b2878ce9a5bfe3d9d", "score": "0.48173416", "text": "robotName(data = '') { return state.addAction('robot/name', 'robot', 'robotName', data ); }", "title": "" }, { "docid": "0fe3fb09f6adc8ec2e7c9da1387f17d1", "score": "0.4798151", "text": "function chooseName(){\r\n const ind = Math.floor( Math.random()*lengthOfList);\r\n const name = nameList[ind];\r\n return name;\r\n}", "title": "" }, { "docid": "5eed136b12bcfed65092d44110ad56b0", "score": "0.47939757", "text": "function nameMammal(name){\n this.name = name;\n this.getInfo = function(){\n return \"The mammals name is \" + this.name;\n }\n}", "title": "" }, { "docid": "585b4d652893d962a96802bd3641ba85", "score": "0.4791486", "text": "async getDeviceName(callback) {\n\t\t// fired by the user changing a the accessory name in Home app accessory setup\n\t\t// a user can rename any box at any time\n\t\tif (this.config.debugLevel > 1) { \n\t\t\tthis.log.warn('%s: getDeviceName', this.name); \n\t\t\tthis.log.warn('%s: getDeviceName returning %s', this.name, this.name);\n\t\t}\n\t\tcallback(null, this.name);\n\t}", "title": "" }, { "docid": "446179ed63fae8e429c02f74b9187029", "score": "0.4786057", "text": "function infoController($scope,$rootScope,DBService){\n\n\n\n $scope.loged=$rootScope.loged;\n $scope.items=DBService.displayRegFormService();\n\n\n}", "title": "" }, { "docid": "5d9bffb637706812d8040cacb0838f29", "score": "0.47815043", "text": "assignMedToPatient(patID, medID) {\r\n let med;\r\n let pat;\r\n if (this.doesMedExist(medID)) {\r\n med = this.listOfMedications.find(function(m) {\r\n return m.id === medID;\r\n })\r\n } else {\r\n throw 'Medicine does not exist.';\r\n }\r\n\r\n if (this.doesPatientExist(patID)) {\r\n pat = this.listOfPatients.find(function(p) {\r\n return p.id === patID;\r\n })\r\n } else {\r\n throw 'Patient does not exist.';\r\n }\r\n \r\n if (pat.isAssignedMed(med)) {\r\n throw 'Patient is already assigned medication.';\r\n } else {\r\n pat.assignMed(med);\r\n }\r\n \r\n }", "title": "" }, { "docid": "22778c19dc989a6d3219328ce8222cea", "score": "0.47731882", "text": "constructor(merk){\n this._namamobil=merk //coba nama properti menggunakan underscore\n }", "title": "" }, { "docid": "f5debcf94a685bc17953dcbddd09c29e", "score": "0.47699448", "text": "function searchMatters(matterName, matterId) {\n if (matterName) {\n return intakeFactory.searchMatters(matterName).then(\n function (response) {\n vm.searchMatterList = response;\n if (matterId != undefined) {\n formatTypeaheadDisplay(matterId);\n }\n return response;\n }, function (error) {\n notificationService.error('Matters not loaded');\n });\n }\n }", "title": "" }, { "docid": "0782549dfca146dbacad4bdcd7ac7c3d", "score": "0.4755323", "text": "function populateMedication(req, res, next) {\n res.data.expand(req.patient);\n\n // format doctor for output\n if (res.data.doctor !== null) {\n var output = crud.filter(res.data.doctor.getData(req.patient), doctors.keys);\n output.id = res.data.doctor._id;\n res.data.doctor = output;\n }\n\n // format pharmacy for output\n if (res.data.pharmacy !== null) {\n output = crud.filter(res.data.pharmacy.getData(req.patient), pharmacies.keys);\n output.id = res.data.pharmacy._id;\n res.data.pharmacy = output;\n }\n\n next();\n}", "title": "" }, { "docid": "f8bf21d21224d7b1a272cc8780838386", "score": "0.47500333", "text": "function getDealerDetails(dealer_name) {\n\t\t\tconsole.log(\"controller dealer_name : \" + dealer_name);\n\t\t\tdkam_dealer_details.get_dealer_details(dealer_name).then(function (payload) {\n\t\t\t\tif (payload != undefined) {\n\t\t\t\t\t$scope.details = payload[dealer].data[dealer];\n\t\t\t\t\tconsole.log(\"Getting Dealer Details : success\")\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log(\"Getting Dealer Details : Service unavailable\")\n\t\t\t\t}\n\t\t\t})\n\t\t}", "title": "" }, { "docid": "657481e75d101f40236270ff0424a95f", "score": "0.47498748", "text": "removeMed(medication) {\r\n let newListOfMeds = this.assignedMeds.filter(function(m) {\r\n return m.id !== medication.id;\r\n })\r\n this.assignedMeds = newListOfMeds;\r\n }", "title": "" }, { "docid": "6c8586e67c390df423347412e4c0a892", "score": "0.47386643", "text": "getMeds() {\r\n return this.listOfMedications;\r\n }", "title": "" }, { "docid": "15d0c265a21f8abb5ef158373d4a7d28", "score": "0.47320062", "text": "function showDes(m) {\n console.log('M:showDes()-AL');\n var id = m.name.valueOf();\n displayDes(id);\n}", "title": "" }, { "docid": "6bdf05d41515d6ca12577bd780a35fde", "score": "0.47129002", "text": "constructor(name) {\n this.name = name;\n this.items = [\"blauwe sweater\", \"groene sweater\", \"paarse sweater\"];\n this.retrieveItems();\n this.createDropDownMenu();\n }", "title": "" }, { "docid": "8687e7ae80e760f78f9da8393a921395", "score": "0.46988904", "text": "function fetchName(dog) {\n namey.get(function (n) {\n dog.setName(n[0]);\n });\n}", "title": "" }, { "docid": "a88534a72c2edf21d5be153c6f65f308", "score": "0.4698831", "text": "function getPatients(index, wid) {\n $http.get(SERVER_HOST + '/api/wardPatients/' + wid)\n .then(function(response) {\n $scope.wards[index].patients = response.data.data;\n console.log($scope.wards[index].patients);\n console.log(wid);\n console.log(response.data);\n }, function(error) {\n console.log(error);\n return undefined;\n });\n }", "title": "" }, { "docid": "90b5e1e6b895146f16fb8fcdb2a70482", "score": "0.46934384", "text": "function randomNameGenerator(){\n //get a random number\n var random = Math.floor(Math.random() * Math.floor(randomNames.length - 1));\n\n //use number to fetch a name from the list\n //set the name field for the animal to be created to the fetched name\n name = randomNames[random];\n document.getElementById(\"animalNameTextBox\").value = name;\n}", "title": "" }, { "docid": "b1dfadd209aac47aeb2a93fbd07e43a0", "score": "0.4668535", "text": "function updateListName(id, newName) {\n getList(parseInt(id))\n .then(list => {\n updateList(id, newName, list.pos, list.cards);\n })\n}", "title": "" }, { "docid": "ad24e663e110980c20046de793a841dd", "score": "0.4660372", "text": "getName() {\n const params = this.getParams();\n return `${this.state.veteran.first_name} ${this.state.veteran.last_name}`;\n }", "title": "" }, { "docid": "0c7d642c432e63da3fca03e564f97fac", "score": "0.4655665", "text": "allNewspapers() {\n return this.microfilmList.map(element => { \n return {\"name\": element.newspaper};\n });\n }", "title": "" }, { "docid": "e96df41419ab56989cf0f00e8f7affc6", "score": "0.4647051", "text": "function populatePSDMadCowName(personalStrengthData, names) {\n personalStrengthData[\"madCowLift\"][0].name = names[0];\n personalStrengthData[\"madCowLift\"][1].name = names[1];\n personalStrengthData[\"madCowLift\"][2].name = names[2];\n}", "title": "" }, { "docid": "c9dc6701aaefe200424c1cf3dc2b0268", "score": "0.46452153", "text": "get renderListItemForHumanName(){\n // console.log({TAG:this.TAG,msg:\"renderListItemForHumanName\"});\n\n let showAccordion=false;\n let accordionLabel=null;\n let accordionSubLabel=null;\n let accordionIcon=null;\n let defaultNameIndex=0;\n\n\n // Search for default name to show\n if(this.defaultNameUse!== undefined){\n let useFound=false;\n for(let i=0;i<this.nameList.length && useFound===false;i++){\n if(this.nameList[i].use===this.defaultNameUse){\n defaultNameIndex=i;\n useFound=true;\n }\n }\n }\n\n let defaultHumanName=new HumanNameDt(this.nameList[defaultNameIndex]);\n\n\n //accordionLabel=(this.nameList[defaultNameIndex].given!==undefined?\" \"+this.nameList[defaultNameIndex].given.join(\" \"):'')+(this.nameList[defaultNameIndex].family!==undefined?\" \"+this.nameList[defaultNameIndex].family:'');\n accordionLabel=defaultHumanName.getGiven().length>0?defaultHumanName.getGiven().join(\" \")+\" \"+defaultHumanName.family:\"\";\n //accordionSubLabel=this.nameList[defaultNameIndex].use;\n accordionSubLabel=defaultHumanName.use;\n //accordionIcon=this.mapIconNameUse[this.nameList[defaultNameIndex].use];\n accordionIcon=this.mapIconNameUse[defaultHumanName.use];\n\n\n // RENDER ITEMS\n //if(this.showAllNames===true && this.patient.name.length>1){\n let items=[];\n\n for(let i=0;this.showAllNames===true && i<this.nameList.length;i++){\n let currentHumanName=new HumanNameDt(this.nameList[i]);\n\n let icon=this.mapIconNameUse[currentHumanName.use];\n let humanNameDt=this.nameList[i];\n let renderedName=(currentHumanName.given.length>0?currentHumanName.given.join(\" \"):'')+(\" \"+currentHumanName.getFamilyElement().value);\n let renderedUse=currentHumanName.use;\n let isNoEditing=this.editable && this.editableItemUse!==currentHumanName.use;\n\n if(i!==defaultNameIndex || this.hideDefault===false){\n if(isNoEditing===true){\n items.push(html`\n <span class=\"layout horizontal wrap\">\n <mwc-icon style=\"opacity:0.38; margin-right:32px;vertical-align:middle\">${icon}</mwc-icon>\n <span class=\"layout vertical wrap\" style=\"font-family:Roboto;\" >\n <span><span style=\"/*vertical-align: super;*/\">${renderedName}</span></span>\n <span style=\"text-transform: capitalize;opacity:0.36;font-size: smaller;align-self: flex-start;\">${renderedUse}</span>\n </span>\n <span style=\"vertical-align:middle;margin-left:auto;align-self:flex-end\">\n <span style=\"margin-left:auto\">\n <mwc-button icon=\"edit\" class=\"light\" style=\"align-self:center;\" @click=${(e)=>this.editNameHandler(currentHumanName)}></mwc-button></span>\n <mwc-button icon=\"delete\" dense class=\"light\" style=\"align-self:center;\" @click=${(e)=>this.removeNameHandler(i,currentHumanName)}></mwc-button>\n </span>\n </span>\n `);\n }else{\n items.push(html`\n <span class=\"layout vertical wrap\" style=\"font-family:Roboto;\">\n <span class=\"layout horizontal wrap\">\n <mwc-icon style=\"opacity:0.38; margin-right:32px;vertical-align:middle\">${icon}</mwc-icon>\n <mwc-textfield label=\"Name Given\" value=${currentHumanName.given.join(\" \")}\n\n @blur=${(e)=>this.editNameHandler(currentHumanName)}\n @input=${(e)=>{this.updateNameHandler(currentHumanName,\"given\",e.target.value)}} ></mwc-textfield>\n <mwc-textfield label=\"Name Family\" value=${currentHumanName.family} style=\"margin-left:56px\"\n @blur=${(e)=>this.editNameHandler(currentHumanName)}\n @input=${(e)=>this.updateNameHandler(currentHumanName,\"family\",e.target.value)}></mwc-textfield>\n\n </span>\n <span style=\"text-transform: capitalize;opacity:0.36;font-size: smaller;align-self: flex-start;\">${renderedUse}</span>\n <span class=\"layout horizontal\" style=\"margin-bottom:24px\">\n <!--<mwc-button icon=\"save\" outlined dense class=\"light\" label=\"save\" style=\"align-self:center;margin-left:auto\" @click=${(e)=>this.editNameHandler(humanNameDt)}></mwc-button>-->\n <mwc-button icon=\"close\" dense class=\"light\" style=\"align-self:center;margin-left:auto\" @click=${(e)=>this.cancelEditingNameHandler(currentHumanName)}></mwc-button>\n </span>\n </span>\n `);\n }\n }\n }\n // RENDER ROOT WC\n showAccordion=this.nameList.length>1 && this.showAllNames===true\n if(showAccordion){\n return html`<mwc-list-item style=\"font-family:Roboto;\" accordion\n icon=\"supervised_user_circle\">\n\n <span slot=\"primary-text\" style=\"font-size:x-large\">${accordionLabel}</span>\n <span slot=\"secondary-text\" style=\"text-transform:capitalize\">${accordionSubLabel}</span>\n <p slot=\"content\" style=\"margin-left:16px;margin-right:16px\">${items}</p>\n </mwc-list-item>`;\n }\n else{\n return html`<mwc-list-item style=\"font-family:Roboto;\"\n icon=\"supervised_user_circle\">\n\n <span slot=\"primary-text\" style=\"font-size:x-large;\">${accordionLabel}\n <!-- <mwc-button icon=\"add_box\" dense class=\"light\" style=\"align-self:center;margin-left:auto\" @click=${(e)=>{this.nameList.push({given:[],family:\"\",use:\"temp\"});this.totalCount++;\n }}></mwc-button> -->\n </span>\n <span slot=\"secondary-text\" style=\"text-transform:capitalize\">${accordionSubLabel}</span>\n <p slot=\"content\" style=\"margin-left:16px;margin-right:16px\">${items}</p>\n </mwc-list-item>`;\n }\n\n\n }", "title": "" }, { "docid": "5f9148592507dcfe98e1b7d200c6346f", "score": "0.46439022", "text": "function GetAllNames() {\n var Data = angularServiceRole.getName();\n Data.then(function (emp) {\n $scope.items = emp.data;\n }, function () {\n alert('Error');\n });\n }", "title": "" }, { "docid": "87aa8c5e072ff084d8da6825a66576a0", "score": "0.46298525", "text": "function getRandomName() {\n var name = getRandomItem(defaultData.names);\n var splitname = name.split(\" \");\n var result = {\n full: name,\n first: splitname[0],\n last: splitname[1],\n display: name.replace(\" \", \"_\")\n }\n return result;\n}", "title": "" }, { "docid": "c11d53cfd46e2885bd4d180409206c00", "score": "0.46206194", "text": "addMedication(name, id) {\r\n this.listOfMedications.forEach(function(m) {\r\n if (m.id === id) {\r\n throw \"Medication ID already in use.\"\r\n }\r\n })\r\n let newMedication = new Medication(name, id);\r\n this.listOfMedications.push(newMedication);\r\n }", "title": "" }, { "docid": "3714e8c63fc49f0bbc9c4b9c6287e4ee", "score": "0.46197355", "text": "function ChurnController( churnService, $mdSidenav, $mdBottomSheet, $log, $q) {\n var self = this;\n\n self.selected = null;\n self.searchOptions = [ ];\n self.toggleList = toggleList;\n self.selectOption = selectOption;\n /*\n churnService\n .loadAllOptions()\n .then( function( options ) {\n self.searchOptions = [].concat(options);\n self.selected = options[0];\n });\n */\n self.searchOptions = [\n {\n name: 'Home',\n id:0\n \n },\n {\n name: 'Search By Address',\n id:1\n \n },\n {\n name: 'Search By Zipcode',\n id:2\n },\n {\n name: 'Search By Registered Agent',\n id:3\n },\n {\n name: 'Contact',\n id:3\n }\n ];\n\n self.entitystatus = [ ];\n function toggleList() {\n var pending = $mdBottomSheet.hide() || $q.when(true);\n\n pending.then(function(){\n $mdSidenav('left').toggle();\n });\n }\n function selectOption ( option ) {\n self.selected = angular.isNumber(option) ? $scope.searchOptions[option] : option;\n self.toggleList();\n }\n }", "title": "" }, { "docid": "2cb56b96784164b5e9d39e80fb1c85b4", "score": "0.45992914", "text": "function displaySinglePatient(patientName) {\n $('#selected-patient').css('opacity', \"1\");\n $('#patient-name').html(patientName);\n\n var patient = patients[selectedPatient];\n var patientID = patient.id;\n}", "title": "" }, { "docid": "502fff170097a9c05542cde477302205", "score": "0.4596392", "text": "function meditation(data) {\r\n console.log(data);\r\n}", "title": "" }, { "docid": "f4f3fd0aa3933632cb0d42bc90df1408", "score": "0.4578359", "text": "function getMovieDescription (imdbID){\n var searchString = \"\"; //ensures that an empty string is passed for movieName, when we call the getMovieInfo factory\n \n // grabs the OMDB API response to our HTTP GET request, so we can display the movie details to the details view\n movieInfoFactory.getOMDBResponse(imdbID, searchString).then( \n \t\tfunction(response) { \n \n vmDetails.movieDetails = response.data; //binds the OMDB API GET request response to the movie details view\n },\n\n \t\tfunction(error){ //creates toastr error messages based on factory error messages\n toastr.error('There was an error'); \n\t\t\t }\n );\n \n }", "title": "" }, { "docid": "188cb5502c6bae6b14d1a3c6cf0015fd", "score": "0.45757505", "text": "get dname() {\n return this.doctorRegister.get('name');\n }", "title": "" }, { "docid": "204d38179d172f9c4a2f7cff7f2b13b7", "score": "0.4575551", "text": "function afterQuery(err, medData) {\r\n if(err) console.log(err);\r\n \tconsole.log(medData[0]);\r\n res.render('rxDescription',medData[0]);\r\n }", "title": "" }, { "docid": "d73374d19dbff99b1ecf10eb8e3fc96f", "score": "0.45734984", "text": "listPage() {\n let data;\n if (helpers.htmlElement('.sort input').checked) {\n data = collections.sort()\n } else {\n data = collections.map()\n }\n\n const directives = {\n displayName: {\n // Some names have a space at the end. The replace removes that space so the won't be an extra - at the end of the string when the spaces are replaced with -\n href(params) {\n return \"#memes/\" + this.href;\n }\n }\n }\n\n Transparency.render(document.getElementById('memeslist'), data, directives);\n }", "title": "" }, { "docid": "14bbf16ed06308d8e656841b9c09a43a", "score": "0.4571286", "text": "function displayNames() {\n results.append(names1);\n cardContent.append(results);\n campCard.append(cardContent);\n $(\"#grounds-list\").append(campCard);\n }", "title": "" }, { "docid": "6a177049cb3ef86fcac4a821657e15b2", "score": "0.45705673", "text": "setName(namePicked) {\n this.name = namePicked;\n }", "title": "" }, { "docid": "535da614cd01258238dbf3601970b185", "score": "0.45685998", "text": "function displayName(data) {\n var myName = data.name;\n console.log(data);\n $('p').html(myName);\n }", "title": "" }, { "docid": "bc3f03850f10c76c81f27bb23330f3bc", "score": "0.4560632", "text": "function deleteMedicine(medId, personsid) {\n var promise = $http({\n method: 'DELETE',\n url:'/meds-delete/' + medId + \"/\" + personsid,\n }).then(function successfulCallback(response){\n medicine = response.data;\n }, function(error){\n console.log(\"error\");\n });\n return promise;\n }", "title": "" }, { "docid": "5f3a8969ea98d8624740c31aa21f7b5e", "score": "0.45544508", "text": "@action\n addList(name, disc) {\n this.lists.push(\n {\n id:Math.floor(Math.random() * 10),\n name: name,\n description: disc\n });\n }", "title": "" }, { "docid": "99f186a71e59187d7ea4b8a28c5ff859", "score": "0.45486078", "text": "function addMedicament( name, price, quantity ) {\n \tvar medicament = {\n name: name,\n price: price,\n quantity: quantity\n };\n\n var request = $http({\n method: \"post\",\n url: root_url + \"medicament\",\n params: {\n action: \"add\"\n },\n data: JSON.stringify(medicament)\n });\n return( request.then( handleSuccess, handleError ) );\n }", "title": "" }, { "docid": "fac75e1fba71fc3ec9b034bc415f42e5", "score": "0.4540813", "text": "async showName(req, res){\n try {\n // Retorna caso nao contenha parametro na url para pesquisar o artigo\n if(!req.params.id){\n return res.status(400).send({error: 'A pesquisa deve possuir parâmetro para a busca.' })\n }\n // Procura artigos pelo nome fornecido na url\n const article = await RegistrationArticle.find({title: req.params.id})\n\n // Caso nao exista um artigo com o parametro fornecido\n if(!article){\n return res.status(400).send({error: 'Não existe resultados para a busca com este parametro.' })\n }\n // Caso nao encontre nenhum artigo\n if(article.length == 0){\n return res.status(400).send({error: 'Artigo não encontrado.' })\n }\n\n return res.json(article);\n\n } catch (error) {\n\n return res.status(400).send({error: 'Erro ao listar artigo.' })\n\n }\n\n }", "title": "" }, { "docid": "9e30a6d63a994c6694321be406f31595", "score": "0.45404565", "text": "function updateDeviceName() {\n deviceNameElement.innerText = app.model.getName();\n }", "title": "" }, { "docid": "d16ef73b9cd5b9ba9396482f8c87c699", "score": "0.4538148", "text": "function name(givenName_, middleName_, familyName_, familyName2_, voided_, uuId_) {\n var modelDefinition = this;\n\n //initialize private members\n var _givenName = givenName_? givenName_: '';\n var _middleName = middleName_ ? middleName_: '';\n var _familyName = familyName_ ? familyName_: '';\n var _familyName2 = familyName2_ ? familyName2_: '';\n var _voided = voided_ ? voided_: false;\n var _uuId = uuId_ ? uuId_: '';\n\n\n modelDefinition.givenName = function(value){\n if(angular.isDefined(value)){\n _givenName = value;\n }\n else{\n return _givenName;\n }\n };\n\n modelDefinition.middleName = function(value){\n if(angular.isDefined(value)){\n _middleName = value;\n }\n else{\n return _middleName;\n }\n };\n\n modelDefinition.familyName = function(value){\n if(angular.isDefined(value)){\n _familyName = value;\n }\n else{\n return _familyName;\n }\n };\n\n modelDefinition.familyName2 = function(value){\n if(angular.isDefined(value)){\n _familyName2 = value;\n }\n else{\n return _familyName2;\n }\n };\n\n modelDefinition.voided = function(value){\n if(angular.isDefined(value)){\n _voided = value;\n }\n else{\n return _voided;\n }\n };\n\n modelDefinition.uuId = function(value){\n if(angular.isDefined(value)){\n _uuId = value;\n }\n else{\n return _uuId;\n }\n };\n\n modelDefinition.openmrsModel = function(value){\n return {givenName:_givenName,\n middleName:_middleName,\n familyName:_familyName,\n familyName2:_familyName2,\n voided:_voided,\n uuId:_uuId};\n };\n }", "title": "" }, { "docid": "c2ac5aab59370f69324a019132306445", "score": "0.4534495", "text": "function DirectorsService($q,tmdbService){\n var directorsList,\n favList = [ 'Quentin Tarantino',\n 'Stanley Kubrick',\n 'Hayao Miyazaki',\n 'Park Chan Wook',\n 'Terry Gilliam',\n '김기덕', // Kim Ki-Duk, had to use korean because there was another director with the same name\n 'Danny Boyle',\n 'Christopher Nolan',\n 'Wes Anderson'];\n\n\n function getDirectorByName(name){\n var def = $q.defer();\n\n // call to tmdb to get director's ID\n tmdbService.searchPerson(name).then(function(firstData){\n\n // call to tmdb to get the rest of the data\n tmdbService.person(firstData.id).then(function(secondData){\n\n def.resolve( angular.merge(firstData, secondData) );\n\n });\n\n });\n\n return def.promise;\n }\n // we return the public API\n return {\n loadAllDirectors : function() {\n //if we already have directorsList we return it\n if(directorsList) return $q.when(directorsList);\n else { \n // transform name list to promises\n var promises = favList.map(function(name){\n return getDirectorByName(name);\n });\n\n var allPromises = $q.all(promises);\n\n // once all promises are ready, we set directorsList\n allPromises.then(function(list){\n directorsList = list;\n })\n\n return allPromises;\n }\n },\n getDetails : function(index) {\n if(directorsList) return $q.when(directorsList[index]);\n else return getDirectorByName(favList[index]);\n },\n };\n }", "title": "" }, { "docid": "d8fe7e11ed97048348c4d65084872f17", "score": "0.45337126", "text": "function registerShowMgmt() {\n\n var showMgr = $('.show-manage-control');//director\n //var showMgr = $('.show-manage-select');//director\n\n if (showMgr.length == 1) {\n newShowListControls(showMgr);\n }\n}", "title": "" }, { "docid": "3a423af615af54351629302ec5b1288c", "score": "0.45326266", "text": "function pullForm() {\n\tconst humanAttr = ['name', 'weight', 'feet', 'inches', 'diet'];\n\tlet humanEl = humanAttr.map((stat) => {\n\t\treturn document.getElementById(stat).value;\n\t});\n\thuman = new Human(...humanEl);\n}", "title": "" }, { "docid": "11a9b69ec6095263a4782d03d433479d", "score": "0.45224538", "text": "function renderNewWorkoutMuscleName(muscle){\n //make span for the name \n const muscleSelect = newElement('span'); \n addClass(muscleSelect, 'newWorkout__muscle')\n muscleSelect.innerText = muscle.name;\n muscleSelect.dataset.id = muscle.id; \n // add on click to toggle 'selected' modifier \n muscleSelect.addEventListener('click',function(e){\n e.target.classList.toggle('newWorkout__muscle--selected')\n })\n return muscleSelect;\n}", "title": "" }, { "docid": "c47b355f170b974de3dcdb549729f0a0", "score": "0.45221663", "text": "doesMedExist(medID) {\r\n return this.listOfMedications.some(function(m) {\r\n return m.id === medID;\r\n })\r\n }", "title": "" }, { "docid": "b90a5ea2a7825ae1b25455be4386e400", "score": "0.452042", "text": "function films(){\n const requestData = JSON.parse(this.responseText);\n const theFilm = document.createElement('li');\n theFilm.innerHTML = requestData.title;\n container.appendChild(theFilm);\n }", "title": "" }, { "docid": "075494c2d39679539c9592971bb7a6d8", "score": "0.45148504", "text": "function setMedicalInfo(medicalData, intakeId, index) {\n var intake_Medical = angular.copy(medicalData);\n var medicalrecordinfo = [];\n var intakeMedicalProviderList = [];\n if (angular.isDefined(intake_Medical.Treatment.insuranceProviderList)) {\n _.forEach(intake_Medical.Treatment.insuranceProviderList, function (currentItem) {\n // if (utils.isNotEmptyVal(currentItem.name)) {\n // medicalrecordinfo.push({ \"contactId\": currentItem.name.contact_id });\n // }\n var obj = {};\n obj.intakeMedicalRecordId = angular.isDefined(currentItem.intakeMedicalRecordId) ? currentItem.intakeMedicalRecordId : '',\n obj.serviceStartDate = angular.isDefined(currentItem.serviceStartDate) ? utils.isNotEmptyVal(currentItem.serviceStartDate) ? moment(currentItem.serviceStartDate).unix() : '' : '',\n obj.serviceEndDate = angular.isDefined(currentItem.serviceEndDate) ? utils.isNotEmptyVal(currentItem.serviceEndDate) ? moment(currentItem.serviceEndDate).unix() : '' : '',\n obj.treatmentType = angular.isDefined(currentItem.treatmentType) ? utils.isNotEmptyVal(currentItem.treatmentType) ? currentItem.treatmentType : '' : '',\n obj.isDeleted = angular.isDefined(currentItem.isDeleted) ? utils.isEmptyVal(currentItem.isDeleted) ? 0 : currentItem.isDeleted : 0,\n obj.medicalProviders = {\n \"contactId\": angular.isDefined(currentItem.name) && (currentItem.name != null) ? parseInt(currentItem.name.contact_id) : '',\n },\n obj.physician = {\n \"contactId\": angular.isDefined(currentItem.physicianId) && (currentItem.physicianId != null) ? parseInt(currentItem.physicianId.contact_id) : '',\n }\n if (obj.treatmentType == \"\" && obj.serviceEndDate == \"\" && obj.serviceEndDate == \"\" && obj.medicalProviders.contactId == \"\" && obj.physician.contactId == \"\") {\n\n } else {\n intakeMedicalProviderList.push(obj);\n }\n\n\n\n }\n )\n }\n\n var medicalRecord = {\n intakeId: intakeId,\n // intakeMedicalRecordId: intake_Medical.Treatment.intakeMedicalRecordId,\n // serviceStartDate: angular.isDefined(intake_Medical.Treatment) ? utils.isNotEmptyVal(intake_Medical.Treatment.serviceStartDate) ? moment(intake_Medical.Treatment.serviceStartDate).unix() : '' : '',\n // serviceEndDate: angular.isDefined(intake_Medical.Treatment) ? utils.isNotEmptyVal(intake_Medical.Treatment.serviceEndDate) ? moment(intake_Medical.Treatment.serviceEndDate).unix() : '' : '',\n // treatmentType: angular.isDefined(intake_Medical.Treatment) ? utils.isEmptyVal(intake_Medical.Treatment.treatmentType) ? '' : intake_Medical.Treatment.treatmentType : '',\n medicalRecordComment: \"\",\n // isDeleted: angular.isDefined(intake_Medical.Treatment) ? utils.isEmptyVal(intake_Medical.Treatment.isDeleted) ? 0 : intake_Medical.Treatment.isDeleted : 0,\n // medicalProviders: medicalrecordinfo,\n intakeMedicalProviders: intakeMedicalProviderList,\n // physician: angular.isDefined(intake_Medical.Treatment.physicianId) && (intake_Medical.Treatment.physicianId != null) ? { \"contactId\": intake_Medical.Treatment.physicianId.contact_id } : {},\n partyRole: \"\",\n recordDocumentId: \"\",\n createdBy: \"\",\n createdDate: \"\",\n modifiedBy: \"\",\n modifiedDate: \"\",\n }\n\n if (intake_Medical.intakePlaintiffId) {\n medicalRecord.associatedPartyId = intake_Medical.intakePlaintiffId;\n }\n return medicalRecord;\n }", "title": "" }, { "docid": "eb99d4167f0dd5026dfbcf903ffb8a5c", "score": "0.45126846", "text": "function ControllerFactory(resourceName, options, extras) {\r\n\treturn function($scope, $rootScope, $http, $routeParams, $location, Popup, H, M, S, R) {\r\n\t\t//Get resource by name. Usually it would be you API i.e. generated magically from your database table.\r\n\r\n\t\t$scope.resourceName = resourceName;\r\n\t\tvar Resource = H.R.get(resourceName);\r\n\r\n\t\t$http.get(S.baseUrl + '/metadata/table?id=' + resourceName).then(function(r) {\r\n\t\t\t$scope.metadata = r.data;\r\n\t\t\t$scope.buildSingleHeaders();\r\n \r\n\t\t\tsetTimeout(function(){\r\n\t\t\t\t$scope.data.onuploadCallbacks = []\r\n\t\t\t\t$scope.data.singleKeys.forEach(function(i){\r\n\t\t\t\t\tif((i.endsWith('_file') || i.endsWith('_image') || i.endsWith('_photo') || i.endsWith('_video') || i.endsWith('_sound') || i.endsWith('_music') || i.endsWith('_audio') || i.endsWith('_attachment') || i.endsWith('file') || i.endsWith('attachment') || i.endsWith('image'))){\r\n\t\t\t\t \t$scope.data.onuploadCallbacks[i] = function(r){\r\n\t\t\t\t\t \t$scope.data.single[i] = r.data.file;\r\n\t\t\t\t\t\t}\r\n\t\t\t \t}\r\n\r\n\t\t\t\t});\t\r\n\t\t\t}, 300);\r\n \r\n\t\t}, function(e) {});\r\n\r\n\t\t//Scope variables\r\n\t\t$scope.data = {};\r\n\t\t$scope.data.single = new Resource();\r\n\t\t$scope.data.list = [];\r\n\t\t$scope.data.limit = 10;\r\n\t\t$scope.data.currentPage = 1;\r\n\t\t$scope.data.pages = [];\r\n\t\t$scope.errors = [];\r\n\t\t$scope.MODES = {\r\n\t\t\t'view': 'view',\r\n\t\t\t'edit': 'edit',\r\n\t\t\t'add': 'add'\r\n\t\t};\r\n\t\t$scope.mode = $scope.MODES.view;\r\n\t\t$scope.locked = true;\r\n\t\t$scope.forms = {};\r\n\t\t$scope.H = H;\r\n\t\t$scope.M = M;\r\n $scope.templates = {};\r\n \r\n $scope.data.permissions = H.S.defaultPermissions;\r\n\r\n\t\t//Set currentRoute\r\n\t\t$scope.currentRoute = (function() {\r\n\t\t\tvar route = $location.path().substring(1);\r\n\t\t\tvar slash = route.indexOf('/');\r\n\t\t\tif (slash > -1) {\r\n\t\t\t\troute = route.substring(0, slash);\r\n\t\t\t}\r\n\t\t\treturn route;\r\n\t\t})();\r\n\r\n\t\t$scope.currentRouteHref = \"#!\" + $scope.currentRoute;\r\n\t\t$scope.newRouteHref = \"#!\" + $scope.currentRoute + \"/new\";\r\n\t\t$scope.editRouteHref = \"#!\" + $scope.currentRoute + \"/:id\";\r\n\r\n\t\t//Default error handler\r\n\t\tvar errorHandler = function(error) {\r\n\t\t\tif (error && error.status) {\r\n\t\t\t\tswitch (error.status) {\r\n\t\t\t\t\tcase 404:\r\n\t\t\t\t\t\t$scope.errors.push({\r\n\t\t\t\t\t\t\tmessage: H.MESSAGES.E404\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 422:\r\n\t\t\t\t\t\t$scope.errors.push({\r\n\t\t\t\t\t\t\tmessage: H.MESSAGES.E422\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 405:\r\n\t\t\t\t\t\t$scope.errors.push({\r\n\t\t\t\t\t\t\tmessage: H.MESSAGES.E405\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 400:\r\n\t\t\t\t\t\t$scope.errors.push({\r\n\t\t\t\t\t\t\tmessage: H.MESSAGES.E400\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 500:\r\n\t\t\t\t\t\t$scope.errors.push({\r\n\t\t\t\t\t\t\tmessage: H.MESSAGES.E500\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 401:\r\n\t\t\t\t\t\t$rootScope.$emit('loginRequired');\r\n\t\t\t\t\tcase 403:\r\n\t\t\t\t\t\t$location.path('unauthorized');\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t$scope.errors.push({\r\n\t\t\t\t\t\t\tmessage: H.MESSAGES.E500\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t//Initializa new single objetc\r\n\t\t$scope.initSingle = function() {\r\n\t\t\t$scope.data.single = new Resource();\r\n $scope.data.selectedForeignKeys = [];\r\n\t\t\t//$scope.buildSingleHeaders();\r\n\t\t};\r\n\r\n\t\t//Get all rows from your API/table. Provide a query filter in case you want reduced dataset.\r\n\t\t$scope.query = function(q, callback) {\r\n\t\t\tif (!q) {\r\n\t\t\t\tq = {};\r\n\t\t\t}\r\n\t\t\tResource.query(q, function(result) {\r\n\t\t\t\tif (result) {\r\n\t\t\t\t\t$scope.data.list = result;\r\n\t\t\t\t}\r\n\t\t\t\tif (callback) {\r\n\t\t\t\t\tcallback(result);\r\n\t\t\t\t}\r\n\t\t\t}, function(error) {\r\n\t\t\t\terrorHandler(error);\r\n\t\t\t\tif (callback) {\r\n\t\t\t\t\tcallback(error);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t};\r\n\r\n\t\t//Get specific record\r\n\t\t$scope.count = function(query, callback) {\r\n\t\t\tquery = query || {\r\n\t\t\t\tcount: true\r\n\t\t\t};\r\n\t\t\tif (!query['count']) query['count'] = true;\r\n\t\t\tResource.query(query, function(result) {\r\n\t\t\t\t$scope.data.records = result[0].count;\r\n\t\t\t\tif (callback) {\r\n\t\t\t\t\tcallback(result);\r\n\t\t\t\t}\r\n\t\t\t}, function(error) {\r\n\t\t\t\terrorHandler(error);\r\n\t\t\t\tif (callback) {\r\n\t\t\t\t\tcallback(error);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t};\r\n\r\n\r\n\t\t//Get specific record\r\n\t\t$scope.get = function(id, callback) {\r\n\t\t\tResource.get({\r\n\t\t\t\tid: id\r\n\t\t\t}, function(result) {\r\n\t\t\t\t$scope.data.single = result;\r\n\t\t\t\t//$scope.buildSingleHeaders();\r\n\t\t\t\tif (callback) {\r\n\t\t\t\t\tcallback(result);\r\n\t\t\t\t}\r\n\t\t\t}, function(error) {\r\n\t\t\t\terrorHandler(error);\r\n\t\t\t\tif (callback) {\r\n\t\t\t\t\tcallback(error);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t};\r\n\r\n\t\t//Delete specific record\r\n\t\t$scope.delete = function(obj, callback) {\r\n\t\t\tif (obj && obj.$delete) {\r\n\t\t\t\tif (S.legacyMode) {\r\n\t\t\t\t\t$http.post(S.baseUrl + \"/\" + resourceName + \"/delete/\", obj).then(function(r) {\r\n\t\t\t\t\t\tif (callback && r.data) {\r\n\t\t\t\t\t\t\tcallback(r.data);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}, function(e) {\r\n\t\t\t\t\t\terrorHandler(e);\r\n\t\t\t\t\t\tif (callback) {\r\n\t\t\t\t\t\t\tcallback(e);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t} else {\r\n\t\t\t\t\tobj.$delete(function(r) {\r\n\t\t\t\t\t\tif (callback) {\r\n\t\t\t\t\t\t\tcallback(r);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}, function(e) {\r\n\t\t\t\t\t\terrorHandler(e);\r\n\t\t\t\t\t\tif (callback) {\r\n\t\t\t\t\t\t\tcallback(e);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if (!isNaN(obj)) {\r\n\t\t\t\t$scope.get(obj, function(result) {\r\n\t\t\t\t\tif (result && result.$delete) {\r\n\t\t\t\t\t\tresult.$delete();\r\n\t\t\t\t\t\tif (callback) {\r\n\t\t\t\t\t\t\tcallback();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t$scope.deleteMany = function(resource, obj, callback) {\r\n\t\t\tif (obj) {\r\n\t\t\t\tvar r = resource || resourceName;\r\n\t\t\t\tvar url = H.SETTINGS.baseUrl + \"/\" + r + \"/\";\r\n\t\t\t\tif (H.S.legacyMode) url = url + \"delete/\";\r\n\t\t\t\tif (Array.isArray(obj)) {\r\n\t\t\t\t\turl = url + \"?id=\" + JSON.stringify(obj);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (obj.id) {\r\n\t\t\t\t\t\turl = url + obj.id;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (H.S.legacyMode) {\r\n\t\t\t\t\treturn $http.post(url, []).then(function(r) {\r\n\t\t\t\t\t\tif (callback) {\r\n\t\t\t\t\t\t\tcallback(r.data);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn r.data;\r\n\t\t\t\t\t}, function(e) {\r\n\t\t\t\t\t\terrorHandler(e);\r\n\t\t\t\t\t\tif (callback) {\r\n\t\t\t\t\t\t\tcallback(e.data);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn e.data;\r\n\t\t\t\t\t});\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn $http.delete(url).then(function(r) {\r\n\t\t\t\t\t\tif (callback) {\r\n\t\t\t\t\t\t\tcallback(r.data);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn r.data;\r\n\t\t\t\t\t}, function(e) {\r\n\t\t\t\t\t\terrorHandler(e);\r\n\t\t\t\t\t\tif (callback) {\r\n\t\t\t\t\t\t\tcallback(e.data);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn e.data;\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t//Save a record\r\n\t\t$scope.save = function(obj, callback) {\r\n\t\t\tif (obj && obj.$save) {\r\n\t\t\t\tvar promise = obj.$save();\r\n\t\t\t\tpromise.then(function(r) {\r\n\t\t\t\t\tif (callback) {\r\n\t\t\t\t\t\tcallback(r);\r\n\t\t\t\t\t}\r\n\t\t\t\t}, function(e) {\r\n\t\t\t\t\terrorHandler(e);\r\n\t\t\t\t\tif (callback) {\r\n\t\t\t\t\t\tcallback(e);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t} else if ($scope.data.single) {\r\n\t\t\t\tvar promise = $scope.data.single.$save();\r\n\t\t\t\tpromise.then(function(r) {\r\n\t\t\t\t\tif (callback) {\r\n\t\t\t\t\t\tcallback(r);\r\n\t\t\t\t\t}\r\n\t\t\t\t}, function(e) {\r\n\t\t\t\t\terrorHandler(e);\r\n\t\t\t\t\tif (callback) {\r\n\t\t\t\t\t\tcallback(e);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t$scope.post = function(resource, arr, callback) {\r\n\t\t\tvar r = resource || resourceName;\r\n\t\t\tvar url = H.SETTINGS.baseUrl + \"/\" + r;\r\n\t\t\tif (arr) {\r\n\t\t\t\tif (H.SETTINGS.enableSaaS) {\r\n\t\t\t\t\tarr.map(function(p) {\r\n\t\t\t\t\t\tif (!p.secret) p.secret = $rootScope.currentUser.secret;\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\treturn $http.post(url, arr)\r\n\t\t\t\t\t.then((function(data, status, headers, config) {\r\n\t\t\t\t\t\tif (callback) {\r\n\t\t\t\t\t\t\tcallback(data.data);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn data.data;\r\n\t\t\t\t\t}), (function(e) {\r\n\t\t\t\t\t\terrorHandler(e);\r\n\t\t\t\t\t\tif (callback) {\r\n\t\t\t\t\t\t\tcallback(e.data);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn e.data;\r\n\t\t\t\t\t}));\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t$scope.update = function(obj, callback) {\r\n\t\t\tvar url = H.SETTINGS.baseUrl + \"/\" + resourceName;\r\n\r\n\t\t\tif (H.S.legacyMode) {\r\n\t\t\t\treturn $http.post(url + \"/update\", obj)\r\n\t\t\t\t\t.then((function(data, status, headers, config) {\r\n\t\t\t\t\t\tif (callback) {\r\n\t\t\t\t\t\t\tcallback(data.data);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn data.data;\r\n\t\t\t\t\t}), (function(e) {\r\n\t\t\t\t\t\terrorHandler(e);\r\n\t\t\t\t\t\tif (callback) {\r\n\t\t\t\t\t\t\tcallback(e.data);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn e.data;\r\n\t\t\t\t\t}));\r\n\t\t\t} else {\r\n\t\t\t\treturn $http.put(url, obj)\r\n\t\t\t\t\t.then((function(data, status, headers, config) {\r\n\t\t\t\t\t\tif (callback) {\r\n\t\t\t\t\t\t\tcallback(data.data);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn data.data;\r\n\t\t\t\t\t}), (function(e) {\r\n\t\t\t\t\t\terrorHandler(e.data);\r\n\t\t\t\t\t\tif (callback) {\r\n\t\t\t\t\t\t\tcallback(e.data);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn e.data;\r\n\t\t\t\t\t}));\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\t//Clear errors\r\n\t\t$scope.clearErrors = function() {\r\n\t\t\t$scope.errors = [];\r\n\t\t};\r\n\r\n\t\t//Refresh data\r\n\t\t$scope.refreshData = function() {\r\n\t\t\t$scope.listAll();\r\n\t\t};\r\n \r\n\t\t$scope.data.sortCache = {};\r\n \r\n\t\t$scope.applySort = function(h){\r\n\t\t\t$scope.data.queryOptions = $scope.data.queryOptions || {};\r\n\t\t\t$scope.data.viewOptions = $scope.data.viewOptions || {};\r\n\t\t\t$scope.data.viewOptions.rawData = $scope.data.viewOptions.rawDataTemp;\r\n\t\t\t$scope.data.queryOptions.orderBy = h;\r\n\t\t\tif($scope.data.sortCache[h] && $scope.data.sortCache[h] == \"asc\"){\r\n\t\t\t\t$scope.data.sortCache[h] = \"desc\";\r\n\t\t\t} else {\r\n\t\t\t\t$scope.data.sortCache[h] = \"asc\";\r\n\t\t\t}\r\n\t\t\tvar orderDirections = { \"asc\" : { title: \"Ascending\", key: \"asc\"}, \"desc\": { title: \"Descending\", key: \"desc\"}};\r\n\t\t\t$scope.data.queryOptions.orderDirection = orderDirections[$scope.data.sortCache[h]];\r\n\t\t\t$scope.refreshData();\r\n\t\t}\r\n \r\n\t\t$scope.applyOptions = function(){\r\n\t\t\t$scope.data.viewOptions = $scope.data.viewOptions || {};\r\n\t\t\t$scope.data.viewOptions.rawData = $scope.data.viewOptions.rawDataTemp;\r\n\t\t\t$scope.refreshData();\r\n\t\t}\r\n \r\n\t\t$scope.setActive = function(i) {\r\n\t\t\treturn ($rootScope.currentPage == i) ? 'active' : 'waves-effect';\r\n\t\t};\r\n\r\n\t\t$scope.mergeQueryOptions = function(query){\r\n\t\t\tif(query && $scope.data.queryOptions){\r\n\t\t\t\tif($scope.data.queryOptions.searchField && $scope.data.queryOptions.search){\r\n\t\t\t\t\tquery[$scope.data.queryOptions.searchField + '[in]'] = $scope.data.queryOptions.search;\r\n\t\t\t\t}\r\n\t\t\t\tif($scope.data.queryOptions.orderBy){\r\n\t\t\t\t\tquery.order = $scope.data.queryOptions.orderBy; \r\n\t\t\t\t}\r\n\t\t\t\tif($scope.data.queryOptions.orderDirection && $scope.data.queryOptions.orderDirection.key && ['asc', 'desc'].indexOf($scope.data.queryOptions.orderDirection.key) > -1){\r\n\t\t\t\t\tquery.orderType = $scope.data.queryOptions.orderDirection.key; \r\n\t\t\t\t}\r\n\t\t\t\tif($scope.data.queryOptions.limit){\r\n\t\t\t\t\t$scope.data.limit = $scope.data.queryOptions.limit;\r\n\t\t\t\t} \r\n\t\t\t}\r\n\t\t\treturn query;\r\n\t\t\t\r\n\t\t}\r\n \r\n\t\t//Load all entries on initialization\r\n\t\t$scope.listAll = async function(currentPage) {\r\n\t\t\tif (!$scope.beforeLoadAll) $scope.beforeLoadAll = async function(query) {\r\n\t\t\t\treturn query;\r\n\t\t\t};\r\n\t\t\tvar countQueryParam = {\r\n\t\t\t\tcount: false\r\n\t\t\t};\r\n countQueryParam = $scope.mergeQueryOptions(countQueryParam); \r\n\t\t\tvar countQuery = await $scope.beforeLoadAll(countQueryParam) || countQueryParam;\r\n\r\n\t\t\t//$scope.loading = true;\r\n\t\t\t$scope.count(countQuery, async function() {\r\n\t\t\t\t$scope.loading = true;\r\n\t\t\t\t$scope.data.pagesCount = parseInt(($scope.data.records - 1) / $scope.data.limit) + 1;\r\n\t\t\t\t$scope.data.pages = [];\r\n\t\t\t\tfor (var i = 0; i < $scope.data.pagesCount; i++) {\r\n\t\t\t\t\t$scope.data.pages.push(i + 1);\r\n\t\t\t\t}\r\n\t\t\t\tif (!currentPage) {\r\n\t\t\t\t\tif (!($scope.data.pages.indexOf($rootScope.currentPage) > -1)) {\r\n\t\t\t\t\t\tif ($rootScope.currentPage > 0) {\r\n\t\t\t\t\t\t\t$rootScope.currentPage = $scope.data.pages[$scope.data.pagesCount - 1];\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t$rootScope.currentPage = 1;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$rootScope.currentPage = currentPage;\r\n\t\t\t\t}\r\n\t\t\t\tvar dataQueryParam = {\r\n\t\t\t\t\tlimit: $scope.data.limit,\r\n\t\t\t\t\toffset: ($rootScope.currentPage - 1) * $scope.data.limit\r\n\t\t\t\t};\r\n dataQueryParam = $scope.mergeQueryOptions(dataQueryParam); \r\n\t\t\t\tvar dataQuery = await $scope.beforeLoadAll(dataQueryParam) || dataQueryParam;\r\n\r\n\t\t\t\t$scope.query(dataQuery, function(r) {\r\n\t\t\t\t\t$scope.loading = false;\r\n \r\n\t\t\t\t\tsetTimeout(function(){\r\n\t\t\t\t\t\tif(!$scope.loadedOnce){\r\n\t\t\t\t\t\t\t$scope.loadedOnce = true;\r\n\t\t\t\t\t\t\t$(\"table\").tableExport();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}, 500);\r\n \r\n\t\t\t\t\tif (r && r.length > 0) {\r\n\t\t\t\t\t\t// var headers = Object.getOwnPropertyNames(r[0]);\r\n\t\t\t\t\t\t// $scope.data.listHeadersRaw = headers;\r\n\t\t\t\t\t\t// if(headers.indexOf(\"id\") > -1) headers.splice(headers.indexOf(\"id\"), 1);\r\n\t\t\t\t\t\t// if(headers.indexOf(\"secret\") > -1) headers.splice(headers.indexOf(\"secret\"), 1);\r\n\t\t\t\t\t\t// headers = headers.filter(function(p){ return (p.slice(-3) !== \"_id\")});\r\n\t\t\t\t\t\t// if($scope.removeListHeaders){\r\n\t\t\t\t\t\t// \tvar removeHeaders = $scope.removeListHeaders();\r\n\t\t\t\t\t\t// \tfor (var i = 0; i < removeHeaders.length; i++) {\r\n\t\t\t\t\t\t// \t\tvar h = removeHeaders[i];\r\n\t\t\t\t\t\t// \t\tif(headers.indexOf(h) > -1) headers.splice(headers.indexOf(h), 1);\r\n\t\t\t\t\t\t// \t}\r\n\t\t\t\t\t\t// }\r\n\t\t\t\t\t\t// $scope.data.listKeys = headers;\r\n\t\t\t\t\t\t// headers = headers.map(function(p){ return H.toTitleCase(H.replaceAll(p, '_', ' '))});\r\n\r\n\t\t\t\t\t\t$scope.data.listKeys = $scope.data.singleKeys.map(function(p){ return p; });\r\n\t\t\t\t\t\tvar headers = $scope.data.singleKeys.map(function(p) {\r\n\t\t\t\t\t\t\treturn $scope.data.singleKeysInfo[p].title;\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif($scope.removeListHeaders){\r\n\t\t\t\t\t\t\tvar removeHeaders = $scope.removeListHeaders();\r\n\t\t\t\t\t\t\tfor (var i = 0; i < removeHeaders.length; i++) {\r\n\t\t\t\t\t\t\t\tvar h = removeHeaders[i];\r\n\t\t\t\t\t\t\t\tif(headers.indexOf(h) > -1) {\r\n\t\t\t\t\t\t\t\t\tvar ind = headers.indexOf(h);\r\n\t\t\t\t\t\t\t\t\theaders.splice(ind, 1);\r\n\t\t\t\t\t\t\t\t\t$scope.data.listKeys.splice(ind, 1);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n \r\n\t\t\t\t\t\t$scope.setListHeaders(headers);\r\n\t\t\t\t\t\tsetTimeout(function(){\r\n\t\t\t\t\t\t\ttry{\r\n\t\t\t\t\t\t\t\t$('.tableexport-caption').detach();\r\n\t\t\t\t\t\t\t\t$('table').tableExport();\r\n\t\t\t\t\t\t\t} catch(ex){\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t}, 1000); \r\n\t\t\t\t\t}\r\n \r\n if(dataQuery.order && dataQuery.orderType) $scope.data.sortCache[dataQuery.order] = dataQuery.orderType;\r\n \r\n\t\t\t\t\tif ($scope.onLoadAll) $scope.onLoadAll(r);\r\n\t\t\t\t});\r\n\r\n\t\t\t});\r\n\t\t};\r\n\r\n\t\t$scope.listAllPrev = function() {\r\n\t\t\tif (($scope.currentPage - 1) > 0) {\r\n\t\t\t\t$scope.listAll($scope.currentPage - 1);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t$scope.listAllNext = function() {\r\n\t\t\tif (($scope.currentPage + 1) <= $scope.data.pages.length) {\r\n\t\t\t\t$scope.listAll($scope.currentPage + 1);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//Load entry on initialization\r\n\t\t$scope.loadSingle = async function(callback) {\r\n\t\t\t//$scope.loading = true;\r\n\t\t\t$scope.get($routeParams.id, async function(r) {\r\n\t\t\t\tif ($scope.onLoad) await $scope.onLoad(r);\r\n\t\t\t\tif (callback) callback(r);\r\n\t\t\t\tGLOBALS.methods.autoFocus();\r\n\t\t\t\t//$scope.loading = false;\r\n\t\t\t});\r\n\t\t};\r\n\r\n\r\n\t\t//Toggle Visibility\r\n\t\t$scope.toggleVisibility = function(item) {\r\n\t\t\titem.visible = !item.visible;\r\n\t\t};\r\n\r\n\t\t//Toggle lock\r\n\t\t$scope.toggleLock = function() {\r\n\t\t\t$scope.locked = !$scope.locked;\r\n\t\t\tif(!$scope.locked){\r\n $scope.mode = $scope.MODES.edit;\r\n\t\t\t\tGLOBALS.methods.autoFocus();\r\n\t\t\t} \r\n\t\t};\r\n\r\n\t\t//Update a single record\r\n\t\t$scope.updateSingle = function(callback) {\r\n\t\t\t//$scope.loading = true;\r\n $scope.saveClicked = true;\r\n\t\t\tif ($scope.beforeUpdate) {\r\n\t\t\t\t$scope.beforeUpdate($scope.data.single, function(r) {\r\n\t\t\t\t\tvar update = true;\r\n\t\t\t\t\tif ($scope.beforeUpdateBase) update = $scope.beforeUpdateBase();\r\n\t\t\t\t\tif (update) {\r\n\t\t\t\t\t\t$scope.update($scope.data.single, function(r) {\r\n\t\t\t\t\t\t\t$scope.locked = true;\r\n\r\n\t\t\t\t\t\t\tif (r && r.error) {\r\n\t\t\t\t\t\t\t\tif ($scope.onError) {\r\n\t\t\t\t\t\t\t\t\t$scope.onError(r.error, function(e) {\r\n\t\t\t\t\t\t\t\t\t\tif ($scope.onErrorBase) $scope.onErrorBase(e);\r\n\t\t\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tif ($scope.onErrorBase) $scope.onErrorBase(r.error);\r\n\t\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tif ($scope.onUpdate) {\r\n\t\t\t\t\t\t\t\t$scope.onUpdate(r, function(r) {\r\n\t\t\t\t\t\t\t\t\tif ($scope.onUpdateBase) $scope.onUpdateBase(r);\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tif ($scope.onUpdateBase) $scope.onUpdateBase(r);\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tif (callback) callback(r);\r\n\t\t\t\t\t\t\t//$scope.loading = false;\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t});\r\n\t\t\t} else {\r\n\t\t\t\tvar update = true;\r\n\t\t\t\tif ($scope.beforeUpdateBase) update = $scope.beforeUpdateBase();\r\n\t\t\t\tif (update) {\r\n\t\t\t\t\t$scope.update($scope.data.single, function(r) {\r\n\t\t\t\t\t\t$scope.locked = true;\r\n\r\n\t\t\t\t\t\tif (r && r.error) {\r\n\t\t\t\t\t\t\tif ($scope.onError) {\r\n\t\t\t\t\t\t\t\t$scope.onError(r.error, function(e) {\r\n\t\t\t\t\t\t\t\t\tif ($scope.onErrorBase) $scope.onErrorBase(e);\r\n\t\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tif ($scope.onErrorBase) $scope.onErrorBase(r.error);\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ($scope.onUpdate) {\r\n\t\t\t\t\t\t\t$scope.onUpdate(r, function(r) {\r\n\t\t\t\t\t\t\t\tif ($scope.onUpdateBase) $scope.onUpdateBase(r);\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tif ($scope.onUpdateBase) $scope.onUpdateBase(r);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (callback) callback(r);\r\n\t\t\t\t\t\t//$scope.loading = false;\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t//Initialize a single record\r\n\t\t$scope.newSingle = async function(callback) {\r\n\t\t\t$scope.locked = false;\r\n $scope.mode = $scope.MODES.add;\r\n\t\t\t$scope.initSingle();\r\n\t\t\tif ($scope.onInit) await $scope.onInit($scope.data.single);\r\n\t\t\tif (callback) callback();\r\n\t\t};\r\n\r\n\t\t//Save a new single record\r\n\t\t$scope.saveSingle = function(callback) {\r\n\t\t\t//$scope.loading = true;\r\n $scope.saveClicked = true;\r\n\t\t\tif ($scope.beforeSave) {\r\n\t\t\t\t$scope.beforeSave($scope.data.single, function(r) {\r\n\t\t\t\t\tvar save = true;\r\n\t\t\t\t\tif ($scope.beforeSaveBase) save = $scope.beforeSaveBase();\r\n\t\t\t\t\tif (save) {\r\n\t\t\t\t\t\t$scope.save($scope.data.single, function(r) {\r\n\t\t\t\t\t\t\t$scope.locked = true;\r\n\r\n\t\t\t\t\t\t\tif ((r && r.error) || (r && r.data && r.data.error)) {\r\n\t\t\t\t\t\t\t\tif ($scope.onError) {\r\n\t\t\t\t\t\t\t\t\t$scope.onError(r.error, function(e) {\r\n\t\t\t\t\t\t\t\t\t\tif ($scope.onErrorBase) $scope.onErrorBase(e);\r\n\t\t\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tif ($scope.onErrorBase) $scope.onErrorBase(r.data.error);\r\n\t\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tif ($scope.onSave) {\r\n\t\t\t\t\t\t\t\t$scope.onSave(r, function(r) {\r\n\t\t\t\t\t\t\t\t\tif ($scope.onSaveBase) $scope.onSaveBase(r);\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tif ($scope.onSaveBase) $scope.onSaveBase(r);\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tif (callback) callback(r);\r\n\t\t\t\t\t\t\t//$scope.loading = false;\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t} else {\r\n\t\t\t\tvar save = true;\r\n\t\t\t\tif ($scope.beforeSaveBase) save = $scope.beforeSaveBase();\r\n\t\t\t\tif (save) {\r\n\t\t\t\t\t$scope.save($scope.data.single, function(r) {\r\n\t\t\t\t\t\t$scope.locked = true;\r\n\r\n\t\t\t\t\t\tif ((r && r.error) || (r && r.data && r.data.error)) {\r\n\t\t\t\t\t\t\tif ($scope.onError) {\r\n\t\t\t\t\t\t\t\t$scope.onError(r.error, function(e) {\r\n\t\t\t\t\t\t\t\t\tif ($scope.onErrorBase) $scope.onErrorBase(e);\r\n\t\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tif ($scope.onErrorBase) $scope.onErrorBase(r.data.error);\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ($scope.onSave) {\r\n\t\t\t\t\t\t\t$scope.onSave(r, function(r) {\r\n\t\t\t\t\t\t\t\tif ($scope.onSaveBase) $scope.onSaveBase(r);\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tif ($scope.onSaveBase) $scope.onSaveBase(r);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (callback) callback(r);\r\n\t\t\t\t\t\t//$scope.loading = false;\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\t//Change a property in single\r\n\t\t$scope.changeSingle = function(property, value) {\r\n\t\t\tthis.data.single[property] = value;\r\n\t\t};\r\n\r\n\r\n\t\t/*Define options\r\n\t\t\tinit:true -> Load all records when the controller loads\r\n\t\t*/\r\n\t\tif (options) {\r\n\t\t\t$scope.options = options;\r\n\t\t\tif ($scope.options.init) {\r\n\t\t\t\t$scope.query();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//Any extra stuff you might want to merge into the data object\r\n\t\tif (extras) {\r\n\t\t\tfor (var e in extras) {\r\n\t\t\t\t$scope.data[e] = extras[e];\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\t//Localized resources\r\n\t\t$scope.textResources = {\r\n\t\t\ttitle: {\r\n\t\t\t\tsingle: '',\r\n\t\t\t\tlist: ''\r\n\t\t\t},\r\n\t\t\ttemplates: {\r\n\t\t\t\tedit: '',\r\n\t\t\t\tcreate: '',\r\n\t\t\t\tlist: ''\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t$scope.initTextResources = function(listTitle, singleTitle, listTemplate, listItemTemplate, listHeaderTemplate, listFooterTemplate, newTemplate, editTemplate, singleHeaderTemplate, singleFooterTemplate) {\r\n\t\t\t$scope.textResources.title.list = listTitle;\r\n\t\t\t$scope.textResources.title.single = singleTitle;\r\n\t\t\t$scope.textResources.templates.list = listTemplate;\r\n\t\t\t$scope.textResources.templates.listItem = listItemTemplate;\r\n\t\t\t$scope.textResources.templates.listHeader = listHeaderTemplate;\r\n\t\t\t$scope.textResources.templates.listFooter = listFooterTemplate;\r\n\t\t\t$scope.textResources.templates.create = newTemplate;\r\n\t\t\t$scope.textResources.templates.edit = editTemplate;\r\n\t\t\t$scope.textResources.templates.singleHeader = singleHeaderTemplate;\r\n\t\t\t$scope.textResources.templates.singleFooter = singleFooterTemplate;\r\n\t\t};\r\n\r\n\t\t$scope.initTextResourcesEasy = function(route, singular) {\r\n\t\t\tif (!route || route == '') {\r\n\t\t\t\troute = $scope.currentRoute;\r\n\t\t\t}\r\n\t\t\tvar plural = route.toUpperCase();\r\n\t\t\t\r\n //if (!singular || singular == '') singular = plural.substring(0, plural.length - 1);\r\n\t\t\tif (!singular || singular == '') singular = H.toSingular(plural).toUpperCase();\r\n\r\n var listTemplate = 'app/modules/' + route + '/list.html';\r\n\t\t\tvar listItemTemplate = 'app/modules/' + route + '/list-item.html';\r\n\t\t\tvar listHeaderTemplate = 'app/modules/' + route + '/list-header.html';\r\n\t\t\tvar listFooterTemplate = 'app/modules/' + route + '/list-footer.html';\r\n\t\t\tvar singleTemplate = 'app/modules/' + route + '/single.html';\r\n\t\t\tvar singleHeaderTemplate = 'app/modules/' + route + '/single-header.html';\r\n\t\t\tvar singleFooterTemplate = 'app/modules/' + route + '/single-footer.html';\r\n\r\n\t\t\t$scope.initTextResources(plural, singular, listTemplate, listItemTemplate, listHeaderTemplate, listFooterTemplate, singleTemplate, singleTemplate, singleHeaderTemplate, singleFooterTemplate);\r\n\t\t};\r\n\r\n\r\n\t\t$scope.initTextResourcesAuto = function(route, singular) {\r\n\t\t\tif (!route || route == '') {\r\n\t\t\t\troute = $scope.currentRoute;\r\n\t\t\t}\r\n\t\t\tvar plural = route.toUpperCase();\r\n\r\n //if (!singular || singular == '') singular = plural.substring(0, plural.length - 1);\r\n\t\t\tif (!singular || singular == '') singular = H.toSingular(plural).toUpperCase();;\r\n\r\n\t\t\tvar common = \"common/templates\";\r\n\r\n\r\n\t\t\tvar listTemplate = 'app/modules/' + common + '/list-extra.html';\r\n\t\t\tvar listItemTemplate = 'app/modules/' + common + '/list-item.html';\r\n\t\t\tvar listHeaderTemplate = 'app/modules/' + common + '/list-header.html';\r\n\t\t\tvar listFooterTemplate = 'app/modules/' + common + '/list-footer.html';\r\n\t\t\tvar singleTemplate = 'app/modules/' + common + '/single.html';\r\n\t\t\tvar singleHeaderTemplate = 'app/modules/' + common + '/single-header.html';\r\n\t\t\tvar singleFooterTemplate = 'app/modules/' + common + '/single-footer.html';\r\n\r\n\t\t\t$scope.initTextResources(plural, singular, listTemplate, listItemTemplate, listHeaderTemplate, listFooterTemplate, singleTemplate, singleTemplate, singleHeaderTemplate, singleFooterTemplate);\r\n\t\t};\r\n\r\n\t\t$scope.setTitle = function(t, v) {\r\n\t\t\t$scope.textResources.title[t] = v;\r\n\t\t};\r\n\r\n\t\t$scope.getTitle = function(t) {\r\n\t\t\tswitch (t) {\r\n\t\t\t\tcase 'single':\r\n\t\t\t\t\tif ($scope.getSingularTitle) return $scope.getSingularTitle();\r\n\t\t\t\t\treturn $scope.textResources.title.single;\r\n\t\t\t\tcase 'list':\r\n\t\t\t\t\treturn $scope.textResources.title.list;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\treturn $scope.textResources.title.list;\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t$scope.getTemplate = function(t) {\r\n\t\t\tswitch (t) {\r\n\t\t\t\tcase 'edit':\r\n\t\t\t\t\treturn $scope.textResources.templates.edit;\r\n\t\t\t\tcase 'new':\r\n\t\t\t\t\treturn $scope.textResources.templates.create;\r\n\t\t\t\tcase 'list':\r\n\t\t\t\t\treturn $scope.textResources.templates.list;\r\n\t\t\t\tcase 'list-item':\r\n\t\t\t\t\treturn $scope.textResources.templates.listItem;\r\n\t\t\t\tcase 'list-header':\r\n\t\t\t\t\treturn $scope.textResources.templates.listHeader;\r\n\t\t\t\tcase 'list-footer':\r\n\t\t\t\t\treturn $scope.textResources.templates.listFooter;\r\n\t\t\t\tcase 'single-header':\r\n\t\t\t\t\treturn $scope.textResources.templates.singleHeader;\r\n\t\t\t\tcase 'single-footer':\r\n\t\t\t\t\treturn $scope.textResources.templates.singleFooter;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\treturn '';\r\n\t\t\t}\r\n\r\n\t\t};\r\n \r\n\t\t$scope.setTemplate = function(key, value){\r\n\t\t\t$scope.templates[key] = value;\r\n\t\t}\r\n\r\n\t\t$scope.getTableHeaders = function() {\r\n\t\t\tvar headers = [];\r\n\t\t\tif ($scope.data.list && $scope.data.list.length > 0 && $scope.data.list[0]) {\r\n\t\t\t\theaders = Object.getOwnPropertyNames($scope.data.list[0]);\r\n\t\t\t}\r\n\t\t\treturn headers;\r\n\t\t};\r\n\r\n\t\t$scope.setListHeaders = function(headers) {\r\n\t\t\t$scope.data.listHeaders = headers;\r\n\t\t};\r\n\r\n\t\t$scope.changeListHeaders = function(header, replacement) {\r\n\t\t\tif ($scope.data.listHeaders && $scope.data.listHeaders.indexOf(header) > -1) {\r\n\t\t\t\t$scope.data.listHeaders[$scope.data.listHeaders.indexOf(header)] = replacement;\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t$scope.buildSingleHeaders = function() {\r\n\t\t\t$scope.data.singleKeys = [] //Object.getOwnPropertyNames($scope.data.single).filter(function(p){ return !(p.startsWith('$') || p == 'secret'); });\r\n\t\t\t$scope.data.foreignKeys = {};\r\n\t\t\t$scope.data.foreignKeysResources = {};\r\n\t\t\t$scope.data.singleKeysInfo = {};\r\n\t\t\tvar aliases = RegisterRoutes().aliases;\r\n\t\t\tfor (i in $scope.metadata) {\r\n\t\t\t\tvar o = JSON.parse(JSON.stringify($scope.metadata[i]));\r\n\t\t\t\tvar k = o.Field;\r\n\t\t\t\tif (k == \"secret\") continue;\r\n\t\t\t\t$scope.data.singleKeys.push(k);\r\n\t\t\t\tvar type = \"text\";\r\n\t\t\t\tvar required = o.Null == 'NO';\r\n\t\t\t\tvar title = H.toTitleCase(H.replaceAll(k, '_', ' '));\r\n\t\t\t\tif(title.endsWith(' Id')) title = title.substring(0,title.length - 3);\r\n\t\t\t\tif (o.Key == \"MUL\"){\r\n\t\t\t\t\ttype = \"fkey\";\r\n\t\t\t\t\t//fkeyTable = title.replace(' ', '_').toLowerCase() + 's';\r\n\t\t\t\t\tfkeyTable = H.toPlural(title.replace(' ', '_').toLowerCase());\t\t\r\n\t\t\t\t\tvar fKeyTableOrAlias = aliases[fkeyTable] ? aliases[fkeyTable] : fkeyTable;\t\t\t\r\n\t\t\t\t\t$scope.data.foreignKeysResources[fkeyTable] = R.get(fKeyTableOrAlias);\r\n\t\t\t\t\t\r\n\t\t\t\t\t(function(fkeyTable){\r\n\t\t\t\t\t\t$scope.data.foreignKeysResources[fkeyTable].query({}, function(r){\r\n\t\t\t\t\t\t\t$scope.data.foreignKeys[fkeyTable] = r;\r\n\t\t\t\t\t\t}, function(e){\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t})(fkeyTable);\r\n\t\t\t\t} else if (k.startsWith(\"is_\") || o.Type == \"tinyint(1)\") {\r\n\t\t\t\t\ttype = \"bool\";\r\n\t\t\t\t} else if (o.Type.startsWith(\"int\") || o.Type.startsWith(\"bigint\") || o.Type.startsWith(\"mediumint\") || o.Type.startsWith(\"smallint\") || o.Type.startsWith(\"float\") || o.Type.startsWith(\"double\") || o.Type.startsWith(\"tinyint\")) {\r\n\t\t\t\t\ttype = \"number\";\r\n\t\t\t\t} else if (o.Type == \"date\"){\r\n\t\t\t\t\ttype = \"date\";\r\n\t\t\t\t} else if (o.Type == \"datetime\"){\r\n\t\t\t\t\ttype = \"datetime\";\r\n\t\t\t\t} else if (k.endsWith(\"email\")) {\r\n\t\t\t\t\ttype = \"email\";\r\n\t\t\t\t} else if (k.indexOf(\"password\") > -1) {\r\n\t\t\t\t\ttype = \"password\";\r\n\t\t\t\t} else if (o.Type == \"text\") {\r\n\t\t\t\t\ttype = \"textarea\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttype = \"text\";\r\n\t\t\t\t}\r\n\t\t\t\t$scope.data.singleKeysInfo[k] = {\r\n\t\t\t\t\ttype: type,\r\n\t\t\t\t\ttitle: title,\r\n\t\t\t\t\trequired: required\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\t// console.log('DATA');\r\n\t\t\t// console.log($scope.data.singleKeys);\r\n\t\t\t// console.log($scope.data.singleKeysInfo);\r\n\t\t\t// console.log($scope.data.foreignKeys);\r\n\t\t\t// console.log($scope.data.foreignKeysResources);\r\n\r\n\t\t\t\r\n\r\n\t\t}\r\n\r\n\t\t$scope.showDialog = function(ev, title, content, okText = \"OK\", cancelText = \"Cancel\", okHandler, cancelHandler, closeHandler) {\r\n\t\t\tPopup.show({\r\n\t\t\t\t\ttitle: title,\r\n\t\t\t\t\tbody: content,\r\n\t\t\t\t\tbuttons: [{\r\n\t\t\t\t\t\ttext: okText,\r\n\t\t\t\t\t\ttheme: 'success',\r\n\t\t\t\t\t\tclick: function(callback, btn, data) {\r\n\t\t\t\t\t\t\tif (okHandler) okHandler();\r\n\t\t\t\t\t\t\tif (callback) callback(btn);\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\tcleanup: function(data) {\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}, {\r\n\t\t\t\t\t\ttext: cancelText,\r\n\t\t\t\t\t\ttheme: 'warning',\r\n\t\t\t\t\t\tclick: function(callback, btn, data) {\r\n\t\t\t\t\t\t\tif (cancelHandler) cancelHandler();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}],\r\n\t\t\t\t\tscope: $scope,\r\n\t\t\t\t\tspinner: true,\r\n\t\t\t\t\tclose: closeHandler || function(data) {\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\t// var confirm = $mdDialog.confirm()\r\n\t\t\t\t// .title(title)\r\n\t\t\t\t// .textContent(content)\r\n\t\t\t\t// .ariaLabel('')\r\n\t\t\t\t// .targetEvent(ev)\r\n\t\t\t\t// .ok(okText)\r\n\t\t\t\t// .cancel(cancelText);\r\n\r\n\t\t\t// $mdDialog.show(confirm).then(function() {\r\n\t\t\t// if(okHandler) okHandler();\r\n\t\t\t// }, function() {\r\n\t\t\t// if(cancelHandler) cancelHandler();\r\n\t\t\t// });\r\n\t\t};\r\n\r\n\t\t$scope.onErrorBase = function(obj) {\r\n\t\t\t$scope.showDialog(null, M.ERROR_TITLE, M.SAVED_ERROR, M.SAVED_OK, M.SAVED_CANCEL, function() {\r\n\t\t\t\t$scope.locked = false;\r\n\t\t\t}, function() {\r\n\t\t\t\t$location.path($scope.currentRoute);\r\n\t\t\t}, function(){ \r\n\t\t\t\t$scope.locked = false; \r\n\t\t\t});\r\n\t\t};\r\n\r\n\t\t$scope.onSaveBase = function(obj) {\r\n\t\t\t$scope.showDialog(null, M.SAVED_TITLE, M.SAVED_MESSAGE, M.SAVED_OK, M.SAVED_CANCEL, function() {\r\n\t\t\t\t$scope.newSingle();\r\n\t\t\t}, function() {\r\n\t\t\t\t$location.path($scope.currentRoute);\r\n\t\t\t}, function() {\r\n $scope.mode = $scope.MODES.view;\r\n });\r\n\t\t};\r\n\r\n\t\t$scope.onUpdateBase = function(obj) {\r\n\t\t\t$scope.showDialog(null, M.SAVED_TITLE, M.SAVED_MESSAGE, M.SAVED_OK, M.SAVED_CANCEL, function() {}, function() {\r\n\t\t\t\t$location.path($scope.currentRoute);\r\n\t\t\t});\r\n\t\t};\r\n\r\n\t\t$scope.beforeSaveBase = $scope.beforeUpdateBase = function(obj) {\r\n\t\t\treturn (!Object.keys($scope.forms[$scope.currentRoute + \"Form\"].$error).length);\r\n\t\t};\r\n\r\n\t\t$scope.goToEdit = function() {\r\n\t\t\t$location.path($scope.currentRoute + \"/\" + $scope.data.single.id);\r\n\t\t};\r\n\r\n\t\t$scope.goToNew = function() {\r\n\t\t\t$location.path($scope.currentRoute + \"/\" + \"new\");\r\n\t\t};\r\n\r\n\t\t$scope.initLaunched = false;\r\n\t\t$scope.launchInit = async function(){\r\n\t\t\tif(!$scope.initLaunched){\r\n\t\t\t\tif($scope.init) await $scope.init();\r\n\t\t\t\t$scope.initLaunched = true;\t\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t$scope.$watch('init', function(n, o){\r\n\t\t\t$scope.launchInit();\r\n\t\t});\r\n \r\n\t\t\r\n\t\tGLOBALS.methods.autoFocus();\r\n\r\n\t};\r\n}", "title": "" }, { "docid": "d2a2c553b6e923751afd0f909000c791", "score": "0.4511569", "text": "function GetListGenre() {\n\t\t\t\t\t\t$scope.list_genre = [];\n\t\t\t\t\t\tvar Genre = $resource(baseUrl + 'genre');\n\t\t\t\t\t\tGenre.query().$promise.then(function(listGenre) {\n\n\t\t\t\t\t\t\t$scope.list_genre = listGenre;\n\n\t\t\t\t\t\t});\n\n\t\t\t\t\t}", "title": "" }, { "docid": "b50bf19a9aa6b0581874dccb22f13ea1", "score": "0.45110655", "text": "function updateMedicine(newMed,medId, personsid) {\n var promise = $http({\n method: 'PUT',\n url:'/meds-update/'+ medId,\n data: {\n name: newMed.name,\n dosage: newMed.dosage,\n time: newMed.time,\n rxnumber: newMed.rxnumber,\n personid: personsid\n }\n }).then(function successfulCallback(response){\n medicine = response.data;\n }, function(error){\n console.log(\"error\");\n });\n return promise;\n }", "title": "" }, { "docid": "e773ac4070d39e415107063ef4276452", "score": "0.44983917", "text": "SearchInventory(ItemName) { \n var index = this.MedicalInventory.map(item => item.Medicine).indexOf(ItemName);\n return this.MedicalInventory[index];\n }", "title": "" }, { "docid": "229ff2e86f4c2367a153ae78c8ae3029", "score": "0.44962233", "text": "getName(){\n\n return this.name;\n\n }", "title": "" }, { "docid": "7e2dcf0bcf1ec570775ed782cf5d19e5", "score": "0.44896564", "text": "function findDog(id){\n//Have to do a new Fetch for dogs specific show page\n//replace :id with the id of the selected dogs\nfetch(`http://localhost:3000/dogs/${id}`)\n .then(res => res.json())\n// Send specific dog data to another function\n//that will populate the edit form\n .then(data => populateEditForm(data))\n}", "title": "" }, { "docid": "d419ab3ea29f3309bd406a29a88b63aa", "score": "0.4483868", "text": "function searchMovie(name) {\n var url = \"http://www.omdbapi.com/?apikey=8e5e4416&s=\" + name;\n searchService\n .findMovieByName(name)\n .then(function (data) {\n console.log(data);\n model.movies = data.Search;\n\n })\n return $sce.trustAsResourceUrl(url);\n\n\n }", "title": "" }, { "docid": "1d289a83bca671a5a73d73b222b61f58", "score": "0.44789153", "text": "function createMainPage() {\n // get body div\n const mainContent = document.getElementById(\"mainContent\");\n\n // get med list display\n const displayMedList = document.getElementById(\"displayMedList\");\n\n\n}", "title": "" }, { "docid": "a4c6dfdad96d2d7fc5c677ccd1b378aa", "score": "0.4478342", "text": "function loadMentors(list, store) {\n for(var i = 0; i < list.length; i++) {\n makeMentorCard(list[i], store);\n }\n}", "title": "" }, { "docid": "896e7cf8e9d691b124c873e76daa70ed", "score": "0.4469005", "text": "setListName(listName) {\n this.name = listName || \"No Name\";\n }", "title": "" }, { "docid": "d0ee7efc81928d1e555bf98136b2b19d", "score": "0.4467747", "text": "function nameOnchange(name) {\n try {\n if (vm.isEdit || !name)\n return;\n\n vm.fieldForm.$setPristine(); // set page reset\n vm.fieldForm.$setDirty(); // set page dirty\n\n\n\n var obj = Enumerable.From(vm.selectedArrayList).FirstOrDefault(null, function (x) {\n return x.name.toLowerCase() == name.toLowerCase();\n });\n if (obj) {\n\n vm.isNameChange = true; // is name chage by existing data \n // check uncheck is bangali checkbox \n if (obj.lBangla) {\n vm.isBangali = true;\n } else {\n vm.isBangali = false;\n }\n // set value \n angular.extend(vm.fieldDetail, obj);\n vm.fieldDetail.id = obj._id;\n\n vm.tmpFieldDtl = angular.copy(vm.fieldDetail);\n\n vm.isCancelBtnHide = false;\n\n } else {\n\n if (vm.isNameChange) {\n vm.fieldDetail = new field({\n refIndex: vm.fieldRange.index,\n name: vm.fieldDetail.name,\n applicationId: vm.fieldDetail.applicationId\n });\n\n vm.isNameChange = false;\n } else {\n vm.fieldDetail.id = null;\n if (vm.fieldDetail._id)\n vm.fieldDetail._id = null;\n }\n }\n } catch (e) {\n showErrorMsg(e);\n }\n }", "title": "" }, { "docid": "1189baca84dd5deef838b632ed278a06", "score": "0.44623137", "text": "function controller_by_user(){\n\t\ttry {\n\t\t\t\n//debug: all data\n//console.log(data_remedioss);\n$ionicConfig.backButton.text(\"\");\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"%cerror: %cPage: `encontrar` and field: `Custom Controller`\",\"color:blue;font-size:18px\",\"color:red;font-size:18px\");\n\t\t\tconsole.dir(e);\n\t\t}\n\t}", "title": "" }, { "docid": "08330157379bedc73ecd3cf0e0f3111d", "score": "0.4458862", "text": "function ControllerMethod($scope,$filter,lastNameFilter){\n $scope.name= 'John';\n $scope.upperName = $filter('uppercase')($scope.name);\n $scope.getFullName = function()\n {\n var fullName = lastNameFilter($scope.name);\n return fullName;\n }\n }", "title": "" }, { "docid": "e47d5a22ef6749542b79702549ac4d93", "score": "0.44580275", "text": "function showNames(names, elementSelector)\n{\n _.forEach(names, function(name)\n {\n //Make a bullet point\n var petList = document.createElement(\"li\");\n //Get a name\n var petName = document.createTextNode(name);\n //Put the name against the bullet point\n petList.appendChild(petName);\n\n //Find the gender headings\n var genderHeading = document.getElementById(elementSelector);\n //List the list under the correct heading\n genderHeading.appendChild(petList);\n });\n}", "title": "" }, { "docid": "57e9e30916b8c058654919825aab8e1b", "score": "0.4457319", "text": "function daoName(rwxmode,seed){\n\t\n\t//Safe-to-edit vars\n\tvar titles = setTitles();\n\t\n\t\n\tvar adj = [\"Abstruse\",\"Accursed\",\"Adamant\",\"All-knowing\",\"Allheaven\",\"Alternative\",\"Amarinthine\",\"Ancient\",\"Angry\",\"Animal\",\"Antediluvian\",\"Antimony\",\"Antithetical\",\"Apocalyptic\",\"Apocryphal\",\"Apotropaic\",\"Aquiline\",\"Arcadian\",\"Archaic\",\"Archetypal\",\"Armored\",\"Ascendant\",\"Ashen\",\"Astral\",\"Azure\",\"Azure-robed\",\"Backstabbing\",\"Barbarian\",\"Bashful\",\"Bearded\",\"Beautiful\",\"Bejewelled\",\"Beloved\",\"Benevolent\",\"Benighted\",\"Berserk\",\"Bespoken\",\"Black\",\"Black-robed\",\"Blood-colored\",\"Bloodless\",\"Bloody\",\"Blue\",\"Booming\",\"Broken\",\"Bronze\",\"Burning\",\"Capricious\",\"Celestial\",\"Cerulean\",\"Chaotic\",\"Chivalrous\",\"Clairvoyant\",\"Cloaked\",\"Complete\",\"Copper\",\"Corrupt\",\"Cosmic\",\"Courageous\",\"Cowardly\",\"Crafty\",\"Crimson\",\"Crimson-robed\",\"Crippled\",\"Cross-legged\",\"Crumbling\",\"Curious\",\"Cyan\",\"Deadly\",\"Deathless\",\"Deciduous\",\"Defiant\",\"Demonic\",\"Devilish\",\"Dharmic\",\"Diamond\",\"Divine\",\"Domineering\",\"Dreadful\",\"Drunken\",\"Earless\",\"Earthly\",\"Ebon\",\"Elemental\",\"Empty\",\"Empyrean\",\"Enclosed\",\"Enlightened\",\"Enraged\",\"Entropic\",\"Essential\",\"Eternal\",\"Ethereal\",\"Eutrophic\",\"Evergreen\",\"Explosive\",\"Eyeless\",\"Faceless\",\"False\",\"Farsighted\",\"Fearful\",\"Feathered\",\"Feckless\",\"Ferrous\",\"Fiendish\",\"Fiery\",\"Five-Elements\",\"Floating\",\"Flowing\",\"Fluid\",\"Flying\",\"Forgotten\",\"Fragrant\",\"Freezing\",\"Furious\",\"Furry\",\"Gallant\",\"Gargantuan\",\"Garrulous\",\"Geomantic\",\"Ghostly\",\"Gigantic\",\"Gilt\",\"Glittering\",\"Godly\",\"Golden\",\"Gossamer\",\"Granite\",\"Graven\",\"Greedy\",\"Green\",\"Grey\",\"Half-handed\",\"Handsome\",\"Hateful\",\"Headless\",\"Heartbroken\",\"Heavenly\",\"Hellish\",\"Heretical\",\"Heroic\",\"Heterodox\",\"Hidden\",\"Hooded\",\"Hopeless\",\"Icy\",\"Illusory\",\"Imperial\",\"Indigo\",\"Intransigent\",\"Intrepid\",\"Invincible\",\"Iridian\",\"Iron\",\"Irredeemable\",\"Irreverent\",\"Jade\",\"Jadeite\",\"Jubilant\",\"Jumping\",\"Karmic\",\"Killer\",\"Leaping\",\"Legendary\",\"Licentious\",\"Liquid\",\"Loathsome\",\"Lone\",\"Long-haired\",\"Loquacious\",\"Loveless\",\"Lovely\",\"Lovesick\",\"Lower\",\"Lucky\",\"Lunar\",\"Magenta\",\"Magical\",\"Magnanimous\",\"Magnanimous\",\"Martial\",\"Masked\",\"Melancholic\",\"Monochrome\",\"Murderous\",\"Mystic\",\"Mythical\",\"Near\",\"Necromantic\",\"Nefarious\",\"Netherworld\",\"Neverending\",\"Nirvanic\",\"Obese\",\"Occult\",\"Ochre\",\"Omniscient\",\"One\",\"One-armed\",\"One-legged\",\"Onyx\",\"Ophidian\",\"Orange\",\"Original\",\"Orthodox\",\"Overbearing\",\"Overwhelming\",\"Parochial\",\"Peaceful\",\"Penultimate\",\"Penumbral\",\"Perverted\",\"Pious\",\"Platinum\",\"Pock-marked\",\"Poisonous\",\"Porcelain\",\"Precipital\",\"Prideful\",\"Primeval\",\"Primordial\",\"Profound\",\"Psychedelic\",\"Psychic\",\"Psycopathic\",\"Pure\",\"Purple\",\"Purposeful\",\"Raging\",\"Rampaging\",\"Reborn\",\"Reckless\",\"Red\",\"Renegade\",\"Revolting\",\"Righteous\",\"Rumbling\",\"Running\",\"Saffron\",\"Sagacious\",\"Salty\",\"Sepulchral\",\"Serene\",\"Shameless\",\"Shelled\",\"Shoeless\",\"Silver\",\"Slashing\",\"Sleeping\",\"Solar\",\"Sole\",\"Sorrowful\",\"Soulless\",\"Sourceless\",\"Spicy\",\"Spiked\",\"Spinning\",\"Squamous\",\"Stabbing\",\"Stellar\",\"Stone\",\"Sublime\",\"Subtle\",\"Sulphurous\",\"Supernal\",\"Supreme\",\"Symmetrical\",\"Tattooed\",\"Tenebral\",\"Teneral\",\"Tentacled\",\"Tesselated\",\"Timeless\",\"Totemic\",\"Toxic\",\"Tranquil\",\"Tranquil\",\"Transcendant\",\"True\",\"Tyrannical\",\"Tyrian\",\"Ultimate\",\"Umbral\",\"Unaging\",\"Uncreated\",\"Undead\",\"Underworld\",\"Undying\",\"Universal\",\"Upper\",\"Vampiric\",\"Vegetal\",\"Venemous\",\"Venerable\",\"Vengeful\",\"Verdurous\",\"Vermilion\",\"Violet\",\"Volcanic\",\"Voracious\",\"Whirling\",\"White\",\"White-robed\",\"Wooden\",\"Yang\",\"Yellow\",\"Yin\",\"Yin-Yang\",\"Youthful\"];\n\t\n\tvar pluralisers = [\"Two\",\"Three\",\"Five\",\"Seven\",\"Nine\",\"Ten\",\"Eleven\",\"Thirteen\",\"Hundred\",\"Thousand\",\"Myriad\",\"Infinite\",\"Many\",\"Manifold\",\"Infinite\",\"Nintey-Nine\",\"10,000\",\"Thirty-Six\",\"Sixty\",\"Sixty-Four\",\"Multitudinous\",\"Endless\"];\n\t\n\tvar nouns = [\"Darkness\",\"Chopsticks\",\"Air\",\"Alcohol\",\"Alligator\",\"Ant\",\"Arrow\",\"Assassin\",\"Asura\",\"Avalanch\",\"Axe\",\"Bat\",\"Bear\",\"Beetle\",\"Billionaire\",\"Blood\",\"Boulder\",\"Bridge\",\"Broadsword\",\"Canopy\",\"Cat\",\"Caterpillar\",\"Cauldron\",\"Centipede\",\"Chameleon\",\"Chaos\",\"Chariot\",\"Chrysanthemum\",\"Cleaver\",\"Cloud\",\"Cobra\",\"Crane\",\"Cricket\",\"Crocodile\",\"Dagger\",\"Dao\",\"Daoist\",\"Death\",\"Deity\",\"Demon\",\"Despair\",\"Destruction\",\"Devil\",\"Divinity\",\"Dog\",\"Dove\",\"Dragon\",\"Drake\",\"Eagle\",\"Earth \",\"Earthworm\",\"Egret\",\"Elephant\",\"Fall\",\"Fan\",\"Fire\",\"Fist\",\"Flagon\",\"Flea\",\"Flood\",\"Flower\",\"Forest\",\"Frog\",\"Ghost\",\"God\",\"God\",\"Gorilla\",\"Grasshopper\",\"Greatsword\",\"Gryphon\",\"Hailstorm\",\"Hare\",\"Hate\",\"Hawk\",\"Heart\",\"Hope\",\"Hornet\",\"Hound\",\"Hummingbird\",\"Hurricane\",\"Ice\",\"Immortal\",\"Inferno\",\"Jackal\",\"Jade\",\"Jaguar\",\"Killer\",\"Lake\",\"Land\",\"Leopard\",\"Light\",\"Lion\",\"Lizard\",\"Llama\",\"Locust\",\"Lotus\",\"Love\",\"Mace\",\"Mansion\",\"Manticore\",\"Mantis\",\"Mermaid\",\"Metal\",\"Meteor\",\"Millionaire\",\"Millipede\",\"Mirror\",\"Moon\",\"Moth\",\"Mountain\",\"Murder\",\"Neo-demon\",\"Newt\",\"Nirvana\",\"Ocean\",\"Ogre\",\"Orchid\",\"Origin\",\"Owl\",\"Pagoda\",\"Panda\",\"Parrot\",\"Peacock\",\"Pearl\",\"Penguin\",\"Pigeon\",\"Pill\",\"Planet\",\"Porcupine\",\"Porcupine\",\"Purgatory\",\"Python\",\"Qilin\",\"Quadrillionaire\",\"Rainstorm\",\"Reincarnation\",\"Revenant\",\"River\",\"Rose\",\"Saber\",\"Salamander\",\"Salvation\",\"Scholar\",\"Scorpion\",\"Sea\",\"Seahorse\",\"Serpent\",\"Shade\",\"Shadow\",\"Shield\",\"Slaughter\",\"Snake\",\"Soul\",\"Sparrow\",\"Spear\",\"Spider\",\"Spring\",\"Star\",\"Starlight\",\"Summer\",\"Sun\",\"Swan\",\"Sword\",\"Tarantula\",\"Tempest\",\"Thunderclap\",\"Thunderstorm\",\"Tiger\",\"Toad\",\"Tornado\",\"Tortoise\",\"Torture\",\"Toucan\",\"Tree\",\"Trillionaire\",\"Turtle\",\"Umbrella\",\"Unicorn\",\"Vampire\",\"Viper\",\"Volcano\",\"Wasp\",\"Water\",\"Whirlpool\",\"Windstorm\",\"Wine\",\"Winter\",\"Wyvern\"];\n\t\n\tvar ttwNouns = [\"Black Hole\",\"Dao Fruit\",\"Flood Dragon\",\"Flying Rain-Dragon\",\"Hopping Vampire\",\"Incense Stick\",\"Lightning Bolt\",\"Medicinal Herb\",\"Medicinal Pill\",\"Medicinal Plant\",\"Nirvana Fruit\",\"Promissory Note\",\"Scroll Painting\",\"Sea Dragon\",\"Sea Turtle\",\"Shooting Star\",\"Spirit Fruit\",\"Spirit Stone\",\"Starry Sky\",\"Wild Boar\",\"Wooden Sword\",\"Xuanwu Turtle\",\"Yellow Springs\",\"Pill Bottle\",\"Feng-Shui Compass\",\"Bag of Holding\",\"Meat Jelly\"];\n\t\n\t\n\t//normalise the noun/adj picked\n\tvar adjLim = .8 * adj.length/(adj.length + pluralisers.length);\n\tvar nounLim = nouns.length/(nouns.length + ttwNouns.length);\n\t\n\t\n\tvar bp = \"The Divination is complete.<br /><br /> You are... \"\n\t\n\tvar ap;//chose which arrar is first part of name.\n\tvar nt;//chose which is second\n\tvar indices = [];\n\t\n\tvar title;\n\t\n\tif(!seed){\n\t\t//set adj or noun\tNEED TO ALTER THESE CONDITIONS TO REFLECT LIST SIZE\n\t\tap = [adj,pluralisers][Math.random() <= adjLim ? 0 : 1];\n\t\tnt = [nouns,ttwNouns][Math.random() <= nounLim ? 0 : 1];\n\t\t\n\t\tindices = [Math.floor(Math.random() * titles.length), Math.floor(Math.random()* ap.length), Math.floor(Math.random() * nt.length)];\n\t\t\n\t}\n\t\n\telse{\n\t\t\n\t\tap = [adj,pluralisers][(Math.abs(seed[0]/2147483647) <= adjLim) ? 0 : 1];\n\t\tnt = [nouns,ttwNouns][(Math.abs(seed[4]/2147483647) <= nounLim) ? 0 : 1];\n\t\t\n\t\tindices = [Math.abs(seed[1] % (titles.length - 1)), Math.abs(seed[2] % (ap.length - 1)), Math.abs(seed[3] % (nt.length - 1))]\n\t\t\n\t\t\n\t}\n\t\n\t//prevent duplicate titles.\n\tif (indices[1] == indices[2]){\n\t\t\t\n\t\tindices[2] = indices[2] + 1 % (nt.length - 1);\n\t\t\t\n\t}\n\t\n\ttitle = [titles[indices[0]], ap[indices[1]], (ap == pluralisers) ? pluralize(nt[indices[2]]) : nt[indices[2]]]\n\t\n\tif((rwxmode) && ((nt != ttwNouns))){\n\t\treturn bp + title[0] + \" \" + toTitleCase(title[1] + title[2]) + \"!!!\";\n\t}\n\telse{\n\t\treturn bp + title[0] + \" \" + toTitleCase(title[1] + \" \" + title[2]) + \"!!!\";\n\t}\n}", "title": "" }, { "docid": "b9b225b100816f6ddc70de62d2962cce", "score": "0.44552723", "text": "function getUserDesignedKitchen()\n {\n\n if(queryStringGuid)\n {\n $location.search('guid', null);\n $location.search('fb_ref', null);\n\n dataFactory.getUserKitchen(queryStringGuid) .success(function (userKitchen) {\n $scope.designId=userKitchen.id;\n getAppliances(userKitchen.id);\n $scope.userProducts=userKitchen.products;\n $scope.layoutImg='img/design_'+userKitchen.id+'.jpg';\n\n })\n .error(function (error) {\n\n });\n }\n else\n {\n alert('no qs');\n }\n }", "title": "" }, { "docid": "da6f9123d3c65559ae98b5b5facbae01", "score": "0.44522813", "text": "function getChamberTitle() {\n for (m = 0; m < app.mdlegislators.length; m++) {\n let camara = app.mdlegislators[m].chamber\n //console.log (md.chambers[camara].title)\n app.mdlegislators[m].memberTitle = app.md.chambers[camara].title\n }\n}", "title": "" }, { "docid": "b11043fbe0bc895f1ea299ff45503806", "score": "0.4451952", "text": "function displayData() {\n $http.get('/home/view')\n .then(function (response) {\n\n console.log(response.data);\n vm.names = response.data;\n\n });\n }", "title": "" }, { "docid": "907ea54d75af4697da6c1640a5c5b790", "score": "0.44494775", "text": "function getSelectedMedicines(medicines){\n var medicine = $(\"#medicine\").val();\n var selectedMedicines = [];\n for (i in medicines){\n if (medicine == medicines[i].ProductName){\n selectedMedicines.push(medicines[i]);\n }\n }\n return selectedMedicines;\n }", "title": "" }, { "docid": "7a0feffc1e14c7457a76a65c5baa6f54", "score": "0.44432262", "text": "getName(){\r\n return this.name;\r\n }", "title": "" }, { "docid": "c0c29768e7f2ef112757ff029c14a67c", "score": "0.4443103", "text": "function getDesigns() {\n\n dataFactory.getDesigns()\n .success(function (designs) {\n $scope.designs = designs;\n\n })\n .error(function (error) {\n\n });\n }", "title": "" }, { "docid": "13ea5f9c1b04b958440cfcec106bdcb3", "score": "0.44423586", "text": "function NameDisplay(NameService) {\n const ctrl = this;\n \n // renderName function, has variable ctrl.nameInput which is equal to: NameService file/function and specifically, calling the getName function\n ctrl.renderName = () => {\n ctrl.nameInput = NameService.getName();\n console.log(`renderName function called in NameDisplay component`);\n }\n }", "title": "" }, { "docid": "4cffa049197d53d066ed627616ab1d02", "score": "0.44350988", "text": "function init() {\n $scope.CurrentPageName = \"Item Detail\";\n\n $scope.items = ItemService.getItems();\n $scope.itemId = $routeParams.itemId;\n $scope.currentItem = $scope.items[$scope.itemId];\n\n $scope.InputBoxTitle = \"Detail For: \" + $scope.currentItem.itemName;\n }", "title": "" }, { "docid": "f2591e8abefeda4265f8a50a02447f40", "score": "0.4428633", "text": "searchMicrofilms(newspaper) {\n return this.microfilmList.filter( microfilm => {\n return newspaper == microfilm.newspaper;\n }); \n }", "title": "" }, { "docid": "e761ecaa635123e9e78331c12794e562", "score": "0.4425817", "text": "function selectName(){\n var ind = Math.floor(Math.random() * names.length);\n\n return names[ind];\n }", "title": "" }, { "docid": "b814c674a6c68ec1995e45e520b35df1", "score": "0.44245917", "text": "function CollectionsController($rootScope, $scope, $location, MovieService) {\n \t// login check\n if(!$rootScope.currentUser){\n alert('Pleaae login');\n $location.path('/login');\n return;\n }\n\n var _this = this;\n \n\n var id =$rootScope.currentUser.id;\n console.log(id);\n MovieService.getCollections(id).then(function(movies){\n console.log(movies)\n _this.movies = movies; \n }); \n\n _this.setShared = setShared;\n function setShared(movie){\n $rootScope.sharedMovie = movie;\n $location.path('/details')\n }\n }", "title": "" }, { "docid": "d8013209e4ac160d141fc0b5585a2276", "score": "0.44237462", "text": "function collectName(){\n var name = fullname.value;\n userdata[\"name\"] = name;\n}", "title": "" }, { "docid": "cee8da17fbade9f12dee46d2c626a508", "score": "0.4421895", "text": "function showDetailsView(e) {\n var view = e.view;\n\n // let's see where this details call is coming in from\n var calleeType = view.params.calleeType;\n\n\n if (calleeType == \"search\") {\n\n var item = null;\n\n _ds.fetch(function () {\n item = _ds.get(view.params.id);\n view.scrollerContent.html(_itemDetailsTemplate(item));\n\n _currentPerson = item;\n\n switchFavouritesButtonIcon(view.params.id);\n\n kendo.mobile.init(view.content);\n\n });\n\n } else {\n\n // we can assume it's favs. The data here is local\n _dsFavourites.fetch(function () {\n\n // we have to go through the local data here to find a match\n var personMatch = null;\n\n var foundMatch = false;\n for (var i = 0; i < _dsFavourites._data.length; i++) {\n personMatch = _dsFavourites._data[i];\n if (personMatch.PersonId == view.params.id) {\n foundMatch = true;\n break;\n }\n\n }\n\n if (foundMatch) {\n\n // ok we have found a match, let's apply the template\n view.scrollerContent.html(_itemDetailsTemplate(personMatch));\n\n _currentPerson = personMatch;\n\n // show the delete icon\n showRemoveFromFavIcon();\n\n\n\n // kick off the view\n kendo.mobile.init(view.content);\n\n\n }\n\n\n });\n }\n\n\n\n\n}", "title": "" }, { "docid": "8fce61d6b1ff4d109a9ee5619f382986", "score": "0.44212243", "text": "function random() {\n FilterService.getRandom($scope.filter)\n .then(function (response) {\n var id = response.data.petfinder.petIds.id.$t;\n $state.go('petfinder.details', {id: id});\n })\n .catch(function (message) {\n console.log(message);\n });\n }", "title": "" }, { "docid": "ad2620e4034c3c27895194aea19c5ef1", "score": "0.44187638", "text": "function moviesTitleList () { \n fetchList(\"movie_title\")\n .then(function(list) { \n $('#the-basics .typeahead').typeahead({\n hint: true,\n highlight: true,\n minLength: 1\n },\n {\n name: 'moviesTitleList',\n source: substringMatcher(list)\n });\n })\n}", "title": "" }, { "docid": "072585b6361c49e550d80ce988d1acbc", "score": "0.44154212", "text": "function getItemList() {\n $http.get(getContextPath() + '/module/pharmacy/listitem.htm').success(function(d) {\n self.itemList = d;\n //console.log(d);\n }).error(function(data, status, headers) {\n console.log(status);\n });\n }", "title": "" }, { "docid": "3736d3c7652da0ac15dbbbab4f9515db", "score": "0.44113192", "text": "function musicianFactory($http){\n var fFactory = {}\n //SEND A REQUEST TO OUR SERVER AND RETURN A PROMISE\n fFactory.create = function(musician){\n return $http.post('/api/v1/musicians', musician)\n }\n\n fFactory.all = function(){\n return $http.get('/api/v1/musicians')\n }\n\n fFactory.destroy = function(deleteId){\n return $http.delete('api/v1/musicians/' + deleteId)\n }\n\n return fFactory\n }", "title": "" }, { "docid": "bef4521f0d731e8c30013cb8b0a51bb6", "score": "0.4407728", "text": "function SearchCtrl($mdDialog, $timeout, $q, RelationEventsCategories, FamilyService) {\n var vm = this;\n var id = localStorage.getItem('signedInUserID');\n\n var allNames = [];\n var allRelationsObj = [];\n RelationEventsCategories.getAllEventNames(id).then(function(data) {\n // console.log(data.data);\n //only add unique items to the array\n pushUniqueNames(data.data);\n }).then(function() {\n RelationEventsCategories.getAllCategoryNames(id).then(function(data) {\n //only add unique items to the array\n pushUniqueNames(data.data);\n // console.log(allNames);\n //make array of strings into a string that is comma-separated\n var stringNames = stringify(allNames);\n vm.names = loadAll(stringNames);\n });\n });\n\n function pushUniqueNames(arr) {\n for (var i = 0; i < arr.length; i++) {\n var items = arr;\n // console.log(arr);\n //TODO add error handling if user inserts a null value\n // if (items[i].name === 'undefined') {\n // console.log(items[i]);\n // }\n if (allNames.indexOf(items[i].name) === -1) {\n allNames.push(items[i].name);\n allRelationsObj.push(items[i]);\n }\n }\n }\n\n // list of `name` value/display objects\n vm.querySearch = querySearch;\n // ******************************\n // Template methods\n // ******************************\n vm.cancel = function($event) {\n $mdDialog.cancel();\n };\n vm.find = function($event, term) {\n var filteredArray = [];\n vm.filteredArray = [];\n RelationEventsCategories.getRelationsByEvent(id, term).then(function(data) {\n filteredArray = data.data;\n //find family member with that issue\n findFamilyMember(filteredArray);\n RelationEventsCategories.getRelationsByCategory(id, term).then(function(data) {\n filteredArray = data.data;\n //find family member with that issue\n findFamilyMember(filteredArray);\n });\n });\n };\n\n function findFamilyMember(arr) {\n for (var j = 0; j < arr.length; j++) {\n FamilyService.getFamilyMember(id, arr[j].relation_id).then(function(data) {\n // console.log(data);\n vm.filteredArray.push(data.data[0]);\n });\n }\n }\n\n function querySearch(query) {\n return query ? vm.names.filter(createFilterFor(query)) : vm.names;\n }\n\n /**\n * Create filter function for a query string\n */\n function createFilterFor(query) {\n var lowercaseQuery = angular.lowercase(query);\n return function filterFn(name) {\n return (name.value.indexOf(lowercaseQuery) === 0);\n };\n }\n\n\n\n}", "title": "" }, { "docid": "260b7824b4698e96d58f4637020c15b6", "score": "0.44055095", "text": "function showPerson(theDoer) {\n\n // Pins down where to add the list\n var mainUL = document.getElementById(theDoer),\n \tmainDiv = document.createElement(\"div\");\n\t mainDiv.setAttribute(\"data-role\", \"collapsible-set\");\n\t mainDiv.setAttribute(\"data-inset\", \"false\");\n\n\n // Steps through each store in localStorage\n for (var i=0, j=localStorage.length; i<j; i++) {\n // Gets data fro localStorage back into an object\n var key = localStorage.key(i);\n var value = localStorage.getItem(key);\n var item = JSON.parse(value);\n\n if ((item.who[1] === theDoer) && (item.done[1] === \"Not Yet\")) {\n\n // Creates li for each individual chore\n var choreDiv = document.createElement(\"div\");\n choreDiv.setAttribute(\"data-role\", \"collapsible\");\n\n\n // Itemizes specific data elements of chore\n for (var m in item) {\n\t var itemValue;\n // Creates li for each element of chore\n // changed li to br\n\n if (item[m][0] === \"Chore Name: \") {\n\t var headerItem = document.createElement(\"h4\");\n\t itemValue = item[m][1];\n\t headerItem.innerHTML = itemValue;\n\t choreDiv.appendChild(headerItem);\n } else {\n var newItem = document.createElement(\"p\");\n\t\t\t\t\t\titemValue = item[m][0] + \" \" + item[m][1];\n\t\t\t\t\t\tnewItem.innerHTML = itemValue;\n choreDiv.appendChild(newItem);\n }\n\n }\n mainDiv.appendChild(choreDiv);\n }\n\n mainUL.appendChild(mainDiv);\n\n }\n\n $(document.getElementById(\"theDoer\")).listview('refresh');\n\n }", "title": "" } ]
556307d6c765f9d4108ca2bde1ebdd2a
DIFF FACTS TODO Instead of creating a new diff object, it's possible to just test if there is a diff. During the actual patch, do the diff again and make the modifications directly. This way, there's no new allocations. Worth it?
[ { "docid": "dddcb8a571876b91160184bb2cd617fa", "score": "0.0", "text": "function _VirtualDom_diffFacts(x, y, category)\n{\n\tvar diff;\n\n\t// look for changes and removals\n\tfor (var xKey in x)\n\t{\n\t\tif (xKey === 'a1' || xKey === 'a0' || xKey === 'a3' || xKey === 'a4')\n\t\t{\n\t\t\tvar subDiff = _VirtualDom_diffFacts(x[xKey], y[xKey] || {}, xKey);\n\t\t\tif (subDiff)\n\t\t\t{\n\t\t\t\tdiff = diff || {};\n\t\t\t\tdiff[xKey] = subDiff;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\t// remove if not in the new facts\n\t\tif (!(xKey in y))\n\t\t{\n\t\t\tdiff = diff || {};\n\t\t\tdiff[xKey] =\n\t\t\t\t!category\n\t\t\t\t\t? (typeof x[xKey] === 'string' ? '' : null)\n\t\t\t\t\t:\n\t\t\t\t(category === 'a1')\n\t\t\t\t\t? ''\n\t\t\t\t\t:\n\t\t\t\t(category === 'a0' || category === 'a3')\n\t\t\t\t\t? undefined\n\t\t\t\t\t:\n\t\t\t\t{ f: x[xKey].f, o: undefined };\n\n\t\t\tcontinue;\n\t\t}\n\n\t\tvar xValue = x[xKey];\n\t\tvar yValue = y[xKey];\n\n\t\t// reference equal, so don't worry about it\n\t\tif (xValue === yValue && xKey !== 'value' && xKey !== 'checked'\n\t\t\t|| category === 'a0' && _VirtualDom_equalEvents(xValue, yValue))\n\t\t{\n\t\t\tcontinue;\n\t\t}\n\n\t\tdiff = diff || {};\n\t\tdiff[xKey] = yValue;\n\t}\n\n\t// add new stuff\n\tfor (var yKey in y)\n\t{\n\t\tif (!(yKey in x))\n\t\t{\n\t\t\tdiff = diff || {};\n\t\t\tdiff[yKey] = y[yKey];\n\t\t}\n\t}\n\n\treturn diff;\n}", "title": "" } ]
[ { "docid": "5ad7e24c60f2030dd5875907d9ec846d", "score": "0.7029614", "text": "patch({diff, uuid}, skipCommits){\r\n let prev_started = this._started;\r\n this.commit(true);\r\n this.begin(true, uuid);\r\n this.immutable = this._patch(this.immutable, diff);\r\n this.commit(true, skipCommits);\r\n if(prev_started)\r\n this.begin();\r\n }", "title": "" }, { "docid": "a455a1efb140fdb0ba6631715608ca8c", "score": "0.655357", "text": "function patch(old, diff) {\n var out = [];\n var i = 0;\n while (i < diff.length) {\n if (diff[i]) {\n // matching\n Array.prototype.push.apply(\n out,\n old.slice(out.length, out.length + diff[i])\n );\n }\n i++;\n if (i < diff.length && diff[i]) {\n // mismatching\n Array.prototype.push.apply(out, diff.slice(i + 1, i + 1 + diff[i]));\n i += diff[i];\n }\n i++;\n }\n return out;\n}", "title": "" }, { "docid": "9b529c48208ffcd071e1f0c0f69514bf", "score": "0.65403736", "text": "function Diff() {}", "title": "" }, { "docid": "9b529c48208ffcd071e1f0c0f69514bf", "score": "0.65403736", "text": "function Diff() {}", "title": "" }, { "docid": "9b529c48208ffcd071e1f0c0f69514bf", "score": "0.65403736", "text": "function Diff() {}", "title": "" }, { "docid": "9b529c48208ffcd071e1f0c0f69514bf", "score": "0.65403736", "text": "function Diff() {}", "title": "" }, { "docid": "9b529c48208ffcd071e1f0c0f69514bf", "score": "0.65403736", "text": "function Diff() {}", "title": "" }, { "docid": "9b529c48208ffcd071e1f0c0f69514bf", "score": "0.65403736", "text": "function Diff() {}", "title": "" }, { "docid": "ef59d5837c3e159c97bbc39791d9059c", "score": "0.65293026", "text": "function applyPatch (oldStr, uniDiff) {\n var diffstr = uniDiff.split('\\n');\n var diff = [];\n var remEOFNL = false,\n addEOFNL = false;\n\n // i = 4 in order to skip diff headers.\n for (var i = 4; i < diffstr.length; i++) {\n if(diffstr[i][0] === '@') {\n var meh = diffstr[i].split(/@@ -(\\d+),(\\d+) \\+(\\d+),(\\d+) @@/);\n diff.unshift({\n start:meh[3],\n oldlength:meh[2],\n oldlines:[],\n newlength:meh[4],\n newlines:[]\n });\n } else if(diffstr[i][0] === '+') {\n diff[0].newlines.push(diffstr[i].substr(1));\n } else if(diffstr[i][0] === '-') {\n diff[0].oldlines.push(diffstr[i].substr(1));\n } else if(diffstr[i][0] === ' ') {\n diff[0].newlines.push(diffstr[i].substr(1));\n diff[0].oldlines.push(diffstr[i].substr(1));\n } else if(diffstr[i][0] === '\\\\') {\n if (diffstr[i-1][0] === '+') {\n remEOFNL = true;\n } else if(diffstr[i-1][0] === '-') {\n addEOFNL = true;\n }\n }\n }\n\n var str = oldStr.split('\\n');\n for (i = diff.length - 1; i >= 0; i--) {\n var d = diff[i];\n for (var j = 0; j < d.oldlength; j++) {\n if(str[d.start-1+j] !== d.oldlines[j]) {\n return false;\n }\n }\n Array.prototype.splice.apply(str,[d.start-1,+d.oldlength].concat(d.newlines));\n }\n\n if (remEOFNL) {\n while (!str[str.length-1]) {\n str.pop();\n }\n } else if (addEOFNL) {\n str.push('');\n }\n return str.join('\\n');\n}", "title": "" }, { "docid": "5473dde672ef6f5943942c45b1555b55", "score": "0.6527144", "text": "function patch(old, diff) {\n\tvar out = [];\n\tvar i = 0;\n\twhile (i < diff.length) {\n\t\tif (diff[i]) { // matching\n\t\t\tArray.prototype.push.apply(out, old.slice(out.length, out.length + diff[i]));\n\t\t}\n\t\ti++;\n\t\tif (i < diff.length && diff[i]) { // mismatching\n\t\t\tArray.prototype.push.apply(out, diff.slice(i + 1, i + 1 + diff[i]));\n\t\t\ti += diff[i];\n\t\t}\n\t\ti++;\n\t}\n\treturn out;\n}", "title": "" }, { "docid": "5473dde672ef6f5943942c45b1555b55", "score": "0.6527144", "text": "function patch(old, diff) {\n\tvar out = [];\n\tvar i = 0;\n\twhile (i < diff.length) {\n\t\tif (diff[i]) { // matching\n\t\t\tArray.prototype.push.apply(out, old.slice(out.length, out.length + diff[i]));\n\t\t}\n\t\ti++;\n\t\tif (i < diff.length && diff[i]) { // mismatching\n\t\t\tArray.prototype.push.apply(out, diff.slice(i + 1, i + 1 + diff[i]));\n\t\t\ti += diff[i];\n\t\t}\n\t\ti++;\n\t}\n\treturn out;\n}", "title": "" }, { "docid": "3868832eac4d2aafd38ca400b78c5142", "score": "0.6359276", "text": "function diff_match_patch() { // 43\n // 44\n // Defaults. // 45\n // Redefine these in your program to override the defaults. // 46\n // 47\n // Number of seconds to map a diff before giving up (0 for infinity). // 48\n this.Diff_Timeout = 1.0; // 49\n // Cost of an empty edit operation in terms of edit characters. // 50\n this.Diff_EditCost = 4; // 51\n // At what point is no match declared (0.0 = perfection, 1.0 = very loose). // 52\n this.Match_Threshold = 0.5; // 53\n // How far to search for a match (0 = exact location, 1000+ = broad match). // 54\n // A match this many characters away from the expected location will add // 55\n // 1.0 to the score (0.0 is a perfect match). // 56\n this.Match_Distance = 1000; // 57\n // When deleting a large block of text (over ~64 characters), how close does // 58\n // the contents have to match the expected contents. (0.0 = perfection, // 59\n // 1.0 = very loose). Note that Match_Threshold controls how closely the // 60\n // end points of a delete need to match. // 61\n this.Patch_DeleteThreshold = 0.5; // 62\n // Chunk size for context length. // 63\n this.Patch_Margin = 4; // 64\n // 65\n // The number of bits in an int. // 66\n this.Match_MaxBits = 32; // 67\n} // 68", "title": "" }, { "docid": "3009d7e1b9acfbf9c43fecb58f451ca2", "score": "0.6277647", "text": "function diff_match_patch() {\n\n // Defaults.\n // Redefine these in your program to override the defaults.\n\n // Number of seconds to map a diff before giving up (0 for infinity).\n this.Diff_Timeout = 1.0;\n // Cost of an empty edit operation in terms of edit characters.\n this.Diff_EditCost = 4;\n // At what point is no match declared (0.0 = perfection, 1.0 = very loose).\n this.Match_Threshold = 0.5;\n // How far to search for a match (0 = exact location, 1000+ = broad match).\n // A match this many characters away from the expected location will add\n // 1.0 to the score (0.0 is a perfect match).\n this.Match_Distance = 1000;\n // When deleting a large block of text (over ~64 characters), how close do\n // the contents have to be to match the expected contents. (0.0 = perfection,\n // 1.0 = very loose). Note that Match_Threshold controls how closely the\n // end points of a delete need to match.\n this.Patch_DeleteThreshold = 0.5;\n // Chunk size for context length.\n this.Patch_Margin = 4;\n\n // The number of bits in an int.\n this.Match_MaxBits = 32;\n}", "title": "" }, { "docid": "3009d7e1b9acfbf9c43fecb58f451ca2", "score": "0.6277647", "text": "function diff_match_patch() {\n\n // Defaults.\n // Redefine these in your program to override the defaults.\n\n // Number of seconds to map a diff before giving up (0 for infinity).\n this.Diff_Timeout = 1.0;\n // Cost of an empty edit operation in terms of edit characters.\n this.Diff_EditCost = 4;\n // At what point is no match declared (0.0 = perfection, 1.0 = very loose).\n this.Match_Threshold = 0.5;\n // How far to search for a match (0 = exact location, 1000+ = broad match).\n // A match this many characters away from the expected location will add\n // 1.0 to the score (0.0 is a perfect match).\n this.Match_Distance = 1000;\n // When deleting a large block of text (over ~64 characters), how close do\n // the contents have to be to match the expected contents. (0.0 = perfection,\n // 1.0 = very loose). Note that Match_Threshold controls how closely the\n // end points of a delete need to match.\n this.Patch_DeleteThreshold = 0.5;\n // Chunk size for context length.\n this.Patch_Margin = 4;\n\n // The number of bits in an int.\n this.Match_MaxBits = 32;\n}", "title": "" }, { "docid": "3009d7e1b9acfbf9c43fecb58f451ca2", "score": "0.6277647", "text": "function diff_match_patch() {\n\n // Defaults.\n // Redefine these in your program to override the defaults.\n\n // Number of seconds to map a diff before giving up (0 for infinity).\n this.Diff_Timeout = 1.0;\n // Cost of an empty edit operation in terms of edit characters.\n this.Diff_EditCost = 4;\n // At what point is no match declared (0.0 = perfection, 1.0 = very loose).\n this.Match_Threshold = 0.5;\n // How far to search for a match (0 = exact location, 1000+ = broad match).\n // A match this many characters away from the expected location will add\n // 1.0 to the score (0.0 is a perfect match).\n this.Match_Distance = 1000;\n // When deleting a large block of text (over ~64 characters), how close do\n // the contents have to be to match the expected contents. (0.0 = perfection,\n // 1.0 = very loose). Note that Match_Threshold controls how closely the\n // end points of a delete need to match.\n this.Patch_DeleteThreshold = 0.5;\n // Chunk size for context length.\n this.Patch_Margin = 4;\n\n // The number of bits in an int.\n this.Match_MaxBits = 32;\n}", "title": "" }, { "docid": "3009d7e1b9acfbf9c43fecb58f451ca2", "score": "0.6277647", "text": "function diff_match_patch() {\n\n // Defaults.\n // Redefine these in your program to override the defaults.\n\n // Number of seconds to map a diff before giving up (0 for infinity).\n this.Diff_Timeout = 1.0;\n // Cost of an empty edit operation in terms of edit characters.\n this.Diff_EditCost = 4;\n // At what point is no match declared (0.0 = perfection, 1.0 = very loose).\n this.Match_Threshold = 0.5;\n // How far to search for a match (0 = exact location, 1000+ = broad match).\n // A match this many characters away from the expected location will add\n // 1.0 to the score (0.0 is a perfect match).\n this.Match_Distance = 1000;\n // When deleting a large block of text (over ~64 characters), how close do\n // the contents have to be to match the expected contents. (0.0 = perfection,\n // 1.0 = very loose). Note that Match_Threshold controls how closely the\n // end points of a delete need to match.\n this.Patch_DeleteThreshold = 0.5;\n // Chunk size for context length.\n this.Patch_Margin = 4;\n\n // The number of bits in an int.\n this.Match_MaxBits = 32;\n}", "title": "" }, { "docid": "3009d7e1b9acfbf9c43fecb58f451ca2", "score": "0.6277647", "text": "function diff_match_patch() {\n\n // Defaults.\n // Redefine these in your program to override the defaults.\n\n // Number of seconds to map a diff before giving up (0 for infinity).\n this.Diff_Timeout = 1.0;\n // Cost of an empty edit operation in terms of edit characters.\n this.Diff_EditCost = 4;\n // At what point is no match declared (0.0 = perfection, 1.0 = very loose).\n this.Match_Threshold = 0.5;\n // How far to search for a match (0 = exact location, 1000+ = broad match).\n // A match this many characters away from the expected location will add\n // 1.0 to the score (0.0 is a perfect match).\n this.Match_Distance = 1000;\n // When deleting a large block of text (over ~64 characters), how close do\n // the contents have to be to match the expected contents. (0.0 = perfection,\n // 1.0 = very loose). Note that Match_Threshold controls how closely the\n // end points of a delete need to match.\n this.Patch_DeleteThreshold = 0.5;\n // Chunk size for context length.\n this.Patch_Margin = 4;\n\n // The number of bits in an int.\n this.Match_MaxBits = 32;\n}", "title": "" }, { "docid": "3009d7e1b9acfbf9c43fecb58f451ca2", "score": "0.6277647", "text": "function diff_match_patch() {\n\n // Defaults.\n // Redefine these in your program to override the defaults.\n\n // Number of seconds to map a diff before giving up (0 for infinity).\n this.Diff_Timeout = 1.0;\n // Cost of an empty edit operation in terms of edit characters.\n this.Diff_EditCost = 4;\n // At what point is no match declared (0.0 = perfection, 1.0 = very loose).\n this.Match_Threshold = 0.5;\n // How far to search for a match (0 = exact location, 1000+ = broad match).\n // A match this many characters away from the expected location will add\n // 1.0 to the score (0.0 is a perfect match).\n this.Match_Distance = 1000;\n // When deleting a large block of text (over ~64 characters), how close do\n // the contents have to be to match the expected contents. (0.0 = perfection,\n // 1.0 = very loose). Note that Match_Threshold controls how closely the\n // end points of a delete need to match.\n this.Patch_DeleteThreshold = 0.5;\n // Chunk size for context length.\n this.Patch_Margin = 4;\n\n // The number of bits in an int.\n this.Match_MaxBits = 32;\n}", "title": "" }, { "docid": "cf7859a9d6bec67036498fc0208ab7be", "score": "0.62686545", "text": "function diff_match_patch() {\n\n // Defaults.\n // Redefine these in your program to override the defaults.\n\n // Number of seconds to map a diff before giving up (0 for infinity).\n this.Diff_Timeout = 1.0;\n // Cost of an empty edit operation in terms of edit characters.\n this.Diff_EditCost = 4;\n // At what point is no match declared (0.0 = perfection, 1.0 = very loose).\n this.Match_Threshold = 0.5;\n // How far to search for a match (0 = exact location, 1000+ = broad match).\n // A match this many characters away from the expected location will add\n // 1.0 to the score (0.0 is a perfect match).\n this.Match_Distance = 1000;\n // When deleting a large block of text (over ~64 characters), how close does\n // the contents have to match the expected contents. (0.0 = perfection,\n // 1.0 = very loose). Note that Match_Threshold controls how closely the\n // end points of a delete need to match.\n this.Patch_DeleteThreshold = 0.5;\n // Chunk size for context length.\n this.Patch_Margin = 4;\n\n // The number of bits in an int.\n this.Match_MaxBits = 32;\n}", "title": "" }, { "docid": "201e5b01f09889425efdb176dba67f79", "score": "0.62294775", "text": "function patch (entityId, prev, next, el) {\n\t return diffNode('0', entityId, prev, next, el)\n\t }", "title": "" }, { "docid": "8e5642ff8d402ee0074420369302c9c1", "score": "0.6216772", "text": "function makeDIFF(response, cb) {\n if (response.oldValue != undefined && response.newValue != undefined) {\n var dd = new DiffDOM({\n valueDiffing: false // does not take into account user input\n });\n \n var diff = {};\n console.log(\"Response: \", response);\n\n // replace whitespace and newline before diff\n var oldValue = JSON.stringify(response.oldValue).replace(/(?:\\\\[rn]|[\\r\\n]+)+/g, \"\");\n var newValue = JSON.stringify(response.newValue).replace(/(?:\\\\[rn]|[\\r\\n]+)+/g, \"\");\n \n diff = dd.diff(stringToObj(oldValue), stringToObj(newValue));\n console.log(diff);\n \n cb(diff);\n }\n}", "title": "" }, { "docid": "1025fa8a6aaf6c0f80b5ed70560ae88f", "score": "0.612845", "text": "static _applyChanges(params) {\n var { oldWrapper, newWrapper, diffs, eventId } = params;\n var childrenDiffs = {};\n\n for(var i = 0, ii = diffs.length; i < ii; i++) {\n var path = diffs[i].path.slice();\n\n if (path.length > 1) {\n // Diff is not applicable at this level, we simply pass the diffs onto the next level\n // bucketted by the keys of the nested children so that all diffs of a common node are applied once.\n let childKey = path.shift();\n diffs[i].path = path;\n if (childrenDiffs[childKey]) {\n childrenDiffs[childKey].push(diffs[i]);\n } else {\n childrenDiffs[childKey] = [diffs[i]];\n }\n } else if(path.length === 1) {\n let { action, value } = diffs[i];\n var key = diffs[i].path[0];\n\n if (action === 'add' && ImmutableWrapper.__isArray(newWrapper.__value)) {\n // -1 means end of array, whatever the index is right now\n if (key === -1) {\n key = newWrapper.__value.length;\n }\n\n newWrapper.__value.splice(key, 0, value);\n newWrapper.__wrappers.splice(key, 0, new ImmutableWrapper({\n value: value,\n path: oldWrapper.__path.concat(key),\n eventId: eventId\n }));\n } else if(action === 'delete') {\n if (ImmutableWrapper.__isObject(newWrapper.__value)) {\n delete newWrapper.__value[key];\n delete newWrapper.__wrappers[key];\n delete newWrapper[key];\n }\n else if(ImmutableWrapper.__isArray(newWrapper.__value)) {\n var index = 0;\n if (key === -1) {\n index = newWrapper.__value.length - 1;\n } else if (diffs[i].force) {\n index = key;\n } else {\n // Since the it's possible element already got rearrange.\n // The only signature that's not changed is the __path, so we\n // go by the index of the element that match the path specified in diff.\n\n index = newWrapper.findIndex(function(wrapper) {\n return wrapper.__path[wrapper.__path.length - 1] === key;\n });\n }\n\n newWrapper.__value.splice(index, 1);\n newWrapper.__wrappers.splice(index, 1);\n }\n } else {\n // Update action\n newWrapper.__value[key] = value;\n newWrapper.__wrappers[key] = new ImmutableWrapper({\n value: value,\n path: oldWrapper.__path.concat(key),\n eventId: eventId\n });\n newWrapper[key] = newWrapper.__wrappers[key];\n }\n } else {\n // This only occurs when setting primitive value or destroy() at the root level\n if (diffs[i].action == 'delete') {\n // remove all nested wrapper references\n for(var key in newWrapper.__wrappers) {\n delete newWrapper[key];\n }\n delete newWrapper.__value;\n delete newWrapper.__wrappers;\n return [];\n } else {\n newWrapper.__value = diffs[i].value;\n }\n }\n }\n\n // Only run this if current array changes length\n if(ImmutableWrapper.__isArray(newWrapper.__value)) {\n // Reorder indices and set path to new value.\n // This needs to be recursive for all nested wrappers.\n for(var j = 0, jj = newWrapper.__wrappers.length; j < jj; j++) {\n this._updateWrapperPath({\n newWrapper: newWrapper.__wrappers[j],\n updatedIndex: j,\n updatedPathIndex: newWrapper.__path.length\n });\n\n newWrapper[j] = newWrapper.__wrappers[j];\n }\n\n // Remove extranous elements since we may already remove from array\n while (newWrapper[j]){\n delete newWrapper[j];\n j += 1;\n }\n }\n\n return childrenDiffs;\n }", "title": "" }, { "docid": "3f630202c7780a186a6cac4da410ae05", "score": "0.60908926", "text": "function diffApply(diff, obj, conflictResolveFn){\n return deepExtend(obj , diff, conflictResolveFn);\n}", "title": "" }, { "docid": "0c3f204bed3362dd820d3a495271cc79", "score": "0.60835457", "text": "function diff(hljs) {\n return {\n name: 'Diff',\n aliases: ['patch'],\n contains: [\n {\n className: 'meta',\n relevance: 10,\n variants: [\n {\n begin: /^@@ +-\\d+,\\d+ +\\+\\d+,\\d+ +@@/\n },\n {\n begin: /^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$/\n },\n {\n begin: /^--- +\\d+,\\d+ +----$/\n }\n ]\n },\n {\n className: 'comment',\n variants: [\n {\n begin: /Index: /,\n end: /$/\n },\n {\n begin: /^index/,\n end: /$/\n },\n {\n begin: /={3,}/,\n end: /$/\n },\n {\n begin: /^-{3}/,\n end: /$/\n },\n {\n begin: /^\\*{3} /,\n end: /$/\n },\n {\n begin: /^\\+{3}/,\n end: /$/\n },\n {\n begin: /^\\*{15}$/\n },\n {\n begin: /^diff --git/,\n end: /$/\n }\n ]\n },\n {\n className: 'addition',\n begin: /^\\+/,\n end: /$/\n },\n {\n className: 'deletion',\n begin: /^-/,\n end: /$/\n },\n {\n className: 'addition',\n begin: /^!/,\n end: /$/\n }\n ]\n };\n}", "title": "" }, { "docid": "0c3f204bed3362dd820d3a495271cc79", "score": "0.60835457", "text": "function diff(hljs) {\n return {\n name: 'Diff',\n aliases: ['patch'],\n contains: [\n {\n className: 'meta',\n relevance: 10,\n variants: [\n {\n begin: /^@@ +-\\d+,\\d+ +\\+\\d+,\\d+ +@@/\n },\n {\n begin: /^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$/\n },\n {\n begin: /^--- +\\d+,\\d+ +----$/\n }\n ]\n },\n {\n className: 'comment',\n variants: [\n {\n begin: /Index: /,\n end: /$/\n },\n {\n begin: /^index/,\n end: /$/\n },\n {\n begin: /={3,}/,\n end: /$/\n },\n {\n begin: /^-{3}/,\n end: /$/\n },\n {\n begin: /^\\*{3} /,\n end: /$/\n },\n {\n begin: /^\\+{3}/,\n end: /$/\n },\n {\n begin: /^\\*{15}$/\n },\n {\n begin: /^diff --git/,\n end: /$/\n }\n ]\n },\n {\n className: 'addition',\n begin: /^\\+/,\n end: /$/\n },\n {\n className: 'deletion',\n begin: /^-/,\n end: /$/\n },\n {\n className: 'addition',\n begin: /^!/,\n end: /$/\n }\n ]\n };\n}", "title": "" }, { "docid": "3c6a2a09d0ffe11e1e3ec90202e64b25", "score": "0.60759884", "text": "function patch (entityId, prev, next, el) {\n return diffNode('0', entityId, prev, next, el)\n }", "title": "" }, { "docid": "2e27aa3056480e5c2ee28cd7a8970e0d", "score": "0.60610855", "text": "function diff(hljs) {\n return {\n name: 'Diff',\n aliases: ['patch'],\n contains: [\n {\n className: 'meta',\n relevance: 10,\n variants: [\n {begin: /^@@ +\\-\\d+,\\d+ +\\+\\d+,\\d+ +@@$/},\n {begin: /^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$/},\n {begin: /^\\-\\-\\- +\\d+,\\d+ +\\-\\-\\-\\-$/}\n ]\n },\n {\n className: 'comment',\n variants: [\n {begin: /Index: /, end: /$/},\n {begin: /={3,}/, end: /$/},\n {begin: /^\\-{3}/, end: /$/},\n {begin: /^\\*{3} /, end: /$/},\n {begin: /^\\+{3}/, end: /$/},\n {begin: /^\\*{15}$/ }\n ]\n },\n {\n className: 'addition',\n begin: '^\\\\+', end: '$'\n },\n {\n className: 'deletion',\n begin: '^\\\\-', end: '$'\n },\n {\n className: 'addition',\n begin: '^\\\\!', end: '$'\n }\n ]\n };\n}", "title": "" }, { "docid": "2e27aa3056480e5c2ee28cd7a8970e0d", "score": "0.60610855", "text": "function diff(hljs) {\n return {\n name: 'Diff',\n aliases: ['patch'],\n contains: [\n {\n className: 'meta',\n relevance: 10,\n variants: [\n {begin: /^@@ +\\-\\d+,\\d+ +\\+\\d+,\\d+ +@@$/},\n {begin: /^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$/},\n {begin: /^\\-\\-\\- +\\d+,\\d+ +\\-\\-\\-\\-$/}\n ]\n },\n {\n className: 'comment',\n variants: [\n {begin: /Index: /, end: /$/},\n {begin: /={3,}/, end: /$/},\n {begin: /^\\-{3}/, end: /$/},\n {begin: /^\\*{3} /, end: /$/},\n {begin: /^\\+{3}/, end: /$/},\n {begin: /^\\*{15}$/ }\n ]\n },\n {\n className: 'addition',\n begin: '^\\\\+', end: '$'\n },\n {\n className: 'deletion',\n begin: '^\\\\-', end: '$'\n },\n {\n className: 'addition',\n begin: '^\\\\!', end: '$'\n }\n ]\n };\n}", "title": "" }, { "docid": "74ebe57919d674f298bc21e35088d0bb", "score": "0.601527", "text": "function iop<A, B>(\n t: Test,\n input: A,\n output: B,\n patch: Patch<A | B>,\n message: string,\n): void {\n const createResult = createPatch<A | B>(input, output);\n t.same(createResult, patch, `${message} (verify diff)`);\n\n const applyResult = applyPatch(input, patch);\n if (createResult) {\n t.same(applyResult, output, `${message} (verify patch)`);\n } else {\n identical(t, applyResult, input, `${message} (verify patch)`);\n }\n}", "title": "" }, { "docid": "661a24216c2172a8ef4b89babcd9c5fd", "score": "0.6004936", "text": "function patch (diff) {\n return patchResource(serviceResource, ['remove'])(diff)\n .chain(() => {\n return Future.parallel(2, [\n patchResource(networkResource, ['create', 'update', 'remove'])(diff),\n patchResource(volumeResource, ['create', 'update', 'remove'])(diff)\n ])\n })\n .chain(() => {\n return patchResource(serviceResource, ['create', 'update'])(diff)\n })\n }", "title": "" }, { "docid": "7933439160706ee6a0eac6864a957361", "score": "0.60043764", "text": "_diff(){\t\t\n\t\tvar text1 = this.currentContribution > 0 ? this.contributions[this.currentContribution - 1].content :'';\n\t\tvar text2 = this.contributions[this.currentContribution].content;\n\t\t\n\t\tvar author = this.contributions[this.currentContribution].user;\n\t\tvar soundEffect = this._getSoundEffect(author.id);\t\t\n\t\t\n\t\tvar dmp = new diff_match_patch();\n \tvar d = dmp.diff_main(text1, text2, false);\n \tdmp.diff_cleanupSemantic(d);\n \t\n \t\n \tthis._talkContribution(soundEffect,author);\n \t\n \t\n \treturn dmp.diff_prettyHtml(d,soundEffect.color);\n }", "title": "" }, { "docid": "a27e3a5fc32d2476aae7bea2a0a6e705", "score": "0.59656024", "text": "function mergediff(orig_data, new_data) {\n var diff = {needUpdate:false, data:{}};\n var diff_data = diff.data;\n\n for (var key in new_data) {\n if (!orig_data.hasOwnProperty(key)\n || JSON.stringify(orig_data[key])!== JSON.stringify(new_data[key])) {\n diff.needUpdate = true;\n orig_data[key] = new_data[key];\n diff_data[key] = new_data[key];\n }\n }\n\n if (Object.keys(orig_data).length > 50) {\n var ordered = Object.keys(orig_data).sort();\n var delNum = ordered.length - 50;\n for (var i = 0; i < delNum; i++) {\n delete orig_data[ordered[i]];\n }\n }\n return diff;\n}", "title": "" }, { "docid": "d79eb0879aa4908333c2445ff5ebd4ae", "score": "0.5923293", "text": "function patchResponse(patchResponse, responseToChange) {\n return Promise.all([patchResponse.arrayBuffer(), responseToChange.arrayBuffer()]).then(([deltaArrayBuffer, sourceArrayBuffer]) => {\n const delta = new Uint8Array(deltaArrayBuffer);\n const source = new Uint8Array(sourceArrayBuffer);\n\n const updated = vcdiff.decodeSync(delta, source);\n const headers = fetchUtil.cloneHeaders(patchResponse.headers);\n\n if (responseToChange.headers.has('Content-Type')) {\n headers.set('Content-Type', responseToChange.headers.get('Content-Type'));\n }\n\n // discard delta headers\n headers.delete('Content-Length');\n headers.delete('Delta-Base');\n headers.delete('im');\n\n headers.set('X-Delta-Length', deltaArrayBuffer.byteLength.toString());\n\n return new Response(updated, {\n status: 200,\n statusText: 'OK',\n headers: headers,\n url: patchResponse.url\n });\n });\n}", "title": "" }, { "docid": "842c1edc69162145cb8d681bf3f0264a", "score": "0.59140164", "text": "function formatArrayOrObjectPropDiff(indent, prop, baseValue, patchValue) {\n // First we need to apply the patch to the array or object.\n var testValue = null;\n if (Array.isArray(baseValue)) {\n testValue = [];\n var maxIndex = Math.max.apply(null, [baseValue.length - 1].concat(_toConsumableArray(Object.keys(patchValue).map(function (index) {\n return parseInt(index, 10);\n }))));\n for (var ii = 0; ii <= maxIndex; ++ii) {\n if (ii in patchValue) {\n if (patchValue[ii] !== undefined) {\n testValue.push(patchValue[ii]);\n }\n } else {\n testValue.push(baseValue[ii]);\n }\n }\n } else {\n testValue = _extends({}, baseValue); // Clone baseValue.\n for (var _key2 in patchValue) {\n if (patchValue[_key2] === undefined) {\n delete testValue[_key2];\n } else {\n testValue[_key2] = patchValue[_key2];\n }\n }\n }\n\n // Then diff the serialized values.\n var diffs = (0, _diff.diffLines)(serializeArrayOrObject(baseValue), serializeArrayOrObject(testValue));\n\n // And format the diff data structure as a string.\n var subIndent = indent + ' ';\n var diffsString = diffs.map(function (_ref) {\n var added = _ref.added,\n removed = _ref.removed,\n value = _ref.value;\n\n var lines = value.replace(/[\\r\\n]*$/, '').split('\\n');\n if (added || removed) {\n return lines.map(function (line) {\n return '' + (added ? '+ ' : '- ') + subIndent + line;\n }).join('\\n');\n } else if (lines.length <= 2) {\n return lines.map(function (line) {\n return ' ' + subIndent + line;\n }).join('\\n');\n } else {\n return ' ' + subIndent + lines[0] + '\\n' + subIndent + ' \\u2026\\n ' + subIndent + lines[lines.length - 1];\n }\n }).join('\\n');\n\n return [formatLines(' ', indent + ' ', prop + '={'), diffsString, formatLines(' ', indent + ' ', '}')].join('\\n');\n}", "title": "" }, { "docid": "8197cfc6bc18ee0dae304a1fe3b23da3", "score": "0.5866281", "text": "function diff(reference, string) {\n var diff_obj = new diff_match_patch();\n var diff = diff_obj.diff_main(reference, string);\n var output = '';\n\n diff_obj.diff_cleanupSemantic(diff);\n diff_obj.diff_cleanupEfficiency(diff);\n\n $.each(diff, function () {\n var type = this[0];\n var slice = this[1];\n\n switch (type) {\n case DIFF_INSERT:\n output += '<ins>' + markPlaceables(slice, false) + '</ins>';\n break;\n\n case DIFF_DELETE:\n output += '<del>' + markPlaceables(slice, false) + '</del>';\n break;\n\n case DIFF_EQUAL:\n output += markPlaceables(slice, false);\n break;\n }\n });\n\n /* Marking of leading/trailing spaces has to be the last step to avoid false positives. */\n return markWhiteSpaces(output);\n }", "title": "" }, { "docid": "6d5670e47cea047537bfaa0de0dc2b1f", "score": "0.5863066", "text": "function applyPatches(uniDiff, options) {\n if (typeof uniDiff === 'string') {\n uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);\n }\n\n var currentIndex = 0;\n function processIndex() {\n var index = uniDiff[currentIndex++];\n if (!index) {\n return options.complete();\n }\n\n options.loadFile(index, function (err, data) {\n if (err) {\n return options.complete(err);\n }\n\n var updatedContent = applyPatch(data, index, options);\n options.patched(index, updatedContent, function (err) {\n if (err) {\n return options.complete(err);\n }\n\n processIndex();\n });\n });\n }\n processIndex();\n}", "title": "" }, { "docid": "704bb72da15a6e96d46eb83eeb282c31", "score": "0.58519924", "text": "function diff(oldTree, newTree) {\n //声明变量patches用来存放补丁的对象\n let patches = {}\n //第一次比较应该是树的第0个索引\n let index = 0\n //递归树 比较过的结果放到补丁里\n walk(oldTree, newTree, index, patches)\n return patches\n}", "title": "" }, { "docid": "36dbbdf4db00645ae4832569acf8dc6f", "score": "0.58445317", "text": "function applyPatches(uniDiff, options) {\n if (typeof uniDiff === 'string') {\n uniDiff = /*istanbul ignore start*/(0, parse.parsePatch) /*istanbul ignore end*/(uniDiff);\n }\n\n var currentIndex = 0;\n function processIndex() {\n var index = uniDiff[currentIndex++];\n if (!index) {\n return options.complete();\n }\n\n options.loadFile(index, function (err, data) {\n if (err) {\n return options.complete(err);\n }\n\n var updatedContent = applyPatch(data, index, options);\n options.patched(index, updatedContent, function (err) {\n if (err) {\n return options.complete(err);\n }\n\n processIndex();\n });\n });\n }\n processIndex();\n}", "title": "" }, { "docid": "36dbbdf4db00645ae4832569acf8dc6f", "score": "0.58445317", "text": "function applyPatches(uniDiff, options) {\n if (typeof uniDiff === 'string') {\n uniDiff = /*istanbul ignore start*/(0, parse.parsePatch) /*istanbul ignore end*/(uniDiff);\n }\n\n var currentIndex = 0;\n function processIndex() {\n var index = uniDiff[currentIndex++];\n if (!index) {\n return options.complete();\n }\n\n options.loadFile(index, function (err, data) {\n if (err) {\n return options.complete(err);\n }\n\n var updatedContent = applyPatch(data, index, options);\n options.patched(index, updatedContent, function (err) {\n if (err) {\n return options.complete(err);\n }\n\n processIndex();\n });\n });\n }\n processIndex();\n}", "title": "" }, { "docid": "36dbbdf4db00645ae4832569acf8dc6f", "score": "0.58445317", "text": "function applyPatches(uniDiff, options) {\n if (typeof uniDiff === 'string') {\n uniDiff = /*istanbul ignore start*/(0, parse.parsePatch) /*istanbul ignore end*/(uniDiff);\n }\n\n var currentIndex = 0;\n function processIndex() {\n var index = uniDiff[currentIndex++];\n if (!index) {\n return options.complete();\n }\n\n options.loadFile(index, function (err, data) {\n if (err) {\n return options.complete(err);\n }\n\n var updatedContent = applyPatch(data, index, options);\n options.patched(index, updatedContent, function (err) {\n if (err) {\n return options.complete(err);\n }\n\n processIndex();\n });\n });\n }\n processIndex();\n}", "title": "" }, { "docid": "36dbbdf4db00645ae4832569acf8dc6f", "score": "0.58445317", "text": "function applyPatches(uniDiff, options) {\n if (typeof uniDiff === 'string') {\n uniDiff = /*istanbul ignore start*/(0, parse.parsePatch) /*istanbul ignore end*/(uniDiff);\n }\n\n var currentIndex = 0;\n function processIndex() {\n var index = uniDiff[currentIndex++];\n if (!index) {\n return options.complete();\n }\n\n options.loadFile(index, function (err, data) {\n if (err) {\n return options.complete(err);\n }\n\n var updatedContent = applyPatch(data, index, options);\n options.patched(index, updatedContent, function (err) {\n if (err) {\n return options.complete(err);\n }\n\n processIndex();\n });\n });\n }\n processIndex();\n}", "title": "" }, { "docid": "36dbbdf4db00645ae4832569acf8dc6f", "score": "0.58445317", "text": "function applyPatches(uniDiff, options) {\n if (typeof uniDiff === 'string') {\n uniDiff = /*istanbul ignore start*/(0, parse.parsePatch) /*istanbul ignore end*/(uniDiff);\n }\n\n var currentIndex = 0;\n function processIndex() {\n var index = uniDiff[currentIndex++];\n if (!index) {\n return options.complete();\n }\n\n options.loadFile(index, function (err, data) {\n if (err) {\n return options.complete(err);\n }\n\n var updatedContent = applyPatch(data, index, options);\n options.patched(index, updatedContent, function (err) {\n if (err) {\n return options.complete(err);\n }\n\n processIndex();\n });\n });\n }\n processIndex();\n}", "title": "" }, { "docid": "8f188d1d57cd133d12ff7d64d3a01149", "score": "0.57973146", "text": "function applyPatches(uniDiff, options) {\n if (typeof uniDiff === 'string') {\n uniDiff = /*istanbul ignore start*/(0, parse.parsePatch /*istanbul ignore end*/)(uniDiff);\n }\n\n var currentIndex = 0;\n function processIndex() {\n var index = uniDiff[currentIndex++];\n if (!index) {\n return options.complete();\n }\n\n options.loadFile(index, function (err, data) {\n if (err) {\n return options.complete(err);\n }\n\n var updatedContent = applyPatch(data, index, options);\n options.patched(index, updatedContent, function (err) {\n if (err) {\n return options.complete(err);\n }\n\n processIndex();\n });\n });\n }\n processIndex();\n }", "title": "" }, { "docid": "9c07178fecb78b3fe27b0c845a87a7d3", "score": "0.5792569", "text": "function diff(lastVnodesOrPatch, vnodes, parentPath, cnode, nextTransferKeyedVnodes) {\n const lastNext = _extends({}, cnode.next);\n const toInitialize = {};\n const toRemain = {};\n const lastVnodes = lastVnodesOrPatch.filter(lastVnode => lastVnode.action === undefined || lastVnode.action.type !== __WEBPACK_IMPORTED_MODULE_3__constant__[\"PATCH_ACTION_MOVE_FROM\"]);\n\n const result = createPatch(lastVnodes, vnodes, parentPath, cnode, nextTransferKeyedVnodes);\n Object.assign(toInitialize, result.toInitialize);\n Object.assign(toRemain, result.toRemain);\n Object(__WEBPACK_IMPORTED_MODULE_2__util__[\"b\" /* each */])(toRemain, (_, key) => {\n delete lastNext[key];\n });\n\n const lastToDestroyPatch = cnode.toDestroyPatch || {};\n // CAUTION Maybe last patch have not been consumed, so we need to keep its info.\n // `lastToDestroyPatch` contains the real dom reference to remove.\n const toDestroyPatch = _extends({}, lastNext, lastToDestroyPatch);\n\n return { toInitialize, toRemain, toDestroy: lastNext, patch: result.patch, toDestroyPatch };\n}", "title": "" }, { "docid": "e4e94119d1657306108d9abc61379023", "score": "0.57862324", "text": "function generatePatch(patch, find_hit, edit_hit, verify_hit, votes, fields, suggestions, paragraph_index, findFixVerifyOptions) { \r\n\tvar outputPatch = {\r\n\t\tstart: patch.start, // beginning of the identified patch\r\n\t\tend: patch.end,\r\n editStart: patch.start, // beginning of the region that revisions touch -- to be changed later in this function\r\n editEnd: patch.end,\r\n\t\toptions: [],\r\n\t\tparagraph: paragraph_index,\r\n numEditors: 0,\r\n merged: false,\r\n originalText: patch.plaintextSentence() // also to be changed once we know editStart and editEnd\r\n\t}\r\n \r\n if (edit_hit != null) {\r\n\t\tvar edit_hit = mturk.getHIT(edit_hit, true);\r\n outputPatch.numEditors = edit_hit.assignments.length\r\n }\r\n\tif (verify_hit != null) {\r\n\t\tvar verify_hit = mturk.getHIT(verify_hit, true);\r\n }\r\n \r\n if (suggestions != null) {\r\n\t\tforeach(suggestions, function(alternatives, fieldName) {\r\n var editsText = (findFixVerifyOptions.verify.editedTextField == fieldName)\r\n // First we set up the options object to have entries for that field\r\n var fieldOption = {\r\n field: fieldName,\r\n alternatives: [],\r\n editsText: editsText\r\n }\r\n outputPatch.options.push(fieldOption);\r\n \r\n fieldOption.alternatives = getFieldAlternatives(alternatives, fieldName, patch, votes, verify_hit.assignments.length, editsText);\r\n \r\n if (findFixVerifyOptions.verify.mapResults != null) {\r\n findFixVerifyOptions.verify.mapResults(fieldOption);\r\n } \r\n\t\t});\r\n\t} \r\n \r\n fixEditAreas(outputPatch, patch);\r\n return outputPatch;\r\n}", "title": "" }, { "docid": "8d0034b1dc43918e54a3138eea29873f", "score": "0.5758582", "text": "function applyPatches(uniDiff, options) {\n\t if (typeof uniDiff === 'string') {\n\t uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);\n\t }\n\n\t var currentIndex = 0;\n\t function processIndex() {\n\t var index = uniDiff[currentIndex++];\n\t if (!index) {\n\t return options.complete();\n\t }\n\n\t options.loadFile(index, function (err, data) {\n\t if (err) {\n\t return options.complete(err);\n\t }\n\n\t var updatedContent = applyPatch(data, index, options);\n\t options.patched(index, updatedContent, function (err) {\n\t if (err) {\n\t return options.complete(err);\n\t }\n\n\t processIndex();\n\t });\n\t });\n\t }\n\t processIndex();\n\t}", "title": "" }, { "docid": "8d0034b1dc43918e54a3138eea29873f", "score": "0.5758582", "text": "function applyPatches(uniDiff, options) {\n\t if (typeof uniDiff === 'string') {\n\t uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);\n\t }\n\n\t var currentIndex = 0;\n\t function processIndex() {\n\t var index = uniDiff[currentIndex++];\n\t if (!index) {\n\t return options.complete();\n\t }\n\n\t options.loadFile(index, function (err, data) {\n\t if (err) {\n\t return options.complete(err);\n\t }\n\n\t var updatedContent = applyPatch(data, index, options);\n\t options.patched(index, updatedContent, function (err) {\n\t if (err) {\n\t return options.complete(err);\n\t }\n\n\t processIndex();\n\t });\n\t });\n\t }\n\t processIndex();\n\t}", "title": "" }, { "docid": "8d0034b1dc43918e54a3138eea29873f", "score": "0.5758582", "text": "function applyPatches(uniDiff, options) {\n\t if (typeof uniDiff === 'string') {\n\t uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);\n\t }\n\n\t var currentIndex = 0;\n\t function processIndex() {\n\t var index = uniDiff[currentIndex++];\n\t if (!index) {\n\t return options.complete();\n\t }\n\n\t options.loadFile(index, function (err, data) {\n\t if (err) {\n\t return options.complete(err);\n\t }\n\n\t var updatedContent = applyPatch(data, index, options);\n\t options.patched(index, updatedContent, function (err) {\n\t if (err) {\n\t return options.complete(err);\n\t }\n\n\t processIndex();\n\t });\n\t });\n\t }\n\t processIndex();\n\t}", "title": "" }, { "docid": "8d0034b1dc43918e54a3138eea29873f", "score": "0.5758582", "text": "function applyPatches(uniDiff, options) {\n\t if (typeof uniDiff === 'string') {\n\t uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);\n\t }\n\n\t var currentIndex = 0;\n\t function processIndex() {\n\t var index = uniDiff[currentIndex++];\n\t if (!index) {\n\t return options.complete();\n\t }\n\n\t options.loadFile(index, function (err, data) {\n\t if (err) {\n\t return options.complete(err);\n\t }\n\n\t var updatedContent = applyPatch(data, index, options);\n\t options.patched(index, updatedContent, function (err) {\n\t if (err) {\n\t return options.complete(err);\n\t }\n\n\t processIndex();\n\t });\n\t });\n\t }\n\t processIndex();\n\t}", "title": "" }, { "docid": "a43209eaf3d74a1602fcb9df8b1a5f94", "score": "0.5742495", "text": "function diff(params) {\n var cid = params.cid;\n var rData = params.data;\n\n function _diff(left, right) {\n if (!right || !right._hash) return;\n var delta;\n if (right._hash && left && left._hash && right._hash == left._hash) {\n return;\n }\n\n if (right.properties) {\n if (!left) {\n left = {};\n }\n var rProperties = right.properties;\n var lProperties = left.properties;\n if (!lProperties) {\n if (!delta) {\n delta = {};\n }\n if (!delta.properties) {\n delta.properties = _clone(rProperties);\n }\n } else {\n var keys = Object.keys(rProperties);\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var rProp = rProperties[key];\n var lProp = lProperties[key];\n var dProperties;\n var rCid = rProp.cid || cid;\n if (!lProp || lProp.cid < rCid) {\n if (!dProperties) {\n delta = {\n properties: {}\n };\n dProperties = delta.properties;\n }\n dProperties[key] = {\n cid: rCid,\n value: _clone(rProp.value)\n };\n if (rProp.type != dProperties[key].type) {\n dProperties[key].type = rProp.type;\n }\n }\n }\n }\n }\n if (right.children) {\n var rChildren = right.children;\n var lChildren = left.children;\n if (!lChildren) {\n if (!delta) {\n delta = {};\n }\n if (!delta.children) {\n delta.children = _clone(right.children);\n }\n } else {\n var keys = Object.keys(rChildren);\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var rChild = rChildren[key];\n var lChild = lChildren[key];\n if (!lChild) {\n if (!delta) {\n delta = {\n children: {}\n };\n }\n var dChildren = delta.children;\n if (!dChildren) {\n dChildren = {};\n delta.children = dChildren;\n }\n dChildren[key] = rChildren[key];\n } else {\n var cDelta = _diff(lChild, rChild);\n if (cDelta) {\n if (!delta) {\n delta = {\n children: {}\n };\n }\n var dChildren = delta.children;\n if (!dChildren) {\n dChildren = {};\n delta.children = dChildren;\n }\n dChildren[key] = cDelta;\n }\n }\n }\n }\n }\n return delta;\n }\n var delta = _diff(data, rData);\n return delta;\n }", "title": "" }, { "docid": "547deed439390ee61fe73b369384306a", "score": "0.5739964", "text": "function _generate(mirror, obj, patches, path) {\n var newKeys = _objectKeys(obj);\n var oldKeys = _objectKeys(mirror);\n var changed = false;\n var deleted = false;\n //if ever \"move\" operation is implemented here, make sure this test runs OK: \"should not generate the same patch twice (move)\"\n for (var t = oldKeys.length - 1; t >= 0; t--) {\n var key = oldKeys[t];\n var oldVal = mirror[key];\n if (obj.hasOwnProperty(key)) {\n var newVal = obj[key];\n if (typeof oldVal == \"object\" && oldVal != null && typeof newVal == \"object\" && newVal != null) {\n _generate(oldVal, newVal, patches, path + \"/\" + escapePathComponent(key));\n }\n else {\n if (oldVal != newVal) {\n changed = true;\n patches.push({ op: \"replace\", path: path + \"/\" + escapePathComponent(key), value: deepClone(newVal) });\n }\n }\n }\n else {\n patches.push({ op: \"remove\", path: path + \"/\" + escapePathComponent(key) });\n deleted = true; // property has been deleted\n }\n }\n if (!deleted && newKeys.length == oldKeys.length) {\n return;\n }\n for (var t = 0; t < newKeys.length; t++) {\n var key = newKeys[t];\n if (!mirror.hasOwnProperty(key)) {\n patches.push({ op: \"add\", path: path + \"/\" + escapePathComponent(key), value: deepClone(obj[key]) });\n }\n }\n }", "title": "" }, { "docid": "82752948a6aaf94372f7ac39bdaebc49", "score": "0.5720028", "text": "function _generate(mirror, obj, patches, path) {\n var newKeys = _objectKeys(obj);\n\n var oldKeys = _objectKeys(mirror);\n\n var changed = false;\n var deleted = false; //if ever \"move\" operation is implemented here, make sure this test runs OK: \"should not generate the same patch twice (move)\"\n\n for (var t = oldKeys.length - 1; t >= 0; t--) {\n var key = oldKeys[t];\n var oldVal = mirror[key];\n\n if (obj.hasOwnProperty(key)) {\n var newVal = obj[key];\n\n if ((0, _typeof2.default)(oldVal) == \"object\" && oldVal != null && (0, _typeof2.default)(newVal) == \"object\" && newVal != null) {\n _generate(oldVal, newVal, patches, path + \"/\" + escapePathComponent(key));\n } else {\n if (oldVal != newVal) {\n changed = true;\n patches.push({\n op: \"replace\",\n path: path + \"/\" + escapePathComponent(key),\n value: deepClone(newVal)\n });\n }\n }\n } else {\n patches.push({\n op: \"remove\",\n path: path + \"/\" + escapePathComponent(key)\n });\n deleted = true; // property has been deleted\n }\n }\n\n if (!deleted && newKeys.length == oldKeys.length) {\n return;\n }\n\n for (var t = 0; t < newKeys.length; t++) {\n var key = newKeys[t];\n\n if (!mirror.hasOwnProperty(key)) {\n patches.push({\n op: \"add\",\n path: path + \"/\" + escapePathComponent(key),\n value: deepClone(obj[key])\n });\n }\n }\n }", "title": "" }, { "docid": "1f126d487464aa181b48c0638f100363", "score": "0.5714624", "text": "function _generate(mirror, obj, patches, path) {\n if (obj === mirror) {\n return;\n }\n if (typeof obj.toJSON === \"function\") {\n obj = obj.toJSON();\n }\n var newKeys = _objectKeys(obj);\n var oldKeys = _objectKeys(mirror);\n var changed = false;\n var deleted = false;\n //if ever \"move\" operation is implemented here, make sure this test runs OK: \"should not generate the same patch twice (move)\"\n for (var t = oldKeys.length - 1; t >= 0; t--) {\n var key = oldKeys[t];\n var oldVal = mirror[key];\n if (obj.hasOwnProperty(key) && !(obj[key] === undefined && oldVal !== undefined && _isArray(obj) === false)) {\n var newVal = obj[key];\n if (typeof oldVal == \"object\" && oldVal != null && typeof newVal == \"object\" && newVal != null) {\n _generate(oldVal, newVal, patches, path + \"/\" + escapePathComponent(key));\n }\n else {\n if (oldVal !== newVal) {\n changed = true;\n patches.push({ op: \"replace\", path: path + \"/\" + escapePathComponent(key), value: deepClone(newVal) });\n }\n }\n }\n else {\n patches.push({ op: \"remove\", path: path + \"/\" + escapePathComponent(key) });\n deleted = true; // property has been deleted\n }\n }\n if (!deleted && newKeys.length == oldKeys.length) {\n return;\n }\n for (var t = 0; t < newKeys.length; t++) {\n var key = newKeys[t];\n if (!mirror.hasOwnProperty(key) && obj[key] !== undefined) {\n patches.push({ op: \"add\", path: path + \"/\" + escapePathComponent(key), value: deepClone(obj[key]) });\n }\n }\n }", "title": "" }, { "docid": "63cfd02da015e635f796f0c8bf787ba0", "score": "0.5709831", "text": "beforeApplyUpdate() {\n /*\n * Stop watching for any updates. If there are still status updates\n * pending, render() will re-register for updates.\n */\n this.model.stopWatchingUpdates();\n\n /*\n * Store any diff fragments for the reload, so we don't have to\n * fetch them again from the server.\n */\n const diffFragmentQueue = RB.PageManager.getPage().diffFragmentQueue;\n const diffCommentsData = this.model.get('diffCommentsData') || [];\n\n for (let i = 0; i < diffCommentsData.length; i++) {\n diffFragmentQueue.saveFragment(diffCommentsData[i][0]);\n }\n }", "title": "" }, { "docid": "5d5a91abb4ed247afd96963f8eaa4730", "score": "0.57093287", "text": "function _generate(mirror, obj, patches, path) {\n\t var newKeys = _objectKeys(obj);\n\t var oldKeys = _objectKeys(mirror);\n\t var changed = false;\n\t var deleted = false;\n\t //if ever \"move\" operation is implemented here, make sure this test runs OK: \"should not generate the same patch twice (move)\"\n\t for (var t = oldKeys.length - 1; t >= 0; t--) {\n\t var key = oldKeys[t];\n\t var oldVal = mirror[key];\n\t if (obj.hasOwnProperty(key)) {\n\t var newVal = obj[key];\n\t if (typeof oldVal == \"object\" && oldVal != null && typeof newVal == \"object\" && newVal != null) {\n\t _generate(oldVal, newVal, patches, path + \"/\" + escapePathComponent(key));\n\t }\n\t else {\n\t if (oldVal != newVal) {\n\t changed = true;\n\t patches.push({ op: \"replace\", path: path + \"/\" + escapePathComponent(key), value: deepClone(newVal) });\n\t }\n\t }\n\t }\n\t else {\n\t patches.push({ op: \"remove\", path: path + \"/\" + escapePathComponent(key) });\n\t deleted = true; // property has been deleted\n\t }\n\t }\n\t if (!deleted && newKeys.length == oldKeys.length) {\n\t return;\n\t }\n\t for (var t = 0; t < newKeys.length; t++) {\n\t var key = newKeys[t];\n\t if (!mirror.hasOwnProperty(key)) {\n\t patches.push({ op: \"add\", path: path + \"/\" + escapePathComponent(key), value: deepClone(obj[key]) });\n\t }\n\t }\n\t }", "title": "" }, { "docid": "6f28df8b3b6c3b61b3d4abb1563c0687", "score": "0.57076615", "text": "function _generate(mirror, obj, patches, path) {\r\n if (obj === mirror) {\r\n return;\r\n }\r\n if (typeof obj.toJSON === \"function\") {\r\n obj = obj.toJSON();\r\n }\r\n var newKeys = helpers_1._objectKeys(obj);\r\n var oldKeys = helpers_1._objectKeys(mirror);\r\n var changed = false;\r\n var deleted = false;\r\n //if ever \"move\" operation is implemented here, make sure this test runs OK: \"should not generate the same patch twice (move)\"\r\n for (var t = oldKeys.length - 1; t >= 0; t--) {\r\n var key = oldKeys[t];\r\n var oldVal = mirror[key];\r\n if (obj.hasOwnProperty(key) && !(obj[key] === undefined && oldVal !== undefined && Array.isArray(obj) === false)) {\r\n var newVal = obj[key];\r\n if (typeof oldVal == \"object\" && oldVal != null && typeof newVal == \"object\" && newVal != null) {\r\n _generate(oldVal, newVal, patches, path + \"/\" + helpers_1.escapePathComponent(key));\r\n }\r\n else {\r\n if (oldVal !== newVal) {\r\n changed = true;\r\n patches.push({ op: \"replace\", path: path + \"/\" + helpers_1.escapePathComponent(key), value: helpers_1._deepClone(newVal) });\r\n }\r\n }\r\n }\r\n else {\r\n patches.push({ op: \"remove\", path: path + \"/\" + helpers_1.escapePathComponent(key) });\r\n deleted = true; // property has been deleted\r\n }\r\n }\r\n if (!deleted && newKeys.length == oldKeys.length) {\r\n return;\r\n }\r\n for (var t = 0; t < newKeys.length; t++) {\r\n var key = newKeys[t];\r\n if (!mirror.hasOwnProperty(key) && obj[key] !== undefined) {\r\n patches.push({ op: \"add\", path: path + \"/\" + helpers_1.escapePathComponent(key), value: helpers_1._deepClone(obj[key]) });\r\n }\r\n }\r\n}", "title": "" }, { "docid": "63a9c47ae75e1e08ee6cac38bf1305de", "score": "0.57017493", "text": "function _generate(mirror, obj, patches, path) {\n var newKeys = _objectKeys(obj);\n var oldKeys = _objectKeys(mirror);\n var changed = false;\n var deleted = false;\n //if ever \"move\" operation is implemented here, make sure this test runs OK: \"should not generate the same patch twice (move)\"\n for (var t = oldKeys.length - 1; t >= 0; t--) {\n var key = oldKeys[t];\n var oldVal = mirror[key];\n if (obj.hasOwnProperty(key)) {\n var newVal = obj[key];\n if ((typeof oldVal === 'undefined' ? 'undefined' : _typeof(oldVal)) == \"object\" && oldVal != null && (typeof newVal === 'undefined' ? 'undefined' : _typeof(newVal)) == \"object\" && newVal != null) {\n _generate(oldVal, newVal, patches, path + \"/\" + escapePathComponent(key));\n } else {\n if (oldVal != newVal) {\n changed = true;\n patches.push({ op: \"replace\", path: path + \"/\" + escapePathComponent(key), value: deepClone(newVal) });\n }\n }\n } else {\n patches.push({ op: \"remove\", path: path + \"/\" + escapePathComponent(key) });\n deleted = true; // property has been deleted\n }\n }\n if (!deleted && newKeys.length == oldKeys.length) {\n return;\n }\n for (var t = 0; t < newKeys.length; t++) {\n var key = newKeys[t];\n if (!mirror.hasOwnProperty(key)) {\n patches.push({ op: \"add\", path: path + \"/\" + escapePathComponent(key), value: deepClone(obj[key]) });\n }\n }\n }", "title": "" }, { "docid": "1b873faf6e9cc91b138c84950a84d2a2", "score": "0.5693423", "text": "function getDiffHTML(diff, ignoreList, header) {\n var isAddedFeature = diff['changeType'].added === 'added';\n\n var root = elt('table', { class: 'cmap-diff-table' });\n if (isAddedFeature) {\n root.style.width = '300px';\n }\n\n if (header) {\n root.appendChild(\n elt('thead', {},\n elt('tr', {},\n elt('td', { colspan: isAddedFeature ? '2' : '3', class: 'cmap-table-head'}, header)\n )\n )\n )\n }\n\n var tbody = elt('tbody');\n\n var types = ['added', 'deleted', 'modifiedOld', 'modifiedNew', 'unchanged'];\n var sortedProps = Object.keys(diff).sort(function(keyA, keyB) {\n var indexA = types.indexOf(Object.keys(diff[keyA])[0]);\n var indexB = types.indexOf(Object.keys(diff[keyB])[0]);\n return (indexA - indexB);\n });\n\n sortedProps.forEach(function(prop) {\n if (ignoreList.indexOf(prop) === -1) {\n var tr = elt('tr');\n\n var th = elt('th', { title: prop, class: 'cmap-strong' }, prop);\n tr.appendChild(th);\n\n types.forEach(function(type) {\n if (diff[prop].hasOwnProperty(type)) {\n var propClass = 'diff-property cmap-scroll-styled props-diff-' + type;\n if (type == 'added' && !isAddedFeature) {\n var empty = elt('td', { class: propClass });\n tr.appendChild(empty);\n }\n\n var td = elt('td', { class: propClass }, diff[prop][type]);\n tr.appendChild(td);\n\n if (type == 'deleted') {\n var empty = elt('td', { class: propClass });\n tr.appendChild(empty);\n }\n\n if (type == 'unchanged') {\n tr.appendChild(td.cloneNode(true));\n }\n }\n });\n\n tbody.appendChild(tr);\n }\n });\n\n root.appendChild(tbody);\n\n return root;\n}", "title": "" }, { "docid": "78c7a5438d6ef4d3acffb2ef773e6475", "score": "0.5691715", "text": "function _generate(mirror, obj, patches, path) {\n\t if (obj === mirror) {\n\t return;\n\t }\n\t if (typeof obj.toJSON === \"function\") {\n\t obj = obj.toJSON();\n\t }\n\t var newKeys = _objectKeys(obj);\n\t var oldKeys = _objectKeys(mirror);\n\t var changed = false;\n\t var deleted = false;\n\t //if ever \"move\" operation is implemented here, make sure this test runs OK: \"should not generate the same patch twice (move)\"\n\t for (var t = oldKeys.length - 1; t >= 0; t--) {\n\t var key = oldKeys[t];\n\t var oldVal = mirror[key];\n\t if (obj.hasOwnProperty(key) && !(obj[key] === undefined && oldVal !== undefined && _isArray(obj) === false)) {\n\t var newVal = obj[key];\n\t if (typeof oldVal == \"object\" && oldVal != null && typeof newVal == \"object\" && newVal != null) {\n\t _generate(oldVal, newVal, patches, path + \"/\" + escapePathComponent(key));\n\t }\n\t else {\n\t if (oldVal !== newVal) {\n\t changed = true;\n\t patches.push({ op: \"replace\", path: path + \"/\" + escapePathComponent(key), value: deepClone(newVal) });\n\t }\n\t }\n\t }\n\t else {\n\t patches.push({ op: \"remove\", path: path + \"/\" + escapePathComponent(key) });\n\t deleted = true; // property has been deleted\n\t }\n\t }\n\t if (!deleted && newKeys.length == oldKeys.length) {\n\t return;\n\t }\n\t for (var t = 0; t < newKeys.length; t++) {\n\t var key = newKeys[t];\n\t if (!mirror.hasOwnProperty(key) && obj[key] !== undefined) {\n\t patches.push({ op: \"add\", path: path + \"/\" + escapePathComponent(key), value: deepClone(obj[key]) });\n\t }\n\t }\n\t }", "title": "" }, { "docid": "78c7a5438d6ef4d3acffb2ef773e6475", "score": "0.5691715", "text": "function _generate(mirror, obj, patches, path) {\n\t if (obj === mirror) {\n\t return;\n\t }\n\t if (typeof obj.toJSON === \"function\") {\n\t obj = obj.toJSON();\n\t }\n\t var newKeys = _objectKeys(obj);\n\t var oldKeys = _objectKeys(mirror);\n\t var changed = false;\n\t var deleted = false;\n\t //if ever \"move\" operation is implemented here, make sure this test runs OK: \"should not generate the same patch twice (move)\"\n\t for (var t = oldKeys.length - 1; t >= 0; t--) {\n\t var key = oldKeys[t];\n\t var oldVal = mirror[key];\n\t if (obj.hasOwnProperty(key) && !(obj[key] === undefined && oldVal !== undefined && _isArray(obj) === false)) {\n\t var newVal = obj[key];\n\t if (typeof oldVal == \"object\" && oldVal != null && typeof newVal == \"object\" && newVal != null) {\n\t _generate(oldVal, newVal, patches, path + \"/\" + escapePathComponent(key));\n\t }\n\t else {\n\t if (oldVal !== newVal) {\n\t changed = true;\n\t patches.push({ op: \"replace\", path: path + \"/\" + escapePathComponent(key), value: deepClone(newVal) });\n\t }\n\t }\n\t }\n\t else {\n\t patches.push({ op: \"remove\", path: path + \"/\" + escapePathComponent(key) });\n\t deleted = true; // property has been deleted\n\t }\n\t }\n\t if (!deleted && newKeys.length == oldKeys.length) {\n\t return;\n\t }\n\t for (var t = 0; t < newKeys.length; t++) {\n\t var key = newKeys[t];\n\t if (!mirror.hasOwnProperty(key) && obj[key] !== undefined) {\n\t patches.push({ op: \"add\", path: path + \"/\" + escapePathComponent(key), value: deepClone(obj[key]) });\n\t }\n\t }\n\t }", "title": "" }, { "docid": "fc198361b1f66747ecf730ab61f1e3cc", "score": "0.5679838", "text": "implementPatchOperators(patch, existingPage) {\n const clonedBases = {};\n if (patch.$push) {\n append(patch.$push);\n } else if (patch.$pullAll) {\n _.each(patch.$pullAll, function(val, key) {\n cloneOriginalBase(key);\n self.apos.util.set(patch, key, _.differenceWith(self.apos.util.get(patch, key) || [], Array.isArray(val) ? val : [], function(a, b) {\n return _.isEqual(a, b);\n }));\n });\n } else if (patch.$pullAllById) {\n _.each(patch.$pullAllById, function(val, key) {\n cloneOriginalBase(key);\n if (!Array.isArray(val)) {\n val = [ val ];\n }\n self.apos.util.set(patch, key, _.differenceWith(self.apos.util.get(patch, key) || [], Array.isArray(val) ? val : [], function(a, b) {\n return a._id === b;\n }));\n });\n } else if (patch.$move) {\n _.each(patch.$move, function(val, key) {\n cloneOriginalBase(key);\n if ((val == null) || (!((typeof val) === 'object'))) {\n return;\n }\n const existing = self.apos.util.get(patch, key) || [];\n const index = existing.findIndex(item => item._id === val.$item);\n if (index === -1) {\n return;\n }\n const itemValue = existing[index];\n existing.splice(index, 1);\n if (val.$before) {\n const beforeIndex = existing.findIndex(item => item._id === val.$before);\n if (beforeIndex !== -1) {\n existing.splice(beforeIndex, 0, itemValue);\n } else {\n existing.splice(index, 0, itemValue);\n }\n } else if (val.$after) {\n const afterIndex = existing.findIndex(item => item._id === val.$after);\n if (afterIndex !== -1) {\n existing.splice(afterIndex + 1, 0, itemValue);\n } else {\n existing.splice(index, 0, itemValue);\n }\n } else {\n existing.splice(index, 0, itemValue);\n }\n });\n }\n _.each(patch, function(val, key) {\n if (key.charAt(0) !== '$') {\n let atReference = false;\n if (key.charAt(0) === '@') {\n atReference = key;\n key = self.apos.util.resolveAtReference(existingPage, key);\n if (key && patch[key.split('.')[0]]) {\n // This base has already been cloned into the patch, or it\n // otherwise touches this base, so we need to re-resolve\n // the reference or indexes may be incorrect\n key = self.apos.util.resolveAtReference(patch, atReference);\n }\n }\n // Simple replacement with a dot path\n if (atReference || (key.indexOf('.') !== -1)) {\n cloneOriginalBase(key);\n self.apos.util.set(patch, key, val);\n }\n }\n });\n function append(data) {\n _.each(data, function(val, key) {\n cloneOriginalBase(key);\n if (val && val.$each) {\n const each = Array.isArray(val.$each) ? val.$each : [];\n const existing = self.apos.util.get(patch, key) || [];\n if (!Array.isArray(existing)) {\n throw self.apos.error('invalid', 'existing property is not an array', {\n dotPath: key\n });\n }\n let position;\n if (_.has(val, '$position')) {\n position = self.apos.launder.integer(val.$position);\n if ((position < 0) || (position > existing.length)) {\n position = existing.length;\n }\n } else if (_.has(val, '$before')) {\n position = _.findIndex(existing, item => item._id === val.$before);\n if (position === -1) {\n position = existing.length;\n }\n } else if (_.has(val, '$after')) {\n position = _.findIndex(existing, item => item._id === val.$after);\n if (position === -1) {\n position = existing.length;\n } else {\n // after\n position++;\n }\n } else {\n position = existing.length;\n }\n const updated = existing.slice(0, position).concat(each).concat(existing.slice(position));\n self.apos.util.set(patch, key, updated);\n } else {\n const existing = self.apos.util.get(patch, key) || [];\n existing.push(val);\n self.apos.util.set(patch, key, existing);\n }\n });\n }\n function cloneOriginalBase(key) {\n if (key.charAt(0) === '@') {\n let _id = key.substring(1);\n const dot = _id.indexOf('.');\n if (dot !== -1) {\n _id = _id.substring(0, dot);\n }\n const result = self.apos.util.findNestedObjectAndDotPathById(existingPage, _id, { ignoreDynamicProperties: true });\n if (!result) {\n throw self.apos.error('invalid', {\n '@path': key\n });\n }\n key = result.dotPath;\n }\n if (key.indexOf('.') === -1) {\n // No need, we are replacing the base\n }\n const base = key.split('.')[0];\n if (!clonedBases[base]) {\n if (_.has(existingPage, base)) {\n // We need all the properties, even impermanent ones,\n // because relationships are read-write in 3.x\n patch[base] = klona(existingPage[base]);\n }\n clonedBases[base] = true;\n }\n }\n }", "title": "" }, { "docid": "fa64aa4e4da9e179e39f88b0b463bd8a", "score": "0.5674168", "text": "function generateDiff(str1, str2, options, gitDir) {\n\n var DEFAULTS = require('../../_shared/defaultOptions')\n\n if (typeof gitDir === 'string') {\n gitDir = '--git-dir ' + gitDir\n } else {\n gitDir = ''\n }\n\n // Single quotes is needed here to avoid .. event not found\n var gitHashCmd1 = 'printf ' + JSON.stringify(str1) + ' | git ' + gitDir + ' hash-object -w --stdin'\n var gitHashCmd2 = 'printf ' + JSON.stringify(str2) + ' | git ' + gitDir + ' hash-object -w --stdin'\n\n var gitHashObj1 = exec(gitHashCmd1, {silent: true})\n var gitHashObj2 = exec(gitHashCmd2, {silent: true})\n\n /* istanbul ignore else */\n if (gitHashObj1.code === 0 && gitHashObj2.code === 0) {\n\n var sha1 = gitHashObj1.stdout.replace(CR, '')\n var sha2 = gitHashObj2.stdout.replace(CR, '')\n\n var sha1Test = SHA_REGEX.test(sha1)\n var sha2Test = SHA_REGEX.test(sha2)\n\n /* istanbul ignore else */\n if (sha1Test && sha2Test) {\n\n var diffObj, repeat\n\n do {\n\n var flags = ''\n\n if (options.wordDiff) {\n flags += ' --word-diff'\n }\n\n if (options.color) {\n flags += ' --color=always'\n }\n\n if (options.flags) {\n flags += ' ' + options.flags\n }\n\n var newCommand = 'git ' + gitDir + ' diff ' + sha1 + ' ' + sha2 + flags\n\n diffObj = exec(newCommand, {silent: true})\n\n if (diffObj.code === 129 && diffObj.stderr.indexOf('usage') > -1) {\n logger.warn('Ignoring invalid git diff options: ' + options.flags)\n logger.info('For valid git diff options refer to ' + config.gitDiffOptionsUrl)\n if (options.flags === DEFAULTS.flags) {\n DEFAULTS.flags = null\n }\n options.flags = DEFAULTS.flags\n if (options.flags) {\n logger.info('Using default git diff options: ' + options.flags)\n }\n repeat = true\n } else {\n repeat = false\n }\n } while (repeat)\n\n /* istanbul ignore else */\n if (diffObj.code === 0) {\n\n var diff = diffObj.stdout\n var atat = ATAT_REGEX.exec(diff)\n\n if (atat) {\n diff = diff.substring(atat.index)\n if (options.noHeaders) {\n diff = diff.replace(ATAT_REGEX, '')\n diff = diff.replace(CR, '')\n }\n }\n\n return (diff !== '') ? diff : undefined\n }\n }\n }\n\n /* istanbul ignore next */\n return undefined\n}", "title": "" }, { "docid": "7e7434990e82ba4d3b04cb31cbc5916b", "score": "0.56740195", "text": "function handleRemainLikePatchNode(lastVnode = {}, vnode, actionType, currentPath, cnode, patch, toInitialize, toRemain, nextTransferKeyedVnodes) {\n const patchNode = createPatchNode(lastVnode, vnode, actionType);\n\n if (Object(__WEBPACK_IMPORTED_MODULE_1__common__[\"e\" /* isComponentVnode */])(vnode)) {\n const path = Object(__WEBPACK_IMPORTED_MODULE_1__common__[\"j\" /* vnodePathToString */])(currentPath);\n toRemain[path] = cnode.next[path];\n } else {\n patchNode.patch = diffNodeDetail(lastVnode, vnode);\n if (vnode.children !== undefined) {\n /* eslint-disable no-use-before-define */\n const childDiffResult = diff(lastVnode.children, vnode.children, currentPath, cnode, nextTransferKeyedVnodes);\n /* eslint-enable no-use-before-define */\n Object.assign(toInitialize, childDiffResult.toInitialize);\n Object.assign(toRemain, childDiffResult.toRemain);\n patchNode.children = childDiffResult.patch;\n }\n }\n patch.push(patchNode);\n}", "title": "" }, { "docid": "357c4fc327334f87491a13fa3beb865c", "score": "0.5651093", "text": "_applyObject(target, patch, path, options, level, override) {\n\n if (!(_isObject(target) && _isObject(patch))) {\n debug('invalid apply, target and patch must be objects');\n this.emit('error', new Error('invalid apply, target and patch must be objects'));\n\n return;\n }\n\n if (level > options.maxLevels) {\n debug('Trying to apply too deep, stopping at level %d', level);\n this.emit('error', new Error('Trying to apply too deep, stopping at level ' + level));\n\n return;\n }\n\n let levelDiffs;\n let keys = _keys(patch);\n let length = keys.length;\n let isTargetArray = _isArray(target);\n\n if (options.emitEvents) {\n levelDiffs = DiffTracker.create(isTargetArray && target.length === 0 && _isArray(patch));\n levelDiffs.path = path;\n }\n\n if (isTargetArray) {\n levelDiffs = levelDiffs || {};\n }\n\n if (length > options.maxKeysInLevel) {\n debug('Stopped patching, Too many keys in object - %d out of %d allowed keys.', length, options.maxKeysInLevel);\n this.emit('error', new Error('Stopped patching, Too many keys in object - ' + length + ' out of ' + options.maxKeysInLevel + ' allowed keys.'));\n\n return levelDiffs;\n }\n\n // main logic loop, iterate patch keys and apply to dest object\n for (let i = 0; i < length; i++) {\n let key = keys[i];\n\n if (utils.isValid(patch[key]) && patch[key] !== target[key]) {\n levelDiffs = this._applyAtKey(target, patch, path, key, levelDiffs, options, level, override, isTargetArray);\n }\n }\n\n // override is either undefined, a path or true\n if ((!_isUndefined(override) && (override === true || path.indexOf(override) === 0)) || (options.overrides && (options.overrides[path]))) {\n // find keys at this level that exists at the target object and remove them\n levelDiffs = this._detectDeletionsAtLevel(target, patch, levelDiffs, path, options, isTargetArray, level);\n }\n\n if (options.emitEvents && levelDiffs.hasDifferences) {\n this.emit((path || '*'), levelDiffs, options);\n }\n\n return levelDiffs;\n }", "title": "" }, { "docid": "d60a6fe284cfcd03bad23cbdcbbbb907", "score": "0.56243634", "text": "function initDiff() {\n let zigzag = [];\n let ops = [];\n return function diff(remotes, locals) {\n let rtype = getType(remotes);\n let ltype = getType(locals);\n let keys = null;\n if (rtype === ltype) {\n switch (rtype) {\n case 'Object':\n if (remotes.id === locals.id) {\n keys = Object.keys(remotes);\n keys.splice(keys.indexOf('id'), 1);\n keys.forEach(k => {\n zigzag.push(k);\n diff(remotes[k], locals[k]);\n zigzag.pop();\n });\n } else {\n ops.push({\n path: Object.assign([], zigzag).join('.'),\n action: '$push',\n value: remotes\n });\n }\n\n break;\n case 'Array':\n remotes.forEach(ritem => {\n let litem =\n locals.find(ll => ll.id === ritem.id) || null;\n if (null === litem) {\n ops.push({\n path: Object.assign([], zigzag).join('.'),\n action: '$push',\n value: ritem\n });\n } else {\n diff(ritem, litem);\n }\n });\n break;\n default:\n if (remotes !== locals) {\n ops.push({\n path: Object.assign([], zigzag).join('.'),\n action: '$set',\n value: remotes\n });\n }\n }\n } else {\n ops.push({\n path: Object.assign([], zigzag).join('.'),\n action: '$set',\n value: remotes\n });\n }\n return ops;\n };\n}", "title": "" }, { "docid": "31703ba9430c20dfbe8ac924c957b57f", "score": "0.5604344", "text": "function _generate(mirror, obj, patches, path, invertible) {\n if (obj === mirror) {\n return;\n }\n if (typeof obj.toJSON === \"function\") {\n obj = obj.toJSON();\n }\n var newKeys = Object(_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__[\"_objectKeys\"])(obj);\n var oldKeys = Object(_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__[\"_objectKeys\"])(mirror);\n var changed = false;\n var deleted = false;\n //if ever \"move\" operation is implemented here, make sure this test runs OK: \"should not generate the same patch twice (move)\"\n for (var t = oldKeys.length - 1; t >= 0; t--) {\n var key = oldKeys[t];\n var oldVal = mirror[key];\n if (Object(_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__[\"hasOwnProperty\"])(obj, key) && !(obj[key] === undefined && oldVal !== undefined && Array.isArray(obj) === false)) {\n var newVal = obj[key];\n if (typeof oldVal == \"object\" && oldVal != null && typeof newVal == \"object\" && newVal != null) {\n _generate(oldVal, newVal, patches, path + \"/\" + Object(_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__[\"escapePathComponent\"])(key), invertible);\n }\n else {\n if (oldVal !== newVal) {\n changed = true;\n if (invertible) {\n patches.push({ op: \"test\", path: path + \"/\" + Object(_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__[\"escapePathComponent\"])(key), value: Object(_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__[\"_deepClone\"])(oldVal) });\n }\n patches.push({ op: \"replace\", path: path + \"/\" + Object(_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__[\"escapePathComponent\"])(key), value: Object(_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__[\"_deepClone\"])(newVal) });\n }\n }\n }\n else if (Array.isArray(mirror) === Array.isArray(obj)) {\n if (invertible) {\n patches.push({ op: \"test\", path: path + \"/\" + Object(_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__[\"escapePathComponent\"])(key), value: Object(_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__[\"_deepClone\"])(oldVal) });\n }\n patches.push({ op: \"remove\", path: path + \"/\" + Object(_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__[\"escapePathComponent\"])(key) });\n deleted = true; // property has been deleted\n }\n else {\n if (invertible) {\n patches.push({ op: \"test\", path: path, value: mirror });\n }\n patches.push({ op: \"replace\", path: path, value: obj });\n changed = true;\n }\n }\n if (!deleted && newKeys.length == oldKeys.length) {\n return;\n }\n for (var t = 0; t < newKeys.length; t++) {\n var key = newKeys[t];\n if (!Object(_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__[\"hasOwnProperty\"])(mirror, key) && obj[key] !== undefined) {\n patches.push({ op: \"add\", path: path + \"/\" + Object(_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__[\"escapePathComponent\"])(key), value: Object(_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__[\"_deepClone\"])(obj[key]) });\n }\n }\n}", "title": "" }, { "docid": "cbdc26594c3bcff7de7622c64934eb2f", "score": "0.55985457", "text": "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "title": "" }, { "docid": "cbdc26594c3bcff7de7622c64934eb2f", "score": "0.55985457", "text": "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "title": "" }, { "docid": "cbdc26594c3bcff7de7622c64934eb2f", "score": "0.55985457", "text": "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "title": "" }, { "docid": "cbdc26594c3bcff7de7622c64934eb2f", "score": "0.55985457", "text": "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "title": "" }, { "docid": "cbdc26594c3bcff7de7622c64934eb2f", "score": "0.55985457", "text": "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "title": "" }, { "docid": "cbdc26594c3bcff7de7622c64934eb2f", "score": "0.55985457", "text": "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "title": "" }, { "docid": "cbdc26594c3bcff7de7622c64934eb2f", "score": "0.55985457", "text": "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "title": "" }, { "docid": "cbdc26594c3bcff7de7622c64934eb2f", "score": "0.55985457", "text": "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "title": "" }, { "docid": "cbdc26594c3bcff7de7622c64934eb2f", "score": "0.55985457", "text": "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "title": "" }, { "docid": "cbdc26594c3bcff7de7622c64934eb2f", "score": "0.55985457", "text": "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "title": "" }, { "docid": "cbdc26594c3bcff7de7622c64934eb2f", "score": "0.55985457", "text": "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "title": "" }, { "docid": "cbdc26594c3bcff7de7622c64934eb2f", "score": "0.55985457", "text": "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "title": "" }, { "docid": "cbdc26594c3bcff7de7622c64934eb2f", "score": "0.55985457", "text": "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "title": "" }, { "docid": "cbdc26594c3bcff7de7622c64934eb2f", "score": "0.55985457", "text": "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "title": "" }, { "docid": "cbdc26594c3bcff7de7622c64934eb2f", "score": "0.55985457", "text": "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "title": "" }, { "docid": "cbdc26594c3bcff7de7622c64934eb2f", "score": "0.55985457", "text": "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "title": "" }, { "docid": "e513944a19cdc80b2ab8982084494b13", "score": "0.5581174", "text": "function _generate(mirror, obj, patches, path, invertible) {\n if (obj === mirror) {\n return;\n }\n if (typeof obj.toJSON === \"function\") {\n obj = obj.toJSON();\n }\n var newKeys = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._objectKeys)(obj);\n var oldKeys = (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._objectKeys)(mirror);\n var changed = false;\n var deleted = false;\n //if ever \"move\" operation is implemented here, make sure this test runs OK: \"should not generate the same patch twice (move)\"\n for (var t = oldKeys.length - 1; t >= 0; t--) {\n var key = oldKeys[t];\n var oldVal = mirror[key];\n if ((0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.hasOwnProperty)(obj, key) && !(obj[key] === undefined && oldVal !== undefined && Array.isArray(obj) === false)) {\n var newVal = obj[key];\n if (typeof oldVal == \"object\" && oldVal != null && typeof newVal == \"object\" && newVal != null) {\n _generate(oldVal, newVal, patches, path + \"/\" + (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.escapePathComponent)(key), invertible);\n }\n else {\n if (oldVal !== newVal) {\n changed = true;\n if (invertible) {\n patches.push({ op: \"test\", path: path + \"/\" + (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.escapePathComponent)(key), value: (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._deepClone)(oldVal) });\n }\n patches.push({ op: \"replace\", path: path + \"/\" + (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.escapePathComponent)(key), value: (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._deepClone)(newVal) });\n }\n }\n }\n else if (Array.isArray(mirror) === Array.isArray(obj)) {\n if (invertible) {\n patches.push({ op: \"test\", path: path + \"/\" + (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.escapePathComponent)(key), value: (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._deepClone)(oldVal) });\n }\n patches.push({ op: \"remove\", path: path + \"/\" + (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.escapePathComponent)(key) });\n deleted = true; // property has been deleted\n }\n else {\n if (invertible) {\n patches.push({ op: \"test\", path: path, value: mirror });\n }\n patches.push({ op: \"replace\", path: path, value: obj });\n changed = true;\n }\n }\n if (!deleted && newKeys.length == oldKeys.length) {\n return;\n }\n for (var t = 0; t < newKeys.length; t++) {\n var key = newKeys[t];\n if (!(0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.hasOwnProperty)(mirror, key) && obj[key] !== undefined) {\n patches.push({ op: \"add\", path: path + \"/\" + (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__.escapePathComponent)(key), value: (0,_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__._deepClone)(obj[key]) });\n }\n }\n}", "title": "" }, { "docid": "a7fb63e96b20f75d05293942aa16db97", "score": "0.55623466", "text": "function apply(tree, patches, validate) {\n\t var result = false, p = 0, plen = patches.length, patch, key;\n\t while (p < plen) {\n\t patch = patches[p];\n\t p++;\n\t // Find the object\n\t var path = patch.path || \"\";\n\t var keys = path.split('/');\n\t var obj = tree;\n\t var t = 1; //skip empty element - http://jsperf.com/to-shift-or-not-to-shift\n\t var len = keys.length;\n\t var existingPathFragment = undefined;\n\t while (true) {\n\t key = keys[t];\n\t if (validate) {\n\t if (existingPathFragment === undefined) {\n\t if (obj[key] === undefined) {\n\t existingPathFragment = keys.slice(0, t).join('/');\n\t }\n\t else if (t == len - 1) {\n\t existingPathFragment = patch.path;\n\t }\n\t if (existingPathFragment !== undefined) {\n\t this.validator(patch, p - 1, tree, existingPathFragment);\n\t }\n\t }\n\t }\n\t t++;\n\t if (key === undefined) {\n\t if (t >= len) {\n\t result = rootOps[patch.op].call(patch, obj, key, tree); // Apply patch\n\t break;\n\t }\n\t }\n\t if (_isArray(obj)) {\n\t if (key === '-') {\n\t key = obj.length;\n\t }\n\t else {\n\t if (validate && !isInteger(key)) {\n\t throw new JsonPatchError(\"Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index\", \"OPERATION_PATH_ILLEGAL_ARRAY_INDEX\", p - 1, patch.path, patch);\n\t }\n\t key = parseInt(key, 10);\n\t }\n\t if (t >= len) {\n\t if (validate && patch.op === \"add\" && key > obj.length) {\n\t throw new JsonPatchError(\"The specified index MUST NOT be greater than the number of elements in the array\", \"OPERATION_VALUE_OUT_OF_BOUNDS\", p - 1, patch.path, patch);\n\t }\n\t result = arrOps[patch.op].call(patch, obj, key, tree); // Apply patch\n\t break;\n\t }\n\t }\n\t else {\n\t if (key && key.indexOf('~') != -1)\n\t key = key.replace(/~1/g, '/').replace(/~0/g, '~'); // escape chars\n\t if (t >= len) {\n\t result = objOps[patch.op].call(patch, obj, key, tree); // Apply patch\n\t break;\n\t }\n\t }\n\t obj = obj[key];\n\t }\n\t }\n\t return result;\n\t }", "title": "" }, { "docid": "04eaf019b9e573b318b85faacf9d4153", "score": "0.55473405", "text": "function apply(tree, patches, validate) {\n var result = false, p = 0, plen = patches.length, patch, key;\n while (p < plen) {\n patch = patches[p];\n p++;\n // Find the object\n var path = patch.path || \"\";\n var keys = path.split('/');\n var obj = tree;\n var t = 1; //skip empty element - http://jsperf.com/to-shift-or-not-to-shift\n var len = keys.length;\n var existingPathFragment = undefined;\n while (true) {\n key = keys[t];\n if (validate) {\n if (existingPathFragment === undefined) {\n if (obj[key] === undefined) {\n existingPathFragment = keys.slice(0, t).join('/');\n }\n else if (t == len - 1) {\n existingPathFragment = patch.path;\n }\n if (existingPathFragment !== undefined) {\n this.validator(patch, p - 1, tree, existingPathFragment);\n }\n }\n }\n t++;\n if (key === undefined) {\n if (t >= len) {\n result = rootOps[patch.op].call(patch, obj, key, tree); // Apply patch\n break;\n }\n }\n if (_isArray(obj)) {\n if (key === '-') {\n key = obj.length;\n }\n else {\n if (validate && !isInteger(key)) {\n throw new JsonPatchError(\"Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index\", \"OPERATION_PATH_ILLEGAL_ARRAY_INDEX\", p - 1, patch.path, patch);\n }\n key = parseInt(key, 10);\n }\n if (t >= len) {\n if (validate && patch.op === \"add\" && key > obj.length) {\n throw new JsonPatchError(\"The specified index MUST NOT be greater than the number of elements in the array\", \"OPERATION_VALUE_OUT_OF_BOUNDS\", p - 1, patch.path, patch);\n }\n result = arrOps[patch.op].call(patch, obj, key, tree); // Apply patch\n break;\n }\n }\n else {\n if (key && key.indexOf('~') != -1)\n key = key.replace(/~1/g, '/').replace(/~0/g, '~'); // escape chars\n if (t >= len) {\n result = objOps[patch.op].call(patch, obj, key, tree); // Apply patch\n break;\n }\n }\n obj = obj[key];\n }\n }\n return result;\n }", "title": "" }, { "docid": "e87ab65fa11e20e233dec26793391d2b", "score": "0.55437344", "text": "patch() {\n }", "title": "" }, { "docid": "90caafa176a49c6def7ae51a96e0bdc6", "score": "0.55408835", "text": "function diffObject(context, expected, actual, strict) {\n diffType(context, expected, actual);\n let expectedKeys = Object.keys(expected);\n let actualKeys = Object.keys(actual);\n\n if (strict) {\n matchKeys(context, expectedKeys, actualKeys);\n }\n\n expectedKeys.forEach(function(key) {\n diff(context.enter(key), expected[key], actual[key]);\n });\n}", "title": "" }, { "docid": "8854d740e0361689924dd4f27d797aa0", "score": "0.55351144", "text": "function parse(patch) {\n var result = [];\n\n if (Array.isArray(patch)) {\n return patch.reduce((r, p) => r.concat(parse(p)), result);\n }\n\n if (patch.set) {\n Object.keys(patch.set).forEach(path => {\n result.push(new _SetPatch.default(patch.id, path, patch.set[path]));\n });\n }\n\n if (patch.setIfMissing) {\n Object.keys(patch.setIfMissing).forEach(path => {\n result.push(new _SetIfMissingPatch.default(patch.id, path, patch.setIfMissing[path]));\n });\n } // TODO: merge\n\n\n if (patch.unset) {\n patch.unset.forEach(path => {\n result.push(new _UnsetPatch.default(patch.id, path));\n });\n }\n\n if (patch.diffMatchPatch) {\n Object.keys(patch.diffMatchPatch).forEach(path => {\n result.push(new _DiffMatchPatch.default(patch.id, path, patch.diffMatchPatch[path]));\n });\n }\n\n if (patch.inc) {\n Object.keys(patch.inc).forEach(path => {\n result.push(new _IncPatch.default(patch.id, path, patch.inc[path]));\n });\n }\n\n if (patch.dec) {\n Object.keys(patch.dec).forEach(path => {\n result.push(new _IncPatch.default(patch.id, path, -patch.dec[path]));\n });\n }\n\n if (patch.insert) {\n var location;\n var path;\n var spec = patch.insert;\n\n if (spec.before) {\n location = 'before';\n path = spec.before;\n } else if (spec.after) {\n location = 'after';\n path = spec.after;\n } else if (spec.replace) {\n location = 'replace';\n path = spec.replace;\n }\n\n result.push(new _InsertPatch.default(patch.id, location, path, spec.items));\n }\n\n return result;\n}", "title": "" }, { "docid": "abe41b15de700ed763dbed49fa0171d8", "score": "0.5530234", "text": "function apply(tree, patches, validate) {\n\t var results = [], p = 0, plen = patches.length, patch, key;\n\t while (p < plen) {\n\t patch = patches[p];\n\t p++;\n\t // Find the object\n\t var path = patch.path || \"\";\n\t var keys = path.split('/');\n\t var obj = tree;\n\t var t = 1; //skip empty element - http://jsperf.com/to-shift-or-not-to-shift\n\t var len = keys.length;\n\t var existingPathFragment = undefined;\n\t while (true) {\n\t key = keys[t];\n\t if (validate) {\n\t if (existingPathFragment === undefined) {\n\t if (obj[key] === undefined) {\n\t existingPathFragment = keys.slice(0, t).join('/');\n\t }\n\t else if (t == len - 1) {\n\t existingPathFragment = patch.path;\n\t }\n\t if (existingPathFragment !== undefined) {\n\t this.validator(patch, p - 1, tree, existingPathFragment);\n\t }\n\t }\n\t }\n\t t++;\n\t if (key === undefined) {\n\t if (t >= len) {\n\t results.push(rootOps[patch.op].call(patch, obj, key, tree)); // Apply patch\n\t break;\n\t }\n\t }\n\t if (_isArray(obj)) {\n\t if (key === '-') {\n\t key = obj.length;\n\t }\n\t else {\n\t if (validate && !isInteger(key)) {\n\t throw new JsonPatchError(\"Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index\", \"OPERATION_PATH_ILLEGAL_ARRAY_INDEX\", p - 1, patch.path, patch);\n\t }\n\t key = parseInt(key, 10);\n\t }\n\t if (t >= len) {\n\t if (validate && patch.op === \"add\" && key > obj.length) {\n\t throw new JsonPatchError(\"The specified index MUST NOT be greater than the number of elements in the array\", \"OPERATION_VALUE_OUT_OF_BOUNDS\", p - 1, patch.path, patch);\n\t }\n\t results.push(arrOps[patch.op].call(patch, obj, key, tree)); // Apply patch\n\t break;\n\t }\n\t }\n\t else {\n\t if (key && key.indexOf('~') != -1)\n\t key = key.replace(/~1/g, '/').replace(/~0/g, '~'); // escape chars\n\t if (t >= len) {\n\t results.push(objOps[patch.op].call(patch, obj, key, tree)); // Apply patch\n\t break;\n\t }\n\t }\n\t obj = obj[key];\n\t }\n\t }\n\t return results;\n\t }", "title": "" }, { "docid": "abe41b15de700ed763dbed49fa0171d8", "score": "0.5530234", "text": "function apply(tree, patches, validate) {\n\t var results = [], p = 0, plen = patches.length, patch, key;\n\t while (p < plen) {\n\t patch = patches[p];\n\t p++;\n\t // Find the object\n\t var path = patch.path || \"\";\n\t var keys = path.split('/');\n\t var obj = tree;\n\t var t = 1; //skip empty element - http://jsperf.com/to-shift-or-not-to-shift\n\t var len = keys.length;\n\t var existingPathFragment = undefined;\n\t while (true) {\n\t key = keys[t];\n\t if (validate) {\n\t if (existingPathFragment === undefined) {\n\t if (obj[key] === undefined) {\n\t existingPathFragment = keys.slice(0, t).join('/');\n\t }\n\t else if (t == len - 1) {\n\t existingPathFragment = patch.path;\n\t }\n\t if (existingPathFragment !== undefined) {\n\t this.validator(patch, p - 1, tree, existingPathFragment);\n\t }\n\t }\n\t }\n\t t++;\n\t if (key === undefined) {\n\t if (t >= len) {\n\t results.push(rootOps[patch.op].call(patch, obj, key, tree)); // Apply patch\n\t break;\n\t }\n\t }\n\t if (_isArray(obj)) {\n\t if (key === '-') {\n\t key = obj.length;\n\t }\n\t else {\n\t if (validate && !isInteger(key)) {\n\t throw new JsonPatchError(\"Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index\", \"OPERATION_PATH_ILLEGAL_ARRAY_INDEX\", p - 1, patch.path, patch);\n\t }\n\t key = parseInt(key, 10);\n\t }\n\t if (t >= len) {\n\t if (validate && patch.op === \"add\" && key > obj.length) {\n\t throw new JsonPatchError(\"The specified index MUST NOT be greater than the number of elements in the array\", \"OPERATION_VALUE_OUT_OF_BOUNDS\", p - 1, patch.path, patch);\n\t }\n\t results.push(arrOps[patch.op].call(patch, obj, key, tree)); // Apply patch\n\t break;\n\t }\n\t }\n\t else {\n\t if (key && key.indexOf('~') != -1)\n\t key = key.replace(/~1/g, '/').replace(/~0/g, '~'); // escape chars\n\t if (t >= len) {\n\t results.push(objOps[patch.op].call(patch, obj, key, tree)); // Apply patch\n\t break;\n\t }\n\t }\n\t obj = obj[key];\n\t }\n\t }\n\t return results;\n\t }", "title": "" }, { "docid": "ba46045a39a768ba5cab2c56c43b8d5d", "score": "0.5526135", "text": "function apply(tree, patches, validate) {\n var result = false,\n p = 0,\n plen = patches.length,\n patch,\n key;\n while (p < plen) {\n patch = patches[p];\n p++;\n // Find the object\n var path = patch.path || \"\";\n var keys = path.split('/');\n var obj = tree;\n var t = 1; //skip empty element - http://jsperf.com/to-shift-or-not-to-shift\n var len = keys.length;\n var existingPathFragment = undefined;\n while (true) {\n key = keys[t];\n if (validate) {\n if (existingPathFragment === undefined) {\n if (obj[key] === undefined) {\n existingPathFragment = keys.slice(0, t).join('/');\n } else if (t == len - 1) {\n existingPathFragment = patch.path;\n }\n if (existingPathFragment !== undefined) {\n this.validator(patch, p - 1, tree, existingPathFragment);\n }\n }\n }\n t++;\n if (key === undefined) {\n if (t >= len) {\n result = rootOps[patch.op].call(patch, obj, key, tree); // Apply patch\n break;\n }\n }\n if (_isArray(obj)) {\n if (key === '-') {\n key = obj.length;\n } else {\n if (validate && !isInteger(key)) {\n throw new JsonPatchError(\"Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index\", \"OPERATION_PATH_ILLEGAL_ARRAY_INDEX\", p - 1, patch.path, patch);\n }\n key = parseInt(key, 10);\n }\n if (t >= len) {\n if (validate && patch.op === \"add\" && key > obj.length) {\n throw new JsonPatchError(\"The specified index MUST NOT be greater than the number of elements in the array\", \"OPERATION_VALUE_OUT_OF_BOUNDS\", p - 1, patch.path, patch);\n }\n result = arrOps[patch.op].call(patch, obj, key, tree); // Apply patch\n break;\n }\n } else {\n if (key && key.indexOf('~') != -1) key = key.replace(/~1/g, '/').replace(/~0/g, '~'); // escape chars\n if (t >= len) {\n result = objOps[patch.op].call(patch, obj, key, tree); // Apply patch\n break;\n }\n }\n obj = obj[key];\n }\n }\n return result;\n }", "title": "" }, { "docid": "998fc5e07c0466c443395a1403bf2c4e", "score": "0.55231416", "text": "refDiff() {\n let res = {\n toAdd: [],\n toRemove: [],\n toUpdate: [],\n };\n Object.keys(this.frameNew).forEach((key) => {\n !this.frameOld[key] && res.toAdd.push(this.frameNew[key]);\n this.frameOld[key] && res.toUpdate.push(this.frameNew[key]);\n });\n Object.keys(this.frameOld).forEach((key) => {\n !this.frameNew[key] && res.toRemove.push(this.frameOld[key]);\n });\n return res;\n }", "title": "" }, { "docid": "ab4c212ef57d21b70d9a97753b6cab54", "score": "0.55138063", "text": "function handleInsertPatchNode(vnode, currentPath, patch, toInitialize, toRemain, cnode) {\n patch.push(createPatchNode({}, vnode, __WEBPACK_IMPORTED_MODULE_3__constant__[\"PATCH_ACTION_INSERT\"]));\n if (Object(__WEBPACK_IMPORTED_MODULE_1__common__[\"e\" /* isComponentVnode */])(vnode)) {\n const nextIndex = vnode.transferKey === undefined ? Object(__WEBPACK_IMPORTED_MODULE_1__common__[\"j\" /* vnodePathToString */])(currentPath) : vnode.transferKey;\n toInitialize[nextIndex] = createCnode(vnode, cnode);\n } else if (vnode.children !== undefined) {\n Object(__WEBPACK_IMPORTED_MODULE_1__common__[\"m\" /* walkVnodes */])(vnode.children, (childVnode, vnodePath) => {\n if (Object(__WEBPACK_IMPORTED_MODULE_1__common__[\"e\" /* isComponentVnode */])(childVnode)) {\n const nextIndex = childVnode.transferKey === undefined ? Object(__WEBPACK_IMPORTED_MODULE_1__common__[\"j\" /* vnodePathToString */])(currentPath.concat(vnodePath)) : childVnode.transferKey;\n\n // Because current vnode is a new vnode,\n // so its child vnode patch action will have \"remain\" type only if it has a transferKey\n if (childVnode.transferKey !== undefined && cnode.next[nextIndex] !== undefined) {\n toRemain[nextIndex] = cnode.next[nextIndex];\n if (childVnode.transferKey !== undefined) {\n childVnode.action = { type: __WEBPACK_IMPORTED_MODULE_3__constant__[\"PATCH_ACTION_MOVE_FROM\"] };\n }\n } else {\n toInitialize[nextIndex] = createCnode(childVnode, cnode);\n }\n\n return true;\n }\n });\n }\n}", "title": "" }, { "docid": "64965533b2a6ec06fb8559282b7c83bb", "score": "0.55103725", "text": "function _generate(mirror, obj, patches, path) {\n var newKeys = _objectKeys(obj);\n var oldKeys = _objectKeys(mirror);\n var changed = false;\n var deleted = false;\n for (var t = oldKeys.length - 1; t >= 0; t--) {\n var key = oldKeys[t];\n var oldVal = mirror[key];\n if (obj.hasOwnProperty(key)) {\n var newVal = obj[key];\n if (typeof oldVal == \"object\" && oldVal != null && typeof newVal == \"object\" && newVal != null) {\n _generate(oldVal, newVal, patches, path + \"/\" + escapePathComponent(key));\n } else {\n if (oldVal != newVal) {\n changed = true;\n patches.push({\n op: \"replace\",\n path: path + \"/\" + escapePathComponent(key),\n value: deepClone(newVal)\n });\n }\n }\n } else {\n patches.push({\n op: \"remove\",\n path: path + \"/\" + escapePathComponent(key)\n });\n deleted = true;\n }\n }\n if (!deleted && newKeys.length == oldKeys.length) {\n return;\n }\n for (var t = 0; t < newKeys.length; t++) {\n var key = newKeys[t];\n if (!mirror.hasOwnProperty(key)) {\n patches.push({\n op: \"add\",\n path: path + \"/\" + escapePathComponent(key),\n value: deepClone(obj[key])\n });\n }\n }\n }", "title": "" }, { "docid": "274a34cb50aecb21da268863efc73475", "score": "0.5506895", "text": "function apply(document, patch, validateOperation) {\n console.warn('jsonpatch.apply is deprecated, please use `applyPatch` for applying patch sequences, or `applyOperation` to apply individual operations.');\n var results = new Array(patch.length);\n /* this code might be overkill, but will be removed soon, it is to prevent the breaking change of root operations */\n var _loop_1 = function(i, length_2) {\n if (patch[i].path == \"\" && patch[i].op != \"remove\" && patch[i].op != \"test\") {\n var value_1;\n if (patch[i].op == '_get') {\n patch[i].value = document;\n return \"continue\";\n }\n if (patch[i].op == \"replace\" || patch[i].op == \"move\") {\n results[i] = deepClone(document);\n }\n if (patch[i].op == \"copy\" || patch[i].op == \"move\") {\n value_1 = getValueByPointer(document, patch[i].from);\n }\n if (patch[i].op == \"replace\" || patch[i].op == \"add\") {\n value_1 = patch[i].value;\n }\n // empty the object\n Object.keys(document).forEach(function (key) { return delete document[key]; });\n //copy everything from value\n Object.keys(value_1).forEach(function (key) { return document[key] = value_1[key]; });\n }\n else {\n results[i] = applyOperation(document, patch[i], validateOperation);\n results[i] = results[i].removed || results[i].test;\n }\n };\n for (var i = 0, length_2 = patch.length; i < length_2; i++) {\n _loop_1(i, length_2);\n }\n return results;\n }", "title": "" }, { "docid": "448679a7750df290e0e23f764c604311", "score": "0.54996294", "text": "patch(patchInfo) {\n // Invoke pre patching hook\n if (this._opts.prePatchApply && this._opts.prePatchApply(this, patchInfo) === VirtualActions.PATCH_REJECT) return;\n\n // Accept rule reparse as default postPatch behavior\n if (patchInfo.reparse === undefined) {\n patchInfo = Object.assign({}, patchInfo, {reparse: true});\n }\n\n this._patchApply(patchInfo);\n\n // Invoke post patching hook\n if (this._opts.postPatchApply) this._opts.postPatchApply(this, patchInfo);\n }", "title": "" }, { "docid": "d1065ec38e5a2ea1dffe6adb97ac019b", "score": "0.54890555", "text": "function diffFacts(a,b,category){var diff;// look for changes and removals\nfor(var aKey in a){if(aKey===STYLE_KEY||aKey===EVENT_KEY||aKey===ATTR_KEY||aKey===ATTR_NS_KEY){var subDiff=diffFacts(a[aKey],b[aKey]||{},aKey);if(subDiff){diff=diff||{};diff[aKey]=subDiff;}continue;}// remove if not in the new facts\nif(!(aKey in b)){diff=diff||{};diff[aKey]=typeof category==='undefined'?typeof a[aKey]==='string'?'':null:category===STYLE_KEY?'':category===EVENT_KEY||category===ATTR_KEY?undefined:{namespace:a[aKey].namespace,value:undefined};continue;}var aValue=a[aKey];var bValue=b[aKey];// reference equal, so don't worry about it\nif(aValue===bValue&&aKey!=='value'||category===EVENT_KEY&&equalEvents(aValue,bValue)){continue;}diff=diff||{};diff[aKey]=bValue;}// add new stuff\nfor(var bKey in b){if(!(bKey in a)){diff=diff||{};diff[bKey]=b[bKey];}}return diff;}", "title": "" }, { "docid": "135b6d4af803ef3c66e7e8e07c3528dd", "score": "0.5480474", "text": "function patchObj(target, patch) {\n const copy = JSON.parse(JSON.stringify(target));\n return Object.assign(copy, patch);\n}", "title": "" }, { "docid": "db867a824ec7e7913f97974987d3c169", "score": "0.54627717", "text": "function _generate(mirror, obj, patches, path) {\n var newKeys = _objectKeys(obj);\n var oldKeys = _objectKeys(mirror);\n var changed = false;\n var deleted = false;\n\n for (var t = oldKeys.length - 1; t >= 0; t--) {\n var key = oldKeys[t];\n var oldVal = mirror[key];\n if (obj.hasOwnProperty(key)) {\n var newVal = obj[key];\n if (typeof oldVal == \"object\" && oldVal != null && typeof newVal == \"object\" && newVal != null) {\n _generate(oldVal, newVal, patches, path + \"/\" + escapePathComponent(key));\n } else {\n if (oldVal != newVal) {\n changed = true;\n patches.push({ op: \"replace\", path: path + \"/\" + escapePathComponent(key), value: deepClone(newVal) });\n }\n }\n } else {\n patches.push({ op: \"remove\", path: path + \"/\" + escapePathComponent(key) });\n deleted = true; // property has been deleted\n }\n }\n\n if (!deleted && newKeys.length == oldKeys.length) {\n return;\n }\n\n for (var t = 0; t < newKeys.length; t++) {\n var key = newKeys[t];\n if (!mirror.hasOwnProperty(key)) {\n patches.push({ op: \"add\", path: path + \"/\" + escapePathComponent(key), value: deepClone(obj[key]) });\n }\n }\n }", "title": "" }, { "docid": "6419a685f2e971df43726521b206e128", "score": "0.5460086", "text": "function diffResource(oldValue, newValue) {\n return impl.diffResource(oldValue, newValue);\n}", "title": "" }, { "docid": "8f5090ad305fb6678e1a485a0fd02605", "score": "0.54569864", "text": "async viewChanges() {\n if (this.isBeingSubmitted()) return;\n\n const currentOperation = this.registerOperation({ type: 'viewChanges' });\n\n const newPageCode = await this.tryPrepareNewPageCode('viewChanges');\n if (newPageCode === undefined) {\n this.closeOperation(currentOperation);\n }\n if (currentOperation.isClosed) return;\n\n mw.loader.load('mediawiki.diff.styles');\n\n let resp;\n try {\n const options = {\n action: 'compare',\n toslots: 'main',\n 'totext-main': newPageCode,\n prop: 'diff',\n formatversion: 2,\n };\n if (mw.config.get('wgArticleId')) {\n options.fromrev = this.targetPage.revisionId;\n } else {\n // Unexistent pages\n options.fromslots = 'main',\n options['fromtext-main'] = '';\n }\n resp = await cd.g.api.post(options).catch(handleApiReject);\n } catch (e) {\n if (e instanceof CdError) {\n const options = Object.assign({}, e.data, {\n message: cd.sParse('cf-error-viewchanges'),\n currentOperation,\n });\n this.handleError(options);\n } else {\n this.handleError({\n type: 'javascript',\n logMessage: e,\n currentOperation,\n });\n }\n return;\n }\n\n if (this.closeOperationIfNecessary(currentOperation)) return;\n\n let html = resp.compare?.body;\n if (html) {\n html = cd.util.wrapDiffBody(html);\n const $label = $('<div>')\n .addClass('cd-previewArea-label')\n .text(cd.s('cf-block-viewchanges'));\n this.$previewArea\n .html(html)\n .prepend($label)\n .cdAddCloseButton();\n } else {\n this.$previewArea.empty();\n if (html !== undefined) {\n this.showMessage(cd.sParse('cf-notice-nochanges'));\n }\n }\n\n if (cd.settings.autopreview) {\n this.viewChangesButton.$element.hide();\n this.previewButton.$element.show();\n this.adjustLabels();\n }\n\n this.closeOperation(currentOperation);\n\n this.$previewArea\n .cdScrollIntoView(this.$previewArea.hasClass('cd-previewArea-above') ? 'top' : 'bottom');\n focusInput(this.commentInput);\n }", "title": "" } ]
d9b6ca611b0a7ec8f47fb7ab54fe9945
(public) this^e % m (HAC 14.85)
[ { "docid": "3c0bace8b736e0e9d47c1aa11e56fc33", "score": "0.0", "text": "function bnModPow(e, m) {\n var i = e.bitLength(),\n k, r = nbv(1),\n z\n if (i <= 0) return r\n else if (i < 18) k = 1\n else if (i < 48) k = 3\n else if (i < 144) k = 4\n else if (i < 768) k = 5\n else k = 6\n if (i < 8)\n z = new Classic(m)\n else if (m.isEven())\n z = new Barrett(m)\n else\n z = new Montgomery(m)\n\n // precomputation\n var g = new Array(),\n n = 3,\n k1 = k - 1,\n km = (1 << k) - 1\n g[1] = z.convert(this)\n if (k > 1) {\n var g2 = new BigInteger()\n z.sqrTo(g[1], g2)\n while (n <= km) {\n g[n] = new BigInteger()\n z.mulTo(g2, g[n - 2], g[n])\n n += 2\n }\n }\n\n var j = e.t - 1,\n w, is1 = true,\n r2 = new BigInteger(),\n t\n i = nbits(e[j]) - 1\n while (j >= 0) {\n if (i >= k1) w = (e[j] >> (i - k1)) & km\n else {\n w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i)\n if (j > 0) w |= e[j - 1] >> (this.DB + i - k1)\n }\n\n n = k\n while ((w & 1) == 0) {\n w >>= 1\n --n\n }\n if ((i -= n) < 0) {\n i += this.DB\n --j\n }\n if (is1) { // ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r)\n is1 = false\n } else {\n while (n > 1) {\n z.sqrTo(r, r2)\n z.sqrTo(r2, r)\n n -= 2\n }\n if (n > 0) z.sqrTo(r, r2)\n else {\n t = r\n r = r2\n r2 = t\n }\n z.mulTo(r2, g[w], r)\n }\n\n while (j >= 0 && (e[j] & (1 << i)) == 0) {\n z.sqrTo(r, r2)\n t = r\n r = r2\n r2 = t\n if (--i < 0) {\n i = this.DB - 1\n --j\n }\n }\n }\n return z.revert(r)\n}", "title": "" } ]
[ { "docid": "a91dec4137ad0b77651bbcce32986496", "score": "0.7374313", "text": "get m() { return this._m; }", "title": "" }, { "docid": "9238add33814648e6051279ff625788e", "score": "0.7167977", "text": "Mm() {\r\n return 0.5*this.Fb()*this.k()*this.j()*this.b*Math.pow(this.d(),2)/12\r\n }", "title": "" }, { "docid": "6213ceacf1edee4f0bc731ca58d6bc92", "score": "0.69107133", "text": "Ms() {\r\n return this.Ast()*this.Fs()*this.j()*this.d()/12\r\n }", "title": "" }, { "docid": "2559466fcc5b730d5213461fb8d2141f", "score": "0.66459507", "text": "h_r(){\r\n return this.L*12/this.r\r\n }", "title": "" }, { "docid": "663d8b0b908310fbf148b1beefe29baa", "score": "0.6518042", "text": "function M(){}", "title": "" }, { "docid": "890f8c200351983356c96aa4aa1125bd", "score": "0.64885616", "text": "get m00(){ return this.data[ 0]; }", "title": "" }, { "docid": "502de079e30d600b034ed7fec0a6ed60", "score": "0.6458317", "text": "function pm(a){var b=qm;this.J=[];this.Z=b;this.Y=a||null;this.G=this.C=!1;this.F=void 0;this.N=this.W=this.L=!1;this.K=0;this.D=null;this.M=0}", "title": "" }, { "docid": "5e8bba2b1bfb2951babe548e2fb51175", "score": "0.64061564", "text": "function m(){}", "title": "" }, { "docid": "5e8bba2b1bfb2951babe548e2fb51175", "score": "0.64061564", "text": "function m(){}", "title": "" }, { "docid": "304435407dfe4f94e67cffa703e0e11d", "score": "0.63694954", "text": "function Classic(m){this.m=m}", "title": "" }, { "docid": "a15a6781470e645373542e6dd8a8975f", "score": "0.6362713", "text": "M_Vd(){\r\n return this.Mr != 0 && this.Vr != 0 ? (this.Mr*12)/(this.Vr*this.d()) : 0\r\n }", "title": "" }, { "docid": "67ed01a358090b1dddbaee912bdbd77c", "score": "0.633102", "text": "function m(n,e){return y(p$g,m$1,h$3,e,n)}", "title": "" }, { "docid": "314c1adc1a9052d72f31e2ae04a2e84b", "score": "0.6319438", "text": "function e808947() { return 'om('; }", "title": "" }, { "docid": "9a8ccebaa01bfb20e35832583055db05", "score": "0.6205298", "text": "get b(){\n\t\treturn this.a * Math.sqrt(1-this.e*this.e);\n\t}", "title": "" }, { "docid": "a247049868bfbbde04bcd0394387de4c", "score": "0.61571497", "text": "mulM(s) { this.x *= s; this.y *= s; return this; }", "title": "" }, { "docid": "3f7b685b8e5123bc44cc791a3bfa4230", "score": "0.6150211", "text": "gimmeXY() {\r\n return this.x * this.y; //?\r\n }", "title": "" }, { "docid": "209d701fd8d8b8894223e29205a1cd95", "score": "0.6101715", "text": "function i(e){return void 0===e&&(e=null),Object(r[\"m\"])(null!==e?e:o)}", "title": "" }, { "docid": "fcde77dfe8c7bc29488c1498046031a6", "score": "0.6091141", "text": "function f() {\n\tthis.m1 = 1;this;\n }", "title": "" }, { "docid": "1f905214b6f3f2f800c2823df641374b", "score": "0.60525715", "text": "function Classic (m) { this.m = m }", "title": "" }, { "docid": "a0822e3a8c8f3114b3b7b45777a2a9ee", "score": "0.60035646", "text": "S_cc(){\n return 15*this.D\n }", "title": "" }, { "docid": "9012429eec4e089d35e8b26af26affe6", "score": "0.59999", "text": "function Mu(a){var b=Nu;this.me=[];this.bg=b;this.Of=a||null;this.sd=this.Tc=!1;this.Vb=void 0;this.kf=this.sg=this.ye=!1;this.pe=0;this.gb=null;this.ze=0}", "title": "" }, { "docid": "0dbdf0895af22d3aebd4e97d80ffe1f7", "score": "0.59998107", "text": "function M(a){var b=Bc;this.l=[];this.A=b;this.B=a||null;this.j=this.g=!1;this.i=void 0;this.s=this.F=this.u=!1;this.m=0;this.h=null;this.o=0}", "title": "" }, { "docid": "77cfc201dc99e666d9225293b8a87e65", "score": "0.5991126", "text": "mag2() {\n return this.dot(this);\n }", "title": "" }, { "docid": "0d5cdfe361b89160fc96fb377ee20789", "score": "0.5988646", "text": "function v(o,m,e) {\n\tif (o.m === \"\") {o.e = e;}\n\to.m += m+\"\\n\";\n}", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "9c3f76ce9f262c6eaafce87caf1ed477", "score": "0.5955103", "text": "function Classic(m) { this.m = m; }", "title": "" }, { "docid": "35fc08443d72e98db901ffd5c9f4327f", "score": "0.5920664", "text": "mod(...args){ return this._getBem(0).mod(...args); }", "title": "" }, { "docid": "4e1d57f1bf642c17987f23e5ae67c934", "score": "0.59154433", "text": "getMagnitud(){\n\n return Math.sqrt(this.x*this.x + this.y*this.y + this.z*this.z);\n }", "title": "" } ]
ea88538cd9fa8f81d778003ff91424c6
(1) This function removes the first part of the section to show the second part, which is a text related to the answer the person chose, which is a Culinary trip.
[ { "docid": "d4238ebeef03dd4e4f596044b49105f3", "score": "0.0", "text": "function handleDrop2(event,ui) {\n//(1) first we remove the first part\n ui.draggable.remove();\n $(\".divDestination\").css({\n display: \"none\"\n });\n $(\"#zoneCharacter\").css({\n display: \"none\"\n });\n//(1) then we show the second part\n $(\"#sectionEnd\").css('display', 'inline-block');\n//and we put a text that is related to the choice the person made\n $(\"#pConclusion\").html('A culinary trip eh? Yummy! Thank you for freely giving me some of your personal preferences. Go check the page I opened for you!');\n//(1) finally, we open a window of a booking website which coincide with the preference of the person.\n window.open(\"https://www.lonelyplanet.com/thailand\", \"PopUp2\", \"width = 400, height = 400, top=250, right = 250\", \"_blank\");\n//(4) adding the website to the pool in the array for the end.\n linksArrayEnd.push(\"https://www.lonelyplanet.com/thailand\");\n}", "title": "" } ]
[ { "docid": "a93a8eabd43f0000910e3eaca9239feb", "score": "0.57533973", "text": "function removeSeparationLines(parts) {\n var pageName = document.title;\n if (pageName.includes(\"Activity\")) {\n parts.splice(0, 1);\n parts.splice(13, 1);\n parts.splice(2, 1);\n } else if (pageName.includes(\"Architecture\")) {\n parts.splice(0, 1);\n parts.splice(49, 1);\n parts.splice(27, 1);\n parts.splice(25, 1);\n parts.splice(14, 1);\n parts.splice(13, 1);\n } else if (pageName.includes(\"Group\")) {\n parts.splice(0, 1);\n parts.splice(12, 1);\n } else if (pageName.includes(\"Reference\")) {\n parts.splice(0, 1);\n parts.splice(17, 1);\n parts.splice(13, 1);\n parts.splice(4, 1);\n parts.splice(0, 1);\n } else if (pageName.includes(\"Object\")) {\n parts.splice(0, 1);\n parts.splice(54, 1);\n parts.splice(36, 1);\n parts.splice(35, 1);\n parts.splice(25, 1);\n parts.splice(22, 1);\n parts.splice(14, 1);\n parts.splice(11, 1);\n parts.splice(3, 1);\n } else if (pageName.includes(\"Person\")) {\n parts.splice(0, 1);\n parts.splice(49, 1);\n parts.splice(31, 1);\n parts.splice(26, 1);\n parts.splice(24, 1);\n parts.splice(15, 1);\n parts.splice(14, 1);\n parts.splice(7, 1);\n parts.splice(5, 1);\n } else if (pageName.includes(\"Place\")) {\n parts.splice(0, 1);\n parts.splice(8, 1);\n } else if (pageName.includes(\"Institution\")) {\n parts.splice(0, 1);\n }\n\n return parts;\n}", "title": "" }, { "docid": "a015417a409e9f009ceedc0d147b6975", "score": "0.5680604", "text": "function removeAdjacentNotes() {\n let box = data.highlighted;\n let boxI = b2i(box);\n let num = document.getElementById(box + 'p').innerHTML;\n if (num === \"\") return; // removing a number shouldn't remove notes\n let square = box[1];\n\n let history = \"\";\n for (let i = 0; i < data.answer.length; i++) {\n if (Math.floor(boxI / 9) === Math.floor(i / 9) || // if in row\n boxI % 9 === i % 9 || // if in column\n square === i2b(i)[1]) { // if in square\n \n let np = document.getElementById(i2b(i) + 'n' + num + 'p');\n if (np.innerHTML !== '') {\n history += i2b(i) + 'n' + num + 'p' + ':' + num + ':';\n np.innerHTML = '';\n\n }\n }\n }\n return history;\n}", "title": "" }, { "docid": "5dc9aac36ff075d6b9d8c6caf2273b57", "score": "0.5667853", "text": "function hide_empty_sections(element){\n let prev, next, len = element.children.length;\n for(let i = 1; i < len; i++){\n \n next = element.children[i];\n prev = element.children[i-1];\n \n if(next && next.children && next.children.length == 1){\n \n if(next.children[0].classList.contains(\"label\") && prev.children[prev.children.length-1].classList.contains(\"label\")){\n \n prev.children[prev.children.length-1].style.display = \"none\";\n \n if(i == len-1) next.children[0].style.display = \"none\";\n }\n }\n \n }\n return element;\n }", "title": "" }, { "docid": "c8e9685bdad2c05d55a0bfca310d2a78", "score": "0.55402267", "text": "function removeNoCategText() {\n let noCatText = document.getElementById(\"no-categ\");\n noCatText.innerHTML = \"\";\n}", "title": "" }, { "docid": "c395cfebff6c94e9107ace5dfa254def", "score": "0.552832", "text": "function remove() {\n if (calcDisplay.innerHTML.length > 1) {\n calcDisplay.innerHTML = calcDisplay.innerHTML.slice(0, -1);\n } else {\n calcDisplay.innerHTML = 0;\n }\n}", "title": "" }, { "docid": "3662e656ae14e07007efc53b0056b241", "score": "0.5511491", "text": "function removeSection () {\n if (nbSections > 1) {\n nbSections--\n\n var sections = getByClass('sectionform')\n var nb = sections.length - 1\n sections[nb].remove()\n } else {\n alert('There is only one section left !')\n }\n}", "title": "" }, { "docid": "9ae9afb361081572cebc75368a5bf70b", "score": "0.5498857", "text": "function formatPuzzle(pc) {\n\tlet pi = display.puzzleIntro;\n\tlet pd = display.puzzleDescription;\n\tlet pt = display.puzzleTitle;\n\tlet dd = display.treasureDisplay;\n\tdd.innerHTML = pc.treasureDisplay();\n\tpt.innerHTML = pc.puzzleTitle()\n\tpi.innerHTML = pc.puzzleIntro();\n\tlet solD = display.solutionDisplay;\n\tsolD.innerHTML =\"\";\n\tlet ed = display.explanationDisplay;\n\ted.innerHTML = \"\";\n}", "title": "" }, { "docid": "1e7bb20c278ab638a73bfaba8154a65f", "score": "0.54897285", "text": "function removeAds() {\n document.querySelectorAll('.has-vertical-spacing:empty').forEach(element => element.remove())\n document.querySelectorAll('*[data-google-query-id]').forEach(element => element.remove())\n document.querySelectorAll('#dfp-header').forEach(element => element.remove())\n\n let outbrainElement = getElementByText('h2', 'Das könnte dich auch interessieren')\n if (outbrainElement) {\n let surroundingSection = outbrainElement.closest('section')\n surroundingSection.remove()\n }\n}", "title": "" }, { "docid": "db3b7437c16fef65dca735720917fca4", "score": "0.5481371", "text": "function removePageNumbers() {\n\t\t\t\t\tlet eol = fullText.length,\n\t\t\t\t\t\tprev = eol,\n\t\t\t\t\t\ti = fullText.lastIndexOf( '\\n', eol -1 );\n\t\t\t\t\twhile (i !== -1) {\n\t\t\t\t\t\t\t\t\t// Note: In questors sometimes get something that looks like \"\\n~Colm\\n\" for no good reason I see. Strip it out. \n\t\t\t\t\t\tif( fullText.slice( i, eol ).match( /^\\s*(\\d+|\\SCol\\S)\\s*$/ ) ) {\n\t\t\t\t\t\t\tlet x = fullText.slice( eol, prev ).match( /^[A-Z\\s]+$/ );\n\t\t\t\t\t\t\tif( x ) {\n\t\t\t\t\t\t\t\tpo.chat( \"Warning. Stripped out string '\" + x[0].trim() + \"' because it looked like a chapter heading across a page break. If not, you probably ought to add it back in again manually.\", Earthdawn.whoFrom.apiWarning );\n\t\t\t\t\t\t\t\tfullText = fullText.slice( 0, i) + fullText.slice( prev );\t\t// Page Number and Page Header. Strip the current line and the next. \n\t\t\t\t\t\t\t} else\n\t\t\t\t\t\t\t\tfullText = fullText.slice( 0, i) + fullText.slice( eol );\t\t// Page Number only. Strip the current line out. \n\t\t\t\t\t\t}\n\t\t\t\t\t\tprev = eol;\n\t\t\t\t\t\teol = i;\n\t\t\t\t\t\ti = fullText.lastIndexOf( '\\n', i -1 );\n\t\t\t\t\t}\n\t\t\t\t} // end removePageNumbers", "title": "" }, { "docid": "139a18eca19a42d28708cfbf7be44a28", "score": "0.5478682", "text": "function removeText() {\n //removes an element with the id 'line' (used in 'out' method)\n if (document.getElementById(\"line\")) {\n let e = document.getElementById(\"line\");\n e.parentNode.removeChild(e);\n }\n //removes an element with the id 'div' (used in 'outputObject' method)\n if (document.getElementById(\"div\")) {\n let e = document.getElementById(\"div\");\n e.parentNode.removeChild(e);\n }\n //removes all elements with the id 'divs' (used in 'outputObjects' method)\n while (document.getElementById(\"divs\")) {\n let e = document.getElementById(\"divs\");\n e.parentNode.removeChild(e);\n }\n}", "title": "" }, { "docid": "1200fe3c791356ac76a28e9397a5c41c", "score": "0.54684186", "text": "function erase(){\n if(!operatorComponent){\n if(firstComponent[firstComponent.length - 1] === '.'){\n decimalCounter = false;\n }\n\n firstComponent = firstComponent.slice(0, -1);\n\n const displayPicker = document.getElementById('display');\n displayPicker.innerText = firstComponent.substring(0,14);\n }else{\n secondComponent = secondComponent.slice(0, -1);\n\n const displayPicker = document.getElementById('display');\n displayPicker.innerText = secondComponent.substring(0,14);\n }\n}", "title": "" }, { "docid": "ba896c685c6a3d833c226255ae60ac51", "score": "0.54326624", "text": "function part4reset() {\n document.getElementById('partFour').innerHTML = \" \"\n}", "title": "" }, { "docid": "64bb63b5f00644e3eb4dd71324314670", "score": "0.5428245", "text": "function clear_text() {\n\n document.getElementById(\"Move_here\").appendChild(document.getElementById(\"Move_this\"));\n // document.getElementById(\"to do\").style.display = \"inline-block\"\n // document.getElementById(\"done\").style.display = \"inline-block\"\n document.getElementById(\"banner\").style = \"padding-top: 10px;\"\n\n document.getElementById(\"application_table_1\").style.display = \"inline-block\";\n document.getElementById(\"application_table_2\").style.display = \"inline-block\";\n\n}", "title": "" }, { "docid": "fac862101a444d65986bf2a150ea129c", "score": "0.54177445", "text": "function finished() {\n\n choices.remove();\n sectionOne.textContent = \"Finished!\";\n sectionTwo.appendChild(h1);\n h1.textContent = `Your final score is ${correctAnswers}!`;\n form.style.display = \"block\";\n \n}", "title": "" }, { "docid": "e3fd807c0265b4f6d68227cd530219f3", "score": "0.54147494", "text": "function tellPart(section, i, j) {\n if (more) more.remove();\n // only first line of section first part\n // write new paragraph or continue old one...\n var part = _parser2.default.part(section.paragraphs[i][j]);\n\n if (noNewline(i, j, section)) {\n paper.continue(part.text);\n } else {\n paper.writeParagraph(part.text);\n }\n\n if (part.multipleChoice) {\n // create listeners for multiple choice\n var multipleChoice = paper.currentParagraph.getElementsByClassName(\"multiple-choice\")[0];\n _interaction2.default.awaitChoice(multipleChoice).then(function (choice) {\n multipleChoice.remove();\n tellSection(choice);\n });\n } else {\n var end = i >= section.paragraphs.length - 1 && j >= section.paragraphs[i].length - 1;\n if (!end) {\n more = createMoreIndication(paper.currentParagraph);\n _interaction2.default.awaitInput(more).then(forEveryPart);\n }\n }\n}", "title": "" }, { "docid": "f2c6d9a2b42308fb413bf2c3e81b9414", "score": "0.5403278", "text": "function theEnd() {\r\nstory.innerHTML +=\"<p>The End.</p>\";\r\nquestion.innerHTML=\"\";\r\nanser.style.display =\"none\";\r\n}", "title": "" }, { "docid": "529476251ddd959305535416ff564127", "score": "0.5387927", "text": "function printTrip (trip) {\n\n var journeyPartOne= '';\n var journeyPartTwo= '';\n\n if (oneLine==false) {\n\n for (var i= 1; i <= trip.indexOf('Union Square'); i++) {\n journeyPartOne += trip[i];\n\n if (i != trip.indexOf('Union Square')) {\n journeyPartOne += ', ';\n }\n }\n console.log('You must travel through the following stops on the line: ' + journeyPartOne + '.');\n console.log('Change at Union Square.');\n\n for (var x= trip.indexOf('Union Square')+1; x < trip.length; x++) {\n journeyPartTwo += trip[x];\n\n if (x != trip.length-1) {\n journeyPartTwo += ', ';\n }\n }\n \n console.log('Your journey continues through the following stops: '+ journeyPartTwo + '.');\n console.log(`${trip.length} stops in total.`);\n \n } else {\n for (var i= 0; i < trip.length; i++) {\n journeyPartOne += trip[i];\n\n if (i != trip.length-1) {\n journeyPartOne += ', ';\n }\n }\n console.log('You must travel through the following stops on the line: ' + journeyPartOne + '.');\n console.log(`${trip.length} stops in total.`);\n }\n}", "title": "" }, { "docid": "96e8ce41c7ff088e7d053429d380bbac", "score": "0.5387331", "text": "function trimDescription(feature) {\n var description = feature.get('description');\n if (description) {\n description = description.replace(/<(?:.|\\n)*?>/gm, '');\n var trimDescription = description.trim();\n if (trimDescription !== 'Wind Speed Probability 5% contour') {\n var textDescription = trimDescription;\n return textDescription;\n }\n }\n}", "title": "" }, { "docid": "531231c7f96c5ae230136aec1185ccf7", "score": "0.5370821", "text": "function removeParagraphToProject() {\n var last_chq_no = $('#total_chq1').val();\n if (last_chq_no > 1) {\n $('#projectParagraph' + last_chq_no).remove();\n $('#total_chq1').val(last_chq_no - 1);\n }\n}", "title": "" }, { "docid": "1c84575630f896aff9c8e6c607ef3f3e", "score": "0.53622043", "text": "function choixCarte_secteurs1() {\n\t\t\t\t\n\t\t\t\ttype_carte1 = \"secteurs\";\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tvar attributs = document.getElementById('stats_Comparaison_carte_attributs1');\n\t\t\t\t\n\t\t\t\t// supprime le choix de la précision de la carte\n\t\t\t\t\n\t\t\t\tif (document.getElementById('stats_Comparaison_carte_attribut_precision1')) {\n\t\t\t\t\t\n\t\t\t\t\tvar attribut_precision = document.getElementById('stats_Comparaison_carte_attribut_precision1');\n\t\t\t\t\tattributs.removeChild(attribut_precision);\n\t\t\t\t\t\n\t\t\t\t\tvar option_precision = document.getElementById('stats_Comparaison_carte_option_precision1');\n\t\t\t\t\tattributs.removeChild(option_precision);\n\t\t\t\t}\n\t\t\t}", "title": "" }, { "docid": "42c0c1a2a58ed9e28923e25c446a9019", "score": "0.5350519", "text": "function resetSection(){\n // Delete the existing section with all elements in it.\n var element = document.getElementById(\"listOfWordsDisplayedList\");\n element.parentNode.removeChild(element);\n\n // Create the new section\n listSection=document.getElementById('listOfWordsDisplayed');\n var section=document.createElement('section');\n section.id = \"listOfWordsDisplayedList\"\n listSection.appendChild(section);\n\n /*\n Create ul element and append it to section.\n This ul element is further used to add list element\n */\n listSection=document.getElementById('listOfWordsDisplayedList');\n ul=document.createElement('ul');\n listSection.appendChild(ul);\n}", "title": "" }, { "docid": "5c8fa02fb9c7f9c5ea7ec567343467af", "score": "0.53455245", "text": "function convertIngredientsToDisplayMode(){\n $('.removeDiv').remove();\n $('.addButton').remove();\n $('.recipeSectionLabel').remove();\n}", "title": "" }, { "docid": "f739b1f29000a36b21d4889364b92d13", "score": "0.5336806", "text": "function cleanCorrection( wrongSection, correction ) {\n\n var newCorrection;\n console.log('wrongSection:', wrongSection);\n\n if ( correction === \"x\" || correction === \"[delete]\" ) {\n\n if ( wrongSection[ 0 ] === \" \" && wrongSection[ wrongSection.length - 1 ] === \" \" ) {\n\n console.log('both');\n newCorrection = \" \";\n\n } else if ( wrongSection[ 0 ] === \" \" || wrongSection[ wrongSection.length - 1 ] === \" \" ) {\n\n console.log('left or right');\n newCorrection = \"\";\n\n } else {\n\n console.log('nowt');\n newCorrection = correction;\n\n newCorrection = \"deleteASpace\";\n\n }\n\n // if error is a space then need to add spaces around it\n } else if ( wrongSection === \" \" ) {\n\n console.log('gap');\n newCorrection = \" \" + correction + \" \";\n\n } else if ( wrongSection[ 0 ] === \" \" && wrongSection[ wrongSection.length - 1 ] === \" \" ) {\n\n console.log('both');\n newCorrection = \" \" + correction + \" \";\n\n } else if ( wrongSection[ 0 ] === \" \" ) {\n\n console.log('left');\n newCorrection = \" \" + correction;\n\n } else if ( wrongSection[ wrongSection.length - 1 ] === \" \" ) {\n\n console.log('right');\n newCorrection = correction + \" \";\n\n } else {\n\n console.log('nowt');\n newCorrection = correction;\n\n }\n\n console.log('new correction:', newCorrection );\n return newCorrection\n\n }", "title": "" }, { "docid": "13c6aa308f2b8de9c85ed5ae6721c270", "score": "0.5308252", "text": "function removeExerciseDisplay() {\n\tconst removeExercise = document.querySelectorAll(\".exercise_set\");\n\tremoveExercise.forEach((input) => {\n\t\tinput.remove();\n\t});\n}", "title": "" }, { "docid": "8c88c1afc650278a0a809e3fde78a30c", "score": "0.5299381", "text": "function resetTimeDisplay()\n{\n document.getElementById(\"category\").innerHTML = ''; //Reset category\n \n //Remove Splits\n var created_splits = document.querySelector('#splits');\n\n while (created_splits.firstChild)\n {\n created_splits.removeChild(created_splits.firstChild);\n }\n\n\n\n}", "title": "" }, { "docid": "4fe9b4d299adb92e9441c4c50bb464b5", "score": "0.52810043", "text": "function removeResult(){\n resultsSection.innerHTML = \"\";\n}", "title": "" }, { "docid": "416f1ea35d9060ba72b1f61b759fe47f", "score": "0.5279223", "text": "function clear_Note(){\r\n document.getElementById('Note_Result').innerHTML = \" \";\r\n document.getElementById('Title0').style.display = \"none\";\r\n}", "title": "" }, { "docid": "0443a7e7e76bf6938abd8ac7e0ecc07f", "score": "0.52409184", "text": "function removeAnswer() {\n var answers = document.getElementsByClassName('answerselection');\n if (answers.length > 2) {\n answers[answers.length-1].remove();\n }\n}", "title": "" }, { "docid": "30855689380fd6cd5f8e815b3a1769c4", "score": "0.52389556", "text": "function delScrn(){\n let ld = calcscreen.textContent.slice(-1);\n if(ld===\" \"){\n let ro = calcscreen.textContent.split(\"\\n\");\n ro.pop();ro.pop();\n calcscreen.textContent = ro.toString().slice(0,-1);\n }\n else{\n calcscreen.textContent = calcscreen.textContent.slice(0,-1);\n ld = calcscreen.textContent.slice(-1);\n }\n}", "title": "" }, { "docid": "33376a8a0e72c4c847d0d73a0d7959b8", "score": "0.5235214", "text": "function choixCarte_secteurs2() {\n\t\t\t\t\n\t\t\t\ttype_carte2 = \"secteurs\";\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tvar attributs = document.getElementById('stats_Comparaison_carte_attributs2');\n\t\t\t\t\n\t\t\t\t// supprime le choix de la précision de la carte\n\t\t\t\t\n\t\t\t\tif (document.getElementById('stats_Comparaison_carte_attribut_precision2')) {\n\t\t\t\t\t\n\t\t\t\t\tvar attribut_precision = document.getElementById('stats_Comparaison_carte_attribut_precision2');\n\t\t\t\t\tattributs.removeChild(attribut_precision);\n\t\t\t\t\t\n\t\t\t\t\tvar option_precision = document.getElementById('stats_Comparaison_carte_option_precision2');\n\t\t\t\t\tattributs.removeChild(option_precision);\n\t\t\t\t}\n\t\t\t}", "title": "" }, { "docid": "161d5f22c084d37d4848701296cd3ad7", "score": "0.5230946", "text": "removePuzzleRatings() {\n\t\tvar infos = document.getElementsByClassName(\"puzzle infos\");\n\t\tif (infos.length == 0){return;}\n\t\tvar element = infos[0];\n\t\t\n\t\tvar splitInnerHTML = element.innerHTML.split(\"<p>Rating\");\n\t\telement.innerHTML = splitInnerHTML[0] + splitInnerHTML[1].substring(splitInnerHTML[1].indexOf(\"</p>\")+4);\n\t}", "title": "" }, { "docid": "559f9873a7822ba7782b31e87eed2010", "score": "0.5212018", "text": "function trimTrailingZeros(sectionText) {\n if (sectionText) {\n var replacedText = sectionText;\n\n for (var i = replacedText.length - 1; i >= 0; i -= 1) {\n if (replacedText[i] === ' ') {\n replacedText = \"\".concat(replacedText.substring(0, i), \"&nbsp;\").concat(replacedText.substring(i + 1));\n } else {\n break;\n }\n }\n\n return replacedText;\n }\n\n return sectionText;\n }", "title": "" }, { "docid": "f0caeb3bd22fd5a532d1cb02543f9295", "score": "0.52054036", "text": "function getSectionWikitext( wikitext, sectionName, sectionDupeIdx ) {\n console.log(\"In getSectionWikitext, sectionName = >\" + sectionName + \"< (wikitext.length = \" + wikitext.length + \")\");\n //console.log(\"wikitext (first 1000 chars) is \" + dirtyWikitext.substring(0, 1000));\n\n // There are certain locations where a header may appear in the\n // wikitext, but will not be present in the HTML; such as code\n // blocks or comments. So we keep track of those ranges\n // and ignore headings inside those.\n var ignoreSpanStarts = []; // list of ignored span beginnings\n var ignoreSpanLengths = []; // list of ignored span lengths\n var IGNORE_RE = /(<pre>[\\s\\S]+?<\\/pre>)|(<source.+?>[\\s\\S]+?<\\/source>)|(<!--[\\s\\S]+?-->)/g;\n var ignoreSpanMatch;\n do {\n ignoreSpanMatch = IGNORE_RE.exec( wikitext );\n if( ignoreSpanMatch ) {\n //console.log(\"ignoreSpan \",ignoreSpanStarts.length,\" = \",ignoreSpanMatch);\n ignoreSpanStarts.push( ignoreSpanMatch.index );\n ignoreSpanLengths.push( ignoreSpanMatch[0].length );\n }\n } while( ignoreSpanMatch );\n\n var startIdx = -1; // wikitext index of section start\n var endIdx = -1; // wikitext index of section end\n\n var headerCounter = 0;\n var headerMatch;\n\n // So that we don't check every ignore span every time\n var ignoreSpanStartIdx = 0;\n\n var dupeCount = 0;\n var lookingForEnd = false;\n\n if( sectionName === \"\" ) {\n // Getting first section\n startIdx = 0;\n lookingForEnd = true;\n }\n\n // Reset regex state, if for some reason we're not running this for the first time\n HEADER_REGEX.lastIndex = 0;\n\n headerMatchLoop:\n do {\n headerMatch = HEADER_REGEX.exec( wikitext );\n if( headerMatch ) {\n\n // Check that we're not inside one of the \"ignore\" spans\n for( var igIdx = ignoreSpanStartIdx; igIdx <\n ignoreSpanStarts.length; igIdx++ ) {\n if( headerMatch.index > ignoreSpanStarts[igIdx] ) {\n if ( headerMatch.index + headerMatch[0].length <=\n ignoreSpanStarts[igIdx] + ignoreSpanLengths[igIdx] ) {\n\n console.log(\"(IGNORED, igIdx=\"+igIdx+\") Header \" + headerCounter + \" (idx \" + headerMatch.index + \"): >\" + headerMatch[0].trim() + \"<\");\n\n // Invalid header\n continue headerMatchLoop;\n } else {\n\n // We'll never encounter this span again, since\n // headers only get later and later in the wikitext\n ignoreSpanStartIdx = igIdx;\n }\n }\n }\n\n //console.log(\"Header \" + headerCounter + \" (idx \" + headerMatch.index + \"): >\" + headerMatch[0].trim() + \"<\");\n // Note that if the lookingForEnd block were second,\n // then two consecutive matching section headers might\n // result in the wrong section being matched!\n if( lookingForEnd ) {\n endIdx = headerMatch.index;\n break;\n } else if( wikitextHeaderEqualsDomHeader( /* wikitext */ headerMatch[2], /* dom */ sectionName ) ) {\n if( dupeCount === sectionDupeIdx ) {\n startIdx = headerMatch.index;\n lookingForEnd = true;\n } else {\n dupeCount++;\n }\n }\n }\n headerCounter++;\n } while( headerMatch );\n\n if( startIdx < 0 ) {\n throw( \"Could not find section named \\\"\" + sectionName + \"\\\" (dupe idx \" + sectionDupeIdx + \")\" );\n }\n\n // If we encountered no section after the target section,\n // then the target was the last one and the slice will go\n // until the end of wikitext\n if( endIdx < 0 ) {\n //console.log(\"[getSectionWikitext] endIdx negative, setting to \" + wikitext.length);\n endIdx = wikitext.length;\n }\n\n //console.log(\"[getSectionWikitext] Slicing from \" + startIdx + \" to \" + endIdx);\n return wikitext.slice( startIdx, endIdx );\n }", "title": "" }, { "docid": "76574f87b9d30342f74df127308d8c86", "score": "0.5197679", "text": "function cut(){\n nutrition.splice(4,2)\n return (\"fruits and veggies: \", nutrition);\n}", "title": "" }, { "docid": "eee139ac6bae706708d8b16795b980f5", "score": "0.5195732", "text": "function clearQuestion() {\n questionDisplay.text(\"\");\n option1.text(\"\");\n option2.text(\"\");\n option3.text(\"\");\n option4.text(\"\");\n}", "title": "" }, { "docid": "c3bd7819e4ba95409778e0e3bfe9f299", "score": "0.5193715", "text": "function clean(sectionPosts) {\n sectionPosts.innerHTML = \"\";\n}", "title": "" }, { "docid": "332f8c47eac216df8729bb930897e8a0", "score": "0.51873505", "text": "function removeNote() {\n group = visibleNoteGroups.shift();\n visibleNotes.shift();\n if (group !== undefined) {\n group.classList.add(\"correct\");\n\n const transformMatrix = window.getComputedStyle(group).transform;\n const x = transformMatrix.split(\",\")[4].trim();\n // And, finally, we set the note's style.transform property to send it skyward.\n group.style.transform = `translate(${x}px, -800px)`;\n }\n}", "title": "" }, { "docid": "b11b9ae2e366671acf2fcc58069dd82c", "score": "0.51848954", "text": "function formatTextInfo() {\n if (currentSlide == 1) {\n $(\"#slideshowtext\").replaceWith(\n '<p id = \"slideshowtext\">' +\n currentSlide +\n \". Screen Privacy is off.\" + '</p>');\n } else if (currentSlide == 2) {\n $(\"#slideshowtext\").replaceWith(\n '<p id = \"slideshowtext\">' +\n currentSlide +\n \". Screen Privacy is on.\" + '</p>');\n } else if (currentSlide == 3) {\n $(\"#slideshowtext\").replaceWith(\n '<p id = \"slideshowtext\">' +\n currentSlide +\n \" Rows Have a built in dropdown menu.\" +\n '</p>');\n } else if (currentSlide == 4) {\n $(\"#slideshowtext\").replaceWith(\n '<p id = \"slideshowtext\">' +\n currentSlide +\n \". TheCourses Taken table allows you to Modify your grade or Delete a row.\" +\n '</p>');\n } else if (currentSlide == 5) {\n $(\"#slideshowtext\").replaceWith(\n '<p id = \"slideshowtext\">' +\n currentSlide +\n \". Modifying grade for MAC2311.\" +\n '</p>');\n } else if (currentSlide == 6) {\n $(\"#slideshowtext\").replaceWith(\n '<p id = \"slideshowtext\">' +\n currentSlide +\n \". MAC2311 grade modified.\" + '</p>');\n } else if (currentSlide == 7) {\n $(\"#slideshowtext\").replaceWith(\n '<p id = \"slideshowtext\">' +\n currentSlide +\n \". Deleting course MAC2311.\" + '</p>');\n } else if (currentSlide == 8) {\n $(\"#slideshowtext\").replaceWith(\n '<p id = \"slideshowtext\">' +\n currentSlide +\n \". Course MAC2311 deleted.\" + '</p>');\n } else if (currentSlide == 9) {\n $(\"#slideshowtext\").replaceWith(\n '<p id = \"slideshowtext\">' +\n currentSlide +\n \". The Courses Needed table rows also dropdown.\" +\n '</p>');\n } else if (currentSlide == 10) {\n $(\"#slideshowtext\").replaceWith(\n '<p id = \"slideshowtext\">' +\n currentSlide +\n \". Modifying weight and relevance for COP3530.\" +\n '</p>');\n } else if (currentSlide == 11) {\n $(\"#slideshowtext\").replaceWith(\n '<p id = \"slideshowtext\">' +\n currentSlide + \". COP3530 updated.\" +\n '</p>');\n } else if (currentSlide == 12) {\n $(\"#slideshowtext\").replaceWith(\n '<p id = \"slideshowtext\">' +\n currentSlide +\n \". Selecting the <<< option adds the course as IP, or in progress.\" +\n '</p>');\n } else if (currentSlide == 13) {\n $(\"#slideshowtext\").replaceWith(\n '<p id = \"slideshowtext\">' +\n currentSlide +\n \". Choose from a selection of graduate programs to \" +\n '</p>');\n } else if (currentSlide == 14) {\n $(\"#slideshowtext\").replaceWith(\n '<p id = \"slideshowtext\">' +\n currentSlide +\n \". The options are revealed in the dropdown box.\" +\n '</p>');\n } else if (currentSlide == 15) {\n $(\"#slideshowtext\").replaceWith(\n '<p id = \"slideshowtext\">' +\n currentSlide +\n \". Each major may have a different required GPA\" +\n '</p>');\n } else {}\n }", "title": "" }, { "docid": "d6dc593afec851546897a6bcb6dd79e8", "score": "0.5154846", "text": "function show_sections(section_id,no_text_change_flag) {\n\n\telement_id = 'sec-' + section_id\n\tnew Effect[Element.visible(element_id) ? \n\t'BlindUp' : 'BlindDown'](element_id, {duration: 0.25});\n\n\n\tif (Element.visible(element_id)) {\n\t\tdocument.getElementById('sec-text-'+ section_id).innerHTML=\"+\";\n\t}\n\telse {\n\t\tdocument.getElementById('sec-text-'+ section_id).innerHTML=\"-\";\n\t}\n\n}", "title": "" }, { "docid": "e9a3eab896f78a3f2107cd0722de7042", "score": "0.5153298", "text": "function textSpeak() {\n//Due to the fact that Section1 has html tags that we don't want the speechSynthesis API to speak out,\n//we must remove the HTML tags and only have it read out the text in a string.\n//To do this we need to use the \"replace\" method.\n let textS = document.getElementById(\"next\").innerHTML;\n let taglessText = textS.replace(/<\\/?[^>]+(>|$)/g, \"\");\n //The taglessText variable will replace markup tags with blank spaces, so speech doesn't say them.\n let utterance = new SpeechSynthesisUtterance(taglessText);\n window.speechSynthesis.speak(utterance);\n}", "title": "" }, { "docid": "725979830a180496d2cf23cd7e5c655f", "score": "0.51507884", "text": "function clearSections(){\n let section = document.querySelector(\".section__quiz\");\n while (section.firstChild) {\n section.removeChild(section.firstChild);\n }\n section = document.querySelector(\".section__manager\");\n while (section.firstChild) {\n section.removeChild(section.firstChild);\n }\n section = document.querySelector(\".section__teams\");\n while (section.firstChild) {\n section.removeChild(section.firstChild);\n }\n}", "title": "" }, { "docid": "0f78e6bb80fc36c8c006a8de4f4b0871", "score": "0.5148659", "text": "resetPhrase() {\r\n const phraseDiv = document.querySelector(\"#phrase\");\r\n const chars = phraseDiv.querySelector(\"ul\");\r\n while (chars.firstChild) {\r\n chars.removeChild(chars.firstChild);\r\n }\r\n }", "title": "" }, { "docid": "acdae32ffa23ffee7bd77d7b040397d1", "score": "0.5120996", "text": "function clearPartOne(){\n\treseTrigAndUnitSelectors();\n\tfor(let i = 0; i < solveBtns.length; i++){\n\t\tif(solveBtns[i].checked){\n\t\t\tsolveBtns[i].checked = false;\n\t\t}\n\t}\n\tfor(let i = 0; i < firstUnits.length; i++){\n\t\tif(firstUnits[i].checked){\n\t\t\tfirstUnits[i].checked = false;\n\t\t}\n\t}\n\tfor(let i = 0; i < secondUnits.length; i++){\n\t\tif(secondUnits[i].checked){\n\t\t\tsecondUnits[i].checked = false;\n\t\t}\n\t}\n\tfor(let i = 0; i < partOneInputFields.length; i++){\n\t\tpartOneInputFields[i].value = \"\"\n\t\tpartOneInputFields[i].disabled = false;\n\t\tpartOneInputFields[i].type = \"number\";\n\t\tif(partOneInputFields[i].classList.contains(\"yellow-outline\")){\n\t\t\tpartOneInputFields[i].classList.remove(\"yellow-outline\");\n\t\t}\n\t}\n velocityFieldOne.placeholder = \"velocity\";\n\tdisplacementFieldOne.placeholder = \"displacement\" + \" (\\u0394x)\";\n\ttimeIntervalFieldOne.placeholder = \"time interval\" + \" (\\u0394t)\";\n\tcurrentSlideIndex = 0;\n\tswitchToSlide()\n}", "title": "" }, { "docid": "8985e5228229e76030449eef615a112d", "score": "0.51197845", "text": "function removeCourseFromAccordions(removedCourse, semester) {\n\n // Remove selected courses from each major accordion.\n var accordions = $(\".accordion\");\n for (var i = 0; i < accordions.length; i++) {\n\n // Get the collection of header/content pairs.\n var accordion = accordions[i].children[0];\n // Pray the DOM never changes.\n var progName = accordion.parentElement.parentElement.children[0].innerText;\n\n // A list of the DOM children of the accordion.\n var kids = accordion.children;\n var numReqs = kids.length / 2; // children.length always even.\n\n // For each \"requirement\" category in this accordion:\n req_loop:\n for (var j = 0; j < numReqs; j++) {\n var reqName = kids[2 * j].children[0].children[0].innerText;\n\n // A list of each \"slot\" into which courses can be added\n var subreqList = kids[2 * j + 1].children;\n var courseWasRemoved = false;\n\n // Iterate over all slots.\n // In each slot's popover info, un-strikethrough the removed course.\n // If removed course is in subreq's innerText, replace it with a new\n // \"Find a Course!\" popover element.\n for (var k = 0; k < subreqList.length; k++) {\n\n // unstrikethrough the removed course in this slot's popover.\n unstrikethrough(removedCourse, subreqList[k]);\n\n // if this slot's innerText is contained within the removedCourse string,\n // AND if this slot's semester A) exists and B) matches the semester parameter:\n // Replace the innerHTML with a fresh findacourse popover (from hiddenHTML);\n // Then delete hiddenHTML.\n var semesterMatches = false;\n if (subreqList[k].children[1] != null &&\n subreqList[k].children[1].classList.contains(\"semester-tag\"))\n {\n semesterMatches = (subreqList[k].children[1].innerText == semester);\n }\n if (removedCourse.includes(getText(subreqList[k])) && semesterMatches) {\n subreqList[k].innerHTML = subreqList[k].hiddenHTML;\n delete subreqList[k].hiddenHTML;\n courseWasRemoved = true;\n }\n }\n if (courseWasRemoved) {\n decrementHeading(kids[2 * j]);\n flash(kids[2 * j]);\n }\n }\n }\n // Reinitialize the popovers.\n refreshPopovers();\n}", "title": "" }, { "docid": "f1aa33de62f2b276f90a4e910de27806", "score": "0.51190144", "text": "function clearScr(id) {\n if (id == 'AC'){\n document.getElementById('display').innerText = '' ;\n }\n\n if (id == 'backSpc')\n {\n let result = (document.getElementById('display').innerText).slice(0, -1) \n document.getElementById('display').innerText = result\n\n }\n \n\n}", "title": "" }, { "docid": "e4c79e3af1b406eaca4a1796615d5608", "score": "0.51179856", "text": "function deselect() {\n const texts = [textOne, textTwo, textThree, textFour, textFive]\n texts.forEach((each) => {\n each.style('display', null)\n each.attr('fill', 'black')\n each.style('opacity', '1')\n })\n canvas.style('transform', 'translate(0px, 0px)')\n description.style('position', 'absolute')\n .style('top', '0px')\n .style('left', `${(canvasWidth / 4) + 50}px`)\n const descDOM = document.querySelector('.Onion_Theory__diagram__descriptions')\n descDOM.classList.remove('show')\n onionSelected = false\n }", "title": "" }, { "docid": "0aadb6793936f256947a26d1d2c298d9", "score": "0.5115284", "text": "meltNextPart() {\n if (this.visibleIndex === (this.snowPalParts.length)) {\n return;\n }\n this.snowPalParts[this.visibleIndex++].setVisible(false);\n }", "title": "" }, { "docid": "6f79331d9a8a4f8743e5f5260a1269c5", "score": "0.5110395", "text": "function clearScreen() {\n document.getElementById(\"points_location\").innerHTML=\"\";\n document.getElementById(\"wiki\").innerHTML =\"<p>Press on a satellite marker on the right for more information!</p>\";\n}", "title": "" }, { "docid": "1d192eb6cfa77404162b7051b206eca3", "score": "0.5104947", "text": "function hideSection1() {\n var HideS1 = document.getElementById('section1');\n if (HideS1.style.display === '', 'none') {\n HideS1.style.display = 'none';\n } else {\n\n }\n}", "title": "" }, { "docid": "aad9559ee0718f083a710c97639ee846", "score": "0.51004004", "text": "function removeHints() {\n var _this3 = this;\n\n var hints = hintQuerySelectorAll(\".introjs-hint\");\n forEach(hints, function (hint) {\n removeHint.call(_this3, hint.getAttribute(\"data-step\"));\n });\n }", "title": "" }, { "docid": "3bb7e77cbdb9c538e9c60bded76d05c8", "score": "0.5099926", "text": "function confirmGoingToNextSection(arrayOfTriggeredSubdomains){\n //Set all of the other features to display none\n if(currentSectionIndex == 0){\n if(arrayOfTriggeredSubdomains.length == 0)\n congratulationsMoveOntoInformant(arrayOfTriggeredSubdomains);\n else\n sorryMoveOntoPatientFollowUp(arrayOfTriggeredSubdomains);\n } else if (currentSectionIndex == 1){\n congratulationsMoveOntoInformant(arrayOfTriggeredSubdomains);\n\n } else if (currentSectionIndex == 2){\n if(arrayOfTriggeredSubdomains.length == 0)\n congratulationsTheresNoConcerns();\n else\n sorryMoveOntoInformantFollowUp(arrayOfTriggeredSubdomains);\n \n } else if (currentSectionIndex == 3){\n congratulationsTheresNoConcerns();\n }\n}", "title": "" }, { "docid": "d2b1344ad0d66cb2916645288b2ab181", "score": "0.5098071", "text": "function displayText() {\n\t\tif (index == result.length) {\n\t\t\tonStop();\n\t\t} else if (index < result.length) {\n\t\t\tvar deleteEnd = \",.!?;:\";\n\t\t\tvar text = result[index];\n\t\t\tif (deleteEnd.includes(text.charAt(text.length - 1)) && !cut) {\n\t\t\t\tresult[index] = text.substring(0, text.length - 1);\n\t\t\t\tcut = true;\n\t\t\t\tdocument.getElementById(\"display\").innerHTML = result[index];\n\t\t\t\tindex--;\n\t\t\t} else {\n\t\t\t\tdocument.getElementById(\"display\").innerHTML = result[index];\n\t\t\t\tcut = false;\n\t\t\t}\n\t\t\tindex++;\n\t\t}\n\t}", "title": "" }, { "docid": "15193c5f0aa3b4e442d2ef285bc37c3c", "score": "0.5097638", "text": "function snip() {\n\n// Remove the last character from snippet.\n\n snippet = snippet.slice(0, -1);\n }", "title": "" }, { "docid": "772b73540d427780be189e2e938f8160", "score": "0.50972575", "text": "function showOriginSection(sectionId) {\n console.log(sectionId);\n $(\".word-origin-section-\"+sectionId).toggle();\n $(\".word-example-section-\"+sectionId).css(\"display\",\"none\");\n}", "title": "" }, { "docid": "7c0de99600746950c125c18aaac1ee96", "score": "0.50970364", "text": "function hideTrailer () {\n $('#trailer-wrapper').html('');\n}", "title": "" }, { "docid": "d3a7db4e2ef65076015746be07719b0e", "score": "0.5088299", "text": "function showSectionOne () {\n\tmusic.play();\n\tSectionOne.classList.remove(\"dn\")\n\tdeclencheur += 1;\n\tshowButtonFinal()\n}", "title": "" }, { "docid": "1649041381dd49967cad8cdb11b20605", "score": "0.5088218", "text": "function removeSolution() {\n var answer= document.getElementById(\"correctAnswer\");\n var youGotIt = document.getElementById(\"youGotIt\");\n\n if (answer.classList.contains(\"showSolution\")) {\n answer.classList.remove(\"showSolution\");\n }\n\n if (youGotIt.classList.contains(\"showSolution\")) {\n youGotIt.classList.remove(\"showSolution\");\n }\n\n }", "title": "" }, { "docid": "367c8e260c27f0922639ce3dd0cc00da", "score": "0.50873274", "text": "function cutQuestionChatter(text) {\n let retval = text;\n for (let i = 0; i < beginningQuestionChatter.length; i++) {\n if (retval.startsWith(beginningQuestionChatter[i] + ' ')) {\n retval = retval.substring(beginningQuestionChatter[i].length);\n retval = retval.trim();\n }\n }\n for (let i = 0; i < endingQuestionChatter.length; i++) {\n if (retval.endsWith(' ' + endingQuestionChatter[i])) {\n retval = retval.substring(0, retval.length - endingQuestionChatter[i].length);\n retval = retval.trim();\n }\n }\n return retval;\n}", "title": "" }, { "docid": "96fc0e21307d551efb76eca2f7ff5b97", "score": "0.5081341", "text": "function gargoyleMeeting2(character) {\n DisplayText_1.DisplayText().clear();\n DisplayText_1.DisplayText(\"You finally close the distance between yourself and the strange structure, which begins to take shape ahead. Though it's half-buried under what must be years of built-up sand and debris, you can clearly make out high stone walls supported by vaulted arches, broken every so often by the shattered remains of stained-glass windows and a pair of utterly destroyed oaken doors nearly hidden behind a row of tall marble pillars, many of which have long since crumbled. High above the ground, you can see a pair of tall, slender towers reaching up to the heavens, one of which has been nearly obliterated by some unimaginably powerful impact, leaving it a stump compared to its twin. From the rooftops, strange shapes look down upon you – stone statues made in the image of demons, dragons, and other monsters.\");\n // [b]You have discovered The Cathedral[/b] (If Fen wants to make this a Place; otherwise it can be encountered in the future via the Explore –> Explore function. Whichever works better. )\n DisplayText_1.DisplayText(\"\\n\\nYou arrive at the grounds around the ruins, cordoned off by a waist-high wrought-iron fence that surrounds the building and what once might have been a beautiful, pastoral garden, now rotting and wilted, its trees chopped down or burned, twig-like bushes a mere gale's difference from being tumbleweeds. A few dozen tombstones outline the path to a gaping maw that was once the great wooden doors. Seeing no obvious signs of danger, you make your way inside, stepping cautiously over the rubble and rotting debris that litters the courtyard.\");\n DisplayText_1.DisplayText(\"\\n\\nIt's quite dark inside, illuminated only by thin shafts of light streaming in from the shattered windows and sundered doors. You can make out a few dozen wooden pews, all either thrown aside and rotting or long-since crushed, leading up to a stone altar and an effigy of a great green tree, now covered in graffiti and filth. Stairs beside the altar lead up to the towers, and down to what must be catacombs or dungeons deep underground.\");\n DisplayText_1.DisplayText(\"\\n\\nHowever, what most catches your eye upon entering the sanctuary are the statues that line the walls. Beautifully carved gray stone idols of creatures, chimeras, and nearer to the altar, god-like beings, are each set into their own little alcove. Unfortunately most have been destroyed along with the cathedral, each lying in a pile of its own shattered debris; some having whole limbs or other extremities broken off and carried away by looters, leaving them mere shadows of their former glory.\");\n DisplayText_1.DisplayText(\"\\n\\nAll of them but one. In the farthest, darkest alcove you see a single statue that still seems intact. It is of a woman – well, more like a succubus than a human woman. Though posed in a low, predatory crouch, she would normally stand nearly six feet tall, hair sculpted to fall playfully about her shoulders. A pair of bat-like wings protruding from her back curl back to expose the lush, smooth orbs of her breasts, easily DD's on a human. A spiked, mace-like tail curls about her legs that are attached to the pedestal upon which she's placed. As you stand marveling at the statue's beauty, you cannot help but notice the slit of her pussy nearly hidden beneath her. Oddly, it seems to have been carved hollow so that you could easily stick a few fingers inside if you so choose.\");\n if (character.stats.lib >= 40)\n DisplayText_1.DisplayText(\" Maybe you could take this with you as a life-sized sex toy?\");\n DisplayText_1.DisplayText(\"\\n\\nHowever, your attention is soon drawn from her body to the pedestal upon which she stands. A pair of solid gold chains extend from the pedestal to her wrists, binding the statue. You notice a plaque has been bolted to the pedestal, a feature not present on any of the other statues here. Leaning down, you blow a sizable amount of dust from the plaque, revealing the following short inscription:\");\n DisplayText_1.DisplayText(\"\\n\\n\\\"<i>Break my bonds to make me tame.</i>\\\"\");\n DisplayText_1.DisplayText(\"\\n\\nYou suppose you could break the chains on the statue. But who knows what will happen if you do?\");\n User_1.User.places.get(PlaceName_1.PlaceName.Cathedral).locationKnown = true;\n DisplayText_1.DisplayText(\"\\n\\n<b>You have discovered the cathedral. You can return here in the future by selecting it from the 'Places' menu in your camp.</b>\\n\");\n // (Display [Break Chains] and [Don't Break] options)\n return { choices: [[\"Don't Break\", dontBreakThatShit], [\"Break Chains\", breakZeChains]] };\n}", "title": "" }, { "docid": "8f2916e0c457af183bff236be4ac44ae", "score": "0.5077452", "text": "function uncover(section) {\n for(var y = 0; y < tableRow; y++) {\n for(var x = 0; x < tableColumn; x++) {\n var spot = getSpot(_this.fields, y, x);\n if (!section.hasOwnProperty('content') && !spot.hasOwnProperty('content')) {\n if (!spot.showFlag && spot.isCovered) {\n _this.openedSpots++;\n }\n spot.isCovered = false;\n spot.neverDisplay = true;\n } else if (section.content === 'mine') {\n if (!spot.showFlag && spot.isCovered) {\n _this.openedSpots++;\n }\n spot.isCovered = false;\n spot.neverDisplay = true;\n }\n \n }\n }\n }", "title": "" }, { "docid": "7eed532c5e70c164c1a7f2813e9711d8", "score": "0.50748134", "text": "function read_more_less_recipe() {\n var btn = document.getElementById(\"btn\");\n var txt = document.getElementById(\"text\");\n var minText =\"Estimate time: 30min <br>\";\n \n var fullText = \"Estimate time: 30min <br>\"+\n \"<h3>Ingredients:</h3>\"+\n \"<ul>\"+\n \"<li>2 cups plain flour (290g)</li>\"+\n \"<li>1/4 cup sugar or sweetener (60g)</li>\"+\n \"<li>4 teaspoons baking powder</li>\"+\n \"<li>1/4 teaspoon baking soda</li>\"+\n \"<li>1/2 teaspoon salt</li>\"+\n \"<li>1 3/4 cups milk (440ml)</li>\"+\n \"<li>1/4 cup butter (60g)</li>\"+\n \"<li>2 teaspoons pure vanilla extract</li>\"+\n \"<li>1 large egg</li>\"+\n \"</ul><br>\"+\n \"<h3>Instructions:</h3>\"+\n \"<ol>\"+\n \"<li>Combine the flour, sugar, baking powder, baking soda and salt in a large-sized bowl.\"+\n \"Make a well in the centre and add the milk, slightly cooled melted butter, vanilla and egg.</li>\"+\n \"<li>Use a wire whisk to whisk the wet ingredients together first before slowly folding them into \"+\n \"the dry ingredients. Mix together until smooth (there may be a couple of lumps but that's okay).</li>\"+\n \"<li>Set the batter aside and allow to rest while heating up your pan or griddle. </li>\"+\n \"<li>Heat a nonstick pan or griddle over low-medium heat and wipe over with a little\"+\n \"butter to lightly grease pan. Pour ¼ cup of batter onto the pan and spread out gently\"+\n \"into a round shape with the back of your ladle or measuring cup.</li>\"+\n \"<li>When the underside is golden and bubbles begin to appear on the surface,\"+\n \"flip with a spatula and cook until golden. Repeat with remaining batter.</li>\"+\n \"<li>Serve with honey, maple syrup, fruit, ice cream or frozen yoghurt, or enjoy plain!</li>\"+\n \"</ol> <br>\";\n if (btn.value == 'Read More') {\n btn.value = 'Read Less';\n txt.innerHTML = fullText;\n }\n else {\n btn.value = 'Read More';\n txt.innerHTML = minText;\n }\n }", "title": "" }, { "docid": "df7f7485751a35233a4a4eb18327c07b", "score": "0.50744003", "text": "delete_section() { Editor.delete_section(this) }", "title": "" }, { "docid": "134371df0a796ab2d5817be2a327cff0", "score": "0.50682604", "text": "function showExampleSection(sectionId) {\n console.log(sectionId);\n $(\".word-example-section-\"+sectionId).toggle();\n $(\".word-origin-section-\"+sectionId).css(\"display\",\"none\"); \n}", "title": "" }, { "docid": "758625b9477db379b7adb590e5992a37", "score": "0.5064007", "text": "function removeExerciseFromRoutine(routine, exercise) {}", "title": "" }, { "docid": "e1d3849731799126606d736903b74db7", "score": "0.5052355", "text": "function removeFirst() {\n $(\"#startPage\").hide();\n createQuestion()\n\n}", "title": "" }, { "docid": "2d86adb407785f0e553151bf5231d98e", "score": "0.5048474", "text": "function toPrint(contests, section) {\n debug('Print section: ', section.title, contests.length);\n if (!contests.length) {\n return;\n }\n\n // Get simple objects\n contests = _.map(contests, c => {\n return _.isPlainObject(c) ? c : c.toJSON();\n });\n\n // For every primary that is partisan, we actually want to print twice,\n // split up\n let splitContests = [];\n let printedParties = ['D', 'DFL', 'R'];\n contests.forEach(c => {\n if (c.election.primary && c.nonpartisan !== true && !c.ranked) {\n printedParties.forEach(party => {\n let copy = _.cloneDeep(c);\n\n // Check that there is this party\n if (c.candidates.find(c => c.party === party)) {\n copy.candidates = c.candidates.filter(c => c.party === party);\n copy.primaryParty = party;\n\n // Hacky way to test for uncontested\n if (section && section.where && section.where.uncontested) {\n if (\n (section.where.uncontested === false ||\n section.where.uncontested['$not'] === true) &&\n copy.candidates.length <= 1\n ) {\n return;\n }\n }\n\n splitContests.push(copy);\n }\n });\n }\n else {\n splitContests.push(c);\n }\n });\n contests = splitContests;\n\n // Default headings\n let defaultHeadings = ['area', ['name', 'seatName', 'subArea']];\n\n // Place to compile lines\n let lines = [];\n\n // Title\n //lines.push(tags.heading1 + section.title);\n\n // Go through each contest\n let previous = null;\n _.each(contests, c => {\n c.sectionTitle = section.title;\n\n // Determine what headings we need to display\n let higherHeadingChanged = false;\n let headings = section.headings || defaultHeadings;\n\n _.each(section.headings || defaultHeadings, (h, hi) => {\n let sep =\n section.separators && section.separators[hi]\n ? section.separators[hi]\n : ' ';\n\n if (h) {\n let currentH = _.isArray(h) ? _.filter(_.pick(c, h)).join(sep) : c[h];\n let previousH = previous\n ? _.isArray(h)\n ? _.filter(_.pick(previous, h)).join(sep)\n : previous[h]\n : undefined;\n\n // Handle any renames\n if (section.rename && section.rename[hi]) {\n _.each(section.rename[hi], replace => {\n if (replace.length !== 2) {\n return;\n }\n\n currentH = currentH\n ? currentH\n .replace(new RegExp(replace[0], 'ig'), replace[1])\n .replace(/\\s+/g, ' ')\n .trim()\n : currentH;\n previousH = previousH\n ? previousH\n .replace(new RegExp(replace[0], 'ig'), replace[1])\n .replace(/\\s+/g, ' ')\n .trim()\n : previousH;\n });\n }\n\n // If heading changed or no previous or high heading changed or\n // (last heading and not higher heading change and not question)\n if (\n ((hi === headings.length - 1 &&\n !higherHeadingChanged &&\n !c.question) ||\n higherHeadingChanged ||\n !previous ||\n currentH !== previousH) &&\n currentH\n ) {\n lines.push(tags['heading' + (hi + 2)] + currentH);\n higherHeadingChanged = true;\n }\n }\n });\n\n // Note if no candidates (besides write-ins)\n if (\n c.candidates.length === 0 ||\n (c.candidates.length === 1 && c.candidates[0].party === 'WI')\n ) {\n lines.push(tags.note + 'No candidates running in this contest.');\n previous = c;\n return;\n }\n\n // Meta. Only show open seats if not primary, or if rawseats is half seats,\n // Not best way to know.\n if (\n (!c.election.primary && c.seats > 1) ||\n (c.election.primary && c.seats > 2)\n ) {\n lines.push(tags.meta + 'Open seats: ' + c.seats);\n }\n\n // Question text.\n if (c.questionText) {\n lines.push(\n tags.question +\n (section.inlineQuestionTitle\n ? c.name.replace(/(.*)(question(.*))/i, '$2') +\n (c.seatName ? ' ' + c.seatName : '') +\n ': ' +\n c.questionText.replace(/\\s+/gm, ' ')\n : c.questionText.replace(/\\s+/gm, ' '))\n );\n }\n\n // Precincts\n lines.push(\n tags.meta +\n (c.precincts || 0) +\n ' of ' +\n c.totalPrecincts +\n ' precincts (' +\n Math.round((c.precincts / c.totalPrecincts) * 100) +\n '%)'\n );\n\n // We want question to be yes first, but ordering the candidates\n // is a key part to determining the winner, so doing this here,\n // but, maybe should be universal\n c.candidates = _.sortBy(c.candidates, a => {\n if (c.question) {\n return a.last.toLowerCase() === 'no' ? 'zzzzzz' : 'aaaaaa';\n }\n });\n\n // A bit of a hack. Ranked choice might not have ranks reporting\n // even though votes are being cast. So, if we have some precincts\n // reporting, but there are not votes for a specific rank\n let emptyRanks;\n if (c.candidates && c.candidates.length && c.ranked && c.precincts) {\n emptyRanks = _.filter(\n _.map(c.candidates[0].ranks, r => {\n let votes = _.sumBy(c.candidates, c => {\n return _.find(c.ranks, { rankedChoice: r.rankedChoice }).votes;\n });\n return votes ? null : r.rankedChoice;\n })\n );\n }\n\n // Candidates\n _.each(c.candidates, candidate => {\n if (candidate.writeIn) {\n return;\n }\n\n if (c.ranked) {\n lines.push(\n tags.ranked +\n (candidate.winner ? '<saxo:ch value=\"226 136 154\"/>' : ' ') +\n '\\t' +\n display(candidate) +\n (candidate.incumbent ? ' (i)' : '') +\n '\\t' +\n (candidate.ranks[0].votes\n ? utility.formatNumber(candidate.ranks[0].votes, 0)\n : emptyRanks &&\n ~emptyRanks.indexOf(candidate.ranks[0].rankedChoice)\n ? '-'\n : 0) +\n '\\t' +\n (candidate.ranks[0].percent\n ? Math.round(candidate.ranks[0].percent) + '%'\n : emptyRanks &&\n ~emptyRanks.indexOf(candidate.ranks[0].rankedChoice)\n ? '-'\n : '0%') +\n '\\t' +\n (candidate.ranks[1].votes\n ? utility.formatNumber(candidate.ranks[1].votes, 0)\n : emptyRanks &&\n ~emptyRanks.indexOf(candidate.ranks[1].rankedChoice)\n ? '-'\n : 0) +\n '\\t' +\n (candidate.ranks[1].percent\n ? Math.round(candidate.ranks[1].percent) + '%'\n : emptyRanks &&\n ~emptyRanks.indexOf(candidate.ranks[1].rankedChoice)\n ? '-'\n : '0%') +\n '\\t' +\n (candidate.ranks[2].votes\n ? utility.formatNumber(candidate.ranks[2].votes, 0)\n : emptyRanks &&\n ~emptyRanks.indexOf(candidate.ranks[2].rankedChoice)\n ? '-'\n : 0) +\n '\\t' +\n (candidate.ranks[2].percent\n ? Math.round(candidate.ranks[2].percent) + '%'\n : emptyRanks &&\n ~emptyRanks.indexOf(candidate.ranks[2].rankedChoice)\n ? '-'\n : '0%') +\n '\\t' +\n (candidate.votes ? utility.formatNumber(candidate.votes, 0) : '-') +\n '\\t' +\n (candidate.votes ? Math.round(candidate.percent) + '%' : '-')\n );\n }\n else {\n lines.push(\n (c.question && candidate.last.toLowerCase() === 'no'\n ? tags.candidateNo\n : tags.candidate) +\n // Still unsure to mark winner when close\n //(candidate.winner && (!c.close || (c.called && c.close))\n (candidate.winner ? '<saxo:ch value=\"226 136 154\"/>' : ' ') +\n '\\t' +\n display(candidate) +\n (candidate.incumbent ? ' (i)' : '') +\n '\\t' +\n (candidate.votes ? utility.formatNumber(candidate.votes, 0) : 0) +\n '\\t' +\n (candidate.percent ? Math.round(candidate.percent) : '0') +\n '%'\n //(ci === 0 ? '%' : '')\n );\n }\n });\n\n previous = c;\n });\n\n // Output text\n return _.flatten(lines).join('\\r\\n');\n}", "title": "" }, { "docid": "f0b4f9acd3a58324f0b49d762b2563f2", "score": "0.5044824", "text": "handleClick(category){\n const length = snippets[category].length;\n const chosenSnippet = snippets[category][Math.floor(Math.random() * length)];\n console.log('chosenSnippet first element before regex: ', chosenSnippet[0]);\n chosenSnippet[0] = chosenSnippet[0].replace(/\\n/g, '')\n console.log('chosenSnippet first element after regex: ', chosenSnippet[0]);\n const splitContent = chosenSnippet[0].trim().split(/[ \\t]+/)\n this.setState({ content : chosenSnippet, incomplete: chosenSnippet[0], wordsOfContent : splitContent });\n }", "title": "" }, { "docid": "ee69046e106b2389ebd03fe8ac934f02", "score": "0.50425756", "text": "function firstQ () { \n btn.remove();\n wordsEl.textContent = \"\";\n timeEl2.textContent = \"\";\n hScoreEl.textContent = \"View High Score\";\n displayQ();\n}", "title": "" }, { "docid": "6f32495feac6094ee71357ec195f3199", "score": "0.5038025", "text": "function printNextSection(truthOrLie) {\n nextSection = currentSection[truthOrLie].nextSection(); // grabs a reference to the nextSection and stores it in a variable\n if ('newCharacter' in nextSection) {\n messagePrinter.clearMessageArea(); // if the next section starts with a new character, it clears the message area from the old character\n }\n messagePrinter.printSection(nextSection); // prints the next section\n currentSection[truthOrLie].consequences(); // runs the consequences function for the last section\n charactersView.updateCharacterMenu(); \n storyLogger.logSection(currentSection);\n storyLogger.logConsequences(currentSection[truthOrLie].consequences);\n currentSection = nextSection; // resets variable\n }", "title": "" }, { "docid": "128f684092daeb02d4e3fc625274768b", "score": "0.50297254", "text": "function getPartial(text, clozePostions) {\n \n // Find where cloze deletion begins in text\n var start = text.slice(0, clozePostions[0]);\n // Remove cloze range\n var end = text.slice(clozePostions[1], text.length);\n \n // Return ellipsized version\n return start + \"...\" + end;\n }", "title": "" }, { "docid": "27541d9c7aa0c7fcc2cdb2dc1ab232f2", "score": "0.50287104", "text": "function hideArticles(){\r\n\tlet startPoint = document.getElementById('before');\r\n\tstartPoint.remove();\r\n\t//let beginAgain = document.getElementById('beforeIndex');\r\n\t//beginAgain.insertAdjacentHTML('afterend', '<div id=\"articleIndex\" class=\"list-group sms-articleindex\"></div>');\r\n}", "title": "" }, { "docid": "79a4b58b0006510149f79ce927bcdbd9", "score": "0.5027695", "text": "splitSection() {\n this.sections = {\n stimulus: Parser.extractInstructionsFromSection(\n \"Descriptions\",\n this.instructions\n ),\n sequences: {\n pre_sequence: Parser.extractInstructionsFromSection(\n \"PreSeq\",\n this.instructions\n ),\n main_sequence: Parser.extractInstructionsFromSection(\n \"MainSeq\",\n this.instructions\n ),\n post_sequence: Parser.extractInstructionsFromSection(\n \"PostSeq\",\n this.instructions\n ),\n },\n };\n }", "title": "" }, { "docid": "27758b53a3dad5b50ffe51a326a8e572", "score": "0.5026837", "text": "function removeOptionalStop(){\r\n\tif(numOptionalStops > 1){\r\n\t\tvar stopElement = document.getElementById(\"Stop\" + numOptionalStops + \"TextLabel\");\r\n\t\tstopElement.parentNode.removeChild(stopElement);\t\t\r\n\t\tnumOptionalStops--;\r\n\t\t\r\n\t}\r\n}", "title": "" }, { "docid": "1241634b22f579331842fe6c3ed8d228", "score": "0.5023159", "text": "function startTimedQuiz() {\n var instructions = document.getElementById('Prompt');\n instructions.remove();\n displayQuestions();\n}", "title": "" }, { "docid": "c40a56c631c1fb1a8013f58deec3322f", "score": "0.5020949", "text": "function rewriteOnsong(element)\n{\n var newText = '';\n var region2 = false;\n var textblocks = $(element).text().split(\"\\n\");\n\n $.each(textblocks, function(i) {\n\n var tx = splitOnSong(textblocks[i]);\n\n // in Presentation mode, ignore lyrics lines starting with a dot ('.') and lines indicating the display region\n if ( location.href.indexOf('chords')>10 ) {\n if ( tx.lyrics.substr(0,1)=='.' || tx.chords.substr(0,6)=='region' ) {\n region2 = true;\n return true;\n }\n }\n\n // don't add an empty line\n if ( tx.chords.trim()!='' ) {\n newText += '<pre class=\"chords\">' + tx.chords + '</pre>';\n region2 = false; // if there are chords, we can't be in region2\n }\n\n if ( tx.lyrics.trim()=='' )\n region2 = false; // region 2 ends when a new slide begins\n\n if ( tx.lyrics.substr(0,1)=='('\n && tx.lyrics.substr(-1,1)==')' )\n newText += '<pre class=\"mb-0 text-primary lh-1h\">' + tx.lyrics + \"</pre>\";\n\n else if ( !region2 && tx.lyrics && tx.lyrics.substr(0,1)!='#' )\n {\n tx.lyrics = checkForSingerInstructions(tx.lyrics);\n newText += '<pre class=\"lyrics\">' + tx.lyrics + \"</pre>\";\n }\n\n // insert horizontal line for each blank line in the source code, but not at the end and not in presentation mode\n else if ( location.href.indexOf('chords')<0 && tx.chords.trim()=='' && tx.lyrics.trim()=='' && i < textblocks.length-1 )\n newText += '<hr class=\"mb-1\">'\n });\n\n $(element).html(newText);\n\n}", "title": "" }, { "docid": "6488893e6e775e1900d04454dd4da07a", "score": "0.501705", "text": "formatRecipe() {\n let steps = this.getNavigationParams().steps\n if(steps.substring(0,12) === \"Directions: \") {\n steps = steps.slice(12)\n }\n return steps\n }", "title": "" }, { "docid": "6fe8b014277d4bf9ede5613bf35a3d50", "score": "0.50159925", "text": "function ctHideNoneText() {\n\n // hide the \"Do not show\" text from the list of selected options\n $('.ms-choice span:contains(\"Do not show\")').each(function () {\n\n // remove the text\n $(this).html($(this).html().split(\"Do not show\").join(\"\"));\n\n // remove trailing commas left over\n if ($(this).html().trim().slice(-1) == ',') {\n $(this).html($(this).html().trim().slice(0, -1));\n }\n // text to display instead if empty\n if (!$(this).text().trim().length) {\n $(this).text(\"Comments not displaying\");\n }\n });\n }", "title": "" }, { "docid": "2282d053621f04168fc27113fafa66c4", "score": "0.5014596", "text": "function firstQuestion() {\n var startContent = $(\"#content\");\n startContent.empty(); //removes the child elements from the div for questions.\n displayQuestion();\n }", "title": "" }, { "docid": "f328f2cf782ee293af270ab35c007565", "score": "0.5014351", "text": "function noHell() {\n document.querySelector('#textFinal').innerText = \"Du lyfter dig upp ur barstolen och börjar gå mot dörren.\"\n document.querySelector('#textFinal2').innerText = \"- Va fan var det i den ölen!?\"\n document.querySelector('#textFinal3').innerText = \"Frågade \" + myName + \" bartendern innan han steg ut till Sanctuarys stökiga gator.\"\n document.querySelector('#yesPlease').style.display = \"none\";\n document.querySelector('#noHell').style.display = \"none\";\n document.querySelector('#part-20-1').style.visibility = \"visible\";\n}", "title": "" }, { "docid": "3e587f978691a283d42b57e82d8acebc", "score": "0.5009937", "text": "function eraseEntry() {\n var template_form = dom.byId('templateForm'),\n first_header = dom.byId('template[header][0]'),\n template_name = dom.byId('template[name]'),\n i;\n\n // delete extra text areas\n for (i = template_form.length - 2; i > 4; i = i - 1) {\n domConstruct.destroy(template_form[i]);\n }\n\n // empty out the first header and response\n first_header.innerText = \"\";\n template_name.innerText = \"\";\n\t\t}", "title": "" }, { "docid": "13d0e0ee12590453504f50d11e8e5a21", "score": "0.500929", "text": "function resetValues() {\n // Text area where selected sentence displayed.\n const outputArea = document.getElementById('output_area');\n\n // Elements where the two parts of a split sentence are shown.\n let firstPart = document.getElementById('first_part').value;\n let secondPart = document.getElementById('second_part').value;\n\n // Clear elements of any pre-existing text.\n outputArea.innerHTML = \"\";\n firstPart = \"\";\n secondPart = \"\";\n\n // Ensure split submission doesn't happen until user has actually chosen\n // a split point.\n const splitButton = document.getElementById('split');\n splitButton.disabled = true;\n }", "title": "" }, { "docid": "4427d1c67dca091f3f28f0f33a13e078", "score": "0.500827", "text": "function removeWord(e) {\n\n //console.log(emptyCheck);\n\n //SUBTRACTING THE TOTAL \n var points = (e.target.previousElementSibling.previousElementSibling.value);\n \n switch(points.length) {\n case 0: break;\n case 1: break;\n case 2: break;\n case 3: total = total - 1;\n break;\n case 4: total = total - 2;\n break;\n case 5: total = total - 3;\n break;\n case 5: total = total - 4;\n break;\n default: total = total - 6;\n break;\n\n }\n //console.log(total);\n\n //DELETION OF FIELD\n var toBeDeleted = e.target.parentNode;\n toBeDeleted.parentNode.removeChild(toBeDeleted);\n\n //UPDATING TOTAL\n document.getElementsByClassName('totalDisplay')[0].textContent = total;\n\n //MESSAGE FOR DELETION OF ALL FIELDS\n console.log(emptyCheck.length);\n if(emptyCheck.length == 0) {\n var message = document.createElement('h1');\n message.textContent = 'Sorry, you do not have any words left! :p';\n document.getElementById('fieldId').appendChild(message);\n }\n\n}", "title": "" }, { "docid": "c797dd8dc213e7ec280a8eca61038a25", "score": "0.50072676", "text": "function CleanText() {\n var tablas = $('#Tablas option');\n var rel = $('#relacion option');\n var selectedOpts = $('#relacionadas option');\n $(selectedOpts).remove();\n $(rel).remove();\n $(tablas).remove();\n $(\"#txtDescricpion\").val(\"\");\n}", "title": "" }, { "docid": "2400057b2b92d9e4116bfa9601b5e936", "score": "0.50023323", "text": "function onNoClick() {\n\tif(sectionIndex < storySections.length) {\n\t\tconsole.log(\"on_no_click - section index: \" + sectionIndex);\n\t\tlet innerText = injectNameToSection(\"Well, I disagree, but never mind. <br/><br/>\" + getCurrentSection());\n\t\tsetInnerText(storySectionID, innerText);\n\t\tutter(getUtteraance(innerText));\n\t\tsectionIndex++;\n\t\tsetInterface()\n\t}\n\telse if(sectionIndex >= storySections.length) {\n\t\tsetInnerText(storySectionID, endOfExperiment);\n\t\tsetEndOfStoryInterface();\n\t}\n}", "title": "" }, { "docid": "4b27c65d1668eedc7df50f63a6e1d093", "score": "0.5001486", "text": "function getSectionText(text) {\n if (text && text.length > 0) {\n var chars = text.map(function (ch) {\n switch (ch) {\n case '\\n':\n return '<br>';\n\n case '&':\n return '&amp;';\n\n case '<':\n return '&lt;';\n\n case '>':\n return '&gt;';\n\n default:\n return ch;\n }\n });\n return chars.join('');\n }\n\n return '';\n }", "title": "" }, { "docid": "5b1354f89bd1ab3fb91a827cbb859626", "score": "0.49976724", "text": "function removeGuide()\r\n{\r\n\tvar items = fl.getDocumentDOM().library.items;\r\n\tvar i = items.length;\r\n\twhile(--i>-1){\r\n\t\tif(items[i].timeline){\r\n\t\t\tremoveGuideLayer(items[i].timeline);\r\n\t\t}\r\n\t}\r\n\r\n\tfor(i=fl.getDocumentDOM().timelines.length - 1; i>-1; --i){\r\n\t\tremoveGuideLayer( fl.getDocumentDOM().timelines[i] );\r\n\t}\r\n}", "title": "" }, { "docid": "7626a5b7d1331974ede06d4a02eefb5c", "score": "0.49918187", "text": "function clearView() {\n for (var i = 0; i < sections.length; i++) {\n //console.log(i);\n sections[i].style.display = 'none';\n }\n }", "title": "" }, { "docid": "d14da28c1d0155701fdbf9e1f58f4cbb", "score": "0.4983525", "text": "function print() {\n // Create a container for the succeding parts\n let newDiv = document.createElement('section');\n // newDiv.id = 'set_' + number;\n list.appendChild(newDiv);\n // Create the icon for circle\n let a = document.createElement('p');\n a.innerHTML = '<i class=\"far fa-dot-circle\"></i>';\n newDiv.appendChild(a);\n // Put the text to the list section\n let addSpan = document.createElement('li');\n // addSpan.id = 'list_' + number;\n addSpan.textContent = to_do;\n newDiv.appendChild(addSpan);\n // Create icon for trash\n let b = document.createElement('p');\n // b.id = 'trash_' + number;\n b.innerHTML = '<i class=\"fas fa-trash-alt\"></i>';\n newDiv.appendChild(b);\n\n // Call function for the trash and streakthrough \n streak();\n remEntry();\n\n // This function will remove the corresponding to do item when the icon is clicked.\n function remEntry() {\n // document\n // .getElementById('trash_' + rem)\n // .addEventListener('click', function () {\n // document.getElementById('set_' + rem).remove();\n // // activity.splice(rem, 1)\n // });\n b.addEventListener('click', function () {\n b.parentNode.remove();\n })\n }\n\n // This function will add and remove streak over the words.\n function streak() {\n // document\n // .getElementById('set_' + rem)\n // .addEventListener('click', function () {\n // document.getElementById('list_' + rem).classList.toggle('lineover');\n // if (check === false) {\n // a.innerHTML = '<i class=\"fas fa-circle\"></i>';\n // check = true;\n // } else if (check === true) {\n // a.innerHTML = '<i class=\"far fa-dot-circle\"></i>';\n // check = false;\n // }\n // });\n a.addEventListener('click', function () {\n a.nextElementSibling.classList.toggle('lineover');\n if (check === false) {\n a.innerHTML = '<i class=\"fas fa-circle\"></i>';\n check = true;\n } else if (check === true) {\n a.innerHTML = '<i class=\"far fa-dot-circle\"></i>';\n check = false;\n }\n })\n\n addSpan.addEventListener('click', function () {\n a.nextElementSibling.classList.toggle('lineover');\n if (check === false) {\n a.innerHTML = '<i class=\"fas fa-circle\"></i>';\n check = true;\n } else if (check === true) {\n a.innerHTML = '<i class=\"far fa-dot-circle\"></i>';\n check = false;\n }\n })\n\n }\n}", "title": "" }, { "docid": "4781f5c8249b55982a434bd498ec9f45", "score": "0.49800363", "text": "function eliminarComentarios() {\n\n let eliminar = stringText.replace(/\\/[\\*|][\\S\\s]+?[\\*]\\/|\\/[\\/].*/g, \"\");\n var elementoMat = document.getElementById('contenido-archivo');\n elementoMat.innerHTML = eliminar;\n\n}", "title": "" }, { "docid": "e6fe3f8a2e4fb650805d9d9e5fd93612", "score": "0.49795997", "text": "function trimLeadingZeros(sectionText) {\n if (sectionText) {\n var replacedText = sectionText;\n\n for (var i = 0; i < replacedText.length; i += 1) {\n if (sectionText[i] === ' ') {\n replacedText = replacedText.replace(' ', '&nbsp;');\n } else {\n break;\n }\n }\n\n return replacedText;\n }\n\n return sectionText;\n }", "title": "" }, { "docid": "3afc8ce9dd4d8932ce601d068d5f77ba", "score": "0.49765357", "text": "function clearPhrase() {\r\n const previousPhrase = phrase.querySelectorAll('li');\r\n for(let i = 0; i < previousPhrase.length; i += 1) {\r\n let ul = previousPhrase[i].parentNode;\r\n ul.removeChild(ul.firstElementChild);\r\n }\r\n}", "title": "" }, { "docid": "886fd58d67cbc8e6d711444609538975", "score": "0.49738902", "text": "function answerCleaner()\n{\n\tfor (var i=0; i < 3; i++)\n\t\t{\n\t\t\t$(\"#answer\" + i).html(\"\");\n\t\t}\n}", "title": "" }, { "docid": "30a349d916c755ba37b28af94cd8ed44", "score": "0.49722412", "text": "function removeResults()\n{\n $(\"#part1\").remove();\n $(\"#part2\").remove();\n}", "title": "" }, { "docid": "e1b7988c722ba560c2496990d3e6ba41", "score": "0.49695095", "text": "function hideTurnControlsInstructions() {\n var instruction_div = document.getElementById(\"turn_option_instructions\");\n instruction_div.innerHTML = \"\";\n instruction_div.style.display = \"block\";\n}", "title": "" }, { "docid": "42e2d59f24131e086086b0f563e93908", "score": "0.49643627", "text": "function DisplayPrn(strJudge,NA,noAdd)\n{\n\t//NewPage(this.WhichPage,null,true)\n\t//\\u5c06\\u6240\\u6709\\u5b57\\u6bb5\\u90fd\\u4e0d\\u663e\\u793a\\uff0c\\u53ea\\u663e\\u793a\\u8be5\\u9875\\u5b57\\u6bb5\n\tvar temp\n\tif (this.PageArr.length > 1 || this.StrFree != \"\")\n\t{\n\t\tif (this.StrFree != \"\")\n\t\t{\ttemp = GetCookieTable(this.StrFree)\n\t\t\tif (temp != null && temp != \"null\" && temp != \"\")\n\t\t\t\tthis.PageArr[0] = temp.split(\",\")\n\t\t\telse\n\t\t\t{\tif (this.WhichPage == 0)\n\t\t\t\t\tthis.WhichPage = 1\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (this.WhichPage == 0)\n\t\t\t\tthis.WhichPage = 1\n\t\t}\n\n\t\ttemp = this.PageArr[this.WhichPage]\n\n\t\tif (temp != \"\" && temp != null)\n\t\t{\n\t\t\tfor(var i=0; i<this.Widths.length; i++)\n\t\t\t\tthis.HideColumn[i] = false\n\t\t\tfor(var i=0; i<temp.length; i++)\n\t\t\t\tthis.HideColumn[temp[i]] = true\n\t\t}\n\t}\n\n\tvar sTemp, field, i,sWidth, sumWidth, iWidth, sHand, sHide, sSort, sStyle,bJudge\n var sUse = new Array()\n\n\tvar sBody = new Array()\n\tsumWidth = 23\n\tfor (i=0; i<this.Widths.length; i++)\n\t{\tif (this.HideColumn.length > 0)\n\t\t{\tif (this.HideColumn[i] == true)\n\t\t\t\tsumWidth += (this.Widths[i])\n\t\t}\n\t\telse\n\t\t\tsumWidth += (this.Widths[i])\n\t}\n\t//******************************************** \\u5e38\\u91cf\\u5b9a\\u4e49 ***********************************\n\tvar TABLE_BEGIN = \"<TABLE name='\" + this.Name + \"TableAll' Id=\" + this.Name + \"TableAll width=\" + this.TableWidth + \"px border=1 cellpadding=0 cellspacing=0 onmouseup='return \" + this.Name + \".MouseDown_Event()'><TR><TD>\"\n\tvar TABLE_END = \"</TD></TR></TABLE>\"\n\n\tsumWidth -= 4\n\n\tvar TABLE_HEAD_H = \"<SPAN id='\" + this.Name + \"SpanHead' style='WIDTH:\"+ this.TableWidth + \";OVERFLOW:hidden'><TABLE id='\" + this.Name + \"TableHead' cellpadding=2 cellspacing=0 style='border-style:solid;border-width:1px;border-color:black' style='width:\" + sumWidth + \"px'>\"\n\tvar TABLE_HEAD_T = \"<SPAN id='\" + this.Name + \"SpanTail' style='WIDTH:\"+ this.TableWidth + \";OVERFLOW:hidden'><TABLE id='\" + this.Name + \"TableTail' cellpadding=2 cellspacing=0 style='border-style:solid;border-width:1px;border-color:black' style='width:\" + sumWidth + \"px'>\"\n\n\tsumWidth -= 18\n\tvar TABLE_HEAD = \"<TABLE id='\" + this.Name + \"TableBody' cellpadding=2 cellspacing=1 bordercolor=Silver bgcolor=Gray \" + this.strTable + \" onKeyDown='\" + this.Name + \".DealKeyPress()' style='width:\" + sumWidth + \"px'>\"\n\tvar TABLE_TAIL_H = \"</TABLE></SPAN>\"\n\tvar TABLE_TAIL = \"</TABLE>\"\n\n\tvar HEAD_ROW_BEGIN = \"<TR style='word-break:break-all;border-color:black' name=Head bgcolor=#cebe9c align=center>\"\n\tvar HEAD_ROW_END = \"</TR>\"\n\n\tvar HEAD_BODY_BEGIN = \"<TD \" + \"Style='border-right:1px solid black;\" + this.strHead + \"' ><b>\"\n\tvar HEAD_BODY_END = \"</TD>\"\n\n\tvar TAIL_BODY_BEGIN = \"<TD \" + \"Style='border-right:1px solid black;' >\"\n\tvar TAIL_BODY_END = \"</TD>\"\n\n\tvar ROW_BEGIN = \"<TR classid='\" + this.Name + \"TableRow' align=left bordercolor=Silver name=rownum id=rowid>\"\n\tvar ROW_END = \"</TR>\"\n\n\tvar CELL_BEGIN = \"<TD class=\" + this.Name + \"FFIIEE>\"\n\tvar CELL_END = \"</TD>\"\n\n\tvar PAGE_BUTTON = '<IMG ID=' + this.Name + '#%&img src=\"' + this.ControlPath + 'Images/#%&.GIF\" onmousedown=\"' + this.Name + '.NewPage(#%&)' + '\" style=\"CURSOR: hand\">'\n\t//var FREE_BUTTON = '<button onclick=\"' + this.Name + '.ShowFree()\"><IMG SRC=\"../../CommonControl/Images/Free.gif\"></button> '\n\tvar FREE_BUTTON = '<IMG ID=' + this.Name + '0img src=\"' + this.ControlPath + 'Images/0.GIF\" onmousedown=\"' + this.Name + '.ShowFree()' + '\" style=\"CURSOR: hand\">'\n\tif (this.WhichPage == 0)\n\t\tFREE_BUTTON = FREE_BUTTON.replace(\"0.GIF\",\"0_.GIF\")\n\t//var SET_BUTTON = '<button onmousedown=\"' + this.Name + '.SetFree()\"><IMG SRC=\"../../CommonControl/Images/Set.gif\"></button> '\n\tvar SET_BUTTON = '<IMG ID=' + this.Name + 'setbutton src=\"' + this.ControlPath + 'Images/SetD.GIF\" onmousedown=\"' + this.Name + '.SetFree()' + '\" style=\"CURSOR: hand\">'\n\t//************************************************************************************************\n\n\n\tsUse[0] = TABLE_HEAD\n\t\tvar sDisplay = \"\"\n\t//\\u662f\\u5426\\u663e\\u793a\\u6807\\u9898\\u3002\n\tif (this.Title)\n\t{\t//\\u5efa\\u7acb\\u8868\\u5934\n\t\tsSort = \"\"\n\t\tsUse[sUse.length] = HEAD_ROW_BEGIN\n\t\t//\\u5efa\\u7acb\\u8868\\u7684\\u6807\\u9898\\u5934\n\t\tfor (field=0; field<this.Widths.length; field++)\n\t\t{\n\t\t\t//\\u8bbe\\u7f6e\\u663e\\u793a\\u5b57\\u6bb5\n\t\t\tif (this.HideColumn.length > 0)\n\t\t\t{\n\t\t\t\tif (this.HideColumn[field] != true)\n\t\t\t\t{\tcontinue;\n\t\t\t\t\tsDisplay = \" style='display:none'\"\n\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tsDisplay = \"\"\n\t\t\t}\n\n\t\t\t//\\u662f\\u5426\\u6307\\u5b9a\\u5b57\\u6bb5\\u5bbd\\u5ea6\n\t\t\tiWidth = this.Widths[field] - 5\n\t\t\tsWidth = HEAD_BODY_BEGIN.replace(\"<TD\",\"<TD width=\" + iWidth + \"px id=\" + this.Name + \"H\" + field + sDisplay)\n\t\t\tsUse[sUse.length] = sWidth\n\t\t\tif (this.UseSort == \"\")\n\t\t\t\t//\\u4e0d\\u6307\\u5b9a\\u6392\\u5e8f\n\t\t\t\tsUse[sUse.length] = this.rs_main.Fields(field).Name\n\t\t\telse\n\t\t\t{\t//\\u6307\\u5b9a\\u6392\\u5e8f\n\t\t\t\tif (field == this.SortColumn)\n\t\t\t\t{\n\t\t\t\t\tif (this.SortAsc == \"\")\n\t\t\t\t\t\tsSort = \" background:transparent url(\" + this.ControlPath + \"Images/up.GIF) no-repeat bottom right;\"\n\t\t\t\t\telse\n\t\t\t\t\t\tsSort = \" background:transparent url(\" + this.ControlPath + \"Images/down.GIF) no-repeat bottom right;\"\n\n\t\t\t\t}\n\t\t\t\tsUse[sUse.length] = \"<div class='HeadSort' onclick='\" + this.Name + \".Sort(\" + field + \")\" + \"' style='text-decoration:underline; CURSOR:hand;\" + sSort + \"'>\" + this.rs_main.Fields(field).Name + \"</div>\"\n\n\t\t\t\tsSort = \"\"\n\t\t\t}\n\t\t\tsUse[sUse.length] = HEAD_BODY_END\n\n\t\t}\n\n\t\t//\\u6eda\\u52a8\\u6761\\u4e4b\\u4e0a\n\t\tsUse[sUse.length] = \"<TH width=13 \" + this.strHead + \"></TH>\"\n\t\t//\\u5efa\\u7acb\\u7eaa\\u5f55\\u5934\\u3002\n\t\tsUse[sUse.length] = HEAD_ROW_END\n\t}\n\n\t//\\u5904\\u7406\\u8868\\u683c\n\t//\\u4ece\\u8d77\\u59cb\\u884c\\u5f00\\u59cb\\u5b89\\u6392lines\\u884c\\u7eaa\\u5f55\n\tif (this.rs_main.RecordCount > 0 )\n\t{\n\t\tthis.rs_main.MoveFirst()\n\t}\n\t//sBody[0] = TABLE_HEAD\n\tsStyle = \"\"\n\tvar sBackC = \"\"\n\tvar jj = 0\n\tfor (j = 0; j<this.rs_main.RecordCount; j++)\n\t{\t//\\u82e5\\u7ed3\\u5c3e\\uff0c\\u5219\\u8df3\\u51fa\\u5faa\\u73af\\u3002\n\t\tif (this.rs_main.EOF)\n\t\t\tbreak\n\n\t\tif (strJudge == null)\n\t\t\tbJudge = true\n\t\telse\n\t\t\teval(\"bJudge = \" + strJudge)\n\n\t\tif (bJudge == false)\n\t\t{\n\t\t\tthis.rs_main.MoveNext()\n\t\t\tcontinue\n\t\t}\n\n\t\t//\\u8bbe\\u7f6e\\u80cc\\u666f\\u8272\n\t\tsBackC = \" Style='background-color:\" + this.arrColor[jj % 2] + \"; height:20px; color:black; word-break:break-all'\"\n\t\tsBody[sBody.length] = ROW_BEGIN.replace(\"rownum\", \"\"+ jj + sBackC)\n\t\tsBody[sBody.length-1] = sBody[sBody.length-1].replace(\"rowid\", \"Row\"+ jj)\n\t\tjj += 1\n\t\t//\\u5b89\\u6392\\u8bb0\\u5f55\\u4e2d\\u7684\\u5404\\u4e2a\\u5b57\\u6bb5\\u3002\n\t\tfor (field=0; field<this.Widths.length; field++)\n\t\t{\t//\\u662f\\u5426\\u6307\\u5b9a\\u5bbd\\u5ea6\\u3002\n\n\t\t\t//\\u8bbe\\u7f6e\\u663e\\u793a\\u5b57\\u6bb5\n\t\t\tif (this.HideColumn.length > 0)\n\t\t\t{\n\t\t\t\tif (this.HideColumn[field] != true)\n\t\t\t\t{\tsDisplay = \" style='display:none'\"\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tsDisplay = \"\"\n\t\t\t}\n\n\t\t\tsWidth = CELL_BEGIN.replace(\"FFIIEE\",\"\" + field + sDisplay)\n\n\t\t\tsBody[sBody.length] = sWidth\n\t\t\tif (this.rs_main.Fields(field).Name == \"\\u5e8f\\u53f7\")\n\t\t\t{\tsBody[sBody.length] = jj + \"\"\n\t\t\t\tthis.rs_main.Fields(field).Value = jj + \"\"\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t var tempValue = this.rs_main.Fields(field).Value;\n\t\t\t if(tempValue==undefined || tempValue==\"undefined\")\n\t\t\t tempValue=\"\";\n\t\t\t if(/^\\d{4}-\\d{1,2}-\\d{1,2}$/.test(tempValue))\n tempValue= \"\\u001D\"+tempValue;\n\t\t\t if(/^\\d{9,}$/.test(tempValue))\n\t\t\t\t tempValue= \"\\u001D\"+tempValue;\n\n tempValue=tempValue.toString();\n tempValue = tempValue.split(\"'\").join(\"\\'\");\n tempValue = tempValue.split('\"').join('\\\"');\n\n //tempValue = tempValue.replace('<','\\u3008');\n while(tempValue.search(\"<\")!=-1)\n\t\t tempValue = tempValue.replace(\"<\", \"&lt;\")\n\n\n\t\t\t\t sBody[sBody.length] = tempValue;\n\t \t\t}\n\t\t\tsBody[sBody.length] = CELL_END\n\t\t}\n\n\t\t//\\u8bb0\\u5f55\\u7ed3\\u675f\\u3002\n\t\tsBody[sBody.length] = ROW_END\n\t\t//\\u4e0b\\u4e00\\u6761\\u8bb0\\u5f55\\u3002\n\t\tthis.rs_main.MoveNext()\n\t}\n\n\n\n\t//\\u8bb0\\u5f55\\u7ed3\\u675f\\u3002\n\tsBody[sBody.length] = ROW_END\n\tsBody[sBody.length] = TABLE_TAIL\n\tsWidth = sBody.join(\"\")\n\t//\\u662f\\u5426\\u6307\\u5b9a\\u9ad8\\u5ea6\\u3002\\u82e5\\u6307\\u5b9a\\uff0c\\u5219\\u4f1a\\u81ea\\u52a8\\u4ea7\\u751f\\u6eda\\u52a8\\u6761\\u3002\n\tif (sumWidth+18 >= this.TableWidth)\n\t\tsumWidth = this.TableWidth -18\n\tif (this.Height == 0)\n\t\tsUse[sUse.length] = sWidth\n\telse\n\t{\tif (this.AskSum)\n\t\t\tsUse[sUse.length] = \"<SPAN id='\" + this.Name + \"TableSpan' style ='height:\" + this.Height + \";width:\" + (sumWidth + 18) + \"; OVERFLOW:auto' onscroll='\" + this.Name + \"SpanHead.scrollLeft = this.scrollLeft;\" + this.Name + \"SpanTail.scrollLeft = this.scrollLeft\t'>\" + sWidth + \"</SPAN>\"\n\t\telse\n\t\t\tsUse[sUse.length] = \"<SPAN id='\" + this.Name + \"TableSpan' style ='height:\" + this.Height + \";width:\" + (sumWidth + 18) + \"; OVERFLOW:auto' onscroll='\" + this.Name + \"SpanHead.scrollLeft = this.scrollLeft;'>\" + sWidth + \"</SPAN>\"\n\t}\n\n\t//\\uff08\\u8868\\u5c3e\\uff09\\u662f\\u5426\\u663e\\u793a\\u6c47\\u603b\n\t//\\u662f\\u5426\\u663e\\u793a\\u6c47\\u603b\n\tif (this.AskSum)\n\t{\n\n\t//\\u5efa\\u7acb\\u8868\\u5c3e\n\t\tsUse[sUse.length] = TABLE_HEAD_T + HEAD_ROW_BEGIN.replace(\"<TR \",\"<TR id=\" + this.Name + \"Sums \")\n\t\t//\\u5efa\\u7acb\\u8868\\u7684\\u6807\\u9898\\u5934\n\t\tfor (field=0; field<this.Widths.length; field++)\n\t\t{\n\t\t\t//\\u8bbe\\u7f6e\\u663e\\u793a\\u5b57\\u6bb5\n\t\t\tif (this.HideColumn.length > 0)\n\t\t\t{\n\t\t\t\tif (field == 0)\n\t\t\t\t{\tif (this.HideColumn[field] != true)\n\t\t\t\t\t{\tsDisplay = \" style='display:none;text-align:right'\"\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tsDisplay = \" style='font-size:9pt';text-align:right'\"\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\tif (this.HideColumn[field] != true)\n\t\t\t\t\t{\tsDisplay = \" style='display:none;font-size:9pt;font-weight:400; text-align:right'\"\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tsDisplay = \" style='font-size:9pt;font-weight:400; text-align:right'\"\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\t//\\u662f\\u5426\\u6307\\u5b9a\\u5b57\\u6bb5\\u5bbd\\u5ea6\n\t\t\tiWidth = this.Widths[field] - 5\n\t\t\tsWidth = TAIL_BODY_BEGIN.replace(\"<TD\",\"<TD width=\" + iWidth + \"px id=\" + this.Name + \"T\" + field + sDisplay)\n\t\t\tsUse[sUse.length] = sWidth\n\n\t\t\tif (field==0)\n\t\t\t\tsUse[sUse.length] = \"\\u5408\\u8ba1\"\n\t\t\telse\n\t\t\t\tif (this.SumArr[field] != null)\n\t\t\t\t\tsUse[sUse.length] = this.SumArr[field]\n\t\t\t\telse\n\t\t\t\t\tsUse[sUse.length] = \"\\u3000\"\n\n\t\t\tsUse[sUse.length] = TAIL_BODY_END\n\t\t}\n\t\tsUse[sUse.length] = \"<TD width=13 \" + this.strHead + \"></TD>\"\n\t\tsUse[sUse.length] = HEAD_ROW_END + TABLE_TAIL_H\n\t}\n\n\n\n\t//\\u8fd4\\u56de\\u8868\\u683c\\u7684HTML\\u5b57\\u7b26\\u4e32\\u3002\n\t//sUse[sUse.length] = TABLE_END\n\n\t//\\u662f\\u5426\\u589e\\u52a0\\u9875\\u9009\\u62e9\n\tsTemp = sUse.join(\"\")\n\n\tif (this.Pages > 1 || this.ShowCount == true ||this.StrFree != \"\")\n\t{\n\t\tsHide = \"\"\n\t\tif (this.Pages>1)\n\t\t\tfor(var n=1; n<this.Pages; n++)\n\t\t\t{\n\n\t\t\t\tsHide += PAGE_BUTTON.replace(\"#%&\",\"\" + n)\n\t\t\t\tif (n == this.WhichPage)\n\t\t\t\t\tsHide = sHide.replace(\"#%&\",\"\" + n + \"_\")\n\t\t\t\telse\n\t\t\t\t\tsHide = sHide.replace(\"#%&\",\"\" + n)\n\t\t\t\tsHide = sHide.replace(\"#%&\",\"\" + n)\n\n\t\t\t}\n\t\t//\\u662f\\u5426\\u663e\\u793a\\u8bb0\\u5f55\\u6570\n\t\tvar sCount = \"\"\n\t\tif (this.ShowCount == true)\n\t\t\tsCount = \"\\u8bb0\\u5f55\\u6570\\uff1a\" + this.rs_main.RecordCount\n\n\t\t//\\u662f\\u5426\\u663e\\u793a\\u81ea\\u7531\\u9009\\u62e9\\u5b57\\u6bb5\n\t\tvar sFree = \"\"\n\t\tif (this.StrFree != \"\")\n\t\t{\n\t\t\tsFree = SET_BUTTON\n\t\t\tsHide = FREE_BUTTON + sHide\n\t\t}\n\n\t\t//sTemp = \"<TABLE width=\" + this.TableWidth + \"><TR><TD align=left id=\" + this.Name + \"Count style='font-family:\\u5b8b\\u4f53;font-size:9pt'>\" + sCount + \"</TD><TD align=middle>\" + sFree + \"</TD><TD align=right>\" + sHide + \"</TD></TR></TABLE>\" + sTemp\n\t}\n\t//\\u8bbe\\u7f6e\\u5217\\u683c\\u5f0f\n\tsTemp = sTemp + \" \" + \"<Style> <!--\" + this.strColumn + sStyle + \"--> </style>\"\n\n\t//\\u4e0d\\u77e5\\u4e3a\\u4ec0\\u4e48\\uff0c\\u7a7a\\u8bb0\\u5f55\\u96c6\\u65e0\\u6cd5\\u5728\\u8fd0\\u884c\\u65f6AddNew\\uff0c\\u53ea\\u597d\\u51fa\\u6b64\\u4e0b\\u7b56\\u3002--- 1\n\tif (this.rs_main.RecordCount < 1 && noAdd != true)\n\t{\n\t\tthis.rs_main.AddNew()\n\t\tthis.rs_main(0) = \"UndEfinedp\"\n\n\t\tthis.IsEmpty = true\n\t}\n\telse\n\t\tthis.IsEmpty = false\n\n\t//\\u91cd\\u65b0\\u6392\\u5e8f\\u540e\\uff0c\\u6e05\\u9664\\u9ad8\\u4eae\\u663e\\u793a\\u884c\n\tthis.preElement = null\n\tthis.PreRow = -1\n\tthis.currentRow = -1;\n\tthis.RowStr = \"\"\n\n\treturn sTemp\n\n}", "title": "" }, { "docid": "dbd86363dd1142c15bc35c851f589a7c", "score": "0.4962633", "text": "function previousSubContent(){\n\tif(sub_section_index > 0) {\n\t\t$('.exp_sub_section').eq(sub_section_index).css('display','none');\n\t\tsub_section_index--;\n\t\t$('.exp_sub_section').eq(sub_section_index).css('display','block');\n\t}\n}", "title": "" }, { "docid": "bb3eee738bc0997932700ee2b914583f", "score": "0.49578202", "text": "function unclozify() {\n\t// Get Cloze code from output box\n\tvar clozeCode = document.getElementById(\"clozecode\").value;\n\n\t// Get question text first\n\tvar pattern = new RegExp(\"(.*)<br \\/>\", \"gm\");\n\tvar matches = pattern.exec(clozeCode);\n\tif (matches != null) {\n\t\tdocument.getElementById(\"question\").value = matches[1];\n\t}\n\n\t// Get remaining answer text\n\tpattern = new RegExp(\"S:~(.*)}\");\n\tvar answers_tmp = pattern.exec(clozeCode);\n\t// Index 1 represents the capture group\n\tvar answers = answers_tmp[1].split(\"~\");\n\n\t// Array for answer boxes\n\tvar letters = ['A', 'B', 'C', 'D'];\n\n\t// Loop through as many times as there are answers\n\tfor (var i = 0; i <= (answers.length - 1); i++) {\n\t\t// Set document ID dynamically based on letters array\n\t\tvar id = \"ans\" + letters[i];\n\n\t\t// Check if this answer is the correct answer\n\t\tif (answers[i].startsWith(\"%100%\")) {\n\t\t\t// Set radio button\n\t\t\tdocument.getElementById(id + letters[i]).checked = true;\n\t\t\t// Set answer text and slice out \"%100%\" text\n\t\t\tdocument.getElementById(id).value = answers[i].slice(5, answers[i].length);\n\t\t} else {\n\t\t\tdocument.getElementById(id).value = answers[i];\n\t\t}\n\t}\n}", "title": "" }, { "docid": "73edaa841603c6761c987bdec0fa4afe", "score": "0.49489203", "text": "function currentPartOneSection() {\n if (partOneSubsectionIsComplete(\"#employee\")) {\n if (partOneSubsectionIsComplete(\"#leadership\")) {\n if (partOneSubsectionIsComplete(\"#organizational\")) {\n return \"#employee\"\n } else {\n return \"#organizational\"\n }\n } else {\n return \"#leadership\"\n }\n } else {\n return \"#employee\"\n }\n}", "title": "" }, { "docid": "9c62add652a909572dde429471009e81", "score": "0.49486172", "text": "function RemoveContent(){\r\n\t document.getElementById(\"quoteDisplay\").innerHTML = \"\";\r\n}", "title": "" }, { "docid": "011b9bda48402cc9629217693744db76", "score": "0.4936405", "text": "function choice1() {\n let yesNo = document.getElementById(\"tossText\").value;\n if (yesNo === \"yeah?\") {\n let storyNode2 = document.getElementById(\"storyBody2\");\n document.getElementById(\"storyBody0\").appendChild(storyNode2);\n storyNode2.style.display = 'block';\n\n document.getElementById(\"tossIt\").style.display = 'none';\n document.getElementById(\"tossText\").style.display = 'none';\n\n } else if (yesNo === \"nah?\") {\n let storyNodeB = document.getElementById(\"storyBodyB\");\n document.getElementById(\"storyBody0\").appendChild(storyNodeB);\n storyNodeB.style.display = 'block';\n\n document.getElementById(\"tossIt\").style.display = 'none';\n document.getElementById(\"tossText\").style.display = 'none';\n }\n}", "title": "" }, { "docid": "b606afb06273d018cf6d10c165bcc71b", "score": "0.4934009", "text": "function hideDifferences(firstEl, secondEl) {\n var replPat = new RegExp('(</?del[^>]*>)|(' + NLCHAR + ')', 'g');\n firstEl.innerHTML = firstEl.innerHTML.replace(replPat, '');\n secondEl.innerHTML = secondEl.innerHTML.replace(replPat, '');\n }", "title": "" } ]
27b937ced78b95711d07c3bca091cf5a
The main exported interface (under `self.acorn` when in the browser) is a `parse` function that takes a code string and returns an abstract syntax tree as specified by [Mozilla parser API][api]. [api]:
[ { "docid": "354fc34a360a4ae3611d555b406fb67c", "score": "0.5222244", "text": "function parse(input, options) {\n return new Parser(options, input).parse()\n}", "title": "" } ]
[ { "docid": "1f62df725b374458bc3995f4d00eaf1c", "score": "0.67733055", "text": "function parseCode(code) {\n var root = new Node(\"\"); // root node of the program\n createProgramTree(root, acorn.parse(code));\n return root;\n}", "title": "" }, { "docid": "5cd901451314ce08c559443705ee6d04", "score": "0.67276746", "text": "function parser(sourceCode) {\n //1.对源码字符串进行词法分析,得到tokens数组\n let tokens = tokenizer(sourceCode);\n tokens.forEach((item, idx) => {\n item.idx = idx;\n }); //添加索引\n console.log(\"tokens= \", tokens);\n\n //2.对得到的tokens数组开始生成ast语法树\n let pos = 0; //tokens的起始位置\n\n let ast = {\n type: nodeTypes.Program,\n body: [\n {\n type: nodeTypes.ExpressionStatement,\n expression: walk(),\n },\n ],\n };\n\n /**\n * <h1 id=\"title\"><span>hello</span>world</h1>\n * @param {*} parentNode\n */\n var rootNode={};\n function walk(parentNode) {\n let node, token, nextToken;\n if(!tokens[pos]) return node;\n token = tokens[pos]; //得到第一个\n nextToken = tokens[pos + 1];\n console.log(\"token = \", token, \"nextToken=\", nextToken);\n // <h1 id=\"title\"><span>hello</span>world</h1>\n // <h1></h1>\n \n if (token.type === \"LeftParentCheses\" && nextToken.type === \"JSXIdentifier\") {\n console.log(\"token.value=\", token.value);\n //一个JSXElement具有的如下几个属性\n node = {\n type: nodeTypes.JSXElement,\n openingElement: {\n type: nodeTypes.JSXOpeningElement,\n name: {\n type: nodeTypes.JSXIdentifier,\n name: tokens[pos + 1].value,\n },\n attributes: [],\n },\n children: [],\n closingElement: null,\n };\n if(!parentNode) {\n rootNode = node; //一开始保存最大的根节点\n }\n\n pos += 1; //1\n token = tokens[pos];\n //如果下一个分词不是 \">\" 则开始读取元素的属性\n if (token.type !== \"RightParentCheses\") {\n pos++; //2\n token = tokens[pos];\n getAttributes(token);\n }\n\n //读取元素属性的方法<span>hello</span>\n function getAttributes(token) {\n if (token.type === \"AttributeKey\") {\n let valueIndex = pos + 2;\n\n //属性节点\n let JSXAttribute = {\n type: nodeTypes.JSXAttribute,\n name: {\n type: nodeTypes.JSXIdentifier,\n name: token.value,\n },\n value: {\n type: nodeTypes.Literal,\n value: tokens[valueIndex].value, //{ type: 'AttributeStringValue', value: '\"title\"' },\n raw: tokens[valueIndex].value,\n },\n };\n node.openingElement.attributes.push(JSXAttribute);\n pos = valueIndex + 1; // 5\n token = tokens[pos];\n getAttributes(token);\n }\n //表示已经把该标签的属性已经全部读取完毕了 , 开始读取孩子节点\n if (token.type === \"RightParentCheses\") {\n pos++; //5\n walk(node); //<span>hello</span>\n }\n }\n if (parentNode != null) {\n //h1.appendChild(span)\n parentNode.children.push(node);\n console.log(\"here----22222\");\n } \n }\n if (token.type === \"LeftParentCheses\" && nextToken.type === \"BackSlash\") {\n console.log('----',rootNode.openingElement.name.name);\n }\n if (token.type === \"JSXText\") {\n function getTextChild() {\n //读取元素的孩子节点\n let JSXTextNode = {\n type: token.type,\n value: token.value,\n raw: token.value,\n };\n if (parentNode) {\n parentNode.children.push(JSXTextNode); //添加文本节点元素\n } else {\n rootNode.children.push(JSXTextNode);\n }\n pos++;\n token = tokens[pos];\n nextToken = tokens[pos + 1];\n //表示当前标签已经读完,包括当前标签的孩子节点<span>hello</span>\n if (token.type === \"LeftParentCheses\" && nextToken.type === \"BackSlash\") {\n console.log(\"前端标签添加孩子节点完毕\");\n pos = pos + 4;\n walk(rootNode);\n }\n else if(token.type === \"LeftParentCheses\" && nextToken.type === \"JSXIdentifier\"){\n //一个JSXElement具有的如下几个属性\n // let subNode = {\n // type: nodeTypes.JSXElement,\n // openingElement: {\n // type: nodeTypes.JSXOpeningElement,\n // name: {\n // type: nodeTypes.JSXIdentifier,\n // name: tokens[pos + 1].value,\n // },\n // attributes: [],\n // },\n // children: [],\n // closingElement: null,\n // };\n //rootNode.children.push(subNode);\n walk(rootNode);\n }\n else{\n pos++;\n walk(rootNode);\n }\n }\n getTextChild();\n }\n\n return node;\n }\n console.log(\"ast = \", JSON.stringify(ast, null, 3));\n}", "title": "" }, { "docid": "46bb7aea9d107c056457c2f1fc3ccf1b", "score": "0.667909", "text": "parse(string) {\n // Implement here...\n }", "title": "" }, { "docid": "80b5852d4653b2dd3a295cd235a4aa77", "score": "0.65052634", "text": "function a(n){var r,o=g(n);return t(),r=e.Parser,u(\"parse\",r),l(r)?new r(String(o),o).parse():r(String(o),o)}", "title": "" }, { "docid": "47f457a7f75ea67a1b9892c0f1c6393a", "score": "0.64671695", "text": "function parse () {\n\tdocument.getElementById(\"output\").innerHTML += '<p>parse()</p>';\n\tif (lexFailed === false) {\n\t\tcurrentTokenValue = tokens[parseIndex][1]; // sets currentTokenValue equal to the value at the current index in tokens\n\t} else {\n\t\tparseIndex = startOfProgram;\n\t\tparseIndex2 = startOfProgram;\n\t\tparseIndex3 = startOfProgram;\n\t\tcurrentTokenValue = tokens[parseIndex][1];\n\t}\t\n\terrorCounter = 0;\n\tcstTree = new Tree(); // creates a new cstTree object\n\tastTree = new Tree(); // creates a new astTree object\n\tparseProgram();\n\tcstTree.endChildren();\n\tdisplayParseOutcome();\n\tparse2();\n\tparse3();\n\tif (semanticAnalysisError === \"\") {\n\t\tdriver(); \n\t}\t\n\tif (currentTokenValue === \"$\" && tokens[parseIndex+1] !== undefined) {\n\t\tparseIndex++;\n\t\tparseIndex2++;\n\t\tparseIndex3++;\n\t\tparseErrors = [];\n\t} else {\n\t\tvar i = parseIndex;\n\t\twhile (i < tokens.length) {\n\t\t\tif (tokens[i][1] === \"$\") {\n\t\t\t\tparseIndex = i+1;\n\t\t\t\tparseIndex2 = i+1;\n\t\t\t\tparseIndex3 = i+1;\n\t\t\t\tparseErrors = [];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "6cda55c9eae0b7571af28f7515191ee2", "score": "0.64506084", "text": "parse() {\n const file = this.startNode();\n const program = this.startNode();\n this.nextToken();\n return this.parseTopLevel(file, program);\n }", "title": "" }, { "docid": "c0ae84b2dfc10b34a72ae0795a9e7024", "score": "0.6414375", "text": "function driver() {\r\n\t// optional, initialize the output string which will be used to display the parser's results\r\n\tvar html = '';\r\n\r\n\t// optional, initialize a message log for error/info reporting\r\n\tvar log = new MsgLog();\r\n\r\n\t// required, initialize the APG-generated opcodes\r\n\t// NOTE: To get this object for any given grammar, go to the APG website Interactive APG page.\r\n\t// Generate a parser for the grammar there.\r\n\t// Click the \"Generated Parser\" button and cut & paste into a file to include here.\r\n\t// Clumsy, but it will have to do until a stand-alone version of the generator is available.\r\n\tvar parserOpcodes = new ABNFOpcodes();\r\n\r\n\t// required, create a parser and attach the grammar-generated opcodes to it\r\n\tvar parser = new ApgLib(parserOpcodes);\r\n\r\n\t// optional, create a list of syntax callback functions and attach to parser\r\n\tvar synList = syntaxCallbackList(parserOpcodes.ruleIds);\r\n\tparser.syntaxInit(synList);\r\n\r\n\t// optional, create a list of semantic call back functions and attach to parser\r\n\tvar semCallbacks = semanticCallbackList(parserOpcodes.ruleIds);\r\n\tparser.semanticInit(semCallbacks);\r\n\r\n\t// required, get the input string and process it into an array of character codes\r\n\t// NOTE: Some browsers will add line ending characters to the textarea content.\r\n\tvar input = window.document.getElementById('input-string').value;\r\n\tvar stringChars = [];\r\n\tgrammarToChars(log, input, stringChars);\r\n\r\n\t// optional, generate an Abstract Syntax Tree (AST)\r\n\t// AST a) generate a list or rule name nodes and initialize the AST object\r\n\tvar astNodes = astNodeList(semCallbacks)\r\n// console.log(\"Pasando\");\r\n\r\n\t// AST b) construct the AST object (needs list of nodes, list of rules and the input string)\r\n\tvar ast = new Ast(astNodes, parserOpcodes.rules, stringChars);\r\n\r\n// console.log(ast.dump(parserOpcodes.rules, stringChars));\r\n\r\n\t// AST c) attach the AST object to the parser\r\n\tparser.astInit(ast);\r\n\r\n\t// optional, initialize the parser statistics object and attach to parser\r\n\tvar parserStats = new Stats(parserOpcodes.rules);\r\n\tparser.statsInit(parserStats);\r\n\r\n\t// optional, initialize the trace object and attach to parser\r\n\tvar parserTrace = new Trace();\r\n\tparserTrace.initRules(parserOpcodes.rules);\r\n\tparserTrace.initChars(stringChars);\r\n\tparser.traceInit(parserTrace);\r\n\r\n\t// optional, customize the parse tree nodes to trace\r\n\t// by default, the parser records visits to all rule name nodes and ignores all other nodes\r\n\t// here we are altering the defaults by turning ON the tracing for the TLS nodes\r\n\tparserTrace.setFilter(parserTrace.parseFilter, 'tls', true);\r\n\tparserTrace.setFilter(parserTrace.displayFilter, 'tls', true);\r\n\r\n\t// here we are turning OFF the saving of rules 18(wsp) and 21(any)\r\n\t// NOTE: comment out the following line for rule 18 to see empty strings in the trace output\r\n\tparserTrace.setFilter(parserTrace.parseFilter, 'rule', false, 18);\r\n\tparserTrace.setFilter(parserTrace.parseFilter, 'rule', false, 21);\r\n\t\r\n\t// optional, set up the user-defined data that the syntax analysis callback functions will need.\r\n\tvar synData = {\r\n\t\tlog : log,\r\n\t\tlineno : 0\r\n\t};\r\n\r\n\t// finally, parse the input string using rule 0(inifile) as the start rule,\r\n\t// stringChars as the input string and synData as the user-defined data\r\n\t// NOTE: the parser ignores synData. It is simply passed to the callback functions for them to use.\r\n\tvar test = parser.syntaxAnalysis(0, stringChars, synData);\r\n\r\n //console.log(\"test\");\r\n //console.log(test); // Este es el resultado true false de la verificacion\r\n\r\n //console.log(parserTrace.lines);\r\n var createTree = function(parserTrace, input) {\r\n var meaningfulTokens = [\r\n \"ancestorOf\",\r\n \"ancestorOf\",\r\n \"ancestorOrSelfOf\",\r\n \"attribute\",\r\n \"attributeGroup\",\r\n \"attributeName\",\r\n \"attributeSet\",\r\n \"binaryOperator\",\r\n \"cardinality\",\r\n \"compoundExpressionConstraint\",\r\n \"conceptId\",\r\n \"conceptReference\",\r\n \"concreteComparisonOperator\",\r\n \"concreteValue\",\r\n \"conjunction\",\r\n \"conjunctionDisjunction\",\r\n \"conjunctionExpressionConstraint\",\r\n \"constraintOperator\",\r\n \"descendantOf\",\r\n \"descendantOrSelfOf\",\r\n \"disjunction\",\r\n \"disjunctionExpressionConstraint\",\r\n \"exclusion\",\r\n \"exclusionExpressionConstraint\",\r\n \"expressionComparisonOperator\",\r\n \"expressionConstraint\",\r\n \"expressionConstraintValue\",\r\n \"focusConcept\",\r\n \"many\",\r\n \"memberOf\",\r\n \"refinedExpressionConstraint\",\r\n \"refinement\",\r\n \"reverseFlag\",\r\n //\"sctId\",\r\n \"simpleExpressionConstraint\",\r\n \"subExpressionConstraint\",\r\n \"term\",\r\n \"to\",\r\n \"unrefinedExpressionConstraint\"\r\n ];\r\n var tree = [];\r\n var max = parserTrace.parseCircular.items();\r\n parserTrace.parseCircular.initReplay();\r\n for (i = 0; i < max; i += 1) {\r\n var j = parserTrace.parseCircular.replay();\r\n line = parserTrace.lines[j];\r\n if (line.state == APG_MATCH && line.opType == RNM &&\r\n meaningfulTokens.indexOf(parserTrace.rules[line.ruleIndex].rule) > -1) {\r\n tree.push({\r\n depth: line.depth,\r\n offset: line.offset,\r\n length: line.length,\r\n rule: parserTrace.rules[line.ruleIndex].rule,\r\n content: input.substr(line.offset, line.length)\r\n })\r\n }\r\n }\r\n return tree;\r\n };\r\n\r\n var simpleTree = createTree(parserTrace, input);\r\n console.log(simpleTree.length);\r\n\r\n var getRootNode = function(tree) {\r\n var result;\r\n tree.forEach(function(node) {\r\n if (node.depth == 0) {\r\n result = node;\r\n }\r\n });\r\n return result;\r\n };\r\n var getChildren = function(node, tree) {\r\n var result = [];\r\n tree.forEach(function(loopNode) {\r\n if (loopNode.depth == node.depth + 1 &&\r\n loopNode.offset >= node.offset &&\r\n loopNode.offset + loopNode.length <= node.offset + node.length &&\r\n loopNode.rule != node.rule) {\r\n //loopNode.content.trim() != node.content.trim()\r\n if (!result.some(function(e) {\r\n return (e.rule == loopNode.rule && true && e.offset == loopNode.offset)\r\n })) {\r\n result.push(loopNode);\r\n }\r\n }\r\n });\r\n return result;\r\n };\r\n\r\n var printTree = function(node) {\r\n var tab = new Array((node.depth*2) + 1).join( \"-\" );\r\n console.log(tab,node.rule, node.content);\r\n var children = getChildren(node, simpleTree);\r\n children.forEach(function(loopChild) {\r\n printTree(loopChild);\r\n });\r\n };\r\n\r\n var root = getRootNode(simpleTree);\r\n printTree(root);\r\n var compiler = {};\r\n compiler.expressionConstraint = function(node, tree) {\r\n var children = getChildren(node, tree);\r\n children.forEach(function(loopChild) {\r\n compiler[loopChild.rule](loopChild, tree);\r\n });\r\n };\r\n compiler.simpleExpressionConstraint = function(node, tree) {\r\n console.log(\"A simple constraint \");\r\n var children = getChildren(node, tree);\r\n children.forEach(function(loopChild) {\r\n if (loopChild.rule == \"constraintOperator\") {\r\n console.log(\"An operation of type \" + loopChild.content);\r\n }\r\n });\r\n children.forEach(function(loopChild) {\r\n if (loopChild.rule == \"focusConcept\") {\r\n console.log(\"on focus concept \" + loopChild.content);\r\n }\r\n });\r\n };\r\n\r\n compiler.refinedExpressionConstraint = function(node, tree) {\r\n console.log(\"A refined constraint \");\r\n var children = getChildren(node, tree);\r\n children.forEach(function(loopChild) {\r\n compiler[loopChild.rule](loopChild, tree);\r\n });\r\n };\r\n\r\n compiler.compoundExpressionConstraint = function(node, tree) {\r\n console.log(\"A compound constraint \");\r\n var children = getChildren(node, tree);\r\n children.forEach(function(loopChild) {\r\n compiler[loopChild.rule](loopChild, tree);\r\n });\r\n };\r\n\r\n compiler.conjunctionExpressionConstraint = function(node, tree) {\r\n console.log(\"A conjuction constraint \");\r\n var children = getChildren(node, tree);\r\n children.forEach(function(loopChild) {\r\n compiler[loopChild.rule](loopChild, tree);\r\n });\r\n };\r\n\r\n compiler.disjunctionExpressionConstraint = function(node, tree) {\r\n console.log(\"A disjunction constraint \");\r\n var children = getChildren(node, tree);\r\n children.forEach(function(loopChild) {\r\n compiler[loopChild.rule](loopChild, tree);\r\n });\r\n };\r\n\r\n compiler.exclusionExpressionConstraint = function(node, tree) {\r\n console.log(\"An exclusion constraint \");\r\n var children = getChildren(node, tree);\r\n children.forEach(function(loopChild) {\r\n compiler[loopChild.rule](loopChild, tree);\r\n });\r\n };\r\n\r\n compiler.subExpressionConstraint = function(node, tree) {\r\n console.log(\"An subexpression constraint \");\r\n var children = getChildren(node, tree);\r\n children.forEach(function(loopChild) {\r\n compiler[loopChild.rule](loopChild, tree);\r\n });\r\n };\r\n\r\n compiler.refinement = function(node, tree) {\r\n console.log(\" with this refinment \", node.content);\r\n };\r\n\r\n //compiler[root.rule](root, simpleTree);\r\n\r\n\r\n var max = parserTrace.parseCircular.items();\r\n parserTrace.parseCircular.initReplay();\r\n for (i = 0; i < max; i += 1) {\r\n var j = parserTrace.parseCircular.replay();\r\n line = parserTrace.lines[j];\r\n if (\r\n //line.dir == \"down\"\r\n line.state == APG_MATCH &&\r\n line.opType == RNM\r\n ) {\r\n if (parserTrace.rules[line.ruleIndex].rule == \"conceptReference\") {\r\n// console.log(line);\r\n// console.log(parserTrace.rules[line.ruleIndex].rule);\r\n// console.log(input.substr(line.offset, line.length));\r\n }\r\n if (parserTrace.rules[line.ruleIndex].rule == \"refinedExpressionConstraint\") {\r\n// console.log(line);\r\n// console.log(parserTrace.rules[line.ruleIndex].rule);\r\n// console.log(input.substr(line.offset, line.length));\r\n }\r\n// if (parserTrace.rules[line.ruleIndex].rule == \"unrefinedExpressionConstraint\") {\r\n// console.log(line);\r\n// console.log(parserTrace.rules[line.ruleIndex].rule);\r\n// console.log(input.substr(line.offset, line.length));\r\n// }\r\n// if (parserTrace.rules[line.ruleIndex].rule == \"expressionConstraint\") {\r\n// console.log(line);\r\n// console.log(parserTrace.rules[line.ruleIndex].rule);\r\n// console.log(input.substr(line.offset, line.length));\r\n// }\r\n// if (parserTrace.rules[line.ruleIndex].rule == \"refinement\") {\r\n// console.log(line);\r\n// console.log(parserTrace.rules[line.ruleIndex].rule);\r\n// console.log(input.substr(line.offset, line.length));\r\n// }\r\n// if (parserTrace.rules[line.ruleIndex].rule == \"attribute\") {\r\n// console.log(line);\r\n// console.log(parserTrace.rules[line.ruleIndex].rule);\r\n// console.log(input.substr(line.offset, line.length));\r\n// }\r\n// if (parserTrace.rules[line.ruleIndex].rule == \"expressionConstraintValue\") {\r\n// console.log(line);\r\n// console.log(parserTrace.rules[line.ruleIndex].rule);\r\n// console.log(input.substr(line.offset, line.length));\r\n// }\r\n\r\n// console.log(parserTrace.rules[line.ruleIndex].rule);\r\n// console.log(line);\r\n //, parserTrace.displayAscii(parserTrace.chars, line.offset, line.length,line.state));\r\n //console.log(line);\r\n }\r\n }\r\n console.log(\"fin\");\r\n\r\n\t// \"while\" is used here simply as a single-point-of-exit error handling loop\r\n\twhile (true) {\r\n\t\t// test for any errors logged during syntaxAnalysis\r\n\t\tif (log.count() !== 0) {\r\n\t\t\thtml += log.logDisplay('syntaxAnalysis analysis errors encountered');\r\n\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\t// test for a possible parser failure that was not logged\r\n\t\tif (!test) {\r\n\t\t\thtml += '<br><br>parser: syntaxAnalysis analysis errors of unknown type encountered';\r\n\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\t// optional, initialize the user-defined data needed by the semantic callback functions\r\n\t\tvar semData = {\r\n\t\t\tlog : log,\r\n\t\t\tsectionName : '',\r\n\t\t\ttotal : 0\r\n\t\t};\r\n\r\n\t\t// translate the string (semantic analysis)\r\n\t\t// this is a traversal of the AST, calling the callback functions assigned to the saved AST nodes\r\n\t\tparser.semanticAnalysis(semData);\r\n\r\n\t\t// report any logged semantic analysis errors\r\n\t\tif (log.count() !== 0) {\r\n\t\t\thtml += log.logDisplay('semanticAnalysis analysis errors encountered');\r\n\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\t// success, if we are here all is well\r\n\t\thtml += '<h4>Parser Translation:</h4>';\r\n\t\thtml += 'total dollars and cents: $' + semData.total;\r\n\t\tbreak;\r\n\t}\r\n\r\n\t// put the results in HTML format\r\n\thtml += '<h4>Parser State:</h4>';\r\n\thtml += parser.stateDisplay(); // display the parser state\r\n\thtml += '<h4>Parser Statistics:</h4>';\r\n\thtml += parserStats.display(); // display the parser statistics\r\n\thtml += '<h4>Parser Trace:</h4>';\r\n\thtml += parserTrace.display(); // display the parser trace\r\n\r\n\t// display the results on the web page\r\n\twindow.document.getElementById('parser-output').innerHTML = html;\r\n}", "title": "" }, { "docid": "fbe910b334d4b2929a183f8fbdaed86d", "score": "0.6412039", "text": "function parse() {\n\n\t// Initialize\n\tresults = new Array();\n\terrors = new Array()\n\twarnings = new Array()\n\tScope = new Tree(T_SCOPE);\n\tCST = new Tree();\n\tAST = new Tree();\n\n\ttokenIndex = 0\n\tnumErrors = 0\n\tnumWarnings = 0\n\t\n\t/* 2nd and subsequent times this proc is called, want to reset the symbol table counter */\n\tif (Symbol.counter)\n\t Symbol.counter = 0\n\t \n\t/* First message on array will be changed after parse to indicate if errors were found. \n\tLeave a spot for it to avoid having to shuffle the results array when parse is done */\n\tresults.push(null)\n\t\n\t/* Ready to go! */\n\tparseProgram()\n\t/* If parse worked, then create the AST */\n\tif (numErrors == 0) {\n\t AST = CSTtoAST(CST)\n\t}\n\t\n\t/* If an error was encountered, fill in that first array element (the one that was null) with\n\t * the \"errors were found\" constant. Push an element on the array at the end to indicate the\n\t * total number of errors found. */\n\tif (numErrors > 0) {\n\t results[0] = eErrorsFound\n\t /* Sorry, I'm a grammar nut :-) Couldn't stand the \"1 parse errors\" and didn't want to\n\t * cheat by using \"error(s)\" */\n\t if (numErrors == 1)\n\t\terror(\"\\n\" + numErrors + \" parse error found.\")\n\t else\n\t\terror(\"\\n\" + numErrors + \" parse errors found.\")\n\t if (numWarnings == 1)\n\t\twarn(\"\\n\" + numWarnings + \" warnings issued.\")\n\t else\n\t\twarn(\"\\n\" + numWarnings + \" warnings issued.\")\n\t}\n\t/* Return a pile of stuff to the caller. The caller knows what to do with all this */\n\treturn { errors : errors, warnings : warnings, CST : CST , AST: AST}\n }", "title": "" }, { "docid": "c6730943e8c3add76ecbf93985392b8f", "score": "0.63628566", "text": "function parse() {\n let editor = ace.edit(\"editor\");\n var txt = editor.getValue();\n console.log('parsing: ' + txt);\n try {\n\tconst sexp = Sexp(txt);\n\tclearError();\n\tactiveRenderer.reset();\n\tactiveRenderer.addAst(sexp);\n\tactiveRenderer.initScale();\n\tactiveRenderer.initPositions();\n\tactiveRenderer.optimize();\n }\n catch (err) {\n\tconsole.log(err);\n\tsetError(err);\n }\n}", "title": "" }, { "docid": "cbf9ec33dfd9c9dfe29f5c82dbf8c566", "score": "0.6352023", "text": "function scm_parse(string)\n{\n var result = scm_program_syntax(ps(string));\n if (result.ast) {\n return result.ast;\n } else {\n return scm_error(\"Reader error\", string);\n }\n}", "title": "" }, { "docid": "586366418cfd5885b3da0c33de5c467b", "score": "0.62960786", "text": "function parser(ast) {\n var isTextNode = ast.type === 3;\n\n var $var = '_$var_' + (ast.tag || 'text') + ('_' + uuid++ + '_');\n codes.push('var ' + $var + ' = [];');\n\n var parentVar = stack[stack.length - 1] || $root;\n //var parentAST = stackAST[stackAST.length - 1];\n\n stack.push($var);\n //stackAST.push(ast);\n\n if (!isTextNode) {\n\n ast.children.forEach(function (child, i) {\n if (child.type === 3) {\n codes.push($var + '.push(' + JSON.stringify(child.text) + ');');\n } else if (child.type === 1) {\n if (child.tag == 'js') {\n if (child.children.length) {\n codes.push('' + child.children[0].text);\n }\n } else {\n parser(child);\n }\n }\n });\n }\n\n stack.length -= 1;\n //stackAST.length -= 1;\n\n //if( ast.tag === 'js' ) return;\n\n //if( stack.length )\n codes.push(parentVar + '.push(' + program + '(\"' + ast.tag + '\", ' + JSON.stringify(ast.attrsMap) + ', ' + $var + '));');\n //else \n // codes.push(`${program}(\"${ast.tag}\", ${JSON.stringify(ast.attrsMap)}, ${$var});`);\n }", "title": "" }, { "docid": "6a7816042b7e22a5f99b5a6df8bc5ae7", "score": "0.6233415", "text": "function parse(input,options){return new Parser(options,input).parse();}// This function tries to parse a single expression at a given", "title": "" }, { "docid": "e35ac0b51b38a02a8d00922817a89bd5", "score": "0.61739606", "text": "function parse(str) {\n var parser = new nearley.Parser(grammar.ParserRules, grammar.ParserStart);\n var output = parser.feed(str).results;\n var ast = clean(output);\n console.log(JSON.stringify(ast));\n return ast;\n}", "title": "" }, { "docid": "ed34ce49e7cff4849563c2805c0c1b06", "score": "0.6156073", "text": "function Parser(text) {\n if (typeof text !== 'string') {\n throw new Error('not a string');\n }\n this.text = text.trim();\n this.level = 0;\n this.place = 0;\n this.root = null;\n this.stack = [];\n this.currentObject = null;\n this.state = NEUTRAL;\n}", "title": "" }, { "docid": "ed34ce49e7cff4849563c2805c0c1b06", "score": "0.6156073", "text": "function Parser(text) {\n if (typeof text !== 'string') {\n throw new Error('not a string');\n }\n this.text = text.trim();\n this.level = 0;\n this.place = 0;\n this.root = null;\n this.stack = [];\n this.currentObject = null;\n this.state = NEUTRAL;\n}", "title": "" }, { "docid": "49d779d130d4eb55f8e2f6c05f74f8bd", "score": "0.6155481", "text": "function Parser() {\r\n }", "title": "" }, { "docid": "61d527f57b63c3f942626a03e949d22d", "score": "0.6103012", "text": "function State(input) {\n var _this = this;\n // The parse state\n this.raw_input = input;\n this.loc = 0;\n this.parse = (function () {\n var statements = _this.many(_this.parseStatement);\n _this.eof();\n return statements;\n }).bind(this);\n // Comments\n this.parseComment = parseComment.bind(this);\n this.parseLineComment = parseLineComment.bind(this);\n this.parseBlockComment = parseBlockComment.bind(this);\n this.parseInnerComment = parseInnerComment.bind(this);\n this.parseStatement = parseStatement.bind(this);\n this.parseFunction = parseFunction.bind(this);\n this.parseAssign = parseAssign.bind(this);\n this.parseVarDecl = parseVarDecl.bind(this);\n this.parseReturn = parseReturn.bind(this);\n this.parseThrow = parseThrow.bind(this);\n this.parseTryCatch = parseTryCatch.bind(this);\n this.parseIf = parseIf.bind(this);\n this.parseWhile = parseWhile.bind(this);\n this.parseBlock = parseBlock.bind(this);\n this.parseExpr = parseExpr.bind(this);\n this.parseNew = parseNew.bind(this);\n this.parseNumber = parseNumber.bind(this);\n this.parseString = parseString.bind(this);\n this.parseSingleQuotedString = parseSingleQuotedString.bind(this);\n this.parseDoubleQuotedString = parseDoubleQuotedString.bind(this);\n this.parseArr = parseArr.bind(this);\n this.parseObj = parseObj.bind(this);\n this.parseNot = parseNot.bind(this);\n this.parseFunCall = parseFunCall.bind(this);\n this.parseInfixOp = parseInfixOp.bind(this);\n this.parseVar = parseVar.bind(this);\n this.braces = braces.bind(this);\n this.parens = parens.bind(this);\n this.brackets = brackets.bind(this);\n this.comma = function () { return _this.token(\",\"); };\n this.semicolon = function () { return _this.token(\";\"); };\n this.dot = function () { return _this.token(\".\"); };\n this.eof = eof.bind(this);\n this.skipSpace = skipSpace.bind(this);\n this.word = word.bind(this);\n this.string = string.bind(this);\n this.token = token.bind(this);\n this.satisfy = satisfy.bind(this);\n this.satisfy1 = satisfy1.bind(this);\n // Combinators\n this.maybe = maybe.bind(this);\n this.many = many.bind(this);\n this.oneOf = oneOf.bind(this);\n this.between = between.bind(this);\n this.sepBy = sepBy.bind(this);\n this.sepByEnd = sepByEnd.bind(this);\n // Consume whitespace\n this.skipSpace = skipSpace.bind(this);\n // Consume the string if it matches the input\n this.string = string.bind(this);\n // Core methods\n this[\"try\"] = function (f) {\n var loc_before = _this.loc;\n try {\n return f();\n }\n catch (err) {\n _this.loc = loc_before;\n throw err;\n }\n };\n this.input = function () { return _this.raw_input.slice(_this.loc); };\n this.consume = function (n) {\n var slice = _this.input().slice(0, n);\n _this.loc += n;\n return slice;\n };\n this.peek = function (n) { return _this.input().slice(0, n); };\n this.error = error.bind(this);\n}", "title": "" }, { "docid": "9996678289592a5497c3985ae8095d09", "score": "0.6102553", "text": "function Parser(text) {\n\t if (typeof text !== 'string') {\n\t throw new Error('not a string');\n\t }\n\t this.text = text.trim();\n\t this.level = 0;\n\t this.place = 0;\n\t this.root = null;\n\t this.stack = [];\n\t this.currentObject = null;\n\t this.state = NEUTRAL;\n\t}", "title": "" }, { "docid": "9996678289592a5497c3985ae8095d09", "score": "0.6102553", "text": "function Parser(text) {\n\t if (typeof text !== 'string') {\n\t throw new Error('not a string');\n\t }\n\t this.text = text.trim();\n\t this.level = 0;\n\t this.place = 0;\n\t this.root = null;\n\t this.stack = [];\n\t this.currentObject = null;\n\t this.state = NEUTRAL;\n\t}", "title": "" }, { "docid": "9996678289592a5497c3985ae8095d09", "score": "0.6102553", "text": "function Parser(text) {\n\t if (typeof text !== 'string') {\n\t throw new Error('not a string');\n\t }\n\t this.text = text.trim();\n\t this.level = 0;\n\t this.place = 0;\n\t this.root = null;\n\t this.stack = [];\n\t this.currentObject = null;\n\t this.state = NEUTRAL;\n\t}", "title": "" }, { "docid": "9996678289592a5497c3985ae8095d09", "score": "0.6102553", "text": "function Parser(text) {\n\t if (typeof text !== 'string') {\n\t throw new Error('not a string');\n\t }\n\t this.text = text.trim();\n\t this.level = 0;\n\t this.place = 0;\n\t this.root = null;\n\t this.stack = [];\n\t this.currentObject = null;\n\t this.state = NEUTRAL;\n\t}", "title": "" }, { "docid": "e2f28a41fb1dc86c7a05836e1b10a15b", "score": "0.6088848", "text": "function Parser(text) {\n if (typeof text !== 'string') {\n throw new Error('not a string');\n }\n this.text = text.trim();\n this.level = 0;\n this.place = 0;\n this.root = null;\n this.stack = [];\n this.currentObject = null;\n this.state = NEUTRAL;\n }", "title": "" }, { "docid": "abb21913b21f247c64340eb7370688dc", "score": "0.60728705", "text": "parse(scope, tokens) {}", "title": "" }, { "docid": "7b018c215b365babd20b7207dee2231d", "score": "0.6042103", "text": "function Parser(text) {\n\t\t if (typeof text !== 'string') {\n\t\t throw new Error('not a string');\n\t\t }\n\t\t this.text = text.trim();\n\t\t this.level = 0;\n\t\t this.place = 0;\n\t\t this.root = null;\n\t\t this.stack = [];\n\t\t this.currentObject = null;\n\t\t this.state = NEUTRAL;\n\t\t}", "title": "" }, { "docid": "030ed12eb71a7d3427647a407ca1db63", "score": "0.60032654", "text": "function testParse(s) {\n var p = esprima.parse(s,{loc: true, range: true});\n console.log(p);\n console.log(esprimaToAST(p, s));\n}", "title": "" }, { "docid": "e473bd3e2ef60c787b8a21566e4e8dd9", "score": "0.5981451", "text": "function parse(input, options) {\n return Parser.parse(input, options);\n} // This function tries to parse a single expression at a given", "title": "" }, { "docid": "539f1c453e6ce9db4fe7b7276fefbbcc", "score": "0.58444446", "text": "static parse(str) {\n }", "title": "" }, { "docid": "525f9801acca905110392b481230487c", "score": "0.5832135", "text": "function AstBase() {}", "title": "" }, { "docid": "1264605a1f1adcc09cad5d8f441e4f66", "score": "0.58080447", "text": "function AST(lexer) {\n this.lexer = lexer;\n}", "title": "" }, { "docid": "2c6283ad491d46dbeb4803f22aedb669", "score": "0.5757538", "text": "function topLevelCode() {\n\n return {\n interpret: function () {\n switch (tokens[0]) {\n case \"HAI\":\n version = tokens[++t];\n console.log(\"Program started! version: \" + version + '\\n');\n return false;\n\n case \"KTHXBYE\":\n process.exit();\n break;\n\n case \"VISIBLE\":\n\n while (tokens[t + 1] != '!') {\n //if(t <= (tokens.length )) break;\n\n var msg = evalExpr();\n\n process.stdout.write(msg.toYarn().val);\n if (t >= (tokens.length - 1)) break;\n\n }\n\n if (tokens[t + 1] != '!') process.stdout.write('\\n');\n t++;\n return false;\n case \"GIMMEH\":\n t++;\n var idf = identify(tokens.slice(1));\n\n\n vars.setSlot(idf, new Yarn(prompt()))\n t = global.idfIdx;\n return false;\n case \"CAN HAS\":\n t = 1;\n var name = tokens[1];\n try {\n vars.val[name] = require(\"../ext/\" + name)\n }\n catch (e) {console.log(e);throw new Maus(\"NO HAS \" + name, 501)}\n t=2;\n return false;\n case \"HOW IZ\":\n t++;\n var func = new FunctionDeclaraition()\n\n if (tokens[1] == \"I\" && !defContext.length) {\n func.global = true;\n t++;\n }\n else {\n func.idf = identify(tokens.slice(1));\n t = global.idfIdx + 1;\n\n }\n var name = tokens[t];\n\n validate(name, true);\n func.name = name;\n\n t++;\n\n while (t < tokens.length - 1) {\n if (func.args.length) expect(\"AN\");\n expect(\"YR\");\n var arg = tokens[t];\n validate(arg);\n if (func.args.includes(arg)) throw new Maus(\"GOT ALREADY \" + arg, 209);\n func.args.push(arg);\n t++;\n }\n func.length = func.args.length;\n layers.unshift(func);\n\n return false;\n case \"FOUND YR\":\n if (stack.length) {\n returnVal = evalExpr();\n return false;\n }\n throw new Maus(\"FOUND YR, WTF?\", 202);\n\n case \"GTFO\":\n if (this.isLoop) {\n loopBreak = true;\n return false;\n }\n\n if (stack.length) {\n returnVal = new Noob();\n return false;\n }\n throw new Maus(\"GTFO, WTF?\", 202);\n\n case \"O RLY?\":\n\n layers.unshift(new IfLayer(vars.val.IT.toTroof().val));\n return false;\n\n case \"WTF?\":\n layers.unshift(new SwitchLayer(vars.val.IT));\n return false;\n\n case \"IM IN YR\":\n var label = tokens[1];\n if (!label) throw new Maus(\"IM IN YR WHAT\", 213);\n t = 1;\n layers.unshift(new LoopLayer(label));\n\n if (tokens.length < 3) return false;\n\n t = 3;\n layers[0].count = true;\n if (tokens[2] === \"UPPIN\") layers[0].by = 1;\n else if (tokens[2] === \"NERFIN\") layers[0].b = -1;\n else throw new Maus(\"SHALL I UPPIN OR NERFIN?\", 214);\n expect(\"YR\");\n t = 4;\n var counter = tokens[4];\n validate(counter);\n layers[0].counter = counter;\n\n if (tokens.length < 6) return false;\n\n t = 5\n layers[0].conditional = true;\n if (tokens[5] === \"TIL\") layers[0].condition = true;\n else if (tokens[5] === \"WILE\") layers[0].condition = false;\n else throw new Maus(\"TIL OR WILE?\", 215);\n layers[0].expression = tokens.slice(6);\n t = tokens.length;\n\n if (global.extErr) {\n layers[0].metahead.textline = global.textline;\n layers[0].metahead.tokensPos = global.tokensPos.slice(6);\n }\n return false;\n\n case \"O HAI IM\":\n\n t = 1;\n var name = tokens[1];\n validate(name);\n global.defContext.unshift(name)\n vars.val[name] = new Bukkit();\n layers.unshift(new BukkitLayer());\n return false;\n\n\n\n }\n\n var idf = identify(tokens);\n\n if (global.idfIdx < tokens.length) {\n //t=global.idfIdx;\n switch (tokens[global.idfIdx]) {\n\n case \"HAS A\":\n\n t = global.idfIdx;\n var name = identify(tokens.slice(++t))[0];\n\n t = global.idfIdx + 1;\n validate(name);\n\n\n\n if (tokens[t + 1] == \"ITZ\") {\n t++;\n var val = evalExpr();\n }\n else if (tokens[t + 1] == \"ITZ A\") {\n t += 2;\n var val = cast(new Noob(), tokens[t]);\n t++;\n\n }\n else if (tokens[t + 1] == \"ITZ LIEK A\") {\n t++;\n var v = evalExpr();\n if (!(v instanceof Bukkit)) throw new Maus(\"IZ LIEK BUKKIT\", 216)\n var val = v;\n }\n else { var val = new Noob(); }\n\n\n idf.push(name);\n global.vars.setSlot(idf, val, true);\n return false;\n\n case \"R\":\n t = global.idfIdx;\n //var name = identify(tokens.slice(++t));\n\n global.vars.setSlot(idf, evalExpr());\n return false;\n\n case \"IS NOW A\":\n t = global.idfIdx;\n\n var to = cast(global.vars.getSlot(idf), tokens[++t]);\n //var name = identify(tokens.slice(++t));\n\n t = 2;\n global.vars.setSlot(idf, to);\n return false;\n\n }\n\n }\n\n\n t = -1;\n global.vars.val.IT = evalExpr();\n\n\n },\n isFunction: false\n }\n}", "title": "" }, { "docid": "81a0723e58f199b78da2b685b541f583", "score": "0.5739654", "text": "function program() {\n var r;\n\n if (debug)\n console.log(\"-- parser: program --\");\n\n r = block();\n check_next_keyword(\".\");\n\n return r;\n }", "title": "" }, { "docid": "a9c3387c49937706d864022967508c77", "score": "0.5683326", "text": "function parse(A,t){return new n.Parser(t,A).parse()}", "title": "" }, { "docid": "3244f0bddf543eb8ab29429b706cf0bd", "score": "0.5660741", "text": "function parse(input, options) {\n return Parser.parse(input, options)\n }", "title": "" }, { "docid": "20e7761e7e6cc489984b2fe4a82b9368", "score": "0.5654685", "text": "function AST( obj ){\n \n}", "title": "" }, { "docid": "818b0f5572561ca6db08001f565be7b0", "score": "0.5638627", "text": "function exec_parser() {\n\tif (Parser && parseOn)\n try {\n editor.getSession().clearAnnotations();\n Parser.parse(editor.getValue());\n } catch(exn) {\n if (!editor.getSession().$annotations) {\n editor.getSession().$annotations = [];\n }\n\n var myAnno = {\n \"column\": exn['column'],\n \"row\": exn['line'] - 1,\n \"type\": \"error\",\n \"raw\": exn['message'],\n \"text\": exn['message']\n };\n \n editor.getSession().$annotations.push(myAnno);\n editor.getSession().setAnnotations(editor.getSession().$annotations);\n } // catch(exn)\n}", "title": "" }, { "docid": "d04a33b315e6f52ca516360887d868d0", "score": "0.5622657", "text": "function ParserWithTransform() {}", "title": "" }, { "docid": "742700da0308f71ca1bfe8221e77999b", "score": "0.5610189", "text": "parse(str) {\n // First of all: Away with all we don't have a need for:\n // Additionally, replace some constants:\n str = this.cleanupInputString(str);\n\n let lastChar = str.length - 1,\n index = 0,\n state = 0,\n expressions = [],\n char = \"\",\n tmp = \"\",\n funcName = null,\n pCount = 0;\n\n while (index <= lastChar) {\n switch (state) {\n case 0:\n // None state, the beginning. Read a char and see what happens.\n char = str.charAt(index);\n if (char.match(/[0-9.]/)) {\n // found the beginning of a number, change state to \"within-number\"\n state = \"within-nr\";\n tmp = \"\";\n index--;\n } else if (this.isOperator(char)) {\n // Simple operators. Note: \"-\" must be treated specifically,\n // it could be part of a number.\n // it MUST be part of a number if the last found expression\n // was an operator (or the beginning):\n if (char === \"-\") {\n if (\n expressions.length === 0 ||\n (expressions[expressions.length - 1] && typeof expressions[expressions.length - 1] === \"string\")\n ) {\n state = 0;\n tmp = \"\";\n expressions.push(-1, \"*\");\n break;\n }\n }\n\n // Found a simple operator, store as expression:\n if (\n (index === lastChar || this.isOperator(expressions[index - 1])) &&\n !expressions[index - 1].match(/[\\*\\^]/)\n ) {\n state = -1; // invalid to end with an operator, or have 2 operators in conjunction\n break;\n } else {\n expressions.push(char);\n state = 0;\n }\n } else if (char === \"(\") {\n // add a check if an expression just finished and about to start a new one\n if (str.charAt(index - 1).match(/[a-zA-Z0-9\\)\\]\\-]/)) {\n expressions.push(\"*\");\n }\n\n // left parenthes found, seems to be the beginning of a new sub-expression:\n state = \"within-parentheses\";\n tmp = \"\";\n pCount = 0;\n } else if (char === \"[\") {\n\n // add a check if an expression just finished and about to start a new one\n if (str.charAt(index - 1).match(/[a-zA-Z0-9\\)\\]\\-]/)) {\n expressions.push(\"*\");\n }\n\n // left named var separator char found, seems to be the beginning of a named var:\n state = \"within-named-var\";\n tmp = \"\";\n } else if (char.match(/[a-zA-Z]/)) {\n // multiple chars means it may be a function, else its a var which counts as own expression:\n if (index < lastChar && str.charAt(index + 1).match(/[a-zA-Z]/)) {\n // check for coefficient\n if (str.charAt(index - 1).match(/[0-9]/)) {\n expressions.push(\"*\");\n }\n tmp = char;\n state = \"within-func\";\n } else {\n // Single variable found:\n // We need to check some special considerations:\n // - If the last char was a number (e.g. 3x), we need to create a multiplication out of it (3*x)\n if (expressions.length > 0) {\n if (typeof expressions[expressions.length - 1] === \"number\") {\n expressions.push(\"*\");\n }\n }\n expressions.push(this.createVariableEvaluator(char));\n this.registerVariable(char);\n state = 0;\n tmp = \"\";\n }\n }\n break;\n\n case \"within-nr\":\n char = str.charAt(index);\n if (char.match(/[0-9.]/)) {\n //Still within number, store and continue\n tmp += char;\n if (index === lastChar) {\n expressions.push(Number(tmp));\n state = 0;\n }\n } else {\n // Number finished on last round, so add as expression:\n expressions.push(Number(tmp));\n tmp = \"\";\n state = 0;\n index--;\n }\n break;\n\n case \"within-func\":\n char = str.charAt(index);\n if (char.match(/[a-zA-Z0-9]/)) {\n tmp += char;\n } else if (char === \"(\") {\n funcName = tmp;\n tmp = \"\";\n pCount = 0;\n state = \"within-func-parentheses\";\n } else {\n throw new Error(`Wrong character for function at position ${index}`);\n }\n break;\n\n case \"within-named-var\":\n char = str.charAt(index);\n if (char === \"]\") {\n // end of named var, create expression:\n expressions.push(this.createVariableEvaluator(tmp));\n this.registerVariable(tmp);\n\n // add a check if a new expression is coming up and just ended one\n if (str.charAt(index + 1).match(/[a-zA-Z0-9\\(\\[]/)) { // by Squagward\n expressions.push(\"*\");\n }\n\n tmp = \"\";\n state = 0;\n } else if (char.match(/\\w/)) {\n tmp += char;\n } else {\n throw new Error(`Character not allowed within named variable: ${char}`);\n }\n break;\n\n case \"within-parentheses\":\n case \"within-func-parentheses\":\n char = str.charAt(index);\n if (char === \")\") {\n //Check if this is the matching closing parenthesis.If not, just read ahead.\n if (pCount <= 0) {\n // Yes, we found the closing parenthesis, create new sub-expression:\n if (state === \"within-parentheses\") {\n expressions.push(new Formula(tmp, this));\n } else if (state === \"within-func-parentheses\") {\n // Function found: return a function that,\n // when evaluated, evaluates first the sub-expression\n // then returns the function value of the sub-expression.\n // Access to the function is private within the closure:\n expressions.push(this.createFunctionEvaluator(tmp, funcName));\n funcName = null;\n }\n if (str.charAt(index + 1).match(/[a-zA-Z0-9]/)) {\n expressions.push(\"*\");\n }\n state = 0;\n } else {\n pCount--;\n tmp += char;\n }\n } else if (char === \"(\") {\n // begin of a new sub-parenthesis, increase counter:\n pCount++;\n tmp += char;\n } else {\n // all other things are just added to the sub-expression:\n tmp += char;\n }\n break;\n }\n index++;\n }\n\n if (state !== 0) {\n throw new Error(\"Could not parse formula: Syntax error.\");\n }\n\n return expressions;\n }", "title": "" }, { "docid": "fef3d459744352978932c35f2328cad7", "score": "0.55906355", "text": "function Parser() {\n this.yy = {};\n}", "title": "" }, { "docid": "a55e7dc9b3c0c4e6ac58efdefbb97752", "score": "0.55686224", "text": "function parse(input, options) {\n return Parser.parse(input, options)\n}", "title": "" }, { "docid": "a55e7dc9b3c0c4e6ac58efdefbb97752", "score": "0.55686224", "text": "function parse(input, options) {\n return Parser.parse(input, options)\n}", "title": "" }, { "docid": "a55e7dc9b3c0c4e6ac58efdefbb97752", "score": "0.55686224", "text": "function parse(input, options) {\n return Parser.parse(input, options)\n}", "title": "" }, { "docid": "a55e7dc9b3c0c4e6ac58efdefbb97752", "score": "0.55686224", "text": "function parse(input, options) {\n return Parser.parse(input, options)\n}", "title": "" }, { "docid": "a55e7dc9b3c0c4e6ac58efdefbb97752", "score": "0.55686224", "text": "function parse(input, options) {\n return Parser.parse(input, options)\n}", "title": "" }, { "docid": "a55e7dc9b3c0c4e6ac58efdefbb97752", "score": "0.55686224", "text": "function parse(input, options) {\n return Parser.parse(input, options)\n}", "title": "" }, { "docid": "cafb51e7a57047f18e513f7caf36fd72", "score": "0.55667347", "text": "function Parser(input) {\n // Make a new lexer\n this.lexer = new Lexer(input);\n}", "title": "" }, { "docid": "ff3d8a6e6f9e7f8fde71b459cf2bcaa2", "score": "0.55239016", "text": "function parse(code, compilerConfig) {\n return lib$1.parse(code, compilerConfig.getParserOptions());\n} // Export medatada in lscdiag format", "title": "" }, { "docid": "6fafd67db05be5f3c550720895fefb63", "score": "0.5492608", "text": "parse() {\n if (this.parser) {\n const document = this.newDocument();\n this.parser.parse(this.input, document);\n this.document = document;\n if (this.input === undefined) {\n throw new Error(`need input, i have ${this.input}`);\n }\n } else {\n const document = this.parseFn(this.input);\n this.document = document;\n }\n this.document.currentSource = undefined;\n this.document.currentLine = undefined;\n }", "title": "" }, { "docid": "ed96320a6a975e51c6eefaa9e603c1ee", "score": "0.54847866", "text": "static parse(tokens, index) {\n throw \"Not Implemented!\";\n }", "title": "" }, { "docid": "6ed5b1d9d8ed382e47e545e4a70a75b7", "score": "0.5418357", "text": "function parse(string) {\n return function innerParse() {\n url.parse(string);\n };\n}", "title": "" }, { "docid": "13aeaf3313ada54d12a82f1274a91081", "score": "0.54086727", "text": "function parse_and_evaluate(str) {\n return evaluate(parse(str));\n}", "title": "" }, { "docid": "5f5947a365617cf356d1022f54d4fb10", "score": "0.5399085", "text": "function compile(text) {\n if (!text) return null\n return parse(scan(text))\n}", "title": "" }, { "docid": "5f5947a365617cf356d1022f54d4fb10", "score": "0.5399085", "text": "function compile(text) {\n if (!text) return null\n return parse(scan(text))\n}", "title": "" }, { "docid": "8185dcb156e7ce1471874960cff656eb", "score": "0.5398901", "text": "function parse(input, options) {\n return new Parser(options, input).parse();\n }", "title": "" }, { "docid": "8fc4d1eeb4753472127189ff25d237d8", "score": "0.5395761", "text": "function parse(input, options) {\n\t return new Parser(options, input).parse()\n\t}", "title": "" }, { "docid": "72bc1f92508f88d0b89d3ce17c4c5832", "score": "0.53902155", "text": "function parse(text) {\n var a = lexer.lexAll(text)\n return parse_blank(a)\n }", "title": "" }, { "docid": "1f3c7c837bc4ea48f4cdb1e14386dc1d", "score": "0.53828305", "text": "parse () {\n\t\tlet tokens = this.tokenize(this.exp)\n\t\ttokens = this.postfix(tokens)\n\t\tthis.processed = this.process(tokens)\n\t}", "title": "" }, { "docid": "ef72e329b7533e2ffee4c81301c13970", "score": "0.5379045", "text": "function parse(input, options) {\n\t return new _state.Parser(options, input).parse();\n\t}", "title": "" }, { "docid": "0523cc04000b953696b4447ca9b7b7fa", "score": "0.5378666", "text": "function TextParser() {}", "title": "" }, { "docid": "0523cc04000b953696b4447ca9b7b7fa", "score": "0.5378666", "text": "function TextParser() {}", "title": "" }, { "docid": "0523cc04000b953696b4447ca9b7b7fa", "score": "0.5378666", "text": "function TextParser() {}", "title": "" }, { "docid": "0523cc04000b953696b4447ca9b7b7fa", "score": "0.5378666", "text": "function TextParser() {}", "title": "" }, { "docid": "f082f5d9502574b080fc74466b3819f2", "score": "0.53645563", "text": "function getAST(load) {\n\n\tif (load.ast) {\n\t\treturn load.ast;\n\t} else {\n\t\tif (load.source) {\n\t\t\tconst opts = Object.assign({sourceFile: load.sourceFile}, parseOpts);\n\t\t\treturn acorn.parse(load.source, opts);\n\t\t} else {\n\t\t\tthrow new Error('Cannot get AST!');\n\t\t}\n\t}\n}", "title": "" }, { "docid": "09e2baf9695dbe8823a31e5dddd8d918", "score": "0.53619975", "text": "function parseTree(text) {\n var tagStart, tagEnd;\n var cur = 0;\n var substr = '';\n var match;\n\n var root = new Root();\n var currentNode = root;\n\n var tagName, params, newBloc;\n\n // Preformatting\n text = text.replace(/<!--([^]*?)-->/gm, '');\n\n while ((tagStart = text.indexOf(START_TAG, cur) + 2 ) != 1 &&\n (tagEnd = text.indexOf(END_TAG, tagStart)) != -1) {\n\n substr = text.substr(tagStart, tagEnd-tagStart);\n match = tagExpr.exec(substr);\n\n if (tagStart - 2 - cur != 0) {\n currentNode.onContent(text.substr(cur, tagStart-2-cur));\n }\n\n if (match == null) {\n throw new Error(\"Cannot parse expression : \" + substr);\n }\n\n tagName = match[1].replace(/\\s/g, '');\n params = match[2];\n\n if (tagName == 'name') {\n root.tpl_name = params.replace(/\\s/g, '');\n } else if (nodes[tagName] !== undefined) {\n newBloc = new nodes[tagName](params);\n currentNode = currentNode.onNext(newBloc);\n } else if (tagName == 'end') {\n if (params.replace(/\\s/g, '') === currentNode.closingTag) {\n currentNode = currentNode.parent;\n } else\n throw new Error(\"Unexpected \"+substr);\n } else {\n throw new Error(\"Cannot parse expression : \" + substr);\n }\n\n cur = tagEnd+2;\n }\n\n // appends the last bits\n if (text.length - cur != 0) {\n root.onContent(text.substr(cur, text.length-cur));\n }\n\n if (currentNode !== root)\n throw new Error(\"Expected end \"+currentNode.closingTag+\" at end of file\");\n\n\n return root;\n}", "title": "" }, { "docid": "5d6ab5c64af958cd0c84f5000a04db00", "score": "0.5346738", "text": "function parse(input, options) {\n return new Parser(options, input).parse()\n }", "title": "" }, { "docid": "00fb1dc411a52423ab11524c23883b64", "score": "0.5345196", "text": "function Lexer() {}", "title": "" }, { "docid": "fc14cb879a2a68627d3792af6a2c5884", "score": "0.53372335", "text": "function parseText(code, parameters) {\n var prop,\n syntax,\n acornReport = \"\",\n reports = {\n 'whitelist': [],\n 'blacklist': []\n };\n \n // auxiliary function: checks if object is empty\n function isEmpty(obj) {\n for (prop in obj) {\n if (obj.hasOwnProperty(prop)) {\n return false;\n }\n }\n return true;\n }\n \n // checks for vague structural constructs\n function checkStructure(ancestors) {\n var i, j, key, component;\n //iterate through the components\n parameters.structure.some(function (component, index) {\n //only check the components that are unverified\n if (component.integrity === false) {\n j = 0;\n for (i = 0; i < ancestors.length; i += 1) {\n if (ancestors[i] === component.array[j]) {\n j = j + 1;\n if (j === component.array.length) {\n component.integrity = true;\n return true;\n }\n }\n }\n }\n \n // if the current (just checked) component didn't pass, \n // stop, because the structure is only valid if the components\n // are found in order\n if (component.integrity === false) {\n return true;\n }\n });\n }\n \n // traverses syntax tree created by esprima; at every leaf calls checkStructure to analyze code structure\n // repurposed from an esprima example script\n function traverse(object, ancestors, visitor) {\n var key, child, tempList;\n\n visitor.call(null, object);\n for (key in object) {\n if (object.hasOwnProperty(key)) {\n child = object[key];\n if (typeof child === 'object' && child !== null) {\n tempList = ancestors.concat(object.type);\n traverse(child, tempList, visitor);\n // call checkStructure at every leaf\n } else {\n checkStructure(ancestors);\n }\n }\n }\n }\n \n function checkList(list, node) { \n /*\n //this is commented out, but provides extra information on the whitelist/blacklist elements\n var excerpt;\n excerpt = content.substring(node.range[0], node.range[1]);\n\n if (excerpt.length > 20) {\n excerpt = excerpt.substring(0, 20) + '...';\n }\n */\n\n parameters[list][node.type] = true;\n \n reports[list].push({\n 'type': node.type,\n 'location': node.start\n });\n }\n \n // if each nested structure in parameters.structure is fulfilled, mark the main structure's integrity as 'true'\n function verifyStructure() {\n var component, key, missingComponents = [];\n \n parameters.structure.forEach(function(element, index) {\n if (element.integrity !== true) {\n missingComponents.push(index);\n }\n });\n \n return missingComponents;\n }\n \n // reset the parameters (at the end of parseText, so that it can be run fresh in the next call)\n function resetParameters() {\n var key;\n for (key in parameters.whitelist) {\n parameters.whitelist[key] = false;\n }\n for (key in parameters.blacklist) {\n parameters.blacklist[key] = false;\n }\n parameters.structure.some(function (component) {\n component.integrity = false;\n });\n }\n \n // generates a string, stored in acornReport, providing feedback on the code in terms of the whitelist, blacklist, and structure\n function assembleReport() {\n var i, key, element, component, missingComponents, errorBool = false;\n \n //assemble whitelist report\n acornReport = acornReport.concat('Whitelist: <br>');\n for (element in parameters.whitelist) {\n if (parameters.whitelist[element] !== true) {\n errorBool = true;\n acornReport = acornReport.concat('&nbsp Error: You are missing a ' + element + '.');\n }\n }\n if (!errorBool) {\n acornReport = acornReport.concat('&nbsp No issues!<br>');\n } else {\n acornReport = acornReport.concat('<br>');\n }\n \n //assemble blacklist report\n acornReport = acornReport.concat('Blacklist:');\n if (reports.blacklist.length > 0) {\n acornReport = acornReport.concat('<br>');\n reports.blacklist.forEach(function (element) {\n acornReport = acornReport.concat('&nbsp Error: You have a ' + element.type + ' on line ' + element.location + '.<br>');\n });\n } else {\n acornReport = acornReport.concat(' No issues! <br>');\n }\n \n //assemble structure report\n acornReport = acornReport.concat('Structure:<br>');\n missingComponents = verifyStructure();\n if (missingComponents.length >0) {\n missingComponents.forEach(function (key, i) {\n if (i === 0) {\n acornReport = acornReport.concat('&nbsp Error: You are missing a ');\n }\n parameters.structure[key].array.forEach(function (element, index) {\n acornReport = acornReport.concat(element);\n if (index < parameters.structure[key].array.length - 1) {\n acornReport = acornReport.concat(' enclosing a ');\n }\n });\n if (i < missingComponents.length - 1) {\n acornReport = acornReport.concat(', as well as a <br>');\n }\n });\n acornReport = acornReport.concat('.<br>');\n } else {\n acornReport = acornReport.concat('&nbsp No issues!<br>');\n }\n }\n \n // if var code is empty\n if (!code) {\n return \"Waiting for your input...<br>\";\n }\n \n // using acorn's loose interpreter, which means that incomplete structures will also be accepted\n // e.g. simply 'for for if for for if' will fulfill the structure requirements of the default parameters (in main1.js)\n // these errors should be picked up by a more robust code parser\n console.log(acorn);\n syntax = acorn.parse_dammit(code, {});\n \n traverse(syntax, [], function (node) {\n var rule;\n for (rule in parameters.whitelist) {\n if (node.type === rule) {\n checkList('whitelist', node);\n }\n }\n for (rule in parameters.blacklist) {\n if (node.type === rule) {\n checkList('blacklist', node);\n }\n }\n });\n assembleReport();\n resetParameters();\n \n return acornReport;\n }", "title": "" }, { "docid": "63a17218cb7a1d8b8f9cf9769aa5746f", "score": "0.53355587", "text": "parse (source) {\n\n // hang onto the source\n if (this.source == null) {\n this.source = source;\n }\n\n this.ast = new Parser().parse(this.source);\n\n // extract the deps from the AST\n\n this.deps = this.ast.deps.map(constant => {\n return {\n ns: constant.value.namespace || '__local',\n name: constant.value.id\n };\n });\n\n return this;\n }", "title": "" }, { "docid": "ba03f94b88a951a05451e7b2b1610580", "score": "0.53352726", "text": "function lexer (input) {\n let current = 0\n let tokens = []\n\n let type = 'main'\n\n let cur = () => input[current] || ''\n let next = () => current++\n let unexpected = (ex) => {\n let err = new SyntaxError('Unexpected token ' + cur() + ' @ ' + current + (ex ? ' expected ' + ex : ''))\n err.stack = input + '\\n' + ' '.repeat(current) + '^' + '\\n\\n' + err.stack\n throw err\n }\n\n while (current < input.length) {\n switch (type) {\n case 'main':\n if (cur() !== '/') {\n unexpected('/')\n }\n next()\n type = 'token' // goto :token\n break\n case 'token':\n if (cur().match(LETTER)) {\n type = 'proto'\n } else if (cur() === '.') {\n type = 'condition'\n next()\n } else if (cur() === '_') {\n type = 'subproto'\n next()\n } else {\n unexpected('a protocol, subprotocol or condition')\n }\n break\n case 'proto': {\n let name = ''\n while (cur().match(LETTER)) {\n name += cur()\n next()\n }\n if (ACTIONS.indexOf(name) !== -1) {\n tokens.push({type: 'action', name})\n } else {\n tokens.push({type: 'proto', name})\n }\n type = 'main'\n break\n }\n case 'subproto': {\n let name = ''\n while (cur().match(LETTER)) {\n name += cur()\n next()\n }\n tokens.push({type: 'subproto', name})\n type = 'main'\n break\n }\n case 'condition': {\n let name = ''\n let matcher = ''\n let value = ''\n while (cur().match(LETTER)) {\n name += cur()\n next()\n }\n if (cur() === ':') {\n next()\n while (cur().match(LETTER)) {\n matcher += cur()\n next()\n }\n }\n if (cur() !== '/') {\n unexpected('/')\n }\n next()\n\n let parseValue = true\n let endChar = '/'\n if (cur() === '\"' || cur() === \"'\") {\n endChar = cur()\n next()\n }\n\n while (parseValue) {\n if (cur() === '\\\\' && input[current + 1] === endChar) {\n next()\n value += cur() // append non-escaped version\n } else if (cur() === endChar) {\n parseValue = false\n } else {\n value += cur()\n }\n next()\n }\n\n tokens.push({type: 'condition', name, matcher, value})\n type = cur() === '/' ? 'main' : 'token'\n break\n }\n default: throw new Error('Parser Error')\n }\n }\n\n return tokens\n}", "title": "" }, { "docid": "1660ae4264cd1a8a31c137e561cd71e6", "score": "0.5329848", "text": "function parseExpressionAt(input,pos,options){var p=new Parser(options,input,pos);p.nextToken();return p.parseExpression();}// Acorn is organized as a tokenizer and a recursive-descent parser.", "title": "" }, { "docid": "9fec559e3820eb0ff9203a3e23d5df17", "score": "0.5326555", "text": "function tokenBase(stream, state) {\n var ch = stream.next(),\n mightBeFunction = false,\n isEQName = isEQNameAhead(stream);\n\n // an XML tag (if not in some sub, chained tokenizer)\n if (ch == \"<\") {\n if(stream.match(\"!--\", true))\n return chain(stream, state, tokenXMLComment);\n\n if(stream.match(\"![CDATA\", false)) {\n state.tokenize = tokenCDATA;\n return ret(\"tag\", \"tag\");\n }\n\n if(stream.match(\"?\", false)) {\n return chain(stream, state, tokenPreProcessing);\n }\n\n var isclose = stream.eat(\"/\");\n stream.eatSpace();\n var tagName = \"\", c;\n while ((c = stream.eat(/[^\\s\\u00a0=<>\\\"\\'\\/?]/))) tagName += c;\n\n return chain(stream, state, tokenTag(tagName, isclose));\n }\n // start code block\n else if(ch == \"{\") {\n pushStateStack(state,{ type: \"codeblock\"});\n return ret(\"\", null);\n }\n // end code block\n else if(ch == \"}\") {\n popStateStack(state);\n return ret(\"\", null);\n }\n // if we're in an XML block\n else if(isInXmlBlock(state)) {\n if(ch == \">\")\n return ret(\"tag\", \"tag\");\n else if(ch == \"/\" && stream.eat(\">\")) {\n popStateStack(state);\n return ret(\"tag\", \"tag\");\n }\n else\n return ret(\"word\", \"variable\");\n }\n // if a number\n else if (/\\d/.test(ch)) {\n stream.match(/^\\d*(?:\\.\\d*)?(?:E[+\\-]?\\d+)?/);\n return ret(\"number\", \"atom\");\n }\n // comment start\n else if (ch === \"(\" && stream.eat(\":\")) {\n pushStateStack(state, { type: \"comment\"});\n return chain(stream, state, tokenComment);\n }\n // quoted string\n else if ( !isEQName && (ch === '\"' || ch === \"'\"))\n return chain(stream, state, tokenString(ch));\n // variable\n else if(ch === \"$\") {\n return chain(stream, state, tokenVariable);\n }\n // assignment\n else if(ch ===\":\" && stream.eat(\"=\")) {\n return ret(\"operator\", \"keyword\");\n }\n // open paren\n else if(ch === \"(\") {\n pushStateStack(state, { type: \"paren\"});\n return ret(\"\", null);\n }\n // close paren\n else if(ch === \")\") {\n popStateStack(state);\n return ret(\"\", null);\n }\n // open paren\n else if(ch === \"[\") {\n pushStateStack(state, { type: \"bracket\"});\n return ret(\"\", null);\n }\n // close paren\n else if(ch === \"]\") {\n popStateStack(state);\n return ret(\"\", null);\n }\n else {\n var known = keywords.propertyIsEnumerable(ch) && keywords[ch];\n\n // if there's a EQName ahead, consume the rest of the string portion, it's likely a function\n if(isEQName && ch === '\\\"') while(stream.next() !== '\"'){}\n if(isEQName && ch === '\\'') while(stream.next() !== '\\''){}\n\n // gobble up a word if the character is not known\n if(!known) stream.eatWhile(/[\\w\\$_-]/);\n\n // gobble a colon in the case that is a lib func type call fn:doc\n var foundColon = stream.eat(\":\");\n\n // if there's not a second colon, gobble another word. Otherwise, it's probably an axis specifier\n // which should get matched as a keyword\n if(!stream.eat(\":\") && foundColon) {\n stream.eatWhile(/[\\w\\$_-]/);\n }\n // if the next non whitespace character is an open paren, this is probably a function (if not a keyword of other sort)\n if(stream.match(/^[ \\t]*\\(/, false)) {\n mightBeFunction = true;\n }\n // is the word a keyword?\n var word = stream.current();\n known = keywords.propertyIsEnumerable(word) && keywords[word];\n\n // if we think it's a function call but not yet known,\n // set style to variable for now for lack of something better\n if(mightBeFunction && !known) known = {type: \"function_call\", style: \"variable def\"};\n\n // if the previous word was element, attribute, axis specifier, this word should be the name of that\n if(isInXmlConstructor(state)) {\n popStateStack(state);\n return ret(\"word\", \"variable\", word);\n }\n // as previously checked, if the word is element,attribute, axis specifier, call it an \"xmlconstructor\" and\n // push the stack so we know to look for it on the next word\n if(word == \"element\" || word == \"attribute\" || known.type == \"axis_specifier\") pushStateStack(state, {type: \"xmlconstructor\"});\n\n // if the word is known, return the details of that else just call this a generic 'word'\n return known ? ret(known.type, known.style, word) :\n ret(\"word\", \"variable\", word);\n }\n }", "title": "" }, { "docid": "9fec559e3820eb0ff9203a3e23d5df17", "score": "0.5326555", "text": "function tokenBase(stream, state) {\n var ch = stream.next(),\n mightBeFunction = false,\n isEQName = isEQNameAhead(stream);\n\n // an XML tag (if not in some sub, chained tokenizer)\n if (ch == \"<\") {\n if(stream.match(\"!--\", true))\n return chain(stream, state, tokenXMLComment);\n\n if(stream.match(\"![CDATA\", false)) {\n state.tokenize = tokenCDATA;\n return ret(\"tag\", \"tag\");\n }\n\n if(stream.match(\"?\", false)) {\n return chain(stream, state, tokenPreProcessing);\n }\n\n var isclose = stream.eat(\"/\");\n stream.eatSpace();\n var tagName = \"\", c;\n while ((c = stream.eat(/[^\\s\\u00a0=<>\\\"\\'\\/?]/))) tagName += c;\n\n return chain(stream, state, tokenTag(tagName, isclose));\n }\n // start code block\n else if(ch == \"{\") {\n pushStateStack(state,{ type: \"codeblock\"});\n return ret(\"\", null);\n }\n // end code block\n else if(ch == \"}\") {\n popStateStack(state);\n return ret(\"\", null);\n }\n // if we're in an XML block\n else if(isInXmlBlock(state)) {\n if(ch == \">\")\n return ret(\"tag\", \"tag\");\n else if(ch == \"/\" && stream.eat(\">\")) {\n popStateStack(state);\n return ret(\"tag\", \"tag\");\n }\n else\n return ret(\"word\", \"variable\");\n }\n // if a number\n else if (/\\d/.test(ch)) {\n stream.match(/^\\d*(?:\\.\\d*)?(?:E[+\\-]?\\d+)?/);\n return ret(\"number\", \"atom\");\n }\n // comment start\n else if (ch === \"(\" && stream.eat(\":\")) {\n pushStateStack(state, { type: \"comment\"});\n return chain(stream, state, tokenComment);\n }\n // quoted string\n else if ( !isEQName && (ch === '\"' || ch === \"'\"))\n return chain(stream, state, tokenString(ch));\n // variable\n else if(ch === \"$\") {\n return chain(stream, state, tokenVariable);\n }\n // assignment\n else if(ch ===\":\" && stream.eat(\"=\")) {\n return ret(\"operator\", \"keyword\");\n }\n // open paren\n else if(ch === \"(\") {\n pushStateStack(state, { type: \"paren\"});\n return ret(\"\", null);\n }\n // close paren\n else if(ch === \")\") {\n popStateStack(state);\n return ret(\"\", null);\n }\n // open paren\n else if(ch === \"[\") {\n pushStateStack(state, { type: \"bracket\"});\n return ret(\"\", null);\n }\n // close paren\n else if(ch === \"]\") {\n popStateStack(state);\n return ret(\"\", null);\n }\n else {\n var known = keywords.propertyIsEnumerable(ch) && keywords[ch];\n\n // if there's a EQName ahead, consume the rest of the string portion, it's likely a function\n if(isEQName && ch === '\\\"') while(stream.next() !== '\"'){}\n if(isEQName && ch === '\\'') while(stream.next() !== '\\''){}\n\n // gobble up a word if the character is not known\n if(!known) stream.eatWhile(/[\\w\\$_-]/);\n\n // gobble a colon in the case that is a lib func type call fn:doc\n var foundColon = stream.eat(\":\");\n\n // if there's not a second colon, gobble another word. Otherwise, it's probably an axis specifier\n // which should get matched as a keyword\n if(!stream.eat(\":\") && foundColon) {\n stream.eatWhile(/[\\w\\$_-]/);\n }\n // if the next non whitespace character is an open paren, this is probably a function (if not a keyword of other sort)\n if(stream.match(/^[ \\t]*\\(/, false)) {\n mightBeFunction = true;\n }\n // is the word a keyword?\n var word = stream.current();\n known = keywords.propertyIsEnumerable(word) && keywords[word];\n\n // if we think it's a function call but not yet known,\n // set style to variable for now for lack of something better\n if(mightBeFunction && !known) known = {type: \"function_call\", style: \"variable def\"};\n\n // if the previous word was element, attribute, axis specifier, this word should be the name of that\n if(isInXmlConstructor(state)) {\n popStateStack(state);\n return ret(\"word\", \"variable\", word);\n }\n // as previously checked, if the word is element,attribute, axis specifier, call it an \"xmlconstructor\" and\n // push the stack so we know to look for it on the next word\n if(word == \"element\" || word == \"attribute\" || known.type == \"axis_specifier\") pushStateStack(state, {type: \"xmlconstructor\"});\n\n // if the word is known, return the details of that else just call this a generic 'word'\n return known ? ret(known.type, known.style, word) :\n ret(\"word\", \"variable\", word);\n }\n }", "title": "" }, { "docid": "83aa97d9ba197e102796aac345fb0a16", "score": "0.5325955", "text": "function expression_parser(input){ \n // comprises of operations // ifparser // beginparser\n if (!input.startsWith('(')) return null\n input = skipSpace(input.slice(1))\n // console.log('inside the expression_parser',input);\n \n let result = operation_parser(input) ||if_parser(input) || begin_parser(input) || defining_variable(input) || check_const(input)\n\n return result ? result : null\n // return null\n}", "title": "" }, { "docid": "0f8b093a27f709b037b79fb6d8f8e432", "score": "0.5320892", "text": "function parse(input, options) {\n return new Parser(options, input).parse();\n }", "title": "" }, { "docid": "08c48ebe58ecc94e37d4397223beda84", "score": "0.53106725", "text": "function Parser(config)\n\t{\n\t\t// Unpack the config object\n\t\tconfig = config || {};\n\t\tvar delim = config.delimiter;\n\t\tvar newline = config.newline;\n\t\tvar comments = config.comments;\n\t\tvar step = config.step;\n\t\tvar preview = config.preview;\n\t\tvar fastMode = config.fastMode;\n\n\t\t// Delimiter must be valid\n\t\tif (typeof delim !== 'string'\n\t\t\t|| delim.length != 1\n\t\t\t|| Baby.BAD_DELIMITERS.indexOf(delim) > -1)\n\t\t\tdelim = \",\";\n\n\t\t// Comment character must be valid\n\t\tif (comments === delim)\n\t\t\tthrow \"Comment character same as delimiter\";\n\t\telse if (comments === true)\n\t\t\tcomments = \"#\";\n\t\telse if (typeof comments !== 'string'\n\t\t\t|| Baby.BAD_DELIMITERS.indexOf(comments) > -1)\n\t\t\tcomments = false;\n\n\t\t// Newline must be valid: \\r, \\n, or \\r\\n\n\t\tif (newline != '\\n' && newline != '\\r' && newline != '\\r\\n')\n\t\t\tnewline = '\\n';\n\n\t\t// We're gonna need these at the Parser scope\n\t\tvar cursor = 0;\n\t\tvar aborted = false;\n\n\t\tthis.parse = function(input)\n\t\t{\n\t\t\t// For some reason, in Chrome, this speeds things up (!?)\n\t\t\tif (typeof input !== 'string')\n\t\t\t\tthrow \"Input must be a string\";\n\n\t\t\t// We don't need to compute some of these every time parse() is called,\n\t\t\t// but having them in a more local scope seems to perform better\n\t\t\tvar inputLen = input.length,\n\t\t\t\tdelimLen = delim.length,\n\t\t\t\tnewlineLen = newline.length,\n\t\t\t\tcommentsLen = comments.length;\n\t\t\tvar stepIsFunction = typeof step === 'function';\n\n\t\t\t// Establish starting state\n\t\t\tcursor = 0;\n\t\t\tvar data = [], errors = [], row = [];\n\n\t\t\tif (!input)\n\t\t\t\treturn returnable();\n\n\t\t\tif (fastMode)\n\t\t\t{\n\t\t\t\t// Fast mode assumes there are no quoted fields in the input\n\t\t\t\tvar rows = input.split(newline);\n\t\t\t\tfor (var i = 0; i < rows.length; i++)\n\t\t\t\t{\n\t\t\t\t\tif (comments && rows[i].substr(0, commentsLen) == comments)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tif (stepIsFunction)\n\t\t\t\t\t{\n\t\t\t\t\t\tdata = [ rows[i].split(delim) ];\n\t\t\t\t\t\tdoStep();\n\t\t\t\t\t\tif (aborted)\n\t\t\t\t\t\t\treturn returnable();\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tdata.push(rows[i].split(delim));\n\t\t\t\t\tif (preview && i >= preview)\n\t\t\t\t\t{\n\t\t\t\t\t\tdata = data.slice(0, preview);\n\t\t\t\t\t\treturn returnable(true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn returnable();\n\t\t\t}\n\n\t\t\tvar nextDelim = input.indexOf(delim, cursor);\n\t\t\tvar nextNewline = input.indexOf(newline, cursor);\n\n\t\t\t// Parser loop\n\t\t\tfor (;;)\n\t\t\t{\n\t\t\t\t// Field has opening quote\n\t\t\t\tif (input[cursor] == '\"')\n\t\t\t\t{\n\t\t\t\t\t// Start our search for the closing quote where the cursor is\n\t\t\t\t\tvar quoteSearch = cursor;\n\n\t\t\t\t\t// Skip the opening quote\n\t\t\t\t\tcursor++;\n\n\t\t\t\t\tfor (;;)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Find closing quote\n\t\t\t\t\t\tvar quoteSearch = input.indexOf('\"', quoteSearch+1);\n\n\t\t\t\t\t\tif (quoteSearch === -1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// No closing quote... what a pity\n\t\t\t\t\t\t\terrors.push({\n\t\t\t\t\t\t\t\ttype: \"Quotes\",\n\t\t\t\t\t\t\t\tcode: \"MissingQuotes\",\n\t\t\t\t\t\t\t\tmessage: \"Quoted field unterminated\",\n\t\t\t\t\t\t\t\trow: data.length,\t// row has yet to be inserted\n\t\t\t\t\t\t\t\tindex: cursor\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treturn finish();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (quoteSearch === inputLen-1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Closing quote at EOF\n\t\t\t\t\t\t\trow.push(input.substring(cursor, quoteSearch).replace(/\"\"/g, '\"'));\n\t\t\t\t\t\t\tdata.push(row);\n\t\t\t\t\t\t\tif (stepIsFunction)\n\t\t\t\t\t\t\t\tdoStep();\n\t\t\t\t\t\t\treturn returnable();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If this quote is escaped, it's part of the data; skip it\n\t\t\t\t\t\tif (input[quoteSearch+1] == '\"')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tquoteSearch++;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (input[quoteSearch+1] == delim)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Closing quote followed by delimiter\n\t\t\t\t\t\t\trow.push(input.substring(cursor, quoteSearch).replace(/\"\"/g, '\"'));\n\t\t\t\t\t\t\tcursor = quoteSearch + 1 + delimLen;\n\t\t\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\n\t\t\t\t\t\t\tnextNewline = input.indexOf(newline, cursor);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (input.substr(quoteSearch+1, newlineLen) === newline)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Closing quote followed by newline\n\t\t\t\t\t\t\trow.push(input.substring(cursor, quoteSearch).replace(/\"\"/g, '\"'));\n\t\t\t\t\t\t\tsaveRow(quoteSearch + 1 + newlineLen);\n\t\t\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\t// because we may have skipped the nextDelim in the quoted field\n\n\t\t\t\t\t\t\tif (stepIsFunction)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdoStep();\n\t\t\t\t\t\t\t\tif (aborted)\n\t\t\t\t\t\t\t\t\treturn returnable();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (preview && data.length >= preview)\n\t\t\t\t\t\t\t\treturn returnable(true);\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Comment found at start of new line\n\t\t\t\tif (comments && row.length === 0 && input.substr(cursor, commentsLen) === comments)\n\t\t\t\t{\n\t\t\t\t\tif (nextNewline == -1)\t// Comment ends at EOF\n\t\t\t\t\t\treturn returnable();\n\t\t\t\t\tcursor = nextNewline + newlineLen;\n\t\t\t\t\tnextNewline = input.indexOf(newline, cursor);\n\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Next delimiter comes before next newline, so we've reached end of field\n\t\t\t\tif (nextDelim !== -1 && (nextDelim < nextNewline || nextNewline === -1))\n\t\t\t\t{\n\t\t\t\t\trow.push(input.substring(cursor, nextDelim));\n\t\t\t\t\tcursor = nextDelim + delimLen;\n\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// End of row\n\t\t\t\tif (nextNewline !== -1)\n\t\t\t\t{\n\t\t\t\t\trow.push(input.substring(cursor, nextNewline));\n\t\t\t\t\tsaveRow(nextNewline + newlineLen);\n\n\t\t\t\t\tif (stepIsFunction)\n\t\t\t\t\t{\n\t\t\t\t\t\tdoStep();\n\t\t\t\t\t\tif (aborted)\n\t\t\t\t\t\t\treturn returnable();\n\t\t\t\t\t}\n\n\t\t\t\t\tif (preview && data.length >= preview)\n\t\t\t\t\t\treturn returnable(true);\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\n\t\t\treturn finish();\n\n\n\t\t\t// Appends the remaining input from cursor to the end into\n\t\t\t// row, saves the row, calls step, and returns the results.\n\t\t\tfunction finish()\n\t\t\t{\n\t\t\t\trow.push(input.substr(cursor));\n\t\t\t\tdata.push(row);\n\t\t\t\tcursor = inputLen;\t// important in case parsing is paused\n\t\t\t\tif (stepIsFunction)\n\t\t\t\t\tdoStep();\n\t\t\t\treturn returnable();\n\t\t\t}\n\n\t\t\t// Appends the current row to the results. It sets the cursor\n\t\t\t// to newCursor and finds the nextNewline. The caller should\n\t\t\t// take care to execute user's step function and check for\n\t\t\t// preview and end parsing if necessary.\n\t\t\tfunction saveRow(newCursor)\n\t\t\t{\n\t\t\t\tdata.push(row);\n\t\t\t\trow = [];\n\t\t\t\tcursor = newCursor;\n\t\t\t\tnextNewline = input.indexOf(newline, cursor);\n\t\t\t}\n\n\t\t\t// Returns an object with the results, errors, and meta.\n\t\t\tfunction returnable(stopped)\n\t\t\t{\n\t\t\t\treturn {\n\t\t\t\t\tdata: data,\n\t\t\t\t\terrors: errors,\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\tdelimiter: delim,\n\t\t\t\t\t\tlinebreak: newline,\n\t\t\t\t\t\taborted: aborted,\n\t\t\t\t\t\ttruncated: !!stopped\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Executes the user's step function and resets data & errors.\n\t\t\tfunction doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [], errors = [];\n\t\t\t}\n\t\t};\n\n\t\t// Sets the abort flag\n\t\tthis.abort = function()\n\t\t{\n\t\t\taborted = true;\n\t\t};\n\n\t\t// Gets the cursor position\n\t\tthis.getCharIndex = function()\n\t\t{\n\t\t\treturn cursor;\n\t\t};\n\t}", "title": "" }, { "docid": "08c48ebe58ecc94e37d4397223beda84", "score": "0.53106725", "text": "function Parser(config)\n\t{\n\t\t// Unpack the config object\n\t\tconfig = config || {};\n\t\tvar delim = config.delimiter;\n\t\tvar newline = config.newline;\n\t\tvar comments = config.comments;\n\t\tvar step = config.step;\n\t\tvar preview = config.preview;\n\t\tvar fastMode = config.fastMode;\n\n\t\t// Delimiter must be valid\n\t\tif (typeof delim !== 'string'\n\t\t\t|| delim.length != 1\n\t\t\t|| Baby.BAD_DELIMITERS.indexOf(delim) > -1)\n\t\t\tdelim = \",\";\n\n\t\t// Comment character must be valid\n\t\tif (comments === delim)\n\t\t\tthrow \"Comment character same as delimiter\";\n\t\telse if (comments === true)\n\t\t\tcomments = \"#\";\n\t\telse if (typeof comments !== 'string'\n\t\t\t|| Baby.BAD_DELIMITERS.indexOf(comments) > -1)\n\t\t\tcomments = false;\n\n\t\t// Newline must be valid: \\r, \\n, or \\r\\n\n\t\tif (newline != '\\n' && newline != '\\r' && newline != '\\r\\n')\n\t\t\tnewline = '\\n';\n\n\t\t// We're gonna need these at the Parser scope\n\t\tvar cursor = 0;\n\t\tvar aborted = false;\n\n\t\tthis.parse = function(input)\n\t\t{\n\t\t\t// For some reason, in Chrome, this speeds things up (!?)\n\t\t\tif (typeof input !== 'string')\n\t\t\t\tthrow \"Input must be a string\";\n\n\t\t\t// We don't need to compute some of these every time parse() is called,\n\t\t\t// but having them in a more local scope seems to perform better\n\t\t\tvar inputLen = input.length,\n\t\t\t\tdelimLen = delim.length,\n\t\t\t\tnewlineLen = newline.length,\n\t\t\t\tcommentsLen = comments.length;\n\t\t\tvar stepIsFunction = typeof step === 'function';\n\n\t\t\t// Establish starting state\n\t\t\tcursor = 0;\n\t\t\tvar data = [], errors = [], row = [];\n\n\t\t\tif (!input)\n\t\t\t\treturn returnable();\n\n\t\t\tif (fastMode)\n\t\t\t{\n\t\t\t\t// Fast mode assumes there are no quoted fields in the input\n\t\t\t\tvar rows = input.split(newline);\n\t\t\t\tfor (var i = 0; i < rows.length; i++)\n\t\t\t\t{\n\t\t\t\t\tif (comments && rows[i].substr(0, commentsLen) == comments)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tif (stepIsFunction)\n\t\t\t\t\t{\n\t\t\t\t\t\tdata = [ rows[i].split(delim) ];\n\t\t\t\t\t\tdoStep();\n\t\t\t\t\t\tif (aborted)\n\t\t\t\t\t\t\treturn returnable();\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tdata.push(rows[i].split(delim));\n\t\t\t\t\tif (preview && i >= preview)\n\t\t\t\t\t{\n\t\t\t\t\t\tdata = data.slice(0, preview);\n\t\t\t\t\t\treturn returnable(true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn returnable();\n\t\t\t}\n\n\t\t\tvar nextDelim = input.indexOf(delim, cursor);\n\t\t\tvar nextNewline = input.indexOf(newline, cursor);\n\n\t\t\t// Parser loop\n\t\t\tfor (;;)\n\t\t\t{\n\t\t\t\t// Field has opening quote\n\t\t\t\tif (input[cursor] == '\"')\n\t\t\t\t{\n\t\t\t\t\t// Start our search for the closing quote where the cursor is\n\t\t\t\t\tvar quoteSearch = cursor;\n\n\t\t\t\t\t// Skip the opening quote\n\t\t\t\t\tcursor++;\n\n\t\t\t\t\tfor (;;)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Find closing quote\n\t\t\t\t\t\tvar quoteSearch = input.indexOf('\"', quoteSearch+1);\n\n\t\t\t\t\t\tif (quoteSearch === -1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// No closing quote... what a pity\n\t\t\t\t\t\t\terrors.push({\n\t\t\t\t\t\t\t\ttype: \"Quotes\",\n\t\t\t\t\t\t\t\tcode: \"MissingQuotes\",\n\t\t\t\t\t\t\t\tmessage: \"Quoted field unterminated\",\n\t\t\t\t\t\t\t\trow: data.length,\t// row has yet to be inserted\n\t\t\t\t\t\t\t\tindex: cursor\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treturn finish();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (quoteSearch === inputLen-1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Closing quote at EOF\n\t\t\t\t\t\t\trow.push(input.substring(cursor, quoteSearch).replace(/\"\"/g, '\"'));\n\t\t\t\t\t\t\tdata.push(row);\n\t\t\t\t\t\t\tif (stepIsFunction)\n\t\t\t\t\t\t\t\tdoStep();\n\t\t\t\t\t\t\treturn returnable();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If this quote is escaped, it's part of the data; skip it\n\t\t\t\t\t\tif (input[quoteSearch+1] == '\"')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tquoteSearch++;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (input[quoteSearch+1] == delim)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Closing quote followed by delimiter\n\t\t\t\t\t\t\trow.push(input.substring(cursor, quoteSearch).replace(/\"\"/g, '\"'));\n\t\t\t\t\t\t\tcursor = quoteSearch + 1 + delimLen;\n\t\t\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\n\t\t\t\t\t\t\tnextNewline = input.indexOf(newline, cursor);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (input.substr(quoteSearch+1, newlineLen) === newline)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Closing quote followed by newline\n\t\t\t\t\t\t\trow.push(input.substring(cursor, quoteSearch).replace(/\"\"/g, '\"'));\n\t\t\t\t\t\t\tsaveRow(quoteSearch + 1 + newlineLen);\n\t\t\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\t// because we may have skipped the nextDelim in the quoted field\n\n\t\t\t\t\t\t\tif (stepIsFunction)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdoStep();\n\t\t\t\t\t\t\t\tif (aborted)\n\t\t\t\t\t\t\t\t\treturn returnable();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (preview && data.length >= preview)\n\t\t\t\t\t\t\t\treturn returnable(true);\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Comment found at start of new line\n\t\t\t\tif (comments && row.length === 0 && input.substr(cursor, commentsLen) === comments)\n\t\t\t\t{\n\t\t\t\t\tif (nextNewline == -1)\t// Comment ends at EOF\n\t\t\t\t\t\treturn returnable();\n\t\t\t\t\tcursor = nextNewline + newlineLen;\n\t\t\t\t\tnextNewline = input.indexOf(newline, cursor);\n\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Next delimiter comes before next newline, so we've reached end of field\n\t\t\t\tif (nextDelim !== -1 && (nextDelim < nextNewline || nextNewline === -1))\n\t\t\t\t{\n\t\t\t\t\trow.push(input.substring(cursor, nextDelim));\n\t\t\t\t\tcursor = nextDelim + delimLen;\n\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// End of row\n\t\t\t\tif (nextNewline !== -1)\n\t\t\t\t{\n\t\t\t\t\trow.push(input.substring(cursor, nextNewline));\n\t\t\t\t\tsaveRow(nextNewline + newlineLen);\n\n\t\t\t\t\tif (stepIsFunction)\n\t\t\t\t\t{\n\t\t\t\t\t\tdoStep();\n\t\t\t\t\t\tif (aborted)\n\t\t\t\t\t\t\treturn returnable();\n\t\t\t\t\t}\n\n\t\t\t\t\tif (preview && data.length >= preview)\n\t\t\t\t\t\treturn returnable(true);\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\n\t\t\treturn finish();\n\n\n\t\t\t// Appends the remaining input from cursor to the end into\n\t\t\t// row, saves the row, calls step, and returns the results.\n\t\t\tfunction finish()\n\t\t\t{\n\t\t\t\trow.push(input.substr(cursor));\n\t\t\t\tdata.push(row);\n\t\t\t\tcursor = inputLen;\t// important in case parsing is paused\n\t\t\t\tif (stepIsFunction)\n\t\t\t\t\tdoStep();\n\t\t\t\treturn returnable();\n\t\t\t}\n\n\t\t\t// Appends the current row to the results. It sets the cursor\n\t\t\t// to newCursor and finds the nextNewline. The caller should\n\t\t\t// take care to execute user's step function and check for\n\t\t\t// preview and end parsing if necessary.\n\t\t\tfunction saveRow(newCursor)\n\t\t\t{\n\t\t\t\tdata.push(row);\n\t\t\t\trow = [];\n\t\t\t\tcursor = newCursor;\n\t\t\t\tnextNewline = input.indexOf(newline, cursor);\n\t\t\t}\n\n\t\t\t// Returns an object with the results, errors, and meta.\n\t\t\tfunction returnable(stopped)\n\t\t\t{\n\t\t\t\treturn {\n\t\t\t\t\tdata: data,\n\t\t\t\t\terrors: errors,\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\tdelimiter: delim,\n\t\t\t\t\t\tlinebreak: newline,\n\t\t\t\t\t\taborted: aborted,\n\t\t\t\t\t\ttruncated: !!stopped\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Executes the user's step function and resets data & errors.\n\t\t\tfunction doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [], errors = [];\n\t\t\t}\n\t\t};\n\n\t\t// Sets the abort flag\n\t\tthis.abort = function()\n\t\t{\n\t\t\taborted = true;\n\t\t};\n\n\t\t// Gets the cursor position\n\t\tthis.getCharIndex = function()\n\t\t{\n\t\t\treturn cursor;\n\t\t};\n\t}", "title": "" }, { "docid": "08c48ebe58ecc94e37d4397223beda84", "score": "0.53106725", "text": "function Parser(config)\n\t{\n\t\t// Unpack the config object\n\t\tconfig = config || {};\n\t\tvar delim = config.delimiter;\n\t\tvar newline = config.newline;\n\t\tvar comments = config.comments;\n\t\tvar step = config.step;\n\t\tvar preview = config.preview;\n\t\tvar fastMode = config.fastMode;\n\n\t\t// Delimiter must be valid\n\t\tif (typeof delim !== 'string'\n\t\t\t|| delim.length != 1\n\t\t\t|| Baby.BAD_DELIMITERS.indexOf(delim) > -1)\n\t\t\tdelim = \",\";\n\n\t\t// Comment character must be valid\n\t\tif (comments === delim)\n\t\t\tthrow \"Comment character same as delimiter\";\n\t\telse if (comments === true)\n\t\t\tcomments = \"#\";\n\t\telse if (typeof comments !== 'string'\n\t\t\t|| Baby.BAD_DELIMITERS.indexOf(comments) > -1)\n\t\t\tcomments = false;\n\n\t\t// Newline must be valid: \\r, \\n, or \\r\\n\n\t\tif (newline != '\\n' && newline != '\\r' && newline != '\\r\\n')\n\t\t\tnewline = '\\n';\n\n\t\t// We're gonna need these at the Parser scope\n\t\tvar cursor = 0;\n\t\tvar aborted = false;\n\n\t\tthis.parse = function(input)\n\t\t{\n\t\t\t// For some reason, in Chrome, this speeds things up (!?)\n\t\t\tif (typeof input !== 'string')\n\t\t\t\tthrow \"Input must be a string\";\n\n\t\t\t// We don't need to compute some of these every time parse() is called,\n\t\t\t// but having them in a more local scope seems to perform better\n\t\t\tvar inputLen = input.length,\n\t\t\t\tdelimLen = delim.length,\n\t\t\t\tnewlineLen = newline.length,\n\t\t\t\tcommentsLen = comments.length;\n\t\t\tvar stepIsFunction = typeof step === 'function';\n\n\t\t\t// Establish starting state\n\t\t\tcursor = 0;\n\t\t\tvar data = [], errors = [], row = [];\n\n\t\t\tif (!input)\n\t\t\t\treturn returnable();\n\n\t\t\tif (fastMode)\n\t\t\t{\n\t\t\t\t// Fast mode assumes there are no quoted fields in the input\n\t\t\t\tvar rows = input.split(newline);\n\t\t\t\tfor (var i = 0; i < rows.length; i++)\n\t\t\t\t{\n\t\t\t\t\tif (comments && rows[i].substr(0, commentsLen) == comments)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tif (stepIsFunction)\n\t\t\t\t\t{\n\t\t\t\t\t\tdata = [ rows[i].split(delim) ];\n\t\t\t\t\t\tdoStep();\n\t\t\t\t\t\tif (aborted)\n\t\t\t\t\t\t\treturn returnable();\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tdata.push(rows[i].split(delim));\n\t\t\t\t\tif (preview && i >= preview)\n\t\t\t\t\t{\n\t\t\t\t\t\tdata = data.slice(0, preview);\n\t\t\t\t\t\treturn returnable(true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn returnable();\n\t\t\t}\n\n\t\t\tvar nextDelim = input.indexOf(delim, cursor);\n\t\t\tvar nextNewline = input.indexOf(newline, cursor);\n\n\t\t\t// Parser loop\n\t\t\tfor (;;)\n\t\t\t{\n\t\t\t\t// Field has opening quote\n\t\t\t\tif (input[cursor] == '\"')\n\t\t\t\t{\n\t\t\t\t\t// Start our search for the closing quote where the cursor is\n\t\t\t\t\tvar quoteSearch = cursor;\n\n\t\t\t\t\t// Skip the opening quote\n\t\t\t\t\tcursor++;\n\n\t\t\t\t\tfor (;;)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Find closing quote\n\t\t\t\t\t\tvar quoteSearch = input.indexOf('\"', quoteSearch+1);\n\n\t\t\t\t\t\tif (quoteSearch === -1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// No closing quote... what a pity\n\t\t\t\t\t\t\terrors.push({\n\t\t\t\t\t\t\t\ttype: \"Quotes\",\n\t\t\t\t\t\t\t\tcode: \"MissingQuotes\",\n\t\t\t\t\t\t\t\tmessage: \"Quoted field unterminated\",\n\t\t\t\t\t\t\t\trow: data.length,\t// row has yet to be inserted\n\t\t\t\t\t\t\t\tindex: cursor\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treturn finish();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (quoteSearch === inputLen-1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Closing quote at EOF\n\t\t\t\t\t\t\trow.push(input.substring(cursor, quoteSearch).replace(/\"\"/g, '\"'));\n\t\t\t\t\t\t\tdata.push(row);\n\t\t\t\t\t\t\tif (stepIsFunction)\n\t\t\t\t\t\t\t\tdoStep();\n\t\t\t\t\t\t\treturn returnable();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If this quote is escaped, it's part of the data; skip it\n\t\t\t\t\t\tif (input[quoteSearch+1] == '\"')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tquoteSearch++;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (input[quoteSearch+1] == delim)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Closing quote followed by delimiter\n\t\t\t\t\t\t\trow.push(input.substring(cursor, quoteSearch).replace(/\"\"/g, '\"'));\n\t\t\t\t\t\t\tcursor = quoteSearch + 1 + delimLen;\n\t\t\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\n\t\t\t\t\t\t\tnextNewline = input.indexOf(newline, cursor);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (input.substr(quoteSearch+1, newlineLen) === newline)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Closing quote followed by newline\n\t\t\t\t\t\t\trow.push(input.substring(cursor, quoteSearch).replace(/\"\"/g, '\"'));\n\t\t\t\t\t\t\tsaveRow(quoteSearch + 1 + newlineLen);\n\t\t\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\t// because we may have skipped the nextDelim in the quoted field\n\n\t\t\t\t\t\t\tif (stepIsFunction)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdoStep();\n\t\t\t\t\t\t\t\tif (aborted)\n\t\t\t\t\t\t\t\t\treturn returnable();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (preview && data.length >= preview)\n\t\t\t\t\t\t\t\treturn returnable(true);\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Comment found at start of new line\n\t\t\t\tif (comments && row.length === 0 && input.substr(cursor, commentsLen) === comments)\n\t\t\t\t{\n\t\t\t\t\tif (nextNewline == -1)\t// Comment ends at EOF\n\t\t\t\t\t\treturn returnable();\n\t\t\t\t\tcursor = nextNewline + newlineLen;\n\t\t\t\t\tnextNewline = input.indexOf(newline, cursor);\n\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Next delimiter comes before next newline, so we've reached end of field\n\t\t\t\tif (nextDelim !== -1 && (nextDelim < nextNewline || nextNewline === -1))\n\t\t\t\t{\n\t\t\t\t\trow.push(input.substring(cursor, nextDelim));\n\t\t\t\t\tcursor = nextDelim + delimLen;\n\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// End of row\n\t\t\t\tif (nextNewline !== -1)\n\t\t\t\t{\n\t\t\t\t\trow.push(input.substring(cursor, nextNewline));\n\t\t\t\t\tsaveRow(nextNewline + newlineLen);\n\n\t\t\t\t\tif (stepIsFunction)\n\t\t\t\t\t{\n\t\t\t\t\t\tdoStep();\n\t\t\t\t\t\tif (aborted)\n\t\t\t\t\t\t\treturn returnable();\n\t\t\t\t\t}\n\n\t\t\t\t\tif (preview && data.length >= preview)\n\t\t\t\t\t\treturn returnable(true);\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\n\t\t\treturn finish();\n\n\n\t\t\t// Appends the remaining input from cursor to the end into\n\t\t\t// row, saves the row, calls step, and returns the results.\n\t\t\tfunction finish()\n\t\t\t{\n\t\t\t\trow.push(input.substr(cursor));\n\t\t\t\tdata.push(row);\n\t\t\t\tcursor = inputLen;\t// important in case parsing is paused\n\t\t\t\tif (stepIsFunction)\n\t\t\t\t\tdoStep();\n\t\t\t\treturn returnable();\n\t\t\t}\n\n\t\t\t// Appends the current row to the results. It sets the cursor\n\t\t\t// to newCursor and finds the nextNewline. The caller should\n\t\t\t// take care to execute user's step function and check for\n\t\t\t// preview and end parsing if necessary.\n\t\t\tfunction saveRow(newCursor)\n\t\t\t{\n\t\t\t\tdata.push(row);\n\t\t\t\trow = [];\n\t\t\t\tcursor = newCursor;\n\t\t\t\tnextNewline = input.indexOf(newline, cursor);\n\t\t\t}\n\n\t\t\t// Returns an object with the results, errors, and meta.\n\t\t\tfunction returnable(stopped)\n\t\t\t{\n\t\t\t\treturn {\n\t\t\t\t\tdata: data,\n\t\t\t\t\terrors: errors,\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\tdelimiter: delim,\n\t\t\t\t\t\tlinebreak: newline,\n\t\t\t\t\t\taborted: aborted,\n\t\t\t\t\t\ttruncated: !!stopped\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Executes the user's step function and resets data & errors.\n\t\t\tfunction doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [], errors = [];\n\t\t\t}\n\t\t};\n\n\t\t// Sets the abort flag\n\t\tthis.abort = function()\n\t\t{\n\t\t\taborted = true;\n\t\t};\n\n\t\t// Gets the cursor position\n\t\tthis.getCharIndex = function()\n\t\t{\n\t\t\treturn cursor;\n\t\t};\n\t}", "title": "" }, { "docid": "08c48ebe58ecc94e37d4397223beda84", "score": "0.53106725", "text": "function Parser(config)\n\t{\n\t\t// Unpack the config object\n\t\tconfig = config || {};\n\t\tvar delim = config.delimiter;\n\t\tvar newline = config.newline;\n\t\tvar comments = config.comments;\n\t\tvar step = config.step;\n\t\tvar preview = config.preview;\n\t\tvar fastMode = config.fastMode;\n\n\t\t// Delimiter must be valid\n\t\tif (typeof delim !== 'string'\n\t\t\t|| delim.length != 1\n\t\t\t|| Baby.BAD_DELIMITERS.indexOf(delim) > -1)\n\t\t\tdelim = \",\";\n\n\t\t// Comment character must be valid\n\t\tif (comments === delim)\n\t\t\tthrow \"Comment character same as delimiter\";\n\t\telse if (comments === true)\n\t\t\tcomments = \"#\";\n\t\telse if (typeof comments !== 'string'\n\t\t\t|| Baby.BAD_DELIMITERS.indexOf(comments) > -1)\n\t\t\tcomments = false;\n\n\t\t// Newline must be valid: \\r, \\n, or \\r\\n\n\t\tif (newline != '\\n' && newline != '\\r' && newline != '\\r\\n')\n\t\t\tnewline = '\\n';\n\n\t\t// We're gonna need these at the Parser scope\n\t\tvar cursor = 0;\n\t\tvar aborted = false;\n\n\t\tthis.parse = function(input)\n\t\t{\n\t\t\t// For some reason, in Chrome, this speeds things up (!?)\n\t\t\tif (typeof input !== 'string')\n\t\t\t\tthrow \"Input must be a string\";\n\n\t\t\t// We don't need to compute some of these every time parse() is called,\n\t\t\t// but having them in a more local scope seems to perform better\n\t\t\tvar inputLen = input.length,\n\t\t\t\tdelimLen = delim.length,\n\t\t\t\tnewlineLen = newline.length,\n\t\t\t\tcommentsLen = comments.length;\n\t\t\tvar stepIsFunction = typeof step === 'function';\n\n\t\t\t// Establish starting state\n\t\t\tcursor = 0;\n\t\t\tvar data = [], errors = [], row = [];\n\n\t\t\tif (!input)\n\t\t\t\treturn returnable();\n\n\t\t\tif (fastMode)\n\t\t\t{\n\t\t\t\t// Fast mode assumes there are no quoted fields in the input\n\t\t\t\tvar rows = input.split(newline);\n\t\t\t\tfor (var i = 0; i < rows.length; i++)\n\t\t\t\t{\n\t\t\t\t\tif (comments && rows[i].substr(0, commentsLen) == comments)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tif (stepIsFunction)\n\t\t\t\t\t{\n\t\t\t\t\t\tdata = [ rows[i].split(delim) ];\n\t\t\t\t\t\tdoStep();\n\t\t\t\t\t\tif (aborted)\n\t\t\t\t\t\t\treturn returnable();\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tdata.push(rows[i].split(delim));\n\t\t\t\t\tif (preview && i >= preview)\n\t\t\t\t\t{\n\t\t\t\t\t\tdata = data.slice(0, preview);\n\t\t\t\t\t\treturn returnable(true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn returnable();\n\t\t\t}\n\n\t\t\tvar nextDelim = input.indexOf(delim, cursor);\n\t\t\tvar nextNewline = input.indexOf(newline, cursor);\n\n\t\t\t// Parser loop\n\t\t\tfor (;;)\n\t\t\t{\n\t\t\t\t// Field has opening quote\n\t\t\t\tif (input[cursor] == '\"')\n\t\t\t\t{\n\t\t\t\t\t// Start our search for the closing quote where the cursor is\n\t\t\t\t\tvar quoteSearch = cursor;\n\n\t\t\t\t\t// Skip the opening quote\n\t\t\t\t\tcursor++;\n\n\t\t\t\t\tfor (;;)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Find closing quote\n\t\t\t\t\t\tvar quoteSearch = input.indexOf('\"', quoteSearch+1);\n\n\t\t\t\t\t\tif (quoteSearch === -1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// No closing quote... what a pity\n\t\t\t\t\t\t\terrors.push({\n\t\t\t\t\t\t\t\ttype: \"Quotes\",\n\t\t\t\t\t\t\t\tcode: \"MissingQuotes\",\n\t\t\t\t\t\t\t\tmessage: \"Quoted field unterminated\",\n\t\t\t\t\t\t\t\trow: data.length,\t// row has yet to be inserted\n\t\t\t\t\t\t\t\tindex: cursor\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treturn finish();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (quoteSearch === inputLen-1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Closing quote at EOF\n\t\t\t\t\t\t\trow.push(input.substring(cursor, quoteSearch).replace(/\"\"/g, '\"'));\n\t\t\t\t\t\t\tdata.push(row);\n\t\t\t\t\t\t\tif (stepIsFunction)\n\t\t\t\t\t\t\t\tdoStep();\n\t\t\t\t\t\t\treturn returnable();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If this quote is escaped, it's part of the data; skip it\n\t\t\t\t\t\tif (input[quoteSearch+1] == '\"')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tquoteSearch++;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (input[quoteSearch+1] == delim)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Closing quote followed by delimiter\n\t\t\t\t\t\t\trow.push(input.substring(cursor, quoteSearch).replace(/\"\"/g, '\"'));\n\t\t\t\t\t\t\tcursor = quoteSearch + 1 + delimLen;\n\t\t\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\n\t\t\t\t\t\t\tnextNewline = input.indexOf(newline, cursor);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (input.substr(quoteSearch+1, newlineLen) === newline)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Closing quote followed by newline\n\t\t\t\t\t\t\trow.push(input.substring(cursor, quoteSearch).replace(/\"\"/g, '\"'));\n\t\t\t\t\t\t\tsaveRow(quoteSearch + 1 + newlineLen);\n\t\t\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\t// because we may have skipped the nextDelim in the quoted field\n\n\t\t\t\t\t\t\tif (stepIsFunction)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdoStep();\n\t\t\t\t\t\t\t\tif (aborted)\n\t\t\t\t\t\t\t\t\treturn returnable();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (preview && data.length >= preview)\n\t\t\t\t\t\t\t\treturn returnable(true);\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Comment found at start of new line\n\t\t\t\tif (comments && row.length === 0 && input.substr(cursor, commentsLen) === comments)\n\t\t\t\t{\n\t\t\t\t\tif (nextNewline == -1)\t// Comment ends at EOF\n\t\t\t\t\t\treturn returnable();\n\t\t\t\t\tcursor = nextNewline + newlineLen;\n\t\t\t\t\tnextNewline = input.indexOf(newline, cursor);\n\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Next delimiter comes before next newline, so we've reached end of field\n\t\t\t\tif (nextDelim !== -1 && (nextDelim < nextNewline || nextNewline === -1))\n\t\t\t\t{\n\t\t\t\t\trow.push(input.substring(cursor, nextDelim));\n\t\t\t\t\tcursor = nextDelim + delimLen;\n\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// End of row\n\t\t\t\tif (nextNewline !== -1)\n\t\t\t\t{\n\t\t\t\t\trow.push(input.substring(cursor, nextNewline));\n\t\t\t\t\tsaveRow(nextNewline + newlineLen);\n\n\t\t\t\t\tif (stepIsFunction)\n\t\t\t\t\t{\n\t\t\t\t\t\tdoStep();\n\t\t\t\t\t\tif (aborted)\n\t\t\t\t\t\t\treturn returnable();\n\t\t\t\t\t}\n\n\t\t\t\t\tif (preview && data.length >= preview)\n\t\t\t\t\t\treturn returnable(true);\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\n\t\t\treturn finish();\n\n\n\t\t\t// Appends the remaining input from cursor to the end into\n\t\t\t// row, saves the row, calls step, and returns the results.\n\t\t\tfunction finish()\n\t\t\t{\n\t\t\t\trow.push(input.substr(cursor));\n\t\t\t\tdata.push(row);\n\t\t\t\tcursor = inputLen;\t// important in case parsing is paused\n\t\t\t\tif (stepIsFunction)\n\t\t\t\t\tdoStep();\n\t\t\t\treturn returnable();\n\t\t\t}\n\n\t\t\t// Appends the current row to the results. It sets the cursor\n\t\t\t// to newCursor and finds the nextNewline. The caller should\n\t\t\t// take care to execute user's step function and check for\n\t\t\t// preview and end parsing if necessary.\n\t\t\tfunction saveRow(newCursor)\n\t\t\t{\n\t\t\t\tdata.push(row);\n\t\t\t\trow = [];\n\t\t\t\tcursor = newCursor;\n\t\t\t\tnextNewline = input.indexOf(newline, cursor);\n\t\t\t}\n\n\t\t\t// Returns an object with the results, errors, and meta.\n\t\t\tfunction returnable(stopped)\n\t\t\t{\n\t\t\t\treturn {\n\t\t\t\t\tdata: data,\n\t\t\t\t\terrors: errors,\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\tdelimiter: delim,\n\t\t\t\t\t\tlinebreak: newline,\n\t\t\t\t\t\taborted: aborted,\n\t\t\t\t\t\ttruncated: !!stopped\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Executes the user's step function and resets data & errors.\n\t\t\tfunction doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [], errors = [];\n\t\t\t}\n\t\t};\n\n\t\t// Sets the abort flag\n\t\tthis.abort = function()\n\t\t{\n\t\t\taborted = true;\n\t\t};\n\n\t\t// Gets the cursor position\n\t\tthis.getCharIndex = function()\n\t\t{\n\t\t\treturn cursor;\n\t\t};\n\t}", "title": "" }, { "docid": "378a80dabc1920dbf9b3429ac7295ece", "score": "0.5300714", "text": "function parse(expr) {\n const scanner = typeof expr === 'string' ? new _emmetio_scanner__WEBPACK_IMPORTED_MODULE_0__[\"default\"](expr) : expr;\n let ch;\n let priority = 0;\n let expected = (1 /* Primary */ | 4 /* LParen */ | 16 /* Sign */);\n const tokens = [];\n while (!scanner.eof()) {\n scanner.eatWhile(_emmetio_scanner__WEBPACK_IMPORTED_MODULE_0__[\"isWhiteSpace\"]);\n scanner.start = scanner.pos;\n if (consumeNumber(scanner)) {\n if ((expected & 1 /* Primary */) === 0) {\n error('Unexpected number', scanner);\n }\n tokens.push(number(scanner.current()));\n expected = (2 /* Operator */ | 8 /* RParen */);\n }\n else if (isOperator(scanner.peek())) {\n ch = scanner.next();\n if (isSign(ch) && (expected & 16 /* Sign */)) {\n if (isNegativeSign(ch)) {\n tokens.push(op1(ch, priority));\n }\n expected = (1 /* Primary */ | 4 /* LParen */ | 16 /* Sign */);\n }\n else {\n if ((expected & 2 /* Operator */) === 0) {\n error('Unexpected operator', scanner);\n }\n tokens.push(op2(ch, priority));\n expected = (1 /* Primary */ | 4 /* LParen */ | 16 /* Sign */);\n }\n }\n else if (scanner.eat(40 /* LeftParenthesis */)) {\n if ((expected & 4 /* LParen */) === 0) {\n error('Unexpected \"(\"', scanner);\n }\n priority += 10;\n expected = (1 /* Primary */ | 4 /* LParen */ | 16 /* Sign */ | 32 /* NullaryCall */);\n }\n else if (scanner.eat(41 /* RightParenthesis */)) {\n priority -= 10;\n if (expected & 32 /* NullaryCall */) {\n tokens.push(nullary);\n }\n else if ((expected & 8 /* RParen */) === 0) {\n error('Unexpected \")\"', scanner);\n }\n expected = (2 /* Operator */ | 8 /* RParen */ | 4 /* LParen */);\n }\n else {\n error('Unknown character', scanner);\n }\n }\n if (priority < 0 || priority >= 10) {\n error('Unmatched \"()\"', scanner);\n }\n const result = orderTokens(tokens);\n if (result === null) {\n error('Parity', scanner);\n }\n return result;\n}", "title": "" }, { "docid": "36593f849110ff48874530b40c15b337", "score": "0.5291365", "text": "function createParser(parser, base) {\n var nparser = base;\n\n nparser.glossary = Promise.wrapfn(parser.glossary);\n nparser.glossary.toText = Promise.wrapfn(parser.glossary.toText);\n\n nparser.summary = Promise.wrapfn(parser.summary);\n nparser.summary.toText = Promise.wrapfn(parser.summary.toText);\n\n nparser.langs = Promise.wrapfn(parser.langs);\n nparser.langs.toText = Promise.wrapfn(parser.langs.toText);\n\n nparser.readme = Promise.wrapfn(parser.readme);\n\n nparser.page = Promise.wrapfn(parser.page);\n nparser.page.prepare = Promise.wrapfn(parser.page.prepare || _.identity);\n\n nparser.inline = Promise.wrapfn(parser.inline);\n\n return nparser;\n}", "title": "" }, { "docid": "181fb5b2e49edcc9879d3625c55934f7", "score": "0.5282716", "text": "parseStmt() {\n\n if(this.lookahead.type === 'id' || this.lookahead.type === 'number') {\n return this.parseExpr()\n } \n\n // if(this.lookahead.type === 'number') { // 表达式\n // return this.parseExpr()\n // }\n\n switch(this.lookahead.value) {\n case 'auto' :\n return this.parseDeclareStmt()\n case 'function':\n return this.parseFunctionStmt()\n case 'if':\n return this.parseIfStmt()\n case 'return':\n return this.parseReturnStmt()\n default :\n console.log(this.lookahead)\n throw `syntax error @line ${this.lookahead.lineno} : not impl. ${this.lookahead.value}`\n }\n\n }", "title": "" }, { "docid": "3932381a69a9d293b9f52f95904a08db", "score": "0.5278697", "text": "function compile( markup ) {\n\tvar loc = 0,\n\t\tinBlock = TRUE,\n\t\tstack = [],\n\t\ttop = [],\n\t\tcontent = top,\n\t\tcurrent = [,,top];\n\n\tfunction pushPreceedingContent( shift ) {\n\t\tshift -= loc;\n\t\tif ( shift ) {\n\t\t\tvar text = markup.substr( loc, shift ).replace(/\\n/g,\"\\\\n\");\n\t\t\tif ( inBlock ) {\n\t\t\t\tcontent.push( text );\n\t\t\t} else {\n\t\t\t\tif ( !text.split('\"').length%2 ) {\n\t\t\t\t\t// This is a {{ or }} within a string parameter, so skip parsing. (Leave in string)\n\t\t\t\t\treturn TRUE;\n\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t//( path\tor \t\\\"string\\\" )\t or ( path = ( path or \\\"string\\\" )\n\t\t\t\t(text + \" \").replace( /([\\w\\$\\.\\[\\]]+|(\\\\?['\"])(.*?)\\2)(?=\\s)|([\\w\\$\\.\\[\\]]+)\\=([\\w\\$\\.\\[\\]]+|\\\\(['\"]).*?\\\\\\6)(?=\\s)/g,\n\t\t\t\t\tfunction( all, path, quot, string, lhs, rhs, quot2 ) {\n\t\t\t\t\t\tcontent.push( path ? path : [ lhs, rhs ] ); // lhs and rhs are for named params\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Build abstract syntax tree: [ tag, params, encoding ]\n\tmarkup = markup\n\t\t.replace( /\\\\'|'/g, \"\\\\\\'\" ).replace( /\\\\\"|\"/g, \"\\\\\\\"\" ) //escape ', and \"\n\t\t.split( /\\s+/g ).join( \" \" ) // collapse white-space\n\t\t.replace( /^\\s+/, \"\" ) // trim left\n\t\t.replace( /\\s+$/, \"\" ); // trim right;\n\n\t//\t\t\t\t\t {{\t\t #\t\ttag\t\t\t\t\t\t\tsingleCharTag\t\t\t\t\t\t\tcode\t\t\t\t\t\t !encoding endTag\t\t{{/closeBlock}}\n\tmarkup.replace( /(?:\\{\\{(?:(\\#)?([\\w\\$\\.\\[\\]]+(?=[\\s\\}!]))|([^\\/\\*\\>$\\w\\s\\d\\x7f\\x00-\\x1f](?=[\\s\\w\\$\\[]))|\\*((?:[^\\}]|\\}(?!\\}))+)\\}\\}))|(!(\\w*))?(\\}\\})|(?:\\{\\{\\/([\\w\\$\\.\\[\\]]+)\\}\\})/g,\n\t\tfunction( all, isBlock, tagName, singleCharTag, code, useEncode, encoding, endTag, closeBlock, index ) {\n\t\t\ttagName = tagName || singleCharTag;\n\t\t\tif ( inBlock && endTag || pushPreceedingContent( index )) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( code ) {\n\t\t\t\tif ( viewsNs.allowCode ) {\n\t\t\t\t\tcontent.push([ \"*\", code.replace( /\\\\(['\"])/g, \"$1\" )]); // unescape ', and \"\n\t\t\t\t}\n\t\t\t} else if ( tagName ) {\n\t\t\t\tif ( tagName === \"else\" ) {\n\t\t\t\t\tcurrent = stack.pop();\n\t\t\t\t\tcontent = current[ 2 ];\n\t\t\t\t\tisBlock = TRUE;\n\t\t\t\t}\n\t\t\t\tstack.push( current );\n\t\t\t\tcontent.push( current = [ tagName, [], isBlock && 1] );\n\t\t\t} else if ( endTag ) {\n\t\t\t\tcurrent[ 3 ] = useEncode ? encoding || \"none\" : \"\";\n\t\t\t\tif ( current[ 2 ] ) {\n\t\t\t\t\tcurrent[ 2 ] = [];\n\t\t\t\t} else {\n\t\t\t\t\tcurrent = stack.pop();\n\t\t\t\t}\n\t\t\t} else if ( closeBlock ) {\n\t\t\t\tcurrent = stack.pop();\n\t\t\t}\n\t\t\tloc = index + all.length; // location marker - parsed up to here\n\t\t\tinBlock = !tagName && current[ 2 ] && current[ 2 ] !== 1;\n\t\t\tcontent = current[ inBlock ? 2 : 1 ];\n\t\t});\n\n\tpushPreceedingContent( markup.length );\n\n\treturn buildTmplFunction( top );\n}", "title": "" }, { "docid": "02fe154df8571f7ddb168a5710b8c5ea", "score": "0.52621716", "text": "parse() {\n while (this.shouldContinue()) {\n const c = this.buffer.charCodeAt(this.index - this.offset);\n switch (this.state) {\n case State.Text: {\n this.stateText(c);\n break;\n }\n case State.SpecialStartSequence: {\n this.stateSpecialStartSequence(c);\n break;\n }\n case State.InSpecialTag: {\n this.stateInSpecialTag(c);\n break;\n }\n case State.CDATASequence: {\n this.stateCDATASequence(c);\n break;\n }\n case State.InAttributeValueDq: {\n this.stateInAttributeValueDoubleQuotes(c);\n break;\n }\n case State.InAttributeName: {\n this.stateInAttributeName(c);\n break;\n }\n case State.InCommentLike: {\n this.stateInCommentLike(c);\n break;\n }\n case State.InSpecialComment: {\n this.stateInSpecialComment(c);\n break;\n }\n case State.BeforeAttributeName: {\n this.stateBeforeAttributeName(c);\n break;\n }\n case State.InTagName: {\n this.stateInTagName(c);\n break;\n }\n case State.InClosingTagName: {\n this.stateInClosingTagName(c);\n break;\n }\n case State.BeforeTagName: {\n this.stateBeforeTagName(c);\n break;\n }\n case State.AfterAttributeName: {\n this.stateAfterAttributeName(c);\n break;\n }\n case State.InAttributeValueSq: {\n this.stateInAttributeValueSingleQuotes(c);\n break;\n }\n case State.BeforeAttributeValue: {\n this.stateBeforeAttributeValue(c);\n break;\n }\n case State.BeforeClosingTagName: {\n this.stateBeforeClosingTagName(c);\n break;\n }\n case State.AfterClosingTagName: {\n this.stateAfterClosingTagName(c);\n break;\n }\n case State.BeforeSpecialS: {\n this.stateBeforeSpecialS(c);\n break;\n }\n case State.InAttributeValueNq: {\n this.stateInAttributeValueNoQuotes(c);\n break;\n }\n case State.InSelfClosingTag: {\n this.stateInSelfClosingTag(c);\n break;\n }\n case State.InDeclaration: {\n this.stateInDeclaration(c);\n break;\n }\n case State.BeforeDeclaration: {\n this.stateBeforeDeclaration(c);\n break;\n }\n case State.BeforeComment: {\n this.stateBeforeComment(c);\n break;\n }\n case State.InProcessingInstruction: {\n this.stateInProcessingInstruction(c);\n break;\n }\n case State.InNamedEntity: {\n this.stateInNamedEntity(c);\n break;\n }\n case State.BeforeEntity: {\n this.stateBeforeEntity(c);\n break;\n }\n case State.InHexEntity: {\n this.stateInHexEntity(c);\n break;\n }\n case State.InNumericEntity: {\n this.stateInNumericEntity(c);\n break;\n }\n default: {\n // `this._state === State.BeforeNumericEntity`\n this.stateBeforeNumericEntity(c);\n }\n }\n this.index++;\n }\n this.cleanup();\n }", "title": "" }, { "docid": "754217abb68d85d819b53af95d9b6674", "score": "0.5249382", "text": "visitParse(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "title": "" }, { "docid": "e30a6a64b68b4ab9cc4e795ca8f9629d", "score": "0.52358294", "text": "static _parserByName(type_name)\n\t\t{\n\t\t\tvar method='parse'+type_name;\n\t\t\tif (!this[method]) return undefined;\n\t\t\treturn this[method].bind(this); // Parsed usually don't requre a context, but it should be a reliable feathre nonetheless.\n\t\t}", "title": "" }, { "docid": "486cc673aace140c79a9711e70f781f4", "score": "0.52335393", "text": "function tokenize(code) {\n const validTokens = {\n COLON: \":\",\n HYPHEN: \"-\",\n GT: \">\",\n STRING: /[a-z]/i,\n DESTROY: \"*\"\n };\n\n const lines = code.split(\"\\n\");\n let tokens = [];\n\n console.log(\"====INPUT CODE====\");\n console.log(\"\");\n lines.forEach((readLine, index) => {\n const linum = index + 1;\n let line = readLine.trim();\n console.log(line);\n let isEdge = false; // it's a node till we encounter \":\"\n let lineCurr = 0;\n let char = line[lineCurr];\n\n while (lineCurr < line.length) {\n if (validTokens.STRING.test(char)) {\n let str = \"\";\n while (validTokens.STRING.test(char)) {\n str += char;\n lineCurr += 1;\n if (lineCurr === line.length) break;\n char = line[lineCurr];\n }\n\n tokens.push({\n type: isEdge ? \"edge\" : \"node\", // either node or edge\n value: str\n });\n continue;\n }\n\n if (char === validTokens.HYPHEN) {\n lineCurr += 1;\n char = line[lineCurr];\n if (char === validTokens.GT) {\n tokens.push({\n type: \"arrow\",\n value: \"->\"\n });\n lineCurr += 1;\n char = line[lineCurr];\n continue;\n } else {\n const errorMessage = !char\n ? `Unexpected end of line ${linum} : ${line}`\n : `Unexpected token ${\n line[lineCurr - 1]\n }${char} at line ${linum} : ${line}`;\n // throw error, invalid syntax\n throw new SyntaxError(errorMessage);\n }\n }\n\n if (char === validTokens.COLON) {\n isEdge = true;\n tokens.push({\n type: \"colon\",\n value: \":\"\n });\n\n lineCurr += 1;\n char = line[lineCurr];\n continue;\n }\n\n if (char === validTokens.DESTROY) {\n tokens.push({\n type: \"destroy\",\n value: \"*\"\n });\n\n lineCurr += 1;\n char = line[lineCurr];\n continue;\n }\n\n throw new SyntaxError(\n `Unexpected token: ${char} at line ${linum}: ${line}`\n );\n }\n });\n\n // console.log(\"\");\n // console.log(\"\");\n // console.log(\"Tokenizer\");\n // console.log(tokens);\n return tokens;\n}", "title": "" }, { "docid": "251bec9f4e6c78a3baf8fe2a3c6f99cd", "score": "0.5220761", "text": "function parse(str) {\n if (!str) {\n str = '()';\n }\n else if (str[0] === '?' || str[0] == '#') {\n // remove ?/# prefix if value comes directly from location.search or location.hash\n str = str.slice(1);\n }\n if (str[0] != '@' && str[0] != '(') {\n // assume parsing object by default\n str = `(${str})`;\n }\n return _parseValue(_lex(str));\n}", "title": "" }, { "docid": "980bfaaf5497862024a04097f2045ea3", "score": "0.5216669", "text": "parse(fn, result) {\n YngwieNode.parse(this, (node) => {\n result = fn(node, result);\n });\n return result;\n }", "title": "" }, { "docid": "369d948442c4d9f141a352241b0cbd7c", "score": "0.5199173", "text": "parseStatement_parseExpression() {\n return this.parseExpression();\n }", "title": "" }, { "docid": "d6c8bc3f6064cae8888ace4f9234e33f", "score": "0.5196882", "text": "parse() {\n\t\t\twhile (this.shouldContinue()) {\n\t\t\t\tconst c = this.buffer.charCodeAt(this.index - this.offset);\n\t\t\t\tif (this.state === State$2.Text) {\n\t\t\t\t\tthis.stateText(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.SpecialStartSequence) {\n\t\t\t\t\tthis.stateSpecialStartSequence(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.InSpecialTag) {\n\t\t\t\t\tthis.stateInSpecialTag(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.CDATASequence) {\n\t\t\t\t\tthis.stateCDATASequence(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.InAttributeValueDq) {\n\t\t\t\t\tthis.stateInAttributeValueDoubleQuotes(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.InAttributeName) {\n\t\t\t\t\tthis.stateInAttributeName(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.InCommentLike) {\n\t\t\t\t\tthis.stateInCommentLike(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.InSpecialComment) {\n\t\t\t\t\tthis.stateInSpecialComment(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.BeforeAttributeName) {\n\t\t\t\t\tthis.stateBeforeAttributeName(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.InTagName) {\n\t\t\t\t\tthis.stateInTagName(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.InClosingTagName) {\n\t\t\t\t\tthis.stateInClosingTagName(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.BeforeTagName) {\n\t\t\t\t\tthis.stateBeforeTagName(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.AfterAttributeName) {\n\t\t\t\t\tthis.stateAfterAttributeName(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.InAttributeValueSq) {\n\t\t\t\t\tthis.stateInAttributeValueSingleQuotes(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.BeforeAttributeValue) {\n\t\t\t\t\tthis.stateBeforeAttributeValue(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.BeforeClosingTagName) {\n\t\t\t\t\tthis.stateBeforeClosingTagName(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.AfterClosingTagName) {\n\t\t\t\t\tthis.stateAfterClosingTagName(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.BeforeSpecialS) {\n\t\t\t\t\tthis.stateBeforeSpecialS(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.InAttributeValueNq) {\n\t\t\t\t\tthis.stateInAttributeValueNoQuotes(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.InSelfClosingTag) {\n\t\t\t\t\tthis.stateInSelfClosingTag(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.InDeclaration) {\n\t\t\t\t\tthis.stateInDeclaration(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.BeforeDeclaration) {\n\t\t\t\t\tthis.stateBeforeDeclaration(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.BeforeComment) {\n\t\t\t\t\tthis.stateBeforeComment(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.InProcessingInstruction) {\n\t\t\t\t\tthis.stateInProcessingInstruction(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.InNamedEntity) {\n\t\t\t\t\tthis.stateInNamedEntity(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.BeforeEntity) {\n\t\t\t\t\tthis.stateBeforeEntity(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.InHexEntity) {\n\t\t\t\t\tthis.stateInHexEntity(c);\n\t\t\t\t}\n\t\t\t\telse if (this.state === State$2.InNumericEntity) {\n\t\t\t\t\tthis.stateInNumericEntity(c);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t// `this._state === State.BeforeNumericEntity`\n\t\t\t\t\tthis.stateBeforeNumericEntity(c);\n\t\t\t\t}\n\t\t\t\tthis.index++;\n\t\t\t}\n\t\t\tthis.cleanup();\n\t\t}", "title": "" }, { "docid": "79b67b0699efa5a736b20447d70353e9", "score": "0.51956916", "text": "function parse(input) {\n var state = parseBatch(input, 0);\n return state.node;\n}", "title": "" }, { "docid": "30e939bb2585411d00684db045125fef", "score": "0.5194371", "text": "function Parser(config)\n\t{\n\t\t// Unpack the config object\n\t\tconfig = config || {};\n\t\tvar delim = config.delimiter;\n\t\tvar newline = config.newline;\n\t\tvar comments = config.comments;\n\t\tvar step = config.step;\n\t\tvar preview = config.preview;\n\t\tvar fastMode = config.fastMode;\n\t\tvar quoteChar;\n\t\t/** Allows for no quoteChar by setting quoteChar to undefined in config */\n\t\tif (config.quoteChar === undefined) {\n\t\t\tquoteChar = '\"';\n\t\t} else {\n\t\t\tquoteChar = config.quoteChar;\n\t\t}\n\t\tvar escapeChar = quoteChar;\n\t\tif (config.escapeChar !== undefined) {\n\t\t\tescapeChar = config.escapeChar;\n\t\t}\n\n\t\t// Delimiter must be valid\n\t\tif (typeof delim !== 'string'\n\t\t\t|| Papa.BAD_DELIMITERS.indexOf(delim) > -1)\n\t\t\tdelim = ',';\n\n\t\t// Comment character must be valid\n\t\tif (comments === delim)\n\t\t\tthrow new Error('Comment character same as delimiter');\n\t\telse if (comments === true)\n\t\t\tcomments = '#';\n\t\telse if (typeof comments !== 'string'\n\t\t\t|| Papa.BAD_DELIMITERS.indexOf(comments) > -1)\n\t\t\tcomments = false;\n\n\t\t// Newline must be valid: \\r, \\n, or \\r\\n\n\t\tif (newline !== '\\n' && newline !== '\\r' && newline !== '\\r\\n')\n\t\t\tnewline = '\\n';\n\n\t\t// We're gonna need these at the Parser scope\n\t\tvar cursor = 0;\n\t\tvar aborted = false;\n\n\t\tthis.parse = function(input, baseIndex, ignoreLastRow)\n\t\t{\n\t\t\t// For some reason, in Chrome, this speeds things up (!?)\n\t\t\tif (typeof input !== 'string')\n\t\t\t\tthrow new Error('Input must be a string');\n\n\t\t\t// We don't need to compute some of these every time parse() is called,\n\t\t\t// but having them in a more local scope seems to perform better\n\t\t\tvar inputLen = input.length,\n\t\t\t\tdelimLen = delim.length,\n\t\t\t\tnewlineLen = newline.length,\n\t\t\t\tcommentsLen = comments.length;\n\t\t\tvar stepIsFunction = isFunction(step);\n\n\t\t\t// Establish starting state\n\t\t\tcursor = 0;\n\t\t\tvar data = [], errors = [], row = [], lastCursor = 0;\n\n\t\t\tif (!input)\n\t\t\t\treturn returnable();\n\n\t\t\tif (fastMode || (fastMode !== false && input.indexOf(quoteChar) === -1))\n\t\t\t{\n\t\t\t\tvar rows = input.split(newline);\n\t\t\t\tfor (var i = 0; i < rows.length; i++)\n\t\t\t\t{\n\t\t\t\t\trow = rows[i];\n\t\t\t\t\tcursor += row.length;\n\t\t\t\t\tif (i !== rows.length - 1)\n\t\t\t\t\t\tcursor += newline.length;\n\t\t\t\t\telse if (ignoreLastRow)\n\t\t\t\t\t\treturn returnable();\n\t\t\t\t\tif (comments && row.substring(0, commentsLen) === comments)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tif (stepIsFunction)\n\t\t\t\t\t{\n\t\t\t\t\t\tdata = [];\n\t\t\t\t\t\tpushRow(row.split(delim));\n\t\t\t\t\t\tdoStep();\n\t\t\t\t\t\tif (aborted)\n\t\t\t\t\t\t\treturn returnable();\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tpushRow(row.split(delim));\n\t\t\t\t\tif (preview && i >= preview)\n\t\t\t\t\t{\n\t\t\t\t\t\tdata = data.slice(0, preview);\n\t\t\t\t\t\treturn returnable(true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn returnable();\n\t\t\t}\n\n\t\t\tvar nextDelim = input.indexOf(delim, cursor);\n\t\t\tvar nextNewline = input.indexOf(newline, cursor);\n\t\t\tvar quoteCharRegex = new RegExp(escapeRegExp(escapeChar) + escapeRegExp(quoteChar), 'g');\n\t\t\tvar quoteSearch = input.indexOf(quoteChar, cursor);\n\n\t\t\t// Parser loop\n\t\t\tfor (;;)\n\t\t\t{\n\t\t\t\t// Field has opening quote\n\t\t\t\tif (input[cursor] === quoteChar)\n\t\t\t\t{\n\t\t\t\t\t// Start our search for the closing quote where the cursor is\n\t\t\t\t\tquoteSearch = cursor;\n\n\t\t\t\t\t// Skip the opening quote\n\t\t\t\t\tcursor++;\n\n\t\t\t\t\tfor (;;)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Find closing quote\n\t\t\t\t\t\tquoteSearch = input.indexOf(quoteChar, quoteSearch + 1);\n\n\t\t\t\t\t\t//No other quotes are found - no other delimiters\n\t\t\t\t\t\tif (quoteSearch === -1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (!ignoreLastRow) {\n\t\t\t\t\t\t\t\t// No closing quote... what a pity\n\t\t\t\t\t\t\t\terrors.push({\n\t\t\t\t\t\t\t\t\ttype: 'Quotes',\n\t\t\t\t\t\t\t\t\tcode: 'MissingQuotes',\n\t\t\t\t\t\t\t\t\tmessage: 'Quoted field unterminated',\n\t\t\t\t\t\t\t\t\trow: data.length,\t// row has yet to be inserted\n\t\t\t\t\t\t\t\t\tindex: cursor\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn finish();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Closing quote at EOF\n\t\t\t\t\t\tif (quoteSearch === inputLen - 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar value = input.substring(cursor, quoteSearch).replace(quoteCharRegex, quoteChar);\n\t\t\t\t\t\t\treturn finish(value);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If this quote is escaped, it's part of the data; skip it\n\t\t\t\t\t\t// If the quote character is the escape character, then check if the next character is the escape character\n\t\t\t\t\t\tif (quoteChar === escapeChar && input[quoteSearch + 1] === escapeChar)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tquoteSearch++;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If the quote character is not the escape character, then check if the previous character was the escape character\n\t\t\t\t\t\tif (quoteChar !== escapeChar && quoteSearch !== 0 && input[quoteSearch - 1] === escapeChar)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif(nextDelim !== -1 && nextDelim < (quoteSearch + 1)) {\n\t\t\t\t\t\t\tnextDelim = input.indexOf(delim, (quoteSearch + 1));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(nextNewline !== -1 && nextNewline < (quoteSearch + 1)) {\n\t\t\t\t\t\t\tnextNewline = input.indexOf(newline, (quoteSearch + 1));\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Check up to nextDelim or nextNewline, whichever is closest\n\t\t\t\t\t\tvar checkUpTo = nextNewline === -1 ? nextDelim : Math.min(nextDelim, nextNewline);\n\t\t\t\t\t\tvar spacesBetweenQuoteAndDelimiter = extraSpaces(checkUpTo);\n\n\t\t\t\t\t\t// Closing quote followed by delimiter or 'unnecessary spaces + delimiter'\n\t\t\t\t\t\tif (input[quoteSearch + 1 + spacesBetweenQuoteAndDelimiter] === delim)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\trow.push(input.substring(cursor, quoteSearch).replace(quoteCharRegex, quoteChar));\n\t\t\t\t\t\t\tcursor = quoteSearch + 1 + spacesBetweenQuoteAndDelimiter + delimLen;\n\n\t\t\t\t\t\t\t// If char after following delimiter is not quoteChar, we find next quote char position\n\t\t\t\t\t\t\tif (input[quoteSearch + 1 + spacesBetweenQuoteAndDelimiter + delimLen] !== quoteChar)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tquoteSearch = input.indexOf(quoteChar, cursor);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\n\t\t\t\t\t\t\tnextNewline = input.indexOf(newline, cursor);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tvar spacesBetweenQuoteAndNewLine = extraSpaces(nextNewline);\n\n\t\t\t\t\t\t// Closing quote followed by newline or 'unnecessary spaces + newLine'\n\t\t\t\t\t\tif (input.substring(quoteSearch + 1 + spacesBetweenQuoteAndNewLine, quoteSearch + 1 + spacesBetweenQuoteAndNewLine + newlineLen) === newline)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\trow.push(input.substring(cursor, quoteSearch).replace(quoteCharRegex, quoteChar));\n\t\t\t\t\t\t\tsaveRow(quoteSearch + 1 + spacesBetweenQuoteAndNewLine + newlineLen);\n\t\t\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\t// because we may have skipped the nextDelim in the quoted field\n\t\t\t\t\t\t\tquoteSearch = input.indexOf(quoteChar, cursor);\t// we search for first quote in next line\n\n\t\t\t\t\t\t\tif (stepIsFunction)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdoStep();\n\t\t\t\t\t\t\t\tif (aborted)\n\t\t\t\t\t\t\t\t\treturn returnable();\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (preview && data.length >= preview)\n\t\t\t\t\t\t\t\treturn returnable(true);\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\t// Checks for valid closing quotes are complete (escaped quotes or quote followed by EOF/delimiter/newline) -- assume these quotes are part of an invalid text string\n\t\t\t\t\t\terrors.push({\n\t\t\t\t\t\t\ttype: 'Quotes',\n\t\t\t\t\t\t\tcode: 'InvalidQuotes',\n\t\t\t\t\t\t\tmessage: 'Trailing quote on quoted field is malformed',\n\t\t\t\t\t\t\trow: data.length,\t// row has yet to be inserted\n\t\t\t\t\t\t\tindex: cursor\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tquoteSearch++;\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Comment found at start of new line\n\t\t\t\tif (comments && row.length === 0 && input.substring(cursor, cursor + commentsLen) === comments)\n\t\t\t\t{\n\t\t\t\t\tif (nextNewline === -1)\t// Comment ends at EOF\n\t\t\t\t\t\treturn returnable();\n\t\t\t\t\tcursor = nextNewline + newlineLen;\n\t\t\t\t\tnextNewline = input.indexOf(newline, cursor);\n\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Next delimiter comes before next newline, so we've reached end of field\n\t\t\t\tif (nextDelim !== -1 && (nextDelim < nextNewline || nextNewline === -1))\n\t\t\t\t{\n\t\t\t\t\t// we check, if we have quotes, because delimiter char may be part of field enclosed in quotes\n\t\t\t\t\tif (quoteSearch > nextDelim) {\n\t\t\t\t\t\t// we have quotes, so we try to find the next delimiter not enclosed in quotes and also next starting quote char\n\t\t\t\t\t\tvar nextDelimObj = getNextUnquotedDelimiter(nextDelim, quoteSearch, nextNewline);\n\n\t\t\t\t\t\t// if we have next delimiter char which is not enclosed in quotes\n\t\t\t\t\t\tif (nextDelimObj && typeof nextDelimObj.nextDelim !== 'undefined') {\n\t\t\t\t\t\t\tnextDelim = nextDelimObj.nextDelim;\n\t\t\t\t\t\t\tquoteSearch = nextDelimObj.quoteSearch;\n\t\t\t\t\t\t\trow.push(input.substring(cursor, nextDelim));\n\t\t\t\t\t\t\tcursor = nextDelim + delimLen;\n\t\t\t\t\t\t\t// we look for next delimiter char\n\t\t\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\trow.push(input.substring(cursor, nextDelim));\n\t\t\t\t\t\tcursor = nextDelim + delimLen;\n\t\t\t\t\t\tnextDelim = input.indexOf(delim, cursor);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// End of row\n\t\t\t\tif (nextNewline !== -1)\n\t\t\t\t{\n\t\t\t\t\trow.push(input.substring(cursor, nextNewline));\n\t\t\t\t\tsaveRow(nextNewline + newlineLen);\n\n\t\t\t\t\tif (stepIsFunction)\n\t\t\t\t\t{\n\t\t\t\t\t\tdoStep();\n\t\t\t\t\t\tif (aborted)\n\t\t\t\t\t\t\treturn returnable();\n\t\t\t\t\t}\n\n\t\t\t\t\tif (preview && data.length >= preview)\n\t\t\t\t\t\treturn returnable(true);\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\n\t\t\treturn finish();\n\n\n\t\t\tfunction pushRow(row)\n\t\t\t{\n\t\t\t\tdata.push(row);\n\t\t\t\tlastCursor = cursor;\n\t\t\t}\n\n\t\t\t/**\n * checks if there are extra spaces after closing quote and given index without any text\n * if Yes, returns the number of spaces\n */\n\t\t\tfunction extraSpaces(index) {\n\t\t\t\tvar spaceLength = 0;\n\t\t\t\tif (index !== -1) {\n\t\t\t\t\tvar textBetweenClosingQuoteAndIndex = input.substring(quoteSearch + 1, index);\n\t\t\t\t\tif (textBetweenClosingQuoteAndIndex && textBetweenClosingQuoteAndIndex.trim() === '') {\n\t\t\t\t\t\tspaceLength = textBetweenClosingQuoteAndIndex.length;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn spaceLength;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Appends the remaining input from cursor to the end into\n\t\t\t * row, saves the row, calls step, and returns the results.\n\t\t\t */\n\t\t\tfunction finish(value)\n\t\t\t{\n\t\t\t\tif (ignoreLastRow)\n\t\t\t\t\treturn returnable();\n\t\t\t\tif (typeof value === 'undefined')\n\t\t\t\t\tvalue = input.substring(cursor);\n\t\t\t\trow.push(value);\n\t\t\t\tcursor = inputLen;\t// important in case parsing is paused\n\t\t\t\tpushRow(row);\n\t\t\t\tif (stepIsFunction)\n\t\t\t\t\tdoStep();\n\t\t\t\treturn returnable();\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Appends the current row to the results. It sets the cursor\n\t\t\t * to newCursor and finds the nextNewline. The caller should\n\t\t\t * take care to execute user's step function and check for\n\t\t\t * preview and end parsing if necessary.\n\t\t\t */\n\t\t\tfunction saveRow(newCursor)\n\t\t\t{\n\t\t\t\tcursor = newCursor;\n\t\t\t\tpushRow(row);\n\t\t\t\trow = [];\n\t\t\t\tnextNewline = input.indexOf(newline, cursor);\n\t\t\t}\n\n\t\t\t/** Returns an object with the results, errors, and meta. */\n\t\t\tfunction returnable(stopped)\n\t\t\t{\n\t\t\t\treturn {\n\t\t\t\t\tdata: data,\n\t\t\t\t\terrors: errors,\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\tdelimiter: delim,\n\t\t\t\t\t\tlinebreak: newline,\n\t\t\t\t\t\taborted: aborted,\n\t\t\t\t\t\ttruncated: !!stopped,\n\t\t\t\t\t\tcursor: lastCursor + (baseIndex || 0)\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t/** Executes the user's step function and resets data & errors. */\n\t\t\tfunction doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [];\n\t\t\t\terrors = [];\n\t\t\t}\n\n\t\t\t/** Gets the delimiter character, which is not inside the quoted field */\n\t\t\tfunction getNextUnquotedDelimiter(nextDelim, quoteSearch, newLine) {\n\t\t\t\tvar result = {\n\t\t\t\t\tnextDelim: undefined,\n\t\t\t\t\tquoteSearch: undefined\n\t\t\t\t};\n\t\t\t\t// get the next closing quote character\n\t\t\t\tvar nextQuoteSearch = input.indexOf(quoteChar, quoteSearch + 1);\n\n\t\t\t\t// if next delimiter is part of a field enclosed in quotes\n\t\t\t\tif (nextDelim > quoteSearch && nextDelim < nextQuoteSearch && (nextQuoteSearch < newLine || newLine === -1)) {\n\t\t\t\t\t// get the next delimiter character after this one\n\t\t\t\t\tvar nextNextDelim = input.indexOf(delim, nextQuoteSearch);\n\n\t\t\t\t\t// if there is no next delimiter, return default result\n\t\t\t\t\tif (nextNextDelim === -1) {\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t\t// find the next opening quote char position\n\t\t\t\t\tif (nextNextDelim > nextQuoteSearch) {\n\t\t\t\t\t\tnextQuoteSearch = input.indexOf(quoteChar, nextQuoteSearch + 1);\n\t\t\t\t\t}\n\t\t\t\t\t// try to get the next delimiter position\n\t\t\t\t\tresult = getNextUnquotedDelimiter(nextNextDelim, nextQuoteSearch, newLine);\n\t\t\t\t} else {\n\t\t\t\t\tresult = {\n\t\t\t\t\t\tnextDelim: nextDelim,\n\t\t\t\t\t\tquoteSearch: quoteSearch\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t}\n\t\t};\n\n\t\t/** Sets the abort flag */\n\t\tthis.abort = function()\n\t\t{\n\t\t\taborted = true;\n\t\t};\n\n\t\t/** Gets the cursor position */\n\t\tthis.getCharIndex = function()\n\t\t{\n\t\t\treturn cursor;\n\t\t};\n\t}", "title": "" }, { "docid": "cf3c8543fd0b795db0d67598923b62fa", "score": "0.51902527", "text": "function parse(input) {\n var nearleyParser = new nearley.Parser(grammar.ParserRules, grammar.ParserStart);\n var parsestr = input.toLowerCase().replace(/\\W/g, \"\");\n try {\n var results = nearleyParser.feed(parsestr).results;\n }\n catch (err) {\n if ('offset' in err) {\n throw new Parser.Error('Parsing failed after ' + err.offset + ' characters', err.offset);\n }\n else {\n throw err;\n }\n }\n if (!results.length) {\n throw new Parser.Error('Incomplete input', parsestr.length);\n }\n return results.map(function (c) {\n return { input: input, prs: clone(c) };\n });\n }", "title": "" }, { "docid": "61457cfba5597b82a69685eaa5066626", "score": "0.5185445", "text": "function _parse(tree) {\n\t\t\tif (tree.type)\n\t\t\t\tself.trigger(tree.type, tree);\n\n\t\t\tif (self.report.length > MAXERR)\n\t\t\t\treturn;\n\n\t\t\t_.each(tree, function (val, key) {\n\t\t\t\tif (val === null)\n\t\t\t\t\treturn;\n\n\t\t\t\tif (!_.isObject(val) && !_.isArray(val))\n\t\t\t\t\treturn;\n\n\t\t\t\tswitch (val.type) {\n\t\t\t\tcase \"ExpressionStatement\":\n\t\t\t\t\tif (val.expression.type === \"Literal\" && val.expression.value === \"use strict\")\n\t\t\t\t\t\tself.scopes.current.strict = true;\n\t\t\t\t\t_parse(val);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"FunctionDeclaration\":\n\t\t\t\t\tself.scopes.addVariable({ name: val.id.name });\n\t\t\t\t\tself.scopes.push(val.id.name);\n\n\t\t\t\t\t// If this function is not empty, parse its leading comments (if any).\n\t\t\t\t\tif (val.body.type === \"BlockStatement\" && val.body.body.length > 0)\n\t\t\t\t\t\t_parseComments(val.range[0], val.body.body[0].range[0]);\n\n\t\t\t\t\t_parse(val);\n\t\t\t\t\tself.scopes.pop();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"FunctionExpression\":\n\t\t\t\t\tif (val.id && val.id.type === \"Identifier\")\n\t\t\t\t\t\tself.scopes.addVariable({ name: val.id.name });\n\t\t\t\t\tself.scopes.push(\"(anon)\");\n\n\t\t\t\t\t// If this function is not empty, parse its leading comments (if any).\n\t\t\t\t\tif (val.body.type === \"BlockStatement\" && val.body.body.length > 0)\n\t\t\t\t\t\t_parseComments(val.range[0], val.body.body[0].range[0]);\n\n\t\t\t\t\t_parse(val);\n\t\t\t\t\tself.scopes.pop();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"WithStatement\":\n\t\t\t\t\tself.scopes.runtimeOnly = true;\n\t\t\t\t\t_parse(val);\n\t\t\t\t\tself.scopes.runtimeOnly = false;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t_parse(val);\n\t\t\t\t}\n\t\t\t});\n\t\t}", "title": "" }, { "docid": "b25f64fcc695199282ad7569d1b3ed94", "score": "0.51851505", "text": "parse(tokenSequence) {\n let tokenIndex = 0;\n const getToken = () => tokenSequence[tokenIndex];\n const nextToken = () => tokenIndex += 1;\n\n let parseProgram = (node) => {\n let token = getToken();\n if (token.type === Token.BlockBegin) {\n addChildNode(node, new ParseTreeNode(Block, null));\n if (parseBlock(node.children[0])) {\n addChildNode(node, new ParseTreeNode(StartPrime, null));\n return parseStartPrime(node.children[1]);\n }\n } else if (token.type === Token.Action || token.type === Token.Command ||\n token.type === Token.Comment) {\n addChildNode(node, new ParseTreeNode(ACC, null));\n if (parseACC(node.children[0])) {\n addChildNode(node, new ParseTreeNode(StartPrime, null));\n return parseStartPrime(node.children[1]);\n }\n } else {\n console.log(`Error parsing at ${token}.`);\n return false;\n }\n };\n\n let parseStartPrime = (node) => {\n let token = getToken();\n if (token.type === Token.BlockBegin) {\n addChildNode(node, new ParseTreeNode(Block, null));\n if (parseBlock(node.children[0])) {\n addChildNode(node, new ParseTreeNode(StartPrime, null));\n return parseStartPrime(node.children[1]);\n }\n } else if (token.type === Token.Action || token.type === Token.Command ||\n token.type === Token.Comment) {\n addChildNode(node, new ParseTreeNode(ACC, null));\n if (parseACC(node.children[0])) {\n addChildNode(node, new ParseTreeNode(StartPrime, null));\n return parseStartPrime(node.children[1]);\n }\n } else {\n return true; // for Start' -> empty\n }\n };\n\n let parseBlock = (node) => {\n let token = getToken();\n if (token.type === Token.BlockBegin) {\n addChildNode(node, new ParseTreeNode(BlockBegin, token));\n nextToken();\n addChildNode(node, new ParseTreeNode(StartPrime, null));\n if (parseStartPrime(node.children[1])) {\n addChildNode(node, new ParseTreeNode(BlockEnd, getToken()));\n if (getToken().type === Token.BlockEnd) {\n nextToken();\n return true;\n } else {\n console.log(\n `Error parsing at ${getToken()}, should be <block-end>.`);\n }\n }\n } else {\n console.log(`Error parsing at ${getToken()}, should be <block-begin>.`);\n }\n };\n\n let parseACC = (node) => {\n let token = getToken();\n if (token.type === Token.Action) {\n addChildNode(node, new ParseTreeNode(Action, token));\n nextToken();\n return true;\n } else if (token.type === Token.Command) {\n addChildNode(node, new ParseTreeNode(Command, token));\n nextToken();\n return true;\n } else if (token.type === Token.Comment) {\n addChildNode(node, new ParseTreeNode(Comment, token));\n nextToken();\n return true;\n } else {\n console.log(\n `Error parsing at ${token}, should be <action> or <command> or <comment>.`);\n return false;\n }\n };\n\n let startNode = new ParseTreeNode(Start);\n if (parseProgram(startNode)) {\n return startNode;\n } else {\n console.log('Failed to parse the code.');\n }\n }", "title": "" }, { "docid": "3a8161a9a77ba42862c7138a16cdd5e6", "score": "0.51813895", "text": "function parser(getPgnInfo) {\n const state = new Map()\n return (input) => parse(getPgnInfo, state, input)\n}", "title": "" } ]
6152209d071d2951939f13baa5ae633b
used by xmlpretty below
[ { "docid": "e22d6d2924dc3bf62835104ec83f38aa", "score": "0.0", "text": "createShiftArr(step) {\n var space = ' ';\n if ( isNaN(parseInt(step)) ) { // argument is string\n space = step;\n } else { // argument is integer\n switch(step) {\n case 1: space = ' '; break;\n case 2: space = ' '; break;\n case 3: space = ' '; break;\n case 4: space = ' '; break;\n case 5: space = ' '; break;\n case 6: space = ' '; break;\n case 7: space = ' '; break;\n case 8: space = ' '; break;\n case 9: space = ' '; break;\n case 10: space = ' '; break;\n case 11: space = ' '; break;\n case 12: space = ' '; break;\n }\n }\n\n var shift = ['\\n']; // array of shifts\n for(var ix=0;ix<100;ix++){\n shift.push(shift[ix]+space);\n }\n return shift;\n }", "title": "" } ]
[ { "docid": "815516f27703652c5b60529e0736042d", "score": "0.5860661", "text": "function prettyPrint(node,options){return new printer_1.Printer(options).printGenerically(node);}", "title": "" }, { "docid": "4df9f27db3afa4ae4d6cb8bc72e19013", "score": "0.57443416", "text": "serialize() {\n return (0, xmlbuilder2_1.convert)({ encoding: \"utf-8\" }, this.thePackage, { prettyPrint: true });\n }", "title": "" }, { "docid": "72edc87a9fbd708c7acc63b2845d43d0", "score": "0.57163197", "text": "function formatXml(xml) {\n var formatted = '';\n var reg = /(>)(<)(\\/*)/g;\n xml = xml.replace(reg, '$1\\r\\n$2$3');\n var pad = 0;\n jQuery.each(xml.split('\\r\\n'), function(index, node) {\n var indent = 0;\n if (node.match( /.+<\\/\\w[^>]*>$/ )) {\n indent = 0;\n } else if (node.match( /^<\\/\\w/ )) {\n if (pad != 0) {\n pad -= 1;\n }\n } else if (node.match( /^<\\w[^>]*[^\\/]>.*$/ )) {\n indent = 1;\n } else {\n indent = 0;\n }\n\n var padding = '';\n for (var i = 0; i < pad; i++) {\n padding += ' ';\n }\n\n formatted += padding + node + '\\r\\n';\n pad += indent;\n });\n\n return formatted;\n }", "title": "" }, { "docid": "46fe84f03cf4e508b9991a29b64b75b5", "score": "0.5660962", "text": "function format(testCase, name)\n{\t\n\tvar dom = getDOMForCommands(testCase.commands);\n\t\n\tvar s = new XMLSerializer(); // https://developer.mozilla.org/en/XMLSerializer\n\tvar docXML = s.serializeToString(dom);\n\t\n\tvar text = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>';\n\tif(options.indentWithTab == 'true') text += '\\n'\n\ttext += docXML;\n\t\n\treturn text;\n}", "title": "" }, { "docid": "76ebc027815025eca76b4a4224d2d2ef", "score": "0.56310034", "text": "function formatXml(xml) {\n var formatted = '';\n var reg = /(>)(<)(\\/*)/g; /* this comment is added to escape the /* in the regex expression not useful at all*/\n xml = xml.replace(reg, '$1\\r\\n$2$3');\n var pad = 0;\n jQuery.each(xml.split('\\r\\n'), function(index, node) {\n var indent = 0;\n if (node.match( /.+<\\/\\w[^>]*>$/ )) {\n indent = 0;\n } else if (node.match( /^<\\/\\w/ )) {\n if (pad != 0) {\n pad -= 1;\n }\n } else if (node.match( /^<\\w[^>]*[^\\/]>.*$/ )) {\n indent = 1;\n } else {\n indent = 0;\n }\n\n var padding = '';\n for (var i = 0; i < pad; i++) {\n padding += ' ';\n }\n\n formatted += padding + node + '\\r\\n';\n pad += indent;\n });\n return formatted;\n}", "title": "" }, { "docid": "15d33f9d2d1fb20d969d0a792aa18bd2", "score": "0.5629387", "text": "function formatXML(document) {\n return formatElement(document.documentElement);\n function formatElement(element) {\n var html = '<span>&lt;</span><span class=\"tag\">' + encodeHtml(element.nodeName) + '</span>';\n if (element.attributes && element.attributes.length > 0) {\n html += formatAttributes(element);\n }\n if (element.childNodes && element.childNodes.length > 0) {\n html += '<span>&gt;</span>';\n if (element.childNodes.length == 1 && element.childNodes[0].nodeType == 3) {\n html += '<span class=\"text\">' + encodeHtml(element.childNodes[0].nodeValue) + '</span>';\n } else {\n html += formatChildNodes(element.childNodes); \n } \n html += '<span>&lt;/</span><span class=\"tag\">' + encodeHtml(element.nodeName) + '</span><span>&gt;</span>';\n } else {\n html += '<span>/&gt;</span>';\n } \n return html; \n }\n function formatChildNodes(childNodes) {\n html = '<ul class=\"list\">';\n for ( var i = 0; i < childNodes.length; i++) {\n var node = childNodes[i];\n if (node.nodeType == 1) {\n html += '<li>' + formatElement(node) + '</li>';\n } else if (node.nodeType == 3 && !/^\\s+$/.test(node.nodeValue)) {\n html += '<li><span class=\"text\">' + encodeHtml(node.nodeValue) + '</span></li>';\n } else if (node.nodeType == 4) {\n html += '<li><span class=\"cdata\">&lt;![CDATA[' + encodeHtml(node.nodeValue) + ']]&gt;</span></li>';\n } else if (node.nodeType == 8) {\n html += '<li><span class=\"comment\">&lt;!--' + encodeHtml(node.nodeValue) + '--&gt;</span></li>';\n }\n }\n html += '</ul>';\n return html;\n }\n function formatAttributes(element) {\n var html = '';\n for (var i = 0; i < element.attributes.length; i++) {\n var attribute = element.attributes[i];\n if (/^xmlns:[^\\s]+$/.test(attribute.nodeName)) {\n html += ' <span class=\"ns\">' + encodeHtml(attribute.nodeName) + '=\"' + encodeHtml(attribute.nodeValue) + '\"</span>';\n } else {\n html += ' <span class=\"atn\">' + encodeHtml(attribute.nodeName) + '</span>=';\n if (attribute.nodeName == 'href' || attribute.nodeName == 'src') {\n var separator = (attribute.nodeValue.indexOf('?') == -1) ? '?' : '&';\n var href = (element.baseURI && attribute.nodeValue[0] != '/') ? element.baseURI + attribute.nodeValue : attribute.nodeValue;\n html += '\"<a class=\"link\" href=\"' + href + '\">' + encodeHtml(attribute.nodeValue) + '</a>\"'; \n } else {\n html += '\"<span class=\"atv\">' + encodeHtml(attribute.nodeValue) + '</span>\"';\n } \n } \n }\n return html;\n }\n }", "title": "" }, { "docid": "34ec2490e19984b8589ba5ffe653db2c", "score": "0.5610424", "text": "ToXML()\n {\n //println(\"building \"+this.Name)\n var ret = this.Version;\n ret += this.BuildElement();\n var i=0;\n while (i<this.Children.length)\n {\n ret += this.Children[i].ToXML();\n i++;\n }\n if (this.Children.length!=0)\n ret+=this.Indent+\"</\"+this.Name+\">\\n\";\n return ret;\n }", "title": "" }, { "docid": "2efdae92088e3635b0d55192f38ca1f7", "score": "0.55861187", "text": "out_xml() {\n this.xmlstr = \"\"\n for(i=0;i < this.ttlv;i++){\n let xmltmp = this.vous[i].tvou;\n this.xmlstr = this.xmlstr + \"\\n\"+ flow.toXml(xmltmp,{indent:' '}) ;\n console.log(this.xmlstr)\n }\n }", "title": "" }, { "docid": "190a66e3bd4a5b0a8835c7fbf3a71548", "score": "0.54834366", "text": "ToXml() {\n\n }", "title": "" }, { "docid": "499b536d44e0c283aa399cc24f2a30b4", "score": "0.54705495", "text": "function PhantomFormatter() {}", "title": "" }, { "docid": "4505df4185aaab5bd89d89c671f96303", "score": "0.5446921", "text": "function xmlCloseAttr(outTs) {\n outTs.WriteLine(\"/>\"); \n \n if (indent.length >= 2) {\n\tindent = indent.substr(2);\n }\n else {\n\tindent = indent+\"-------\";\n }\n}", "title": "" }, { "docid": "1eb2c27bb8dd4d44c2957de08762f117", "score": "0.54448885", "text": "function formatXml$static(xml/*:String*/)/*:String*/ {\n var formatted/*:String*/ = '';\n var reg/*:**/ = /(>)(<)(\\/*)/g;\n xml = xml.replace(reg, '$1\\r\\n$2$3');\n var pad/*:int*/ = 0;\n xml.split('\\r\\n').forEach(function (node/*:**/)/*:**/ {\n var indent/*:int*/ = 0;\n if (node.match(/.+<\\/\\w[^>]*>$/)) {\n indent = 0;\n } else if (node.match(/^<\\/\\w/)) {\n if (pad != 0) {\n pad -= 1;\n }\n } else if (node.match(/^<\\w[^>]*[^\\/]>.*$/)) {\n indent = 1;\n } else {\n indent = 0;\n }\n\n var padding/*:String*/ = '';\n for (var i/*:int*/ = 0; i < pad; i++) {\n padding += ' ';\n }\n\n formatted += padding + node + '\\r\\n';\n pad += indent;\n });\n\n return formatted;\n }", "title": "" }, { "docid": "7e3ff0675bda47867dac77bc0b5df459", "score": "0.53770554", "text": "serialize() {\n return `${this.childNodes.map(x => x.serialize()).join('')}`;\n }", "title": "" }, { "docid": "88ae35acc4454f7887436bd8e68cf98b", "score": "0.5364276", "text": "function pretty(a) \r\n{\r\n\treturn '<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td width=\"100%\" class=\"EWTitle\" nowrap>' + a + '</td></tr>' +\r\n\t\t '<tr><td nowrap></td></tr></table>';\r\n}", "title": "" }, { "docid": "6526d8d2f503e7712c34a5260c4a743e", "score": "0.53574914", "text": "function printAST(a) {\n var sout = \"\"; // We concat all output to this string and return it.\n\n // Iterate through the linked list.\n while (a!=null) {\n\n switch(a.name) {\n\n case \"outer\":\n if (a.OUTERTEXT!=null)\n sout += a.OUTERTEXT;\n else if (a.templateinvocation!=null)\n sout += printAST(a.templateinvocation);\n else if (a.templatedef!=null)\n sout += printAST(a.templatedef);\n break;\n\n case \"templateinvocation\":\n sout += \"{{\";\n if (a.itext!=null) {\n // An invocation name does not have leading/trailing WS.\n var tname = printAST(a.itext);\n // If the name starts with a \"{\" (because there's a nested invoke, param,\n // or def), then introduce a space to avoid accidentally converting \n // the TSTART \"{{\" into a PSTART \"{{{\".\n if (tname.length>0 && tname.charAt(0)=='{')\n sout += \" \";\n sout += tname;\n }\n // Append args, if any.\n if (a.targs!=null)\n sout += printAST(a.targs);\n sout += \"}}\";\n break;\n\n case \"itext\":\n if (a.INNERTEXT!=null)\n sout += a.INNERTEXT;\n else if (a.templateinvocation!=null)\n sout += printAST(a.templateinvocation);\n else if (a.templatedef!=null)\n sout += printAST(a.templatedef);\n else if (a.tparam!=null)\n sout += printAST(a.tparam);\n break;\n\n case \"targs\":\n // Args are prepended by a PIPE.\n sout += \"|\";\n if (a.itext!=null)\n sout += printAST(a.itext);\n break;\n\n case \"templatedef\":\n sout += \"{:\";\n // Print the definition name, without leading/trailing WS. \n // Check before trimming though, as it could be null.\n if (a.dtext!=null)\n sout += printAST(a.dtext);\n sout += printAST(a.dparams);\n sout += \":}\";\n break;\n\n case \"dtext\":\n if (a.INNERDTEXT!=null)\n sout += a.INNERDTEXT;\n else if (a.templateinvocation!=null)\n sout += printAST(a.templateinvocation);\n else if (a.templatedef!=null)\n sout += printAST(a.templatedef);\n else if (a.tparam!=null)\n sout += printAST(a.tparam);\n break;\n\n case \"dparams\":\n // Like targs, individual dparams are separated by a PIPE.\n sout += \"|\";\n if (a.dtext!=null) {\n sout += printAST(a.dtext);\n }\n break;\n\n case \"tparam\":\n // A parameter name itself should not have leading/trailing WS.\n sout += \"{{{\" + a.pname.trim() + \"}}}\";\n break;\n\n default: \n // We shouldn't need this, but just in case.\n sout += \"ERROR(\"+a.name+\")\";\n break;\n }\n a = a.next;\n }\n return sout;\n}", "title": "" }, { "docid": "9eab356dfcac3beb12720c37c6bd5cb5", "score": "0.5337274", "text": "function create_xml_tree () {\n\n\n}", "title": "" }, { "docid": "ee9f8782f3194bb60a444c3f375e2336", "score": "0.5296835", "text": "getASTXMLTree() {\n let str = \"\";\n str = \"<li><a href=''>\" + this.id_open + \"</a>\";\n if (this.attributes == null && this.childs == null && this.value == null) {\n str = str + \"</li>\";\n return str;\n }\n str = str + \"<ul>\";\n if (this.attributes != null) {\n str = str + \"<li><a href=''>Atributos</a><ul>\";\n this.attributes.forEach((value) => {\n str = str + \"<li><a href=''>Atributo</a><ul>\";\n str = str + \"<li><a href=''>\" + value.id.slice(0, -1) + \"</a></li>\";\n str = str + \"<li><a href=''>\" + value.value + \"</a></li>\";\n str = str + \"</ul></li>\\n\";\n });\n str = str + \"</ul></li>\";\n }\n if (this.value != null) {\n str = str + \"<li><a href=''>Value</a><ul><li><a href=''>\" + this.value + \"</a></li></ul></li></ul></li>\\n\";\n return str;\n }\n if (this.id_close == null) {\n str = str + \"</ul></li>\\n\";\n return str;\n }\n if (this.childs != null) {\n str = str + \"<li><a href=''>Children</a><ul>\";\n this.childs.forEach((value) => {\n str = str + value.getASTXMLTree();\n });\n str = str + \"</ul></li>\\n\";\n }\n str = str + \"</ul></li>\\n\";\n return str;\n }", "title": "" }, { "docid": "f6f1f1987e2c3b71af26b3a8fd69cfd8", "score": "0.52827233", "text": "function dump( set, name ) \n{\n\t$( '#output' ).append( '<b>' + name + '</b> (' + set.entries.length + ' entries)<hr/>' );\n\n\tfor( var p = 0; p < set.entries.length; p++ )\n\t{\n\t\tif( set.entries[p].tag == null )\n\t\t{\n\t\t\t$( '#output' ).append( 'Unknown tag: ' + \n\t\t\t\tset.entries[p].data +\n\t\t\t\t'<br/>' );\t\t\t\t\t\t\t\n\t\t} else {\n\t\t\t$( '#output' ).append( set.entries[p].tag.name + \n\t\t\t\t': ' + \n\t\t\t\tset.entries[p].data +\n\t\t\t\t'<br/>' );\n\t\t}\n\t}\n\t\n\t$( '#output' ).append( '<br/>' );\t\n}", "title": "" }, { "docid": "fd0d8d0b67cdbbb853fd6d3b556c4761", "score": "0.5262806", "text": "createXml() {\n for (var i = 0; i < this.bundleView._nodes.length; i++) {\n this.bundleView._nodes[i].xmlId = i;\n }\n for (var i = 0; i < this.bundleView.relations().length; i++) {\n this.bundleView.relations()[i].xmlId = i;\n }\n var str = \"<?xml version=\\\"1.0\\\"?>\\n<hierarchy version=\\\"1.0\\\">\\n <nodes>\\n\";\n var parent;\n str += \" <node id=\\\"0\\\">\\n <parentId>-1</parentId>\\n <label>invisible root node</label>\\n </node>\\n\";\n for (var i = 0; i < this.bundleView._nodes.length; i++) {\n parent = this.bundleView._nodes[i].parent();\n str +=\" <node id=\\\"\" + (i + 1) + \"\\\">\\n <parentId>\" + (parent ? parent.xmlId + 1 : 0) + \"</parentId>\\n <label>\" + this.bundleView._nodes[i].label() + \"</label>\\n </node>\\n\";\n }\n str += \" </nodes>\\n <relations>\\n\"\n for (var i = 0; i < this.bundleView.relations().length; i++) {\n str +=\" <relation>\\n <sourceId>\" + (this.bundleView.relations()[i].from.xmlId + 1) + \"</sourceId>\\n <destId>\" + (this.bundleView.relations()[i].to.xmlId + 1) + \"</destId>\\n </relation>\\n\";\n }\n str += \" </relations>\\n</hierarchy>\\n\";\n return str;\n }", "title": "" }, { "docid": "0a683f669dc89e1c742638ffe5a4dc66", "score": "0.52470964", "text": "function json2xml(o, tab) {\n var toXml = function (v, name, ind) {\n var xml = \"\";\n if (v instanceof Array) {\n for (var i = 0, n = v.length; i < n; i++)\n xml += ind + toXml(v[i], name, ind + \"\\t\") + \"\\n\";\n }\n else if (typeof (v) == \"object\") {\n var hasChild = false;\n xml += ind + \"<\" + name;\n for (var m in v) {\n if (m.charAt(0) == \"@\")\n xml += \" \" + m.substr(1) + \"=\\\"\" + v[m].toString() + \"\\\"\";\n else\n hasChild = true;\n }\n xml += hasChild ? \">\" : \"/>\";\n if (hasChild) {\n for (var m in v) {\n if (m == \"#text\")\n xml += v[m];\n else if (m == \"#cdata\")\n xml += \"<![CDATA[\" + v[m] + \"]]>\";\n else if (m.charAt(0) != \"@\")\n xml += toXml(v[m], m, ind + \"\\t\");\n }\n xml += (xml.charAt(xml.length - 1) == \"\\n\" ? ind : \"\") + \"</\" + name + \">\";\n }\n }\n else {\n if (typeof (v) != \"function\")\n\n xml += ind + \"<\" + name + \">\" + v.toString() + \"</\" + name + \">\";\n }\n return xml;\n }, xml = \"\";\n for (var m in o)\n xml += toXml(o[m], \"A\", \"\");\n // xml += toXml(o[m], m, \"\");\n return tab ? xml.replace(/\\t/g, tab) : xml.replace(/\\t|\\n/g, \"\");\n}", "title": "" }, { "docid": "704fab28a6c65a6a99803c24ad2eb7b9", "score": "0.52388996", "text": "function pretty(el) {\n if ( el.value == null || el.value == el.type ) {\n return el.type;\n }\n return el.type + \":\" + el.value;\n }", "title": "" }, { "docid": "dafd498bfc54b0acd7130dc10e9ad547", "score": "0.5232061", "text": "_toHtml () {\n const escapeXML = ( text ) =>\n text.replace( /&/g, \"&amp;\" ).replace( /</g, \"&lt;\" )\n .replace( />/g, \"&gt;\" ).replace( /\"/g, \"&quot;\" )\n .replace( /'/g, \"&#039;\" )\n return `<pre>${escapeXML(this.toString())}</pre>`\n }", "title": "" }, { "docid": "89ad38d7bf7414f6164f879f3601b3e5", "score": "0.5220778", "text": "function XmlParm() {}", "title": "" }, { "docid": "7e1e11d6d2a6737e01d461c2f7204dcc", "score": "0.5214777", "text": "preOrderPrint() {\n this[_preOrderPrintHelp](this.root);\n }", "title": "" }, { "docid": "9941f4f855cefada6eaa99cf4cdc8723", "score": "0.52019346", "text": "function CX(v){ console.dirxml($(v)[0]); }", "title": "" }, { "docid": "e1b52af12e854640f9b53dd5efc49db2", "score": "0.51898664", "text": "bracery() {\n return this.nodes.slice(1).concat(this.nodes[0]).reduce ((s, node) => s + this.makeNodeBracery(node),'');\n }", "title": "" }, { "docid": "cc04bc12e1d9b9524c671f208115cbfe", "score": "0.51688325", "text": "function print(ast) {\n\t\t return (0, _visitor.visit)(ast, { leave: printDocASTReducer });\n\t\t}", "title": "" }, { "docid": "cc04bc12e1d9b9524c671f208115cbfe", "score": "0.51688325", "text": "function print(ast) {\n\t\t return (0, _visitor.visit)(ast, { leave: printDocASTReducer });\n\t\t}", "title": "" }, { "docid": "c34f4f1418d6ec98c7023cd5b0e3ad67", "score": "0.51617163", "text": "function xmlFileHeader(outTs) {\n outTs.Writeline(\"<?xml version='1.0' encoding='UTF-8'?>\");\n outTs.Writeline(\"<!-- $Id: express2xml.js,v 1.38 2004/08/24 16:58:55 thendrix Exp $ -->\");\n outTs.Writeline(\"<?xml-stylesheet type=\\\"text\\/xsl\\\" href=\\\"..\\/..\\/..\\/xsl\\/express.xsl\\\"?>\");\n outTs.Writeline(\"<!DOCTYPE express SYSTEM \\\"../../../dtd/express.dtd\\\">\");\n\n}", "title": "" }, { "docid": "a1a0c8bddec0b3de55ea1e82569da7f1", "score": "0.51282007", "text": "function pp(ast)\n{\n pp_indent(ast, 0);\n}", "title": "" }, { "docid": "a1a0c8bddec0b3de55ea1e82569da7f1", "score": "0.51282007", "text": "function pp(ast)\n{\n pp_indent(ast, 0);\n}", "title": "" }, { "docid": "1794ef0bec3c2c42c1b9cc5f686d71c5", "score": "0.5123336", "text": "function ze(a){var b;D&&(b=a.Xf());var c=ec(\"xml\");a=$c(a,!0);for(var d=0,e;e=a[d];d++){var h=Ae(e);e=e.Sa();h.setAttribute(\"x\",D?b-e.x:e.x);h.setAttribute(\"y\",e.y);c.appendChild(h)}return c}", "title": "" }, { "docid": "8bd4b2aebd831eed21faa1ad0a8a86d1", "score": "0.51175433", "text": "[_preOrderPrintHelp] (node) {\n console.log(node.key);\n for (let child of node.children)\n this[_preOrderPrintHelp](child);\n }", "title": "" }, { "docid": "97098386cbfdbd92f007527526fc2d59", "score": "0.51106447", "text": "function buildTagsArray_page_05(N){\n//alert(\"buildTagsArray_page_05\");\n\n\n//N=0 no red, use '<' in xml tag\n//N>0 insert red use '&#060;' (prev '&lt;') in xml tag to make html viewable\n\nvar NI = 0;\nif ( N == \"0\" ) { NI=0; } else { NI=1; }\n\n\nvar bfont= new String(BFONT[NI]);\nvar efont= new String(EFONT[NI]);\n\tvar obrak= new String(OBRAK[NI]);\n\nvar ps=new Array();\n\n\n//ps[ps.length] = new String(\"<-- page_05 -->\");\n\n/////////////////////////////////////////////////////header xml version=\"1.0\"\n///document.write('<?xml version=\"1.0\" ?>\\r\\n'); \n\n\n///////////////////////////////////////////////////// <mods:relatedItem type=\"constituent\">\n///////////////////////////////////////////////////////////// <mods:identifier type = \"local\"\n\n\nvar atiff = new Array();\nvar alist = new String();\n alist = parent.U.document.UF.file_list_tiff.value;\n atiff = alist.split(\",\");\nvar strCFN = new String();//strConstituentFileName\n\nvar numC = atiff.length;///parent.U.document.UF.numConstituentsTIFF.value;\n\n\n\nps[ps.length]= new String(obrak+'mods:relatedItem type=\"constituent\">\\r\\n');\nfor(j=0;j<numC; j++) {\n\n\n\nstrCFN = new String(atiff[j]);\nstrCFN = strCFN.replace(/ /g,\"\");\n/////alert(\"j=\"+j+\" strCFN=\"+strCFN);\n\n\t\nif ( strCFN != \"undefined\" && strCFN != \"\" ) {\nps[ps.length]= new String(obrak+'mods:identifier type=\"local\">'\n\t+ bfont+strCFN+efont\n\t+ obrak+'/mods:identifier>\\r\\n'\n\t);\n}// end if\n\n\n}//end for loop\n\n\nps[ps.length]= new String(obrak+'/mods:relatedItem >\\r\\n');\n\n///////////////////////////////////////////////////// <mods:identifier type=\"uri\"\n\n\n\nps[ps.length]= new String(obrak+'mods:identifier type=\"uri\">'\n\t/////+ bfont + document.FormOne.constituent_file_uri_1.value + efont +' \\r\\n'\n\t+ obrak+'/mods:identifier>\\r\\n'\n\t);\n\n\n\n\n\n\n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// close mods\n\n\n////////////////ps[ps.length]= new String(obrak+'/mods:mods>\\r\\n');\n\n///////////////////////////////////////////////////////////////////////////////////// chd\n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n\n\nreturn(ps);\n\n\n}///end function buildTagsArray_page_05()", "title": "" }, { "docid": "45f5f1d8a8dd3354134fd4ad9d8e3fc6", "score": "0.5107555", "text": "function convert_pl_xml(filename, cb) {\n\tvar fname = path.basename(filename),\n\t\td_str = 'digraph ' + fname.substring(0, fname.lastIndexOf('.')) + ' {\\node [shape=plaintext];',\n\t\td_str_es = '//Edges \\n'; //Edges string buffer\n\n\t// Create a file stream and pass it to XmlStream\n\tvar stream = fs.createReadStream(path.join(__dirname, filename)),\n\t\txml = new XmlStream(stream);\n\n\n\txml.collect('branch');\n\txml.collect('node');\n\txml.collect('segment');\n\n\tvar curr_bName = '',\n\t\tseg_cnt = 0;\n\txml.on('error', function(err) {\n\t\tconsole.log(\"...Error in stream: \"+err);\n\t\tcb(\"Error Occurred\"+err);\n\t});\n\txml.on('startElement: branch', function (item) {\n\t\tconsole.log(\"...... startElement: branch\");\n\t\tcurr_bName = item['$']['basename'];\n\t\tseg_cnt = 0;\n\t});\n\txml.on('startElement: segment', function (item) {\n\t\tconsole.log(\"...... startElement: segment\");\n\t\tseg_cnt = seg_cnt + 1;\n\t});\n\txml.on('updateElement: node', function (item) {\n\t\tconsole.log(\"...... updateElement: node\");\n\t\tconsole.log(\"......>>> item: \" + JSON.stringify(item));\n\t\tvar nLabel = item.$.name,\n\t\t\tnTxt = ' ';\n\t\tif (item.hasOwnProperty('start-node')) {\n\t\t\tnTxt = ' image=\"../../../icons/pipeline_start_node.gif\"];';\n\t\t} else if (item.hasOwnProperty('end-node')) {\n\t\t\tnTxt = ' image=\"../../../icons/pipeline_end_node.gif\"];';\n\t\t} else if (item.hasOwnProperty('interaction-node')) {\n\t\t\tnTxt = ' image=\"../../../icons/pipeline_interaction_node.gif\"];';\n\t\t} else if (item.hasOwnProperty('loop-node')) {\n\t\t\tnTxt = ' image=\"../../../icons/pipeline_loop_node.gif\"];';\n\t\t} else if (item.hasOwnProperty('jump-node')) {\n\t\t\tnTxt = ' image=\"../../../icons/pipeline_jump_node.gif\"];';\n\t\t} else if (item.hasOwnProperty('pipelet-node')) {\n\t\t\tnTxt = ' image=\"../../../icons/pipeline_pipelet_node.gif\"];';\n\t\t} else if (item.hasOwnProperty('join-node')) {\n\t\t\tnTxt = ' image=\"../../../icons/pipeline_join_node.gif\"];';\n\t\t} else if (item.hasOwnProperty('decision-node')) {\n\t\t\tnTxt = ' image=\"../../../icons/pipeline_decision_node.gif\"];';\n\t\t}\n\t\td_str += \"\\n\" + curr_bName + \".\" + seg_cnt + nTxt;\n\t\tconsole.log(\"........ d_str: \" + d_str);\n\t});\n\txml.on('end', function (data) {\n\t\tconsole.log(\"... d_str: \" + d_str);\n\t\tcb(d_str + '\\n' + d_str_es + '\\n}\\n');\n\t});\n}", "title": "" }, { "docid": "dc2891328e51f0d918f6093e0d1ef0b1", "score": "0.5091372", "text": "function _printStructure(currentDict, preSpace){\n\tif(currentDict['name'] == 'node_modules' || currentDict['name'] == '.git' )\n\t\treturn;\n\t/*if(currentDict['name'] == 'public'){\n\t\tconsole.log(JSON.stringify(currentDict['desc']));\n\t}*/\n\tconsole.log();\n\tconsole.log(preSpace+'{\\n'+preSpace+' name:'+currentDict['name']);\n\tconsole.log(preSpace+' type:'+currentDict['type']);\n\tconsole.log(preSpace+' level:'+currentDict['level']);\n\tconsole.log(preSpace+' prefix:'+currentDict['prefix']);\n\tif(currentDict['desc'] != null){\n\t\tconsole.log(preSpace+' desc:');\n\t\tObject.keys(currentDict['desc']).forEach(function(key) {\n\t\t\t//console.log(key);\n\t\t\t_printStructure(currentDict['desc'][key], preSpace+' ');\n\t\t});\n\t}\n\tconsole.log(preSpace+'}');\n}", "title": "" }, { "docid": "69252eea7e97868c5c50b59aa5b0695e", "score": "0.50746846", "text": "function wm_write_gml_to_console()\n{\n\tvar wm_gml_data = points + \"</drawing></tag></GML>\";\n console.log(wm_gml_data); \n}", "title": "" }, { "docid": "ec7c87a6ded0ceb734cb8d485c99fbc5", "score": "0.5045005", "text": "function writeNode(state,level,object,block,compact,iskey){state.tag=null;state.dump=object;if(!detectType(state,object,false)){detectType(state,object,true);}var type=_toString.call(state.dump);if(block){block=state.flowLevel<0||state.flowLevel>level;}var objectOrArray=type==='[object Object]'||type==='[object Array]',duplicateIndex,duplicate;if(objectOrArray){duplicateIndex=state.duplicates.indexOf(object);duplicate=duplicateIndex!==-1;}if(state.tag!==null&&state.tag!=='?'||duplicate||state.indent!==2&&level>0){compact=false;}if(duplicate&&state.usedDuplicates[duplicateIndex]){state.dump='*ref_'+duplicateIndex;}else{if(objectOrArray&&duplicate&&!state.usedDuplicates[duplicateIndex]){state.usedDuplicates[duplicateIndex]=true;}if(type==='[object Object]'){if(block&&Object.keys(state.dump).length!==0){writeBlockMapping(state,level,state.dump,compact);if(duplicate){state.dump='&ref_'+duplicateIndex+state.dump;}}else{writeFlowMapping(state,level,state.dump);if(duplicate){state.dump='&ref_'+duplicateIndex+' '+state.dump;}}}else if(type==='[object Array]'){var arrayLevel=state.noArrayIndent&&level>0?level-1:level;if(block&&state.dump.length!==0){writeBlockSequence(state,arrayLevel,state.dump,compact);if(duplicate){state.dump='&ref_'+duplicateIndex+state.dump;}}else{writeFlowSequence(state,arrayLevel,state.dump);if(duplicate){state.dump='&ref_'+duplicateIndex+' '+state.dump;}}}else if(type==='[object String]'){if(state.tag!=='?'){writeScalar(state,state.dump,level,iskey);}}else{if(state.skipInvalid)return false;throw new YAMLException('unacceptable kind of an object to dump '+type);}if(state.tag!==null&&state.tag!=='?'){state.dump='!<'+state.tag+'> '+state.dump;}}return true;}", "title": "" }, { "docid": "b2544481f4accee2e6a19ab1807df4c8", "score": "0.5041893", "text": "function exportTree() {\n\tvar initialIndent = 1;\n\tif (document.getElementById(\"use-custom-indent\").checked) {\n\t\tinitialIndent = parseInt(document.getElementById(\"custom-indent\").value, 10);\n\t}\n\n\t\n\tdocument.getElementById(\"output\").innerText = stringify(dialogueTree, initialIndent, null);\n\treturn;\n\t\n\tvar itemsToParse = [dialogueTree];\n\n\twhile (itemsToParse.length) {\n\t\tvar next = itemsToParse[0];\n\t}\n\t\n}", "title": "" }, { "docid": "378a25728794da810683b259ab883d8e", "score": "0.5035636", "text": "function xml2json(xml, tab) {\n var X = {\n toObj: function (xml) {\n var o = {};\n if (xml.nodeType == 1) { // element node ..\n if (xml.attributes.length) // element with attributes ..\n for (var i = 0; i < xml.attributes.length; i++)\n o[\"@\" + xml.attributes[i].nodeName] = (xml.attributes[i].nodeValue || \"\").toString();\n if (xml.firstChild) { // element has child nodes ..\n var textChild = 0, cdataChild = 0, hasElementChild = false;\n for (var n = xml.firstChild; n; n = n.nextSibling) {\n if (n.nodeType == 1) hasElementChild = true;\n else if (n.nodeType == 3 && n.nodeValue.match(/[^ \\f\\n\\r\\t\\v]/)) textChild++; // non-whitespace text\n else if (n.nodeType == 4) cdataChild++; // cdata section node\n }\n if (hasElementChild) {\n if (textChild < 2 && cdataChild < 2) { // structured element with evtl. a single text or/and cdata node ..\n X.removeWhite(xml);\n for (var n = xml.firstChild; n; n = n.nextSibling) {\n if (n.nodeType == 3) // text node\n o[\"#text\"] = X.escape(n.nodeValue);\n else if (n.nodeType == 4) // cdata node\n o[\"#cdata\"] = X.escape(n.nodeValue);\n else if (o[n.nodeName]) { // multiple occurence of element ..\n if (o[n.nodeName] instanceof Array)\n o[n.nodeName][o[n.nodeName].length] = X.toObj(n);\n else\n o[n.nodeName] = [o[n.nodeName], X.toObj(n)];\n }\n else // first occurence of element..\n o[n.nodeName] = X.toObj(n);\n }\n }\n else { // mixed content\n if (!xml.attributes.length)\n o = X.escape(X.innerXml(xml));\n else\n o[\"#text\"] = X.escape(X.innerXml(xml));\n }\n }\n else if (textChild) { // pure text\n if (!xml.attributes.length)\n o = X.escape(X.innerXml(xml));\n else\n o[\"#text\"] = X.escape(X.innerXml(xml));\n }\n else if (cdataChild) { // cdata\n if (cdataChild > 1)\n o = X.escape(X.innerXml(xml));\n else\n for (var n = xml.firstChild; n; n = n.nextSibling)\n o[\"#cdata\"] = X.escape(n.nodeValue);\n }\n }\n if (!xml.attributes.length && !xml.firstChild) o = null;\n }\n else if (xml.nodeType == 9) { // document.node\n o = X.toObj(xml.documentElement);\n }\n else\n alert(\"unhandled node type: \" + xml.nodeType);\n return o;\n },\n toJson: function (o, name, ind) {\n var json = name ? (\"\\\"\" + name + \"\\\"\") : \"\";\n if (o instanceof Array) {\n for (var i = 0, n = o.length; i < n; i++)\n o[i] = X.toJson(o[i], \"\", ind + \"\\t\");\n json += (name ? \":[\" : \"[\") + (o.length > 1 ? (\"\\n\" + ind + \"\\t\" + o.join(\",\\n\" + ind + \"\\t\") + \"\\n\" + ind) : o.join(\"\")) + \"]\";\n }\n else if (o == null)\n json += (name && \":\") + \"null\";\n else if (typeof (o) == \"object\") {\n var arr = [];\n for (var m in o)\n arr[arr.length] = X.toJson(o[m], m, ind + \"\\t\");\n json += (name ? \":{\" : \"{\") + (arr.length > 1 ? (\"\\n\" + ind + \"\\t\" + arr.join(\",\\n\" + ind + \"\\t\") + \"\\n\" + ind) : arr.join(\"\")) + \"}\";\n }\n else if (typeof (o) == \"string\")\n json += (name && \":\") + \"\\\"\" + o.toString() + \"\\\"\";\n else\n json += (name && \":\") + o.toString();\n return json;\n },\n innerXml: function (node) {\n var s = \"\"\n if (\"innerHTML\" in node)\n s = node.innerHTML;\n else {\n var asXml = function (n) {\n var s = \"\";\n if (n.nodeType == 1) {\n s += \"<\" + n.nodeName;\n for (var i = 0; i < n.attributes.length; i++)\n s += \" \" + n.attributes[i].nodeName + \"=\\\"\" + (n.attributes[i].nodeValue || \"\").toString() + \"\\\"\";\n if (n.firstChild) {\n s += \">\";\n for (var c = n.firstChild; c; c = c.nextSibling)\n s += asXml(c);\n s += \"</\" + n.nodeName + \">\";\n }\n else\n s += \"/>\";\n }\n else if (n.nodeType == 3)\n s += n.nodeValue;\n else if (n.nodeType == 4)\n s += \"<![CDATA[\" + n.nodeValue + \"]]>\";\n return s;\n };\n for (var c = node.firstChild; c; c = c.nextSibling)\n s += asXml(c);\n }\n return s;\n },\n escape: function (txt) {\n return txt.replace(/[\\\\]/g, \"\\\\\\\\\")\n .replace(/[\\\"]/g, '\\\\\"')\n .replace(/[\\n]/g, '\\\\n')\n .replace(/[\\r]/g, '\\\\r');\n },\n removeWhite: function (e) {\n e.normalize();\n for (var n = e.firstChild; n;) {\n if (n.nodeType == 3) { // text node\n if (!n.nodeValue.match(/[^ \\f\\n\\r\\t\\v]/)) { // pure whitespace text node\n var nxt = n.nextSibling;\n e.removeChild(n);\n n = nxt;\n }\n else\n n = n.nextSibling;\n }\n else if (n.nodeType == 1) { // element node\n X.removeWhite(n);\n n = n.nextSibling;\n }\n else // any other node\n n = n.nextSibling;\n }\n return e;\n }\n };\n if (xml.nodeType == 9) // document node\n xml = xml.documentElement;\n var json = X.toJson(X.toObj(X.removeWhite(xml)), xml.nodeName, \"\\t\");\n return \"{\\n\" + tab + (tab ? json.replace(/\\t/g, tab) : json.replace(/\\t|\\n/g, \"\")) + \"\\n}\";\n}", "title": "" }, { "docid": "d93778bde5b34354beb1188a506fbd03", "score": "0.5029832", "text": "function html_action() {\nxml.p(\n \"First Line\", \n xml.closedNode(\"br\"),\n \"Second Line\" \n).writeln();\nxml.closedNode(\"hr\", {size:\"2\", noshade:\"noshade\"}).writeln();\n \n \nxml.open(\"body\", {bgcolor:\"yellow\"}).writeln();\nxml.node(\"h1\", (\">>Hello World & Welcome!<<\").encodeXml()).writeln();\nxml.node(\"hr\").writeln(); // => <hr />\nxml.node(\"p\", \"This is \", xml.node(\"a\", {href: \"http://helma.org\"}, \"helma\"), \" speaking!\").writeln();\nxml.close(\"body\").writeln();\n\n return;\n with (xml) { res.writeln(\n xmlDeclaration(), // <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n html( // <html>\n head( // <head>\n title(\"History\") // <title>History</title>\n ), // </head>\n body ( // <body>\n comment(\"HI\"), // <!-- HI -->\n h1(\"Header\"), // <h1>Header</h1>\n p(<span class=\"red\">\n even e4x works\n </span>) // <p><span class=\"red\">even e4x works</span></p>\n ) // </body>\n ) // </html> \n )} //\n return; \n with (html) { res.writeln(\n p(\"Zeile 1\"),\n p(),\n p({\"class\":\"red\"}),\n p(\"Zeile 2\", br(), \"Zeile 3\"),\n p(<span class=\"red\">\n Even E4X works.\n </span>),\n p(\"Hello \", a({href:\"http://www.helma.org\"}, \"Helma\"), \"!\")\n )} \n return;\n with (html) { \n xmlDeclaration().writeln();\n doctype(\"xhtml\").writeln();\n openTag(\"html\", {lang:\"en\"}).writeln();\n openTag(\"body\").writeln();\n comment(\"code written by http.js for helma-ng\").writeln();\n h1(\"hello\").writeln();\n div(\n p(\n \"Das ist der erste \", em(\"Absatz\"), \" mit einem \", \n a({href:\"http://helma.org\", \"xml:lang\":\"en\"}, \"Link\"), \"!!!\", br(),\n \"Und einer zweiten Zeile.\",\n tag(\"isbn:number\", \"876868-979\")\n )\n ).writeln();\n p(<span style=\"color:red\">This is a red <em>span</em></span>).writeln()\n p(<span style=\"color:yellow\">This is a yellow span</span>).writeln() \n/* script({type:\"text/javascript\"}, \n 'alert(\"hello!\")'\n ).writeln(); */\n closeTag(\"body\").writeln();\n closeTag(\"html\").writeln();\n }\n}", "title": "" }, { "docid": "d18cc414773f99511bf0d45e7da1cbcf", "score": "0.50262547", "text": "function buildTagsArray_page_03(N){\n//alert(\"buildTagsArray_page_03\");\n\n\n//N=0 no red, use '<' in xml tag\n//N>0 insert red use '&#060;' (prev '&lt;') in xml tag to make html viewable\n\nvar NI = 0;\nif ( N == \"0\" ) { NI=0; } else { NI=1; }\n\n\nvar bfont= new String(BFONT[NI]);\nvar efont= new String(EFONT[NI]);\n\tvar obrak= new String(OBRAK[NI]);\n\nvar ps=new Array();\n\n//ps[ps.length] = new String(\"<-- page_03 -->\");\n\n/////////////////////////////////////////////////////header xml version=\"1.0\"\n///document.write('<?xml version=\"1.0\" ?>\\r\\n'); \n\n\n\t\n\n///////////////////////////////////////////////////// <mods:language\n///////////////////////////////////////////////////////////// <mods:languageTerm\n\n\nps[ps.length]= new String(obrak+'mods:language>\\r\\n');\n\n\nps[ps.length]= new String(obrak+'mods:languageTerm type=\"code\" authority=\"iso639-2b\">'\n\t+ bfont +document.forms[0].language.value + efont \n\t+ obrak +'/mods:languageTerm>\\r\\n'\n\t);\n\nps[ps.length]= new String(obrak+'/mods:language>\\r\\n');\n\t\n///////////////////////////////////////////////////// <mods:typeOfResource\n\n//type_of_resource_01 is required\nps[ps.length]= new String(obrak+'mods:typeOfResource>'\n\t+ bfont +document.forms[0].type_of_resource_01.value + efont \n\t+ obrak +'/mods:typeOfResource>\\r\\n'\n\t);\n \n\n\n//do not make empty tag for type_of_resource_02\nif ( document.forms[0].type_of_resource_02.value.length > 0 ) {\nps[ps.length]= new String(obrak+'mods:typeOfResource>'\n\t+ bfont +document.forms[0].type_of_resource_02.value + efont \n\t+ obrak +'/mods:typeOfResource>\\r\\n'\n\t);\n}\n\n//do not make empty tag for type_of_resource_03\nif ( document.forms[0].type_of_resource_03.value.length > 0 ) {\nps[ps.length]= new String(obrak+'mods:typeOfResource>'\n\t+ bfont +document.forms[0].type_of_resource_03.value + efont \n\t+ obrak +'/mods:typeOfResource>\\r\\n'\n\t);\n}\n\n\n\n\n///////////////////////////////////////////////////// <mods:subject\n///////////////////////////////////////////////////////////// <mods:genre\n\n\nvar genre_authority_tag_display = new String(\"\");\n\nif (document.forms[0].mods_genre_radio[0].checked) {\n \tgenre_authority_tag_display = 'authority=\"'+bfont+'aat'+efont+'\" ';\n}else if (document.forms[0].mods_genre_radio[1].checked) {\n \tgenre_authority_tag_display = 'authority=\"'+bfont+'nmc'+efont+'\" ';\n}else if (document.forms[0].mods_genre_radio[2].checked) {\n\tgenre_authority_tag_display = 'authority=\"'+bfont+'marcgt'+efont+'\" ';\n}\n\n\n\n\nps[ps.length]= new String(obrak+'mods:genre '+ genre_authority_tag_display + '>'\n\t+ bfont + replace_apos(document.forms[0].mods_genre.value) + efont \n\t+ obrak +'/mods:genre>\\r\\n'\n\t);\n\n\t\n\n\n\n\n///////////////////////////////////////////////////// <mods:physicalDescription\n///////////////////////////////////////////////////////////// <mods:form type=\"technique\"\n///////////////////////////////////////////////////////////// <mods:form type=\"medium\" \n///////////////////////////////////////////////////////////// <mods:digitalOrigin\n///////////////////////////////////////////////////////////// <mods:internetMediaType\n///////////////////////////////////////////////////////////// <mods:extent (pages;dimensions)\n\n\n\nps[ps.length]= new String(obrak+'mods:physicalDescription>\\r\\n');\n\n\n\n///form_type_technique\n///input box on museum page, tag built on page 3\n///do not build empty tag\nif ( document.forms[0].museum_form_type_technique.value.length > 0 ) {\nps[ps.length]= new String(obrak+'mods:form type=\"technique\" authority=\"aat\">'\n\t+ bfont + replace_apos(document.forms[0].museum_form_type_technique.value) + efont\n\t+ obrak+'/mods:form>\\r\\n'\n\t);\n\n}///end if\n\n///form_type_medium\n///input box on museum page, tag built on page 3\n///do not build empty tag\nif ( document.forms[0].museum_form_type_medium.value.length > 0 ) {\nps[ps.length]= new String(obrak+'mods:form type=\"medium\" authority=\"aat\">'\n\t+ bfont + replace_apos(document.forms[0].museum_form_type_medium.value) + efont \n\t+ obrak+'/mods:form>\\r\\n'\n\t);\n}//end if\n\nps[ps.length]= new String(obrak+'mods:digitalOrigin>'\n\t+ bfont + document.forms[0].digital_origin.value + efont \n\t+ obrak+'/mods:digitalOrigin>\\r\\n'\n\t);\n\n////THIS IS A HIDDEN FIELD THAT DOES NOT DISPLAY ON THE WEB FORM\nps[ps.length]= new String(obrak+'mods:internetMediaType>'\n\t+ bfont + document.forms[0].internetmediatype.value + efont \n\t+ obrak+'/mods:internetMediaType>\\r\\n'\n\t);\n\n\n///////parse extent fields for correct display\nvar strExtent = new String(\"\");\nvar numExtent = 0;\n\nif ( document.forms[0].extent_pages.value.length > 0 ) {\n\t///alert(\"document.forms[0].extent_pages.value=\\n>>\"+document.forms[0].extent_pages.value+\"<<\");\n\tstrExtent = document.forms[0].extent_pages.value+ \" digital images; \";\n\tnumExtent++;\n\t}\n\nif ( document.forms[0].extent_number_of_objects.value.length > 0 ) {\n\tstrExtent += document.forms[0].extent_number_of_objects.value ;\n\tnumExtent++;\n\t}\n\n\nif ( document.forms[0].extent_dimensions.value.length > 0 ) {\n\tstrExtent += \"; \" + document.forms[0].extent_dimensions.value;\n\tnumExtent++;\n\t}\n\nif ( numExtent < 2 ) {\n\tstrExtent = strExtent.replace(/;/g,'');\n\t}\n\n///////do not generate an empty tag for extent\n\nif ( numExtent > 0 ) {\n\nps[ps.length]= new String(obrak+'mods:extent>'\n\t+ bfont + replace_apos(strExtent) + efont \n\t+ obrak+'/mods:extent>\\r\\n'\n\t);\n\n}\n\t\t\t\n\t\nps[ps.length]= new String(obrak+'/mods:physicalDescription>\\r\\n');\n\n\n///////////////////////////////////////////////////// <mods:abstract\n\n\n///////do not generate an empty tag for abstract\nif ( document.forms[0].abstract.value != \"\" ) {\nps[ps.length]= new String(obrak+'mods:abstract>'\n\t+ bfont + replace_apos(document.forms[0].abstract.value) + efont \n\t+ obrak+'/mods:abstract>\\r\\n'\n\t);\n}\n\t\n\n\n\n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// close mods\n\n\n//////////////ps[ps.length]= new String(obrak+'/mods:mods>\\r\\n');\n\n///////////////////////////////////////////////////////////////////////////////////// chd\n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n\n\nreturn(ps);\n\n\n}///end function buildTagsArray_page_03()", "title": "" }, { "docid": "207aba085ebd0568a7abe21bf7046a72", "score": "0.50200325", "text": "function pretty_print(str) {\n\t\tvar div = document.createElement('div');\n\t\tdiv.textContent = str;\n\t\tdiv.setAttribute('class', 'print');\n\t\tdocument.body.appendChild(div);\n}", "title": "" }, { "docid": "065197ba55b3928ac2a07c337ec0d238", "score": "0.50176", "text": "function updatePretty() {\n var codeBlocks = $(\"pre, code\");\n var rePretty = false;\n for (var i = 0; i < codeBlocks.length; i++) {\n var codeBlock = codeBlocks[i];\n var curClass = codeBlock.getAttribute('class') || \"\";\n if (!curClass.includes(\"prettyprint\")) {\n rePretty = true;\n var found = $(codeBlock).text().toLowerCase().match(\"^(lang-.*?):\");\n curClass = curClass + \" prettyprint\";\n if (found) {\n curClass = curClass + \" \" + found[1];\n codeBlock.innerHTML = codeBlock.innerHTML.replace(/^lang-.*?:/i, \"\");\n }\n\n codeBlock.setAttribute(\"class\", curClass);\n }\n }\n\n var expanders = $(\".more-data\");\n\n for (var i = 0; i < expanders.length; i++) {\n var expander = expanders[i];\n if (!expander.isBound) {\n expander.isBound = true;\n $(expander).click(function() {\n var tied = $(this.parentNode).find(\"pre\")[0];\n setTimeout(function() {\n var olClass = tied.getAttribute(\"class\");\n tied.setAttribute(\"class\", olClass.replace(\"prettyprinted\", \"\"));\n PR.prettyPrint();\n }, 1000);\n });\n }\n }\n\n if (rePretty)\n PR.prettyPrint();\n }", "title": "" }, { "docid": "0c076554e54819d0b2567457177def28", "score": "0.5015065", "text": "function prettyPrintDOMNode(domNode, nonFirst, tabToUse, convertToLower) {\r\n if (!nonFirst) {\r\n tabcount = 0;\r\n if (tabToUse == null) {\r\n tabCharactors = \"\\t\";\r\n } else {\r\n tabCharactors = tabToUse;\r\n }\r\n }\r\n if (domNode == null) {\r\n return \"\";\r\n }\r\n var dom_text = \"\";\r\n var dom_node_value = \"\";\r\n var len = domNode.childNodes.length;\r\n if (len > 0) {\r\n if (domNode.nodeName != \"#document\") {\r\n if (nonFirst) {\r\n dom_text += \"\\n\";\r\n }\r\n dom_text += getCurTabs();\r\n dom_text +=\r\n \"<\" + getTrueDOMNodeNameFromNode(domNode, convertToLower) + getAttributeText(domNode) +\r\n \">\";\r\n tabcount++;\r\n }\r\n for (var i = 0; i < len; i++) {\r\n if (i == 0) {\r\n dom_text += prettyPrintDOMNode(domNode.childNodes[i], true, \"\", convertToLower);\r\n } else {\r\n dom_text += prettyPrintDOMNode(domNode.childNodes[i], true, \"\", convertToLower);\r\n }\r\n }\r\n if (domNode.nodeName != \"#document\") {\r\n tabcount--;\r\n if (!(domNode.childNodes.length == 1 && domNode.childNodes[0].nodeName == \"#text\")) {\r\n dom_text += \"\\n\" + getCurTabs();\r\n }\r\n dom_text += \"</\" + getTrueDOMNodeNameFromNode(domNode, convertToLower) + \">\";\r\n }\r\n\r\n } else {\r\n if (domNode.nodeName == \"#text\") {\r\n dom_text += domNode.nodeValue;\r\n }else if (domNode.nodeName == \"#comment\") {\r\n dom_text += \"\\n\" + getCurTabs() + \"<!--\" + domNode.nodeValue + \"-->\";\r\n }else {\r\n dom_text += \"\\n\" +\r\n getCurTabs() + \"<\" + getTrueDOMNodeNameFromNode(domNode, convertToLower) +\r\n getAttributeText(domNode) +\r\n \"/>\";\r\n }\r\n }\r\n return dom_text;\r\n}", "title": "" }, { "docid": "a4d0109650e253d8e6b1177b3e0643e2", "score": "0.50096464", "text": "function xml2json(xml, tab) {\r\n var X = {\r\n toObj: function(xml) {\r\n var o = {};\r\n if (xml.nodeType==1) { // element node ..\r\n if (xml.attributes.length) // element with attributes ..\r\n for (var i=0; i<xml.attributes.length; i++)\r\n \t {\r\n \t \tvar attrName = xml.attributes[i].nodeName;\t\t\r\n \t \tvar start = attrName.substring(0,1);\r\n \t \tstart = start.toLowerCase();\r\n \t \tattrName = start+attrName.substring(1);\r\n \t \tattrValue = xml.attributes[i].nodeValue;\r\n \t \tif(attrValue == \"true\")\r\n \t \t{\r\n \t \t\to[attrName] = true;\t\r\n \t \t}\r\n \t \telse if(attrValue == \"false\")\r\n \t \t{\r\n \t \t\to[attrName] = false;\t\r\n \t \t}\r\n \t \telse\r\n \t \t{\r\n \t \t\to[attrName] = X.escape((attrValue||\"\").toString());\r\n \t \t}\r\n \t\r\n \t }\r\n if (xml.firstChild) { // element has child nodes ..\r\n var textChild=0, cdataChild=0, hasElementChild=false;\r\n for (var n=xml.firstChild; n; n=n.nextSibling) {\r\n if (n.nodeType==1) hasElementChild = true;\r\n else if (n.nodeType==3 && n.nodeValue.match(/[^ \\f\\n\\r\\t\\v]/)) textChild++; // non-whitespace text\r\n else if (n.nodeType==4) cdataChild++; // cdata section node\r\n }\r\n if (hasElementChild) {\r\n if (textChild < 2 && cdataChild < 2) { // structured element with evtl. a single text or/and cdata node ..\r\n X.removeWhite(xml);\r\n for (var n=xml.firstChild; n; n=n.nextSibling) {\r\n \tif(n.nodeType != 8 || n.nodeName != \"#comment\")\r\n \t{\r\n\t if (n.nodeType == 3) // text node\r\n\t o[\"#text\"] = X.escape(n.nodeValue);\r\n\t else if (n.nodeType == 4) // cdata node\r\n\t o[\"#cdata\"] = X.escape(n.nodeValue);\r\n\t else if (o[n.nodeName]) { // multiple occurence of element ..\r\n\t if (o[n.nodeName] instanceof Array)\r\n\t o[n.nodeName][o[n.nodeName].length] = X.toObj(n);\r\n\t else\r\n\t o[n.nodeName] = [o[n.nodeName], X.toObj(n)];\r\n\t }\r\n\t else // first occurence of element..\r\n\t o[n.nodeName] = X.toObj(n);\r\n \t}\r\n }\r\n }\r\n else { // mixed content\r\n if (!xml.attributes.length)\r\n o = X.escape(X.innerXml(xml));\r\n else\r\n o[\"#text\"] = X.escape(X.innerXml(xml));\r\n }\r\n }\r\n else if (textChild) { // pure text\r\n if (!xml.attributes.length)\r\n o = X.escape(X.innerXml(xml));\r\n else\r\n o[\"#text\"] = X.escape(X.innerXml(xml));\r\n }\r\n else if (cdataChild) { // cdata\r\n if (cdataChild > 1)\r\n o = X.escape(X.innerXml(xml));\r\n else\r\n for (var n=xml.firstChild; n; n=n.nextSibling)\r\n o[\"#cdata\"] = X.escape(n.nodeValue);\r\n }\r\n }\r\n if (!xml.attributes.length && !xml.firstChild) o = null;\r\n }\r\n else if (xml.nodeType==9) { // document.node\r\n o = X.toObj(xml.documentElement);\r\n }\r\n else\r\n \treturn null;\r\n // console.log(\"unhandled node type: \" + xml.nodeType);\r\n \r\n return o;\r\n },\r\n toJson: function(o, name, ind) {\r\n var json = name ? (\"\\\"\"+name+\"\\\"\") : \"\";\r\n if (o instanceof Array) {\r\n for (var i=0,n=o.length; i<n; i++)\r\n o[i] = X.toJson(o[i], \"\", ind+\"\\t\");\r\n json += (name?\":[\":\"[\") + (o.length > 1 ? (\"\\n\"+ind+\"\\t\"+o.join(\",\\n\"+ind+\"\\t\")+\"\\n\"+ind) : o.join(\"\")) + \"]\";\r\n }\r\n else if (o == null)\r\n json += (name&&\":\") + \"null\";\r\n else if (typeof(o) == \"object\") {\r\n var arr = [];\r\n for (var m in o)\r\n arr[arr.length] = X.toJson(o[m], m, ind+\"\\t\");\r\n json += (name?\":[{\":\"{\") + (arr.length > 1 ? (\"\\n\"+ind+\"\\t\"+arr.join(\",\\n\"+ind+\"\\t\")+\"\\n\"+ind) : arr.join(\"\")) + (name?\"}]\":\"}\");\r\n }\r\n else if (typeof(o) == \"string\")\r\n json += (name&&\":\") + \"\\\"\" + o.toString() + \"\\\"\";\r\n else\r\n json += (name&&\":\") + o.toString();\r\n return json;\r\n },\r\n innerXml: function(node) {\r\n var s = \"\"\r\n if (\"innerHTML\" in node)\r\n s = node.innerHTML;\r\n else {\r\n var asXml = function(n) {\r\n var s = \"\";\r\n if (n.nodeType == 1) {\r\n s += \"<\" + n.nodeName;\r\n for (var i=0; i<n.attributes.length;i++)\r\n s += \" \" + n.attributes[i].nodeName + \"=\\\"\" + (n.attributes[i].nodeValue||\"\").toString() + \"\\\"\";\r\n if (n.firstChild) {\r\n s += \">\";\r\n for (var c=n.firstChild; c; c=c.nextSibling)\r\n s += asXml(c);\r\n s += \"</\"+n.nodeName+\">\";\r\n }\r\n else\r\n s += \"/>\";\r\n }\r\n else if (n.nodeType == 3)\r\n s += n.nodeValue;\r\n else if (n.nodeType == 4)\r\n s += \"<![CDATA[\" + n.nodeValue + \"]]>\";\r\n return s;\r\n };\r\n for (var c=node.firstChild; c; c=c.nextSibling)\r\n s += asXml(c);\r\n }\r\n return s;\r\n },\r\n escape: function(txt) {\r\n return txt.replace(/[\\\\]/g, \"\\\\\\\\\")\r\n .replace(/[\\\"]/g, '\\\\\"')\r\n .replace(/[\\']/g, '\\\\\\'')\r\n .replace(/[\\n]/g, '\\\\n')\r\n .replace(/[\\r]/g, '\\\\r');\r\n },\r\n removeWhite: function(e) {\r\n e.normalize();\r\n for (var n = e.firstChild; n; ) {\r\n if (n.nodeType == 3) { // text node\r\n if (!n.nodeValue.match(/[^ \\f\\n\\r\\t\\v]/)) { // pure whitespace text node\r\n var nxt = n.nextSibling;\r\n e.removeChild(n);\r\n n = nxt;\r\n }\r\n else\r\n n = n.nextSibling;\r\n }\r\n else if (n.nodeType == 1) { // element node\r\n X.removeWhite(n);\r\n n = n.nextSibling;\r\n }\r\n else // any other node\r\n n = n.nextSibling;\r\n }\r\n return e;\r\n }\r\n };\r\n if (xml.nodeType == 9) // document node\r\n xml = xml.documentElement;\r\n var json = X.toJson(X.toObj(X.removeWhite(xml)), xml.nodeName, \"\\t\");\r\n return \"{\\n\" + tab + (tab ? json.replace(/\\t/g, tab) : json.replace(/\\t|\\n/g, \"\")) + \"\\n}\";\r\n}", "title": "" }, { "docid": "00407766a684c843e6d4d78c12f8bbb2", "score": "0.50095403", "text": "function buildTagsArray_page_museum(N){\n//alert(\"buildTagsArray_page_museum\");\n//N=0 no red, use '<' in xml tag\n//N>0 insert red use '&#060;' (prev '&lt;') in xml tag to make html viewable\n\nvar NI = 0;\nif ( N == \"0\" ) { NI=0; } else { NI=1; }\n\n\nvar bfont= new String(BFONT[NI]);\nvar efont= new String(EFONT[NI]);\n\tvar obrak= new String(OBRAK[NI]);\n\nvar ps=new Array();\n\n//ps[ps.length] = new String(\"<-- page_07 -->\");\n\n/////////////////////////////////////////////////////header xml version=\"1.0\"\n///document.write('<?xml version=\"1.0\" ?>\\r\\n'); \n\n\n\n\n\t\n\n///////////////////////////////////////////////////// <mods:relatedItem type=\"constituent\">\n///////////////////////////////////////////////////// <mods:physicalDescription\n///////////////////////////////////////////////////////////// <mods:form type=\"technique\"\n///////////////////////////////////////////////////////////// <mods:form type=\"medium\" \n\nps[ps.length]= new String(obrak+'mods:physicalDescription>\\r\\n');\n\n\nps[ps.length]= new String(obrak+'mods:form type=\"technique\" authority=\"aat\">'\n\t+ bfont + replace_apos(document.forms[0].museum_form_type_technique.value) + efont \n\t+ obrak+'/mods:form>\\r\\n'\n\t);\n\n\nps[ps.length]= new String(obrak+'mods:form type=\"medium\" authority=\"aat\">'\n\t+ bfont + replace_apos(document.forms[0].museum_form_type_medium.value) + efont\n\t+ obrak+'/mods:form>\\r\\n'\n\t);\n\n\nps[ps.length]= new String(obrak+'/mods:physicalDescription>\\r\\n');\n\n////////This field is being dropped\n///////////////////////////////////////////////////// <mods:identifier type=\"accessionNumber\"\n\n/*-------------------------------------------------------------------------------------------\nps[ps.length]= new String(obrak+'mods:identifier type=\"accessionNumber\">'\n\t+ bfont + replace_apos(document.forms[0].museum_accession_number.value) + efont\n\t+ obrak+'/mods:identifier>\\r\\n'\n\t);\n---------------------------------------------------------------------------------------------*/\n\n///////////////////////////////////////////////////// <mods:note type=\"museumCredits\"\n\n\nps[ps.length]= new String(obrak+'mods:note type=\"museumCredits\">'\n\t+ bfont + replace_apos(document.forms[0].museum_credit_line.value) + efont \n\t+ obrak+'/mods:note>\\r\\n'\n\t);\n\n\n\n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// close mods\n\n\n//////////////ps[ps.length]= new String(obrak+'/mods:mods>\\r\\n');\n\n///////////////////////////////////////////////////////////////////////////////////// chd\n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n\n\nreturn(ps);\n\n\n}///end function buildTagsArray_page_museum()", "title": "" }, { "docid": "4d72c2566e28d9464880ecad35a5e1d9", "score": "0.500748", "text": "function dump() {\n const separator = '========\\n';\n\n $('dump-field').textContent = separator + 'Summary\\n' + separator +\n JSON.stringify({availableSpace: availableSpace}, null, 2) + '\\n' +\n separator + 'Usage And Quota\\n' + separator +\n JSON.stringify(dumpTreeToObj(), null, 2) + '\\n' + separator +\n 'Misc Statistics\\n' + separator +\n JSON.stringify(dumpStatisticsToObj(), null, 2);\n}", "title": "" }, { "docid": "c03cfcbbcb18aaaa559d321b2d645165", "score": "0.50031716", "text": "function print(ast) {\n\t return (0, _visitor.visit)(ast, { leave: printDocASTReducer });\n\t}", "title": "" }, { "docid": "c03cfcbbcb18aaaa559d321b2d645165", "score": "0.50031716", "text": "function print(ast) {\n\t return (0, _visitor.visit)(ast, { leave: printDocASTReducer });\n\t}", "title": "" }, { "docid": "490ac210d05233a18d88241c8a145727", "score": "0.49832362", "text": "function buildTagsArray_page_02(N){\n\t//alert(\"buildTagsArray_page_02\");\n\n\n\t//N=0 no red, use '<' in xml tag\n\t//N>0 insert red use '&#060;' (prev '&lt;') in xml tag to make html viewable\n\n\tvar NI = 0;\n\tif ( N == \"0\" ) { NI=0; } else { NI=1; }\n\n\t\n\tvar bfont= new String(BFONT[NI]);\n\tvar efont= new String(EFONT[NI]);\n\tvar obrak= new String(OBRAK[NI]);\n\nvar ps=new Array();\n\n\n/////////////////////////////////////////////////////header xml version=\"1.0\"\n///document.write('<?xml version=\"1.0\" ?>\\r\\n'); \n\n\n\n\n///////////////////////////////////////////////////// <mods:originInfo\n///////////////////////////////////////////////////////////// <mods:dateCreated\n///////////////////////////////////////////////////////////// <mods:place\n///////////////////////////////////////////////////////////////////// <mods:placeTerm\n///////////////////////////////////////////////////////////// <mods:publisher\n\n\n\nps[ps.length] = new String(obrak+'mods:originInfo>\\r\\n');\n\n\nvar keyDateDone=0;\n\nif ( document.forms[0].date_created.value != \"\" ) {//use date_created\nvar str_date_createdQ = new String('');\nif ( document.forms[0].date_createdQ.value != 'none' && document.forms[0].date_createdQ.value != \"\" ) {\n str_date_createdQ = 'qualifier=\"'+bfont+ document.forms[0].date_createdQ.value +efont+'\"';\n }\nkeyDateDone++;\nvar str_date_created = new String();\n str_date_created = document.forms[0].date_created.value;\n str_date_created = str_date_created.replace(/[a-z]/gi,'');\nps[ps.length] = new String(obrak+'mods:dateCreated '+ str_date_createdQ+' keyDate=\"yes\" encoding=\"w3cdtf\">'\n\t+ bfont + str_date_created + efont \n\t+ obrak+'/mods:dateCreated>\\r\\n'\n\t);\n\n}else{// date range tags\n\n\nvar str_date_created_begin = new String();\n str_date_created_begin = document.forms[0].date_created_begin.value;\n str_date_created_begin = str_date_created_begin.replace(/[a-z]/gi,'');\n str_date_created_begin = str_date_created_begin.replace(/ /gi,'');\nif ( str_date_created_begin.length > 0 ) {\nvar str_date_created_beginQ = new String('');\nif ( document.forms[0].date_created_beginQ.value != 'none' && document.forms[0].date_created_beginQ.value != \"\" ) {\n str_date_created_beginQ = 'qualifier=\"'+bfont+ document.forms[0].date_created_beginQ.value +efont +'\"';\n }\nkeyDateDone++;\nps[ps.length] = new String(obrak+'mods:dateCreated '+ str_date_created_beginQ+' keyDate=\"yes\" encoding=\"w3cdtf\" point=\"start\">'\n\t+ bfont + str_date_created_begin + efont\n\t+ obrak+'/mods:dateCreated>\\r\\n'\n\t);\n}\n\n\n\nvar str_date_created_end = new String();\n str_date_created_end = document.forms[0].date_created_end.value;\n str_date_created_end = str_date_created_end.replace(/[a-z]/gi,'');\n str_date_created_end = str_date_created_end.replace(/ /gi,'');\nif ( str_date_created_end.length > 0 ) {\nvar str_date_created_endQ = new String('');\nif ( document.forms[0].date_created_endQ.value != 'none' && document.forms[0].date_created_endQ.value != \"\" ) {\n str_date_created_endQ = 'qualifier=\"'+bfont+ document.forms[0].date_created_endQ.value +efont+'\"';\n }\nps[ps.length] = new String(obrak+'mods:dateCreated '+ str_date_created_endQ+' encoding=\"w3cdtf\" point=\"end\">'\n\t+ bfont + str_date_created_end + efont \n\t+ obrak+'/mods:dateCreated>\\r\\n'\n\t);\n}\n\n}//end date range tags\n\n\n///is this a required field - only when radio button yes is clicked\nif ( document.forms[0].date_issued.value.length > 0 ) {\nvar str_date_issuedQ = new String('');\n\nif ( document.forms[0].date_issuedQ.value != 'none' && document.forms[0].date_issuedQ.value != \"\") {\n str_date_issuedQ = 'qualifier=\"'+bfont+ document.forms[0].date_issuedQ.value+efont +'\"';\n }\n\nvar str_date_issued = new String();\n str_date_issued = document.forms[0].date_issued.value;\n str_date_issued = str_date_issued.replace(/[a-z]/gi,'');\nvar str_keyDate = new String(\"\");\nif ( keyDateDone == 0 ) {\n\tstr_keyDate = ' keyDate=\"yes\" ';\n\t}\nps[ps.length] = new String(obrak+'mods:dateIssued '+ str_date_issuedQ+str_keyDate+' encoding=\"w3cdtf\">'\n\t+ bfont + str_date_issued + efont\n\t+ obrak+'/mods:dateIssued>\\r\\n'\n\t);\n}\n\n\n//do not make tag for empty form vars\nif ( document.forms[0].place_of_origin.value != \"\" ) {\nps[ps.length]= new String(obrak+'mods:place>\\r\\n');\n\n\nps[ps.length]= new String(obrak+'mods:placeTerm>'\n\t+ bfont + replace_apos(document.forms[0].place_of_origin.value) + efont \n\t+ obrak+'/mods:placeTerm>\\r\\n'\n\t);\n\t\nps[ps.length]= new String(obrak+'/mods:place>\\r\\n');\n}\n\t\n\n\n//do not make unneeded comma\nvar myComma =new String(\"\");\nvar myPubName = new String(document.forms[0].publisher_name.value);\nvar myPubAddr = new String(document.forms[0].publisher_address.value);\n\nmyPubName = myPubName.replace(/ /g,'');\nmyPubAddr = myPubAddr.replace(/ /g,'');\n\nif ( myPubName.length > 0 && myPubAddr.length > 0 ) {\n\tmyComma = \", \";\n\t}\n\n\n//do not make tag for empty form vars\nif ( document.forms[0].publisher_name.value.length > 0 || document.forms[0].publisher_address.value.length > 0 ) {\nvar publisherNameAddress = new String();\n publisherNameAddress = document.forms[0].publisher_name.value+myComma+document.forms[0].publisher_address.value;\nps[ps.length]= new String(obrak+'mods:publisher>'\n\t+ bfont + replace_apos(publisherNameAddress) + efont\n\t+ obrak +'/mods:publisher>\\r\\n'\n\t);\n}\n\n\nps[ps.length]= new String(obrak+'/mods:originInfo>\\r\\n');\n\t\n\n\n\n\n\n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// close mods\n\n\n/////////////ps[ps.length]= new String(obrak+'/mods:mods>\\r\\n');\n\n///////////////////////////////////////////////////////////////////////////////////// chd\n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n///////////////////////////////////////////////////////////////////////////////////// \n\n\nreturn(ps);\n\n\n}///end function buildTagsArray_page_02()", "title": "" }, { "docid": "82de433719cc258b7db902bc50f31af2", "score": "0.49791202", "text": "BuildElement()\n {\n var el = this.Indent+\"<\"+this.Name+this.Attribute+\">\"+this.Value;\n if (this.Children.length==0)\n el += \"</\"+this.Name+\">\\n\";\n else\n el += \"\\n\";\n return el;\n }", "title": "" }, { "docid": "841142bcac5039392a9a51d3355f1c3f", "score": "0.49717662", "text": "function xmlminWithDefault() {\n VKBeautify.xmlmin(exampleContent);\n}", "title": "" }, { "docid": "44c40b4b7f7fc82bcc754e29f615b089", "score": "0.49713743", "text": "static layoutTreeDump(layoutState) {\n return this._dumpBox(layoutState, layoutState.rootContainer(), 1) + this._dumpTree(layoutState, layoutState.rootContainer(), 2);\n }", "title": "" }, { "docid": "725f2aa3086e5d67c39875585bf5e6d0", "score": "0.49696586", "text": "dump() {\n console.log(\n util.inspect(this, {\n colors: true,\n depth: null // unlimited depth\n })\n );\n }", "title": "" }, { "docid": "637e985b1c4127a96bb5ddaed74dfd0c", "score": "0.4965204", "text": "function parseTag ( element, depth )\n {\n text += \"-\".repeat(depth) + element.tagName + \"\\n\";\n }", "title": "" }, { "docid": "ac4b9f3878dc87d255e95b285413b566", "score": "0.4960683", "text": "function DumpParagraphs(pp) {\n for (var ii = 0; ii < pp.length; ++ii) { console.log(\"Content[\" + ii + \"] =\" + JSON.stringify(pp[ii])); }\n }", "title": "" }, { "docid": "3c4138152ecedd4b06e4df38f13249ca", "score": "0.49553743", "text": "function getAddressLabelXml()\n {\n var labelXml = '<?xml version=\"1.0\" encoding=\"utf-8\" ?>\\\n\t\t\t\t\t\t<DieCutLabel Version=\"8.0\" Units=\"twips\" MediaType=\"Default\">\\\n <PaperOrientation>Landscape</PaperOrientation>\\\n <Id>Address</Id>\\\n <PaperName>30252 Address</PaperName>\\\n <DrawCommands>\\\n <RoundRectangle X=\"0\" Y=\"0\" Width=\"1581\" Height=\"5040\" Rx=\"270\" Ry=\"270\"/>\\\n </DrawCommands>\\\n <ObjectInfo>\\\n <TextObject>\\\n <Name>TITLE</Name>\\\n <ForeColor Alpha=\"255\" Red=\"0\" Green=\"0\" Blue=\"0\"/>\\\n <BackColor Alpha=\"0\" Red=\"255\" Green=\"255\" Blue=\"255\"/>\\\n <LinkedObjectName></LinkedObjectName>\\\n <Rotation>Rotation0</Rotation>\\\n <IsMirrored>False</IsMirrored>\\\n <IsVariable>True</IsVariable>\\\n <HorizontalAlignment>Left</HorizontalAlignment>\\\n <VerticalAlignment>Middle</VerticalAlignment>\\\n <TextFitMode>AlwaysFit</TextFitMode>\\\n <UseFullFontHeight>True</UseFullFontHeight>\\\n <Verticalized>False</Verticalized>\\\n <StyledText>\\\n <Element>\\\n <String>Title text</String>\\\n <Attributes>\\\n <Font Family=\"Helvetica\" Size=\"13\" Bold=\"True\" Italic=\"False\" Underline=\"False\" Strikeout=\"False\"/>\\\n <ForeColor Alpha=\"255\" Red=\"0\" Green=\"0\" Blue=\"0\"/>\\\n </Attributes>\\\n </Element>\\\n </StyledText>\\\n </TextObject>\\\n <Bounds X=\"952.2937\" Y=\"178.3812\" Width=\"3376.462\" Height=\"382.6219\"/>\\\n </ObjectInfo>\\\n <ObjectInfo>\\\n <TextObject>\\\n <Name>DESC</Name>\\\n <ForeColor Alpha=\"255\" Red=\"0\" Green=\"0\" Blue=\"0\"/>\\\n <BackColor Alpha=\"0\" Red=\"255\" Green=\"255\" Blue=\"255\"/>\\\n <LinkedObjectName></LinkedObjectName>\\\n <Rotation>Rotation0</Rotation>\\\n <IsMirrored>False</IsMirrored>\\\n <IsVariable>True</IsVariable>\\\n <HorizontalAlignment>Left</HorizontalAlignment>\\\n <VerticalAlignment>Top</VerticalAlignment>\\\n <TextFitMode>ShrinkToFit</TextFitMode>\\\n <UseFullFontHeight>True</UseFullFontHeight>\\\n <Verticalized>False</Verticalized>\\\n <StyledText>\\\n <Element>\\\n <String>Description text</String>\\\n <Attributes>\\\n <Font Family=\"Helvetica\" Size=\"13\" Bold=\"False\" Italic=\"False\" Underline=\"False\" Strikeout=\"False\"/>\\\n <ForeColor Alpha=\"255\" Red=\"0\" Green=\"0\" Blue=\"0\"/>\\\n </Attributes>\\\n </Element>\\\n </StyledText>\\\n </TextObject>\\\n <Bounds X=\"948.9343\" Y=\"516.4281\" Width=\"3375.759\" Height=\"884.0282\"/>\\\n </ObjectInfo>\\\n <ObjectInfo>\\\n <BarcodeObject>\\\n <Name>BARCODE</Name>\\\n <ForeColor Alpha=\"255\" Red=\"0\" Green=\"0\" Blue=\"0\"/>\\\n <BackColor Alpha=\"255\" Red=\"255\" Green=\"255\" Blue=\"255\"/>\\\n <LinkedObjectName></LinkedObjectName>\\\n <Rotation>Rotation90</Rotation>\\\n <IsMirrored>False</IsMirrored>\\\n <IsVariable>True</IsVariable>\\\n <Text>12345</Text>\\\n <Type>Code128Auto</Type>\\\n <Size>Small</Size>\\\n\t <TextPosition>Top</TextPosition>\\\n <TextFont Family=\"Menlo\" Size=\"9\" Bold=\"False\" Italic=\"False\" Underline=\"False\" Strikeout=\"False\"/>\\\n <CheckSumFont Family=\"Helvetica\" Size=\"10\" Bold=\"False\" Italic=\"False\" Underline=\"False\" Strikeout=\"False\"/>\\\n <TextEmbedding>None</TextEmbedding>\\\n <ECLevel>0</ECLevel>\\\n <HorizontalAlignment>Center</HorizontalAlignment>\\\n <QuietZonesPadding Left=\"0\" Right=\"0\" Top=\"0\" Bottom=\"0\"/>\\\n </BarcodeObject>\\\n <Bounds X=\"331.2\" Y=\"57.59995\" Width=\"488.125\" Height=\"1435.2\"/>\\\n </ObjectInfo>\\\n <ObjectInfo>\\\n <TextObject>\\\n <Name>TEXT</Name>\\\n <ForeColor Alpha=\"255\" Red=\"255\" Green=\"255\" Blue=\"255\"/>\\\n <BackColor Alpha=\"255\" Red=\"0\" Green=\"0\" Blue=\"0\"/>\\\n <LinkedObjectName></LinkedObjectName>\\\n <Rotation>Rotation90</Rotation>\\\n <IsMirrored>False</IsMirrored>\\\n <IsVariable>False</IsVariable>\\\n <HorizontalAlignment>Center</HorizontalAlignment>\\\n <VerticalAlignment>Middle</VerticalAlignment>\\\n <TextFitMode>ShrinkToFit</TextFitMode>\\\n <UseFullFontHeight>True</UseFullFontHeight>\\\n <Verticalized>False</Verticalized>\\\n <StyledText>\\\n <Element>\\\n <String>SLIRP ITEM</String>\\\n <Attributes>\\\n <Font Family=\"Helvetica\" Size=\"13\" Bold=\"True\" Italic=\"False\" Underline=\"False\" Strikeout=\"False\"/>\\\n <ForeColor Alpha=\"255\" Red=\"255\" Green=\"255\" Blue=\"255\"/>\\\n </Attributes>\\\n </Element>\\\n </StyledText>\\\n </TextObject>\\\n <Bounds X=\"4432.975\" Y=\"57.59995\" Width=\"378.9844\" Height=\"1435.2\"/>\\\n </ObjectInfo>\\\n</DieCutLabel>';\n return labelXml;\n }", "title": "" }, { "docid": "d41684a69154e6d541c9eca76ab567c3", "score": "0.495427", "text": "function xmlResourcesToJson(xml)\r\n{\r\n console.log(\"Invoke xmlResourcesToJson function\");\r\n console.log(\"xml node Name : \"+xml.nodeName);\r\n var obj = {};\r\n if (xml.nodeType == 1) { \r\n var name=xml.nodeName;\r\n if (xml.attributes.length > 0 && name!=\"query\") {\r\n for (var j = 0; j < xml.attributes.length; j++) {\r\n var attribute = xml.attributes.item(j);\r\n var nameAttribute=attribute.nodeName;\r\n var valueAttribute=attribute.nodeValue;\r\n if(nameAttribute==\"xl:href\")\r\n obj[\"href\"] = attribute.nodeValue;\r\n else\r\n obj[attribute.nodeName] = attribute.nodeValue;\r\n }\r\n }\r\n }\r\n\r\n\r\n if (xml.hasChildNodes()){\r\n var firstChild=xml.firstChild;\r\n var name=firstChild.nodeName;\r\n var term=xml.getElementsByTagName(\"kind\")[0].getAttribute(\"term\");\r\n if(xml.nodeName!=\"query\")\r\n {\r\n obj[\"attributes\"]={};\r\n var attribute=xml.getElementsByTagName(\"attribute\");\r\n var nam=searchAttribute(attribute[0].attributes, \"name\");\r\n var firstSplit=(nam).split('.');\r\n obj[\"attributes\"][firstSplit[0]]={};\r\n obj[\"attributes\"][firstSplit[0]][term]={};\r\n }else{\r\n obj[name]=[];\r\n } \r\n for(var i = 0; i < xml.childNodes.length; i++) {\r\n var item = xml.childNodes.item(i);\r\n nodeName=item.nodeName;\r\n \r\n if(nodeName!=\"attribute\")\r\n {\r\n console.log(\"nodeName different from attribute : \"+nodeName);\r\n if(nodeName==\"kind\")\r\n {\r\n var attributeKind=item.attributes;\r\n obj[nodeName]=searchAttribute(attributeKind, \"scheme\")+searchAttribute(attributeKind, \"term\");\r\n }\r\n\r\n else if(nodeName==\"mixin\")\r\n {\r\n var attributeMixin=item.attributes;\r\n var mixinValue=searchAttribute(attributeMixin, \"scheme\")+searchAttribute(attributeMixin, \"term\");\r\n var name=\"mixins\";\r\n obj[name]=[];\r\n obj[name].push(mixinValue);\r\n }\r\n else if(typeof(obj[nodeName]) == \"undefined\"){\r\n obj[nodeName] = xmlResourcesToJson(item); \r\n }else{\r\n if (typeof(obj[nodeName].push) == \"undefined\") {\r\n var old = obj[nodeName];\r\n obj[nodeName] = [];\r\n obj[nodeName].push(old);\r\n }\r\n obj[nodeName].push(xmlResourcesToJson(item));\r\n }\r\n }else{\r\n var name=searchAttribute(item.attributes, \"name\");\r\n var secondSplit=name.split('.');\r\n if(secondSplit[2]==\"source\" || secondSplit[2]==\"target\")\r\n {\r\n obj[secondSplit[2]]=searchAttribute(item.attributes, \"xl:href\");\r\n }\r\n else if(secondSplit[1]==term)\r\n {\r\n obj[\"attributes\"][firstSplit[0]][secondSplit[1]][secondSplit[2]]=searchAttribute(item.attributes, \"value\");\r\n }\r\n } \r\n }\r\n }\r\n return obj;\r\n}", "title": "" }, { "docid": "62e8142aca5259717577fc84dd9e03a5", "score": "0.4953968", "text": "function display (document) {\n\t\n\tlet walkNode = document\n\tlet output = ''\n\n\tlet tabulation = ''\n\n\tdo {\n\n\t\t// get next node, linear\n\t\tlet {nextNode, parent} = walkNode.next()\n\n\t\tif(nextNode) {\n\n\t\t\t// if next node is child of a remote parent, close branches\n\t\t\tif(parent){\n\t\t\t\tlet backWalkNode = walkNode\n\t\t\t\twhile (backWalkNode!==parent) {\n\t\t\t\t\tif(backWalkNode.type!=='text')\n\t\t\t\t\t\toutput += '\\n' + tabulation.repeat(backWalkNode.depth) + '</' + backWalkNode.type + '>'\n\t\t\t\t\tbackWalkNode = backWalkNode.parent\n\t\t\t\t} \n\t\t\t}\n\n\t\t\twalkNode = nextNode\n\t\t\toutput += '\\n' + tabulation.repeat(walkNode.depth)\n\t\t\tif(walkNode.type === 'text') {\n\t\t\t\tlet marks = ''\n\t\t\t\tlet backWalkNode = walkNode\n\t\t\t\t// if it's a text node, go back up the tree and reassemble all marks\n\t\t\t\tfor (let i = walkNode.depth; i > 1; i--) {\n\t\t\t\t\tif(backWalkNode.parent.type!=='item')\n\t\t\t\t\t\tmarks = backWalkNode.parent.marks[backWalkNode.position] + marks\n\t\t\t\t\tbackWalkNode = backWalkNode.parent\n\t\t\t\t}\n\t\t\t\toutput += marks + Parser.parseInline(walkNode.textContent)\n\t\t\t} else {\n\t\t\t\t// if it's not a text node, open node\n\t\t\t\toutput += '<' + walkNode.type + ' ' + JSON.stringify(walkNode.info) + '>'\n\t\t\t\tif(walkNode.textContent)\n\t\t\t\t\toutput += '-----------------------------' + Parser.parseInline(walkNode.textContent)\n\t\t\t}\n\n\t\t} else \n\t\t\tbreak\n\t} while (walkNode)\n\n\treturn output\n}", "title": "" }, { "docid": "7600397dda3ec2e3e4b27f99c211d299", "score": "0.49523208", "text": "function rg(a){var b;I&&(b=a.xe());var c=ac(\"xml\");a=Uc(a,!0);for(var d=0,e;e=a[d];d++){var g=sg(e);e=e.Q();g.setAttribute(\"x\",I?b-e.x:e.x);g.setAttribute(\"y\",e.y);c.appendChild(g)}return c}", "title": "" }, { "docid": "f9e6e3ba9ea906f04cc2e06b692cbacb", "score": "0.49452814", "text": "function xml2json(xml, tab) {\n var X = {\n toObj: function(xml) {\n var o = {};\n if (xml.nodeType==1) { // element node ..\n if (xml.attributes.length) // element with attributes ..\n for (var i=0; i<xml.attributes.length; i++)\n o[\"@\"+xml.attributes[i].nodeName] = (xml.attributes[i].nodeValue||\"\").toString();\n if (xml.firstChild) { // element has child nodes ..\n var textChild=0, cdataChild=0, hasElementChild=false;\n for (var n=xml.firstChild; n; n=n.nextSibling) {\n if (n.nodeType==1) hasElementChild = true;\n else if (n.nodeType==3 && n.nodeValue.match(/[^ \\f\\n\\r\\t\\v]/)) textChild++; // non-whitespace text\n else if (n.nodeType==4) cdataChild++; // cdata section node\n }\n if (hasElementChild) {\n if (textChild < 2 && cdataChild < 2) { // structured element with evtl. a single text or/and cdata node ..\n X.removeWhite(xml);\n for (var n=xml.firstChild; n; n=n.nextSibling) {\n if (n.nodeType == 3) // text node\n o[\"#text\"] = X.escape(n.nodeValue);\n else if (n.nodeType == 4) // cdata node\n o[\"#cdata\"] = X.escape(n.nodeValue);\n else if (o[n.nodeName]) { // multiple occurence of element ..\n if (o[n.nodeName] instanceof Array)\n o[n.nodeName][o[n.nodeName].length] = X.toObj(n);\n else\n o[n.nodeName] = [o[n.nodeName], X.toObj(n)];\n }\n else // first occurence of element..\n o[n.nodeName] = X.toObj(n);\n }\n }\n else { // mixed content\n if (!xml.attributes.length)\n o = X.escape(X.innerXml(xml));\n else\n o[\"#text\"] = X.escape(X.innerXml(xml));\n }\n }\n else if (textChild) { // pure text\n if (!xml.attributes.length)\n o = X.escape(X.innerXml(xml));\n else\n o[\"#text\"] = X.escape(X.innerXml(xml));\n }\n else if (cdataChild) { // cdata\n if (cdataChild > 1)\n o = X.escape(X.innerXml(xml));\n else\n for (var n=xml.firstChild; n; n=n.nextSibling)\n o[\"#cdata\"] = X.escape(n.nodeValue);\n }\n }\n if (!xml.attributes.length && !xml.firstChild) o = null;\n }\n else if (xml.nodeType==9) { // document.node\n o = X.toObj(xml.documentElement);\n }\n else\n alert(\"unhandled node type: \" + xml.nodeType);\n return o;\n },\n toJson: function(o, name, ind) {\n var json = name ? (\"\\\"\"+name+\"\\\"\") : \"\";\n if (o instanceof Array) {\n for (var i=0,n=o.length; i<n; i++)\n o[i] = X.toJson(o[i], \"\", ind+\"\\t\");\n json += (name?\":[\":\"[\") + (o.length > 1 ? (\"\\n\"+ind+\"\\t\"+o.join(\",\\n\"+ind+\"\\t\")+\"\\n\"+ind) : o.join(\"\")) + \"]\";\n }\n else if (o == null)\n json += (name&&\":\") + \"null\";\n else if (typeof(o) == \"object\") {\n var arr = [];\n for (var m in o)\n arr[arr.length] = X.toJson(o[m], m, ind+\"\\t\");\n json += (name?\":{\":\"{\") + (arr.length > 1 ? (\"\\n\"+ind+\"\\t\"+arr.join(\",\\n\"+ind+\"\\t\")+\"\\n\"+ind) : arr.join(\"\")) + \"}\";\n }\n else if (typeof(o) == \"string\")\n json += (name&&\":\") + \"\\\"\" + o.toString() + \"\\\"\";\n else\n json += (name&&\":\") + o.toString();\n return json;\n },\n innerXml: function(node) {\n var s = \"\"\n if (\"innerHTML\" in node)\n s = node.innerHTML;\n else {\n var asXml = function(n) {\n var s = \"\";\n if (n.nodeType == 1) {\n s += \"<\" + n.nodeName;\n for (var i=0; i<n.attributes.length;i++)\n s += \" \" + n.attributes[i].nodeName + \"=\\\"\" + (n.attributes[i].nodeValue||\"\").toString() + \"\\\"\";\n if (n.firstChild) {\n s += \">\";\n for (var c=n.firstChild; c; c=c.nextSibling)\n s += asXml(c);\n s += \"</\"+n.nodeName+\">\";\n }\n else\n s += \"/>\";\n }\n else if (n.nodeType == 3)\n s += n.nodeValue;\n else if (n.nodeType == 4)\n s += \"<![CDATA[\" + n.nodeValue + \"]]>\";\n return s;\n };\n for (var c=node.firstChild; c; c=c.nextSibling)\n s += asXml(c);\n }\n return s;\n },\n escape: function(txt) {\n return txt.replace(/[\\\\]/g, \"\\\\\\\\\")\n .replace(/[\\\"]/g, '\\\\\"')\n .replace(/[\\n]/g, '\\\\n')\n .replace(/[\\r]/g, '\\\\r');\n },\n removeWhite: function(e) {\n e.normalize();\n for (var n = e.firstChild; n; ) {\n if (n.nodeType == 3) { // text node\n if (!n.nodeValue.match(/[^ \\f\\n\\r\\t\\v]/)) { // pure whitespace text node\n var nxt = n.nextSibling;\n e.removeChild(n);\n n = nxt;\n }\n else\n n = n.nextSibling;\n }\n else if (n.nodeType == 1) { // element node\n X.removeWhite(n);\n n = n.nextSibling;\n }\n else // any other node\n n = n.nextSibling;\n }\n return e;\n }\n };\n if (xml.nodeType == 9) // document node\n xml = xml.documentElement;\n var json = X.toJson(X.toObj(X.removeWhite(xml)), xml.nodeName, \"\\t\");\n return \"{\\n\" + tab + (tab ? json.replace(/\\t/g, tab) : json.replace(/\\t|\\n/g, \"\")) + \"\\n}\";\n }", "title": "" }, { "docid": "f74ac378e3e34a0c5aa460f2313a30cc", "score": "0.4941469", "text": "get xml() { return (this.aux.xml != null) ? this.aux.xml.xml : undefined; }", "title": "" }, { "docid": "b494ad81c506ef7ab14987bbda239fb9", "score": "0.49216533", "text": "function parseXML(node, simple){\n if(!node) return null;\n var txt = '', obj = null, att = null;\n var nt = node.nodeType, nn = jsVar(node.localName || node.nodeName);\n var nv = node.text || node.nodeValue || '';\n /*DBG*/ //if(window.console) console.log(['x2j',nn,nt,nv.length+' bytes']);\n if(node.childNodes){\n if(node.childNodes.length>0){\n /*DBG*/ //if(window.console) console.log(['x2j',nn,'CHILDREN',node.childNodes]);\n $.each(node.childNodes, function(n,cn){\n var cnt = cn.nodeType, cnn = jsVar(cn.localName || cn.nodeName);\n var cnv = cn.text || cn.nodeValue || '';\n /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>a',cnn,cnt,cnv]);\n if(cnt == 8){\n /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>b',cnn,'COMMENT (ignore)']);\n return; // ignore comment node\n }\n else if(cnt == 3 || cnt == 4 || !cnn){\n // ignore white-space in between tags\n if(cnv.match(/^\\s+$/)){\n /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>c',cnn,'WHITE-SPACE (ignore)']);\n return;\n };\n /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>d',cnn,'TEXT']);\n txt += cnv.replace(/^\\s+/,'').replace(/\\s+$/,'');\n // make sure we ditch trailing spaces from markup\n }\n else{\n /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>e',cnn,'OBJECT']);\n obj = obj || {};\n if(obj[cnn]){\n /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>f',cnn,'ARRAY']);\n\n // http://forum.jquery.com/topic/jquery-jquery-xml2json-problems-when-siblings-of-the-same-tagname-only-have-a-textnode-as-a-child\n if(!obj[cnn].length) obj[cnn] = myArr(obj[cnn]);\n obj[cnn] = myArr(obj[cnn]);\n\n obj[cnn][ obj[cnn].length ] = parseXML(cn, true/* simple */);\n obj[cnn].length = obj[cnn].length;\n }\n else{\n /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>g',cnn,'dig deeper...']);\n obj[cnn] = parseXML(cn);\n };\n };\n });\n };//node.childNodes.length>0\n };//node.childNodes\n if(node.attributes){\n if(node.attributes.length>0){\n /*DBG*/ //if(window.console) console.log(['x2j',nn,'ATTRIBUTES',node.attributes])\n att = {}; obj = obj || {};\n $.each(node.attributes, function(a,at){\n var atn = jsVar(at.name), atv = at.value;\n att[atn] = atv;\n if(obj[atn]){\n /*DBG*/ //if(window.console) console.log(['x2j',nn,'attr>',atn,'ARRAY']);\n\n // http://forum.jquery.com/topic/jquery-jquery-xml2json-problems-when-siblings-of-the-same-tagname-only-have-a-textnode-as-a-child\n //if(!obj[atn].length) obj[atn] = myArr(obj[atn]);//[ obj[ atn ] ];\n obj[cnn] = myArr(obj[cnn]);\n\n obj[atn][ obj[atn].length ] = atv;\n obj[atn].length = obj[atn].length;\n }\n else{\n /*DBG*/ //if(window.console) console.log(['x2j',nn,'attr>',atn,'TEXT']);\n obj[atn] = atv;\n };\n });\n //obj['attributes'] = att;\n };//node.attributes.length>0\n };//node.attributes\n if(obj){\n obj = $.extend( (txt!='' ? new String(txt) : {}),/* {text:txt},*/ obj || {}/*, att || {}*/);\n //txt = (obj.text) ? (typeof(obj.text)=='object' ? obj.text : [obj.text || '']).concat([txt]) : txt;\n txt = (obj.text) ? ([obj.text || '']).concat([txt]) : txt;\n if(txt) obj.text = txt;\n txt = '';\n };\n var out = obj || txt;\n //console.log([extended, simple, out]);\n if(extended){\n if(txt) out = {};//new String(out);\n txt = out.text || txt || '';\n if(txt) out.text = txt;\n if(!simple) out = myArr(out);\n };\n return out;\n }", "title": "" }, { "docid": "55aed3df18e7b5d5f26dc1618c468b99", "score": "0.4916049", "text": "function getNodePrettyName(aNode)\n{\n try {\n var tag = \"\";\n if (aNode.nodeType == nsIDOMNode.DOCUMENT_NODE) {\n tag = \"document\";\n } else {\n tag = aNode.localName;\n if (aNode.nodeType == nsIDOMNode.ELEMENT_NODE && aNode.hasAttribute(\"id\"))\n tag += \"@id=\\\"\" + aNode.getAttribute(\"id\") + \"\\\"\";\n }\n\n return \"'\" + tag + \" node', address: \" + getObjAddress(aNode);\n } catch (e) {\n return \"' no node info '\";\n }\n}", "title": "" }, { "docid": "2dae34c6d28bd8c431d85a7237a0cfaf", "score": "0.49160066", "text": "function tagOutput(descriptor, innerDescriptor, name) {\n\tvar out = '<' + name + innerDescriptor.attributes;\n\tif (innerDescriptor.style)\n\t\tout += ' style=\"' + innerDescriptor.style + '\"';\n\tif (innerDescriptor.classes)\n\t\tout += ' class=\"' + innerDescriptor.classes + '\"';\n\tif (innerDescriptor.children)\n\t\tdescriptor.children += out + '>' + innerDescriptor.children + '</' + name + '>';\n\telse if (openTags.test(name))\n\t\tdescriptor.children += out + '>';\n\telse if (strictTags.test(name))\n\t\tdescriptor.children += out + '></' + name + '>';\n\telse\n\t\tdescriptor.children += out + '/>';\n}", "title": "" }, { "docid": "569accc3b51f2f291c840323b6c21790", "score": "0.49095863", "text": "_renderTree() {\n\t}", "title": "" }, { "docid": "af7197843ba35021ca51830cb6a67fea", "score": "0.49072087", "text": "function print() {\n\n // nothing to do\n if(!this.nodes.length) {\n return;\n }\n\n // document\n this.push(this.doc);\n\n // list nodes\n for(var i = 0;i < this.nodes.length;i++) {\n this.push(this.nodes[i]);\n }\n\n // eof\n this.push(Node.createNode(Node.EOF));\n}", "title": "" }, { "docid": "451f2223d80f13cb36ade3c4e7465871", "score": "0.48954955", "text": "stringifyProps(node, tagObj, {\n anchors,\n doc\n }) {\n const props = [];\n const anchor = doc.anchors.getName(node);\n\n if (anchor) {\n anchors[anchor] = node;\n props.push(`&${anchor}`);\n }\n\n if (node.tag) {\n props.push(doc.stringifyTag(node.tag));\n } else if (!tagObj.default) {\n props.push(doc.stringifyTag(tagObj.tag));\n }\n\n return props.join(' ');\n }", "title": "" }, { "docid": "81b4f0f2a02ec8cfe9555c73102da30f", "score": "0.4895248", "text": "stringifyProps(node, tagObj, {\n anchors,\n doc\n }) {\n const props = [];\n const anchor = doc.anchors.getName(node);\n\n if (anchor) {\n anchors[anchor] = node;\n props.push(`&${anchor}`);\n }\n\n if (node.tag && node.tag !== tagObj.tag) {\n props.push(doc.stringifyTag(node.tag));\n } else if (!tagObj.default) {\n props.push(doc.stringifyTag(tagObj.tag));\n }\n\n return props.join(' ');\n }", "title": "" }, { "docid": "e98495177fc1e84a888cce142bb94968", "score": "0.48912406", "text": "toMarkup() {\n let markup = \"<\" + this.type; // Add the attributes\n\n for (const attr in this.attributes) {\n if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {\n markup += \" \" + attr + \"=\\\"\";\n markup += utils.escape(this.attributes[attr]);\n markup += \"\\\"\";\n }\n }\n\n markup += \">\";\n\n for (let i = 0; i < this.children.length; i++) {\n markup += this.children[i].toMarkup();\n }\n\n markup += \"</\" + this.type + \">\";\n return markup;\n }", "title": "" }, { "docid": "c477d0ab65cc6ede06cf1717b8bc2a1a", "score": "0.4889729", "text": "function parseXML(node, simple) {\n if (!node) return null;\n var txt = \"\",\n obj = null,\n att = null;\n var nt = node.nodeType,\n nn = jsVar(node.localName || node.nodeName);\n var nv = node.text || node.nodeValue || \"\"; //if(window.console) console.log(['x2j',nn,nt,nv.length+' bytes']);\n\n /*DBG*/\n\n if (node.childNodes) {\n if (node.childNodes.length > 0) {\n /*DBG*/\n //if(window.console) console.log(['x2j',nn,'CHILDREN',node.childNodes]);\n for (var n = 0; n < node.childNodes.length; ++n) {\n var cn = node.childNodes[n];\n var cnt = cn.nodeType,\n cnn = jsVar(cn.localName || cn.nodeName);\n var cnv = cn.text || cn.nodeValue || \"\"; //if(window.console) console.log(['x2j',nn,'node>a',cnn,cnt,cnv]);\n\n /*DBG*/\n\n if (cnt == 8) {\n /*DBG*/\n //if(window.console) console.log(['x2j',nn,'node>b',cnn,'COMMENT (ignore)']);\n continue; // ignore comment node\n } else if (cnt == 3 || cnt == 4 || !cnn) {\n // ignore white-space in between tags\n if (cnv.match(/^\\s+$/)) {\n /*DBG*/\n //if(window.console) console.log(['x2j',nn,'node>c',cnn,'WHITE-SPACE (ignore)']);\n continue;\n } //if(window.console) console.log(['x2j',nn,'node>d',cnn,'TEXT']);\n\n /*DBG*/\n\n\n txt += cnv.replace(/^\\s+/, \"\").replace(/\\s+$/, \"\"); // make sure we ditch trailing spaces from markup\n } else {\n /*DBG*/\n //if(window.console) console.log(['x2j',nn,'node>e',cnn,'OBJECT']);\n obj = obj || {};\n\n if (obj[cnn]) {\n /*DBG*/\n //if(window.console) console.log(['x2j',nn,'node>f',cnn,'ARRAY']);\n // http://forum.jquery.com/topic/jquery-jquery-xml2json-problems-when-siblings-of-the-same-tagname-only-have-a-textnode-as-a-child\n if (!obj[cnn].length) obj[cnn] = myArr(obj[cnn]);\n obj[cnn] = myArr(obj[cnn]);\n obj[cnn][obj[cnn].length] = parseXML(cn, true\n /* simple */\n );\n obj[cnn].length = obj[cnn].length;\n } else {\n /*DBG*/\n //if(window.console) console.log(['x2j',nn,'node>g',cnn,'dig deeper...']);\n obj[cnn] = parseXML(cn);\n }\n }\n }\n } //node.childNodes.length>0\n\n } //node.childNodes\n\n\n if (node.attributes) {\n if (node.attributes.length > 0) {\n /*DBG*/\n //if(window.console) console.log(['x2j',nn,'ATTRIBUTES',node.attributes])\n att = {};\n obj = obj || {};\n\n for (var a = 0; a < node.attributes.length; ++a) {\n var at = node.attributes[a];\n var atn = jsVar(at.name),\n atv = at.value;\n att[atn] = atv;\n\n if (obj[atn]) {\n /*DBG*/\n //if(window.console) console.log(['x2j',nn,'attr>',atn,'ARRAY']);\n // http://forum.jquery.com/topic/jquery-jquery-xml2json-problems-when-siblings-of-the-same-tagname-only-have-a-textnode-as-a-child\n //if(!obj[atn].length) obj[atn] = myArr(obj[atn]);//[ obj[ atn ] ];\n obj[cnn] = myArr(obj[cnn]);\n obj[atn][obj[atn].length] = atv;\n obj[atn].length = obj[atn].length;\n } else {\n /*DBG*/\n //if(window.console) console.log(['x2j',nn,'attr>',atn,'TEXT']);\n obj[atn] = atv;\n }\n } //obj['attributes'] = att;\n\n } //node.attributes.length>0\n\n } //node.attributes\n\n\n if (obj) {\n var newObj = txt != \"\" ? new String(txt) : {};\n\n for (var prop in obj) {\n if (obj.hasOwnProperty(prop)) {\n newObj[prop] = obj[prop];\n }\n }\n\n obj = newObj; //txt = (obj.text) ? (typeof(obj.text)=='object' ? obj.text : [obj.text || '']).concat([txt]) : txt;\n\n txt = obj.text ? [obj.text || \"\"].concat([txt]) : txt;\n if (txt) obj.text = txt;\n txt = \"\";\n }\n\n var out = obj || txt; //console.log([extended, simple, out]);\n\n if (extended) {\n if (txt) out = {}; //new String(out);\n\n txt = out.text || txt || \"\";\n if (txt) out.text = txt;\n if (!simple) out = myArr(out);\n }\n\n return out;\n } // parseXML", "title": "" }, { "docid": "5f8d0b989fb412de870cfd85ac6edd3b", "score": "0.48883358", "text": "function makeMarkup (conf, parse, msg) {\n var attr = { \"class\": \"def idl\" };\n var $pre = $(\"<pre></pre>\").attr(attr);\n $pre.html(parse.filter(function(defn) { return !typeIsWhitespace(defn.type); })\n .map(function(defn) { return writeDefinition(defn, -1, msg); })\n .join('\\n\\n'));\n return $pre;\n }", "title": "" }, { "docid": "ebe09ed4fecfc4fb1a6003394e7a49b8", "score": "0.48594284", "text": "function xinspect(e,b){if(typeof b==\"undefined\"){b=\"\"}if(b.length>50){return\"[MAX ITERATIONS]\"}var c=[];for(var d in e){var a=typeof e[d];c.push(b+'\"'+d+'\" ('+a+\") => \"+(a==\"object\"?\"object:\"+xinspect(e[d],b+\" \"):e[d]+\"\"))}return c.join(b+\"\\n\")}", "title": "" }, { "docid": "4ca03e5c14ac0fa570422328326b984a", "score": "0.4850988", "text": "function dump(obj) {\n var out = '';\n for (var i in obj) {\n out += i + \": \" + obj[i] + \"\\n\";\n }\n alert(out);\n var pre = document.createElement('pre');\n pre.innerHTML = out;\n document.body.appendChild(pre)\n}", "title": "" }, { "docid": "ecb4169132ddab574896cf75a7c03691", "score": "0.48499686", "text": "function makePretty (width, ribbon) {\n\n // Integer, Integer, Doc -> DOC\n function best (thisRibbon, current, doc) {\n return be(thisRibbon, current, [{indent: 0, doc: doc}]);\n }\n\n // DOC -> DOC\n function memoize(thunk) {\n let seen = false;\n let value;\n\n return () => {\n if (seen) {\n return value;\n } else {\n seen = true;\n value = thunk();\n return value;\n }\n };\n }\n\n // Integer, Integer, [Pair] -> DOC\n function be (r, k, pairs) {\n if (pairs.length === 0) {\n return NIL;\n }\n\n let doc = pairs[0].doc;\n let indent = pairs[0].indent;\n let rest = pairs.slice(1);\n\n switch (doc.type) {\n case 'nil':\n return be(r, k, rest);\n case 'concat':\n return be(r, k, [{indent, doc: doc.left}, {indent, doc: doc.right()}, ...rest]);\n case 'nest':\n return be(r, k, [{indent: indent + doc.indent, doc: doc.rest}, ...rest]);\n case 'text':\n if (doc.text === '') {\n return NIL;\n } else {\n return memoize(() => ({type: 'TEXT', text: doc.text, rest: memoize(() => (be(r, k + doc.text.length, rest)()))}));\n }\n case 'line':\n return memoize(() => ({type: 'LINE', indent: indent, rest: memoize(() => (be(r + indent, indent, rest)()))}));\n case 'union':\n return better(r, k, be(r, k, [{indent, doc: doc.left}, ...rest]),\n memoize(() => (be(r, k, [{indent, doc: doc.right()}, ...rest])())));\n default:\n console.log(doc());\n throw Error(`unnexpected document type: ${doc.type}`);\n }\n }\n\n // Integer, Integer, Integer, DOC, DOC -> DOC\n function better (thisRibbon, current, docL, docR) {\n if (fits(width - current, thisRibbon - current, docL)) {\n return docL;\n } else {\n return docR;\n }\n }\n\n // Integer, Integer, DOC -> Boolean\n function fits(diffWidth, diffRibbon, thunk) {\n if (diffWidth < 0 || diffRibbon < 0) {\n return false;\n }\n\n let doc = thunk();\n\n switch (doc.type) {\n case 'NIL':\n return true;\n case 'TEXT':\n return fits(diffWidth - doc.text.length, diffRibbon - doc.text.length, doc.rest);\n case 'LINE':\n return true;\n default:\n throw Error(`unnexpected DOCUMENT type: ${doc.type}`);\n }\n }\n\n function pretty (doc) {\n return layout(best(ribbon, 0, doc));\n }\n\n return pretty;\n}", "title": "" }, { "docid": "ce9496bd7487b21bddd5a06d6b3ee73b", "score": "0.4833019", "text": "function toXML(_a){\n var xml = '<object>'\n for(var i=0;i<_a.length;i++){\n xml += convertToXML(_a[i].val.toString(), _a[i].name.toString())\n }\n xml += '</object>'\n return xml;\n} // end toXML()", "title": "" }, { "docid": "f904fe53ef066a1d22e9eb60f5914988", "score": "0.48302302", "text": "function stringifyXML(obj, opts) {\n var builder = new xml2js.Builder({\n rootName: (opts || {}).rootName,\n renderOpts: {\n pretty: false,\n },\n });\n return builder.buildObject(obj);\n}", "title": "" }, { "docid": "11beb38eaff87c888e7c6e0ab51e603b", "score": "0.4826908", "text": "function dumpObjectTree(tree, indent) {\n var i;\n\n if (indent === undefined) {\n indent = 0;\n }\n\n function niceLog(msg) {\n var j;\n var out = \"\";\n for (j = 0; j < indent; ++j) {\n out += \" \";\n }\n console.log(out + msg);\n }\n\n niceLog(\"+ Element:\");\n niceLog(\"|- type: \" + tree.type);\n niceLog(\"|- type definition: \" + tree.typeDefinition);\n\n niceLog(\"|+ Properties:\");\n for (i = 0; i < tree.properties.length; ++i) {\n niceLog(\"|--> \" + tree.properties[i].name);\n }\n\n niceLog(\"|+ Delegates:\");\n for (i = 0; i < tree.delegates.length; ++i) {\n niceLog(\"|--> \" + tree.delegates[i].name + \" : \" + tree.delegates[i].value);\n }\n\n if (tree.types.length) {\n niceLog(\"|+ Types:\");\n for (i = 0; i < tree.types.length; ++i) {\n dumpObjectTree(tree.types[i], indent + 2);\n }\n }\n\n if (tree.elements.length) {\n niceLog(\"|+ Elements: \");\n for (i = 0; i < tree.elements.length; ++i) {\n dumpObjectTree(tree.elements[i], indent + 2);\n }\n }\n }", "title": "" }, { "docid": "436994d54da91c30a7332f1cd7a0012b", "score": "0.48236522", "text": "dump() {\n let s;\n\n for (let v of this.vertexes) {\n if (v.pos) {\n s = v.value + ' (' + v.pos.x + ',' + v.pos.y + '):';\n } else {\n s = v.value + ':';\n }\n\n for (let e of v.edges) {\n s += ` ${e.destination.value}`;\n }\n console.log(s);\n }\n }", "title": "" }, { "docid": "436994d54da91c30a7332f1cd7a0012b", "score": "0.48236522", "text": "dump() {\n let s;\n\n for (let v of this.vertexes) {\n if (v.pos) {\n s = v.value + ' (' + v.pos.x + ',' + v.pos.y + '):';\n } else {\n s = v.value + ':';\n }\n\n for (let e of v.edges) {\n s += ` ${e.destination.value}`;\n }\n console.log(s);\n }\n }", "title": "" }, { "docid": "436994d54da91c30a7332f1cd7a0012b", "score": "0.48236522", "text": "dump() {\n let s;\n\n for (let v of this.vertexes) {\n if (v.pos) {\n s = v.value + ' (' + v.pos.x + ',' + v.pos.y + '):';\n } else {\n s = v.value + ':';\n }\n\n for (let e of v.edges) {\n s += ` ${e.destination.value}`;\n }\n console.log(s);\n }\n }", "title": "" }, { "docid": "436994d54da91c30a7332f1cd7a0012b", "score": "0.48236522", "text": "dump() {\n let s;\n\n for (let v of this.vertexes) {\n if (v.pos) {\n s = v.value + ' (' + v.pos.x + ',' + v.pos.y + '):';\n } else {\n s = v.value + ':';\n }\n\n for (let e of v.edges) {\n s += ` ${e.destination.value}`;\n }\n console.log(s);\n }\n }", "title": "" }, { "docid": "436994d54da91c30a7332f1cd7a0012b", "score": "0.48236522", "text": "dump() {\n let s;\n\n for (let v of this.vertexes) {\n if (v.pos) {\n s = v.value + ' (' + v.pos.x + ',' + v.pos.y + '):';\n } else {\n s = v.value + ':';\n }\n\n for (let e of v.edges) {\n s += ` ${e.destination.value}`;\n }\n console.log(s);\n }\n }", "title": "" }, { "docid": "436994d54da91c30a7332f1cd7a0012b", "score": "0.48236522", "text": "dump() {\n let s;\n\n for (let v of this.vertexes) {\n if (v.pos) {\n s = v.value + ' (' + v.pos.x + ',' + v.pos.y + '):';\n } else {\n s = v.value + ':';\n }\n\n for (let e of v.edges) {\n s += ` ${e.destination.value}`;\n }\n console.log(s);\n }\n }", "title": "" }, { "docid": "436994d54da91c30a7332f1cd7a0012b", "score": "0.48236522", "text": "dump() {\n let s;\n\n for (let v of this.vertexes) {\n if (v.pos) {\n s = v.value + ' (' + v.pos.x + ',' + v.pos.y + '):';\n } else {\n s = v.value + ':';\n }\n\n for (let e of v.edges) {\n s += ` ${e.destination.value}`;\n }\n console.log(s);\n }\n }", "title": "" }, { "docid": "68315a0e7ec543dac54aa3f34a013c5a", "score": "0.4823043", "text": "function parseReferences(xmlp) {\n\n\t// RAN OUT OF TIME TO IMPLEMENT...\n}", "title": "" }, { "docid": "9b3fdd38865b9501c4f72f2d553d61ea", "score": "0.4822256", "text": "function printAttr() {\n const parts = [node.member, \" \"];\n\n if (node.kind === \"singleton\") {\n parts.push(\"self.\");\n }\n\n parts.push(node.name);\n\n if (node.ivar_name === false) {\n parts.push(\"()\");\n } else if (node.ivar_name) {\n parts.push(\"(\", node.ivar_name, \")\");\n }\n\n parts.push(\": \", path.call(printType, \"type\"));\n\n return group(concat(parts));\n }", "title": "" }, { "docid": "b323f4da24f405dbde83a4e2687096e5", "score": "0.48208138", "text": "function xmlAttr(name, value, outTs) {\n // SPF: delete \"SELF\\\" ISSUE: this is not the correct way to process SELF\\\n // xml will not validate with \"SELF\\\" \n // value = value.replace(/SELF\\\\/,\"\");\n \n var txt = indent+name+'=\\\"'+value+'\\\"';\n outTs.WriteLine();\n outTs.Write(txt);\n}", "title": "" }, { "docid": "aeea8d8c2210ac50cbdf52a194910d1b", "score": "0.4816284", "text": "function prettyPrint(stxarr, shouldResolve) {\n var indent = 0;\n var unparsedLines = stxarr.reduce(function(acc, stx) {\n var s = shouldResolve ? expander.resolve(stx) : stx.token.value;\n // skip the end of file token\n if (stx.token.type === parser.Token.EOF) {\n return acc;\n }\n if (stx.token.type === parser.Token.StringLiteral) {\n s = '\"' + s + '\"';\n }\n if (s == '{') {\n acc[0].str += ' ' + s;\n indent++;\n acc.unshift({\n indent: indent,\n str: ''\n });\n } else if (s == '}') {\n indent--;\n acc.unshift({\n indent: indent,\n str: s\n });\n acc.unshift({\n indent: indent,\n str: ''\n });\n } else if (s == ';') {\n acc[0].str += s;\n acc.unshift({\n indent: indent,\n str: ''\n });\n } else {\n acc[0].str += (acc[0].str ? ' ' : '') + s;\n }\n return acc;\n }, [{\n indent: 0,\n str: ''\n }]);\n return unparsedLines.reduce(function(acc, line) {\n var ind = '';\n while (ind.length < line.indent * 2) {\n ind += ' ';\n }\n return ind + line.str + '\\n' + acc;\n }, '');\n }", "title": "" }, { "docid": "e53275f4fe48f7ebebe66ea33ff73e5c", "score": "0.48158532", "text": "get pretty() {\n return stringify.configure({ pretty: true });\n }", "title": "" }, { "docid": "bd3d2c5eb3eee1931d354db9bcdfe50b", "score": "0.4815276", "text": "function prettifyName(name) {\n}", "title": "" }, { "docid": "ba70d2c6303a112f9c17804d98fc2eab", "score": "0.481497", "text": "function IpadicFormatter() {\n}", "title": "" }, { "docid": "1f9c0bdc6f4a213f7791c2e7b3d0c500", "score": "0.4812605", "text": "_logString () {\n return logItemHelper('YXml', this)\n }", "title": "" }, { "docid": "947023bbb1fd436e888df66424364a86", "score": "0.48116145", "text": "function XMLSerializerForIE(s) {\n\t\t\t\tvar out = \"\";\n\n\t\t\t\tout += \"<\" + s.nodeName;\n\t\t\t\tfor (var n = 0; n < s.attributes.length; n++) {\n\t\t\t\t\tout += \" \" + s.attributes[n].name + \"=\" + \"'\" + s.attributes[n].value + \"'\";\n\t\t\t\t}\n\n\t\t\t\tif (s.hasChildNodes()) {\n\t\t\t\t\tout += \">\\n\";\n\n\t\t\t\t\tfor (var n = 0; n < s.childNodes.length; n++) {\n\t\t\t\t\t\tout += XMLSerializerForIE(s.childNodes[n]);\n\t\t\t\t\t}\n\n\t\t\t\t\tout += \"</\" + s.nodeName + \">\" + \"\\n\";\n\t\t\t\t} else out += \" />\\n\";\n\n\t\t\t\treturn out;\n\t\t\t}", "title": "" }, { "docid": "a0950da52f1749df2c3122494737fa3b", "score": "0.48114607", "text": "function printObjectValuesBracket() {\n\n}", "title": "" }, { "docid": "3875af38992e2ddef48c73b707c85654", "score": "0.48054332", "text": "toFragmentString(){\n const s = new XMLSerializer()\n return s.serializeToString(this._elem)\n }", "title": "" }, { "docid": "0641623ed2f63eb6cfacdf649c1d037c", "score": "0.4803124", "text": "function printAstToDoc(ast, options) {\n var alignmentSize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n var printer = options.printer;\n\n if (printer.preprocess) {\n ast = printer.preprocess(ast, options);\n }\n\n var cache = new Map();\n\n function printGenerically(path$$1, args) {\n var node = path$$1.getValue();\n var shouldCache = node && typeof node === \"object\" && args === undefined;\n\n if (shouldCache && cache.has(node)) {\n return cache.get(node);\n } // We let JSXElement print its comments itself because it adds () around\n // UnionTypeAnnotation has to align the child without the comments\n\n\n var res;\n\n if (printer.willPrintOwnComments && printer.willPrintOwnComments(path$$1)) {\n res = callPluginPrintFunction(path$$1, options, printGenerically, args);\n } else {\n // printComments will call the plugin print function and check for\n // comments to print\n res = comments.printComments(path$$1, function (p) {\n return callPluginPrintFunction(p, options, printGenerically, args);\n }, options, args && args.needsSemi);\n }\n\n if (shouldCache) {\n cache.set(node, res);\n }\n\n return res;\n }\n\n var doc$$2 = printGenerically(new fastPath(ast));\n\n if (alignmentSize > 0) {\n // Add a hardline to make the indents take effect\n // It should be removed in index.js format()\n doc$$2 = addAlignmentToDoc$1(concat$3([hardline$2, doc$$2]), alignmentSize, options.tabWidth);\n }\n\n docUtils$2.propagateBreaks(doc$$2);\n return doc$$2;\n}", "title": "" }, { "docid": "56234d8663733f352ec70de9a977b3ac", "score": "0.47982228", "text": "function recordElement(item, depth, text) {\n if (item) {\n text += \"\\t\".repeat(depth);\n text += \"<\" + item.className();\n if (item.id()) text += ' id=\"' + item.id() + '\"';\n if (item.text() && item.text() != \"\") text += ' text=\"' + item.text() + '\"';\n if (item.desc() && item.desc() != \"\") text += ' desc=\"' + item.desc() + '\"';\n text += ' bounds=\"' + item.bounds() + '\"';\n if (item.childCount() < 1) text += \"/>\\n\";\n else {\n text += \">\\n\";\n item.children().forEach((child) => {\n text = recordElement(child, depth + 1, text);\n });\n text += \"\\t\".repeat(depth);\n text += \"</\" + item.className() + \">\\n\";\n }\n }\n return text;\n }", "title": "" }, { "docid": "e1ee9a96295cd9a59fceaed1c62d816d", "score": "0.47975606", "text": "function print(ast) {\n return visit(ast, {\n leave: printDocASTReducer\n });\n} // TODO: provide better type coverage in future", "title": "" }, { "docid": "e1ee9a96295cd9a59fceaed1c62d816d", "score": "0.47975606", "text": "function print(ast) {\n return visit(ast, {\n leave: printDocASTReducer\n });\n} // TODO: provide better type coverage in future", "title": "" } ]
83d4cf8fde80ef4b9150b121e2c3ec6a
We have no pointers in JS, so keep tables separate
[ { "docid": "ab79720fbdaf8fecfaadd96af00d7da1", "score": "0.0", "text": "function fixedtables(state) {\n\t /* build fixed huffman tables if first call (may not be thread safe) */\n\t if (virgin) {\n\t var sym;\n\n\t lenfix = new utils.Buf32(512);\n\t distfix = new utils.Buf32(32);\n\n\t /* literal/length table */\n\t sym = 0;\n\t while (sym < 144) { state.lens[sym++] = 8; }\n\t while (sym < 256) { state.lens[sym++] = 9; }\n\t while (sym < 280) { state.lens[sym++] = 7; }\n\t while (sym < 288) { state.lens[sym++] = 8; }\n\n\t inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n\t /* distance table */\n\t sym = 0;\n\t while (sym < 32) { state.lens[sym++] = 5; }\n\n\t inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n\t /* do this just once */\n\t virgin = false;\n\t }\n\n\t state.lencode = lenfix;\n\t state.lenbits = 9;\n\t state.distcode = distfix;\n\t state.distbits = 5;\n\t}", "title": "" } ]
[ { "docid": "d655da147144155724e039b5e3d57178", "score": "0.626447", "text": "function jsTable()\r\n{\r\n\t/*\r\n\t*\tAdd row to bottom of table\r\n\t*/\r\n\tthis.add = function(row)\r\n\t{\r\n\t\tdataTable.push(row);\r\n\t}\r\n\tthis.addAt = function(row, index)\r\n\t{\r\n\t\tfor(var i = dataTable.length; i>index; --i)\r\n\t\t\tdataTable[i] = dataTable[i-1];\r\n\t\tdataTable[index] = row;\r\n\t}\r\n\t/*\r\n\t*\tReturn row at index\r\n\t*/\r\n\tthis.get = function(index)\r\n\t{\r\n\t\treturn dataTable[index];\r\n\t}\r\n\t/*\r\n\t*\tRemove all rows where keyCol = target\r\n\t*/\r\n\tthis.remove = function(keyCol, target)\r\n\t{\r\n\t\tvar deadRow = findIndex(keyCol, target);\r\n\t\tfor(var i in deadRow)\r\n\t\t\tremoveAt(deadRow[i]);\r\n\t}\r\n\tthis.removeAt = function(index)\r\n\t{\r\n\t\tfor(var i = index; i<dataTable.length-1; ++i)\r\n\t\t\tdataTable[i] = dataTable[i+1];\r\n\t\tdataTable.pop();\r\n\t}\r\n\t/*\r\n\t*\tReturns a jsTable object containing all\r\n\t*\trows where keyCol = target\r\n\t*/\r\n\tthis.find = function(keyCol, target)\r\n\t{\r\n\t\tvar wa = new jsTable();\r\n\t\tvar rows = findIndex(keyCol, target);\r\n\t\tfor(var i in rows)\r\n\t\t\twa.add(rows[i]);\r\n\t\treturn wa;\r\n\t}\r\n\t/*\r\n\t*\tPerform destructive Quicksort\r\n\t*/\r\n\tthis.sort = function(keyCol)\r\n\t{\r\n\t\tquickSort(keyCol, 0, dataTable.length-1);\r\n\t}\r\n\t/*\r\n\t*\tReturns the table as a string\r\n\t*\twith delimiters inserted\r\n\t*/\r\n\tthis.toString = function()\r\n\t{\r\n\t\tvar sTable = \"\";\r\n\t\tif(this.withHeader)\r\n\t\t{\r\n\t\t\tvar rowHdr = \"\";\r\n\t\t\tfor(var n in dataTable[0])\r\n\t\t\t\trowHdr += sHdrDelim.replace(/\\[jstdHdr\\]/, n);\r\n\t\t\tsTable += sRowDelim.replace(/\\[jstdRow\\]/, rowHdr);\r\n\t\t}\r\n\t\tfor(var r in dataTable)\r\n\t\t{\r\n\t\t\tvar dataRow = dataTable[r];\r\n\t\t\tvar sRow = \"\";\r\n\t\t\tfor(var c in dataRow)\r\n\t\t\t\tsRow += sColDelim.replace(/\\[jstdCol\\]/, dataRow[c]);\r\n\t\t\tsTable += sRowDelim.replace(/\\[jstdRow\\]/, sRow);\r\n\t\t}\r\n\t\treturn sTabDelim.replace(/\\[jstdTab\\]/, sTable);\r\n\t}\r\n\t/*\r\n\t*\tSets the various delimiters\r\n\t*\tformat:\r\n\t*\t\tsTabDelim[jstd]sHdrDelim[jstd]sRowDelim[jstd]sColDelim\r\n\t*\tdelimiter format:\r\n\t*\t\t.*DELIM_ID.*\r\n\t*\tDELIM_ID:\r\n\t*\t\ttable -> [jstdTab]\r\n\t*\t\theader -> [jstdHdr]\r\n\t*\t\trow -> [jstdRow]\r\n\t*\t\tcolumn -> [jstdCol]\r\n\t*\texample:<table>[jstdTab]</table>[jstd]<th>[jstdHdr]</th>[jstd]<tr>[jstdRow]</tr>[jstd]<td>[jstdCol]</td>\r\n\t*/\r\n\tthis.setDelim = function(d)\r\n\t{\r\n\t\tvar delims = d.split(/\\[jstd\\]/);\r\n\t\tsTabDelim = delims[0];\r\n\t\tsHdrDelim = delims[1];\r\n\t\tsRowDelim = delims[2];\r\n\t\tsColDelim = delims[3];\r\n\t}\r\n\r\n\t// private\r\n\t/*\r\n\t*\tReturns an array of row indexes\r\n\t*\twhere keyCol = target\r\n\t*/\r\n\tfunction findIndex(keyCol, target)\r\n\t{\r\n\t\tvar aIndexes = new Array();\r\n\t\t// if sorted on the keyCol, then use binary search\r\n\t\tif(sCurSort==keyCol)\r\n\t\t{\r\n\t\t\tvar iLength = dataTable.length;\r\n\t\t\tvar begin = 0;\r\n\t\t\tvar end = iLength-1;\r\n\t\t\tvar cursor;\r\n\t\t\twhile(end-begin>0)\r\n\t\t\t{\r\n\t\t\t\tcursor = (end-begin)/2 + begin;\r\n\t\t\t\tvar curElem = dataTable[cursor][keyCol];\r\n\t\t\t\tif(curElem==target)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(dataTable[cursor-1][keyCol]!=target)\t// we've found the beginning\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// now find all of them\r\n\t\t\t\t\t\twhile(curElem==target)\r\n\t\t\t\t\t\t\taIndexes.push(cursor);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tend = cursor;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tif(curElem<target)\r\n\t\t\t\t\t\tbegin = cursor;\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tend = cursor;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t// else use table scan\r\n\t\telse\r\n\t\t{\r\n\t\t\tfor(var i=0;i<dataTable.length;++i)\r\n\t\t\t\tif(dataTable[cursor][keyCol]==target)\r\n\t\t\t\t\taIndexes.push(i);\r\n\t\t}\r\n\t\treturn aIndexes;\r\n\t}\r\n\t/*\r\n\t*\t\r\n\t*/\r\n\tfunction repForm(a)\r\n\t{\r\n\t\tif(isNaN(a))\r\n\t\t\ta = a.toUpperCase();\r\n\t\telse\r\n\t\t\ta = parseInt(a);\r\n\t\treturn a;\r\n\t}\r\n\t/*\r\n\t*\t\r\n\t*/\r\n\tfunction partition(keyCol, left, right)\r\n\t{\r\n\t\tvar i = left,\r\n\t\t\tj = right;\r\n\t\tvar temp;\r\n\t\tvar pivot = dataTable[Math.floor((left+right)/2)][keyCol];\r\n\r\n\t\twhile(i<=j)\r\n\t\t{\r\n\t\t\twhile(repForm(dataTable[i][keyCol])<repForm(pivot)) ++i;\r\n\t\t\twhile(repForm(dataTable[j][keyCol])>repForm(pivot)) --j;\r\n\t\t\tif(i<=j)\r\n\t\t\t{\r\n\t\t\t\ttemp = dataTable[i];\r\n\t\t\t\tdataTable[i] = dataTable[j];\r\n\t\t\t\tdataTable[j] = temp;\r\n\t\t\t\ti++;\r\n\t\t\t\tj--;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn i;\r\n\t}\r\n\t/*\r\n\t*\t\r\n\t*/\r\n\tfunction quickSort(keyCol, left, right)\r\n\t{\r\n\t\tvar index = partition(keyCol, left, right);\r\n\t\tif(left < index-1)\r\n\t\t\tquickSort(keyCol, left, index-1);\r\n\t\tif(index < right)\r\n\t\t\tquickSort(keyCol, index, right);\r\n\t}\r\n\r\n\tvar dataTable = new Array();\r\n\tvar sTabDelim = \"[jstdTab]\";\r\n\tvar sHdrDelim = \"[jstdHdr]\";\r\n\tvar sRowDelim = \"[jstdRow];\";\r\n\tvar sColDelim = \"[jstdCol],\";\r\n\tvar sCurSort;\r\n\t// public\r\n\tthis.withHeader = false;\r\n\tthis.jstdHTML = \"<table border='1'>[jstdTab]</table>[jstd]<th>[jstdHdr]</th>[jstd]<tr>[jstdRow]</tr>[jstd]<td>[jstdCol]</td>\";\r\n}", "title": "" }, { "docid": "1e154dc97697dcff1c1d2c99590e8df7", "score": "0.6206583", "text": "function TTtable(id, data, objects, keys, tableTitle, titles, split){\n var i, j, k, n, nContentRows, cellContent;\n\n insertDOM('table', id + 'table', 'TTtab', 'border-collapse:collapse;', id, '', '');\n insertDOM('colgroup', id+'colgroup', '', '', id+'table');\n for(i=0; i<split.length-1; i++){\n insertDOM('col', id+'colSpace'+i, '', '', id+'colgroup');\n document.getElementById(id+'colSpace'+i).setAttribute('span', keys.length+1) \n insertDOM('col', id+'col'+i, '', 'border-left:1px solid white;', id+'colgroup');\n document.getElementById(id+'col'+i).setAttribute('span', '1')\n }\n\n\n if(tableTitle != ''){\n insertDOM('tr', id+'tableTitleRow', '', '', id+'table', '', '');\n insertDOM('td', id+'tableTitle', '', '', id+'tableTitleRow', '', tableTitle);\n document.getElementById(id+'tableTitle'). setAttribute('colspan', (1+keys.length)*split.length)\n }\n\n insertDOM('tr', id+'tableHeaderRow', '', '', id+'table', '', '');\n for(k=0; k<split.length; k++){\n //insertDOM('td', 'spacerCell'+k, '', '', id+'tableHeaderRow','',''); \n for(j=0; j<titles.length; j++){\n insertDOM('td', id+'headerCell'+j+'col'+k, '', 'padding-left:'+( (j==0 && k!=0) ? 25:10 )+'px; padding-right:'+( (j==titles.length-1) ? 25:10 )+'px;', id+'tableHeaderRow','',titles[j]); \n }\n }\n \n nContentRows = Math.max.apply(null, split);\n\n //build table:\n for(i=0; i<nContentRows; i++){\n //rows\n insertDOM('tr', id+'row'+i, '', '', id+'table', '', '');\n //cells\n for(j=0; j<titles.length*split.length; j++){\n insertDOM('td', id+'row'+i+'cell'+j, '', 'padding:0px; padding-right:'+( (j%(titles.length+1)==0 && j!=0) ? 25:10 )+'px; padding-left:'+( (j%titles.length == 0 && j!=0) ? 25:10 )+'px', id+'row'+i, '', '' );\n //if(j%(keys.length+1)==keys.length && j!=titles.length*split.length-1 ){\n // document.getElementById(id+'row'+i+'cell'+j).setAttribute('style', 'border-right:1px solid white');\n //}\n }\n }\n\n //fill table:\n n=0;\n for(i=0; i<split.length; i++){\n for(j=0; j<split[i]; j++){\n document.getElementById(id+'row'+j+'cell'+(titles.length*i)).innerHTML = objects[n];\n for(k=0; k<keys.length; k++){\n if(typeof data[objects[n]][keys[k]] == 'string')\n cellContent = data[objects[n]][keys[k]];\n else \n cellContent = data[objects[n]][keys[k]].toFixed(window.parameters.tooltipPrecision)\n if(cellContent == 0xDEADBEEF) cellContent = '0xDEADBEEF'\n document.getElementById(id+'row'+j+'cell'+(1+titles.length*i+k)).innerHTML = cellContent;\n }\n n++;\n }\n }\n\n}", "title": "" }, { "docid": "c95a2f24c89807db27418be9ab683d21", "score": "0.6172658", "text": "function TTtable(id, data, objects, keys, rowTitles, tableTitle, titles, split){\n var i, j, k, n, nContentRows, cellContent;\n\n injectDOM('table', id+'table', id, {'class':'TTtab', 'style':'border-collapse:collapse'});\n injectDOM('colgroup', id+'colgroup', id+'table', {});\n for(i=0; i<split.length-1; i++){\n injectDOM('col', id+'colSpace'+i, id+'colgroup', {'span':keys.length+1});\n injectDOM('col', id+'col'+i, id+'colgroup', {'style':'border-left:1px solid white;', 'span':'1'});\n }\n\n\n if(tableTitle != ''){\n injectDOM('tr', id+'tableTitleRow', id+'table', {});\n injectDOM('td', id+'tableTitle', id+'tableTitleRow', {'innerHTML':tableTitle, 'colspan':(1+keys.length)*split.length});\n }\n\n injectDOM('tr', id+'tableHeaderRow', id+'table', {});\n for(k=0; k<split.length; k++){\n for(j=0; j<titles.length; j++){\n injectDOM('td', id+'headerCell'+j+'col'+k, id+'tableHeaderRow', {\n 'style' : 'padding-left:'+( (j==0 && k!=0) ? 25:10 )+'px; padding-right:'+( (j==titles.length-1) ? 25:10 )+'px;',\n 'innerHTML' : titles[j]\n });\n }\n }\n \n nContentRows = Math.max.apply(null, split);\n\n //build table:\n for(i=0; i<nContentRows; i++){\n //rows\n injectDOM('tr', id+'row'+i, id+'table', {});\n //cells\n for(j=0; j<titles.length*split.length; j++){\n injectDOM('td', id+'row'+i+'cell'+j, id+'row'+i, {\n 'style' : 'padding:0px; padding-right:'+( (j%(titles.length+1)==0 && j!=0) ? 25:10 )+'px; padding-left:'+( (j%titles.length == 0 && j!=0) ? 25:10 )+'px'\n });\n //if(j%(keys.length+1)==keys.length && j!=titles.length*split.length-1 ){\n // document.getElementById(id+'row'+i+'cell'+j).setAttribute('style', 'border-right:1px solid white');\n //}\n }\n }\n\n //fill table:\n n=0;\n\n for(i=0; i<split.length; i++){\n for(j=0; j<split[i]; j++){\n document.getElementById(id+'row'+j+'cell'+(titles.length*i)).innerHTML = rowTitles[n];\n for(k=0; k<keys.length; k++){\n\n if(typeof data[objects[n]][keys[k]] == 'string')\n cellContent = data[objects[n]][keys[k]];\n else\n cellContent = data[objects[n]][keys[k]].toFixed(window.parameters.tooltipPrecision);\n if(cellContent == 0xDEADBEEF) cellContent = '0xDEADBEEF'\n document.getElementById(id+'row'+j+'cell'+(1+titles.length*i+k)).innerHTML = cellContent;\n }\n n++;\n }\n }\n\n}", "title": "" }, { "docid": "1a48955974950a58db5c0c4bd8d8b20d", "score": "0.6155172", "text": "function showTable2(entityIndex) {\n\n var table = new Table({\n\n chars: {\n 'top': '═',\n 'top-mid': '╤',\n 'top-left': '╔',\n 'top-right': '╗',\n 'bottom': '═',\n 'bottom-mid': '╧',\n 'bottom-left': '╚',\n 'bottom-right': '╝',\n 'right': '║',\n 'left': '║',\n 'left-mid': '╟',\n 'mid': '─',\n 'mid-mid': '┼',\n 'right-mid': '╢',\n 'middle': '│'\n }\n });\n\n table.push(\n [\"First Name\", addressBook.entries[entityIndex].firstName], [\"Last Name\", addressBook.entries[entityIndex].lastName], [\"Birthday\", addressBook.entries[entityIndex].birthDay], [\"Addresses\", addressBook.entries[entityIndex].addressLine + \"\\n\" + addressBook.entries[entityIndex].city + \", \" + addressBook.entries[entityIndex].province + \" \" + addressBook.entries[entityIndex].postalCode + \"\\n\" + addressBook.entries[entityIndex].country], [\"Phones\", addressBook.entries[entityIndex].phoneType + \": \" + addressBook.entries[entityIndex].phoneNumber], [\"Emails\", addressBook.entries[entityIndex].emailType + \": \" + addressBook.entries[entityIndex].emailAddress]\n );\n console.log(table.toString());\n\n //console.log(addressBook.entries[count].firstName + addressBook.entries[count].lastName + ' has been Saved');\n count += 1;\n callEditOptions();\n}", "title": "" }, { "docid": "d53af9c9e14bb943ed8edd8c3023e9e8", "score": "0.61446977", "text": "function tables() {\n return tables;\n }", "title": "" }, { "docid": "f57880e94eb42a7ffd9b61f686c0f0e6", "score": "0.61198366", "text": "function prepareData(tables) {\n // get the id's of each table and add the row string\n let tableIds = [];\n for (const table of tables) {\n tableIds.push({\n tableClass: table.getAttribute(\"id\"),\n rowClass: table.getAttribute(\"id\") + \"-row\",\n })\n }\n\n // get the row for each table\n for (const table of tableIds) {\n table.rows = Array.from(document.querySelectorAll(\".\" + table.rowClass));\n }\n\n\n // check if there have been any new rows added to any table\n if (newRows.length) {\n for (const table of tableIds) {\n for (const newRow of newRows) {\n // insert the newly constructed row to its appropriate table\n if (newRow.dbPropertyName === table.tableClass) table.rows.push(newRow.row);\n }\n }\n }\n\n // shorting the array to ascending order\n bubbleShort(tableIds);\n\n // transform the table rows into the format the database expects\n for (const table of tableIds) {\n for (let i = 0; i < table.rows.length; ++i) {\n // remove deleted items\n if (table.rows[i].classList.contains(\"delete\")) {\n table.rows.splice(i, 1);\n // -i happens when an item is removed, if not one row shall not be converted\n --i;\n\n } else { // change the format\n table.rows[i] = changeFormat(table.rows[i], table.tableClass);\n }\n }\n }\n\n return tableIds;\n}", "title": "" }, { "docid": "0706908199664abf2566215eda09cc2b", "score": "0.6089349", "text": "function set_table(){\n\tlet table = document.getElementById('order');\n\tlet i;\n\tlet j;\n\n\tfor (i = 0; i < (store.orderHistory).length; i++){\n\t\tlet row = table.insertRow(i+2);\n\t\tfor (j = 0; j < 6; j++){\n\t\t\tlet cell = row.insertCell(j);\n\t\t\tcell.innerHTML = (store.orderHistory)[i][j];\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "8367b0f88a05741e55e300deadfaf168", "score": "0.60577166", "text": "function make_table_for_external_dispatcher(id_of_table , row_class_name , state , all){\n let table_witch_contains_id = document.getElementById(id_of_table);\n let table_rows_with_class_name = document.getElementsByClassName(row_class_name);\n while (table_rows_with_class_name.length){ // delete all row of certain table\n table_rows_with_class_name[0].remove();\n }\n let prepared_times = [] ;\n let all_prepared_times_ids = {};\n\n for (let calendar = 0 ; calendar < gates.array_of_calendars.length; calendar++){\n let index_for_this_date = gates.array_of_calendars[calendar].get_index_by_real_time(document.getElementById('input_date').value); // da sa pouzit premena 'selected_date'\n if (index_for_this_date !== -1 ){\n for (let certain_time_slot = 0; certain_time_slot < gates.array_of_calendars[calendar].time_slots[index_for_this_date].states.length ; certain_time_slot++){\n if (gates.array_of_calendars[calendar].time_slots[index_for_this_date].states[certain_time_slot] === state){\n // pokial je row prepared negenegrovat s rovnakim casom ak sa uz cas nachada v\n if (state === 'prepared' && ! prepared_times.includes(gates.array_of_calendars[calendar].time_slots[index_for_this_date].start_times[certain_time_slot])){\n prepared_times.push(gates.array_of_calendars[calendar].time_slots[index_for_this_date].start_times[certain_time_slot]);\n all_prepared_times_ids[gates.array_of_calendars[calendar].time_slots[index_for_this_date].start_times[certain_time_slot]] = [gates.array_of_calendars[calendar].time_slots[index_for_this_date].ids[certain_time_slot]];\n }else if(state === 'prepared'){\n all_prepared_times_ids[gates.array_of_calendars[calendar].time_slots[index_for_this_date].start_times[certain_time_slot]].push(gates.array_of_calendars[calendar].time_slots[index_for_this_date].ids[certain_time_slot]);\n continue;\n }\n let row = table_witch_contains_id.insertRow();\n row.className = row_class_name;\n let cell1 = row.insertCell(0);\n if (all){\n cell1.innerHTML = gates.array_of_calendars[calendar].time_slots[index_for_this_date].start_times[certain_time_slot];\n }else{\n cell1.innerHTML = gates.array_of_calendars[calendar].time_slots[index_for_this_date].start_times[certain_time_slot].split(\" \")[1];\n }\n // tuna bude podmienka na nieje prepared tak wiplni innner html cell2 a cell3 s menami jazdcov a EVC\n let cell2 = row.insertCell(1);\n let cell3 = row.insertCell(2);\n let cell4 = row.insertCell(3);\n let cell5 = row.insertCell(4);\n if (state !== 'prepared'){\n if (gates.array_of_calendars[calendar].time_slots[index_for_this_date].kamionists_2[certain_time_slot] !== null){\n cell2.innerHTML = gates.array_of_calendars[calendar].time_slots[index_for_this_date].kamionists_1[certain_time_slot]\n +\"<br>\"+gates.array_of_calendars[calendar].time_slots[index_for_this_date].kamionists_2[certain_time_slot];\n }else{\n cell2.innerHTML = gates.array_of_calendars[calendar].time_slots[index_for_this_date].kamionists_1[certain_time_slot];\n }\n\n\n cell3.innerHTML = gates.array_of_calendars[calendar].time_slots[index_for_this_date].evcs[certain_time_slot];\n cell4.innerHTML = gates.array_of_calendars[calendar].time_slots[index_for_this_date].destinations[certain_time_slot];\n\n if (gates.array_of_calendars[calendar].time_slots[index_for_this_date].commoditys[certain_time_slot].length > 40){\n create_html_linked_text(gates.array_of_calendars[calendar].time_slots[index_for_this_date].commoditys[certain_time_slot],cell5)\n\n }else{\n cell5.innerHTML = gates.array_of_calendars[calendar].time_slots[index_for_this_date].commoditys[certain_time_slot];\n }\n\n\n }\n\n let cell6 = row.insertCell(5);\n\n // treba pridat funkcionalitu buutonom\n if (state === 'prepared'){\n let apply_button = document.createElement(\"BUTTON\")\n apply_button.className=\"btn btn-default bg-success only_one\";\n apply_button.innerHTML=\"apply\";\n apply_button.onclick = function (){\n Time_slot.open_time_slot(all_prepared_times_ids[gates.array_of_calendars[calendar].time_slots[index_for_this_date].start_times[certain_time_slot]].random(),'prepared');\n }\n cell6.className=\"td_flex_buttons\";\n if (actual_date_now >gates.array_of_calendars[calendar].time_slots[index_for_this_date].start_times[certain_time_slot]){\n }else{\n cell6.appendChild(apply_button);\n }\n\n }else if(state === 'requested'){\n let show_button = document.createElement(\"BUTTON\")\n show_button.className=\"btn btn-default bg-primary only_one\";\n show_button.innerHTML=\"show\";\n show_button.onclick = function (){\n Time_slot.open_time_slot(gates.array_of_calendars[calendar].time_slots[index_for_this_date].ids[certain_time_slot],'requested');\n }\n cell6.className=\"td_flex_buttons\";\n if (actual_date_now >gates.array_of_calendars[calendar].time_slots[index_for_this_date].start_times[certain_time_slot]){\n }else{\n cell6.appendChild(show_button);\n }\n\n }\n }\n }\n }\n }\n // }\n}", "title": "" }, { "docid": "9ffd3fc3ed46b1d56b16eb7e7f18a33a", "score": "0.6054898", "text": "function createVirtualTable() {\n var rows = domTable.rows;\n for (var rowIndex = 0; rowIndex < rows.length; rowIndex++) {\n var cells = rows[rowIndex].cells;\n for (var cellIndex = 0; cellIndex < cells.length; cellIndex++) {\n addCellInfoToVirtual(rows[rowIndex], cells[cellIndex]);\n }\n }\n }", "title": "" }, { "docid": "16d8e463400f025d93c955df869e43b0", "score": "0.6033506", "text": "buildHtmlTable(arr) {\n var table = _table_.cloneNode(false), columns = this.addAllColumnHeaders(arr, table);\n for (var i = 0, maxi = arr.length; i < maxi; ++i) {\n var tr = _tr_.cloneNode(false);\n for (var j = 0, maxj = columns.length; j < maxj; ++j) {\n var td = _td_.cloneNode(false);\n var cellValue = arr[i][columns[j]].toString();\n //td.appendChild<Text>(document.createTextNode(arr[i][columns[j]] || ''));\n td.appendChild(document.createTextNode(cellValue || ''));\n tr.appendChild(td);\n }\n table.appendChild(tr);\n }\n /* var trList : NodeListOf<ChildNode> = table.childNodes;\n console.log(trList)\n for(var index = 0; index < trList.length; index++) {\n trList[index].addEventListener(\"mouseover\", (e: Event) => {\n const t = e.target as HTMLTableSectionElement;\n console.log(t);\n //const usuario: IUser = this.getUsuariosById(t.id);\n //alert(\"Row Clicked\");\n });\n } */\n return table;\n }", "title": "" }, { "docid": "85945091edefa3880b4918ba9b3f9114", "score": "0.602913", "text": "function convert_device_uplink_headers_database_to_table(device_uplink,view){cov_oh5eqgm35.f[4]++;let headers_database=(cov_oh5eqgm35.s[133]++,Object.keys(device_uplink));let headers_table=(cov_oh5eqgm35.s[134]++,[]);let place_holder=(cov_oh5eqgm35.s[135]++,{});//object which will store the text and value data\nlet x;//this is just a place holder for the value returned by device_uplink_headers_database_to_table_LUT\ncov_oh5eqgm35.s[136]++;for(let i=0;i<headers_database.length;i++){cov_oh5eqgm35.s[137]++;x=device_uplink_headers_database_to_table_LUT(headers_database[i],view);cov_oh5eqgm35.s[138]++;if(x!=null){cov_oh5eqgm35.b[37][0]++;cov_oh5eqgm35.s[139]++;place_holder[\"text\"]=x;cov_oh5eqgm35.s[140]++;place_holder[\"value\"]=headers_database[i];cov_oh5eqgm35.s[141]++;headers_table.push(place_holder);cov_oh5eqgm35.s[142]++;place_holder={};}else{cov_oh5eqgm35.b[37][1]++;}}cov_oh5eqgm35.s[143]++;return headers_table;}//Takes as the input an array of lenght 1 of the device uplink data and returns the headers in the form {text: \"Table form\", value: \"database form\"};", "title": "" }, { "docid": "4ea0e9601a324d0e91143435bc18e8e6", "score": "0.6029026", "text": "function tableP(element) { \r\n\r\n\r\n\r\n}", "title": "" }, { "docid": "e53b23891d37aba8a3744c072d8240ad", "score": "0.60197663", "text": "function createTableDomElements() {\r\n\r\n createTableHoursOfOperationTh();\r\n\r\n createTableCookiesPerHourTd();\r\n\r\n createTableTotalsTd();\r\n}", "title": "" }, { "docid": "489f85c6eee5d8b259c6c2352227e1cf", "score": "0.60194546", "text": "function createVirtualTable() {\n var rows = domTable.rows;\n for (var rowIndex = 0; rowIndex < rows.length; rowIndex++) {\n var cells = rows[rowIndex].cells;\n for (var cellIndex = 0; cellIndex < cells.length; cellIndex++) {\n addCellInfoToVirtual(rows[rowIndex], cells[cellIndex]);\n }\n }\n }", "title": "" }, { "docid": "489f85c6eee5d8b259c6c2352227e1cf", "score": "0.60194546", "text": "function createVirtualTable() {\n var rows = domTable.rows;\n for (var rowIndex = 0; rowIndex < rows.length; rowIndex++) {\n var cells = rows[rowIndex].cells;\n for (var cellIndex = 0; cellIndex < cells.length; cellIndex++) {\n addCellInfoToVirtual(rows[rowIndex], cells[cellIndex]);\n }\n }\n }", "title": "" }, { "docid": "489f85c6eee5d8b259c6c2352227e1cf", "score": "0.60194546", "text": "function createVirtualTable() {\n var rows = domTable.rows;\n for (var rowIndex = 0; rowIndex < rows.length; rowIndex++) {\n var cells = rows[rowIndex].cells;\n for (var cellIndex = 0; cellIndex < cells.length; cellIndex++) {\n addCellInfoToVirtual(rows[rowIndex], cells[cellIndex]);\n }\n }\n }", "title": "" }, { "docid": "489f85c6eee5d8b259c6c2352227e1cf", "score": "0.60194546", "text": "function createVirtualTable() {\n var rows = domTable.rows;\n for (var rowIndex = 0; rowIndex < rows.length; rowIndex++) {\n var cells = rows[rowIndex].cells;\n for (var cellIndex = 0; cellIndex < cells.length; cellIndex++) {\n addCellInfoToVirtual(rows[rowIndex], cells[cellIndex]);\n }\n }\n }", "title": "" }, { "docid": "f4133b9e8246f031b4e3a9ac6bdb0bd8", "score": "0.5979939", "text": "function tableMaker() {\n var tblEl = document.getElementById('sales-tbl');\n var header = tableHead();\n var body = tableBody();\n var footer = tableFooter();\n tblEl.appendChild(header);\n tblEl.appendChild(body);\n tblEl.appendChild(footer);\n}", "title": "" }, { "docid": "03b2da04a321a9f8c62588a03367951f", "score": "0.59753186", "text": "function createVirtualTable() {\n var rows = domTable.rows;\n\n for (var rowIndex = 0; rowIndex < rows.length; rowIndex++) {\n var cells = rows[rowIndex].cells;\n\n for (var cellIndex = 0; cellIndex < cells.length; cellIndex++) {\n addCellInfoToVirtual(rows[rowIndex], cells[cellIndex]);\n }\n }\n }", "title": "" }, { "docid": "75a24afe60e1331d774eb4db0f0d2c99", "score": "0.5969739", "text": "function generateTable(table, data) {\n while(table.rows[0]) table.deleteRow(0);\n console.log(table.rows)\n for (let element of data) {\n let row = table.insertRow();\n for (key in element) {\n let cell = row.insertCell();\n let text = document.createTextNode(element[key]);\n cell.appendChild(text);\n }\n }\n }", "title": "" }, { "docid": "8a5c89d44bd1009fad10d86cbf135328", "score": "0.59485984", "text": "function table(data) {\n var table = new Table({\n head: ['Department Id#', 'Department Name', 'Overhead Costs', 'Department Sales', 'Total Profit'],\n style: {\n head: ['blue'],\n compact: false,\n colAligns: ['center'],\n }\n });\n //loop through each item in the mysql bamazon database and push data into a new row in the table\n for (var i = 0; i < data.length; i++) {\n table.push(\n [data[i].department_id, data[i].department_name, (data[i].over_head_costs).toFixed(2), (data[i].department_sales).toFixed(2), (data[i].total_profit).toFixed(2)],\n );\n };\n console.log(table.toString());\n afterConnectionOperation();\n}", "title": "" }, { "docid": "4a29f3ca7aa601819f9f1b5a7bc6fd6f", "score": "0.5943221", "text": "function tableLinkCreator(nameTable, nameField, array){\n var tab = [];\n var k = 0 ;\n var bool = [];\n for (var i = 0; i<array.length; i++){\n bool.push(false);\n }\n while (k<= array.length){\n if(bool[k] == false){\n tab.push(array[k]);\n bool[k] = true;\n for (var i =k+1; i<array.length; i++){\n var tmptab =[];\n var tmparray = [];\n for (var key in tab[0]) {\n tmptab.push(key);\n }\n for (var keyT in array[i]) {\n tmparray.push(keyT);\n }\n if(bool[i] == false && (tmptab[1] == tmparray[1])){\n tab.push(array[i]);\n console.log(tab);\n bool[i] = true;\n }\n }\n writeLinkedArrayToJson(nameTable, nameField, tab);\n }\n k +=1;\n tab = [];\n }\n}", "title": "" }, { "docid": "aa9744de0c454eec72b246cacd50fc45", "score": "0.5940713", "text": "function CanvasTbl() {}", "title": "" }, { "docid": "6fb6f78625e58413e48e0d663a960317", "score": "0.5927291", "text": "function StatementArrays(pro,pas,pre,par,key){\r\n let table=[];\r\n table[0]=MakeUpperArray(Simple(mod1,pro,pas,pre,key));\r\n table[1]=MakeUpperArray(Progressive(mod1,pro,pre,key));\r\n table[2]=MakeUpperArray(Perfect(mod2,pro,pre,par,key));\r\n table[3]=MakeUpperArray(PerfectProgressive(mod2,pro,pre,key));\r\n return table;\r\n}", "title": "" }, { "docid": "778ff1bc97b70ebfa31f40b8f8f584f9", "score": "0.59234315", "text": "function Get_Table_Elements(text, option)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\tvar tableblocks=text.split(':');\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\tif (tableblocks.length==1) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t{\tvar tempdata=tableblocks[0].split(\".\");\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t\tvar columnnumber=(tempdata[1].replace(\"$\",\"\"));\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t\tcolumnnumber=parseInt(columnnumber.charCodeAt())-62;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t\tvar rownumber=parseInt(tempdata[2].replace(\"$\",\"\"))+2;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t\tvar numbers=DOM_Object[tempdata[0]]['real'][rownumber+'-'+columnnumber];\t\t\t\t\t\t\t\t\t\t//\t\\\n\t\tvar units=DOM_Object[tempdata[0]]['units'][rownumber+'-'+columnnumber];\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t\tif (typeof(units)==\"undefined\") { units=\"\"; }\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t}else\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t{\tvar tempdata1=tableblocks[0].split(\".\");\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t\tvar columnnumber1=(tempdata1[1].replace(\"$\",\"\"));\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t\tcolumnnumber1=parseInt(columnnumber1.charCodeAt())-62;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t\tvar rownumber1=parseInt(tempdata1[2].replace(\"$\",\"\"))+2;\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t\tvar tempdata2=tableblocks[1].split(\".\");\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t\tvar columnnumber2=(tempdata2[1].replace(\"$\",\"\"));\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t\tcolumnnumber2=parseInt(columnnumber2.charCodeAt())-62;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t\tvar rownumber2=parseInt(tempdata2[2].replace(\"$\",\"\"))+2;\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t\tvar numbers=''\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t\tvar numberarray=new Array();\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t\tvar counter=0;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t\tfor (var a=rownumber1; a<=rownumber1+(rownumber2-rownumber1); a++)\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t\t{\tfor (var b=columnnumber1; b<=columnnumber1+(columnnumber2-columnnumber1); b++)\t\t\t\t\t\t\t\t//\t\\\n\t\t\t{\tnumberarray[counter]=DOM_Object[tempdata1[0]]['real'][a+'-'+b];\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t\t\t\tcounter=counter+1;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t\t\t\tnumbers=numbers+\", \"+DOM_Object[tempdata1[0]]['real'][a+'-'+b];\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\t}\t}\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\\n\tif (option===0) { return numbers; }else if (option==1) { return numberarray; }\t\t\t\t\t\t\t\t\t\t//\t\\\n}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\\", "title": "" }, { "docid": "ab504f60617aaa990dea1ffe1bfc3bf2", "score": "0.59154636", "text": "function createTable(){\r\n var table = \"\";\r\n for(var i=0; i<ROWS; i++){\r\n var cur_row = \"\";\r\n cur_row += `<tr id=\"row-${i}\">`;\r\n for(var j=0; j<COLS; j++){\r\n cur_row += `<td id=\"${i},${j}\" class=\"dead\" onclick=\"set(id)\"></td>`;\r\n }\r\n cur_row += `</tr>`\r\n table += cur_row;\r\n }\r\n document.getElementById('petri').innerHTML = table;\r\n}", "title": "" }, { "docid": "05578d734dc23db5f8f1bf9e13b5c56c", "score": "0.5894745", "text": "function getArraysFromTable() {\n\n td = document.querySelectorAll('td');\n tr = document.querySelectorAll(\"tr\");\n\n let quantity = td.length;\n const td0 = Array.from(tr, el => el.querySelectorAll('td')[0].textContent);\n const td1 = Array.from(tr, el => el.querySelectorAll('td')[1].textContent);\n\n return arrTable = [td0.slice(1, td0.length), td1.slice(1, td1.length)];\n\n // addCell();\n }", "title": "" }, { "docid": "481c8a2542b631cc0a0ecb70ce139b25", "score": "0.58871126", "text": "static modifyTable() { return 'test'; }", "title": "" }, { "docid": "65dc35019ab15025e5de3d929c017d60", "score": "0.58786994", "text": "function updateTable() {\r\n // Clear the current table contents\r\n resetTable();\r\n\r\n let resultTable = generateTable(\"multTable\");\r\n}", "title": "" }, { "docid": "37c662f7017a17e0010cec1dc2f8891c", "score": "0.5864985", "text": "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < tableData.length; i++) {\n \n var data = tableData[i];\n var fields = Object.keys(data);\n \n\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = data[field];\n }\n }\n }", "title": "" }, { "docid": "85958284e54af2295ccdd767969e2bac", "score": "0.58591634", "text": "function fillTableView(table) {\n const rows = Array.from(table.rows);\n for (let i = 1; i < rows.length; i ++) {\n const cells = Array.from(rows[i].cells);\n for (let j = 1; j < cells.length; j ++) {\n cells[j].innerText = matrix[i - 1][j - 1];\n }\n }\n }", "title": "" }, { "docid": "5a0ebed89fa0115223e6b5e2180db88c", "score": "0.5838636", "text": "buildTable() {\n this.currentY = 0;\n this.currentX = 0;\n this.currentRow = 1;\n this.currentIndex = 0;\n this.shapesMap = {};\n this.betHistory = [];\n this.chipAmountMap = {};\n\n this.setChipValue(100);\n\n Object.keys(tableData['Rows']).forEach((curRow, index) => {\n tableData['Rows'][curRow].map(this.makeTableItem.bind(this))\n })\n }", "title": "" }, { "docid": "45c280aa5d9612e36eb09e2b865ecbcc", "score": "0.58370787", "text": "function getTableDetails(t){return A.map(t.rows,function(t){var e=A.map(t.cells,function(A){var t=A.hasAttribute(\"rowspan\")?parseInt(A.getAttribute(\"rowspan\"),10):1,e=A.hasAttribute(\"colspan\")?parseInt(A.getAttribute(\"colspan\"),10):1;return{element:A,rowspan:t,colspan:e}});return{element:t,cells:e}})}", "title": "" }, { "docid": "340ccb04dd281d6efe3087c2068a7688", "score": "0.58360124", "text": "function makeTable(table, data) {\n for (let element of data){\n let row=table.insertRow();\n for (key in element){\n let cell= row.insertCell();\n let text= document.createTextNode(element[key]);\n cell.appendChild(text);\n }\n }\n}", "title": "" }, { "docid": "b28d3435808c8fd79e44dd50aff50aea", "score": "0.5816889", "text": "function drawtable()\n{\n // going to use a template for this!\n\n // example table data row { id: \"CDL\", rank: 1949, \"change\": 23, \"winp\" : 84.4, \"run\" : \"wwwwwwwwww\" },\n\n // need in the item s_players,\n // {{:rank}}\n // {{:change}}\n // {{:id}} - initials\n // {{:record}} - win percentage\n // {{:gamerun}} - last ten games results\n\n // the template then executes for each of the elements in this.\n\n var active_players = getplayers(tabledata.singles, 0);\n var inactive_players = getplayers(tabledata.inactive_singles, active_players.length);\n var results = getresults(all_results, 25);\n var upsets = getupsets(all_results.slice(-500));\n\n var template = $.templates(\"#playerTemplate\");\n var htmlOutput = template.render(active_players);\n $(\"#s_tbl\").html(htmlOutput);\n\n var template = $.templates(\"#inactive_player_template\");\n var htmlOutput = template.render(inactive_players);\n $(\"#inactive_tbl\").html(htmlOutput);\n\n var recent_res_template = $.templates(\"#resultTemplate\");\n var htmlOutput = recent_res_template.render(results);\n $(\"#rec_res_tbl\").html(htmlOutput);\n\n var upsets_template = $.templates(\"#upsetTemplate\");\n var htmlOutput = upsets_template.render(upsets);\n $(\"#upset_tbl\").html(htmlOutput);\n\n// players = getplayers(tabledata.doubles);\n// template = $.templates(\"#rowTemplate\");\n// htmlOutput = template.render(players);\n\n// $(\"#d_tbl\").html(htmlOutput);\n}", "title": "" }, { "docid": "8fe3e8f57ebf72366fdf5d5a722c4e0e", "score": "0.58082396", "text": "function DrawTable(){\r\n var html = ''; \r\n html = html + '<tr>';\r\n for (i = 0;i<map.length;i++){\r\n\r\n for(j=0;j<map[i].length;j++){\r\n html = html + '<td id=\"cell-'+j+'-'+i+'\"></td>';\r\n }\r\n html = html + '</tr>'; \r\n }\r\n $('#stage').append( html );\r\n }", "title": "" }, { "docid": "051778076056d2029682a2b863228994", "score": "0.58040106", "text": "function genBatttalionTable(){\n// let script = document.createElement(\"script\")\n// script.setAttribute(\"src\", \"https://kryogenix.org/code/browser/sorttable/sorttable.js\")\n// document.getElementsByTagName(\"head\")[0].appendChild(script);\n let base = parseTableObject(document.querySelector(\"#base table\"));\n let growth = parseTableObject(document.querySelector(\"#growth table\"));\n let stats = [\"Phys\", \"Mag\", \"Hit\", \"Crit\", \"Avo\", \"Prot\", \"Res\", \"Cha\"]\n base.forEach(function(b, idx){\n let g = growth[idx];\n stats.map((s) => b[s] = Math.floor(Number(b[s]) + Number(g[s])*4));\n })\n let arr = [Object.keys(base[0])].concat(base.map(Object.values));\n let table = genTableArray(arr);\n table.id = \"final\";\n// table.setAttribute(\"class\", \"sortable\")\n// sorttable.makeSortable(table);\n document.getElementById(\"base\").parentElement.appendChild(table);\n}", "title": "" }, { "docid": "e2f410a983da8673390fa63ef8791b8c", "score": "0.5798893", "text": "function generateTableContent(table, data) {\n for (let element of data) {\n let row = table.insertRow();\n for (let key in element) {\n // Excludes ID field from table\n //if (!(key.match(\"id\"))) {\n let cell = row.insertCell();\n let cellText = document.createTextNode(element[key]);\n let tagName = document.createAttribute(\"name\");\n tagName.value = key;\n cell.setAttributeNode(tagName);\n cell.appendChild(cellText);\n //}\n }\n }\n}", "title": "" }, { "docid": "91b547218a151e93cf438d781fe0aa80", "score": "0.5797592", "text": "function renderTable() {\n $tbody.innerHTML = \"\";\n var alienSubset = dataSetFilter.slice(startIdx, endIdx);\n \n for (var i = 0; i < alienSubset.length; i++) {\n var aliencurrent = alienSubset[i];\n var alienrow = Object.keys(aliencurrent);\n\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < alienrow.length; j++) {\n \n var alienpoint = alienrow[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = aliencurrent[alienpoint];\n }\n }\n}", "title": "" }, { "docid": "d2044410abd97b1cd3dffb2b9b0bdbbd", "score": "0.5796565", "text": "constructor(tables) {\r\n this.cells = [];\r\n this.links = [];\r\n this.populate(tables);\r\n }", "title": "" }, { "docid": "a1df33f0bae60abd450aee9f63a7e171", "score": "0.5776435", "text": "function preCourseJsonToTable() {}", "title": "" }, { "docid": "c89893d0a01ea4a377e7ffbaaff7873d", "score": "0.57544327", "text": "constructor(tableElements) {\r\n this.tableElements= tableElements;\r\n \r\n }", "title": "" }, { "docid": "2e67d6d51f6591022245b27dd2148e23", "score": "0.5753814", "text": "unionProperty(firstIndex) {\n // First we create a copy of the current tableDataExplore\n let tableData = _.cloneDeep(this.state.tableData);\n\n // we get the siblingArray of the current property neighbour\n let siblingArray = this.state.propertyNeighbours[firstIndex].siblingArray;\n\n for (let i = 0; i < siblingArray.length; ++i) {\n // We get the tableArray and name of the current sibling page\n let tableArray = siblingArray[i].tableArray;\n let otherTableOrigin = siblingArray[i].name;\n // console.log(otherTableOrigin);\n // If the current sibling has no tables that are unionable, we break out of the loop.\n // Because siblingArray is sorted by the length of their tableArray\n if (tableArray.length === 0) {\n break;\n }\n // Else, we want to union all unionable tables from the current sibling page\n else {\n for (let j = 0; j < tableArray.length; ++j) {\n // We get the clean data for the current \"other table\"\n let otherTableData = setTableFromHTML(\n tableArray[j].data,\n otherTableOrigin\n );\n // We fetch the column header row\n let headerRow = otherTableData[0];\n otherTableData = setUnionData(otherTableData);\n // Let's do some checking here: we do not want to union the same table with itself\n let sameTable = false;\n if (otherTableOrigin === decodeURIComponent(this.state.urlPasted.slice(30)) && headerRow.length === tableData[0].length) {\n let diffColFound = false;\n for (let m=0; m<headerRow.length; ++m) {\n if (headerRow[m].data !== this.state.tableHeader[m].value) {\n diffColFound = true;\n break;\n }\n }\n if (diffColFound === false) {\n sameTable = true;\n }\n }\n // We create a copy of the colMapping of the current \"oother table\"\n let tempMapping = tableArray[j].colMapping.slice();\n\n // if sameTable is false, we can safely union the data\n if (sameTable === false) {\n tableData = tableConcat(\n tableData,\n otherTableData,\n tempMapping\n );\n }\n }\n }\n }\n\n // Support for undo: \n let lastAction = \"unionProperty\";\n let prevState = \n {\n \"tableData\":this.state.tableData,\n };\n\n this.setState({\n tableData: tableData,\n lastAction: lastAction,\n prevState: prevState,\n });\n }", "title": "" }, { "docid": "5774ad9c40240419f71b0a5396310d19", "score": "0.5746833", "text": "function updateTables(){\r\n state = tableHistory[historyIndex];\r\n beverages_stockAmounts = state['beverages_stockAmounts'];\r\n\r\n for (let i = 1; i < 5; i++){\r\n tables[\"table\"+i] = state[\"table\"+i]\r\n }\r\n\r\n showOrder(tableClickEvent);\r\n}", "title": "" }, { "docid": "27c09860d0a864622eeadc36f7ee4adf", "score": "0.5741352", "text": "function generateTable(){\n let rows = [];\n let i,j;\n\n for (i = 0; i < props.rows; i++) {\n let columns = [];\n for (j = 0; j < props.columns; j++) {\n columns.push(<td key={i+\"-\"+j} onClick={props.updateValues.bind(null, i, j)}>{props.values[i][j]}</td>);\n }\n rows.push(<tr key={i+\"-\"+j}>{columns}</tr>);\n }\n return rows;\n }", "title": "" }, { "docid": "15ad994d680d1195cff74414206cf146", "score": "0.5733636", "text": "function tableScript(){\n\tlet tableStart = \"CREATE TABLE \" + currentTable + \"<br>(<br>\";\n\tlet tableBody = \"\";\n\tlet tableEnd = \");\";\n\n\tif(Attributes.length > 0){\n\t\tfor (i in Attributes){\n\t\t\ttableBody += Attributes[i].attTitle + \" \";\n\t\t\ttableBody += Attributes[i].attType + \" \";\n\t\t\ttableBody += Attributes[i].attSize + \" \";\n\t\t\tif (Attributes[i].attNull === true){\n\t\t\t\ttableBody += \"NULL \";\n\t\t\t} else {\n\t\t\t\ttableBody += \"NOT NULL \";\n\t\t\t}\n\t\t\tif (Attributes[i].attUnique === true){\n\t\t\t\ttableBody += \"UNIQUE,<br>\";\n\t\t\t} else {\n\t\t\t\ttableBody += \"NOT UNIQUE,<br>\";\n\t\t\t}\n\t\t}\n\t}\n\t\n\tdocument.getElementById(\"scriptDisplay\").innerHTML = tableStart + tableBody + tableEnd;\n}", "title": "" }, { "docid": "8a021c21a65c6ff253e0ea64398161c5", "score": "0.572864", "text": "function changeTable(table) {\n wholeTable = table.getArray();\n headerArray = table.columns;\n updateVariableDropdown();\n rowNum = wholeTable.length;\n columnNum = wholeTable[0].length;\n console.log(wholeTable);\n currMin = wholeTable[0][varIndex];\n currMax = wholeTable[0][varIndex];\n for (let i = 0; i < rowNum; i++) {\n var valNum = wholeTable[i][varIndex];\n currMin = min(currMin,valNum);\n currMax = max(currMax,valNum);\n }\n currMin = currMin - 1;\n currMax = currMax + 1;\n\n\n p3.remove();\n p3 = createP(\"Data min: \"+ currMin);\n p3.id('dataMinLabel');\n p3.position(380, 420);\n p4.remove();\n p4 = createP(\"Data max: \" + currMax);\n p4.id('dataMaxLabel');\n p4.position(380, 170);\n p7.remove();\n p7 = createP(\"Data min: \" + currMin);\n p7.position(680, 420);\n p7.id('dataMinLabel2');\n p8.remove();\n p8 = createP(\"Data max: \" + currMax);\n p8.position(680, 170);\n p8.id('dataMaxLabel2');\n\n\n for (let i = 0; i < wholeTable.length; i++) {\n var valNum = wholeTable[i][varIndex];\n console.log(valNum);\n var sVal = map(valNum, currMin,currMax, angleMin, angleMax);\n var speedValNum = map(valNum, currMin, currMax, speedMin, speedMax);\n servVals[i] = sVal;\n speedValArray[i] = speedValNum;\n var xStart = i * 40 + 80;\n var yStart = 400 - valNum;\n rects.splice(0, rects.length); \n let newB = new Rectangle(xStart, yStart, valNum, sVal);\n rects.push(newB);\n }\n if (wholeTable.length < servVals.length ) {\n //var diff = serVals.length - wholeTable.length;\n servVals.length = wholeTable.length;\n console.log(\"servVals\"+servVals);\n }\n console.log(wholeTable);\n console.log(varIndex);\n console.log(servVals);\n\n //updateTable();\n //makeTable();\n //HTML TABLE TRIAL\n \n var empty1 = selectAll('td');\n for (var x=0; x< empty1.length; x++) {\n empty1[x].remove();\n }\n var empty2 = selectAll('th');\n for (var y=0; y<empty2.length; y++) {\n empty2[y].remove();\n }\n var empty3 = selectAll('.tr_tbody','#tbody_id');\n for (var z=0; z<empty3.length; z++) {\n empty3[z].remove();\n }\n var divPointer = select('#tr_id');\n var divPointer2 = select('#tbody_id')\n for (var i = 0; i < headerArray.length; i++) {\n var th = createElement(\"th\")\n if (headerArray[i] != null) {\n th.html(headerArray[i]);\n }\n th.parent(divPointer);\n }\n for (var i = 0; i < wholeTable.length; i++) {\n var tr = createElement(\"tr\");\n tr.attribute('data', i);\n tr.parent(divPointer2);\n tr.addClass('tr_tbody');\n for (var j = 0; j < wholeTable[0].length; j++) {\n var td_1 = createElement(\"td\");\n td_1.html(wholeTable[i][j]);\n td_1.parent(tr);\n }\n }\n highlightHolder.length=0;\n console.log(\"empty:\"+highlightHolder)\n highlightHolder = selectAll('.tr_tbody');\n console.log(highlightHolder);\n\n}", "title": "" }, { "docid": "0a58227d754f966619572188f31138dc", "score": "0.57267976", "text": "function __veryUglyTable(tableId,tableHeaderId,data,columnArray){\n// add column headers to your table\n for(var i = 0;i<columnArray.length;i++){\n var tr = '<td>' + columnArray[i] + '</td>';\n $(\"#\"+tableHeaderId).append(tr);\n }\n\n// now add table data\n for(var m =0;m<data.length;m++){\n var tr = \"<tr>\";\n for(var i = 0;i<columnArray.length;i++){\n var currentDataItem = data[m];\n var currentColumn = columnArray[i];\n var td = '<td>' + currentDataItem[currentColumn] + '</td>';\n tr = tr+td;\n }\n tr = tr + '</tr>';\n $(\"#\"+tableId).append(tr);\n }\n}", "title": "" }, { "docid": "0a58227d754f966619572188f31138dc", "score": "0.57267976", "text": "function __veryUglyTable(tableId,tableHeaderId,data,columnArray){\n// add column headers to your table\n for(var i = 0;i<columnArray.length;i++){\n var tr = '<td>' + columnArray[i] + '</td>';\n $(\"#\"+tableHeaderId).append(tr);\n }\n\n// now add table data\n for(var m =0;m<data.length;m++){\n var tr = \"<tr>\";\n for(var i = 0;i<columnArray.length;i++){\n var currentDataItem = data[m];\n var currentColumn = columnArray[i];\n var td = '<td>' + currentDataItem[currentColumn] + '</td>';\n tr = tr+td;\n }\n tr = tr + '</tr>';\n $(\"#\"+tableId).append(tr);\n }\n}", "title": "" }, { "docid": "88407fa76c67c8d36edaedbd3c1db554", "score": "0.5724457", "text": "function queryAllProducts() {\n connection.query(\"SELECT * FROM products\", function(err, res) {\n var table = new Table({\n head: ['Item Id#', 'Product Name', 'Department Name', 'Price', 'Stock Quantity'],\n style: {\n head: ['yellow'],\n compact: true,\n colAligns: ['center'],\n },\n chars: {\n 'top': '═',\n 'top-mid': '╤',\n 'top-left': '╔',\n 'top-right': '╗',\n 'bottom': '═',\n 'bottom-mid': '╧',\n 'bottom-left': '╚',\n 'bottom-right': '╝',\n 'left': '║',\n 'left-mid': '╟',\n 'mid': '─',\n 'mid-mid': '┼',\n 'right': '║',\n 'right-mid': '╢',\n 'middle': '│'\n }\n });\n for (var i = 0; i < res.length; i++) {\n table.push(\n [res[i].item_id, res[i].product_name, res[i].department_name, \"$\" + res[i].price, res[i].stock_quantity]\n );\n }\n\n //this console.logs the table\n console.log(table.toString());\n console.log(\"\");\n })\n}", "title": "" }, { "docid": "489a6c2e537ddd0ab7d68a696ab99e40", "score": "0.57211834", "text": "getTableBodyHtml() {\n let html = \"\"\n if (this.sightingArray.length > 0) {\n let cols = Object.keys(this.sightingArray[0]);\n html = this.sightingArray.map(row => \"<tr>\" + cols.map(colName => '<td>' + row[colName] + '</td>').join(\"\") + \"</tr>\").join(\"\");\n }\n return html;\n }", "title": "" }, { "docid": "1a6669a7e7db069530ab7ce399b644cb", "score": "0.57149166", "text": "function initTable() {\n tableData.forEach((sighting) => {\n var row = tbody.append(\"tr\");\n\n Object.entries(sighting).forEach(([key, value]) => {\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n}", "title": "" }, { "docid": "a5f96f529ec47f4285dafec1e962e69c", "score": "0.57132196", "text": "function transposeTableOfObjects(table_element){\n var alt_name=\"\";\n var content=\"\";\n var table_id = table_element.id;\n\n if ( !table_element ) {\n console.log(\"transposeTableOfObjects: Could not find table to be transposed with id '\" + table_id + \"'.\");\n return;\n } else {\n console.log(\"# table to be transposed is '\" + table_id + \"'. Object for this table is: \" + table_element);\n }\n var maxColumns = 0;\n // Find the max number of columns\n var num_rows = table_element.rows.length;\n var num_columns = table_element.rows[0].cells.length;\n console.log(\"# Number of rows in the table is: \" + num_rows );\n console.log(\"# Number of columns in the table is: \" + num_columns );\n\n var array_of_cells = [];\n for (var r = 0; r < num_rows; r++) {\n array_of_cells[r] = [];\n var row = table_element.rows[r];\n var num_cells = table_element.rows[r].cells.length;\n console.log(\"# transposeTableOfObjects: r = \" + r + \" row_name = \" + row.id + ' with ' + num_cells + ' cells');\n\n for ( var c = 0; c < num_columns; c++) {\n array_of_cells[r][c] = row.cells[c];\n var cell = row.cells[c];\n if ( !cell ) { return };\n console.log(\"# transposeTableOfObjects: r = \" + r + \" c = \" + c + \" table_data_id = \" + cell.id);\n }\n }\n\n // Remove the empty rows from the table.\n var r = 0;\n while ( table_element.rows.length ) {\n table_element.deleteRow(0);\n console.log(\"# transposeTableOfObjects: Deleted a row\");\n }\n\n for ( var c = 0; c < num_columns; c++) {\n var table_row = document.createElement(\"TR\");\n table_row.id=\"table_row_\" + c;\n table_element.appendChild(table_row);\n //table_element.appendChild(table_row);\n for (var r = 0; r < num_rows; r++) {\n table_row.appendChild(array_of_cells[r][c]);\n }\n }\n\n // Update the styles for the row and column titles and unhide boxes.\n if ( object_table_transposed ) {\n // The table was transposed and now it is not transposed.\n object_table_transposed = 0\n // Set the alignment of the table headings for the table in the original (not-transposed) state.\n getCssRuleStyle(document, \".titleRowLeft\").textAlign = \"right\";\n getCssRuleStyle(document, \".titleRowRight\").textAlign = \"left\";\n //getCssRuleStyle(document, \".titleRowLeft\").fontSize = \"15\";\n // Move the unhide boxes.\n var top_right_style = getCssRuleStyle(document, \".topRight\");\n //console.log(top_right_style);\n top_right_style.top = \"0px\";\n top_right_style.right = \"0px\";\n top_right_style.bottom = \"\";\n top_right_style.left = \"\";\n var bottom_left_style = getCssRuleStyle(document, \".bottomLeft\");\n //console.log(bottom_left_style);\n bottom_left_style.top = \"\";\n bottom_left_style.right = \"\";\n bottom_left_style.bottom = \"0px\";\n bottom_left_style.left = \"0px\";\n bottom_left_style.backgroundColor = \"orange\";\n } else {\n // The table was not transposed and now it is transposed.\n object_table_transposed = 1\n // Set the alignment of the table headings for the table in the transposed state.\n getCssRuleStyle(document, \".titleRowLeft\").textAlign = \"center\";\n getCssRuleStyle(document, \".titleRowRight\").textAlign = \"center\";\n // Move the unhide boxes.\n var top_right_style = getCssRuleStyle(document, \".topRight\");\n //console.log(top_right_style);\n top_right_style.top = \"\";\n top_right_style.right = \"\";\n top_right_style.bottom = \"0px\";\n top_right_style.left = \"0px\";\n var bottom_left_style = getCssRuleStyle(document, \".bottomLeft\");\n //console.log(bottom_left_style);\n bottom_left_style.top = \"0px\";\n bottom_left_style.right = \"0px\";\n bottom_left_style.bottom = \"\";\n bottom_left_style.left = \"\";\n bottom_left_style.backgroundColor = \"blue\";\n }\n\n console.log(\"# transposeTableOfObjects: Done.\");\n return;\n}", "title": "" }, { "docid": "2b0a510a8b1cdc9aadf321a5efa98617", "score": "0.5712858", "text": "function departmentOverView() {\n connection.query(\"SELECT * FROM departments\", function(err, res) {\n if(err) throw err;\n\n var departmentTable = new Table({\n head: [\"ID\", \"Department Name\", \"Over Head Cost\"],\n colWidths: [4, 30, 20]\n });\n for (var i = 0; i < res.length; i++) {\n departmentTable.push([res[i].department_id, res[i].department_name, \"$\"+res[i].over_head_costs]);\n };\n console.log(departmentTable.toString());\n menu();\n });\n}", "title": "" }, { "docid": "3f5c489d40948e8f1b34319b016b28e7", "score": "0.5702845", "text": "function multTable(){\n let table = []\n for(let j = 1; j < 11; j++){\n let row = []\n for(let i = 1; i < 11; i++){\n row.push(i * j)\n }\n table.push(row)\n }\n return table\n}", "title": "" }, { "docid": "b0d3c16d72c8a1f169942c94afe9c5cf", "score": "0.57016313", "text": "function addtable() {\n tbody.html(\"\");\n console.log(`There are ${tableDatashape.length} records in this table.`);\n console.log(\"----------\");\n tableDatashape.forEach(function(sighting) {\n var row = tbody.append(\"tr\");\n Object.entries(sighting).forEach(function([key, value]) {\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n }", "title": "" }, { "docid": "162b027b822b3b75b83ad41ead5abafc", "score": "0.5696426", "text": "function calculate_cells(){\n\t// local variables used in for loops\n\tvar i, j;\n\t// open loop for each HTML table inside id=drag (tables variable is initialized in onload event)\n\tfor (i=0; i<tables.length; i++){\n\t\t// define row offsets variable\n\t\tvar row_offset = new Array();\n\t\t// collect table rows and initialize row offsets array\n\t\tvar tr = tables[i].getElementsByTagName('tr');\n\t\t// backward loop has better perfomance\n\t\tfor (j=tr.length-1; j>=0; j--) row_offset[j] = box_offset(tr[j]);\n\t\t// save table informations (table offset and row offsets)\n\t\ttables[i].offset = box_offset(tables[i]);\n\t\ttables[i].row_offset = row_offset;\n\t}\n}", "title": "" }, { "docid": "3d8e5230b7df75eddf9627b378b49664", "score": "0.56927323", "text": "function createTable(){\n\ttable = new Table({ chars: {'mid': '-', 'left-mid': '-', 'mid-mid': '-', 'right-mid': '-'} });\n\ttable.push([\"Item ID\", \"Product Name\", \"Department Name\", \"Price\", \"Quantity\"]);\n}", "title": "" }, { "docid": "177ea8ee524a2dd1a06c3a514048807a", "score": "0.56903756", "text": "function Fill_AEL_Table(tbodyTblName, JustLinkedAwpId, JustUnLinkedAwpId, JustUnlinkedExcId) {\n console.log(\" ===== Fill_AEL_Table =====\");\n console.log(\"tbodyTblName\", tbodyTblName);\n const show_console = false; // (tbodyTblName === \"level\");\n\nif (show_console){\n console.log(\" mimp.import_table: \", mimp.import_table);\n console.log(\" mimp: \", mimp);\n console.log(\" > mimp.linked_awp_values[\" + tbodyTblName + \"]: \", deepcopy_dict(mimp.linked_awp_values[tbodyTblName]));\n console.log(\" > mimp.linked_exc_values[\" + tbodyTblName + \"]: \", deepcopy_dict(mimp.linked_exc_values[tbodyTblName]));\n};\n // tbodyTblNames are: \"coldef\", \"department\", \"level\", \"sector\", \"profiel\", \"subject\", \"subjecttype\"\n // tbody id's are: id_MIMP_tbody_coldef_awp, id_MIMP_tbody_coldef_exc, id_MIMP_tbody_coldef_lnk etc.\n\n // stored_coldef: [ {awpColdef: \"examnumber\", caption: \"Examennummer\", linkfield: true, excColdef: \"exnr\"}, ...]\n\n // when not is_tbl_coldef and import_teble= studsubj:\n // row data are stored in mimp.linked_awp_values.subject and mimp.linked_exc_value.subject\n const is_tbl_coldef = (tbodyTblName === \"coldef\");\n\n// --- reset tables\n const el_tbody_awp = document.getElementById(\"id_MIMP_tbody_\" + tbodyTblName + \"_awp\");\n const el_tbody_exc = document.getElementById(\"id_MIMP_tbody_\" + tbodyTblName + \"_exc\");\n const el_tbody_lnk = document.getElementById(\"id_MIMP_tbody_\" + tbodyTblName + \"_lnk\");\n\n if (el_tbody_awp && el_tbody_exc && el_tbody_lnk){\n el_tbody_awp.innerText = null;\n el_tbody_exc.innerText = null;\n el_tbody_lnk.innerText = null;\n\n// --- show or hide tables\n // tbodyTblName gets value from mimp_stored.tablelist\n // hide table department, level, sector when their column is not linked, only when table = student\n let show_table = false;\n if (is_tbl_coldef){\n show_table = true;\n } else {\n if(mimp.import_table === \"import_student\"){\n // --- hide tables that are not linked\n // lookup awpColdef 'department' etc in mimp.stored_coldefs. If it exists: show table 'department' etc.\n const lookup_row = get_arrayRow_by_keyValue(mimp.stored_coldefs, \"awpColdef\", tbodyTblName);\n // check if it is a linked column by checking if 'excColdef' exists in row\n show_table = (lookup_row && \"excColdef\" in lookup_row);\n\n } else if([\"import_studsubj\", \"import_grade\"].includes(mimp.import_table)){\n // PR2021-08-11 NIU. Was: show_table = ([\"subject\", \"subjecttype\"].includes(tbodyTblName));\n show_table = (tbodyTblName === \"subject\");\n };\n };\n // el_container is used to map values, like in id_MIMP_container_sector\n const el_container = document.getElementById(\"id_MIMP_container_\" + tbodyTblName);\n if(el_container) {add_or_remove_class(el_container, cls_hide, !show_table)};\n\n // mimp.stored_coldefs gets value from schoolsetting_dict in i_UpdateSchoolsettingsImport(schoolsetting_dict)\n\n if(show_table){\n // --- first loop through array of awp_columns, then through array of excel_coldefs\n // key: 0 = \"awp\", 1: \"lnk\" or \"awp\"\n for (let j = 0; j < 2; j++) {\n const key = (!j) ? \"awp\" : \"exc\";\n const rows = (is_tbl_coldef) ? (key === \"awp\") ? mimp.stored_coldefs : mimp.excel_coldefs :\n (key === \"awp\") ? mimp.linked_awp_values[tbodyTblName] : mimp.linked_exc_values[tbodyTblName];\n const rows_name = (is_tbl_coldef) ? (key === \"awp\") ? \"mimp.stored_coldefs\" : \"mimp.excel_coldefs\" :\n (key === \"awp\") ? \"mimp.linked_awp_values[\" + tbodyTblName + \"]\" : \"mimp.linked_exc_values[\" + tbodyTblName + \"]\";\nif (show_console){\n console.log(\"=============== key: \", key, \"==================\");\n console.log(\"------------- rows_name: \", rows_name);\n console.log(\"------------- rows: \", rows);\n}\n if(rows){\n for (let i = 0, row ; row = rows[i]; i++) {\n // mimp.stored_coldefs row = {awpColdef: \"examnumber\", caption: \"Examennummer\", linkfield: true, excColdef: \"exnr\"}\n // row = {awpBasePk: 7, awpValue: \"n&t\", excColdef: \"Profiel\", excValue: \"NT\"}\n // {awpBasePk: 5, awpValue: \"e&m\", excColdef: \"Profiel\", excValue: \"EM\"}\n // >>>>> give value to rowid when creating dictlist\n // was:\n // const row_id = get_AEL_rowId(tbodyTblName, key, i); // row_id: id_tr_level_exc_2\n // add rowId to dict of this row\n // row.rowId = row_id;\n // awp row is linked when it has an excColdef and excValue -> add to linked table\n //const row_is_linked = (!!row.excColdef);\nif (show_console){\n console.log(\"------------- row ------------- \");\n console.log( row);\n}\n // short version:\n //const row_is_linked = (is_tbl_coldef) ? (key === \"awp\") ? !!row.excColdef : !!row.awpColdef :\n // (key === \"awp\") ? !!row.excValue : !!row.awpBasePk;\n\n let row_is_linked = false;\n if (is_tbl_coldef) {\n if (key === \"awp\") {\n row_is_linked = !!row.excColdef;\nif (show_console){console.log(\"===> row_is_linked awp row.excColdef exists\", row.excColdef)};\n } else {\n row_is_linked = !!row.awpColdef;\nif (show_console){console.log(\"===> row_is_linked exc row.awpColdef exists\", row.excColdef)};\n if(!row_is_linked){\n if ([\"import_studsubj\", \"import_grade\"].includes(mimp.import_table)){\n // all subject showed up in excel coldef table, too confusing\n // skip subjects in excel coldef table when they exist in mimp.linked_exc_values[subject]\n const lookup_dict = b_lookup_dict_in_dictlist(mimp.linked_awp_values[\"subject\"], \"excValue\", row.excColdef);\n if(lookup_dict){\n row_is_linked = true;\nif (show_console){console.log(\"===> row_is_linked lookup_dict\", lookup_dict)};\n };\n };\n };\n };\n } else {\n if (key === \"awp\") {\n row_is_linked = !!row.excValue;\nif (show_console){console.log(\"===> row_is_linked row.excValue\", row.excValue)};\n } else {\n row_is_linked = !!row.awpBasePk;\nif (show_console){console.log(\"===> row_is_linked row.awpBasePk\", row.awpBasePk)};\n };\n };\n const row_cls = (row_is_linked) ? cls_tbl_td_linked : cls_tbl_td_unlinked;\n const cls_width = (row_is_linked) ? \"tsa_tw_50perc\" : \"tsa_tw_100perc\";\n const row_awpBasePk = (row.awpBasePk) ? row.awpBasePk : null;\n\n // --- dont add row when excel_row is linked (has awpBasePk)\n // PR2020-12-27 debug: must use (!!j); (j) will return 0 instead of false;\n // skip linked excel row, linked row is already added by key 'awp'\n //const skip_linked_exc_row = (is_tbl_coldef) ? !!j && row_is_linked : (!!j && !!row_awpBasePk);\n const skip_linked_exc_row = (key === \"exc\" && row_is_linked);\n\n const awpCaption = (is_tbl_coldef) ? row.caption : row.awpValue;\n const excCaption = (is_tbl_coldef) ? row.excColdef : row.excValue;\n const row_id = (row.rowId) ? row.rowId : null;\nif (show_console){\n console.log(\"....awpCaption\", awpCaption);\n console.log(\"....excCaption\", excCaption);\n}\n if(!skip_linked_exc_row){\n // --- if excColdef and excValue exist: append row to table ColLinked\n // append row to table Awp if excValue does not exist in items\n // add linked row to linked table, add to awp / excel tab;le otherwise\n let el_tbody = (row_is_linked) ? el_tbody_lnk : (key === \"awp\") ? el_tbody_awp : el_tbody_exc;\n\n // --- insert tblRow into tbody_lnk\n let tblRow = el_tbody.insertRow(-1);\n if (row.rowId) {tblRow.id = row.rowId};\n\n const row_key = (is_tbl_coldef) ? (key === \"awp\") ? row.awpColdef : row.excColdef :\n (key === \"awp\") ? row.awpBasePk : row.excValue;\n tblRow.setAttribute(\"data-key\", row_key)\n\n tblRow.classList.add(row_cls)\n tblRow.classList.add(cls_width)\n tblRow.addEventListener(\"click\", function(event) {Handle_AEL_row_clicked(event)}, false);\n\n // --- if new appended row: highlight row for 1 second\n //const cls_just_linked_unlinked = (row_is_linked) ? \"tsa_td_linked_selected\" : \"tsa_td_unlinked_selected\";\n const cls_just_linked_unlinked = (row_is_linked) ? \"tsa_td_linked_hover\" : \"tsa_td_unlinked_hover\";\n\n let show_justLinked = false;\n if(row_is_linked) {\n show_justLinked = (!!JustLinkedAwpId && !!row_id && JustLinkedAwpId === row_id)\n } else if (key === \"awp\") {\n show_justLinked = (!!JustUnLinkedAwpId && !!row_id && JustUnLinkedAwpId === row_id)\n } else {\n show_justLinked = (!!JustUnlinkedExcId && !!row_id && JustUnlinkedExcId === row_id)\n }\n if (show_justLinked) {\n let cell = tblRow.cells[0];\n tblRow.classList.add(cls_just_linked_unlinked)\n setTimeout(function (){ tblRow.classList.remove(cls_just_linked_unlinked) }, 1000);\n }\n\n // --- append td with row.caption\n // row {awpKey: 2, caption: \"PKL\", excValue: \"Omar TEST\"}\n let td_first = tblRow.insertCell(-1);\n td_first.classList.add(row_cls);\n const text = (key === \"awp\") ? awpCaption : excCaption;\n td_first.innerText = text;\n\n // --- if new appended row: highlight row for 1 second\n if (show_justLinked) {\n //td_first.classList.add(cls_just_linked_unlinked)\n //setTimeout(function (){ td_first.classList.remove(cls_just_linked_unlinked)}, 1000);\n ShowClassWithTimeout(td_first, cls_just_linked_unlinked, 1000);\n }\n\n // --- if linked row: also append td with excValue\n if (row_is_linked) {\n let td_second = tblRow.insertCell(-1);\n td_second.classList.add(row_cls);\n td_second.innerText = excCaption;\n\n // --- if new appended row: highlight row for 1 second\n if (show_justLinked) {\n //td_second.classList.add(cls_just_linked_unlinked)\n //setTimeout(function (){ td_second.classList.remove(cls_just_linked_unlinked) }, 1000);\n ShowClassWithTimeout(td_second, cls_just_linked_unlinked, 1000);\n };\n };\n // --- add mouseenter/mouseleave EventListener to tblRow\n const cls_linked_hover = (row_is_linked) ? \"tsa_td_linked_hover\" : \"tsa_td_unlinked_hover\";\n // cannot use pseudo class :hover, because all td's must change color, hover doesn't change children\n tblRow.addEventListener(\"mouseenter\", function(event) {\n for (let i = 0, td; td = tblRow.children[i]; i++) {\n td.classList.add(cls_linked_hover);\n }});\n tblRow.addEventListener(\"mouseleave\", function() {\n for (let i = 0, td; td = tblRow.children[i]; i++) {\n td.classList.remove(cls_linked_hover);\n }});\n }; // if(!skip_linked_exc_row)\n }; // for (let i = 0, row ; row = items[i]; i++)\n }; // if(items){\n }; // for (let j = 0; j < 2; j++)\n }; // if(show_table)\n }; // if (el_tbody_awp && el_tbody_exc && el_tbody_lnk)\n }", "title": "" }, { "docid": "24febab1883a2e3efff4b0127f4095f1", "score": "0.568274", "text": "buildPolyTableRow(arrayOfPolynomials){\n\t\treturn(<tr> {arrayOfPolynomials.map(buildPolyTableCell)} </tr>);\n\t}", "title": "" }, { "docid": "a2aef5beec808f5b2067b347fb7d9450", "score": "0.56767863", "text": "function genTable(callback) {\n\n\t\tvar tbody = \t\t$('<tbody/>', {\n\t\t\t\t\t\t\t\tid: 'tableBody'\n\t\t\t\t\t\t\t});\n\t\tvar tStream = \t\t$('<img/>', {\n\t\t\t\t\t\t\t\tclass: 'twitch',\n\t\t\t\t\t\t\t\tsrc: \"https://farm1.staticflickr.com/982/41478803294_14c3d1dc1f_o.png\"\n\t\t\t\t\t\t\t});\n\t\tvar tProgram = \t\t$('<img/>', {\n\t\t\t\t\t\t\t\tclass: 'twitch',\n\t\t\t\t\t\t\t\tsrc: \"https://farm1.staticflickr.com/969/28327059108_5e1595670b_o.png\"\n\t\t\t\t\t\t\t});\n\t\tvar thead = \t\t$('<thead/>');\n\t\tvar table = \t\t$('<table/>', {\n\t\t\t\t\t\t\t\tclass: 'table table-hover'\n\t\t\t\t\t\t\t}).append(thead, tbody);\n\t\tvar sp3 = \t\t\t$('<span/>', {\n\t\t\t\t\t\t\t\tclass: \"oi oi-bolt\"\n\t\t\t\t\t\t\t});\n\t\tvar navA3 = \t\t$('<a/>', {\n\t\t\t\t\t\t\t\tid: \"offline\",\n\t\t\t\t\t\t\t\tclass: \"nav-item nav-link\",\n\t\t\t\t\t\t\t\thref: \"#\",\n\t\t\t\t\t\t\t\t\"data-toggle\": \"tooltip\",\n\t\t\t\t\t\t\t\t\"data-placement\": \"bottom\",\n\t\t\t\t\t\t\t\ttitle: \"offline\"\n\t\t\t\t\t\t\t}).append(sp3);\n\t\tvar sp2 = \t\t\t$('<span/>', {\n\t\t\t\t\t\t\t\tclass: \"oi oi-infinity\"\n\t\t\t\t\t\t\t});\n\t\tvar navA2 = \t\t$('<a/>', {\n\t\t\t\t\t\t\t\tid: \"all\",\n\t\t\t\t\t\t\t\tclass: \"nav-item nav-link active\",\n\t\t\t\t\t\t\t\thref: \"#\",\n\t\t\t\t\t\t\t\t\"data-toggle\": \"tooltip\",\n\t\t\t\t\t\t\t\t\"data-placement\": \"bottom\",\n\t\t\t\t\t\t\t\ttitle: \"all streamers\"\n\t\t\t\t\t\t\t}).append(sp2);\n\t\tvar sp1 = \t\t\t$('<span/>', {\n\t\t\t\t\t\t\t\tclass: \"oi oi-audio\"\n\t\t\t\t\t\t\t});\n\t\tvar navA1 = \t\t$('<a/>', {\n\t\t\t\t\t\t\t\tid: \"online\",\n\t\t\t\t\t\t\t\tclass: \"nav-item nav-link\",\n\t\t\t\t\t\t\t\thref: \"#\",\n\t\t\t\t\t\t\t\t\"data-toggle\": \"tooltip\",\n\t\t\t\t\t\t\t\t\"data-placement\": \"bottom\",\n\t\t\t\t\t\t\t\ttitle: \"online\"\n\t\t\t\t\t\t\t}).append(sp1);\n\t\tvar navTabs = \t\t$('<nav/>', {\n\t\t\t\t\t\t\t\tclass: 'nav nav-pills nav-justified'\n\t\t\t\t\t\t\t}).append(navA1, navA2, navA3);\n\t\tvar streamer = \t\t$('<div/>', {\n\t\t\t\t\t\t\t\tid: 'streamers',\n\t\t\t\t\t\t\t\tclass: 'table-responsive-sm text-center'\n\t\t\t\t\t\t\t}).append(tProgram, tStream, navTabs, table);\n\t\tcallback(allStreamers, streamer);\n\t\t$(function () {\n\t\t $('[data-toggle=\"tooltip\"]').tooltip()\n\t\t});\n\t}", "title": "" }, { "docid": "8f33e5ff1da88bb15e0e4d0deebfeaee", "score": "0.5673169", "text": "function ConvToTab(tbl){\r\ntbl = createTable(tbl)\r\ntbl.firstRow = tbl.rows[0].cells\r\ntbl.content = tbl.rows[1].cells\r\n\r\nif (tbl.getAttribute(\"defaultTab\") == undefined)\r\n{\r\ntbl.active = 0\r\n}\r\nelse{\r\nif (tbl.getAttribute(\"defaultTab\") < tbl.firstRow.length)\r\n{\r\ntbl.active = tbl.getAttribute(\"defaultTab\")\r\n}\r\n\r\n\r\n}\r\n\r\n\r\ntbl.showTab = function(obj){\r\n\r\nfor (var i=0;i<tbl.firstRow.length;i++)\r\n{\r\n\ttbl.firstRow[i].className = \"inactive\"\r\n\r\n\t\tif (tbl.content[i])\r\n\t\t{\r\n\t\t\ttbl.content[i].style.display = \"none\"\r\n\t\t}\r\n}\r\n\r\n\ttbl.firstRow[(tbl.findMyIndex(obj))].className = \"active\"\r\nif (document.all)\r\n{\r\n\ttbl.content[(tbl.findMyIndex(obj))].style.display = \"block\"\r\n}\r\nelse{\r\n\ttbl.content[(tbl.findMyIndex(obj))].style.display = \"table-cell\"\r\n}\r\n\r\n}\r\n\r\n\r\nfor (var i=0;i<tbl.firstRow.length;i++)\r\n{\r\n\tvar cll = tbl.firstRow[i]\r\n\t\tif (cll.getAttribute(\"defaultTab\") == \"true\")\r\n\t\t{\r\n\t\t\ttbl.active = 0\r\n\t\t}\r\n\r\n\t\tcll.onclick = function(){\r\n\t\t\ttbl.showTab(this)\r\n\t\t}\r\n\r\n\t\tif (tbl.content[i])\r\n\t\t{\r\n\t\t\ttbl.content[i].colSpan = tbl.firstRow.length\r\n\t\t\ttbl.content[i].style.display = \"none\"\r\n\t\t}\r\n\r\n}\r\n\r\ntbl.showTab(tbl.firstRow[tbl.active])\r\n}", "title": "" }, { "docid": "a780fce1883becfbe6094d1d4185b11f", "score": "0.5672913", "text": "allTableArray() {\n const { tables } = this.tables();\n let arr = [];\n\n tables.forEach((table, index) => {\n arr.push({\n id: index,\n table: table,\n data: this.all({ table: table })\n })\n })\n\n return arr;\n }", "title": "" }, { "docid": "1240c268130b2e7bbe44e3944223d5fc", "score": "0.56634945", "text": "function displayTable() {\n //geting connection to the table\n var query = connection.query(\"SELECT * FROM products\", function(err, res) {\n \n var table = new Table([\n\n head=['id','product_name','department_name','price','stock_quantity']\n ,\n colWidths=[6,21,25,17]\n \n ]);\n table.push(['id','product name','department name','price','stock quantity']);\n for (var i = 0; i < res.length; i++) {\n \n table.push(\n \n [res[i].id ,res[i].product_name,res[i].department_name,res[i].price ,res[i].stock_quantity]\n \n );\n \n }\n console.log(colors.bgWhite(colors.red((table.toString()))));\n \n start();\n });\n}", "title": "" }, { "docid": "5a7cfb45a7a47d1c42181ca1cd66db5b", "score": "0.56540006", "text": "function getTable(grid){\r\n\tfor( j=0 ; j<grid.length ; j++){\r\n\t\trow = getRow(grid[j]);\r\n\t\tG(\"grid\").insertAdjacentHTML('beforeend', row);\r\n\t}\r\n}", "title": "" }, { "docid": "0cb01998d4490219a5e46de26949b514", "score": "0.5645506", "text": "function addTable(){\r\n \r\n\r\n}", "title": "" }, { "docid": "117dc50c6f7ad16bebc90cb4ecdc2c74", "score": "0.5642623", "text": "_generateTable() {\n let HTML = \"\";\n for (let i = 0; i < this.rowsInPage; i++) {\n HTML += `\n <tr>\n <td><div></div></td>\n <td></td>\n <td></td>\n <td></td>\n <td><i class=\"fas fa-pencil-alt\"></i></td>\n </tr>\n `;\n }\n document.querySelector(\".table__body tbody\").innerHTML = HTML;\n }", "title": "" }, { "docid": "5b7c8727aa1e977da4491efbad373465", "score": "0.56324327", "text": "function fillInnerTable(tableId, obs, modifyFunction = null, deleteFunction = null, editbuttonvis = true ) {\n var table = document.getElementById(tableId);\n var hasButton = table.getAttribute('hasButton') == '1';\n var thead = table.children[0];\n var tbody = table.children[1];\n tbody.innerHTML = '';\n var headingCells = thead.children[0].children;\n var searchCells = thead.children[0].children;\n for (var i = 1; i < searchCells.length; i++) {\n var searchCell = searchCells[i];\n if (searchCell.children.length != 0) {\n searchCell.children[0].value = '';\n }\n }\n\n for (var i = 0; i < obs.length; i++) {\n var ob = obs[i];\n var row = createElement(\"tr\");\n var td = createElement(\"td\");\n td.innerHTML = (i + 1);\n row.appendChild(td);\n if (hasButton) {\n var e = headingCells.length - 1;\n } else {\n var e = headingCells.length;\n }\n\n for (j = 1; j < e; j++) {\n var td = createElement(\"td\");\n var headingCell = headingCells[j];\n var type = headingCell.getAttribute('datatype');\n var property = headingCell.getAttribute('property');\n var propertytype = headingCell.getAttribute('propertytype');\n\n if (propertytype == 'attribute') {\n var get = function (model, path) {\n var parts = path.split('.');\n if (parts.length > 1 && typeof model[parts[0]] === 'object') {\n return get(model[parts[0]], parts.splice(1).join('.'));\n } else {\n return model[parts[0]];\n }\n }\n var data = get(ob, property);\n } else {\n var data = window[property](ob);\n }\n\n if (type == 'text') {\n if (data == null) {\n data = '-';\n }\n td.innerHTML = data;\n }\n if (type == 'amount') {\n if (data == null) {\n data = '-';\n }\n td.innerHTML = parseFloat(data).toFixed(2);\n }\n row.appendChild(td);\n }\n\n if (hasButton) {\n var td = createElement(\"td\");\n\n // Inner Table Update Button\n var buttonInnerUpdate = createElement('button');\n buttonInnerUpdate.setAttribute('type', 'button');\n buttonInnerUpdate.classList.add('btn');\n buttonInnerUpdate.classList.add('btn-sm');\n buttonInnerUpdate.classList.add('btn-outline-warning');\n buttonInnerUpdate.innerHTML = '<i class=\"fa fa-edit\"></i> ';\n buttonInnerUpdate.onclick = function () {\n idx = window.parseInt(this.parentNode.parentNode.firstChild.innerHTML);\n modifyFunction(obs[idx - 1], idx-1);\n };\n\n // Inner Table Delete Button\n var buttonInnerDelete = createElement('button');\n buttonInnerDelete.setAttribute('type', 'button');\n buttonInnerDelete.classList.add('btn');\n buttonInnerDelete.classList.add('ml-1');\n buttonInnerDelete.classList.add('btn-sm');\n buttonInnerDelete.classList.add('btn-outline-danger');\n buttonInnerDelete.innerHTML = '<i class=\"fa fa-trash-alt\"></i> ';\n buttonInnerDelete.onclick = function () {\n idx = window.parseInt(this.parentNode.parentNode.firstChild.innerHTML);\n deleteFunction(obs[idx - 1], idx-1);\n };\n if(editbuttonvis)\n td.appendChild(buttonInnerUpdate);\n\n td.appendChild(buttonInnerDelete);\n row.appendChild(td);\n }\n tbody.appendChild(row);\n }\n}", "title": "" }, { "docid": "99ba418079d83dd1c6590340050d0257", "score": "0.5619754", "text": "function main(){\n tbody.selectAll(\"tr\").remove(); \n tableData.forEach(function(ufoSighting){\n var row = tbody.append(\"tr\");\n Object.values(ufoSighting).forEach(function(value){\n row.append(\"td\").text(value);\n });\n });\n}", "title": "" }, { "docid": "19c10c68a335126cb9d937cf7ae9aff4", "score": "0.5616288", "text": "function displayTable() {\n connection.query('SELECT * from products', function(error, results, fields) {\n if (error) throw error;\n\n var table = new Table({\n head: ['Item ID', 'Product Name', 'Department Name', 'Price', \"Stock\"]\n });\n results.forEach(function(columns) {\n var obj = new Object;\n obj[columns.item_id] = [columns.product_name, columns.department_name, \"$\" + columns.price, columns.stock_quantity];\n table.push(obj);\n });\n console.log(table.toString());\n selectItem();\n });\n}", "title": "" }, { "docid": "38c9dedce7ec90319d65273ec97dae67", "score": "0.5614609", "text": "function get_sub_data(table){\n if (table!==undefined){ // if it's just a placeholder, returns undefined, which is checked in the function call\n var data = []\n var rows = table.children\n // array with each element representing a row of substitutions, each in that representing a substitution, and a 2 element array in that with the input and output\n for (let i=0;i<rows.length;i++){\n var row = rows[i]\n var cells = row.children\n data.push([])\n for (let j=0;j<cells.length;j++){\n var cell = cells[j]\n var mq_field = cell.children[0]\n if(!(mq_field.className.includes(\"mq\"))){continue}\n var ltx = MQ(mq_field).latex()\n data[i].push(ltx)\n }\n }\n return data\n }\n}", "title": "" }, { "docid": "84b0fbc3749d52671f623a4b8f2c3d13", "score": "0.56130844", "text": "function updateGameTable() {\n for (let i = 0; i < 4; i++) {\n for (let j = 0; j < 4; j++) {\n gameTable[i][j] = gameFields[i][j].innerHTML;\n }\n }\n}", "title": "" }, { "docid": "0412541027bd5b54a7a22d2192c114f2", "score": "0.5607823", "text": "function dataTable(data) { \n var keys = Object.keys(data[0]); \n var headers = keys.map(function(name) { \n return new UnderlinedCell(new TextCell(name)); \n }); \n var body = data.map(function(row) { \n return keys.map(function(name) { \n var value = row[name]; \n // This was changed: \n if (typeof value == \"number\") return new RTextCell(String(value)); \n else return new TextCell(String(value)); \n }); \n }); \n return [headers].concat(body);\n}", "title": "" }, { "docid": "d76ca9e639a4b8df9dd50c0e8111115d", "score": "0.56078225", "text": "function makeTableWork() {\n appendArrays();\n \n //REMOVE ALL ROWS IN TABLE\n $(\"#main-table tbody tr\").remove();\n //////////////////////////\n \n for (let item of songNamesArray) {\n addRows(item);\n }\n}", "title": "" }, { "docid": "3cea801ffd2d43af00ff35b4d0001365", "score": "0.55998296", "text": "function createTable() {\n\t/* The following if statement checks if a table has already been created. If so, it deletes it to create a new one. */\n\tif (document.getElementById(\"tbl\")) {\n\t\tdocument.getElementById(\"tbl\").remove();\n\t}\n\n\t// Initialize table element with an id of \"tbl\", append it as a child of <body>.\n\tconst myTable = document.createElement(\"table\");\n\tmyTable.setAttribute(\"id\", \"tbl\");\n\tdocument.body.appendChild(myTable);\n\n\t/* The following loop runs through the objects inside of tableRowArray, assigning each object(row) to a <tr> element in html which is then appended to the table as its child. For each <tr> there is a nested for in loop which runs through each rows' properties, assigning them to created <td>'s which are appended as children to the <tr>'s.*/\n\tfor (const tr of tableRowArray) {\n\t\tconst trIndex = tableRowArray.indexOf(tr);\n\n\t\t//Create header's row\n\t\tif (trIndex === 0) {\n\t\t\theadersRow = document.createElement(\"tr\");\n\t\t\tdocument.getElementById(\"tbl\").appendChild(headersRow);\n\t\t\theadersRow.setAttribute(\"id\", \"headersRow\");\n\t\t}\n\n\t\ttrElement = document.createElement(\"tr\");\n\t\tdocument.getElementById(\"tbl\").appendChild(trElement);\n\t\ttrElement.setAttribute(\"id\", \"row\" + trIndex);\n\n\t\tlet countForHeaders = 0;\n\t\tfor (const prop in tableRowArray[trIndex]) {\n\t\t\tif (Object.hasOwnProperty.call(tableRowArray[trIndex], prop)) {\n\t\t\t\t/* Create <th> (Headers)*/\n\t\t\t\tif (trIndex === 0) {\n\t\t\t\t\tconst th = prop;\n\t\t\t\t\tthElement = document.createElement(\"th\");\n\t\t\t\t\tdocument.getElementById(\"headersRow\").appendChild(thElement);\n\t\t\t\t\tthElement.innerText = tableHeaders[countForHeaders++];\n\t\t\t\t}\n\n\t\t\t\t/* console.log(trIndex);\n\t\t\tconsole.log(tableRowArray[trIndex][prop]); */\n\t\t\t\tconst td = tableRowArray[trIndex][prop];\n\n\t\t\t\ttdElement = document.createElement(\"td\");\n\t\t\t\tdocument.getElementById(\"row\" + trIndex).appendChild(tdElement);\n\t\t\t\ttdElement.setAttribute(\"id\", prop + \"-col\" + trIndex);\n\n\t\t\t\tif (prop === \"startedAt\" || prop === \"finishedAt\") {\n\t\t\t\t\ttdElement.innerText =\n\t\t\t\t\t\tweekDays[td.getDay()] + \" \" + td.toTimeString().split(\" \")[0].slice(0, 5);\n\t\t\t\t} else if (prop === \"tasksFinishedPrecent\") {\n\t\t\t\t\ttdElement.innerText = td + \"%\";\n\t\t\t\t\ttdElement.style.background = `hsl(145, ${30 + td / 2.5}%, ${90 - td / 2}%)`;\n\t\t\t\t} else if (prop === \"totalTime\") {\n\t\t\t\t\ttdElement.style.background = `hsl(0, ${65 + td}%, ${85 - td}%)`;\n\t\t\t\t\ttdElement.innerText = td;\n\t\t\t\t} else {\n\t\t\t\t\ttdElement.innerText = td;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2025fb77b765450cf391824f895f1bd7", "score": "0.5594361", "text": "function create_tables() {\n // go through each one and make the table for it \n Object.values(DINING_HALLS).forEach(function(value) {\n console.log(value);\n make_table(value);\n });\n}", "title": "" }, { "docid": "b449e1eeade5f8405ff70410ad166c7a", "score": "0.55907696", "text": "function generateTable() {\n\tif (document.contains(document.getElementById(\"containerTabs\"))) {\n\t\tdocument.getElementById(\"containerTabs\").remove();\n\t}\n\tif (page.contextualIdentitiesEnabled) {\n\t\tgenerateTabNav();\n\t}\n\tgenerateTableOfURLS();\n\tif (page.contextualIdentitiesEnabled) {\n\t\tdocument.getElementsByClassName(\"tablinks\")[0].click();\n\t}\n}", "title": "" }, { "docid": "2cf710647dbc5fb57076cf82232b398e", "score": "0.5583989", "text": "function html_table(x, y, has_header_x, has_header_y) {\n this.x = x;\n this.y = y;\n this.has_header_x = has_header_x;\n this.has_header_y = has_header_y;\n this._table = null;\n this.header_x = null;\n this.header_y = null;\n this.header_xy = null;\n this.cells = null;\n this.generate_tables();\n}", "title": "" }, { "docid": "f164b29dd9e9c0391c115cc3cfcc60e3", "score": "0.5572339", "text": "get table () {\n return this.data;\n }", "title": "" }, { "docid": "698d17181c22b44198bc912ed53526ee", "score": "0.5559132", "text": "function render_table() {\n\n for (let i = 0; i < classmateData.length; i++) {\n insertRow(classmateData[i]);\n }\n}", "title": "" }, { "docid": "09c853deb76db751ac406f072b366360", "score": "0.55557954", "text": "getPTable() {\n return JSON.stringify(this.processTable.map(p => p.getData()), null, 1);\n }", "title": "" }, { "docid": "09c853deb76db751ac406f072b366360", "score": "0.55557954", "text": "getPTable() {\n return JSON.stringify(this.processTable.map(p => p.getData()), null, 1);\n }", "title": "" }, { "docid": "e9d986ffae181189e35c8dc207fc56c9", "score": "0.55478144", "text": "function ViewProductsForSale(){\n //created a query that grabs all of the data in the database\n connection.query('SELECT * FROM products', function(error,data){\n\n var table = new Table({\n head: ['Product ID', 'Department', 'Product Name', 'Price', 'Stocks Left']\n , colWidths: [15, 25, 70, 15, 15]\n });\n\n for(var x in data){\n table.push(\n [data[x].item_id, data[x].department_name, data[x].product_name, data[x].price, data[x].stock_quantity]\n );\n }\n\n console.log(table.toString());\n\n //calling back the ManagerFunction() \n ManagerFunctions();\n }); \n}", "title": "" }, { "docid": "5d5731baed658dc66d6510bab321ecf6", "score": "0.5544837", "text": "function genTable(crash){\r\n let hash = crash;\r\n for(let i=0;i<tableLength;i++){\r\n let outcome = crashPointFromHash(hash);\r\n\thash = genGameHash(hash);\r\n table[i] = outcome;\r\n }\r\n for(let i=0;i<tableLength;i++){\r\n table[i] = parseFloat(table[i]);\r\n }\r\n}", "title": "" }, { "docid": "e9becba4dddcc59ecdb51ed08cb85c26", "score": "0.55436635", "text": "function generateTable(table, data)\r\n{\r\n\tfor (var i = 0; i < data.length; ++i)\r\n\t{\r\n\t\tlet element = data[i];\r\n\r\n\t\t// add textual elements for each Prescription - name, dosage etc\r\n\t\tlet row = table.insertRow();\r\n\t\tfor (key in element)\r\n\t\t{\r\n\t\t\tlet cell = row.insertCell();\r\n\r\n\t\t\tcell.className = \"summary_td\"\r\n\r\n\t\t\t\tlet text = document.createTextNode(element[key]);\r\n\t\t\tcell.appendChild(text);\r\n\t\t}\r\n\r\n\t\t// add delete button for Prescription element\r\n\t\tlet cell = row.insertCell();\r\n\t\tvar deleteBtn = document.createElement(\"button\");\r\n\t\tdeleteBtn.appendChild(document.createTextNode(\"x\"));\r\n\t\taddEvent(deleteBtn, 'click',\r\n\t\t\tfunction (e)\r\n\t\t{\r\n\t\t\tonDeletePrescription(element);\r\n\t\t}\r\n\t\t);\r\n\r\n\t\tcell.appendChild(deleteBtn);\r\n\t}\r\n}", "title": "" }, { "docid": "28021f061b9141f3be5f3a9631a5292f", "score": "0.55416805", "text": "handleJoinTable(e, i) {\n // We need to get two arrays of column headers. One for the table panel table, one for the selected table to join.\n let tableHeader = _.cloneDeep(this.state.tableHeader);\n let originTableHeader = [];\n let joinTableHeader = [];\n\n // Note: both originTableHeader and joinTableHeader are array of objects with three properties: label, value, and index\n\n // First we get the header for the origin table\n // console.log(tableHeader);\n // Let's loop through this tableHeader to fill the originTableHeader\n for (let i = 0; i < tableHeader.length; ++i) {\n // If the current element in table header has length of 0, it means it's empty\n if (tableHeader[i].length === 0) {\n break;\n }\n else {\n // We loop through the tableHeader[i]\n let value = \"\";\n for (let j = 0; j < tableHeader[i].length; ++j) {\n let valueToAdd = j > 0 ? \"&\" + tableHeader[i][j].value : tableHeader[i][j].value;\n value+=valueToAdd;\n }\n originTableHeader.push(\n {\n \"value\":value,\n \"label\":value,\n \"index\":i\n }\n )\n }\n }\n // console.log(originTableHeader);\n\n // Now that we have originTableHeader working correctly, let's get the joinTableHeader\n let urlOrigin = decodeURIComponent(this.state.urlPasted.slice(30));\n let joinTableData = setTableFromHTML(this.state.originTableArray[i], urlOrigin);\n // console.log(joinTable);\n\n // We start the index from 1, because 0 index corresponds to OriginURL\n for (let i = 0; i < joinTableData[0].length; ++i) {\n joinTableHeader.push(\n {\n \"value\":joinTableData[0][i].data,\n \"label\":joinTableData[0][i].data,\n \"index\":i\n }\n )\n }\n\n // Now we take a look at originTableHeader, joinTableHeader, and joinTable\n // console.log(originTableHeader);\n // console.log(joinTableHeader);\n // console.log(joinTableData);\n\n // It seems like we have fetched the right values. \n // Now we use these to update states, so that join modal can display the right content.\n\n // Bugfix here: if either tableHeader is empty, we want to show an alert message\n if (originTableHeader.length === 0 || joinTableHeader.length === 0) {\n alert(\"One of the join tables have no data. Join cannot be performed.\");\n }\n else {\n // Support for join suggestions starts here: \n // we compute the three most joinable column pairs based on column data\n // console.log(this.state.tableData);\n // console.log(joinTableData);\n\n // We call the helper function computeJoinableColumn that takes in the table data and headers\n\n let joinPairRecord = computeJoinableColumn(this.state.tableData, joinTableData, originTableHeader, joinTableHeader);\n\n this.setState({\n showJoinModal: true,\n joinTableIndex: i,\n joinTableData: joinTableData,\n originColOptions: originTableHeader,\n joinColOptions: joinTableHeader,\n joinPairRecord: joinPairRecord,\n })\n }\n }", "title": "" }, { "docid": "7ec443c693c870a3363f662ce011e454", "score": "0.5538746", "text": "renderTable() {\n const numbers = [0, 1, 2, 3, 4, 5, 6, 7];\n const table = numbers.map((number) => \n this.renderRow(number)\n )\n return (table);\n }", "title": "" }, { "docid": "46c4da85e15ac695a25c10d199a69778", "score": "0.5531589", "text": "function renderTable(tdata) {\n // Set the value of ending index\n var endingIndex = startingIndex + resultsPerPage;\n //Looping through data set\n for (var i = 0; i < tdata.length; i++) {\n // Insert a row\n var $row = $tbody.insertRow(i);\n // Get current object & keys\n var currentSighting = tdata[i];\n var fields = Object.keys(currentSighting);\n // Insert filteredSightings\n for(var j = 0; j < fields.length; j++) {\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = currentSighting[field];\n };\n }; \n // tdata.forEach(val => console.log(val));\n}", "title": "" }, { "docid": "48d2cc7f4257f7a8831974d30fc776bb", "score": "0.55218166", "text": "function drawTable(rowItems, xProp, yProp, zProp, minimaRow, maximaRow, table_element, dimensions) {\n // removed sorting code. if you want it back, look at gigvis-expt4 or earlier.\n // The supplied table_element is an xhtml body element within a foreignObject, embedded\n // in the svg for a chart.\n // Within this we build a single table (class table.outerTable) that has one inner table\n // for the column headers. This has two rows: \"tr.headerNames\" and \"tr.headerXY\".\n // We also create a \"tbody.mainTable\" that will hold the main data rows.\n var width = dimensions.width + \"px\";\n var height = dimensions.height + \"px\";\n var twidth = (dimensions.width - 20) + \"px\"; // width for the inner tables - leave some room for scroller\n var dataTHeight = (dimensions.height - 60) + \"px\";\n\n var dataColumns = Object.keys(rowItems[0].datum.data); // start with all columns\n dataColumns.remove(\"originalrow\");\n dataColumns.remove(\"filtering\");\n dataColumns.remove(\"editedColumns\");\n\n var editedColStr = minimaRow.editedColumns;\n var editedMinima = (editedColStr == \"\") ? [] : editedColStr.split(\"|\");\n editedColStr = maximaRow.editedColumns;\n var editedMaxima = (editedColStr == \"\") ? [] : editedColStr.split(\"|\");\n\n var headerItems = [], minimaItems = [], maximaItems = [];\n dataColumns.forEach(\n function(col) {\n var annotation = \"\";\n if (col==xProp) annotation = \"x\";\n if (col==yProp) annotation = annotation+\"y\";\n if (col==zProp) annotation = annotation+\"z\";\n headerItems.push([{datacolumn: col, annotation: annotation}]);\n minimaItems.push([{datacolumn: col, value: minimaRow[col], dragx: \"tablecell,workingDataRanges,\" + col + \",r_default_rangeControls\", datarole: 1}]);\n maximaItems.push([{datacolumn: col, value: maximaRow[col], dragx: \"tablecell,workingDataRanges,\" + col + \",r_default_rangeControls\", datarole: 2}]);\n });\n Shiny.propLatest = { x: xProp, y: yProp, z: zProp };\n\n var tableRoot = d3.select(table_element);\n // Iff the table hasn't been built yet, build it now.\n // one outer table for the whole data collection\n if (tableRoot.select(\"table.outerTable\").empty()) {\n var outerTable = d3.select(table_element)\n .append(\"table\").attr(\"class\", \"outerTable\").attr(\"width\", width).attr(\"style\", \"border-spacing:0; padding:0\");\n // make a row in the outerTable for the header table\n var headerTable = outerTable\n .append(\"tr\")\n .append(\"td\").attr(\"style\", \"padding:0\")\n .append(\"table\").attr(\"class\", \"headerTable\").attr(\"width\", twidth).attr(\"style\", \"table-layout:fixed; font-size:14px\").data([null]);\n // one row in the header table for the column names\n headerTable\n .append(\"tr\").attr(\"class\", \"headerXY\").attr(\"style\", \"font-size:13px; cursor:default\");\n headerTable\n .append(\"tr\").attr(\"class\", \"headerNames\").attr(\"style\", \"cursor:default\");\n headerTable\n .append(\"tr\").attr(\"class\", \"minima\").attr(\"style\", \"font-size:12px; cursor:ew-resize\").attr(\"align\", \"center\");\n headerTable\n .append(\"tr\").attr(\"class\", \"maxima\").attr(\"style\", \"font-size:12px; cursor:ew-resize\").attr(\"align\", \"center\");\n\n // and then another row in the outerTable to hold a scrolling div that will then hold the main data table itself\n outerTable\n .append(\"tr\")\n .append(\"td\").attr(\"style\", \"padding:0\")\n // the cell holds a scrolling div\n .append(\"div\").attr(\"class\", \"scrollingTableDiv\").attr(\"width\", width).attr(\"style\", \"height:\" + dataTHeight + \"; overflow:auto;\")\n // and the div holds a table\n .append(\"table\").attr(\"border\", 1).attr(\"width\", twidth).attr(\"height\", dataTHeight).attr(\"style\", \"table-layout:fixed; border-collapse:collapse; font-size:12px\") // fixed layout because otherwise we can't figure out the widths for the header row (which is also a table)\n .append(\"tbody\").attr(\"class\", \"mainTable\");\n } // end of table building\n\n // now load the headerNames row with the column-name items, with some behaviour\n var switchCols = function(newXCol, newYCol, newZCol) {\n // any argument can be null, meaning \"leave as is\".\n // check whether values are same as those most recently used\n var latest = Shiny.propLatest;\n var newX = newXCol || latest.x;\n var newY = newYCol || latest.y;\n var newZ = newZCol || latest.z;\n if (newX == latest.x && newY == latest.y && newZ == latest.z) return;\n\n Shiny.propLatest = { x: newX, y: newY, z: newZ }; // will also be set by table code, but that's ok\n\n $world.setHandStyle(\"wait\");\n Shiny.historyManager().addParameterRangeItem(Shiny.chartNamed(\"plot1\"), \"newXYProps\", \"axes\", [ { x: newX, y: newY, z: newZ } ], null);\n Shiny.buildAndSendMessage(\"command\", [ \"newXYProps\", { x: newX, y: newY, z: newZ } ]);\n }\n var swapXY = function() {\n switchCols(Shiny.propLatest[\"y\"], Shiny.propLatest[\"x\"]);\n }\n var highlightHeader = function(elem) {\n var jsTH = $(elem)[0];\n jsTH.focus();\n jsTH.style.backgroundColor=\"lightgray\";\n // or supposedly sthg like d3.select(this).style(\"backgroundColor\", \"gray\")?\n }\n var headerNames = tableRoot.select(\"tr.headerNames\").selectAll(\"th\").data(headerItems);\n headerNames.enter()\n .append(\"th\")\n .attr(\"tabindex\",-1) // allow the element to get focus\n //.attr(\"style\", \"cursor: auto\")\n .on(\"mouseenter\", function(d) {\n var jsTH = $(this)[0];\n var col = d[0].datacolumn;\n if (d3.event.altKey) switchCols(col, null); // ALT switches x\n else if (d3.event.shiftKey) switchCols(null, col); // SHIFT switches y\n })\n .on(\"mouseover\", function(d) {\n highlightHeader(this);\n })\n .on(\"mouseout\", function(d) {\n $(this)[0].style.backgroundColor=null;\n })\n .on(\"dblclick\", swapXY)\n .on(\"keydown\", function(d) {\n // console.log(d3.event.getKeyChar());\n if (d3.event.getKeyChar() == \"X\") switchCols(d[0].datacolumn, null, null);\n else if (d3.event.getKeyChar() == \"Y\") switchCols(null, d[0].datacolumn, null);\n else if (d3.event.getKeyChar() == \"Z\") switchCols(null, null, d[0].datacolumn);\n d3.event.stopPropagation();\n d3.event.preventDefault();\n });\n\n headerNames\n .text(function (d) { return d[0].datacolumn; })\n\n // and the annotations row with x and y indicators\n var annotationCells = tableRoot.select(\"tr.headerXY\").selectAll(\"th\").data(headerItems);\n annotationCells.enter().append(\"th\");\n annotationCells.text(function (d) { return d[0].annotation });\n\n // minima and maxima rows\n var minimaCells = tableRoot.select(\"tr.minima\").selectAll(\"td\").data(minimaItems);\n minimaCells.enter().append(\"td\");\n minimaCells.each(function(d) { d[0]._element = this });\n minimaCells.text(function (d) { return d[0].value })\n .attr(\"style\", function(d) {\n return \"color: \" + (editedMinima.indexOf(d[0].datacolumn) == -1 || d[0].value == \"0\" ? \"black\" : \"#E00000\")\n });\n\n var maximaCells = tableRoot.select(\"tr.maxima\").selectAll(\"td\").data(maximaItems);\n maximaCells.enter().append(\"td\");\n maximaCells.each(function(d) { d[0]._element = this });\n maximaCells.text(function (d) { return d[0].value })\n .attr(\"style\", function(d) {\n return \"color: \" + (editedMaxima.indexOf(d[0].datacolumn) == -1 || d[0].value == \"100\" ? \"black\" : \"#E00000\")\n });\n\n // then an inner-table row for each element of the data\n var rows = tableRoot.select(\"tbody.mainTable\").selectAll(\"tr\").data(rowItems);\n rows.enter()\n .append(\"tr\"); //.sort(sortValueDescending);\n\n rows\n .each(function(d) { d._svg = this });\n\n // a cell for each column of the row\n // NB: we assume each row is an item with a field corresponding to each column name\n // We also take advantage of the fact that Vega's svgHandler will look at a DOM element's\n // __data__ property and expect it to be either an item (with a mark property) or an\n // array (supposedly of items) of which it returns the first entry.\n\n //dataColumns.splice( $.inArray(\"tableTextColour\", dataColumns), 1 );\n var cells = rows.selectAll(\"td\")\n .data(function (d, i, j) {\n // d is the data object (with items mpg, wt etc) for a single row.\n // We return a collection of objects, one to be stored in the __data__ of each td.\n return dataColumns.map(function (column) { return [d, column] }); // we'll look up the value later\n });\n\n cells.enter()\n .append(\"td\");\n\n /* Any benefit to giving the cells values, rather than just deriving them every time?\n cells\n .datum(function(d, i, j) {\n var column = d[1];\n var rowItem = rowItems[j];\n return [rowItem, rowItem.datum.data[column], j, column]\n });\n */\n // show all the values. This is run for all cells every time any row is updated. Could we\n // restrict to just the changing rows?\n cells\n .text(function (d, i, j) {\n var column = d[1];\n var rowItem = rowItems[j];\n return String(rowItem.datum.data[column]);\n })\n/*\n .attr(\"style\", function(d, i, j) {\n var editedColStr = rowItems[j].datum.data[\"editedColumns\"];\n var color = \"black\";\n if (editedColStr != \"\" && editedColStr.split(\"|\").indexOf(d[1]) != -1) color = \"red\";\n var filtered = rowItems[j].datum.data[\"filtering\"] != 0;\n return \"opacity: \"+ (filtered ? \"0.3\" : \"1\") + \"; color: \" + color;\n })\n*/\n\n}", "title": "" }, { "docid": "b0312e3e01f7f253da84a8eb30ab20f7", "score": "0.5516868", "text": "function BuildHistoryDetailsTable(table, array) { \n let rowCount = table.rows.length;\n // clear all data rows from the table\n while (rowCount > 1 ) {\n table.deleteRow(1);\n rowCount = table.rows.length;\n }\n // add rows to table\n let row = 1;\n for (let i = 0; i < array.length; i ++) {\n let newRow = table.insertRow(row);\n let cell1 = newRow.insertCell(0);\n let cell2 = newRow.insertCell(1);\n let cell3 = newRow.insertCell(2);\n let cell4 = newRow.insertCell(3);\n let cell5 = newRow.insertCell(4);\n let cell6 = newRow.insertCell(5);\n let cell7 = newRow.insertCell(6);\n\n let symb = array[i].symbol;\n let qnty = array[i].quantity\n let pric = array[i].price;\n let cost = array[i].quantity * array[i].price;\n let buys = array[i].buySell;\n let date = array[i].date;\n let gain = array[i].gainLoss;\n\n cell1.innerHTML = array[i].symbol;\n cell2.innerHTML = array[i].quantity\n cell3.innerHTML = array[i].price;\n cell4.innerHTML = array[i].quantity * array[i].price;\n cell5.innerHTML = array[i].buySell;\n cell6.innerHTML = array[i].date;\n cell7.innerHTML = array[i].gainLoss;\n row ++;\n };\n} // BuildHistoryDetailsTable() ", "title": "" }, { "docid": "50c4d5612ec63251df13c8a5a974b90a", "score": "0.551542", "text": "function buildTable(data) {\r\n \r\n tbody.html(\"\");\r\n//use \"td\" and \"tr\" from html connect it to js\r\n data.forEach((meta_row) => {\r\n var row = tbody.append(\"tr\");\r\n\r\n Object.values(meta_row).forEach((val) => {\r\n var cell = row.append(\"td\");\r\n cell.text(val);\r\n }\r\n //closed parenthesis for second \"forEach\" function\r\n );\r\n //closed wiggle for after arrow, closed parenthesis for first \"forEach\"\r\n });\r\n //closed paranthesis for function \"buildTable\"\r\n}", "title": "" }, { "docid": "a0f67c56b16a46fb9037e9099f693575", "score": "0.55136395", "text": "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < tableData.length; i++) {\n // Get current data location object and fields\n var location = tableData[i];\n console.log(location)\n var fields = Object.keys(location);\n // Create new row in tbody, set index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n \n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = location[field];\n } \n }\n}", "title": "" }, { "docid": "093c9998de6e091612b87f656fec9c65", "score": "0.55122435", "text": "function bookingsMap(data, tableBody) {\n data.map(function(bookingData) {\n $(tableBody).empty(); //reset table contents\n var booking = {};\n booking.number = bookingData.bookingNumber;\n booking.guest = bookingData.guestName;\n booking.web = bookingData.reservationWebsite;\n booking.checkIn = bookingData.checkIn;\n booking.checkOut = bookingData.checkOut;\n booking.rating = bookingData.rating;\n booking.url = bookingData.reviewURL;\n booking.employee = bookingData.employee;\n //TODO: pass tableBody id through variable 'tableBody' if it should load in bcn or svq table\n $(tableBody).append(\"<tr>\" + \"<td>\" + booking.number + \"</td>\" +\n \"<td>\" + booking.guest + \"</td>\" +\n \"<td>\" + booking.web + \"</td>\" +\n \"<td>\" + booking.checkIn + \"</td>\" +\n \"<td>\" + booking.checkOut + \"</td>\" +\n \"<td>\" + booking.rating + \"</td>\" +\n \"<td>\" + booking.url + \"</td>\" +\n \"<td>\" + booking.employee + \"</td>\" +\n \"<td>\" + \"<button>\" + \"Edit\" + \"</button>\" +\n \"<button>\" + \"Delete\" + \"</button>\" + \"</td>\" + \"</tr>\");\n });\n}", "title": "" }, { "docid": "14df79273d026b877e22322bdf1e1712", "score": "0.55120635", "text": "function render_tables(){\n // create tables to present all available rules\n var table_conf = {};\n table_conf[\"conf\"] = [ {\n \"id\": \"1\",\n \"width\": \"200px\"\n }, {\n \"id\": \"1\",\n \"width\": \"290px\"\n }, {\n \"id\": \"1\",\n \"width\": \"100px\"\n }, {\n \"id\": \"1\",\n \"width\": \"100px\"\n }\n ];\n\n // presentation_format: text, JSON, table, dropdown\n\n // setup column headers for table\n var header_conf = [];\n header_conf = [ {\n \"id\": \"1\",\n \"text\": \"domain\"\n }, {\n \"id\": \"5\",\n \"text\": \"notes\"\n }, {\n \"id\": \"3\",\n \"text\": \"edit\"\n }, {\n \"id\": \"4\",\n \"text\": \"delete\"\n }\n ];\n\n // setup column configuration for table\n\n var column_conf = [];\n column_conf = [ {\n \"id\": \"1\",\n \"json_path\": \"url_match\",\n \"other_attributes\":[{\"j_name\":\"url_match\"}],\n \"presentation_format\": \"text\"\n }, {\n \"id\": \"3\",\n \"json_path\": \"notes\",\n \"presentation_format\": \"text\"\n },{\n \"id\": \"4\",\n \"node\": {\n \"name\": \"button\",\n \"text\": \"edit\",\n \"class\": \"edit-rule\",\n \"EventListener\": {\n \"type\": \"click\",\n \"func\": \"updateObject\",\n \"parameter\": \"click\"\n }\n \n }\n }, {\n \"id\": \"5\",\n \"node\": {\n \"name\": \"button\",\n \"text\": \"delete\",\n \"class\": \"delete-rule\",\n \"EventListener\": {\n \"type\": \"click\",\n \"func\": \"deleteObject\",\n \"parameter\": \"click\"\n }\n }\n },\n\n ];\n\n \n // l\n \n\n // sourceDomainPolicy\n header_conf[0].text = \"Domain name\";\n column_conf[0].json_path = \"url_match\";\n\n \n \n // loop through all tables and create the actual tables object\n for (var t = 0; t < index_db_config.length; t++) {\n // console.debug(\"do: \" + tables[t]);\n\n\n try {\n\n// check if the tables has a spot on the html page\n// \t console.debug(document.getElementById(\"hide_\" + index_db_config[t].dbname + \"_button\"));\n \t console.debug( document.querySelector('div[indexeddbname=\"'+index_db_config[t].dbname+'\"]'));\n \t\n \t if(document.querySelector('div[indexeddbname=\"'+index_db_config[t].dbname+'\"]')){\n \t\t \n \t\t \n \t }\n \t \n \t\n } catch (e) {\n \t// error to be expected here it not all databases should have their own table. Which are to be show is determined by the content rule-admin.html\n \t// The iteration above goes through the master list in db config, the html acts as a filter.\n console.debug(e);\n }\n\n }\n \n \n \n try {\n \tsetup_database_objects_table_async('sourceDomainPolicyDB', 'sourceDomainPolicyStore', 'keyId', 'sourceDomainPolicy_table', document.getElementById(\"sourceDomainPolicy\"), table_conf, header_conf, column_conf);\n\n } catch (e) {\n console.debug(e)\n }\n\n // sourceHostnamePolicy\n header_conf[0].text = \"Full hostname address\";\n column_conf[0].json_path = \"url_match\";\n try {\n \tsetup_database_objects_table_async('sourceHostnamePolicyDB', 'sourceHostnamePolicyStore', 'keyId', 'sourceHostnamePolicy_table', document.getElementById(\"sourceHostnamePolicy\"), table_conf, header_conf, column_conf);\n } catch (e) {\n console.debug(e)\n }\n\n // sourceURLPolicy\n header_conf[0].text = \"URL/Page address\";\n column_conf[0].json_path = \"url_match\";\n\n try {\n \tsetup_database_objects_table_async('sourceURLPolicyDB', 'sourceURLPolicyStore', 'keyId','sourceURLPolicy_table', document.getElementById(\"sourceURLPolicy\"), table_conf, header_conf, column_conf);\n \t } catch (e) {\n console.debug(e);\n }\n\t\n}", "title": "" }, { "docid": "486ec0b393a0a11cf595831095466367", "score": "0.55090153", "text": "function mkTable() {\n d3.selectAll(\"tr:not(#VMhead)\")\n .remove() //start anew \n\t \n\t//one row for each binding\n var rows = VM.table.append(\"tbody\")\n .selectAll(\"tr\")\n .data(VM.bindings, function(d) {\n return d.left.id\n }); \n\n\t //create new DOM elements for each row\n rows.enter()\n .append(\"tr\")\n .selectAll(\"td\")\n .data(function(row) {\n return [row.left, row.right]\n })\n .enter()\n .append(\"td\")\n .text(function(d, i) {\n return mkString(d)\n });\n\n rows.exit().remove(); //make sure any removed rows are deleted\n\n\t//attach some CSS to the table\n d3.select(\"table\")\n .style({\n \"border\": \"1px solid black\",\n \"table-layout\": \"fixed\",\n \"width\": \"200px\"\n });\n d3.selectAll(\"th,td\")\n .style({\n \"overflow\": \"hidden\",\n \"width\": \"440px\",\n \"text-align\": \"left\",\n \"font-size\": \"150%\"\n });\n d3.selectAll(\"tr:nth-child(even)\")\n .style(\"background-color\", \"#e5e5e5\");\n\n d3.selectAll(\"tr:nth-child(odd)\")\n .style(\"background-color\", \"#fdfdfd\");\n\n d3.select(\"thead tr\")\n .style(\"background-color\", \"#e5e5e5\");\n\n\t //attach the remove row behavior for when the row is clicked\n d3.selectAll(\"tr:not(#VMhead)\")\n .on(\"click\", rmRow); \n\n }", "title": "" }, { "docid": "34530d831bd1bb47c887d99a55c5c3c9", "score": "0.55042106", "text": "function evaluateTable(){\n var rows = document.getElementsByTagName(\"tr\");\n // If we only have 1 row it means we only have the header and we are done\n if (rows.length == 1) return null;\n // We get the headers just in case titles (or their order) are changed accross pages...\n var headerCells = rows[0].cells;\n // Mapping all the rows except first one (headers)\n return Array.prototype.map.call(Array.prototype.slice.call(rows,1), function(row) {\n var tmpJSON = {};\n // Now we fill the Account and Transaction\n for(i=0; i<headerCells.length; i++){\n if (headerCells[i].textContent == \"Amount\"){\n var amount = row.cells[i].textContent;\n // We capture both sides around the amount because some currencies are on the left, some on the right\n var matchArray = amount.match(/([^0-9]*)(\\d+)([^0-9]*)/);\n tmpJSON[\"Currency\"] = (matchArray[1] != \"\") ? matchArray[1] : matchArray[3];\n // The amount is always the third element of the match and we put it in float\n tmpJSON[headerCells[i].textContent] = parseFloat(matchArray[2]);\n } else if (headerCells[i].textContent == \"Transaction\"){\n // We extract the transaction number and put it in int\n tmpJSON[\"Id\"] = parseInt(row.cells[i].textContent.match(/\\d+/g)[0]);\n } else {\n tmpJSON[headerCells[i].textContent] = row.cells[i].textContent;\n }\n }\n return tmpJSON;\n });\n}", "title": "" }, { "docid": "080b8eeaf3004dc0d316ab30a9ec8d58", "score": "0.5503103", "text": "unionPage(firstIndex, secondIndex) {\n document.body.classList.add('waiting');\n // First we create a copy of the current tableDataExplore\n let tableData = _.cloneDeep(this.state.tableData);\n // We get the tableArray and name of the current sibling page\n let tableArray = \n this.state.propertyNeighbours[firstIndex].siblingArray[secondIndex].tableArray;\n let otherTableOrigin = \n this.state.propertyNeighbours[firstIndex].siblingArray[secondIndex].name;\n\n for (let i = 0; i < tableArray.length; ++i) {\n // We get the clean data for the current \"other table\"\n let otherTableData = setTableFromHTML(\n tableArray[i].data,\n otherTableOrigin\n );\n // We fetch the header row now\n let headerRow = otherTableData[0];\n otherTableData = setUnionData(otherTableData);\n // console.log(headerRow);\n // console.log(this.state.tableHeader);\n\n // Let's do some checking here: we do not want to union the same table with itself\n let sameTable = false;\n if (otherTableOrigin === decodeURIComponent(this.state.urlPasted.slice(30)) && headerRow.length === tableData[0].length) {\n let diffColFound = false;\n for (let m=0; m<headerRow.length; ++m) {\n if (headerRow[m].data !== this.state.tableHeader[m].value) {\n diffColFound = true;\n break;\n }\n }\n if (diffColFound === false) {\n sameTable = true;\n }\n }\n // We create a copy of the colMapping of the current \"other table\"\n let tempMapping = tableArray[i].colMapping.slice();\n\n // if sameTable is false, we can safely union the data\n if (sameTable === false) {\n tableData = tableConcat(\n tableData,\n otherTableData,\n tempMapping\n );\n }\n }\n // Now, since we are changing the number of rows, we need to call updateNeighbourInfo\n // Note: the colIndex we give to getNeighbourPromise should be this.state.keyColIndex\n let promiseArrayOne = this.getNeighbourPromise(tableData, \"subject\", this.state.keyColIndex);\n let promiseArrayTwo = this.getNeighbourPromise(tableData, \"object\", this.state.keyColIndex);\n allPromiseReady(promiseArrayOne).then((valuesOne) => {\n allPromiseReady(promiseArrayTwo).then((valuesTwo) => {\n\n // We call updateNeighbourInfo here because we are changing the rows\n let updatedNeighbours = updateNeighbourInfo(valuesOne, valuesTwo);\n let keyColNeighbours = updatedNeighbours.keyColNeighbours;\n let firstDegNeighbours = updatedNeighbours.firstDegNeighbours;\n\n document.body.classList.remove('waiting');\n // Suppport for undo.\n let lastAction = \"unionPage\";\n let prevState = \n {\n \"tableData\":this.state.tableData,\n \"keyColNeighbours\":this.state.keyColNeighbours,\n \"firstDegNeighbours\":this.state.firstDegNeighbours,\n \"previewColIndex\": this.state.previewColIndex,\n };\n \n this.setState({\n tableData: tableData,\n keyColNeighbours: keyColNeighbours,\n firstDegNeighbours: firstDegNeighbours,\n previewColIndex: -1,\n lastAction: lastAction,\n prevState: prevState,\n })\n })\n })\n }", "title": "" }, { "docid": "b3c2b8ff7049f25a7ae4c3a013468c4d", "score": "0.550177", "text": "function productsSales() {\n //table variable for printing database data nicely\n var table = new Table({ head: [\"Id\", \"Department Name\", \"Overhead Costs\", \"Product Sales\", \" Total Profit\"] });\n\n connection.query('SELECT department_id, department_name, over_head_costs, product_sales, (total_sales - over_head_costs) as total_profit FROM departments',\n (err, row) => {\n if (err) throw err;\n row.forEach(function(data) {\n var elem = [];\n elem.push(data.department_id, data.department_name, data.over_head_costs, data.product_sales, data.total_profit);\n table.push(elem);\n });\n console.log(table.toString());\n menuScreen();\n })\n}", "title": "" }, { "docid": "028ed3c497b00eac10396fbb8059b2eb", "score": "0.5500847", "text": "function make_table(data){\n // Clear any input\n tbody.html(\"\");\n // Create as many rows needed equal to the sightings, and append the data into cells\n data.forEach(function(sighting) {\n var row = tbody.append(\"tr\");\n Object.values(sighting).forEach((value)=>{\n var cell= row.append(\"td\");\n cell.text(value);\n })\n })\n}", "title": "" }, { "docid": "c928e808100df60c2058d7c1264b4c27", "score": "0.55002534", "text": "function setTableFromHTML(selecteTableHTML, urlOrigin) {\n let selectedTable = selecteTableHTML;\n let tempTable = [];\n\n // We first fetch the plain, unprocessed version of the table.\n // This is the part where we make the modification: use links instead of cell literals\n\n for (let i = 0; i < selectedTable.rows.length; ++i) {\n // console.log(selectedTable.rows[i]);\n let tempRow = [];\n for (let j = 0; j < selectedTable.rows[i].cells.length; ++j) {\n let curCellText = HTMLCleanCell(selectedTable.rows[i].cells[j].innerText);\n // Note: We want to use the href as data (if such href exists) instead of its innerText.\n if (i > 0) {\n // We get all the links from this current cell (there may be more than one)\n let anchorArray = selectedTable.rows[i].cells[j].getElementsByTagName(\n \"a\"\n );\n // we want to use the first valid link as the search element for this cell\n // Definition of being valid: its associated innerText is not empty (thus not the link of a picture)\n // and it is not a citation (so [0] is not \"[\")\n for (let k = 0; k < anchorArray.length; ++k) {\n if (\n anchorArray[k].innerText !== \"\" &&\n anchorArray[k].innerText[0] !== \"[\"\n ) {\n let hrefArray = anchorArray[k].href.split(\"/\");\n // console.log(\"InnerText is \"+anchorArray[k].innerText);\n // console.log(\"It exists in DBPedia as \"+hrefArray[hrefArray.length-1]);\n curCellText = decodeURIComponent(hrefArray[hrefArray.length - 1]);\n // if (curCellText.includes(\"UEFA\")) {\n // console.log(curCellText);\n // }\n }\n }\n }\n let curRowSpan = selectedTable.rows[i].cells[j].rowSpan;\n let curColSpan = selectedTable.rows[i].cells[j].colSpan;\n // console.log(curColSpan);\n tempRow.push({\n data: curCellText,\n origin: urlOrigin,\n rowSpan: curRowSpan,\n colSpan: curColSpan,\n });\n }\n tempTable.push(tempRow);\n }\n\n // We first deal with colspans.\n for (let i = 0; i < tempTable.length; ++i) {\n for (let j = 0; j < tempTable[i].length; ++j) {\n let curCellText = tempTable[i][j].data;\n if (tempTable[i][j].colSpan > 1) {\n for (let k = 1; k < tempTable[i][j].colSpan; ++k) {\n tempTable[i].splice(j + 1, 0, {\n data: curCellText,\n origin: urlOrigin,\n rowSpan: tempTable[i][j].rowSpan,\n colSpan: 1,\n });\n }\n }\n }\n }\n\n // We now deal with rowspans.\n for (let i = 0; i < tempTable.length; ++i) {\n for (let j = 0; j < tempTable[i].length; ++j) {\n let curCellText = tempTable[i][j].data;\n if (tempTable[i][j].rowSpan > 1) {\n for (let k = 1; k < tempTable[i][j].rowSpan; ++k) {\n // Note: the if condition is necessary to take care of error conditions (the original HTML table element has errors)\n if (i + k < tempTable.length) {\n tempTable[i + k].splice(j, 0, {\n data: curCellText,\n origin: urlOrigin,\n rowSpan: 1,\n colSpan: 1,\n });\n }\n }\n }\n }\n }\n\n // We now add in an additional column: the originURL of the page\n tempTable[0].splice(0, 0, {\n data: \"OriginURL\",\n origin: urlOrigin,\n rowSpan: 1,\n colSpan: 1,\n });\n for (let i = 1; i < tempTable.length; ++i) {\n tempTable[i].splice(0, 0, {\n data: urlOrigin,\n origin: \"null\",\n rowSpan: 1,\n colSpan: 1,\n });\n }\n\n // console.log(tempTable);\n return tempTable; // tempTable is a 2D array of objects storing the table data. Object has two fields: data(string) and origin(string).\n}", "title": "" }, { "docid": "f4d0d1172ed10d25f4c0b21e0469d316", "score": "0.5496695", "text": "function getTable(data, elements=[]) {\r\n\r\n\tfor (let elt of elements) {\r\n\r\n\t\tif (!(elt in data))\r\n\t\t\tdata[elt] = {}\r\n\r\n\t\telse if (typeof data[elt] != 'object') {\r\n\t\t\tlet path = '[\"'+elements.slice(0, elements.indexOf(elt)+1).join('\"].[\"')+'\"]'\r\n\t\t\tthrow error(path + ' must be an object')\r\n\t\t}\r\n\r\n\t\tdata = data[elt]\r\n\t}\r\n\r\n\treturn data\r\n}", "title": "" } ]
0bc1f7db431c0ad7310ae886c975eff9
Returns a temp file path after writing sBody to it. sBody (string)
[ { "docid": "a794088a47257a991b616b79d6d265ca", "score": "0.7698499", "text": "function getTempFilePath(sBody){\n var oTmpFile = Components.classes[\"@mozilla.org/file/directory_service;1\"].getService(Components.interfaces.nsIProperties).get(\"ProfD\", Components.interfaces.nsIFile);\n oTmpFile.append(\"msg.tmp\"); \n oTmpFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666); \n // do whatever you need to the created file \n \n var foStream = Components.classes[\"@mozilla.org/network/file-output-stream;1\"]. \n createInstance(Components.interfaces.nsIFileOutputStream); \n \n // use 0x02 | 0x10 to open file for appending. \n foStream.init(oTmpFile, 0x02 | 0x08 | 0x20, 0666, 0); \n // write, create, truncate \n // In a c file operation, we have no need to set file mode with or operation, \n // directly using \"r\" or \"w\" usually. \n \n // if you are sure there will never ever be any non-ascii text in data you can \n // also call foStream.writeData directly \n var converter = Components.classes[\"@mozilla.org/intl/converter-output-stream;1\"]. \n\tcreateInstance(Components.interfaces.nsIConverterOutputStream); \n converter.init(foStream, \"UTF-8\", 0, 0); \n converter.writeString(sBody); \n converter.close(); // this closes foStream \n \n return oTmpFile;\n}", "title": "" } ]
[ { "docid": "51ba260b72b0e21fb959ff4b9c5cf6ed", "score": "0.56341934", "text": "static TMP(pathname, req, res) {\n // log(\"tempFile \" + pathname)\n var file = pathname.replace(/^\\/_tmp\\//, '');\n if (req.method == 'GET') {\n var data = this.tmpStorage[file];\n res.writeHead(200);\n res.end(data, 'binary');\n }\n if (req.method == 'PUT') {\n var fullBody = '';\n req.setEncoding('binary');\n req.on('data', chunk => {\n fullBody += chunk.toString();\n });\n req.on('end', async () => {\n this.tmpStorage[file] = fullBody;\n setTimeout(() => {\n log('cleanup ' + file);\n delete this.tmpStorage[file];\n }, 5 * 60 * 1000); // cleanup after 5min\n res.writeHead(200); // done\n res.end();\n });\n }\n }", "title": "" }, { "docid": "ba65acb3fe4992b8c74fe53ae31f8446", "score": "0.54813707", "text": "function getTempBatFile()\n{\n\tvar path = getWebServicesDirectory();\n\tif(path)\n\t\tpath = path + tempBatFile;\n\telse\n\t\tpath = tempBatFile; \n\t\t\n\treturn path;\t\n}", "title": "" }, { "docid": "93775cfa591809c2c88e302fdf0ba637", "score": "0.5375087", "text": "writeFile(name, body) {\n console.log(\"writeFile Buffer\", body);\n return new Promise((resolve, reject) => {\n const pathName = path.join(this.uploadDirectory, name);\n fs.writeFile(pathName, body, err => {\n if (err) {\n return reject(err);\n }\n if (err) {\n console.log(err);\n reject(err);\n } else {\n console.log(name)\n resolve (name);\n }\n });\n })\n }", "title": "" }, { "docid": "e993724f49d0f5c62290bb5b585b5955", "score": "0.5330916", "text": "function createTempFileName() {\n\tif( typeof( fso ) == \"undefined\" ) {\n\t\t// use the fso object if already defined\n\t\tvar fso = new ActiveXObject(\"Scripting.FileSystemObject\");\n\t}\n var tfolder = fso.GetSpecialFolder(2);\n var tname = fso.GetTempName();\n\treturn( tfolder.path + '\\\\' + tname );\n}", "title": "" }, { "docid": "8d82c347ed26a77bf8174f60f378ed47", "score": "0.5229654", "text": "function createTempFile(){\n let randomFile = fm.getTempPath() + \"temp-\" + Math.round(Math.random() * 10000) + \".png\"\n\n fs.writeFileSync(randomFile, \"\")\n return randomFile\n}", "title": "" }, { "docid": "7a642c1823678c899c08c15f978a7244", "score": "0.51468927", "text": "function getBodyTemplate(bodyTemplate) {\r\n return (fs.readFileSync(path.join(__dirname, emailConfigs.templatePath + bodyTemplate), \"utf8\"));\r\n}", "title": "" }, { "docid": "10dfbd3979f2ed00f78f5e98fc538769", "score": "0.51099163", "text": "writeSteinsaltzPDF(body, directoryName, tractate, page) {\n return __awaiter(this, void 0, void 0, function* () {\n let attachDir = this.app.vault.getConfig(\"attachmentFolderPath\"); // Get attachment directory from Obsidian\n let pdfDir = directoryName;\n if (attachDir == \"/\") { // Top of the vault\n pdfDir = \"\"; // Will get leading / from pathName (see below)\n }\n else if (attachDir == \"./\") { // Current directory\n pdfDir = directoryName;\n }\n else if (attachDir.substring(0, 2) == \"./\" && attachDir.length > 2) { // Subdirectory of current\n pdfDir = directoryName + \"/\" + attachDir.substring(2);\n // Make directory?\n if (!(yield this.app.vault.adapter.exists(pdfDir))) {\n yield this.app.vault.adapter.mkdir(pdfDir);\n new obsidian.Notice(`Created attachments directory ${pdfDir}`);\n }\n }\n else if (attachDir.substring(0, 1) != \"/\") { // Absolute name\n pdfDir = \"/\" + attachDir;\n }\n let pathName = `${pdfDir}/${tractate}_${page}.pdf`;\n this.app.vault.createBinary(pathName, yield body.arrayBuffer());\n });\n }", "title": "" }, { "docid": "4631655f3317cf4463d6ca94dcb0e3d7", "score": "0.50123554", "text": "function getTempPath() {\n console.log(path.join(os.tmpdir(), TEMP))\n return path.join(os.tmpdir(), TEMP);\n}", "title": "" }, { "docid": "29d964c9a0051d2b8ccce7cec19c7a70", "score": "0.4951489", "text": "function TmpFilenameTextarea(){\n var TmpFilename;\n _tmpdir = gettmpDir();\n do{\n TmpFilename = _tmpdir + _dir_separator + \"ucjs.textarea.\" +\n Math.floor( Math.random() * 100000 ) + \".\" + _ext;\n }while(!ExistsFile(TmpFilename))\n return TmpFilename;\n }", "title": "" }, { "docid": "c3c739e2a00c1d7eeb79b55e6218b341", "score": "0.4910482", "text": "function createTempFile(contents) {\n var file = tmp.fileSync();\n\n fs.writeFileSync(file.name, contents, 'utf8');\n\n return file.name;\n}", "title": "" }, { "docid": "1336ed0acdb928f1df9a39d96c5dd4a8", "score": "0.48813462", "text": "function create_temp_file(tabs){\n\tif ( tabs.tab_array.length == 0 ) { console.log(\"Tab not found.\"); return; }\n\tvar file_path = tabs.tab_array_main[tabs.focus_file];\n\tvar editor_content = fileEditor.getValue();\n\tvar editor_json = { 'file_path': file_path, 'file_content': editor_content };\n\tfetch('http://localhost:3000/create_temp_file', {\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\t'content-type': 'application/json',\n\t\t},\n\t\tbody: JSON.stringify(editor_json)\n\t}).then(respons => {\n\t\tresult_content = response.json();\n\t\treturn result_content;\n\t}).then(data => {\n\t\tconsole.log(\"update [\" + data[\"file_name\"] + \"] file...\");\n\t\t_result = data[\"file_name\"];\n\t}).catch(error => {\n\t\tconsole.log(error);\n\t\tresult_content = error;\n\t})\n}", "title": "" }, { "docid": "6d417958edf71a4a71d8b604af3fbc16", "score": "0.48270893", "text": "function uploadPath(id) {\n return path.join(__dirname, 'tmp', id);\n}", "title": "" }, { "docid": "387395834ebe29910f89073c35dd81b6", "score": "0.48226044", "text": "getFilePathWRTRoot() {\n return path.join(\n this.parent,\n this.filename\n );\n }", "title": "" }, { "docid": "a9a159338dfd4d934e7f9f9b231b4a88", "score": "0.48216516", "text": "function TempFilesFolderName()\r{\r var strfolderPath = \"@@@\";\r var homeFolder = new Folder(\"~\");\r // $.writeln(homeFolder.fsName);\r var folderName = new File(homeFolder.fsName + '/temppics.adob');\r // $.writeln(folderName.fsName);\r \r if(folderName.exists)\r {\r folderName.open ('r');\r strfolderPath = folderName.readln();\r // $.writeln(\" function return : \" + strfolderPath);\r }\r else\r {\r // $.writeln(\" File \" + folderName.fullName + \" not found\" ) ;\r }\r\r//strfolderPath= '/Users/test/pics/';\r//alert(' temp pics are located ' + strfolderPath);\rreturn strfolderPath;\r \r}", "title": "" }, { "docid": "37bca4683b6236b630a1ab88c61dd36a", "score": "0.471104", "text": "function saveAndGetFilePath(req, callback){\n\t\n\t// get the temporary location of the file\n\tvar tmp_path = req.files.myFile.path;\n\t// set where the file should actually exists - in this case it is in the \"images\" directory\n\tvar target_path = './public/uploads/images/products/' + req.files.myFile.name;\n\tvar savePath = \"/uploads/images/products/\";\n\t// move the file from the temporary location to the intended location\n\tfs.rename(tmp_path, target_path, function(err) {\n\t if (err) throw err;\n\t // delete the temporary file, so that the explicitly set temporary upload dir does not get filled with unwanted files\n\t fs.unlink(tmp_path, function() {\n\t if (err) throw err;\n\t // res.send('File uploaded to: ' + target_path + ' - ' + req.files.myFile.size + ' bytes');\n\t\t\tconsole.log('File uploaded to: ' + target_path + ' - ' + req.files.myFile.size + ' bytes');\t \n\t\t\tsavePath = savePath + req.files.myFile.name;\n\t\t\tconsole.log(\"Save File to :\" + savePath);\n\t callback(null, savePath);\n\t // res.redirect(\"/addCategory\");\n\n\t });\n\t});\n}", "title": "" }, { "docid": "10070cb61c65a2daab55ccdb87b964cd", "score": "0.47100836", "text": "function writeFile(name, body) {\n return (new Promise((resolve, reject) => {\n fs.writeFile(uploadDir + path.sep + name, body, (err) => {\n if (err) {\n return reject(err);\n }\n resolve(name);\n });\n // action following resolve - call readFile\n })).then(readFile);\n}", "title": "" }, { "docid": "2b7585249c55e6c7a8bba5daa70a119f", "score": "0.46228802", "text": "static tmp(docs) {\n const tmpdir = fs.mkdtempSync(path.join(os.tmpdir(), 'cdk8s-'));\n const filePath = path.join(tmpdir, 'temp.yaml');\n Yaml.save(filePath, docs);\n return filePath;\n }", "title": "" }, { "docid": "4af7722f0a8e57745f145cc31c36683f", "score": "0.45920032", "text": "upload(path, fileBody, fileOptions) {\n return __awaiter$7(this, void 0, void 0, function* () {\n return this.uploadOrUpdate('POST', path, fileBody, fileOptions);\n });\n }", "title": "" }, { "docid": "21a14a43d9a9243e42280889bf6e1d13", "score": "0.45677054", "text": "function createTempFile(aName, aContent, aCallback=function(){})\n{\n // Create a temporary file.\n let file = FileUtils.getFile(\"TmpD\", [aName]);\n file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt(\"666\", 8));\n\n // Write the temporary file.\n let fout = Cc[\"@mozilla.org/network/file-output-stream;1\"].\n createInstance(Ci.nsIFileOutputStream);\n fout.init(file.QueryInterface(Ci.nsILocalFile), 0x02 | 0x08 | 0x20,\n parseInt(\"644\", 8), fout.DEFER_OPEN);\n\n let converter = Cc[\"@mozilla.org/intl/scriptableunicodeconverter\"].\n createInstance(Ci.nsIScriptableUnicodeConverter);\n converter.charset = \"UTF-8\";\n let fileContentStream = converter.convertToInputStream(aContent);\n\n NetUtil.asyncCopy(fileContentStream, fout, function (aStatus) {\n aCallback(aStatus, file);\n });\n}", "title": "" }, { "docid": "f7b4e81e5bc9dabbc39bda7375c766ae", "score": "0.45394725", "text": "function saveTo() {\n \n var body, title;\n\n title = documentsService.getCurrentDocumentTitle();\n body = documentsService.getCurrentDocumentBody();\n return dropboxService.saveFile(title, body);\n }", "title": "" }, { "docid": "d9e21420d57d13666dc347eb15a4e566", "score": "0.45157957", "text": "function copyFixture (fixtureRelativePath) {\n const fixturePath = path.join(fixturesPath, fixtureRelativePath);\n const tmpPath = path.join(tmpDir, path.basename(fixtureRelativePath));\n fs.copySync(fixturePath, tmpPath);\n return tmpPath;\n }", "title": "" }, { "docid": "5152f51421c2f0f6e9cbf0a8a636fe74", "score": "0.45137155", "text": "function surbsToGlobalFile(asSurb, goSurbFilea){\n\n\t\t// TODO: sanitize SURB.\n\t\tvar sSurbsText = \"\";\n\t\tfor(iSurb in asSurb){\n\t\t var sSurbBegin = \"-----BEGIN TYPE III REPLY BLOCK-----\";\n\t\t var sSurbEnd = \"-----END TYPE III REPLY BLOCK-----\";\n\t\t \n\t\t var sBeginPattern = new RegExp(\"- \" + sSurbBegin);\n\t\t var sEndPattern = new RegExp(\"- \" + sSurbEnd);\n\t\t var sSurb = asSurb[iSurb];\n\t\t sSurb = sSurb.replace(sBeginPattern, sSurbBegin);\n\t\t sSurb = sSurb.replace(sEndPattern, sSurbEnd);\n\n\t\t\n\t\t sSurbsText +=sSurb + \"\\n\";\n\t\t}\n\t\tvar goSurbFile = getTempFilePath(sSurbsText);\n\t\treturn goSurbFile.path;\n}", "title": "" }, { "docid": "e03585eb4cd00e0e4980190aa51be030", "score": "0.44905508", "text": "function getBody(){\n\n\tlet myBody = {\"name\" : getValueByID(\"nameInput\"),\n\t\t\t\t\"parents\": getValueByID(\"parentsInput\"),\n\t\t\t\t\"present\": getPresents(),\n\t\t\t\t\"birthday\": getValueByID(\"birthdayInput\"),\n\t\t\t\t\"eating\": getValueByID(\"eatingInput\"),\n\t\t\t\t\"sleeping\": getValueByID(\"sleepingInput\"),\n\t\t\t\t\"spez\": getValueByID(\"spezInput\"),\n\t\t\t\t\"important\": getValueByID(\"importantInput\")}\n\tconsole.log(myBody);\n\treturn JSON.stringify(myBody);\n}", "title": "" }, { "docid": "e72e8abebdc78dba8461011434320d84", "score": "0.44846624", "text": "function createFilePath(room) {\n fileName = room + '_' + String(Date.now()) + '.wav';\n return (PATH + fileName)\n }", "title": "" }, { "docid": "eac3f0472abe97ee4596c014a99423a8", "score": "0.4482592", "text": "function postUpload(title, body) {\n if (!Cookies.isLoggedIn()) {\n throw new Error(\"User is not logged in!\");\n }\n\n console.log(Cookies.getLoginDetails());\n\n const urlEncodedData = querystring.stringify({\n title,\n body\n });\n\n return axios(BASE_URL + UPLOAD_ROUTE, {\n method: \"POST\",\n data: urlEncodedData,\n withCredentials: true\n });\n}", "title": "" }, { "docid": "67243a06dee5272582e7a33f0a637fd4", "score": "0.4456857", "text": "function getOutputFile(bAddQuotes)\n{\n\tvar path = getWebServicesDirectory(); \t \n\tif (path)\n\t\tpath = path + outputFile;\n\telse\n\t\tpath = outputFile;\t\n\n\t// put quotes around.\n\tif(bAddQuotes && bAddQuotes == true)\n\t\tpath = addQuotes(path);\n\treturn path;\t\n}", "title": "" }, { "docid": "c77fb95a03503d23863833100abe6b8b", "score": "0.44276783", "text": "makeSaveAsPath() {\n\t\tthis.saveAs = path.normalize(this.saveAs);\t\t// fix up ../ and //\n\t\t\n\t\tif (!path.isAbsolute(this.saveAs)) {\n\t\t\tlog.config(`Path to saveAs file should be an absolute path, '${this.saveAs}'`);\n\t\t\treturn;\n\t\t}\n\t\t\t\n\t\tvar parts = this.saveAs.split('/');\n\t\tif (parts.length <= 1) {\n\t\t\treturn;\t\t\t\t\t\t\t\t\t\t// empty string or filename only, nothing to do\n\t\t}\n\t\t\n\t\tvar partialPath = '';\n\t\tfor (let i=1; i < parts.length-1; i++) {\t\t// skip parts[0], which s/b an empty string for absolute paths\n\t\t\tpartialPath += '/' + parts[i];\n\t\t\tif (!fs.existsSync(partialPath))\n\t\t\t\tfs.mkdirSync(partialPath);\n\t\t}\n\t}", "title": "" }, { "docid": "94bef94e92eecade5c327ac3a5edf303", "score": "0.4423273", "text": "_tapeFile() {\n this.fs.copy(\n this.templatePath(TAPE_FILE),\n this.destinationPath(`${this.projectName}/${TAPE_FOLDER}/${TAPE_FILE}`)\n );\n }", "title": "" }, { "docid": "96ace40d0b3888ee705fcf305dd57458", "score": "0.4406034", "text": "getAbsoluteFilePath() {\n /*\n TODO make this work regardless of being in the app or being\n in the parent folder of app. Right now, we are assuming we are\n in the parent folder of app.\n */\n return path.join(\n process.cwd(),\n config.SAVE_ROOT,\n this.getFilePathWRTRoot()\n );\n }", "title": "" }, { "docid": "c44ebdbf07c1022cd5e73ed21da4eab0", "score": "0.43975818", "text": "async storePdf(req, res) {\r\n // create the file path\r\n const pathFile = path.resolve(\r\n __dirname,\r\n \"..\",\r\n \"..\",\r\n \"tmp\",\r\n \"uploads\",\r\n localStorage.getItem(\"oldFile\")\r\n );\r\n\r\n // Delete the last file\r\n await fs.unlink(pathFile, err => {\r\n if (err) {\r\n console.log({ error: err });\r\n return res.status(400).json(err);\r\n }\r\n });\r\n\r\n console.log(\"Arquivo salvo!\");\r\n\r\n return res.json(req.file);\r\n }", "title": "" }, { "docid": "5ee09871f3987171652517d31b2059d8", "score": "0.43973985", "text": "uploadToSignedUrl(path, token, fileBody, fileOptions) {\n return __awaiter$7(this, void 0, void 0, function* () {\n const cleanPath = this._removeEmptyFolders(path);\n const _path = this._getFinalPath(cleanPath);\n const url = new URL(this.url + `/object/upload/sign/${_path}`);\n url.searchParams.set('token', token);\n try {\n let body;\n const options = Object.assign({ upsert: DEFAULT_FILE_OPTIONS.upsert }, fileOptions);\n const headers = Object.assign(Object.assign({}, this.headers), { 'x-upsert': String(options.upsert) });\n if (typeof Blob !== 'undefined' && fileBody instanceof Blob) {\n body = new FormData();\n body.append('cacheControl', options.cacheControl);\n body.append('', fileBody);\n }\n else if (typeof FormData !== 'undefined' && fileBody instanceof FormData) {\n body = fileBody;\n body.append('cacheControl', options.cacheControl);\n }\n else {\n body = fileBody;\n headers['cache-control'] = `max-age=${options.cacheControl}`;\n headers['content-type'] = options.contentType;\n }\n const res = yield this.fetch(url.toString(), {\n method: 'PUT',\n body: body,\n headers,\n });\n if (res.ok) {\n return {\n data: { path: cleanPath },\n error: null,\n };\n }\n else {\n const error = yield res.json();\n return { data: null, error };\n }\n }\n catch (error) {\n if (isStorageError(error)) {\n return { data: null, error };\n }\n throw error;\n }\n });\n }", "title": "" }, { "docid": "222c9981393eab8cccf71672d5452b0b", "score": "0.43852803", "text": "function storefile(rootPath, reqPath, contents) {\n // TODO(mike): Should probably merge this with the ls code (very similar)\n const fullPath = path.resolve(rootPath, reqPath);\n if (!fullPath.startsWith(rootPath)) {\n return { error: 'not-authorized' };\n }\n// if (!fs.existsSync(fullPath)) {\n// return { error: 'not-exists' };\n// }\n\n // TODO(mike): Should probably check/test if trying to save over a folder, etc.\n// if (!fs.statSync(fullPath).isFile()) {\n// return { error: 'not-file' };\n// }\n\n fs.writeFileSync(fullPath, contents, 'utf8');\n\n return {\n path: '/' + reqPath,\n };\n}", "title": "" }, { "docid": "3f12c16d662b1e621c9e35bb7f20956d", "score": "0.4366611", "text": "function saveTemporada(req,res){\n\n var temporada = new Temporada();\n var params=req.body;\n console.log(\"Aquiiii..................>>>\");\n console.log(params);\n temporada.nombre_temporada = params.nombre_temporada;\n temporada.fecha_inicio = params.fecha_inicio;\n temporada.fecha_fin = params.fecha_fin;\n temporada.id_usuario = params.id_usuario;\n \n if (req.files && req.files.url_reglamento_temporada != undefined) {\n console.log(\"Con Imagen\");\n var file_path = req.files.url_reglamento_temporada.path;\n var file_split = file_path.split('/');\n var file_name = file_split[3];\n //console.log(file_split);\n var ext_split = file_name.split('\\.');\n var file_ext = ext_split[1];\n //console.log(ext_split);\n if (file_ext == 'pdf') {\n \n temporada.url_reglamento_temporada = file_name;\n //console.log(equipo)\n temporada.save((err,temporadaGuardada) => {\n if(err){\n res.status(500).send({mensaje: \"Error en el servidor\"});\n }else{\n if (!temporadaGuardada) {\n res.status(404).send({mensaje: 'Error al crear una Temporada'});\n }else{\n res.status(200).send({temporada: temporadaGuardada});\n }\n }\n });\n \n } else {\n console.log(\"Archivo no valido\");\n res.status(200).send({\n mensaje: \"Extension del archivo no valido\"\n });\n }\n } else {\n console.log(\"Sin Imagen\");\n //temporada.url_reglamento_temporada = \"null\";\n temporada.save((err,temporadaGuardada) => {\n if(err){\n res.status(500).send({mensaje: \"Error en el servidor\"});\n }else{\n if (!temporadaGuardada) {\n res.status(404).send({mensaje: 'Error al crear una Temporada'});\n }else{\n res.status(200).send({temporada: temporadaGuardada});\n }\n }\n });\n // res.status(200).send({\n // message: \"No ha subido Ninguna Imagen\"\n // });\n }\n\n\n\n \n}", "title": "" }, { "docid": "34a4ae2140e12a4a6a922b876b5de365", "score": "0.4355977", "text": "function gettmpDir() {\n /* Where is the directory that we use. */\n var fobj = Components.classes[\"@mozilla.org/file/directory_service;1\"].\n getService(Components.interfaces.nsIProperties).\n get(\"ProfD\", Components.interfaces.nsIFile);\n fobj.append('Temp_ExternalEditor');\n if (!fobj.exists()) {\n fobj.create(Components.interfaces.nsIFile.DIRECTORY_TYPE,\n parseInt('0700',8));\n }\n if (!fobj.isDirectory()) {\n alert('Having a problem finding or creating directory: '+fobj.path);\n }\n return fobj.path;\n }", "title": "" }, { "docid": "4e16018e369e02cc2e31798b35a44a18", "score": "0.43527335", "text": "async function storeRequest(requestId, bodyObj) {\n // Save each submission into a bucket.\n const bucket = storage.bucket(GCP_STORAGE_BUCKET);\n const file = bucket.file(`${requestId}.json`);\n try {\n await file.save(JSON.stringify(bodyObj, null, 2));\n } catch(e) {\n console.error(`Could not store JSON for request ${requestId}.`);\n console.error(JSON.stringify(bodyObj, null, 0));\n }\n}", "title": "" }, { "docid": "bfbede163176bc8e98c7939802575c1d", "score": "0.4347873", "text": "get body() {\n if (this._body)\n return this._body;\n if (this._properties)\n return this._properties.getAString(\"Body\");\n return \"\";\n }", "title": "" }, { "docid": "60b54e3563992a45de04be5ae7bbd8be", "score": "0.43460852", "text": "function generateFile(tplPath, destPath) {\n const file = nunjucks.renderString(tp.read(tplPath), vars);\n // const file = template(tp.read(tplPath), vars);\n tf.write(destPath, file);\n console.log(`File ${chalk.blue(destPath)} created`);\n }", "title": "" }, { "docid": "0d66357e82502d028511bbc369a1c605", "score": "0.43411723", "text": "function writeFile(tripDetail) {\n readFile();\n \n contentGlobal = contentGlobal + \" -- \" + tripDetail;\n var dataObj = new Blob([contentGlobal], { type: 'text/plain' });\n\n // Create a FileWriter object for our FileEntry (log.txt).\n fileEntryGlobal.createWriter(function (fileWriter) {\n\n // If data object is not passed in,\n // create a new Blob instead.\n if (!dataObj) {\n dataObj = new Blob([contentGlobal], { type: 'text/plain' });\n }\n\n fileWriter.write(dataObj);\n\n fileWriter.onwriteend = function() {\n console.log(\"Successful file write...\");\n var saveFile = \"Successful Data Saved\";\n document.getElementById(\"saved\").innerHTML=saveFile;\n //readFile();\n };\n\n fileWriter.onerror = function (e) {\n console.log(\"Failed file write: \" + e.toString());\n document.getElementById('saved').innerHTML=\"Please, try again.\";\n }; \n\n });\n \n}", "title": "" }, { "docid": "f0c98b44f0d73497143b02c79c08c732", "score": "0.4314739", "text": "function generateServerSave(){\n\tvar rn = new Date().getTime();\n\tvar fileName = \"file-\"+rn+\".txt\";\n\tsessionStorage.setItem(\"ServerFile\", fileName);\n}", "title": "" }, { "docid": "103d6914347c04f79c786318c2bbec6a", "score": "0.43135983", "text": "setBody(body) {\n this.body = body;\n }", "title": "" }, { "docid": "b99b5273ab69bad9b9dc6dcb269e08db", "score": "0.4300996", "text": "getFilePath() {\r\n return this._context.fileSystemWrapper.getStandardizedAbsolutePath(this.compilerObject.name);\r\n }", "title": "" }, { "docid": "263be0bba001f53247aafbf79ecc9721", "score": "0.4266926", "text": "function stringifyBody(obj) {\n\tvar str = JSON.stringify(obj)\n\tstr = str.replace(/\\\"name\\\":\\\"(.*?)\\\"/g, (match, str) => {\n\t\tstr = \"\\\"\" + str.replace(/([^\\u0000-\\u007F])/g, (match, str) => {\n\t\t\treturn escape(str).replace(/%u/g, \"\\\\u\").toLowerCase()\n\t\t}) + \"\\\"\"\n\t\treturn `\"name\":${str}`\n\t})\n\treturn str\n}", "title": "" }, { "docid": "f5e02eab3250aa89ba43eac65255f3d0", "score": "0.42592335", "text": "function makeSafeFilename() {\n return \"recorded_data/data_\" + Date.now() + \".json\";\n}", "title": "" }, { "docid": "93522f3c84f13a1bf4d8692acce9e5d7", "score": "0.42331085", "text": "function getTempVarFile(varName) {\n\treturn tempVarsDir + '/' + varName + '.json';\n}", "title": "" }, { "docid": "128c1e304958e2efabd82fb651c12ff5", "score": "0.4231726", "text": "function defaultBody() {\n return '';\n}", "title": "" }, { "docid": "ca454dae71d9e4c76c991ce481b9664c", "score": "0.42188382", "text": "function getFullPath ({path, ref}) {\n path =\n (ref\n ? ref().path.toString() + '/'\n : '') +\n (path || '')\n return path\n }", "title": "" }, { "docid": "bd1e7d26526d3f5ef409f847e533813c", "score": "0.42175668", "text": "async renderBody(req, type, s, data, module) {\n\n let result;\n\n const args = self.getRenderArgs(req, data, module);\n\n const env = self.getEnv(req, module);\n\n if (type === 'file') {\n let finalName = s;\n if (!finalName.match(/\\.\\w+$/)) {\n finalName += '.html';\n }\n result = await Promise.promisify(function (finalName, args, callback) {\n return env.getTemplate(finalName).render(args, callback);\n })(finalName, args);\n } else if (type === 'string') {\n result = await Promise.promisify(function (s, args, callback) {\n return env.renderString(s, args, callback);\n })(s, args);\n } else {\n throw new Error('renderBody does not support the type ' + type);\n }\n return result;\n }", "title": "" }, { "docid": "01085fef92f8feac2d55d24a035f8c14", "score": "0.42115232", "text": "get body() {\n if (!this._body && this.isBinaryBody) {\n this._body = new TextDecoder().decode(this._binaryBody);\n }\n return this._body || '';\n }", "title": "" }, { "docid": "fdf068e1617671b56a65e982c130d7e2", "score": "0.42111441", "text": "__getPostFilePath(fileName) {\n\t\tvar blogsDir = this.fileSystemAdapter.getConfigProperty('blogsDir');\n\t\treturn blogsDir + path.sep + fileName;\n\t}", "title": "" }, { "docid": "4fe061a112bc52080adcae8e039c666a", "score": "0.42067167", "text": "function createBody(formData) {\n const body = {\n name: formData.get(\"name\"),\n user_rating: formData.get(\"user_rating\"),\n guide_rating: formData.get(\"guide_rating\"),\n stars: formData.get(\"stars\"),\n comments: formData.get(\"comments\"),\n climb_type: formData.get(\"climb_type\"),\n sent: formData.get(\"sent\"),\n mp_link: formData.get(\"mp_link\"),\n pitches: formData.get(\"pitches\"),\n }\n return body\n}", "title": "" }, { "docid": "38d3d83bed34efe0f55a61118388176f", "score": "0.42052916", "text": "uploadOrUpdate(method, path, fileBody, fileOptions) {\n return __awaiter$7(this, void 0, void 0, function* () {\n try {\n let body;\n const options = Object.assign(Object.assign({}, DEFAULT_FILE_OPTIONS), fileOptions);\n const headers = Object.assign(Object.assign({}, this.headers), (method === 'POST' && { 'x-upsert': String(options.upsert) }));\n if (typeof Blob !== 'undefined' && fileBody instanceof Blob) {\n body = new FormData();\n body.append('cacheControl', options.cacheControl);\n body.append('', fileBody);\n }\n else if (typeof FormData !== 'undefined' && fileBody instanceof FormData) {\n body = fileBody;\n body.append('cacheControl', options.cacheControl);\n }\n else {\n body = fileBody;\n headers['cache-control'] = `max-age=${options.cacheControl}`;\n headers['content-type'] = options.contentType;\n }\n const cleanPath = this._removeEmptyFolders(path);\n const _path = this._getFinalPath(cleanPath);\n const res = yield this.fetch(`${this.url}/object/${_path}`, Object.assign({ method, body: body, headers }, ((options === null || options === void 0 ? void 0 : options.duplex) ? { duplex: options.duplex } : {})));\n if (res.ok) {\n return {\n data: { path: cleanPath },\n error: null,\n };\n }\n else {\n const error = yield res.json();\n return { data: null, error };\n }\n }\n catch (error) {\n if (isStorageError(error)) {\n return { data: null, error };\n }\n throw error;\n }\n });\n }", "title": "" }, { "docid": "9228ef39b3b3e644a04410573ae6aa6a", "score": "0.42052117", "text": "function saveFile(response, filename, done) {\n var file = fs.createWriteStream(filename);\n file.write(response.body);\n file.end();\n file.on(\"finish\", function() {\n done();\n });\n}", "title": "" }, { "docid": "00c351c975888df7e30ddb899ca08113", "score": "0.42020613", "text": "function r(tmpl) {\n\treturn path + tmpl;\n}", "title": "" }, { "docid": "0cb535d49712c5dd6f3f24eb60467d01", "score": "0.41951013", "text": "get blobBody() {\n return undefined;\n }", "title": "" }, { "docid": "96ede7f7d80079b98523d65b481bc507", "score": "0.41930747", "text": "get fullPath() {\r\n return this._location.path;\r\n }", "title": "" }, { "docid": "d47b87de1ef2e650dc4c59a17d90ba75", "score": "0.4191343", "text": "function write(dest, s) {\r\n\tPackages.edu.mit.csail.uid.turkit.util.U.saveString(getFile(dest), s)\r\n}", "title": "" }, { "docid": "c1209718e6cc2427caacf656afb84c48", "score": "0.41850638", "text": "createFile(data, location, fileName, subFolder = { status: false }) {\n // File Path\n let path = \"\";\n if (subFolder.status) {\n path = `${location}/${fileName.charAt(0)}`;\n }\n //Make sure file exist\n fs.existsSync(path) ? \"\" : fs.promises.mkdir(path, { recursive: true });\n\n fs.writeFile(`${path}/${fileName}`, JSON.stringify(data), \"utf8\", function(\n err\n ) {\n if (err) {\n console.log(\"An error occured while writing JSON Object to File.\");\n return console.log(err);\n }\n console.log(`${path}/${fileName} file has been saved.`);\n });\n }", "title": "" }, { "docid": "4d75f9381805aa11fe05c3cc016d9de4", "score": "0.41825986", "text": "copyTo(url, shouldOverWrite = true) {\n return Object(_operations_js__WEBPACK_IMPORTED_MODULE_7__[\"spPost\"])(this.clone(File, `copyTo(strnewurl='${Object(_utils_escapeQueryStrValue_js__WEBPACK_IMPORTED_MODULE_8__[\"escapeQueryStrValue\"])(url)}',boverwrite=${shouldOverWrite})`));\n }", "title": "" }, { "docid": "bc3b9212697edaa492258090afa1d57e", "score": "0.41779152", "text": "function createNote(body, notesArray) {\n const note = body;\n notesArray.push(note);\n\n fs.writeFileSync(\n path.join(__dirname, \"../db/db.json\"),\n JSON.stringify({ notes: notesArray }, null, 2)\n );\n\n console.log(\"And here's the note\", note);\n return note;\n}", "title": "" }, { "docid": "986415814ad91ae0524955a11818344e", "score": "0.4177405", "text": "function gotBody_nowDelete(_body) {\n body = _body;\n sourceStorage.deleteMessageHeaderAndBody(header, deleted_nowAdd);\n }", "title": "" }, { "docid": "664a3a2abcfcd07d84290efd39ca7c27", "score": "0.41731468", "text": "function downloadTempFile() {\n console.log('downloadTempFile', filePath, tempFilePath);\n\n return new Promise((resolve, reject) => {\n bucket\n .file(filePath)\n .download({ destination: tempFilePath })\n .then(data => {\n console.log('Download successful:', filePath, tempFilePath, data[0]);\n resolve();\n })\n .catch(err => {\n reject(err);\n throw new Error('Error while downloading temp file:', err);\n });\n });\n }", "title": "" }, { "docid": "55b71be45cea5852c8bcd16bb05b0db4", "score": "0.41701427", "text": "saveTFFI(){\n\n var textToSave = JSON.stringify(this.props.trip);\n var textToSaveAsBlob = new Blob([textToSave], {type:\"text/plain\"});\n var textToSaveAsURL = window.URL.createObjectURL(textToSaveAsBlob);\n var fileNameToSaveAs = \"trip.json\";\n\n var downloadLink = document.createElement(\"a\");\n downloadLink.download = fileNameToSaveAs;\n downloadLink.innerHTML = \"Download File\";\n downloadLink.href = textToSaveAsURL;\n downloadLink.onclick = this.destroyClickedElement;\n downloadLink.style.display = \"none\";\n document.body.appendChild(downloadLink);\n\n downloadLink.click();\n }", "title": "" }, { "docid": "fe74bcb3e741ac65e19960f2c96bd47d", "score": "0.41692993", "text": "getTempName(config) {\n const dirname = config.tempDir;\n const filename = Util.createGUID();\n return path.resolve(dirname, filename);\n }", "title": "" }, { "docid": "e4fbeea98633d58a8badf13ee9f47ba8", "score": "0.41646805", "text": "function saveFile() {\n var inFullFilePath = document.getElementById('inFile').value;\n var inFile = inFullFilePath.replace(/^.*[\\\\\\/]/, '');\n var outFile = document.getElementById('outFile').value;\n var fpath = document.getElementById('fpath').value;\n var obj = JSON.stringify({msgType : 'ioFile', input : inFile, output: outFile, filePath: fpath});\n\tcsocket.emit('message', obj);\n}", "title": "" }, { "docid": "1583a07a690993578a622095f84d7f6b", "score": "0.41584027", "text": "function CreateXML()\n {\n var writer : StreamWriter;\n //FileInfo t = new FileInfo(_FileLocation+\"\\\\\"+ _FileName);\n var t : FileInfo = new FileInfo(_FileLocation+\"/\"+ _FileName);\n if(!t.Exists)\n {\n writer = t.CreateText();\n }\n else\n {\n t.Delete();\n writer = t.CreateText();\n }\n writer.Write(_data);\n writer.Close();\n Debug.Log(\"File written.\");\n }", "title": "" }, { "docid": "cb8bc78352d9311be28a582dbca5cf58", "score": "0.41582465", "text": "createFile() {\n return outputJsonSync(this.fileBase, this.defaults);\n }", "title": "" }, { "docid": "dd6fae3c7d78da6bd4bb5bac79f1a9b8", "score": "0.4147676", "text": "function createFile(name)\n{\n var dirService = Cc[\"@mozilla.org/file/directory_service;1\"]\n .getService(Ci.nsIProperties);\n\n // Get unique file within user profile directory.\n var file = dirService.get(\"TmpD\", Ci.nsIFile);\n file.append(name);\n\n // Initialize output stream.\n var outputStream = Cc[\"@mozilla.org/network/file-output-stream;1\"]\n .createInstance(Ci.nsIFileOutputStream);\n\n // Create some content.\n var text = \"Test file for upload.\";\n outputStream.init(file, 0x02|0x08|0x20, 0666, 0);\n outputStream.write(text, text.length);\n outputStream.close();\n\n FBTest.sysout(\"curlMultiPartFormData.createFile: \" + file.path);\n\n return file;\n}", "title": "" }, { "docid": "9467a5a5ad6db1119d6cd060a26f5603", "score": "0.41462854", "text": "function generateUniqueFileName(user, filename, role) {\r\n var fileExtension = getFileExtension(filename);\r\n var currentTime = new Date().toISOString().replace(/\\./g, '-').replace(/\\:/g, '-');\r\n var tempFile = user + \"_\" + currentTime + fileExtension;\r\n console.log(tempFile);\r\n return tempFile;\r\n}", "title": "" }, { "docid": "d40db06f89f867916d10fd35a9bf24b6", "score": "0.41428864", "text": "getImageDir() {\n\t\ttry {\n\t\t\tvar blogsDir = this.fileSystemAdapter.getConfigProperty('blogsDir');\n\t\t\tvar temp = blogsDir + path.sep + FileSystemConstants.IMAGE_DIR ;\n\t\t\t\n\t\t\t// creates the temp dir if it does not exist\n\t\t\tthis.fileSystemAdapter.createDir(temp);\n\t\t\treturn temp;\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error creating temp directory.\", error);\n\t\t\tthrow error;\n\t\t}\n\t}", "title": "" }, { "docid": "9b9a35bd4ae4b148ec48c3de8c41be8c", "score": "0.41399828", "text": "function getMockFileFullPath(request, dataFile) {\n const publicPrivateDir = getMockPrefix(request)\n return path.join(dataDirectory, publicPrivateDir, dataFile)\n}", "title": "" }, { "docid": "b5ae9a0e01bc5289af0cd9150378d2b0", "score": "0.41379148", "text": "function getBody() {\n\tcursor = positionCursor(BODY);\n\n\tlet body = \"\";\n\n\tif (cursor != -1) {\n\t\tfor (cursor; !limitReached(cursor); cursor++) {\n\t\t\tbody += input.charAt(cursor);\n\t\t}\n\t}\n\t\n\tif (!copiedFromAcrobat) {\n\t\tbody = formatBodyContacts(body);\n\t} else {\n\t\tbody = stripErroneousLineBreaks(body);\n\t}\n\n\tinfo.body = body;\n\t\n}", "title": "" }, { "docid": "84133b9d904491563df2e454de26651f", "score": "0.41368562", "text": "update(path, fileBody, fileOptions) {\n return __awaiter$7(this, void 0, void 0, function* () {\n return this.uploadOrUpdate('PUT', path, fileBody, fileOptions);\n });\n }", "title": "" }, { "docid": "cad4afebc5cc0fd4f5954e9436e34d6f", "score": "0.41277435", "text": "function createBody (atom){\n var body = ['--END_OF_PART\\r\\n',\n\t\t'Content-Type: application/atom+xml;\\r\\n\\r\\n',\n\t\tatom, '\\r\\n',\n\t\t'--END_OF_PART\\r\\n',\n\t\t'X-Upload-Content-Type: ', 'text/html', '\\r\\n\\r\\n',\n\t\t$('#snip-content').html(), '\\r\\n',\n\t\t'--END_OF_PART--\\r\\n'].join('');\n}", "title": "" }, { "docid": "f27e95606d619ce32a0027fc661e04a7", "score": "0.41213262", "text": "async function tempFile(dir, opts = { prefix: \"\", postfix: \"\" }) {\n const r = Math.floor(Math.random() * 1000000);\n const filepath = path.resolve(`${dir}/${opts.prefix || \"\"}${r}${opts.postfix || \"\"}`);\n await mkdir(path.dirname(filepath), { recursive: true });\n const file = await open(filepath, {\n create: true,\n read: true,\n write: true,\n append: true,\n });\n return { file, filepath };\n }", "title": "" }, { "docid": "f27e95606d619ce32a0027fc661e04a7", "score": "0.41213262", "text": "async function tempFile(dir, opts = { prefix: \"\", postfix: \"\" }) {\n const r = Math.floor(Math.random() * 1000000);\n const filepath = path.resolve(`${dir}/${opts.prefix || \"\"}${r}${opts.postfix || \"\"}`);\n await mkdir(path.dirname(filepath), { recursive: true });\n const file = await open(filepath, {\n create: true,\n read: true,\n write: true,\n append: true,\n });\n return { file, filepath };\n }", "title": "" }, { "docid": "b151a8d9afd5d6def8eb989d56a50381", "score": "0.41211334", "text": "function writeReservations(TM_Reservations,pathName){\n\tvar JSON_String= JSON.stringify(TM_Reservations,null,\"\\t\");\n\tJSON_Sring=JSON.stringify(TM_Reservations,null,4);\n\tfs.writeFile(pathName, JSON_String, function (err) {\n \t\n \tif (err) return console.log(err+\"path not found: \"+pathName);\n \t\n});\n //save current reservation ID to file\n fs.writeFile(\"data/config.txt\", reservationID, function (err) { \n if (err) return console.log(err+\"path not found: \"+pathName); \n});\n fs.writeFile(\"data/usersID.txt\", userID, function (err) { \n if (err) return console.log(err+\"path not found: \"+pathName); \n});\n\n}", "title": "" }, { "docid": "b10861b80fbcd823a1a73788e8fe2f51", "score": "0.41210648", "text": "get sf() {\n if (typeof this.text === 'undefined') throw new Error('undefined file ' + this.filePath);\n return (0, _tsMorph.createTSMSourceFile_cached)(this.filePath, this.text);\n }", "title": "" }, { "docid": "5aa0e81327ea7fd6f2519ae36e43913f", "score": "0.41207367", "text": "function createLink(remoteFileInfo, localFileInfo) {\n\t\tvar msg = {\n\t\t\t\"msgType\"\t\t: \"Normal Request\",\n\t\t\t\"methodName\"\t: \"linkTwoFiles\",\n\t\t\t\"params\"\t\t: {\n\t\t\t\t\"hostId\"\t\t: remoteFileInfo[\"hostId\"],\n\t\t\t\t\"remoteFileName\": remoteFileInfo[\"name\"],\n\t\t\t\t\"localFileName\" : localFileInfo[0][\"name\"]\n\t\t\t}\n\t\t};\n// console.log(JSON.stringify(msg))\n// console.log(msg);\n// console.log(localFileInfo);\n// console.log(typeof localFileInfo);\n// console.log(localFileInfo[0]);\n// console.log(localFileInfo[\"name\"]);\n// console.log(localFileInfo[0][\"name\"]);\n\t\t_socket.write(prepareMsg(msg));\n\t}", "title": "" }, { "docid": "62d87ae48053bbd93f6463b7132f9a29", "score": "0.4119459", "text": "function createNewNote(body, notesArray) {\n const note = body;\n notesArray.push(note);\n fs.writeFileSync(\n path.join(__dirname, './data/notes.json'),\n JSON.stringify({ notes: notesArray }, null, 2)\n );\n return note;\n }", "title": "" }, { "docid": "9972b9aed77c80683aa65e121e982ceb", "score": "0.41146913", "text": "get fullPath() {\n return this._location.path;\n }", "title": "" }, { "docid": "1acf1983e763cddc22ea9bbc483a6c3d", "score": "0.41123348", "text": "function sendDoc(ts, doc) {\n ts.server.request({\n files: [{\n type: \"full\",\n name: doc.name,\n text: docValue(ts, doc)\n }]\n }, function (error) {\n if (error) console.error(error);\n else doc.changed = null;\n });\n }", "title": "" }, { "docid": "d89b4c355eedf0f3132acfdd3be331f7", "score": "0.41036877", "text": "function generateFile(tplPath, destPath) {\n const file = template(tp.read(tplPath), vars);\n tf.write(destPath, file);\n }", "title": "" }, { "docid": "e82067f23a741ad8ca23b9bb8c8e3fc6", "score": "0.40988255", "text": "function addBodyToOut() {\n if (body.length > 0) {\n out.push(body.join(''));\n body = [];\n }\n state = 'LF';\n out.push('\\n');\n }", "title": "" }, { "docid": "23d3bc79d10364bf9e3b3d2b804cc968", "score": "0.40947402", "text": "async saveFile(buffer, { beforeSave, uuid = (0, uuid_1.v4)() } = {}) {\n const metadata = await fileUtils.identify(buffer, { mediaTypes: __classPrivateFieldGet(this, _GenericFileStorage_mediaTypes, \"f\") });\n const fileName = `${uuid}.${metadata.format}`;\n const filePath = getFilePath(__classPrivateFieldGet(this, _GenericFileStorage_path, \"f\"), fileName);\n const metadataFilePath = getFileMetadataPath(__classPrivateFieldGet(this, _GenericFileStorage_path, \"f\"), fileName);\n const { dir: fileDir } = path.parse(filePath);\n await (beforeSave === null || beforeSave === void 0 ? void 0 : beforeSave({ metadata }));\n await fs.mkdir(fileDir, { recursive: true });\n try {\n await Promise.all([\n fs.writeFile(filePath, buffer),\n fs.writeFile(metadataFilePath, JSON.stringify(metadata), 'utf8')\n ]);\n return {\n id: fileName,\n metadata: metadata\n };\n }\n catch (e) {\n await Promise.all([filePath, metadataFilePath]\n .map(path => fs.rm(path, { force: true })));\n throw e;\n }\n }", "title": "" }, { "docid": "604a9a9da392a3f97467fcf0bd639a31", "score": "0.40899563", "text": "requestBody(body) {\n if (body === null || typeof body === 'undefined') {\n return null;\n }\n if (body instanceof URLSearchParams) {\n setOrIgnoreIfExists(this.options.headers, 'Content-Type', 'application/x-www-form-urlencoded;charset=utf-8');\n return body.toString();\n }\n if (isPlainObject(body)) {\n setOrIgnoreIfExists(this.options.headers, 'Content-Type', 'application/json;charset=utf-8');\n return JSON.stringify(body);\n }\n return body;\n }", "title": "" }, { "docid": "78fb6e90e6c27fb32c469c8f7471b582", "score": "0.40816048", "text": "function writeTemplate(verbose=false,pathInput,filename, content){\n fs.writeFileSync(path.join(pathInput,filename),content,{mode:Number.parseInt(0755)})\n if(verbose) {\n console.log('write: ' + path.join(pathInput,filename))\n }\n}", "title": "" }, { "docid": "de04a5412de21e33a844bb414b6ce09e", "score": "0.4077604", "text": "function NewFileName(id, name, date, filenameTo,type) {\n \n var timezone = CacheService.getScriptCache().get(\"timezone\");\n\n // filename = Utilities.formatDate(date, config.timezone, rule.filenameTo.replace('%s',name));\n \n filename = Utilities.formatDate(date, timezone, filenameTo);\n id = id.substr(id.length-3, 3);\n filename = filename.replace('%id',id); //email id\n filename = filename.replace('%t',type); //type\n filename = filename.replace('%s',name); //email topic\n filename = filename.replace(rule.filenameReplaceFrom,rule.filenameReplaceTo); //user defined\n \n // filename = filename.replace('[toread] ',''); ==>> faire en REGEX.\n filename = filename.substr(1, config.maxNameLength);\n \n if ( config.fnameComputerReady === true ) { \n filename = removeDiacritics(filename);\n config.maxNameLength = Math.min(config.maxNameLength,\"250\");\n filename = filename.substr(1, config.maxNameLength);\n }\n \n Logger.log(\"Created a new filename: \" + filename);\n return filename;\n}", "title": "" }, { "docid": "e679de751390a1e3237c93d543569d9d", "score": "0.40738878", "text": "function createFileFn(startPath, nameFile, text)\n{\n fs.writeFileSync(startPath+'/'+nameFile, text);\n}", "title": "" }, { "docid": "feb077932a8395fe6a1317371f33a87a", "score": "0.4065916", "text": "decode_buffer(buf, folder, filename='' ) { \n return fs.writeFile(path.join(__dirname, '../../../../public/uploads/' + folder + '/', filename), buf, function(error) {\n if (error) {\n } \n else {\n }\n });\n }", "title": "" }, { "docid": "0b3e81569fa37739576cb3686518af24", "score": "0.40632227", "text": "commit(){\r\n \r\n let ws = filesystem.createWriteStream(this.pathToFile);\r\n\r\n ws.on('error',(e)=>{\r\n console.log(e);\r\n });\r\n\r\n let ret = ws.write(storageBuffer);\r\n\r\n }", "title": "" }, { "docid": "a215bd46fa15df02e4cd6e217ea00406", "score": "0.4057189", "text": "function postFileRequestCallback(err, res, body) {\r\n\tif (err) console.log('Request error: ' + err.code + \r\n\t\t' from ' + err.address + ':' + err.port);\r\n\r\n\tif (body) testUtmResponse(body);\r\n}", "title": "" }, { "docid": "79feffdf00ac662d3c886a44af736ca7", "score": "0.40529966", "text": "filename(req, file, cb) {\n cb(null, util.generatePathPdf(req.body.name, req.body.idJob));\n }", "title": "" }, { "docid": "78c8139aa3c8029eb50d97245fe6aa2e", "score": "0.40512985", "text": "writelog() {\n this.fs.appendFileSync(`${__dirname}/scrapeLog.txt`, this.pdfname);\n }", "title": "" }, { "docid": "e6c14c6735f0e9a24bf95a9e4f645759", "score": "0.4044344", "text": "function writeToFile(fileName, template) {\n fs.writeFile(fileName, template, function(err) {\n console.log(fileName);\n\n if (err) {\n return console.log(err);\n } else {\n return console.log(\"Success!\");\n }\n })\n}", "title": "" }, { "docid": "8eb6908560f4df19efe450a710f0eaf2", "score": "0.4041838", "text": "function duplicateParsedFile(model, sourceShortPath, targetTempDir, targetShortPath, fileArtifactsFactory) {\n if (model.getFileArtifact(targetShortPath)) {\n return;\n }\n\n var targetFileArtifact = fileArtifactsFactory.createArtifact(targetTempDir, targetShortPath);\n if (!targetFileArtifact) {\n return null;\n }\n var sourceFileArtifact = model.getFileArtifact(sourceShortPath);\n\n if (!sourceFileArtifact) {\n return null;\n }\n\n targetFileArtifact.setOriginalContentForAccessContainer(sourceFileArtifact.getOriginalContentForDataContainer());\n model.addFileArtifact(targetFileArtifact);\n}", "title": "" }, { "docid": "fac5197eb556872155fbffc605da43a2", "score": "0.4037006", "text": "constructBody(task) {\n var body = {\n text: `${task.id}-${task.name.replace(/[aeiou ]/gi, \"\")}`,\n type: \"todo\",\n notes: `Synced from Things App ${new Date().toLocaleString()}`,\n };\n return `'${JSON.stringify(body)}'`;\n }", "title": "" }, { "docid": "4fef51da57a43311535b7c751f4b995d", "score": "0.4035794", "text": "function GetFileName(Obj, DesObj) {\n strFilePath = Obj.value;\n FilePathLen = strFilePath.length;\n var strFileName = '';\n var SepChar = '';\n for (var i = FilePathLen; i >= 0; i--) {\n SepChar = Obj.value.substring(strFilePath.length - 1, strFilePath.length);\n if (SepChar != \"\\\\\") {\n strFilePath = strFilePath.substring(0, strFilePath.length - 1);\n strFileName = SepChar + strFileName;\n }\n else {\n DesObj.value = strFileName;\n return 1;\n }\n\n }\n if (DesObj.value == '')\n DesObj.value = Obj.value;\n}", "title": "" }, { "docid": "f562c7d3b05e2d32ba8f139757ffffb9", "score": "0.40354323", "text": "static setTemporary(file, isTemporary = true) {\n file = FileHelpers.normalize(file);\n if (!isTemporary && \n FileWriter.temporaryFiles.includes(file)) {\n FileWriter.temporaryFiles\n .splice(FileWriter.temporaryFiles\n .indexOf(file), 1);\n } else if (isTemporary && \n !FileWriter.temporaryFiles.includes(file)) {\n FileWriter.temporaryFiles.push(file);\n }\n }", "title": "" }, { "docid": "018ca26453f90e916c1e0015d45139d2", "score": "0.40345097", "text": "static async appendFile(params) {\n let url = \"/feedback\" + params\n const res = await fetch(url)\n console.log(res)\n let data = await res.text()\n console.log(data)\n }", "title": "" } ]
98a2bcfd8566e35a15090ca8e0f0e59f
var duplicate = n => [n, n] flatmap([1, 2, 3], duplicate) ==> [1, 1, 2, 2, 3, 3]
[ { "docid": "357c5af7ef5cb0cc8dd87108a05ef733", "score": "0.0", "text": "function flatmap (sequence, proc) {\n return sequence\n .map(i => (proc(i)))\n .reduce((accu, curr) => (accu.concat(curr)));\n}", "title": "" } ]
[ { "docid": "80216313d19685b748a253b216d8f7ca", "score": "0.80873734", "text": "function duplicate(n) {\n return [n, n];\n}", "title": "" }, { "docid": "aff259294797df84ac19aa55504a8c50", "score": "0.7343777", "text": "function duplicate2(n) {\n return [[[n, n]]];\n}", "title": "" }, { "docid": "0cdfc56c2c6522faf8e840c3509b0f6e", "score": "0.6936619", "text": "function duplicate(arr){\n arr.forEach(item => arr.push(item))\n return arr;\n}", "title": "" }, { "docid": "bd1adda8c2b02ce194a44c751b3f1ecd", "score": "0.6730309", "text": "function myFunction() {\n console.log(singleNonDuplicate(\n [1,1,4,4,5,5,6,8,8]\n ));\n\n\n}", "title": "" }, { "docid": "934b40b632a79b9c6e0adf06660ffdaf", "score": "0.6672699", "text": "function dupelements(arr,a,b){\n\tvar dup = []; \n for(var i=a+1;i<b;i++){\n\tdup.push(arr[i]);\n}\nreturn dup;}", "title": "" }, { "docid": "b51165f053aeb705b018df8c79ed7393", "score": "0.66294223", "text": "function same(n) {\n\treturn [n, n, n, n, n, n];\n}", "title": "" }, { "docid": "8e60ffaeb415b51e12076fef78f8801f", "score": "0.6449898", "text": "function duplicateArray(array) {\n var output = [];\n array.forEach(function (element) {\n output.push(element, element);\n });\n return output;\n}", "title": "" }, { "docid": "f951a001b0d3ae4b8110b5c3b0c418dd", "score": "0.6396274", "text": "function duplicate(array) {\n var arr = [];\n for (var i = 0; i < array.length; i ++) {\n arr.push(array[i]);\n }\n arr = arr.concat(array);\n return arr;\n}", "title": "" }, { "docid": "08587f34115fd86a161b761764637de0", "score": "0.6239004", "text": "function duplicate(arr) {\n\n let l = arr.length;\n for(let i=0; i<l; i++) {\n arr.push(arr[i]);\n }\n}", "title": "" }, { "docid": "708229a29c24075b06ffcbbea227b8ba", "score": "0.6152827", "text": "function deepDup(arr) {\n\n if (!(arr instanceof Array)) {\n return arr;\n }\n\n return arr.map((el) => {\n return deepDup(el);\n });\n}", "title": "" }, { "docid": "94c4e9b2cc748f77656638a1571af692", "score": "0.61326736", "text": "function uniq(inp) {\n return [...new Set(inp)];\n}", "title": "" }, { "docid": "a65b2d46b29dad357cc51f9f271445ee", "score": "0.6123611", "text": "function deepDup(arr) {\n\n return arr.map(function(el) {\n if (Array.isArray(el)) {\n return deepDup(el);\n } else {\n return el;\n }\n });\n\n}", "title": "" }, { "docid": "c7f07c326d5f80fc2fc3aa9206e4e0eb", "score": "0.61063087", "text": "function repetidos(array) {\n var array = [3, 6, 67, 6, 23, 11, 100, 8, 93, 0, 17, 24, 7, 1, 33, 45, 28, 33, 23, 12, 99, 100];\n var dupl = [];\n for (var i = 0; i < array.length; i++) {\n for (var x = i; x < array.length; x++) {\n if (i!=x && array[i]==array[x]) {\n dupl.push.apply(array[i])\n console.log(array[i]);\n }\n \n }\n\n }\n}", "title": "" }, { "docid": "77b074e40fff524e8bf44c9b40f82446", "score": "0.60307", "text": "function replicate(times, number){\n if (times <= 0) return [];\n \n return [number].concat( replicate(times-1, number)) \n}", "title": "" }, { "docid": "446cdff9549dd31e3ef8513ba696ee95", "score": "0.6001417", "text": "function permutationsWithoutDups(arr) {\n if (arr.length < 1) return []\n const result = []\n util(arr, 0, result)\n return result\n}", "title": "" }, { "docid": "473440ef14fa54ee2df45a5b0aab71a5", "score": "0.5981512", "text": "function rep(x, times) {\n var s = seq(1,times).map(function(z) { return x })\n var o = []\n return o.concat.apply(o,s)\n}", "title": "" }, { "docid": "a0df20f9d7a06e001090750d016165e6", "score": "0.59501237", "text": "function repeat(n) {\n // See https://stackoverflow.com/a/10050831\n return [...Array(n)];\n}", "title": "" }, { "docid": "68699962f69dc2cbd8c38acb78e7d25e", "score": "0.59235036", "text": "function firstDuplicate (arr) {\n\n}", "title": "" }, { "docid": "7dfef38a7be4863131ed6865e57772a1", "score": "0.58883905", "text": "function remove_duplicates_1(arr) {\n return [...new Set(arr)];\n}", "title": "" }, { "docid": "4dd5d069586784040435a8862578224f", "score": "0.58750516", "text": "function duplicate(grid) {\n let dup = [0, 0, 0, 0];\n dup = dup.map(x => [0, 0, 0, 0]);\n for (let i = 0; i < row_num; ++i) {\n for (let j = 0; j < column_num; ++j) {\n dup[i][j] = grid[i][j];\n }\n }\n return dup;\n}", "title": "" }, { "docid": "e2fb38ece7eb8d5a4831fc24337336c7", "score": "0.5823662", "text": "function replicate(count,num) {\n if(count<=0) return []\n\n return [num].concat(replicate(count-1,num))\n}", "title": "" }, { "docid": "87d5461310e08d338bc04f5f3a596644", "score": "0.58230436", "text": "function re_dup(arr){\n let newArr = []\n for(let i = 0;i < arr.length; i++){\n if(newArr.indexOf(arr[i]) == -1){\n newArr.push(arr[i])\n }\n }\n return newArr;\n}", "title": "" }, { "docid": "127aeec7a597fae7cc72d006cf05a55d", "score": "0.581017", "text": "function unshiftDuplicateArr(arr,num){\n var newArray = [num];\n\n for(var i = 0; i < arr.length; i++) {\n newArray.push(arr[i]);\n }\n\n return newArray;\n}", "title": "" }, { "docid": "e6d64a9dc6b486d52c71b5187f0a8dff", "score": "0.5808788", "text": "function remDups(arr) {\n let set = new Set(arr);\n return [...set];\n}", "title": "" }, { "docid": "7dbf94a0b8398535dd301a84560c32fe", "score": "0.58055866", "text": "function repeatList(el, n) {\n var output = [];\n for(var i = 0; i < n; i++) {\n output.push(el);\n }\n return output;\n}", "title": "" }, { "docid": "845f290d147300161fc78755329f7e11", "score": "0.5802212", "text": "function replicate(x, n) /* forall<a> (x : a, n : int) -> list<a> */ {\n function enumerate(i, acc) /* (i : int, acc : list<23721>) -> list<23721> */ { tailcall: while(1)\n {\n if ($std_core._int_le(i,0)) {\n return acc;\n }\n else {\n {\n // tail call\n var _x40 = (dec(i));\n var _x41 = Cons(x, acc);\n i = _x40;\n acc = _x41;\n continue tailcall;\n }\n }\n }}\n return enumerate(n, Nil);\n}", "title": "" }, { "docid": "52a754f4166992d1b7000b2312e8dd13", "score": "0.5795706", "text": "function createMulitple(num, val) {\n return [...Array(num).keys()].map((x) => val());\n}", "title": "" }, { "docid": "09eae5df0ce00cff2719ba2e461cbede", "score": "0.5778507", "text": "function flatter(arr) {\n return [...new Set(arr.flat(3))].sort()\n}", "title": "" }, { "docid": "194dda3aef7a096c9c7fd1d03a22cf28", "score": "0.5739209", "text": "static duplicates(tab){\n //on ajoute un element au debut à la fin afin de pouvoir faire i-1 et i+1\n tab.push(-1, 7, 7);\n tab.unshift(-1);\n\n let res = [];\n let i = 1;\n while (i < tab.length){\n if (tab[i] === tab[i-1] && tab[i] === tab[i+1]){\n res.push(i-2, i-1, i); //car on a ajouté un element au debut\n res = res.concat(Grille.match4(i, tab));\n i++;\n }\n i++;\n }\n return res\n }", "title": "" }, { "docid": "cac31b4350d035abe00fedc4da50c9e4", "score": "0.57274365", "text": "function uniteUnique(arr) {\n //create a new array\n //create a variable to hold our arguments array\n //loop through the length of the arguments\n //loop through the individule elements\n //compare the values for repeating duplicates\n //compare the values for repeating numbers, use indexof to look for reapeating numbers, if found dont push.\n //push the numbers to a new array that match the requirements into that new array\nvar newArray = [];\n\nfor (var i = 0; i < arguments.length; i++){\n var numbers = arguments[i];\n for (var j = 0; j < numbers.length; j++) {\n if (newArray.indexOf(numbers[j]) === -1) {\n newArray.push(numbers[j])\n }\n }\n }\n return newArray;\n}", "title": "" }, { "docid": "7bb8a05353c9b6cc2dfba5f77583658e", "score": "0.5718067", "text": "function dedup(array) {\n //create a new array with no duplicates\n //[...new Set()] returns a new array of unique items\n let newArr = [...new Set(array)];\nreturn newArr;\n}", "title": "" }, { "docid": "0ed81bc835f00c529293030d5975eb11", "score": "0.571642", "text": "static clone2D(a) {\n return a.map(o => [ ...o ]);\n }", "title": "" }, { "docid": "6f4b8dd817c03ea42c17a2eab99b4fe0", "score": "0.5714819", "text": "function dup(x) {\n let i;\n buff = new Array(x.length);\n copy(buff, x);\n return buff;\n}", "title": "" }, { "docid": "abca80943ef57378ba8a4bbf520f1bec", "score": "0.57137644", "text": "function cloneArray (array){\n return [...array]\n}", "title": "" }, { "docid": "11e863bbd09ed8920036027309da18f8", "score": "0.56884044", "text": "function uniq(array) {\n return [...new Set(array)];\n}", "title": "" }, { "docid": "7cf54d3b39ad2937c556342b84c3632c", "score": "0.5688121", "text": "function quickCloneArray(input) {\n\treturn input.map(cloneValue);\n}", "title": "" }, { "docid": "eeeecc3cc0910af0a7d720e2740d02b5", "score": "0.56533754", "text": "function dup (a) {\r\n b=a.length\r\n c=[]\r\n for (i=0; i<b; i++) {\r\n if (!c.includes(a[i])) {c.push(a[i])}\r\n }\r\n console.log(c)\r\n }", "title": "" }, { "docid": "aa0e71388b7b001bd551a1616a619089", "score": "0.56514263", "text": "function removeDuplicateItems(arr) {}", "title": "" }, { "docid": "55316ced64e42c44a684cc69cdddd966", "score": "0.56444573", "text": "function distinct (arr) {\n return [... new Set(arr)]; \n}", "title": "" }, { "docid": "57f29a16fced69c9f0675383f2e95064", "score": "0.56443274", "text": "function permuteNoSlate(nums) {\n const result = [],\n len = nums.length\n function pHelper(i, arr) {\n if (len === i) {\n result.push(arr.slice(0))\n return\n }\n\n for (let pick = i; pick < len; pick++) {\n swap(arr, pick, i)\n pHelper(i + 1, arr)\n swap(nums, pick, i)\n }\n }\n\n pHelper(0, nums)\n return result\n}", "title": "" }, { "docid": "0cebf33a3c9bc097f126e2803a5fff6d", "score": "0.56426305", "text": "function removeDuplicate(a) {\n\t\t var seen = {};\n\t\t var out = [];\n\t\t var len = a.length;\n\t\t var j = 0;\n\t\t for(var i = 0; i < len; i++) {\n\t\t var item = a[i];\n\t\t if(seen[item] !== 1) {\n\t\t seen[item] = 1;\n\t\t out[j++] = item;\n\t\t }\n\t\t }\n\t\t return out;\n\t\t}", "title": "" }, { "docid": "12c719e3e17f992756634d527033ad67", "score": "0.5626774", "text": "function dedup(array) {\n\n}", "title": "" }, { "docid": "12c719e3e17f992756634d527033ad67", "score": "0.5626774", "text": "function dedup(array) {\n\n}", "title": "" }, { "docid": "d477f14a730117f570da6c98b10a3a73", "score": "0.56211627", "text": "function duplicate(arr) {\n\tlet finalArr = [];\n\tlet countObj = arr.reduce((finalResult, currentItem) => {\n\t\t// if there's no property on finalResult of the key\n\t\t// then we set the key equal to 1; first time it has been seen\n\t\tif(!finalResult[currentItem]) finalResult[currentItem] = 1;\n\t\telse finalResult[currentItem] += 1;\n\t finalResult[currentItem] > 1 ? finalArr.push(currentItem) : null;\n\t\treturn finalResult;\n\t}, {})\n\n\treturn finalArr;\n}", "title": "" }, { "docid": "2324e2095939f816a6ae54ea5b4c27fe", "score": "0.5611137", "text": "function returnArrayWithoutDuplicates(a) {\r\n //console.log(a);\r\n return Array.from(new Set(a));\r\n }", "title": "" }, { "docid": "819705a4254ee2aa19dc642b60a88085", "score": "0.56059664", "text": "function removeDups(a) {\n let a1 = [];\n for(let i=0; i<a.length; i++) {\n if(a1.indexOf(a[i]) === -1)\n a1.push(a[i]);\n }\n return a1;\n}", "title": "" }, { "docid": "9a4a34b4deabf19045cd9238b3789e2b", "score": "0.55959874", "text": "function removeDuplicates4(arr) {\n return [...new Set(arr)];\n}", "title": "" }, { "docid": "49f988828fe5b14047d050f5e4e5ec0f", "score": "0.55905", "text": "function removeDups(arr) {\n\treturn [...new Set(arr)];\n}", "title": "" }, { "docid": "80bad2dae4a3be8ac04056fea5d116e3", "score": "0.55890125", "text": "function sameFlatMap(array, mapfn) {\n var result;\n if (array) {\n for (var i = 0; i < array.length; i++) {\n var item = array[i];\n var mapped = mapfn(item, i);\n if (result || item !== mapped || isArray(mapped)) {\n if (!result) {\n result = array.slice(0, i);\n }\n if (isArray(mapped)) {\n addRange(result, mapped);\n }\n else {\n result.push(mapped);\n }\n }\n }\n }\n return result || array;\n }", "title": "" }, { "docid": "8c780280992feb182b1e19eb944aaf50", "score": "0.55857056", "text": "function checkDuplicate(array) {\n let newArray = [];\n array.forEach(function(item) {\n if (!newArray.includes(item)) {\n newArray.push(item);\n }\n });\n return newArray;\n}", "title": "" }, { "docid": "8135610e4bdc5b6d7525018d8de643be", "score": "0.55753314", "text": "function repeat (inputArray) {\r\n\r\n let outputArray = [];\r\n\r\n for(i = 0; i <= 2; i++) {\r\n for (let j = 0; j < inputArray.length; j++ ) {\r\n outputArray.push(inputArray[j]);\r\n }\r\n }\r\n return outputArray;\r\n}", "title": "" }, { "docid": "e41c9b41b03512c9881b031a418fe542", "score": "0.5570346", "text": "function duplicateSandwich(a) {\n for (let i = 0, lim = a.length - 1, j; i < lim; i++) {\n j = a.indexOf(a[i], i + 1);\n if (j !== -1)\n return a.slice(i + 1, j);\n } \n}", "title": "" }, { "docid": "4c492c05715eea609b37d214eae2a420", "score": "0.5567036", "text": "function buyFruit(array) {\n return array.map(subArray => {\n return repeat(subArray[0], subArray[1]);\n })\n .reduce((acc, value) => acc.concat(value));\n}", "title": "" }, { "docid": "d22196459ac9d7e6bb09af4077e4efef", "score": "0.555115", "text": "function copy(a) {\n /*\n const l = a.length;\n const b = new Array(l);\n for (let i = 0; i < l; ++i) {\n b[i] = a[i];\n }\n */\n return [...a];\n}", "title": "" }, { "docid": "c812101052dde181c4795e2dd7e3373b", "score": "0.55416363", "text": "function quickCloneArray(input) {\n\t\treturn input.map(cloneValue);\n\t}", "title": "" }, { "docid": "79589a97ac9192a9fc7907c406c0d95d", "score": "0.5541227", "text": "function getUniqueValues(arrayOfNums) {\n const set = new Set(arrayOfNums);\n return [...set];\n}", "title": "" }, { "docid": "fa90e1e1c2a07b911e905101470305b3", "score": "0.5536836", "text": "function repeatArray(array, n) {\n if (n <= 0) return [];\n // Create an array of size \"n\" with undefined values\n var arrays = Array.apply(null, new Array(n));\n // Replace each \"undefined\" with our array, resulting in an array of n copies of our array\n arrays = arrays.map(function() {\n return array;\n });\n // Flatten our array of arrays\n //return [].concat.apply([], arrays);\n return arrays;\n}", "title": "" }, { "docid": "723da21f0ec778d7e7efff15f90da128", "score": "0.55320317", "text": "function distinct(a) {\n \n // p// always be an array, always number, will it alwats be whole number, positive, !empty array\n // r// return array of numbers, no dup\n // e// [,2,2,3,4] ... [1,2,3,4]\n // p//I'm gunna take a range of number given, and im look thru to see if dup values, remove dups and return only range\n return [...new Set(a)]\n \n \n }", "title": "" }, { "docid": "dc9bc420e8ea3535a508568691f0de83", "score": "0.5521053", "text": "function uniq(a) {\n return Array.from(new Set(a));\n}", "title": "" }, { "docid": "fc92af84ac85e9e98e423d014ed36f1a", "score": "0.55202043", "text": "function copyMachine(arr, num) {\r\n let newArr = [];\r\n while (num >= 1) {\r\n let obj = [...arr];\r\n newArr.push(obj)\r\n num--;\r\n }\r\n return newArr;\r\n}", "title": "" }, { "docid": "1b0ab2e5ea98ae925c76d9b1c5952583", "score": "0.55150545", "text": "function copy(a) {\n var l = a.length;\n var b = new Array(l);\n\n for (var i = 0; i < l; ++i) {\n b[i] = a[i];\n }\n\n return b;\n} // map :: (a -> b) -> [a] -> [b]", "title": "" }, { "docid": "d91f9334ea4a921b6b12dcce39abb8f8", "score": "0.5511162", "text": "function removeDuplicates(arr) {\n let visited = {};\n for (element of arr) {\n visited[element] = true;\n }\n return Object.keys(visited).map((x) => parseInt(x));\n}", "title": "" }, { "docid": "d0199c5f1e97901827e8d68c26b4a4f9", "score": "0.549986", "text": "function uniteUnique(arr) {\n\tvar args = [...arguments];\n\tlet newArr =[];\n\tfor(let index in args){\n\t let currArr = args[index];\n\t currArr.filter( item =>{\n\t if (newArr.indexOf(item)==-1){\n\t newArr.push(item);\n\t }\n\t });\n\t}\n\treturn newArr;\n}", "title": "" }, { "docid": "4299e80d1eb68107b499f014b9d15e8d", "score": "0.54919934", "text": "function Duplicate(){}", "title": "" }, { "docid": "12236522da04477b44998e084280c44e", "score": "0.5487162", "text": "function once(array){\n arr2 = [];\n for (var i = 0; i < array.length; i++){\n if (array[i] != array[i+1] && array[i] != array[i-1]){\n arr2.push(array[i])\n } \n }\n return arr2;\n \n }", "title": "" }, { "docid": "234e0f82109d55bd9099f0534470b3b7", "score": "0.547462", "text": "function repS(a) {\n\tvar res = [];\n\tvar i = 1;\n\twhile (i<a.length) {\n\t\tres[i] = a[i].repeat(i);\n\t\ti++;\n\t}\n\treturn res;\n}", "title": "" }, { "docid": "0275fe347a96fdf310bd707ff6d082e1", "score": "0.5473703", "text": "function perm(xs){\n function ins(a, ys){\n function helper(left, right, res){\n if(is_empty_list(right)){\n return pair(append(left, list(a)), res);\n } else {\n return helper(append(left, list(head(right))), tail(right), pair(append(left, append(list(a), right)), res));\n }\n }\n return helper([], ys, []);\n }\n return is_empty_list(xs)\n ? list([])\n : accumulate(append, [], map(x=>ins(head(xs), x), perm(tail(xs))));\n}", "title": "" }, { "docid": "3d4ea5d5f1f7c7c81a180c9ae7235034", "score": "0.5464732", "text": "function double (result, item){\n return [...result, item, item];\n}", "title": "" }, { "docid": "f6d3ca51bdac5a595bf43a8a49129ff8", "score": "0.5461857", "text": "function printFirstRepeating2(arr){\n let n = arr.length, i;\n let map = new Map();\n for(i=0; i<n; i++){\n if(map.has(arr[i])){\n map.set(arr[i], map.get(arr[i]) + 1);\n }else{\n map.set(arr[i], 1);\n }\n }\n for(i=0; i<n; i++){\n if(map.get(arr[i]) > 1){\n console.log(\"1st element duplicate is:\", arr[i]);\n return;\n }\n }\n console.log(\"no duplicates\");\n}", "title": "" }, { "docid": "7b11022f1ec260c2fef0a4193d0d9f55", "score": "0.54589325", "text": "function deepDup(arr){\n let ret = [];\n for(let i = 0; i < arr.length; i++) {\n if (arr[i] instanceof Array) {\n ret.push(deepDup(arr[i]));\n } else {\n ret.push(arr[i]);\n }\n }\n return ret;\n}", "title": "" }, { "docid": "743853f8c8f9586238d45c0291a9dc3c", "score": "0.5456935", "text": "function map$1(f, xs) {\n return reverse$1(fold(function (acc, x) {\n return new List(f(x), acc);\n }, new List(), xs));\n}", "title": "" }, { "docid": "5ee60b15d78faa121e5107da34a2356a", "score": "0.54565364", "text": "function dup(x) {\n var i;\n buff = new Array(x.length);\n copy_(buff, x);\n return buff;\n}", "title": "" }, { "docid": "fbb6a14632248f78b7a2baed439a04dc", "score": "0.5451939", "text": "function remove_duplicates_2(arr) {\n let lndv = 0; // Last Non Duplicate value\n\n if( arr.length === 0 ) return [];\n \n for(let i = 1; i < arr.length; i++) {\n if( arr[lndv] !== arr[i] ) {\n arr[lndv+1] = arr[i]\n lndv++;\n }\n }\n\n arr.length = lndv + 1;\n\n return arr;\n}", "title": "" }, { "docid": "3ee08b94f519b30dabf3b5873d569aae", "score": "0.54493874", "text": "function addOneToEachNumber_map(x) {\n if (x === null) {\n return null\n }\n else {\n let arr = [...x]\n\n return arr.map(x => x + 1)\n }\n}", "title": "" }, { "docid": "e81b47169a0bb0caac956a09bf848da8", "score": "0.54490674", "text": "function uniteUnique(arr) {\n\n let arrAll = [].concat(...arguments);\n let unique = new Set(arrAll);\n return [...unique];\n }", "title": "" }, { "docid": "df06019c72c98fbd96aa6b2073706202", "score": "0.5446031", "text": "function sameMap(array, f) {\n var result;\n if (array) {\n for (var i = 0; i < array.length; i++) {\n if (result) {\n result.push(f(array[i], i));\n }\n else {\n var item = array[i];\n var mapped = f(item, i);\n if (item !== mapped) {\n result = array.slice(0, i);\n result.push(mapped);\n }\n }\n }\n }\n return result || array;\n }", "title": "" }, { "docid": "b70957d868c95ba840bbe509d0128dbf", "score": "0.54440546", "text": "function removeDuplicates(inputArray) {\n const results = [];\n inputArray.map((num) => {\n if (!results.includes(num)) {\n results.push(num)\n }\n })\n return results;\n}", "title": "" }, { "docid": "fb8ad927c704da080db1cf3109bd1077", "score": "0.54427123", "text": "function uniteUnique(...arr) {\n return arr.reduce((accum, next) => {\n next.forEach(i => {\n if (!accum.includes(i)) {\n accum.push(i);\n }\n });\n return accum;\n });\n}", "title": "" }, { "docid": "fadbef9f0d400e84c908693d2ff17e90", "score": "0.54409224", "text": "function repeatValue(value, n, arr) {\n for (let i = 0; i < n - 1; i++) {\n arr.push(value);\n }\n\n return arr;\n}", "title": "" }, { "docid": "db38335f45c416a6e23ee24d998e6d41", "score": "0.5438059", "text": "function arrayUnique(a) {\n var seen = {}, out = [], len = a.length, j = 0, i, item;\n \n for(i = 0; i < len; i++) {\n item = a[i];\n if(seen[item] !== 1) {\n seen[item] = 1;\n out[j++] = item;\n }\n }\n return out;\n}", "title": "" }, { "docid": "9575aea2b53316613bbcf8540c0857a3", "score": "0.54378", "text": "function permute (nums) {\n var result = [];\n if (nums.length === 1) {\n result.push(nums);\n return result;\n }\n\n //递归公式\n var index = nums.pop(),\n next = permute(nums);\n\n for (var i = 0; i < next.length; i++) {\n for (var j = 0; j <= next[i].length; j++) {\n var temp = Object.assign([],next[i]);\n temp.splice(j,0,index);\n result.push(temp);\n }\n }\n return result;\n}", "title": "" }, { "docid": "e1358da63e7eb04ff9e1537b04270ab5", "score": "0.54353404", "text": "function uniteUnique(...uniqueArray) {\n// spreads ([1], [2,[1,0]], [3, 2,[1,0]]) to ([1], [2,1,0], [3,2,1,0])\n console.log(\"uniqueArray: \" + uniqueArray);\n \n // .reduce() with .concat() ([1], [2,1,0], [3,2,1,0]) to ([1], [2,1,0], [3,2,1,0])\n return uniqueArray.reduce(function(accumulator,currentValue){\n //\n return accumulator.concat(currentValue).filter(function(element,index,array){\n console.log(\"element: \" + element + \", index: \" + index + \", array: \" +array);\n \n \n // return the element only if it exists at its own index position\n return index == array.indexOf(element);\n \n });\n });\n }", "title": "" }, { "docid": "c1ae8f3bc4f64c4238fc1001b6ef3560", "score": "0.54347503", "text": "function repeat(n) {\n eq (arguments.length, repeat.length);\n return function repeat$1(x) {\n eq (arguments.length, repeat$1.length);\n var result = [];\n for (var m = 0; m < n; m += 1) result.push (x);\n return result;\n };\n}", "title": "" }, { "docid": "7c1ad788e51357cf83b2a5a0966ee6bb", "score": "0.543243", "text": "function returnTwice(arr) {\n\tvar arrnew=[];\n\tfor (var i = 0; i <arr.length; i++) {\n\tarrnew.push(arr[i]);\n\tarrnew.push(arr[i]);\n\t}\n\tconsole.log(arrnew);\n}", "title": "" }, { "docid": "ad9d1e1930bbc5fecbb193c6e9638c53", "score": "0.5430672", "text": "function dedup(array) {\n let dedArray = [];\n for (let i = 0; i < array.length; i++ ) {\n //take a number 0\n if (array[i] === array[i + 1] || array[i] === array[i +2]) {\n continue;\n } else {\n dedArray.push(array[i]);\n }\n }\n return dedArray;\n}", "title": "" }, { "docid": "d773b1fa2a25efc64c3600daf5902de4", "score": "0.543037", "text": "function unique2(array) {\n return array.reduce(function(uniqueArray, currentElement) {\n if(uniqueArray.length === 0) {\n uniqueArray.push(currentElement)\n }\n var isCurrValueExist = uniqueArray.includes(currentElement)\n if(!isCurrValueExist) {\n uniqueArray.push(currentElement)\n }\n return uniqueArray\n }, [])\n}", "title": "" }, { "docid": "c105723463b60eb234366de7d5617905", "score": "0.54297507", "text": "function integers_from(n) {\n return pair(n,\n () => integers_from(n + 1));\n}", "title": "" }, { "docid": "18bb73882c8bc6c92ccb83df90359886", "score": "0.54287595", "text": "function unite(arr) {\n return myArmy.concat(arr);\n}", "title": "" }, { "docid": "c8b1dbc55058bc5c7bcb28d251b9cfaa", "score": "0.54282194", "text": "function uniteUnique(...arr) {\n const flatArray = [].concat(...arr)\n return [...new Set(flatArray)];\n}", "title": "" }, { "docid": "086d5aad41b8cae39f47fbfb8ab88b31", "score": "0.54273504", "text": "static uniq(input) {\n return input.filter((val, index, arr) => { return arr.indexOf(val) === index; });\n }", "title": "" }, { "docid": "39e7be0390125c8c4c71831c75b91914", "score": "0.5424694", "text": "function uniq(a) {\n var seen = {};\n var out = [];\n var len = a.length;\n var j = 0;\n for (var i = 0; i < len; i++) {\n var item = a[i];\n if (seen[item] !== 1) {\n seen[item] = 1;\n out[j++] = item;\n }\n }\n return out;\n}", "title": "" }, { "docid": "d84e8f2d2a8cdf4945733bd80f341022", "score": "0.54156315", "text": "function dedup(array) {\n // use new Set method to remove all duplicates from array\n let noDuplArr = [...new Set(array)]; \n // return output array\n return noDuplArr;\n}", "title": "" }, { "docid": "c96e919b3a61d370527bddeeb1c76d9b", "score": "0.54148954", "text": "function dup(x) {\r\n var i;\r\n var buff=new Array(x.length);\r\n copy_(buff,x);\r\n return buff;\r\n }", "title": "" }, { "docid": "a84f30cc462186df2c028bf1ce5cbeaf", "score": "0.54131585", "text": "function removeDuplicates(input) {\n return input.filter((element, index, array) => {\n if (array.indexOf(element) === index) return element;\n });\n}", "title": "" }, { "docid": "d599e2b326d32dfb4f86228758bf5d51", "score": "0.5412722", "text": "function map$1(f, xs) {\n return reverse$1(fold(function (acc, x) { return new List(f(x), acc); }, new List(), xs));\n}", "title": "" }, { "docid": "2bbf5c0de12edce0189264f8b3a0dbaa", "score": "0.54064476", "text": "function uniq(a) {\n var seen = {};\n return a.filter(function(item) {\n return seen.hasOwnProperty(item) ? false : (seen[item] = true);\n });\n}", "title": "" }, { "docid": "f3fb28f25f075dd117c5b4c9d0e4fd73", "score": "0.54055333", "text": "function deletedRepeated(items)\n{\n\treturn [... new Set(items)];\n}", "title": "" }, { "docid": "81691be1d005c62910b1671c52f87186", "score": "0.5405031", "text": "function removeDuplicates(num) {\r\n let x;\r\n const len=num.length;\r\n const out=[];\r\n const obj={};\r\n \r\n for (x=0; x<len; x++) {\r\n obj[num[x]]=0;\r\n }\r\n for (x in obj) {\r\n out.push(x);\r\n }\r\n return out;\r\n }", "title": "" }, { "docid": "5ee8338236d7b10d5f37319f461c989b", "score": "0.5403627", "text": "function deepDup(arr) {\n let duped = [];\n\n for (let i = 0; i < arr.length; i++) {\n let ele = arr[i];\n\n if (Array.isArray(ele)) {\n duped.push(deepDup(ele));\n } else {\n duped.push(ele);\n }\n }\n\n return duped;\n}", "title": "" }, { "docid": "61e6d9526408366b6449fb6c5ac9950d", "score": "0.5402421", "text": "function removeDuplicateIntegers(input) {\n}", "title": "" }, { "docid": "2bdf5d6904471495a891052eeee53b7c", "score": "0.5399924", "text": "function uniteUnique() {\n var concatArr = [];\n var i = 0;\n while (arguments[i]){\n concatArr = concatArr.concat(arguments[i]); i++;\n }\n var uniqueArray = concatArr.filter(function(item, pos) {\n return concatArr.indexOf(item) == pos;\n });\n return uniqueArray;\n}", "title": "" } ]
80b717f03bd5a774e1c9aa7e9c58e4fa
gets the right hand edge
[ { "docid": "378e837df1ade27fcf878e2447033334", "score": "0.8013164", "text": "function rightEdge(obj){\n\tvar rightEdge\n\ttry {\n\t\trightEdge = obj.position.x + (obj.extents.max.x + obj.offset.x)*obj.scale.x;\n\t} \n\tcatch (err) {\n\t\trightEdge = obj.position.x + (obj.offset.x * obj.scale.x);\n\t}\n\treturn rightEdge;\n}", "title": "" } ]
[ { "docid": "1d5f823a0177fba290da6d2ffdef16c4", "score": "0.7721134", "text": "get right() {\n\t\treturn this.origin.x + this.size.width\n\t}", "title": "" }, { "docid": "ab1517402de85831f3d69222bc92f5e2", "score": "0.75793314", "text": "getRight() {\n return this.x + this.getWidth() / 2;\n }", "title": "" }, { "docid": "72e9de0d9d09341bf533b9fc6df5b8ea", "score": "0.7552363", "text": "get right() {\r\n return this.x + this.width;\r\n }", "title": "" }, { "docid": "25fd34190c0a0737edf17386e4c5ba88", "score": "0.74598414", "text": "right() {\n return this.native.right();\n }", "title": "" }, { "docid": "3e687df08963a9b7bf68f894ef0852b8", "score": "0.73701817", "text": "static right() {\n\n // Return a Direction pointing towards the right\n return new Direction([1, 0, 0]);\n }", "title": "" }, { "docid": "23a52285aed872d929a2f599470e1319", "score": "0.7285282", "text": "getRightClosed() {\n return this._rightClosed || this._right;\n }", "title": "" }, { "docid": "1332919d302483d4d719b14af01ede41", "score": "0.72742355", "text": "getRight() {\n if (Direction_1.Direction.isRight(this.anchor)) {\n return this.position.x;\n }\n else if (Direction_1.Direction.isLeft(this.anchor)) {\n return this.position.x + this.size.width;\n }\n else {\n return this.position.x + this.size.width / 2;\n }\n }", "title": "" }, { "docid": "a3e2bd01a870083075b4c701f6c07ea8", "score": "0.7263307", "text": "function fromRight(e){\n return e.Right;\n}", "title": "" }, { "docid": "8c0d960603cdc2cc5426c8a17b43d533", "score": "0.7244345", "text": "function getRightEdge(index, cell) {\n return {\n index: index,\n x: editor.dom.getPos(cell).x + cell.offsetWidth\n };\n }", "title": "" }, { "docid": "e1c0476431c4817ecb4072a6289e1472", "score": "0.7240904", "text": "get right() { return this.x + this.width; }", "title": "" }, { "docid": "13c2e74f14bbc74f3bae68a4be24edec", "score": "0.72288406", "text": "get right() {\n return this._right\n }", "title": "" }, { "docid": "b0f015d6406f73b6532cbb35c993b57e", "score": "0.7096116", "text": "get right() {\n return new Vec2(-this.y, this.x);\n }", "title": "" }, { "docid": "db044bb3c83545e71dc71e93dbd91afc", "score": "0.70895046", "text": "getRightOpen() {\n return this._rightOpen || this._right;\n }", "title": "" }, { "docid": "0bc6dcd1c6e08538969a48f2be617a0b", "score": "0.7038243", "text": "static get right() {}", "title": "" }, { "docid": "a0e3512ba864cd330a99d17198f59146", "score": "0.6853203", "text": "get right(){ return this.ui.right; }", "title": "" }, { "docid": "7425cca346ced6b3aff9dcf1726d9f42", "score": "0.6774292", "text": "get rightOption() {\n const { right, root } = this;\n return right.length ? right[right.length - 1].values[1]: root.values[1];\n }", "title": "" }, { "docid": "6dfeefc1a80f9d2319c34e008521edb5", "score": "0.67675275", "text": "leftEdge() {\n return this.x - this.radius;\n }", "title": "" }, { "docid": "7a50e861c6983e5eeba42cb81e282634", "score": "0.6712833", "text": "get LandscapeRight() {}", "title": "" }, { "docid": "c96584a6da198574623238f4c0ebb7b2", "score": "0.67059916", "text": "function right(y) {\n return { kind: 'right', value: y };\n}", "title": "" }, { "docid": "8f7bf63c752c6de6ca0b57a8e9e67061", "score": "0.6640033", "text": "getRight(spot) {\r\n return 2*spot+1;\r\n }", "title": "" }, { "docid": "aec50d3a7a25178b80f2dbc560f9594f", "score": "0.66147333", "text": "getTieRightX() {\n let tieStartX = this.getAbsoluteX();\n tieStartX += this.getGlyphWidth() + this.x_shift + this.extraRightPx;\n if (this.modifierContext) tieStartX += this.modifierContext.getExtraRightPx();\n return tieStartX;\n }", "title": "" }, { "docid": "49a2d3a909acb7710d3f28c8c3cb74c2", "score": "0.6569415", "text": "function right(node, n) {\n return n - 1 - node.height;\n}", "title": "" }, { "docid": "2209ff35b7ead3d2f0ca8c0310395f9e", "score": "0.64277035", "text": "get right()\n {\n return (-this.x / this.scale.x) + this.worldScreenWidth;\n }", "title": "" }, { "docid": "4c4bf5440767570448eee675322930ba", "score": "0.63913214", "text": "rightRightCase(node) {\n return this.rotateLeft(node);\n }", "title": "" }, { "docid": "dda43bc6ccb40a2f0f1e2f47bfc83e8d", "score": "0.63750994", "text": "function topRight( r )\t\t{ return [r[0] + r[2], r[1]]; }", "title": "" }, { "docid": "33620b279f8a7e830453cc2d7786752d", "score": "0.6354786", "text": "static get Side () {\n return Object.freeze({\n LEFT: 1,\n ABOVE: 0,\n RIGHT: -1\n })\n }", "title": "" }, { "docid": "93bf1bcde7f6d7f18584bc9265e63d2d", "score": "0.6316686", "text": "get focusRight(){ return this.ui.focusRight; }", "title": "" }, { "docid": "6ad43a34225f0c0f8b1dd03c33a71755", "score": "0.6310301", "text": "getSide() { return 0; }", "title": "" }, { "docid": "6ad43a34225f0c0f8b1dd03c33a71755", "score": "0.6310301", "text": "getSide() { return 0; }", "title": "" }, { "docid": "a953397a685ed8d1049e6043899c14c9", "score": "0.6273901", "text": "get rightToLeft() {\n\t\treturn this.nativeElement ? this.nativeElement.rightToLeft : undefined;\n\t}", "title": "" }, { "docid": "a953397a685ed8d1049e6043899c14c9", "score": "0.6273901", "text": "get rightToLeft() {\n\t\treturn this.nativeElement ? this.nativeElement.rightToLeft : undefined;\n\t}", "title": "" }, { "docid": "a953397a685ed8d1049e6043899c14c9", "score": "0.6273901", "text": "get rightToLeft() {\n\t\treturn this.nativeElement ? this.nativeElement.rightToLeft : undefined;\n\t}", "title": "" }, { "docid": "66cd7ee10ab6a771f0593e6eb1c7f0d5", "score": "0.6259139", "text": "function findRightMostNode(current_node){\n\t\twhile(current_node.getChild(\"R\") != null){\n\t\t\tcurrent_node = current_node.getChild(\"R\");\n\t\t}\n\n\t\treturn current_node;\n\t}", "title": "" }, { "docid": "c8990b1aff75fece502c37c526365f3b", "score": "0.6249322", "text": "function shiftRight() {\n\t// if there a place from right\n\tif(checkRight() === true) {\n\t\t// take current figure\n\t\tlet figureCells = selectFigure();\n\t\t// for each cell of the figure\n\t\tfigure.nums.forEach((num,i,arr) => {\n\t\t\t// increse index\n\t\t\tarr[i] = num + 1;\n\t\t\t// move to the right\n\t\t\tfigureCells[i].style.left = board[num].x + cellSize + 'px';\n\t\t});\n\t}\n}", "title": "" }, { "docid": "7f7bb8692567a622acfa847c3a5a5902", "score": "0.6235415", "text": "function arrow_right_kind(arrow) {\n switch (String(arrow)) {\n case '<-':\n case '←':\n case '<=':\n case '⇐':\n case '<~':\n case '↚':\n return 'none';\n case '->':\n case '→':\n case '<->':\n case '↔':\n case '<=->':\n case '⇐→':\n case '<~->':\n case '↚→':\n return 'legal';\n case '=>':\n case '⇒':\n case '<=>':\n case '⇔':\n case '<-=>':\n case '←⇒':\n case '<~=>':\n case '↚⇒':\n return 'main';\n case '~>':\n case '↛':\n case '<~>':\n case '↮':\n case '<-~>':\n case '←↛':\n case '<=~>':\n case '⇐↛':\n return 'forced';\n default:\n throw new Error(\"arrow_direction: unknown arrow type \" + arrow);\n }\n }", "title": "" }, { "docid": "6aee3dcf0ab18d64e6ca7b21ea6d6342", "score": "0.6180395", "text": "function nextRight(v) {\n\t var children = v.children;\n\t return children ? children[children.length - 1] : v.t;\n\t }", "title": "" }, { "docid": "6aee3dcf0ab18d64e6ca7b21ea6d6342", "score": "0.6180395", "text": "function nextRight(v) {\n\t var children = v.children;\n\t return children ? children[children.length - 1] : v.t;\n\t }", "title": "" }, { "docid": "6aee3dcf0ab18d64e6ca7b21ea6d6342", "score": "0.6180395", "text": "function nextRight(v) {\n\t var children = v.children;\n\t return children ? children[children.length - 1] : v.t;\n\t }", "title": "" }, { "docid": "703cdc6813f86ede01999260a764e1ec", "score": "0.6175315", "text": "RIGHT() {\n if (this.uninitialized)\n return;\n this.D = util_1.DirectionUtil.TurnRight(this.D);\n }", "title": "" }, { "docid": "4956aeaea84e781e1b07a1430235bece", "score": "0.6174582", "text": "function selectRightBrother()\n {\n if (Main.selectedElement === null) return;\n\n const plumbInstance = Main.getPlumbInstanceByNodeID(Main.selectedElement);\n\n const connections = plumbInstance.getConnections(\n {\n target: Main.selectedElement\n });\n let closestNode;\n let left = Infinity;\n const leftCurrent = $(\"#\" + Main.selectedElement).offset().left;\n connections.forEach(function(connection)\n {\n const sourceConnections = plumbInstance.getConnections(\n {\n source: connection.sourceId\n });\n sourceConnections.forEach(function(sourceConnection)\n {\n const nodeLookedAt = sourceConnection.targetId;\n const leftLookedAt = $(\"#\" + nodeLookedAt).offset().left;\n\n if (nodeLookedAt != Main.selectedElement &&\n leftLookedAt > leftCurrent &&\n left > leftLookedAt)\n {\n closestNode = nodeLookedAt;\n left = leftLookedAt;\n }\n });\n });\n if (left !== Infinity)\n {\n Main.selectElement(closestNode);\n }\n }", "title": "" }, { "docid": "c675dae6013c7505e8016130e7e1be0c", "score": "0.61717343", "text": "getLeftClosed() {\n return this._leftClosed || this._left;\n }", "title": "" }, { "docid": "f9f368477d46bc1a92fa90b2cb62ddef", "score": "0.61678857", "text": "get anchorRight(){ return this.ui.anchorRight; }", "title": "" }, { "docid": "acddd228146ac61c084788381ceb61a9", "score": "0.6149175", "text": "function toRight(){\n}", "title": "" }, { "docid": "7f874f6b410d992e374e4bde26a7ee1c", "score": "0.61273235", "text": "function ELEMENT_RIGHT$static_(){CommentMetaDataPanel.ELEMENT_RIGHT=( CommentMetaDataPanel.BLOCK.createElement(\"right\"));}", "title": "" }, { "docid": "92f56612df1ddf9779f07e1a2736904b", "score": "0.6125399", "text": "getSide() {\n return numberToSide(this.getByte(2));\n }", "title": "" }, { "docid": "09b60ff04a5aff1036ab47879cf6b406", "score": "0.61250496", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n }", "title": "" }, { "docid": "d99ff5855a588213ed6d42c3fce1f888", "score": "0.61245626", "text": "setRight(x) {\n return this.native.setRight(x);\n }", "title": "" }, { "docid": "35cc4585083f6d645edec3c054699f53", "score": "0.61244357", "text": "right(i) { return (2 * i + 2); }", "title": "" }, { "docid": "34f5c78bd411c5da42c3b89b7b136040", "score": "0.61242294", "text": "get padRight(){ return this.__pad[ 1 ]; }", "title": "" }, { "docid": "0758524b9e1c8b885b9d14ed9c0e5aaf", "score": "0.6121713", "text": "function getRightDirection(direction) {\n\tswitch (direction) {\n\t\tcase NORTH:\treturn EAST;\n\t\tcase SOUTH: return WEST;\n\t\tcase WEST:\treturn NORTH;\n\t\tcase EAST:\treturn SOUTH;\n\t\tdefault:\treturn NONE;\n\t}\n}", "title": "" }, { "docid": "cb014092464b6d170d46a550c1a0919f", "score": "0.6100685", "text": "static get left() {}", "title": "" }, { "docid": "89ab8ea3aa1e478fdc5c9d4120d2bb90", "score": "0.6099357", "text": "static set right(value) {}", "title": "" }, { "docid": "5ee9fcb2701595cf656c6540e1a751db", "score": "0.60749924", "text": "function nextRight(v) {\n\t var children = v.children;\n\t return children ? children[children.length - 1] : v.t;\n\t}", "title": "" }, { "docid": "5ee9fcb2701595cf656c6540e1a751db", "score": "0.60749924", "text": "function nextRight(v) {\n\t var children = v.children;\n\t return children ? children[children.length - 1] : v.t;\n\t}", "title": "" }, { "docid": "5ee9fcb2701595cf656c6540e1a751db", "score": "0.60749924", "text": "function nextRight(v) {\n\t var children = v.children;\n\t return children ? children[children.length - 1] : v.t;\n\t}", "title": "" }, { "docid": "5ee9fcb2701595cf656c6540e1a751db", "score": "0.60749924", "text": "function nextRight(v) {\n\t var children = v.children;\n\t return children ? children[children.length - 1] : v.t;\n\t}", "title": "" }, { "docid": "5ee9fcb2701595cf656c6540e1a751db", "score": "0.60749924", "text": "function nextRight(v) {\n\t var children = v.children;\n\t return children ? children[children.length - 1] : v.t;\n\t}", "title": "" }, { "docid": "023adcca46bc1a61dc457f3c7366762e", "score": "0.60623187", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n }", "title": "" }, { "docid": "023adcca46bc1a61dc457f3c7366762e", "score": "0.60623187", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n }", "title": "" }, { "docid": "023adcca46bc1a61dc457f3c7366762e", "score": "0.60623187", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n }", "title": "" }, { "docid": "023adcca46bc1a61dc457f3c7366762e", "score": "0.60623187", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n }", "title": "" }, { "docid": "b145a70f687f3119fa9b433ce8775fc9", "score": "0.60543346", "text": "function nextRight(node) {\n var children = node.children;\n return children.length && node.isExpand ? children[children.length - 1] : node.hierNode.thread;\n}", "title": "" }, { "docid": "8f7be792e639ae3e062f08ef161751af", "score": "0.6036883", "text": "function getRight() {\n var $i = $index + 1;\n\n return hasSlide($i) ? getSlide($i) : getFirst();\n }", "title": "" }, { "docid": "ea0ce2208ef020f7a345b5af43853e26", "score": "0.60310596", "text": "rightLeftCase(node) {\n if (!node.right) {\n throw new Error(\"rightLeftCase: right child not set\");\n }\n node.right = this.rotateRight(this.nodes[node.right]).id;\n return this.rotateLeft(node);\n }", "title": "" }, { "docid": "05ce764c97802d5107c4eaadb4a23624", "score": "0.6030429", "text": "function right() {\r\n\tif (state.dir !== undefined && state.dir !== null && state.dir !== '') {\r\n\t\tswitch (state.dir) {\r\n\t\t\tcase 'NORTH': {\r\n\t\t\t\tstate.dir = 'EAST';\r\n\t\t\t\tconsole.log(\"Robot is now facing \" + state.dir);\r\n\t\t\t\treturn state.dir;\r\n\t\t\t}\r\n\t\t\tcase 'EAST': {\r\n\t\t\t\tstate.dir = 'SOUTH';\r\n\t\t\t\tconsole.log(\"Robot is now facing \" + state.dir);\r\n\t\t\t\treturn state.dir;\r\n\t\t\t}\r\n\t\t\tcase 'SOUTH': {\r\n\t\t\t\tstate.dir = 'WEST';\r\n\t\t\t\tconsole.log(\"Robot is now facing \" + state.dir);\r\n\t\t\t\treturn state.dir;\r\n\t\t\t}\r\n\t\t\tcase 'WEST': {\r\n\t\t\t\tstate.dir = 'NORTH';\r\n\t\t\t\tconsole.log(\"Robot is now facing \" + state.dir);\r\n\t\t\t\treturn state.dir;\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tconsole.log(\"The robot has not been placed on the table yet.\")\r\n\t}\r\n}", "title": "" }, { "docid": "58a784363f18023adb1936c8edd156df", "score": "0.6027449", "text": "function rightChildIndex(nodeIndex) {\n return (2 * nodeIndex) + 2;\n }", "title": "" }, { "docid": "1098ef4767518b436de3a682813496c8", "score": "0.60170263", "text": "get paddingRight() {\n return this.i.ew;\n }", "title": "" }, { "docid": "4cee675d09da9b7f9de561fd1c8b35a3", "score": "0.6016914", "text": "rightView() {\r\n if (!this.root) return null;\r\n let queue = [];\r\n let result = [];\r\n if (this.root) queue.push(this.root);\r\n while (queue.length > 0) {\r\n let temp = [];\r\n let len = queue.length;\r\n for (let i = 1; i <= len; i++) {\r\n let node = queue.shift();\r\n if (i === len) temp.push(node.data);\r\n if (node.left) queue.push(node.left);\r\n if (node.right) queue.push(node.right);\r\n }\r\n result.push(temp);\r\n }\r\n return result;\r\n }", "title": "" }, { "docid": "192d1ed195479777fd7bcd29aebc24c8", "score": "0.60145944", "text": "get horizontal() {\n return this._left + this._right\n }", "title": "" }, { "docid": "64e6b171848adcea4335c04cbdb7ef00", "score": "0.60125846", "text": "bottomRight() {\n return new QPointF_1.QPointF(this.native.bottomRight());\n }", "title": "" }, { "docid": "bae4624d86e10ef4c6303d4708caa4b2", "score": "0.6009638", "text": "function nextRight(v) {\r\n var children = v.children;\r\n return children ? children[children.length - 1] : v.t;\r\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" }, { "docid": "8627a931c35d7620cb97a6057ed2d429", "score": "0.59769183", "text": "function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}", "title": "" } ]
f16f30303c0c84df775d1a261014ad36
(public) this mod a
[ { "docid": "a9209294f8d319646201ba67e7d046d5", "score": "0.0", "text": "function bnMod(a) {\n var r = nbi();\n this.abs().divRemTo(a,null,r);\n if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r);\n return r;\n}", "title": "" } ]
[ { "docid": "5584602e264922db2b7010ea9997160a", "score": "0.7252235", "text": "get a() {\r\n\t\treturn this._a_\r\n\t}", "title": "" }, { "docid": "d0e09c5cb217bb19d492c329a624ff6d", "score": "0.71102196", "text": "get a() {\n\t\treturn this._a_;\n\t}", "title": "" }, { "docid": "4b39491c463f8171eb8346787fe98a17", "score": "0.6954185", "text": "get a() {\n return this._a_;\n }", "title": "" }, { "docid": "d42f66f04df35ef5ac411a70bb8a80ab", "score": "0.6807274", "text": "get a() {\n return this._a_;\n }", "title": "" }, { "docid": "c689c9723b66cd6ba2c89be262ef6965", "score": "0.6772047", "text": "get a() {\n /* Use \"this\" to make sure its bound to this object rather \n than a global variable (of course if you call it the right way\n and don't mess with it). */\n return this._a;\n }", "title": "" }, { "docid": "fa99a6ae686a3d44968d53b27dcda572", "score": "0.6626288", "text": "set a(val) {this._a = val}", "title": "" }, { "docid": "2bb15a065411e33260326c5b28ee2e68", "score": "0.6568525", "text": "get a(){\n return this._a_;\n }", "title": "" }, { "docid": "8229886ddb569efcf313124c645c2ee9", "score": "0.6493823", "text": "function $a(a,b){m.call(this,a.g);this.d=a;this.c=b;this.e=a.e;this.a=a.a;if(1==this.c.length){var c=this.c[0];c.m||c.c!=ab||(c=c.j,\"*\"!=c.c()&&(this.b={name:c.c(),l:null}))}}", "title": "" }, { "docid": "392dc9244a9a72a0bbdeba9bc998a9a2", "score": "0.6407613", "text": "set a(val){\n\t\tthis._a_ = val ;\n\t}", "title": "" }, { "docid": "2c1b4902653712192d41decb66478de2", "score": "0.6398882", "text": "function M(){this.a={}}", "title": "" }, { "docid": "78a96b85d3922c8f38b185e2f999e5ae", "score": "0.6303823", "text": "function md(a){this.pb=a.id;this.group=B.i.Hi;this.Rb=!1}", "title": "" }, { "docid": "9b1ae55d9d16da4213daf506049d500f", "score": "0.6279079", "text": "set a(val) {\r\n\t\tthis._a_ = val * 2\r\n\t}", "title": "" }, { "docid": "1f5cee655f0ec95bc51dd84ee173060a", "score": "0.6267377", "text": "function m(a){this.g=a;this.a=this.e=!1;this.b=null}", "title": "" }, { "docid": "c0bca4c37de85ed18e7559013a3e90d9", "score": "0.6253435", "text": "function asgards(a){\n this.a = a;\n}", "title": "" }, { "docid": "5a8e130ee9f284bebff3d82c3a92b475", "score": "0.62241524", "text": "set a(val){\n this._a_ = val*2;\n }", "title": "" }, { "docid": "b135193b8147947ba98252c3bec4f410", "score": "0.6221956", "text": "function re(a){this.o=a}", "title": "" }, { "docid": "381cd22cf9f71643b29b414d0e5e3da3", "score": "0.6213713", "text": "function Ag(a) {\n this.m = a\n}", "title": "" }, { "docid": "f875716acb8a56cef470f5c3faabbab7", "score": "0.61737627", "text": "set a(val) {\n\t\tthis._a_ = val * 2;\n\t}", "title": "" }, { "docid": "8ae11803ba6269935c32ac695d4845c1", "score": "0.6171505", "text": "function A(){this.a={}}", "title": "" }, { "docid": "b5653e35854443f7ff73161165f8384d", "score": "0.6149485", "text": "function eg(a){this.m=a}", "title": "" }, { "docid": "75d499672d4d50ee49fe02830f5bb9db", "score": "0.6114774", "text": "set a(val) {\n this._a_ = val * 2;\n }", "title": "" }, { "docid": "7d89850e45064b3b51d06e10ff2cfcb7", "score": "0.61110324", "text": "get a() {\n if (this._a) {\n return this._a\n } else {\n return 2\n }\n }", "title": "" }, { "docid": "4cc65831fa175e6cbf04d9d4c82a48a8", "score": "0.60599756", "text": "function Za(a){m.call(this,4);this.c=a;Xa(this,Aa(this.c,function(a){return a.e}));Ya(this,Aa(this.c,function(a){return a.a}))}", "title": "" }, { "docid": "afa624afcc99c499e978d4589fb28e09", "score": "0.60440207", "text": "function An(a,b){this.HB=[];this.h9a=a;this.IWa=b||null;this.D$=this.xYa=!1;this.tj=void 0;this.ZJa=this.qLb=this.uxa=!1;this.gra=0;this.Vg=null;this.Sha=0}", "title": "" }, { "docid": "fbd35e248cea3cd7a8eaa92940f7245c", "score": "0.6043945", "text": "function Ai(a){Ai.s.constructor.call(this,a);Uh(this)}", "title": "" }, { "docid": "4e09c4e6a50c4bb962b5c76e2dda0566", "score": "0.60339576", "text": "function pb(a){m.call(this,1);this.c=a;this.e=a.e;this.a=a.a}", "title": "" }, { "docid": "702d5b69b1452c8a3d8b953c47e547c4", "score": "0.6033311", "text": "set a(val) {\n this._a_ = val * 2;\n }", "title": "" }, { "docid": "f42fe4c7fd260dd9b5aded06a3e3e540", "score": "0.59875923", "text": "function Ak(a){var b=Bk;this.fd=[];this.$e=b;this.Ce=a||null;this.cc=this.Db=!1;this.Ua=void 0;this.fe=this.fg=this.ud=!1;this.jd=0;this.G=null;this.vd=0}", "title": "" }, { "docid": "39c135234c387219ba662c7080de7001", "score": "0.59454125", "text": "function Id(a){this.a=a}", "title": "" }, { "docid": "01123ea94faa7bb4d3b3dfb866f96f60", "score": "0.5917527", "text": "function gd(a){this.Aa=Object.create(null);this.u=a}", "title": "" }, { "docid": "acffe366305a123ddf65c9f97713c0bb", "score": "0.58942", "text": "function ___PRIVATE___(){}", "title": "" }, { "docid": "cbf11f686296b5549ddbc6163baa1344", "score": "0.58456826", "text": "function foo(a) {\n\tthis.a = a;\n}", "title": "" }, { "docid": "ba473614d9d682134d399bc5ae9b1173", "score": "0.58277076", "text": "function pA(a,b){this.l=[];this.T=a;this.G=b||null;this.j=this.e=!1;this.g=void 0;this.z=this.U=this.o=!1;this.n=0;this.ye=null;this.k=0}", "title": "" }, { "docid": "8a5f3135411a4c91fd88ec65d2a4e1a5", "score": "0.5820449", "text": "function b(a) {\n md = a\n }", "title": "" }, { "docid": "561a48b21c0f1d5190ed4694aa2bda27", "score": "0.5818127", "text": "function li(a){var b=mi;this.g=[];this.u=b;this.o=a||null;this.f=this.a=!1;this.c=void 0;this.m=this.A=this.i=!1;this.h=0;this.b=null;this.l=0}", "title": "" }, { "docid": "c1f001967cea105b00e6f7ff9cc841d7", "score": "0.58014876", "text": "function Mi(a){this.P=a}", "title": "" }, { "docid": "590d8d10f59ff0ad82ecaec79a7d38fb", "score": "0.5799385", "text": "function f() {\n return this.a;\n }", "title": "" }, { "docid": "6a315f77baa907807bfad319585c8ef7", "score": "0.57939774", "text": "function foo(){ console.log(this.a); }", "title": "" }, { "docid": "b5a66a14945c483888797cccc8833204", "score": "0.5777064", "text": "function ve(a){this.B=a}", "title": "" }, { "docid": "88ff86b2efcf9663abb9adaf3be6bae9", "score": "0.5771337", "text": "function Fd(a){this.a=a}", "title": "" }, { "docid": "47ba723068e8bd1682492ed998acd6af", "score": "0.57700104", "text": "function ke(a){this.va={};this.o=a}", "title": "" }, { "docid": "97c607e6f4846728d9a873e545f28f58", "score": "0.5769223", "text": "function gvjs_om(a){var b=gvjs_0ba;this.$e=[];this.Xca=b;this.L8=a||null;this.lI=this.dC=!1;this.ek=void 0;this.M3=this.ika=this.MV=!1;this.pU=0;this.rd=null;this.TV=0}", "title": "" }, { "docid": "5cb18eeb6df206382b4242e766f5f3f1", "score": "0.5742926", "text": "function rb(a){m.call(this,1);this.c=a}", "title": "" }, { "docid": "78371f4ad948f6e7b480368773182c27", "score": "0.57278985", "text": "getAlpha() {\n return this.a;\n }", "title": "" }, { "docid": "e78a720ae3a40955653992bfe8198e9e", "score": "0.5722672", "text": "function Foo(a) {this.a = a}", "title": "" }, { "docid": "4e826137363e89b9e5d1e65b7ae3cb08", "score": "0.57047194", "text": "function b(a) {\n md = a\n }", "title": "" }, { "docid": "1075af2e3a334fd27cf25ba60e673d49", "score": "0.5691212", "text": "get a() {\n\t\treturn 2;\n\t}", "title": "" }, { "docid": "1075af2e3a334fd27cf25ba60e673d49", "score": "0.5691212", "text": "get a() {\n\t\treturn 2;\n\t}", "title": "" }, { "docid": "3735c2b18b6451f98134ec5f546efc61", "score": "0.5661572", "text": "function N(){this.a={}}", "title": "" }, { "docid": "07173a99f9bed42cdca588f8ccfe294d", "score": "0.565452", "text": "function bozo() {\n console.log(this.a)\n}", "title": "" }, { "docid": "e7aef4394d23a0027370879c0cd0408b", "score": "0.56541884", "text": "function foo() {\n console.log( this.a );\n}", "title": "" }, { "docid": "b8c4442167ee1be77ef95732b98a57e7", "score": "0.5614343", "text": "function oh(a){this.w=a}", "title": "" }, { "docid": "8fc970236a44f6100917976de0d12d14", "score": "0.56095016", "text": "function foo() {\n\tconsole.log( this.a );\n}", "title": "" }, { "docid": "8fc970236a44f6100917976de0d12d14", "score": "0.56095016", "text": "function foo() {\n\tconsole.log( this.a );\n}", "title": "" }, { "docid": "8fc970236a44f6100917976de0d12d14", "score": "0.56095016", "text": "function foo() {\n\tconsole.log( this.a );\n}", "title": "" }, { "docid": "aaef5c87b08050b93b190fbdaa72bed4", "score": "0.5605335", "text": "function B(a){this.wl=a}", "title": "" }, { "docid": "2dc8c5eec68ef0820db1d07b9c5e35b4", "score": "0.5587075", "text": "function ab(a,b,c){this.a=a;this.b=b||1;this.h=c||1}", "title": "" }, { "docid": "4dc41102a2ac89239bf3bbb5d537b512", "score": "0.5575512", "text": "function b(a){md=a}", "title": "" }, { "docid": "4dc41102a2ac89239bf3bbb5d537b512", "score": "0.5575512", "text": "function b(a){md=a}", "title": "" }, { "docid": "4dc41102a2ac89239bf3bbb5d537b512", "score": "0.5575512", "text": "function b(a){md=a}", "title": "" }, { "docid": "4dc41102a2ac89239bf3bbb5d537b512", "score": "0.5575512", "text": "function b(a){md=a}", "title": "" }, { "docid": "4dc41102a2ac89239bf3bbb5d537b512", "score": "0.5575512", "text": "function b(a){md=a}", "title": "" }, { "docid": "4dc41102a2ac89239bf3bbb5d537b512", "score": "0.5575512", "text": "function b(a){md=a}", "title": "" }, { "docid": "4dc41102a2ac89239bf3bbb5d537b512", "score": "0.5575512", "text": "function b(a){md=a}", "title": "" }, { "docid": "4dc41102a2ac89239bf3bbb5d537b512", "score": "0.5575512", "text": "function b(a){md=a}", "title": "" }, { "docid": "4dc41102a2ac89239bf3bbb5d537b512", "score": "0.5575512", "text": "function b(a){md=a}", "title": "" }, { "docid": "2610108d82a3fc991c7b75421813635b", "score": "0.5574132", "text": "function pi(a){var b=qi;this.g=[];this.u=b;this.s=a||null;this.f=this.a=!1;this.c=void 0;this.m=this.A=this.h=!1;this.i=0;this.b=null;this.l=0}", "title": "" }, { "docid": "944a2e3fbff9d5c0d9265c26efc4180d", "score": "0.5569727", "text": "function foo(){\n console.log(this.a)\n}", "title": "" }, { "docid": "710c202cae8ffb5eb6f28d95a6f7774b", "score": "0.5557675", "text": "function foo(something) {\n\tthis.a = something;\n}", "title": "" }, { "docid": "710c202cae8ffb5eb6f28d95a6f7774b", "score": "0.5557675", "text": "function foo(something) {\n\tthis.a = something;\n}", "title": "" }, { "docid": "feb5877a41107b11c3915fdda9136b06", "score": "0.5550373", "text": "function AnimatedModulo(a,modulus){_classCallCheck(this,AnimatedModulo);var _this=_possibleConstructorReturn(this,Object.getPrototypeOf(AnimatedModulo).call(this));\n\t\n\t_this._a=a;\n\t_this._modulus=modulus;return _this;}", "title": "" }, { "docid": "78af71806ad6aec2ccfd1f6530803e32", "score": "0.555033", "text": "function fm(a,b){fm.s.constructor.call(this,\"\");this.o=b;this.Ib(a)}", "title": "" }, { "docid": "618aeafddaf2a95e857b56f5207b2aa8", "score": "0.5543839", "text": "function b(a){od=a}", "title": "" }, { "docid": "618aeafddaf2a95e857b56f5207b2aa8", "score": "0.5543839", "text": "function b(a){od=a}", "title": "" }, { "docid": "618aeafddaf2a95e857b56f5207b2aa8", "score": "0.5543839", "text": "function b(a){od=a}", "title": "" }, { "docid": "618aeafddaf2a95e857b56f5207b2aa8", "score": "0.5543839", "text": "function b(a){od=a}", "title": "" }, { "docid": "618aeafddaf2a95e857b56f5207b2aa8", "score": "0.5543839", "text": "function b(a){od=a}", "title": "" }, { "docid": "618aeafddaf2a95e857b56f5207b2aa8", "score": "0.5543839", "text": "function b(a){od=a}", "title": "" }, { "docid": "618aeafddaf2a95e857b56f5207b2aa8", "score": "0.5543839", "text": "function b(a){od=a}", "title": "" }, { "docid": "58dce5e59394990b12104a791c72b86d", "score": "0.55365056", "text": "function Sb(a){this.Ma=new Rb(0,25);this.ga(a)}", "title": "" }, { "docid": "c4a65f8e300d3592aee3f417f233f57f", "score": "0.55322725", "text": "function foo(){\n console.log(this.a);\n}", "title": "" }, { "docid": "b1358d2f3c3f48e6f8ffb5acb40f9f6b", "score": "0.5525998", "text": "function foo () {\n console.log(this.a);\n}", "title": "" }, { "docid": "559271b6e278eebd624da990184ae26f", "score": "0.5519945", "text": "function foo (){\n console.log(this.a);\n}", "title": "" }, { "docid": "762d25f0d22b26411ee77ef1a084f863", "score": "0.5509704", "text": "function Ag(){this.b=null;this.a=[]}", "title": "" }, { "docid": "6b2c3365475968136d6cb24401fef205", "score": "0.55040544", "text": "function ba(){}", "title": "" }, { "docid": "19b535497ec1fc84a1c32675dd3f6399", "score": "0.5503138", "text": "function Mh(a){var b=Nh;this.g=[];this.v=b;this.u=a||null;this.f=this.a=!1;this.c=void 0;this.l=this.A=this.i=!1;this.h=0;this.b=null;this.m=0}", "title": "" }, { "docid": "8de674fcbd6bd20573c2e876d59a0e99", "score": "0.5493067", "text": "function RSADoPublic(x)\n{\n\treturn x.modPowInt(this.e, this.n);\n}", "title": "" }, { "docid": "1b8ee44edc458f01c07bd6956c1f0692", "score": "0.54909474", "text": "function $e(a,b){this.N=[];this.Ca=a;this.ga=b||null;this.H=this.D=!1;this.F=void 0;this.ea=this.Ga=this.R=!1;this.O=0;this.Ne=null;this.J=0}", "title": "" }, { "docid": "79249f67e15afcc674d7f52d57da4a34", "score": "0.5490856", "text": "function foo() {\n console.log(this.a);\n}", "title": "" }, { "docid": "04e36c28f0e6691617310aea3fe0f631", "score": "0.54862773", "text": "function foo() {\n console.log(this.a);\n}", "title": "" }, { "docid": "04e36c28f0e6691617310aea3fe0f631", "score": "0.54862773", "text": "function foo() {\n console.log(this.a);\n}", "title": "" }, { "docid": "04e36c28f0e6691617310aea3fe0f631", "score": "0.54862773", "text": "function foo() {\n console.log(this.a);\n}", "title": "" }, { "docid": "04e36c28f0e6691617310aea3fe0f631", "score": "0.54862773", "text": "function foo() {\n console.log(this.a);\n}", "title": "" }, { "docid": "04e36c28f0e6691617310aea3fe0f631", "score": "0.54862773", "text": "function foo() {\n console.log(this.a);\n}", "title": "" }, { "docid": "54a567cd5d5d1802bc919cf657b37d3b", "score": "0.54860216", "text": "function foo() {\n console.log( this.a );\n}", "title": "" }, { "docid": "be573606e5e2f1a100ac15893e62fa51", "score": "0.5484566", "text": "function pi(a){var b=qi;this.g=[];this.u=b;this.s=a||null;this.f=this.a=!1;this.c=void 0;this.v=this.C=this.i=!1;this.h=0;this.b=null;this.l=0}", "title": "" }, { "docid": "562c5b6aa43b9491eb9220d5e64eaa3c", "score": "0.54826725", "text": "function Ar(a,b){this.v=[];this.H=a;this.L=b||null;this.g=this.a=!1;this.j=void 0;this.J=this.I=this.B=!1;this.F=0;this.f=null;this.o=0}", "title": "" }, { "docid": "41b7c6739aa3c0e563a1fbe6ba50d571", "score": "0.54789305", "text": "function foo() {\n console.log( this.a );\n}", "title": "" }, { "docid": "41b7c6739aa3c0e563a1fbe6ba50d571", "score": "0.54789305", "text": "function foo() {\n console.log( this.a );\n}", "title": "" }, { "docid": "41b7c6739aa3c0e563a1fbe6ba50d571", "score": "0.54789305", "text": "function foo() {\n console.log( this.a );\n}", "title": "" }, { "docid": "41b7c6739aa3c0e563a1fbe6ba50d571", "score": "0.54789305", "text": "function foo() {\n console.log( this.a );\n}", "title": "" } ]
920701e6681fe09de7356020440f21c3
Function to list all products to sale
[ { "docid": "49615bce5d1d1cec52c00225ef12a1f9", "score": "0.0", "text": "function main(){\n connection.query('SELECT * FROM products', function(err, response) {\n if (err) throw err;\n \n console.table(response)\n postFunction();\n\n });\n}", "title": "" } ]
[ { "docid": "e24b39e9f729e3f59cea900ec1f1b892", "score": "0.7634222", "text": "function productsForSale() {\n console.log(\"\\n\\rHere's a list of products that are available for sale:\\n\\r\");\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n for (var i = 0; i < res.length; i++) {\n result.push({\n item_id: res[i].item_id,\n product_name: res[i].product_name,\n department_name: res[i].department_name,\n price: res[i].price,\n stock_quantity: res[i].stock_quantity\n });\n }\n console.table(result);\n menuOptions();\n })\n}", "title": "" }, { "docid": "fcbbbbafe92958e6c288f2d6cd49eaed", "score": "0.7233105", "text": "function getAllProducts(){\n return products\n}", "title": "" }, { "docid": "eb076527786ea6f1496850a85ad6e697", "score": "0.7185731", "text": "function productsForSale() {\n\n\tconnection.query('SELECT * FROM products', function(err, data) {\n\t\tif (err) throw err;\n\n\t\tconsole.log('Products for sale: '); \n\n\t\tconsole.log(data);\n\n\t}); // end of query select * from products\n\n}", "title": "" }, { "docid": "1a767943be67bd9685ee54ec53e48a3c", "score": "0.71048886", "text": "async function getProductsBySale() {\r\n try {\r\n const { rows: productsList } = await client.query(`\r\n SELECT products.*\r\n FROM products\r\n WHERE sale=true;`);\r\n\r\n const products = await Promise.all(\r\n productsList.map((product) => getProductById(product.id))\r\n );\r\n\r\n return products;\r\n } catch (error) {\r\n throw error;\r\n }\r\n}", "title": "" }, { "docid": "966c8c12be991cf8056a56b0b17625c0", "score": "0.7057144", "text": "function viewProducts(){\n \tconsole.log(\"View products for sale: \\r\\n\");\n\n\tconnection.query(\"SELECT * FROM products\", function(err, res){\n\t\tif (err) throw err;\n\t\t\n\t\tfor (var i =0; i < res.length; i++){\n\t\t\tt.cell('Product Id', res[i].title_id)\n\t\t\tt.cell('Description', res[i].product_name)\n\t\t\tt.cell('Department', res[i].department_name)\n\t\t\tt.cell(\"Price\", res[i].price)\n\t\t\tt.cell(\"Quantity\", res[i].stock_quantity)\n\t\t\tt.newRow()\t\t \n\t\t}\n\t\tconsole.log(t.toString());\n\t\taddInventory(res);\n\t});\n }", "title": "" }, { "docid": "a8471895d2e6105907a54a8e6ac2a782", "score": "0.7052925", "text": "function viewProducts () {\n let querySQL = 'SELECT item_id, product_name, price, stock_quantity FROM products';\n connection.query(querySQL, (err, res) => {\n if (err) throw err;\n let title = 'LIST OF ALL PRODUCTS FOR SALE';\n common.displayProductTable(title, res); // pass title and queryset to function that will print out information\n console.log('\\n');\n managerOptions(); // return to main menu\n });\n}", "title": "" }, { "docid": "5b32e913898b59d73879144452abbc3d", "score": "0.70289433", "text": "function itemForSale() {\n\tconsole.log(\"All Products for Sale \\n\")\n\n var query = connection.query(\"SELECT * FROM products\", function(err, res) {\n \tif (err) { \n \t\tthrow (error);\n \t};\n\n for (var i = 0; i < response.length - 1; i++) {\n \tconsole.log(\"item ID: \" + res[i].item_id + \"\\n Product\" + res[i].product_name + \"\\n Department\" + res[i].department_name + \"\\n $\" \n \t+ res[i].price + \"\\n Stock\" + res[i].stock_quantity);\n \t}\n\n\tcustomerSelection();\n\n\t});\n}", "title": "" }, { "docid": "df6bbf99a6130602649398570a74968c", "score": "0.69755214", "text": "function viewProductSales() {\r\n\r\n connection.query('SELECT * FROM Bamazon.products', function (err, res) {\r\n for(var i = 0; i<res.length;i++){\r\n console.log(\"ID: \" + res[i].ItemID + \" | \" + \"Product: \" + res[i].ProductName + \" | \" + \"Department: \" + res[i].DepartmentName + \" | \" + \"Price: \" + res[i].Price + \" | \" + \"QTY: \" + res[i].StockQuantity);\r\n console.log('--------------------------------------------------------------------------------------------------')\r\n }\r\n startManager();\r\n});\r\n}", "title": "" }, { "docid": "f7facd314d738531b8e313a7e3fdaa4e", "score": "0.6957607", "text": "function viewAllInventory(){\n\tconsole.log(\"Here are the products for sale\");\n\tconnection.query(\"SELECT * FROM products\", function(error, response){\n\t\tif(error){\n\t\t\tconsole.log(error);\n\t\t}\n\t\t\n\t\tfor(var i = 0; i < response.length; i++){\n\t\t\tconsole.log(\"ID: \" + response[i].id + \"\\nITEM: \" + response[i].name + \"\\nPrice: \" + response[i].price + \"\\nQuantity: \" + response[i].quantity + \"\\n------------------\");\n\t\t}\n\t\tcontinueSearch();\n\t})\n}", "title": "" }, { "docid": "945e7427acd244e7aa33eb2f8108c6c3", "score": "0.682554", "text": "function viewProducts() {\n console.log(\"All available items listed for sale.\");\n connection.query(\"SELECT * FROM products\", function(err,res) {\n if(err) throw err;\n console.table(res); \n \n console.log(\"======================================================================\");\n return mgrSelect();\n });\n}", "title": "" }, { "docid": "f644c2b9f04e1b5dba3824bdc980a158", "score": "0.6817565", "text": "function viewProducts() {\n connection.query('SELECT * FROM products', function (error, res) {\n for (var i = 0; i < res.length; i++) {\n console.log('prodID: ' + res[i].item_id + ' — price (USD): ' + res[i].price + ' — ' + res[i].product_name);\n }\n // after displying products, close the sale\n placeOrder();\n });\n}", "title": "" }, { "docid": "0b4867e59a42e561924e428886a93675", "score": "0.6807049", "text": "function showAll(){\n\tconnection.query(\"SELECT * FROM products\", function(err, res){\n\t\tif (err) throw err;\n\t\tconsole.log(\"\\n Available products \");\n\t\tconsole.log(\"\\n--------------------------------------------------------------------------\");\n\t\tfor(i=0;i<res.length;i++){\n\t\t\tconsole.log(\"Item ID: \" + res[i].item_id + \" || Name: \" + res[i].product_name + \" || Price: \" + \"$\" + res[i].price + \" || Stock: \" + res[i].stock_quantity + \" ||\" +\n\t\t\t\"\\n----------------------------------------------------------------------------\");\n\t\t}\n\t\tpurchaseProduct();\n\t});\n}", "title": "" }, { "docid": "34a502960d99e84895d576513e8d46fd", "score": "0.67933124", "text": "function getAll() {\n var servCall = SmartShopService.getProducts();\n servCall.then(function(d) {\n $scope.product = d.data;\n },\n function(error) {\n $log.error(\"Oops! Something went wrong while fetching the data.\" + error.data.ExceptionInformation);\n });\n }", "title": "" }, { "docid": "ebf3fb22585b89d1b44e0c04e1b0b996", "score": "0.6703828", "text": "function itemsForSale(){\n\t// gets all the items in the products table from the database\n\tconnection.query(\"SELECT * FROM products\", function(err, result){\n\t\t// loops through the results from the mySQL database\n\t\tfor (var i = 0; i < result.length; i++){\n\t\t\t// logs the item_id, product_name & price\n\t\t\tconsole.log(\"Item ID: \" + result[i].item_id + \n\t\t\t\t\"\\n Item: \" + result[i].product_name + \n\t\t\t\t\"\\n Price: \" + result[i].price + \n\t\t\t\t\"\\n Stock Qty: \" + result[i].stock_quantity +\n\t\t\t\t\"\\n -------------------------------\");\n\t\t}\n\t// allows the buyer prompt to start after the items are listed\n\tbuyer();\n\t});\n}", "title": "" }, { "docid": "d5924d9a36e3af8008d114ad59294026", "score": "0.66035855", "text": "function get_products() {\n\tconnection.connect();\n \n\tconnection.query('SELECT * FROM products', function (error, results, fields) {\n\t if (error) throw error;\n\n\t products = results;\n\t prod_count = results.length;\n\t \n\t console.log(\"Products available for sale today: \" + prod_count);\n\t console.log(\" \");\n\t console.log(\"----------------------------------------------------------------------------------\")\n\t console.log(\"| ID | Product Name | Department | Price |\")\n\t console.log(\"----------------------------------------------------------------------------------\")\n\t console.log(\"----------------------------------------------------------------------------------\")\n\n\t for (i = 0; i < prod_count; i++) {\n\t console.log(\"| \" + products[i].item_id + \" | \" + products[i].product_name + \" | \" + products[i].department_name + \" | \" + products[i].price);\n\t console.log(\"----------------------------------------------------------------------------------\");\n\t }\n\n\t});\n\n\n\t\n}", "title": "" }, { "docid": "c217af5bc096acdbe26030048fb40ddb", "score": "0.6603336", "text": "function viewProducts() {\n connection.query(\"SELECT * FROM bamazon_db.products;\", function (err, res) {\n if (err) throw err;\n console.log(\"***************\");\n console.log(\"ITEMS FOR SALE!\");\n console.log(\"***************\");\n console.table(res);\n // link to exit app function\n exitApp();\n });\n}", "title": "" }, { "docid": "f34172e486bd39cf4c5dd1565780bce9", "score": "0.65797013", "text": "function Products(){\n connection.query(\"SELECT * from products\", function(err, res){\n if(err) throw err;\n console.log(\"\\nThese are the items Bamazon has for sale\\n\");\n for (let i in res){\n let stuff = res[i];\n\n console.log(\n \"id: \", stuff.id,\n \"Name: \",stuff.product_name,\n \"Prices: \", stuff.price, \n \"Quantity: \", stuff.stock_quantity\n )\n }\n })\n promptUser();\n }", "title": "" }, { "docid": "ae38a4e12fc81640a9e79b2bd39cc076", "score": "0.6551723", "text": "function listProducts(products){\n let prodList=[] ;\n \n products.forEach(product =>prodList.push(product.name )) ;\n \n return prodList\n}", "title": "" }, { "docid": "86d44cbee0f0a5e94ba5f2445c0f4724", "score": "0.65338016", "text": "function showAllProducts() {\n connection.query(\"SELECT * FROM products\", (err, res) => {\n let productListing = new Table({\n head: [chalk.blueBright.bold(\"ID\"), chalk.blueBright.bold(\"PRODUCT NAME\"), chalk.blueBright.bold(\"DEPARTMENT\"), chalk.blueBright.bold(\"PRICE\")],\n });\n for (let i = 0; i < res.length; i++) {\n productListing.push([chalk.redBright.bold(res[i].item_id), res[i].product_name, res[i].department_name, chalk.greenBright(`$${res[i].price}`)]);\n }\n console.log(`${productListing.toString()}`);\n productID();\n });\n}", "title": "" }, { "docid": "212626886a3274bcb2fcc608fc862fa3", "score": "0.6531337", "text": "function showProducts(productList) {\n for (var item of productList) {\n showDescription(item.description);\n showUnits(item);\n showPrice(item.price);\n }\n}", "title": "" }, { "docid": "b2f66f1769ba4a9c9db5fb801d265088", "score": "0.65133893", "text": "function prods(){\r\n ProductService.GetProducts().then(function (productlist){\r\n vm.productlist = productlist;\r\n })\r\n }", "title": "" }, { "docid": "839b90397a4bff0cc9bb175cc16c1bd7", "score": "0.65078086", "text": "function getProducts(){\n\t\tdbOperations.views(\"GetProduct\",{}).then(function(res){\n\t\t\t$scope.products = res;\n\t\t\tconsole.log(res);\n\t\t\tformatProductData();\n\t\t\t\n\t\t});\n\t}", "title": "" }, { "docid": "26a5656116136a6cdbb36708bca874ad", "score": "0.6453728", "text": "function showAllProducts() {\n connection.query(\"SELECT * FROM bamazon_db.products;\", function(err, data) {\n if (err) throw err;\n console.table(data);\n console.log(\"This is what we have currently in stock. \");\n buyWhat();\n });\n}", "title": "" }, { "docid": "51692771aade34d775ee6d6f76a55a4f", "score": "0.64175224", "text": "function getProducts (req, res){\n\tProduct.find({}, (err, products)=> {\n\t\tif(err) return res.status(500).send({message: `Error al recuperar la lista de productos: ${err}`})\n\t\tif(!products) return res.status(404).send({message: `No existen productos`})\n\n\t\t\tres.status(200).send({products})\n\t})\n}", "title": "" }, { "docid": "b13ca4c4d3f8e3cb6a9c418973024c46", "score": "0.6411142", "text": "function allInventory() {\n\tconnection.query(\"SELECT * FROM products\", function (err, res) {\n\t\tif (err) {throw err};\n \n console.log(\"Items for sale:\");\n for(var i = 0; i < res.length; i++) {\n console.log(\"ID: \" + res[i].item_id + \" | Product: \" + res[i].product_name + \" | Quantity: \" + res[i].stock_quantity + \" | Price: $\" + res[i].price); \n }\n // create function to shorten this/make it more user friendly\n console.log(\"Is there anything else you would like to do?\");\n menuOptions();\n\t});\n}", "title": "" }, { "docid": "d8a8d4ac62768601f388637949817bd3", "score": "0.6410925", "text": "function getAllProducts() {\n fetch('api/products')\n .then(res => res.json())\n .then(data => {\n data.products.forEach(prod => addProduct(contents = prod));\n });\n}", "title": "" }, { "docid": "e7376f0864382b3c1b187f92958ababe", "score": "0.6397211", "text": "function viewProducts()\n{\n\t//list ID, name, price & quantity.\n\n\t//Select All from (products) table within (bamazon) DB\n\tconnection.query(\"SELECT * FROM products\", function(err, res)\n\t{\n\t\tif(err) throw err;\n\n\t\t//Display all products in table by looping through each row inside table\n\t\tfor(var i = 0; i < res.length; i++)\n\t\t{\n\t\t\tconsole.log(\"ID: \" + res[i].item_id + \" | \" +\n\t\t\t\t\t\t\"Product Name: \" + res[i].product_name + \" | \" +\n\t\t\t\t\t\t\"Category: \" + res[i].department_name + \" | \" +\n\t\t\t\t\t\t\"Price: \" + res[i].price + \" | \" +\n\t\t\t\t\t\t\"Quantity: \" + res[i].stock_quantity);\n\t\t}\n\n\t\tconsole.log(\"-----------------------------------------------------------------------------------------------------\\n \\n\");\n\n\t\t//Recursion\n\t\tmenu();\n\t});\n\n\n}", "title": "" }, { "docid": "99ecc5107989e015c58a2012205c5e98", "score": "0.63951784", "text": "products(getProductFactory) {\n return getProductFactory.getAllProducts();\n }", "title": "" }, { "docid": "e278267b9b78bc97bd6c8d303c6a5d84", "score": "0.63769263", "text": "static getAll(req, res){\n models.Product.findAll().then( Products => {\n res.send(Products)\n })\n }", "title": "" }, { "docid": "4d01f32a91bf06af541872f127df7f6a", "score": "0.63727385", "text": "function getBuyingProducts() {\n var servCall = SmartShopService.getBuyingProducts();\n servCall.then(function(d) {\n $scope.buyingProduct = d.data;\n },\n function(error) {\n $log.error(\"Oops! Something went wrong while fetching the data.\" + error.data.ExceptionInformation);\n });\n }", "title": "" }, { "docid": "e27fb0cecb5d44e2bda8fee259774014", "score": "0.6369617", "text": "function getAllManufacturingProducts(req,res) {\n baseRequest.getProductByCategory(req,res,{},Manufacturing)\n}", "title": "" }, { "docid": "a4ba8b48d885bce688e6407b04a614f5", "score": "0.63691515", "text": "function getSaleItems() {\n $http({\n method: 'GET',\n url: '/store/getSaleItems'\n }).then(function(response) {\n sale_items.list = response.data;\n }).catch(function(error) {\n alertify.alert(\"Error with GET request to DB for all sale items\");\n console.log('Error with GET request to DB for all sale items: ', error);\n });\n }", "title": "" }, { "docid": "4566243c4d8510f7e63881dc01c273fc", "score": "0.6368072", "text": "function viewProducts() {\n connection.query('SELECT * FROM PRODUCTS', function (error, results) {\n if (error) throw error;\n console.table(results);\n inquireManager();\n });\n}", "title": "" }, { "docid": "099da9b55a01e04328b4458d15819b6e", "score": "0.6362387", "text": "function getProductSellDailyList() {\n\t\t// get the shop products sells in a week URL\n\t\tvar listProductSellDailyUrl = '/o2o/shopadmin/listproductselldailyinfobyshop';\n\t\t// request back-end, products sells\n\t\t$.getJSON(listProductSellDailyUrl, function(data) {\n\t\t\tif(data.success) {\n\t\t\t\tvar myChart = echarts.init(document.getElementById('chart'));\n\t\t\t\t// generate static Echart data \n\t\t\t\tvar option = generateStaticEchartPart();\n\t\t\t\toption.legend.data = data.legendData;\n\t\t\t\toption.xAxis = data.xAxis;\n\t\t\t\toption.series = data.series;\n\t\t\t\tmyChart.setOption(option);\n\t\t\t}\n\t\t});\n\t}", "title": "" }, { "docid": "fdce8f8f3f2424f0dd3da6a7dcdafe77", "score": "0.63618904", "text": "function allItemsSold(sellerID) {\n\n}", "title": "" }, { "docid": "8ace350cce9e064c6841cda1eca382d1", "score": "0.6358163", "text": "function printProducts(products) {\n\tfor (var i = 0; i < products.length; i++) {\n\t\tconsole.log(\"Name: \" + products[i].name +\n\t\t \", Calories: \" + products[i].calories +\n\t\t \", Color: \" + products[i].color +\n\t\t \", Sold: \" + products[i].sold);\n\t}\n}", "title": "" }, { "docid": "f74f0fdf91fb12ded52c4f68ef1fc444", "score": "0.63561743", "text": "function saleProduct(call) {\n let table = document.getElementById('stockTable');\n let i = call.rowIndex;\n let row = table.rows[i];\n let sale_id = row.cells[0].innerHTML;\n\n api.clearTable(saleBody);\n saleRecords.forEach((record) => {\n if (record['sale_id'] == sale_id) {\n saleData(record['products'], record['total_sale']);\n }\n });\n}", "title": "" }, { "docid": "1f46a5fe3361b1bc663e9265428a29eb", "score": "0.63531196", "text": "function dispSaleItems() {\n\tvar table = new Table({\n\t head: ['Prod. ID', 'Prod. Name', 'Dept. Name', 'Price', 'Quantity', 'Sales'], \n\t colWidths: [10, 25, 18, 12, 14, 12]\n\t\t});\n \tconnection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n console.log(\"\\n------------------------------------------------\\n\");\n for (var i = 0; i < res.length; i++) {\n\n \ttable.push([\n\t\t\t res[i].item_id,\n\t\t\t res[i].product_name, \n\t\t\t res[i].department_name,\n\t\t\t res[i].price,\n\t\t\t res[i].stock_quantity,\n\t\t\t res[i].product_sales\n\t\t \t]);\t\n\t\t\t};\n\t\tconsole.log(table.toString());\n\t\tconsole.log(\"\\n------------------------------------------------\\n\");\n \tbuyQuestion();\n \t});\n}", "title": "" }, { "docid": "2225a9d3bfae3a16e41654c7a6e3b3cd", "score": "0.6336668", "text": "function render_Products(){\n //clears the shop\n shop.innerHTML = ' ';\n\n //builds shop\n for(item in product_list){\n prod = product_list[item];\n if(prod.isSale){\n shop.innerHTML += \"<div class='col-md-3'><a href='selectedprod.html?prodID=\" + prod.productId +\"'><img class='instapic' src='img/prod/\" + prod.imageUrl + \"'></a>\" + \"<p> ON SALE! -- $ \" + prod.price + \"</p></div>\"\n }else{\n shop.innerHTML += \"<div class='col-md-3'><a href='selectedprod.html?prodID=\" + prod.productId +\"'><img class='instapic' src='img/prod/\" + prod.imageUrl + \"'></a>\" + \"<p> $ \" + prod.price + \"</p></div>\"\n }\n\n }\n\n product_list = [];\n}", "title": "" }, { "docid": "f23fda6f5f6b3132ab5ee60e29bc14ba", "score": "0.63288826", "text": "function displayProduct() {\n //insert each product of product arrays\n cart.getCartItems().forEach((product) => {\n fillTemplate(product)\n totalProductPrice(product)\n })\n}", "title": "" }, { "docid": "9fd9494cd79c3628089c193979bebad0", "score": "0.630782", "text": "function viewProduct(){\n\n console.log(chalk.gray(\"\\n---------Product List ---------\\n\"));\n\n connection.query(\"select item_id,product_name, concat('$',format(price,2)) as price, stock_quantity from products\", function(err,res){\n \n if (err) throw err;\n\n console.table(res);\n listOptions();\n })\n}", "title": "" }, { "docid": "ec2ef741891dca7f0a4a80cfee021535", "score": "0.6306218", "text": "function getProducts() {\n connection.query(\"SELECT * FROM products\", function (error, results) {\n if (error) throw error;\n console.table(results);\n buy(results);\n })\n}", "title": "" }, { "docid": "073b45e62ce52cfe7d4c90e63276993f", "score": "0.6306033", "text": "function viewProducts() {\n\n console.log(\"Listing all available products: \\n\");\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n // Log all results of the SELECT statement\n // console.log(res); \n for (var i = 0; i < res.length; i++) {\n console.log(\n \"Item ID: \" +\n res[i].item_id +\n \" || Product Name: \" +\n res[i].product_name +\n \" || Department Name: \" +\n res[i].department_name +\n \" || Price: \" +\n res[i].price +\n \" || Stock Quantity: \" +\n res[i].stock_quantity\n );\n }\n runSearch()\n });\n // connection.end();\n \n }", "title": "" }, { "docid": "9dfdc6d9f68a0b43bc16a58869178e7d", "score": "0.6299663", "text": "function displayProducts(data) {\n\tconsole.log(\"OUR PRODUCTS\",\n\t\t\t\t\t\t \"\\n--------------------------------\");\n\tfor (let i = 0; i < data.length; i++) {\n\t\tlet id = data[i].item_id,\n\t\t\t\tname = data[i].product_name,\n\t\t\t\tprice = data[i].price.toFixed(2);\n\t\tconsole.log(\"ID: \" + id,\n\t\t\t\t\t\t\t\t\"\\nNAME: \" + name,\n\t\t\t\t\t\t\t\t\"\\nPRICE: $\" + price,\n\t\t\t\t\t\t\t\t\"\\n--------------------------------\");\n\t}\n}", "title": "" }, { "docid": "e43070bed2bb802cd3ef577873299c8a", "score": "0.62905085", "text": "function displayItems() {\n\tconsole.log(\"Welcome to Bamazon! Here are our products available for sale:\\n\");\n\tconnection.query(\"SELECT * FROM products\", function(err, res) {\n\t\tif (err) throw err;\n\n\t\tfor (var i = 0; i < res.length; i++) {\n\t console.log(res[i].item_id + \" | \" + res[i].product_name + \" | \" + \"$\" + res[i].price);\n\t }\n\t console.log(\"-------------------------------------------------------------------\");\n\t});\n}", "title": "" }, { "docid": "27c311f7dd89a022ec751bdf21d2737a", "score": "0.62866944", "text": "function displayProducts() {\n console.log(\"Selecting all products...\\n\");\n connection.query(\"SELECT * FROM products\", function (err, res) {\n if (err) throw err;\n // Log all results \n for (var i = 0; i < res.length; i++) {\n console.log(\"ID: \" + res[i].item_id + \" | \" + \"Product: \" + res[i].product_name + \" | \" + \"Department: \" + res[i].department_name + \" | \" + \"Price: \" + res[i].price + \" | \" + \"Quantity: \" + res[i].stock_quantity);\n console.log('------------------------------------------------------------------------------------------------------------');\n };\n runSearch()\n });\n}", "title": "" }, { "docid": "0cc7f543b97feb03cfd4857c5d9ba086", "score": "0.6271419", "text": "function readProducts() {\n console.log(\"Displaying all products...\\n\");\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n // log all products\n for (var i = 0; i < res.length; i++) {\n console.log(\"ID: \" + res[i].id + \"\\nProduct Name: \" + res[i].product_name + \n \"\\nDepartment: \" + res[i].department_name + \"\\nPrice: \" + res[i].price + \"\\nAvailable Quantity: \" + res[i].stock_quantity + \"\\n====================\");\n }\n buyProducts(res);\n });\n}", "title": "" }, { "docid": "40ce34e78db57190b3afa1c149242508", "score": "0.62533504", "text": "function showItemsForSale() {\n\t//Create a connection query to the database.\n\t//Select all columns from products table to get product info.\n\tconnection.query(\"SELECT * FROM products\", function(err, res){\n\t\t//If there is an error, throw error.\n\t\tif(err) throw err;\n\n\t\t//Use inquirer to prompt customer to select a department\n\t\t//console.log(res);\n\t\tvar chooseDepartment = [\n\t\t\t{\n\t\t\t \ttype: 'list',\n\t\t\t \tname: 'productDepartment',\n\t\t\t \tmessage: 'Select a department',\n\t\t\t \tchoices: function() {\n\t\t\t \t\tvar departmentsArray = [];\n\t\t\t \t\tfor (var i = 0; i < res.length; i++) {\n\t\t\t \t\t\tdepartmentsArray.push(res[i].department_name);\n\t\t\t \t\t}\n\t\t\t \t\treturn departmentsArray;\n\t\t\t \t}\n\t\t\t}\n\t\t];\n\t\t//After customer selects department.\n\t\tinquirer.prompt(chooseDepartment).then(answers => {\n\t\t\tvar customerDept = answers.productDepartment;\n\t\t\t//Search the database for only the items in the department that the customer selected.\n\t\t\tconnection.query(\"SELECT * from products WHERE ?\", \n\t\t\t\t{\n\t\t\t\t\tdepartment_name: customerDept\n\t\t\t\t},\n\t\t\t\tfunction(err, res) {\n\t\t\t\t\tif (err){\n\t\t\t\t\t\tconsole.log(\"error: \" + err);\n\t\t\t\t\t}\n\t\t\t\t\t//console.log(res);\n\t\t\t\t\t\t//Show only the items in the department that the customer selected.\n\t\t\t\t\t\t//Display item number, item, price, and number remaining information that is stored in the products table in the db.\n\t\t\t\t\t\tconsole.log(\"Items for sale\");\n\t\t\t\t\t\tconsole.log(\"Department: \" + customerDept);\n\t\t\t\t\t\tfor (var i = 0; i < res.length; i++){\n\t\t\t\t\t\t\tvar items = \n\t\t\t\t\t\t\t\"====================================\" + \"\\r\\n\" +\n\t\t\t\t\t\t\t\"Item number: \" + res[i].item_id + \"\\r\\n\" +\n\t\t\t\t\t\t\t\"Item: \" + res[i].product_name + \"\\r\\n\" +\n\t\t\t\t\t\t\t\"Price: $\" + res[i].price + \"\\r\\n\" +\n\t\t\t\t\t\t\t\"Number remaining: \" + res[i].stock_quantity + \"\\r\\n\" +\n\t\t\t\t\t\t\t\"=====================================\"\n\t\t\t\t\t\t\tconsole.log(items);\n\t\t\t\t\t\t}\n\t\t\t\t\t//After customer has a chance to look over the items, ask them if they want to buy something today.\n\t\t\t\t\tbuyItemOrLeave();\n\t\t\t\t}\n\t\t\t);\n\t\t});\n\t});\n}", "title": "" }, { "docid": "f8b3c10029225ed9b7a248ae96a89242", "score": "0.62444025", "text": "function getProducts(req, res) {\n Product.find({}, (err, products) => {\n if (err) return res.status(500).send({ message: `Error in the request: ${err}.` })\n if (!products) return res.status(404).send({ message: 'There is no any products' })\n\n res.status(200).send({ products })\n })\n}", "title": "" }, { "docid": "0b52c9e5e1a47e6095552b079fe8e208", "score": "0.6215155", "text": "function showProducts() {\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n for (let i in res) {\n let product = res[i]\n\n console.log(\n \"| Product ID:\", product.item_id,\n \"| Product Name:\", product.product_name,\n \"| Price:\", product.price\n )\n }\n buyProduct(res);\n })\n}", "title": "" }, { "docid": "79a6c318c89bf562a431d39a3a95c433", "score": "0.6192736", "text": "function ViewProducts(){\n db.connect(function(err) {\n if (err) throw err;\n console.log(\"Selecting and Displaying all products...\\n\");\n db.query(\"SELECT * FROM products\", function (err, res) {\n if (err) throw err;\n \n const table = cTable.getTable(res);\n console.log(table);\n \n // for (var i = 0; i < res.length; i++){\n \n // console.log(\"ITEM: \" + res[i].item_id + \" | PRODUCT: \" + res[i].product_name + \" | DEPARTMENT: \" + res[i].department_name + \" | PRICE: \" + res[i].price + \" | QUANTITY IN STOCK: \" + res[i].stock_quantity + \" | PRODUCT SALES: \" + res[i].product_sales);\n \n \n // Log all results of the SELECT statement\n db.end(); \n \n })\n \n \n });\n\n}", "title": "" }, { "docid": "c935f6f2c86cf9ccd50424329ebff4e5", "score": "0.6187885", "text": "function fetchProductos() {\n fetch(url + \"catalogo/id?identificador=\" + catalogoSeleccionado)\n .then((response) => response.json())\n .then((data) => setProductosList(data));\n }", "title": "" }, { "docid": "26b5a3c5a1045b354f01af2adc47266f", "score": "0.6178758", "text": "function listProducts()\r\n{\r\n for (i=0; i<products.length; i++)\r\n {\r\n document.write(products[i].toString() + \"<br />\");\r\n }\r\n}", "title": "" }, { "docid": "ebf0dbfa65c576cddc15a2a4deb26b6c", "score": "0.6176501", "text": "function viewProducts() {\n\tconsole.log(\"Viewing Product Inventory---------------------------\");\n\tconnection.query(\"SELECT * FROM products\", function(error, results){\n\t\tif (error) throw error;\n\t\t//console.log(results);\n\t\tfor (var i = 0; i < results.length; i++) {\n\t\t\tconsole.log(\"id: \" + results[i].item_id + \" | Product Name: \" + results[i].product_name + \" | Price: \" +\n\t\t\t\tresults[i].price + \" | Quantity: \" + results[i].stock_quantity + \" | Dept: \" + results[i].department_name);\n\t\t}\n\t\tconsole.log(\"------------------------------\")\n\t\tstart();\n\t})\n}", "title": "" }, { "docid": "68f71f06c455d0f3d71b2ff1c0217469", "score": "0.61643684", "text": "function list(){\r\n \r\n ProductService.list().then( \r\n\t function(response) { \r\n\t $scope.products = response._embedded.product;\r\n\t /* var n = str.lastIndexOf('/');\r\n\t var id = str.substring(n + 1);*/\r\n\t });\r\n }", "title": "" }, { "docid": "4b556e904363c4bb68c6cb24762a1fb0", "score": "0.6155193", "text": "function getProducts() {\n Product.getAll()\n .then(function (products) {\n scope.products = products;\n })\n ['catch'](function (err) {\n Notification.error('Something went wrong with fetching the departments, please refresh the page.')\n });\n }", "title": "" }, { "docid": "524f0f8e246b72d67ca525a2712bca3c", "score": "0.6153955", "text": "function productItems() {\n\tconnection.connect(function(err) {\n\n\t\tconnection.query(\"SELECT * FROM products\", function(err, result) {\n\t\tif (err) throw err\n\t\telse console.table(result , \"\\n\");\n\t\tproductId();\n\t\t});\n\t});\n}", "title": "" }, { "docid": "7b866e5515ba5b3bd474c1055d35156f", "score": "0.61393213", "text": "function json_product_list() {\n\n\tvar self = this;\n\tvar filter = self.post;\n\n\tdatabase.find('products', 'product', filter, function(err, result) {\n\n\t\tif (err) {\n\t\t\tself.view500(err);\n\t\t\treturn;\n\t\t}\n\n\t\tself.json(result);\n\t});\n\n}", "title": "" }, { "docid": "e72153c25e4567515f5157f1f6ac5330", "score": "0.6137941", "text": "function viewProducts() {\n\tconnection.query(\"SELECT * FROM products\", function(err, res) {\n\tif (err) throw err;\n\t\n\tconsole.log(\"\\nPRODUCT LISTING:\\n\");\n \tfor (var i = 0; i < res.length; i++) {\n \t\t\n \t\t//CHECK if ITEM is in stock\n \t\tvar stockCheck = \"Yes\";\n \t\tif(res[i].stock_quantity <= 0){\n \t\t\tstockCheck = \"No\";\n\t\t}\n\t\tconsole.log(\n\t\t\tres[i].item_id \n\t\t\t+ \" : \" + res[i].product_name \n\t\t\t+ \" | Price: \" + res[i].price\n\t\t\t+ \" | In Stock: \" + stockCheck \n\t\t\t+ \"(\"+res[i].stock_quantity + \")\"\n\t\t);\n\t}\n\tmainPrompts();\n\t});\n}", "title": "" }, { "docid": "0012c4858537e52e399bc5cf1fc09f10", "score": "0.6129221", "text": "function displayProducts() {\n\tconsole.log(\"----------------------------------------------------------------------------------\");\n\tconsole.log(\" Welcome to Bamazon.\")\n\tconnection.query(\"SELECT * FROM products\", function(err, res) {\n\t\t// Loop through response length of products table.\n\t\tfor (var i = 0; i < res.length; i++) {\n\t\t\t// Console out the products and details.\n\t\t\tconsole.log(\"----------------------------------------------------------------------------------\");\n\t\t\tconsole.log(\"Item_ID: \" + res[i].item_id + \"| \" + \"Product: \" + res[i].product_name + \"| \" + \"Dept: \" + res[i].department_name + \"| \" + \"Price $\" + res[i].price);\n\t\t}\n\t});\n} // End of displayProducts().", "title": "" }, { "docid": "8e65fd4f638b2bd4ecff0a52ed4c82dd", "score": "0.6104497", "text": "function displayProducts() {\n connection.query(\"SELECT * FROM products\", function (error, results) {\n if (error) throw error;\n console.log(\"\\n~~~~~~~~~~~~~~~~~~~~Bamazon Products~~~~~~~~~~~~~~~~~~~~\");\n for (var i = 0; i < results.length; i++) {\n console.log(\"Product ID: \" + results[i].item_id + \" || Product: \" + results[i].product_name + \" || Dapartment: \" + results[i].department_name + \" || Price: \" + results[i].price + \" || In Stock: \" + results[i].stock_quantity);\n }\n console.log(\"~~~~~~~~~~~~~~~~~~~~Bamazon Products~~~~~~~~~~~~~~~~~~~~\\n\");\n chooseProduct(results);\n });\n}", "title": "" }, { "docid": "504583b35f00452bc3cd391ba4cf6649", "score": "0.6103948", "text": "function listaProdutos() {\n produtoS('budweiser', 'Budweiser', 'Budweiser', 2.00, 2.00)\n produtoS('cheers', 'Cheers', 'Cheers', 2.00, 2.00)\n produtoS('corona', 'Corona', 'Corona', 2.00, 2.00)\n produtoS('heineken', 'Heineken', 'Heineken', 2.00, 2.00)\n produtoS('sagres', 'Sagres', 'Sagres', 2.00, 2.00)\n produtoS('superBock', 'SuperBock', 'Super Bock', 2.00, 2.00)\n produtoS('caipirinha', 'Caipirinha', 'Caipirinha', 6.00, 6.00)\n produtoS('cosmopolitan', 'Cosmopolitan', 'Cosmopolitan', 6.00, 6.00)\n produtoS('manhattan', 'Manhattan', 'Manhattan', 6.00, 6.00)\n produtoS('margarita', 'Margarita', 'Margarita', 6.00, 6.00)\n produtoS('martini', 'Martini', 'Martini', 6.00, 6.00)\n produtoS('mojito', 'Mojito', 'Mojito', 6.00, 6.00);\n produtoS('morangoska', 'Morangoska', 'Morangoska', 6.00, 6.00)\n produtoS('pinaColada', 'PinaColada', 'Pina Colada', 6.00, 6.00)\n produtoS('vodkaLaranja', 'VodkaLaranja', 'Vodka Laranja', 6.00, 6.00)\n produtoS('gin', 'Gin', 'Gin', 6.00, 6.00)\n produtoS('vodkaRedBull', 'VodkaRedBull', 'Vodka RedBull', 6.00, 6.00)\n produtoS('rumCola', 'RumCola', 'Rum Cola', 6.00, 6.00)\n produtoS('7up', '7Up', '7 Up', 2.00, 2.00)\n produtoS('cocaCola', 'CocaCola', 'Coca Cola', 2.00, 2.00)\n produtoS('colaZero', 'ColaZero', 'Coca Cola Zero', 2.00, 2.00)\n produtoS('fantaAnanas', 'FantaAnanas', 'Fanta Ananás', 2.00, 2.00)\n produtoS('fantaLaranja', 'FantaLaranja', 'Fanta Laranja', 2.00, 2.00)\n produtoS('fantaUva', 'FantaUva', 'Fanta Uva', 2.00, 2.00)\n produtoS('guarana', 'Guarana', 'Guaraná', 2.00, 2.00)\n produtoS('pepsi', 'Pepsi', 'Pepsi', 2.00, 2.00)\n produtoS('pepsiTwist', 'PepsiTwist', 'Pepsi Twist', 2.00, 2.00)\n produtoS('sumolLaranja', 'SumolLaranja', 'Sumol Laranja', 2.00, 2.00)\n produtoS('sumolAnanas', 'SumolAnanas', 'Sumol Ananas', 2.00, 2.00)\n produtoS('amendoim', 'Amendoins', 'Amendoim', 1.20, 1.20)\n produtoS('batata', 'BatatasFritas', 'Batatas Fritas', 1.00, 1.00)\n produtoS('caju', 'Cajus', 'Cajus', 1.20, 1.20)\n produtoS('pistachio', 'Pistachios', 'Pistachios', 1.20, 1.20)\n produtoS('hamburguerSimples', 'HamburguerSimples', 'Hamburguer Simples', 2.50, 2.50)\n produtoS('hamburguerBacon', 'HamburguerBacon', 'Hamburguer Bacon', 3.50, 3.50)\n produtoS('hamburguerQueijo', 'HamburguerQueijo', 'Hamburguer Queijo', 3.00, 3.00)\n produtoS('hamburguerTudo', 'HamburguerTudo', 'Hamburguer Tudo', 4.00, 4.00)\n produtoS('cachorroSimples', 'CachorroSimples', 'Cachorro Simples', 2.50, 2.50)\n produtoS('cachorroTudo', 'CachorroTudo', 'Cachorro Tudo', 3.50, 3.50)\n produtoS('tostaFiambre', 'TostaFiambre', 'Tosta Fiambre', 2.00, 2.00)\n produtoS('tostaQueijo', 'TostaQueijo', 'Tosta Queijo', 2.00, 2.00)\n produtoS('tostaMista', 'TostaMista', 'Tosta Mista', 2.50, 2.50)\n }", "title": "" }, { "docid": "a743899874f043cbd5c0e8dc63bae24e", "score": "0.6100841", "text": "function displayAllProducts() {\n connection.query(\"SELECT * FROM products\", function(error, res) {\n for (var i = 0; i < res.length; i++) {\n console.log(res[i].item_id + \" | \" + res[i].product_name + \" | \" + res[i].department_name + \" | \" + res[i].price);\n }\n console.log(\"-----------------------------------\")\n console.log(\"-----------------------------------\")\n });\n}", "title": "" }, { "docid": "34f66c33bb1a3a5f5c64bd6d54e6e944", "score": "0.6096365", "text": "function productsForSale() {\n connection.query(\n `SELECT item_id ID, \n product_name Name,\n price Price,\n stock_quantity Quantity\n FROM products`,\n function (error, res) {\n if (error) console.error(error);\n\n res.forEach(element => {\n console.log(\"ID: \" + element.ID);\n console.log(\"Product: \" + element.Name);\n console.log(\"Price: \" + element.Price);\n console.log(\"Quantity: \" + element.Quantity);\n console.log(separator)\n });\n start();\n });\n}", "title": "" }, { "docid": "f88322cb665976c58f68cd82adbf7ed4", "score": "0.6089002", "text": "function viewProducts() {\n\n connection.query('SELECT * FROM products', function(error, results, fields) {\n if (error) throw error;\n for (let i = 0; i < results.length; i++) {\n console.log('ID: ' + results[i].id + ' | ' +\n ' MODEL NUMBER: ' + results[i].product_name + ' | ' +\n ' PRICE: ' + results[i].price + ' | ' + ' QUANTITY: ' + results[i].stock_quantity +\n '\\n =========================================================== '\n );\n }\n });\n \n}", "title": "" }, { "docid": "af43f06f3cb98597f94c7d4c98597924", "score": "0.6070669", "text": "function getProducts(sbc_id) {\n var pagina = 'ProductAccessory/listProductsById';\n var par = '[{\"sbc_id\":\"' + sbc_id + '\"}]';\n var tipo = 'json';\n var selector = putProducts;\n fillField(pagina, par, tipo, selector);\n}", "title": "" }, { "docid": "6600627661ac195c1a11c96391838d1f", "score": "0.60663235", "text": "function displayProducts() {\n \n // show welcome text and the table\n console.log(\"\\n----------------------------------------------------\\n\");\n console.log(chalk.blue.bold(\"Welcome to the Parts and Planes Store! \\nFollow the prompts to purchase, or press the Q key to leave the store.\"));\n console.log(\"\\n----------------------------------------------------\\n\");\n \n var startInput = getTable();\n \n // TODO: change to ajax/promise\n setTimeout(buyProduct, 500);\n}", "title": "" }, { "docid": "ac3ba264ba8346ccedd9611c30bf0e4b", "score": "0.60659325", "text": "allProducts(productsListFromProps) {\n if (productsListFromProps.length > 0) {\n const l = productsListFromProps.length;\n let indexedProductsAll = [];\n for (let x = 0; x < l; x++) {\n indexedProductsAll.push({ seqNumb: x, details: productsListFromProps[x] })\n }\n return indexedProductsAll;\n } else {\n return [];\n }\n }", "title": "" }, { "docid": "54653ed02a09894dcc3fc18f4c239f37", "score": "0.6061914", "text": "function displayAll (){\n\tconnection.query('SELECT item_id, product_name, price FROM products', function(err,res){\n\tif (err) throw err;\n\tfor (var i=0; i<res.length;i++){\n\t\tconsole.log(\"id: \" + res[i].item_id + \" name: \"+ res[i].product_name + \" price: \"+ res[i].price);\n\t};\n});\n\n}", "title": "" }, { "docid": "2c991f56143e8bb1b436e9fca5548ec9", "score": "0.6053807", "text": "function DisplayAll(){\n\tconnection.query(\"SELECT * FROM products\",\n\tfunction(err,res){\n\t\tif (err) throw err;\n\t\tprintInConsole(res);\n });\n}", "title": "" }, { "docid": "6271d3f74682aa2edb84af973b900b19", "score": "0.60533816", "text": "function viewProducts(){\n\tvar query = 'SELECT item_id, product_name, price, stock_quantity FROM products';\n\n\tconnection.query(query, function(err, results){\n\t\tif(err) throw err;\n\n\t\tconsole.log('\\n');\n\t\tconsole.table(results);\n\t\tstart();\n\t});\t\n}", "title": "" }, { "docid": "1b07d27f2cb7941352eedfb5f651b668", "score": "0.6052717", "text": "function displayProducts () {\n // var to reset table variable\n var table = new Table(tableKey)\n // reset inventory array\n inventory = []\n console.log(gradient.vice('\\nConnecting to store...'))\n // mysql connection\n connection.query('SELECT B.department_id, A.department_name, B.over_head_costs, SUM(A.product_sales) AS Sales, SUM(A.product_sales) - B.over_head_costs AS Profit FROM products A, departments B WHERE A.department_name = B.department_name GROUP BY department_name ORDER by department_id', function (err, result) {\n if (err) throw err\n buildtable(result, table)\n ask()\n }\n )\n}", "title": "" }, { "docid": "844a77868a20ad65563b9cdf23544bda", "score": "0.6045269", "text": "function showProduct() {\n //To connect to the database and to show the id, product and price in the table\n connection.query(\"SELECT item_id,product_name,price FROM products\", function (err, results) {\n if (err) throw err;\n console.log('\\n Welcome! here is the avaiable items in our store\\n')\n console.table(results);\n //To run the shopping function (note:must put inside the query otherwise it may run before list shown)\n shopping();\n })\n}", "title": "" }, { "docid": "dbf08897dccdc8e1ac1f7bbec80fb795", "score": "0.6044648", "text": "getComapreProducts() {\n const itemsStream = new rxjs__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"](observer => {\n observer.next(products);\n observer.complete();\n });\n return itemsStream;\n }", "title": "" }, { "docid": "9cb891c028bc9ab2571912c6054ad71e", "score": "0.6035082", "text": "async getProductList (limit = 50) {\n const stripe_id = await this.getStoreStripeAccountId();\n return new Promise((resolve, reject) => {\n this.stripe.products.list(\n {\n limit\n },\n stripe_id,\n function (err, products) {\n if (err) {\n pino.error(err);\n return reject(err);\n }\n\n return resolve(products);\n }\n );\n });\n }", "title": "" }, { "docid": "97c01d7a4555e6437b0ef37f7efcce8a", "score": "0.6032122", "text": "function productsForSale () {\n [\n connection.query('SELECT * FROM products', function (err, res) {\n if (err) throw err\n // console.log(res)\n let table = new Table({\n head: ['SKU', 'Product', 'Price', 'Department', 'Quantity']\n })\n for (var i = 0; i < res.length; i++) {\n // pushes items into choicesArray\n let inventoryItem = [\n sku = res[i].sku,\n productname = res[i].product_name,\n price = res[i].price,\n departmentname = res[i].department_name,\n stockquantity = res[i].stock_quantity\n ]\n table.push([`${sku}`,\n `${productname}`,\n `${price}`,\n `${departmentname}`,\n `${stockquantity}`])\n }\n console.log(table.toString())\n connection.end()\n })\n ]\n}", "title": "" }, { "docid": "4bcadefad8c1261c63ca3c7ac608e811", "score": "0.6030813", "text": "function getProducts() {\n\t//ACHTUNG VOR DER ABGABE MUSS UNBEDINGT BEI DEN IMAGES DER PFAD UEBERPRUEFT WERDEN\n\tfetch(url + \"products/\")\n\t.then(function(response){\n\t\tif (response.status !== 200) {\n\t\t\tconsole.log(\"Looks like there was a problem. Status Code: \" + response.status);\n\t\t\treturn;\n\t\t}\n\n\t\tresponse.json().then(function(data){\n\t\t\tconsole.log(data);\n\t\t\t//var product = data.results; \n\t\t\tfor(var i = 0; i < data.length; i++) {\n\t\t\t\t\tcreateOneProduct(data[i]);\n\t\t\t}\n\t\t})\n\t});\n}", "title": "" }, { "docid": "8c81d9de528871305402e66d4d900943", "score": "0.60090494", "text": "function productsView(){\n connection.query('SELECT * FROM Products', function(err, result) {\n for (var i = 0; i<result.length; i++) {\n console.log(\"Item ID: \" + result[i].itemId + \" | Product Name: \" + result[i].productName + \" | Department Name: \" + result[i].departmentName + \" | price: \" + result[i].price + \" | Stock Quantity: \" + result[i].stockQuantity);\n productList.push(result[i]);\n console.log(\"---------------------------------------------------------------------------------------------------------------\");\n }\n menu();\n })\n}", "title": "" }, { "docid": "33e4a2bcff83f5ecb3a5c56285f9842c", "score": "0.6000136", "text": "function listProducts() {\r\n\r\n\tvar output = \"\";\r\n\r\n // Handle the product objects from the array. Use i to index the array.\r\n\t/*\r\n\tfor (var i in products) { \r\n\r\n output += ( \"<br><br>Number: \" + products[i].number + \r\n \"<br>Name: \" + products[i].name +\r\n \"<br>Price: \" + products[i].price +\r\n \"<br>Description: \" + products[i].description )\r\n \r\n \t}*/\r\n \t\r\n \t\r\n \t//for (var i in products) { \r\n\t//\tvar TV = products[i];\r\n\t\r\n \tfor (var TV of products) { \r\n \t\toutput += \"<br>\";\r\n \t\tfor (var key in TV){\r\n \t\toutput += \"<br>\" +key +\": \" + TV[key]; //TV[key] == TV.key products.length\r\n \t\t}\r\n \t}\r\n \t\r\n // Write the output text to the web page (=to the DOM that browser then shows) \r\n\tdocument.getElementById(\"productList\").innerHTML = output;\r\n}", "title": "" }, { "docid": "edfee4c05d63b2b5adc31cd496db12af", "score": "0.59980196", "text": "function displayProducts(products) {\n products.forEach((product) => {\n const row = createProductLine(product);\n listePanier.appendChild(row);\n });\n}", "title": "" }, { "docid": "60c946b8bb814f40a67d40cb7e91b9be", "score": "0.5991368", "text": "async getProducts(amt = 1000) {\n const req = {\n accessToken: this.accessToken,\n }\n // const options = {\n // headers: {\n // 'Content-Type': 'application/json'\n // },\n // method: 'POST',\n // body: JSON.stringify(req)\n // }\n\n // let products = await fetch(\"/getProducts\", options);\n // products = products.json();\n\n let products = [];\n // Get the list of product IDs.\n let productIDs = await fetch('https://hallam.sci-toolset.com/discover/api/v1/products/search', {\n method: 'POST',\n body: `{\"size\":${amt}, \"keywords\":\"\"}`,\n headers: {\n 'Accept': '*/*',\n 'Authorization': 'Bearer ' + this.accessToken,\n 'Content-Type': 'application/json'\n }\n })\n\n // Load the data of each Product.\n if (productIDs.ok) {\n productIDs = await productIDs.json();\n\n for (let p of productIDs.results.searchresults) {\n // console.log(p);\n\n let productData = await fetch(\"https://hallam.sci-toolset.com/discover/api/v1/products/\" + p.id, {\n headers: {\n Authorization: 'Bearer ' + this.accessToken,\n },\n })\n\n products.push(await productData.json());\n }\n }\n\n return products;\n }", "title": "" }, { "docid": "425a79e7b62dc852296774a12c247715", "score": "0.59901476", "text": "function getProduct() {\n var listPr = getPrFromLocal();\n addTotalPrToView(listPr.length);\n if (listPr.length > 0) {\n for (var i = 0; i < listPr.length; i++) {\n getPrFromServer(listPr[i].prid, bindingPrById, listPr[i].total, i);\n }\n }\n else {\n //\n }\n}", "title": "" }, { "docid": "0a0726ce013b03fb8188c6d18b491bd8", "score": "0.5988804", "text": "static getAllProducts() {\n return db.any(`select * from products`)\n }", "title": "" }, { "docid": "f7b6fc274edd8ab2ead74229d746c861", "score": "0.5977273", "text": "function displayProducts(products) {\n let html ='';\n for (let i = 0; i < products.length; i++) {\n let product = products[i];\n html += renderHTMLProduct(product,'list');\n }\n document.getElementById('result').innerHTML = html; \n}", "title": "" }, { "docid": "718e1fac878d4ef198ec6ba9bb7f533a", "score": "0.5970823", "text": "queryItemsForSale() {\n return this.client.query(\n q.Map(\n q.Paginate(q.Match(q.Index(\"items_for_sale\"), true)),\n (row) =>\n q.Let({doc : q.Get(row)}, {\n ref : q.Select([\"ref\"], q.Var(\"doc\")),\n data : {\n label : q.Select([\"data\",\"label\"], q.Var(\"doc\")),\n price : q.Select([\"data\",\"price\"], q.Var(\"doc\")),\n owner : q.Select([\"data\",\"owner\"], q.Var(\"doc\")),\n owner_name :\n q.Select([\"data\",\"name\"],\n q.Get(q.Select([\"data\",\"owner\"], q.Var(\"doc\"))))\n }\n })\n )\n );\n }", "title": "" }, { "docid": "eb13664d115e652bf9ba1c4914b028e4", "score": "0.5970802", "text": "function displayProducts() {\n console.log(\"Selecting all products...\\n\");\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n console.log(\"=======================================================\");\n console.log(\"ID\\tProduct\\t\\tPrice\\tQuantity\");\n console.log(\"=======================================================\");\n res.forEach(element => {\n //Trick to format so that columns are properly aligned\n let extraTab = element.product_name.length < 8 ? \"\\t\\t\" : \"\\t\";\n console.log(\n `${element.item_id}\\t${element.product_name}${extraTab}${element.price}\\t${element.stock_quantity}`\n );\n });\n promptUser(res);\n });\n}", "title": "" }, { "docid": "711b666ffc4230680e3ab28c88e58379", "score": "0.5966246", "text": "function viewAllProducts(){\n let query = \"SELECT * FROM products\"\n connection.query(query,function(err,res){\n if(err){throw err};\n console.log(\"\\n===============\\n\")\n res.forEach(function(prod){\n if (prod.stock_quantity < 5){\n console.log(colors.red(`ID: ${prod.id} - ${prod.product_name} - $${prod.price} || Stock Quantity: ${prod.stock_quantity}`));\n }\n else{\n console.log(`ID: ${prod.id} - ${prod.product_name} - $${prod.price} || Stock Quantity: ${prod.stock_quantity}`);\n }\n })\n console.log(\"\\n===============\\n\")\n showMenu();\n })\n}// end of view all products fn;", "title": "" }, { "docid": "3aaba183ea6cf1367ffb7b07d1e4142b", "score": "0.5964978", "text": "RetrieveListOfCatalogName() {\n let url = `/order/catalog/formatted`;\n return this.client.request('GET', url);\n }", "title": "" }, { "docid": "3f9b90d123b650d07b00250337c04d99", "score": "0.59647876", "text": "function productList(res) {\n console.table(res)\n console.log(\"*******************************************************************\");\n afterConnection();\n }", "title": "" }, { "docid": "be27f58cdf4d4873a601731dad4d46e9", "score": "0.59545755", "text": "function viewProducts(){\n connection.query(\"SELECT * FROM products\",\n function(err, res){\n if(err) throw err;\n console.table(res);\n });\n}", "title": "" }, { "docid": "13bf5f77a3a039fd7118ec012cc5cca2", "score": "0.5946525", "text": "function catalog() {\n connection.query(\"SELECT * FROM products\", function(err, results){\n catalogLength = 0; \n catalogLength = results.length;\n\n if (err) throw err;\n for(i=0; i<results.length; i++){\n console.log(\"Item #: \" + results[i].id + \"\\n\" +\n \"Item Name: \" + results[i].name + \"\\n\" + \n \"Department: \" + results[i].department_name + \"\\n\" + \n \"Price: $\" + results[i].price + \"\\n\");\n };\n\n productNumber();\n }); \n }", "title": "" }, { "docid": "1323a0223a180aa5ed32c8c9370c1865", "score": "0.59425205", "text": "function productsScreen() {\n connection.query('SELECT * FROM products', function (err, res) {\n if (err) throw err;\n console.log(\"Items to buy\");\n for (var i = 0; i < res.length; i++) {\n console.log('Item ID: ' + res[i].id);\n console.log('Product Name: ' + res[i].product);\n console.log('Department: ' + res[i].department);\n console.log('Price: ' + res[i].price);\n console.log('Stock Quantity: ' + res[i].stock_quanity);\n console.log('------------------------------------------');\n } \n initialize();\n });\n}", "title": "" }, { "docid": "74ee229934d9e3bbce945b1735dbb097", "score": "0.5936217", "text": "function loadAll(data) {\n\n console.log(data.products);\n var products = data.products;\n\n return products.map(function (product) {\n return {\n value: product.id,\n name_uk: product.name_uk,\n name_en: product.name_en,\n display: product.name_en,\n img: product.img,\n coordinates: product.coordinates\n };\n });\n }", "title": "" }, { "docid": "a350dacbb20f3b7e9608c381059ff96c", "score": "0.59241354", "text": "async getSale(req, res) {\n try {\n const id = req.params.id;\n const sale = await Sales.findAll({\n where: { id: id },\n include:[{model:db.product},{model:db.user} ]\n });\n if (sale.length >= 1) return res.status(200).send(sale);\n return res.status(404).send(\"Sale with id \"+id+\"not found\");\n } catch (error) {\n res.status(500).send(error);\n }\n }", "title": "" }, { "docid": "239db0c861ad64d52e8e6700d12c4c24", "score": "0.5923763", "text": "function displayAllProducts() {\n log(\"Selecting all products...\\n\");\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n // Log all results of the SELECT statement\n \n for (i=0; i<res.length;i++){\n log(chalk.white(\"Item ID: \",res[i].item_id));\n log(chalk.red(\"Product Name: \", res[i].product_name));\n log(chalk.blue(\"Department: \", res[i].department_name));\n log(chalk.green(\"Price: \",res[i].price));\n log(chalk.yellow(\"# in Stock: \",res[i].stock_quantity));\n // log(chalk.keyword('orange')(\"Sales: \",res[i].product_sales));\n log(\"---------------\");\n }\n displayPrompts();\n // connection.end();\n });\n\n function displayPrompts(){\n let inquirer = require(\"inquirer\");\n\n inquirer.prompt([\n {\n type: \"input\",\n name: \"id\",\n message: \"Please enter an item ID\"\n },\n {\n type: \"input\",\n name: \"quantity\",\n message: \"Please enter the quantity you would like to purchase\"\n }\n ]).then(answers =>{\n id = answers.id;\n quantity = answers.quantity;\n checkQuantity(id, quantity);\n });\n\n }\n\n}", "title": "" }, { "docid": "d3b56fe2940b22a5dc41a3766ea285bd", "score": "0.5921478", "text": "function viewProducts() {\n connection.query(\"SELECT * FROM products\", function (err, res) {\n\n for (var i = 0; i < res.length; i++) {\n console.log(\"\\---------------------------------------------\\n Item ID: \" + res[i].item_id + \"\\n Product: \" + res[i].product_name + \"\\n Department: \" + res[i].department_name + \"\\n Price $\" + res[i].price + \"\\n Inventory Stock: \" + res[i].stock_quantity);\n }\n console.log(\"\\---------------------------------------------\\n\")\n \n // Returns to the menu\n menu();\n });\n}", "title": "" }, { "docid": "a149294da75de7d257870d6331ab2da0", "score": "0.59208786", "text": "function get_products(e) {\n\t\tloading();\n\t\tvar retailer_name = e.dataPoint.name;\n\t\t$.ajax({\n\t\t\turl : 'get_products_view/'+retailer_name,\n\n\t\t\tmethod : 'POST',\n\t\t\tdataType: 'json',\n\t\t\tsuccess : function(data)\n\t\t\t{\n\t\t\t\tunloading();\n\t\t\t\tif(typeof rev_store_tb_obj == 'object'){\n\t\t\t\t\trev_store_tb_obj.fnDestroy();\n\t\t\t\t}\n\t\t\t\t$(\"#products_listing tbody\").html(data);\n\t\t\t\trev_store_tb_obj = $(\"#products_listing\").dataTable({\n\t\t\t\t\t\"iDisplayLength\":100,\n\t\t\t\t\t\"lengthMenu\": [ 25, 50, 75, 100 ],\n\t\t\t\t\tfnDrawCallback: function( oSettings ) {\n\t\t\t\t\t\tvar elm = $('select[name=products_listing_length]').parent().parent();\n\t\t\t\t\t\t$('select[name=products_listing_length]').parent().remove();\n\t\t\t\t\t\telm.html('<div class=\"form-group\" style=\"margin-bottom: 5px;\"><label>Search</label><input type=\"text\" id=\"retailer_product_search\" class=\"form-control\"></div>');\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t//\t\t\t\t$(\"#products_listing tbody\").html(data);\n\t\t\t\t$('#retailer_name').text(retailer_name);\n\n\t\t\t\t$('html, body').animate({\n\t\t\t\t\tscrollTop:$('#products_details').position().top\n\t\t\t\t}, 'slow');\n\t\t\t\t$(\"#products_details\").removeClass('hide');\n\t\t\t\t$('html, body').animate({\n\t\t\t\t\tscrollTop: $(\"#products_details\").offset().top\n\t\t\t\t}, 100);\n\t\t\t},\n\t\t\terror: function(){\n\t\t\t\tunloading();\n\t\t\t}\n\t\t});\n\t}", "title": "" }, { "docid": "693bdc738d8151a727332d80a541eaae", "score": "0.5914801", "text": "function filterProductBySaleDate2(listProduct){\n let list = [], j = 0;\n for (let i=0; i<listProduct.length; i++){\n if(!listProduct[i].isDelete && listProduct[i].saleDate > now && listProduct[i].quantity>0){\n list[j++] = {\n id : listProduct[i].id,\n name : listProduct[i].name\n };\n }\n }\n\n return list;\n}", "title": "" }, { "docid": "52f8b447d6103286e8b0494e9fa7ef27", "score": "0.59105074", "text": "function saleData(products, totals) {\n var table = document.getElementById('sale');\n var rows = table.rows;\n var totalSale = rows[1].cells[2];\n products.forEach(product => {\n var row = $('<tr />');\n $('#sale').append(row);\n row.append($('<td>' + product.prod_name + '</td>'));\n row.append($('<td>' + product.quantity + '</td>'));\n row.append($('<td>' + product.price + '</td>'));\n });\n totalSale.innerHTML = totals;\n}", "title": "" }, { "docid": "6023de58843869bf5554d640b06117c3", "score": "0.5907513", "text": "function viewProducts() {\n connection.query(\"SELECT * FROM products\", function (err, res) {\n if (err) throw err;\n console.table(res);\n // Select new action from menu\n managerMenu();\n })\n}", "title": "" }, { "docid": "b24d6ec0d45de461b2873ad4cd5b0dba", "score": "0.59060097", "text": "function queryResults(err, results) {\n if(err) {\n console.log(err);\n };\n \n // Loop displays products\n console.log(\"Product Catalog \\n\");\n for (i = 0; i < 10; i++) {\n console.log(\"Id: \" + results[i].id + \"\\t\" + \"Product: \" + results[i].product_name + \" (Price: $\" + results[i].price + \")\");\n\n };\n\n // Start shopping\n shopping(results);\n}", "title": "" } ]
1d6ad6b7d199b466b8e33d5acc7d5c17
A crude way of determining if an object is a window
[ { "docid": "e3996983e3fffb0c1b331b3f87ffa008", "score": "0.8226494", "text": "function isWindow(obj) {\n\t // must use == for ie8\n\t /*jshint eqeqeq:false*/\n\t return obj != null && obj == obj.window;\n\t}", "title": "" } ]
[ { "docid": "f3992143c6d5367030372db0fd806feb", "score": "0.8638745", "text": "function isWindow(obj){return obj!==null&&obj===obj.window;}", "title": "" }, { "docid": "c0f7688b0308352cac609295513698b9", "score": "0.8427498", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "c0f7688b0308352cac609295513698b9", "score": "0.8427498", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "c0f7688b0308352cac609295513698b9", "score": "0.8427498", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "c0f7688b0308352cac609295513698b9", "score": "0.8427498", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "c0f7688b0308352cac609295513698b9", "score": "0.8427498", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "c0f7688b0308352cac609295513698b9", "score": "0.8427498", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "c0f7688b0308352cac609295513698b9", "score": "0.8427498", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "077fe25bcf5a7dfd05411079a0885a5f", "score": "0.8408737", "text": "function isWindow(obj) {\r\n return obj !== null && obj === obj.window;\r\n }", "title": "" }, { "docid": "077fe25bcf5a7dfd05411079a0885a5f", "score": "0.8408737", "text": "function isWindow(obj) {\r\n return obj !== null && obj === obj.window;\r\n }", "title": "" }, { "docid": "065bccbd0dad12aa768e299984efa9a8", "score": "0.8394922", "text": "function isWindow( obj ) {\n\n if ( obj === root ) {\n return true;\n }\n\n if ( !obj || typeof obj !== \"object\" ) {\n return false;\n }\n\n if ( !isEnvNode && obj.window !== obj ) {\n return false;\n }\n\n var className = getTag( obj );\n\n return className === strWin || className === strWin2;\n\n}", "title": "" }, { "docid": "68243bddbb30d43110d0235b9f3bef53", "score": "0.8392342", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "68243bddbb30d43110d0235b9f3bef53", "score": "0.8392342", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "68243bddbb30d43110d0235b9f3bef53", "score": "0.8392342", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "68243bddbb30d43110d0235b9f3bef53", "score": "0.8392342", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "68243bddbb30d43110d0235b9f3bef53", "score": "0.8392342", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "68243bddbb30d43110d0235b9f3bef53", "score": "0.8392342", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "68243bddbb30d43110d0235b9f3bef53", "score": "0.8392342", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "68243bddbb30d43110d0235b9f3bef53", "score": "0.8392342", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "68243bddbb30d43110d0235b9f3bef53", "score": "0.8392342", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "68243bddbb30d43110d0235b9f3bef53", "score": "0.8392342", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "68243bddbb30d43110d0235b9f3bef53", "score": "0.8392342", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "68243bddbb30d43110d0235b9f3bef53", "score": "0.8392342", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "68243bddbb30d43110d0235b9f3bef53", "score": "0.8392342", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "68243bddbb30d43110d0235b9f3bef53", "score": "0.8392342", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "68243bddbb30d43110d0235b9f3bef53", "score": "0.8392342", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "68243bddbb30d43110d0235b9f3bef53", "score": "0.8392342", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "68243bddbb30d43110d0235b9f3bef53", "score": "0.8392342", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "68243bddbb30d43110d0235b9f3bef53", "score": "0.8392342", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "68243bddbb30d43110d0235b9f3bef53", "score": "0.8392342", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "68243bddbb30d43110d0235b9f3bef53", "score": "0.8392342", "text": "function isWindow(obj) {\n return obj !== null && obj === obj.window;\n }", "title": "" }, { "docid": "f9a2e2238026d3c465417d2c40347292", "score": "0.83668685", "text": "function isWindow(obj) {\n\t /* eslint no-eq-null: 0 */\n\t /* eslint eqeqeq: 0 */\n\t return obj != null && obj == obj.window;\n\t}", "title": "" }, { "docid": "f25594412d64842866951d9ffff4250f", "score": "0.83650583", "text": "function isWindow(obj) {\r\n return obj !== null && obj === obj.window;\r\n }", "title": "" }, { "docid": "e1a52e48fab36153320a70958d3519ca", "score": "0.8353763", "text": "function isWindow(obj) {\r\n\t /* eslint no-eq-null: 0 */\r\n\t /* eslint eqeqeq: 0 */\r\n\t return obj != null && obj == obj.window;\r\n\t}", "title": "" }, { "docid": "e08fec250649472630dd3fcb360492df", "score": "0.8350056", "text": "static isWindow(object){return![undefined,null].includes(object)&&typeof object==='object'&&'window'in object&&object===object.window}", "title": "" }, { "docid": "bc27eaf56c47418d4361a4611502e14d", "score": "0.8316734", "text": "function isWindow(obj) {\n\t return obj !== null && obj === obj.window;\n\t }", "title": "" }, { "docid": "c35f13d2333664b0def2b1497780a75c", "score": "0.8289678", "text": "function isWindow(obj) {\n /* eslint no-eq-null: 0 */\n /* eslint eqeqeq: 0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "1920835350e7f43d6d2518175cc9f687", "score": "0.82223046", "text": "function isWindow(obj) {\n\t // must use == for ie8\n\t /* eslint eqeqeq:0 */\n\t return obj != null && obj == obj.window;\n\t}", "title": "" }, { "docid": "1920835350e7f43d6d2518175cc9f687", "score": "0.82223046", "text": "function isWindow(obj) {\n\t // must use == for ie8\n\t /* eslint eqeqeq:0 */\n\t return obj != null && obj == obj.window;\n\t}", "title": "" }, { "docid": "1920835350e7f43d6d2518175cc9f687", "score": "0.82223046", "text": "function isWindow(obj) {\n\t // must use == for ie8\n\t /* eslint eqeqeq:0 */\n\t return obj != null && obj == obj.window;\n\t}", "title": "" }, { "docid": "1920835350e7f43d6d2518175cc9f687", "score": "0.82223046", "text": "function isWindow(obj) {\n\t // must use == for ie8\n\t /* eslint eqeqeq:0 */\n\t return obj != null && obj == obj.window;\n\t}", "title": "" }, { "docid": "1920835350e7f43d6d2518175cc9f687", "score": "0.82223046", "text": "function isWindow(obj) {\n\t // must use == for ie8\n\t /* eslint eqeqeq:0 */\n\t return obj != null && obj == obj.window;\n\t}", "title": "" }, { "docid": "1920835350e7f43d6d2518175cc9f687", "score": "0.82223046", "text": "function isWindow(obj) {\n\t // must use == for ie8\n\t /* eslint eqeqeq:0 */\n\t return obj != null && obj == obj.window;\n\t}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "ad959175d9cbc6e8d5688bb23da52ee9", "score": "0.81798154", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}", "title": "" }, { "docid": "2a271e8f9b88b5be9a9b281f06a1348a", "score": "0.8169672", "text": "function isWindow(obj) {\n\t // must use == for ie8\n\t /* eslint eqeqeq:0 */\n\t return obj !== null && obj !== undefined && obj == obj.window;\n\t}", "title": "" }, { "docid": "2a271e8f9b88b5be9a9b281f06a1348a", "score": "0.8169672", "text": "function isWindow(obj) {\n\t // must use == for ie8\n\t /* eslint eqeqeq:0 */\n\t return obj !== null && obj !== undefined && obj == obj.window;\n\t}", "title": "" }, { "docid": "2a271e8f9b88b5be9a9b281f06a1348a", "score": "0.8169672", "text": "function isWindow(obj) {\n\t // must use == for ie8\n\t /* eslint eqeqeq:0 */\n\t return obj !== null && obj !== undefined && obj == obj.window;\n\t}", "title": "" }, { "docid": "2a271e8f9b88b5be9a9b281f06a1348a", "score": "0.8169672", "text": "function isWindow(obj) {\n\t // must use == for ie8\n\t /* eslint eqeqeq:0 */\n\t return obj !== null && obj !== undefined && obj == obj.window;\n\t}", "title": "" }, { "docid": "2a271e8f9b88b5be9a9b281f06a1348a", "score": "0.8169672", "text": "function isWindow(obj) {\n\t // must use == for ie8\n\t /* eslint eqeqeq:0 */\n\t return obj !== null && obj !== undefined && obj == obj.window;\n\t}", "title": "" }, { "docid": "2a271e8f9b88b5be9a9b281f06a1348a", "score": "0.8169672", "text": "function isWindow(obj) {\n\t // must use == for ie8\n\t /* eslint eqeqeq:0 */\n\t return obj !== null && obj !== undefined && obj == obj.window;\n\t}", "title": "" }, { "docid": "2a271e8f9b88b5be9a9b281f06a1348a", "score": "0.8169672", "text": "function isWindow(obj) {\n\t // must use == for ie8\n\t /* eslint eqeqeq:0 */\n\t return obj !== null && obj !== undefined && obj == obj.window;\n\t}", "title": "" }, { "docid": "2a271e8f9b88b5be9a9b281f06a1348a", "score": "0.8169672", "text": "function isWindow(obj) {\n\t // must use == for ie8\n\t /* eslint eqeqeq:0 */\n\t return obj !== null && obj !== undefined && obj == obj.window;\n\t}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" }, { "docid": "a992dd150a95d35a5eb735e6039c9669", "score": "0.8153487", "text": "function isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}", "title": "" } ]
e845c795df25b2c899425fe87c46c11d
Modal is cleared with this function so new information can be loaded.
[ { "docid": "b99bd7a4e84ce4cd92b2c1adf34f459d", "score": "0.731496", "text": "function clearRecipeModal() {\n $(\"#modal-recipe-image\").removeClass(\"src\");\n $(\"#modal-recipe-name\").empty();\n $(\"#modal-recipe-ingredients\").empty();\n $(\"#modal-recipe-instructions\").empty();\n $(\"#modal-recipe-delete\").empty();\n }", "title": "" } ]
[ { "docid": "9ef97b2cad866da8d129b982c6f23496", "score": "0.80189323", "text": "resetInfoModal() {\n this.infoModal.title = ''\n this.infoModal.content = ''\n }", "title": "" }, { "docid": "45d3f83c4dc5797d67ee1d435ef5ed3f", "score": "0.7577634", "text": "function clearModal() {\n\t\t$('#MapPopup').modal(\"hide\");\n\t}", "title": "" }, { "docid": "0cd360c4346b5039ac5955cd2198efcc", "score": "0.74901897", "text": "function clearModal() {\n $(\"#my_modal .modal-header\").html(\"\");\n $(\"#my_modal .modal-body\").html(\"\");\n }", "title": "" }, { "docid": "a1fecb891a6c772ae565d1b5d0125d25", "score": "0.7292757", "text": "function clearRecipeInfoModal(){\n var recipeDataEl = document.getElementById(\"modal-all\");\n recipeDataEl.style.display = \"none\";\n}", "title": "" }, { "docid": "dc064e6b16438d665deec4b972f6bc86", "score": "0.7106946", "text": "function removeContentOfModal() {\n $('#modal-body-chart-place').empty();\n _global_dialog.find('.col-md-5').empty();\n }", "title": "" }, { "docid": "a3b536991914d83008c224d2dff6b0f8", "score": "0.7030557", "text": "closeModal() {\n if (this.bFormEdited) {\n this.bShowConfirmationModal = true;\n }\n else {\n //re-initialize the track variable after successful transaction\n this.listSelectedRecords = [];\n this.listValidPremise = [];\n this.reasonSelected = false;\n this.dataExisting = null;\n this.dataNew = null;\n this.dataReasonOptions = null;\n this.bFormEdited = false;\n this.bShowLoadingSpinner = false;\n\n this.bShowModal = false;\n }\n }", "title": "" }, { "docid": "2d8e255c008a1a68258a112cb8e8db7c", "score": "0.7006041", "text": "function emptyModal(){\n\n\t$('#demo-modal').css(\"display\", \"none\");\n\t$('#highlight').empty();\n\n}", "title": "" }, { "docid": "6444bcc7ccd6db9a608d8c15f7daad79", "score": "0.70027643", "text": "function clearPromptModal() {\n console.log('In clearPromptModal()');\n var $modalInput = $_promptModal.find('#promptModalInput');\n var $positiveButton = $_promptModal.find('button.positive');\n\n $_promptModal.modal('hide');\n\n $_promptModal.find('.modal-title').text('');\n $modalInput.attr('placeholder', '');\n $modalInput.val('');\n $positiveButton.text('Confirm');\n $positiveButton.unbind('click');\n $_promptModal.find('button.negative').unbind('click');\n }", "title": "" }, { "docid": "2b12e12fef901e9a1354be48a0cccf8b", "score": "0.69689924", "text": "function resetEditRelationshipModal(){\n $(\".m-modal-edit-relationship-name-con > div\").css(\"display\", \"none\");\n}", "title": "" }, { "docid": "62e49629ec01a50c5ef1215cb831ecfa", "score": "0.6965014", "text": "hideInfoModal(){\n infoModal.hide();\n }", "title": "" }, { "docid": "7e3fde5895444106354441e37c75de34", "score": "0.69465095", "text": "function createremoveModalByClickListener() {\n modalContainer.remove();\n modalContainer = '';\n currentModal = '';\n}", "title": "" }, { "docid": "25ce4f321e600275a8ee46c1bac8b897", "score": "0.69456214", "text": "function removerModal() {\n contenedorMod.remove();\n }", "title": "" }, { "docid": "3982c7ce0bfd6662875587dc4196ab5c", "score": "0.6942452", "text": "function clearModal() {\n modal.style.display = 'none';\n document.getElementById('modal-text').innerHTML = \"\";\n}", "title": "" }, { "docid": "caae845c4bbf795e64417930f085af8e", "score": "0.6941149", "text": "function clearConfirmModal() {\n console.log('In clearConfirmModal()');\n var $positiveButton = $_confirmModal.find('button.positive');\n\n $_promptModal.modal('hide');\n\n $_confirmModal.find('.modal-title').text('');\n $_confirmModal.find('.modal-body').text('');\n $positiveButton.text('Confirm');\n $positiveButton.unbind('click');\n $_confirmModal.find('button.negative').unbind('click');\n }", "title": "" }, { "docid": "248d1d75a7164779ed048f8b3aabb13b", "score": "0.69401973", "text": "_closeModal() {\n delete oak.runner.modal;\n oak.updateSoon();\n }", "title": "" }, { "docid": "11ed476e4f87651c777a9a081424bb68", "score": "0.69302607", "text": "function resetModalItems(){\n s('.modal img').src = 'assets/img/placeholder_image.png';\n s('.modal .modal--features-area').innerHTML = \"\";\n s('.modal').setAttribute('data-card', '');\n}", "title": "" }, { "docid": "4daf7867b14cc3e317baad38e25082b5", "score": "0.6920656", "text": "function hideModal() {\n $(\"#modalWindow\").modal(\"hide\");\n $(\"body\").removeClass(\"modal-open\");\n $(\".modal-backdrop\").remove();\n $scope.client.name = \"\";\n $scope.client.email = \"\";\n $scope.client.address = \"\";\n }", "title": "" }, { "docid": "8f37409f3859b707a352215b6e71ee33", "score": "0.6914311", "text": "closeModalForm() {\n this.editModalVisible = false;\n this.itemToEdit = {};\n }", "title": "" }, { "docid": "213e23773ba8ef259cadd0f8866cf5f2", "score": "0.69073355", "text": "hiddenModal() {\n this.showingRegisterModal = false;\n this.showingCostForm = false;\n this.showingModal = false;\n }", "title": "" }, { "docid": "f8cd6c9741ff103f1c830c447ae761ac", "score": "0.68884075", "text": "hideCreationModal(){\n newListingModal.hide();\n }", "title": "" }, { "docid": "bda1468d28d111c164499ee068575d0c", "score": "0.68699855", "text": "function initModal() {\n modal.classList.remove('show-modal');\n modalScore.innerHTML = \"\";\n modalRating.innerHTML = \"\";\n modalTakenTime.innerHTML = \"\";\n}", "title": "" }, { "docid": "c7dd7809212dcea4e60550666450be8b", "score": "0.68600416", "text": "function modalHandler() {\n setModal(!modal);\n }", "title": "" }, { "docid": "5495a55ae7de07bd97c122bde7922318", "score": "0.68287027", "text": "function limpiar_campos_modal_editar() {\n $('.btn-edit-modal').val(\"\");\n $('.titulo').val(\"\");\n $('.user').val(\"\");\n $('.id').val(\"\");\n $('.text').html('');\n $('.select-estado').empty();\n $('.fecha_noticia').val(\"\");\n $('.select-estado').append('');\n $('#modalEdit').find(\".modal-body\").find('.imagen_noticia').append(\"\");\n}", "title": "" }, { "docid": "b4efddbfdfd248a726a6ec7e8e9bcb31", "score": "0.68270105", "text": "function p_destroyModal()\n{\n p_modal.Obj.empty();\n p_modal.Try('hide');\n}", "title": "" }, { "docid": "fbeab26103a0ebed83f0d6d8bf5589ab", "score": "0.6767222", "text": "function removeModal() {\n if (modal) {\n modal.remove();\n }\n }", "title": "" }, { "docid": "581542b5b4ec324cfd90d0a108ec04f0", "score": "0.67561305", "text": "function clearViewModal() {\n document.getElementById(\"item-body\").innerHTML = ''\n}", "title": "" }, { "docid": "0856ff674bf0ff7990dc7847aab25c5f", "score": "0.67401844", "text": "function cargarModalObjetivo(){\n \n //reset al formulario ->limpiar el form\n document.getElementById(\"formPersonal\").reset();\n //abrir modal\n $(\"#formPersonal\").modal('show');\n \n }", "title": "" }, { "docid": "038a62215ef68b0ff1702aa33b7eedd1", "score": "0.6737933", "text": "hideModal() {\n this.setAddToListModalVisible(false);\n }", "title": "" }, { "docid": "9f97146880fb3a508c322cf65a090ffd", "score": "0.6717372", "text": "function showModal(){\n $('#frmpuesto').trigger('reset');\n $('#Mdpuesto').modal('show');\n}", "title": "" }, { "docid": "a1a29439d2ba9bddfbc06cdbb965b8b3", "score": "0.6699303", "text": "function limpiar_modal() {\n $('#formComision').val('');\n }", "title": "" }, { "docid": "93e9e60211b2949739befef39e5e5714", "score": "0.66964126", "text": "function removeAddPopupContent() {\n $(\"#cropList\").empty();\n $('.EditorModal').modal('hide');\n $(\".EditorModal\").css(\"display\", \"none\");\n $(\".EditorModal\").removeClass(\"in\");\n $(\"#inner-content\").removeClass(\"modal-open\");\n $(\".modal-backdrop\").remove(); \n }", "title": "" }, { "docid": "7b9dc59e334e98777e74ffc5716a6ea0", "score": "0.6694128", "text": "function close() {\n bulmaModal.destroy();\n }", "title": "" }, { "docid": "08866790c28d29f6577b219d874099fd", "score": "0.66929317", "text": "function clear_modal() {\n $('#edit_tag_id').val('');\n $('#tag_name').val('');\n $('#tag_description').val('');\n $('#create_tag_name').val('');\n $('#create_tag_description').val('');\n $('#tag_parent').children().each(function () {\n if ($(this).val() != 0) {\n $(this).remove();\n }\n });\n $('#create_tag_parent').children().each(function () {\n if ($(this).val() != 0) {\n $(this).remove();\n }\n });\n $('#create_tag_user_access_selection').empty();\n $('#edit_tag_user_access_selection').empty();\n }", "title": "" }, { "docid": "40d39a56117532e044770a63f70a8ac6", "score": "0.66812366", "text": "handleCloseClick() {\n document.getElementById(\"modal\").style.display = \"none\";\n this.clearInputBoxes();\n }", "title": "" }, { "docid": "a3368aeaaddc5e401bef930dca748c84", "score": "0.6669759", "text": "function fermerModalAdministration()\n {\n fermerModal();\n // refresh de la datatble\n refreshDataTable();\n // On remet l'ancienne class à la modale\n $('#modal-dialog').removeClass('MediumModal').addClass('LargeModal');\n }", "title": "" }, { "docid": "067d2f6ebd6b4aa541b941b2d5b94b9f", "score": "0.6650568", "text": "function clearModal()\n{\n edit.style.display = 'block';\n document.getElementById('post-brand-input').value = \"\";\n document.getElementById('post-type-input').value = \"\";\n document.getElementById('post-code-input').value = \"\";\n document.getElementById('post-color-input').value = \"\";\n document.getElementById('post-quantity-input').value = \"\";\n document.getElementById('post-updated-input').value = \"\";\n document.getElementById('post-name-input').value = \"\";\n document.getElementById('post-min-quantity-warning').value = \"\";\n document.getElementById('post-location-input').value = \"\";\n document.getElementById('post-notes-input').value = \"\";\n}", "title": "" }, { "docid": "4533ae7263b5f81678badaa443c56773", "score": "0.66291076", "text": "function ClearOpenRegisterModal(){\r\n\t$('#openingAmount').val(null);\r\n\t$('#openingNote').val(null);\r\n\t$('#openRegisterModal').modal('hide');\r\n\t$('#passcode').val(null);\r\n\t$('#passcode').focus();\r\n}", "title": "" }, { "docid": "19be840c36d1595b9baf539a2dfbbe11", "score": "0.6627358", "text": "function emptyModal() {\r\n let modalOptions = document.getElementById(\"modal-dependant-issues\").options;\r\n\r\n for (let i = 0; i < modalOptions.length; i++) {\r\n modalOptions[i].selected = false;\r\n }\r\n document.getElementById(\"modal-mode\").value = \"create\";\r\n $(\"#modal\").modal(\"show\");\r\n}", "title": "" }, { "docid": "be4613603f966de155a182b8799b4f47", "score": "0.65946424", "text": "function clearTripModal() {\n $('.entry-input').val('');\n $('.date').val('');\n $('#description-field').val('');\n}", "title": "" }, { "docid": "bf266ca8fbad2725a495bf07bfcd7495", "score": "0.65840757", "text": "function hideModal() {\r\n $(\"#modal\").hide();\r\n //$(\"html\").css(\"overflow\", \"\");\r\n Modal.onModalHide.notify();\r\n Modal.onModalHide.clear();\r\n $(\"#modal\").remove();\r\n }", "title": "" }, { "docid": "3cdd8331b6d83ea99912eb167f9f4cbb", "score": "0.6573933", "text": "function destroyModal() {\n\t\t$('.swatch-modal').remove();\n\t\t$('.jqmOverlay').remove();\n\t}", "title": "" }, { "docid": "5c205bb1286208fd97530a4901c2d9c7", "score": "0.65603215", "text": "closeModal() {\n this.handleCleanUpdate('modalclosed');\n }", "title": "" }, { "docid": "f8b60058053f5e4d81701033458c4d14", "score": "0.6555892", "text": "function closeModal(){\n $('#txtCantidad').val('');//limpiamos los campos\n $('#txtPrecio').val('');\n $('.modal').fadeOut();\n\n}", "title": "" }, { "docid": "7a72f20f7594237bde9cd01012c5e8a6", "score": "0.6554879", "text": "function closeModelDialog() {\n document.getElementById('myModal').style.display = \"none\";\n document.getElementById(\"detailContent\").innerHTML = \"\";\n}", "title": "" }, { "docid": "8d25634d0bc30cfdb23dd7794f2cf2c5", "score": "0.6553046", "text": "function closeModal() {\r\n modal.css('display','none');\r\n }", "title": "" }, { "docid": "b9baa349245e418eac9df597e0f27862", "score": "0.65442586", "text": "function closeModal(){\n modal.style.display = \"none\";\n addModal.style.display = \"none\";\n }", "title": "" }, { "docid": "1c5ffd11884de21591d46163494603c8", "score": "0.6543696", "text": "function resetEditModal(){\n\tdocument.getElementById(\"modal-edit-amount\").value=\"\";\n\tdocument.getElementById(\"edit-notes\").value=\"\";\n}", "title": "" }, { "docid": "a1939a2ad6c59bf9103b76f1abff2771", "score": "0.65314156", "text": "function clearModal(){\n document.querySelector(\"#input-firstname\").value = \"\";\n document.querySelector(\"#input-lastname\").value = \"\";\n document.querySelector(\"#input-grade\").value = \"\";\n document.querySelector(\"#input-age\").value = \"\";\n document.querySelector(\"#input-weekday\").value = \"\";\n document.querySelector(\"#input-date\").value = \"\";\n document.querySelector(\"#input-subject\").value = \"\";\n document.querySelector(\"#input-content\").value = \"\";\n}", "title": "" }, { "docid": "11904c07673adb776d38c35efc5c49ee", "score": "0.6530305", "text": "closeModal() {\n if (this.bFormEdited) {\n this.bShowConfirmationModal = true;\n }\n else {\n //re-initialize the track variable after successful transaction\n this.reasonSelected = false;\n this.bFormEdited = false;\n this.bIfAdjustment = false;\n this.bEditDisabled = true;\n this.dataReasonOptions = null;\n this.dataReinstateTo = null;\n\n this.bShowModal = false;\n }\n }", "title": "" }, { "docid": "e51eefb2faa84ce2414179066f7231fa", "score": "0.6530156", "text": "function clearModal(e)\n{\n if (e.target == modal)\n {\n modal.style.display = 'none';\n }\n}", "title": "" }, { "docid": "33cffdf72bc86c75250b21d97338399c", "score": "0.65266454", "text": "function onCloseModal() {\n\t\tif ( isMediaDestroyed( attributes?.id ) ) {\n\t\t\tsetAttributes( {\n\t\t\t\turl: undefined,\n\t\t\t\tid: undefined,\n\t\t\t} );\n\t\t}\n\t}", "title": "" }, { "docid": "961314c23211bc04aa873e3109084631", "score": "0.6518681", "text": "function fermerModal()\n {\n $('#modal-container').hide();\n $('.modal-backdrop').hide();\n }", "title": "" }, { "docid": "c05d10c8760b9b7c1c28dc927270639d", "score": "0.65142405", "text": "function closeModal(){\n $(\"#modalWindow\").css('display', 'none');\n $(\"#newGuidedVisit\").css('display', 'none');\n $(\"#updateGuidedVisit\").css('display', 'none');\n $('#confirmDelete').css('display', 'none');\n $('.error').css('display', 'none');\n }", "title": "" }, { "docid": "f9c842de72943544adbc59865b0132fc", "score": "0.65091944", "text": "function modalClose() {\n modal.style.display = \"none\";\n }", "title": "" }, { "docid": "1fc52553a08fabd37fe1740f2cb9eb25", "score": "0.6500472", "text": "function handleModalClose() {\n setModalOpen(false);\n setAuthTokenSet(true);\n }", "title": "" }, { "docid": "cdca452d084ba10bfa8953050c474c33", "score": "0.64995646", "text": "function clearModificationsUI() {\n Modifications.resetUI();\n }", "title": "" }, { "docid": "1811c5d58ef20084c22f1d3f0b4d543b", "score": "0.64915633", "text": "function closeModal(){\n setisModalOpen(false);\n }", "title": "" }, { "docid": "d0e4ebe6236940d96857597289450a77", "score": "0.64901584", "text": "function ocultar() {\n let modal = document.getElementById(\"myModal\");\n modal.style.display = \"none\";\n}", "title": "" }, { "docid": "4b559d1c7d11b03d1057f44dc1a892fb", "score": "0.6482936", "text": "function hidenModal(){\n $('#jcode-modal-multiple').modal('hide');\n $('#jcode-modal-multiple').on('hidden.bs.modal',function(){\n $('jcode-modal-content').html('');\n }); \n }", "title": "" }, { "docid": "bca1d6a86689947dd133026d7412ef9e", "score": "0.6479665", "text": "closeModal() {\n this.bShowModal = false;\n }", "title": "" }, { "docid": "e7d9700e64d6b9d828a2e421289c7fe2", "score": "0.6479484", "text": "function closeModal(){ modal.style.display = 'none'; }", "title": "" }, { "docid": "b500dd9a32b8f71c307c8a577afb015f", "score": "0.64787817", "text": "function close_modal() {\n\tmodal.style.display = \"none\";\n\thighlights_div.innerHTML = '';\n\tfeatures_div.innerHTML = '';\n\tbug_fixes_div.innerHTML = '';\n\tid_input_modal.disabled = false;\n\tid_input_modal.value = \"\";\n\tauthor_input_modal.disabled = false;\n\tauthor_input_modal.value = \"\";\n}", "title": "" }, { "docid": "a62582b78b13c107bc7fa7706253344e", "score": "0.6477279", "text": "function cerrarModal(){\n document.getElementById(\"modal\").style.display = \"none\"; \n }", "title": "" }, { "docid": "a62582b78b13c107bc7fa7706253344e", "score": "0.6477279", "text": "function cerrarModal(){\n document.getElementById(\"modal\").style.display = \"none\"; \n }", "title": "" }, { "docid": "6e44274bd77f2be9ed1bc656afdf6b13", "score": "0.6473937", "text": "dispose() {\n const modalContainer = document.getElementById(\n this.modalContainerElementId_);\n modalContainer.innerHTML = '';\n }", "title": "" }, { "docid": "f687c04eed7f8c4a90a627bfb94288d0", "score": "0.6473859", "text": "function ocultar8() {\n let modal = document.getElementById(\"myModal8\");\n modal.style.display = \"none\";\n}", "title": "" }, { "docid": "75b55f70f1d73a0989566d4789e52ab3", "score": "0.6471987", "text": "function openDestroyModal() {\n $('.ui.basic.modal')\n .modal({\n closable: false,\n onApprove: function () {\n removeProject();\n }\n })\n .modal('show');\n }", "title": "" }, { "docid": "8e7209bb3fdbc654969f7811c2cbdcfa", "score": "0.64694154", "text": "function init(){\n\n new_game();\n $(\"#modal11\").hide();\n $('.modal').modal();\n\n }", "title": "" }, { "docid": "e014a6a0742543bdcc9578972e014668", "score": "0.64660954", "text": "function clearModal() {\n document.getElementById(\"last-name\").value = '';\n document.getElementById(\"first-name\").value = '';\n document.getElementById(\"email-input\").value = '';\n document.getElementById(\"gender-input\").value = '';\n document.getElementById(\"birthdate-input\").value = '';\n document.getElementById(\"picture\").value = '';\n}", "title": "" }, { "docid": "0af228b83fbf06cdbe99a945bbeb3e4f", "score": "0.64533675", "text": "function modalCloseAndReset(table){\n\n $('.modal').find('input').removeClass('valid');\n\n $('.modal').find('.input-field').removeClass('valid');\n\n $('.modal').modal('close');\n\n $('.modal').find('form').validate().resetForm();\n\n $('.modal').find('div.errorlabel').remove();\n\n $('form :input').each(function(){\n\n $(this).val('');\n\n })\n\n $('form .resetIfClose').each(function(){\n\n $(this).text('');\n\n })\n\n if(table != null){\n\n $(table).DataTable().ajax.reload();\n\n }\n\n }", "title": "" }, { "docid": "c62f862616f67cf7c798f85cc729349c", "score": "0.64478284", "text": "function hideModal () {\n\tMapper.DOM.$modal.fadeOut(300,function () {\n\n\t\tMapper.data = {\n\t\t\tx : 0,\n\t\t\ty : 0\n\t\t}\n\n\t\tif ( $oldMarker ) {\n\t\t\t$oldMarker.remove();\n\t\t\t$oldMarker = null;\n\t\t}\n\n\t\tif ( $newMarker ) {\n\t\t\t$newMarker.remove();\n\t\t\t$newMarker = null;\n\t\t}\n\n\t\tMapper.DOM.$modalCursorLoc.html('');\n\n\t\t$('body').css({\n\t\t\t'padding-right' : '',\n\t\t\t'overflow' : 'hidden'\n\t\t});\n\n\t});\n}", "title": "" }, { "docid": "f2d166e9e53701d6faa3ee26da29e035", "score": "0.6444654", "text": "function openNewModal(){\r\n\tclearData();\r\n\t//open modal\r\n\t$('#modalNew').modal('open');\r\n}", "title": "" }, { "docid": "4a7b9fb2c7d0e0c9dd01652374008328", "score": "0.6444038", "text": "function onCloseDetails() {\n var elBookModal = getEl('.modal');\n elBookModal.style.display = \"none\";\n}", "title": "" }, { "docid": "2ca40460488d2ae3c45d069cb221086a", "score": "0.644318", "text": "function closeModal(){\r\n addmodal.style.display = \"none\";\r\n updatemodal.style.display = \"none\";\r\n}", "title": "" }, { "docid": "cac6f3ba6a09bf79e591cdfe615b564c", "score": "0.6442313", "text": "function resetDSAddEditModal() {\n setVisibleDSTypeRDBMS(true);\n setVisibleDSTypeCarbon(false);\n clearDynamicAuthTable();\n}", "title": "" }, { "docid": "5d4656b551ed1262dd23acd17dc93765", "score": "0.64408445", "text": "function mostrarModal(that) {\n $('.ocultable').attr('aria-hidden', 'true');\n\n $(that).find(\".modal\").modal({ keyboard: false, backdrop: \"static\", dismiss: \"modal\" });\n $(that).find(\".modal\").modal('show');\n }", "title": "" }, { "docid": "eeaefe9c6dffe5e3fc77a3e497f9bb23", "score": "0.64277506", "text": "function limparDados() {\n $('#nome').val('');\n $('#ativo').val('N');\n $('#modelo-cadastro').modal('toggle')\n }", "title": "" }, { "docid": "10de85c83e5d2f2337c71f23cffa8eb3", "score": "0.64274645", "text": "function setModal(){\n// Get the modal\nvar modal = document.getElementById(\"myModal\");\nmodal.style.display = \"none\";\n}", "title": "" }, { "docid": "cde64aebbd66ae02bfae9d3488a4dc28", "score": "0.6424869", "text": "function closeModal() {\n select.getFeatures().clear();\n details.classList.add('hidden');\n}", "title": "" }, { "docid": "357f54d375a94f80afc24c7eec912811", "score": "0.64241374", "text": "function ocultar3() {\n let modal = document.getElementById(\"myModal3\");\n modal.style.display = \"none\";\n}", "title": "" }, { "docid": "e90386711b69b7bf6874e743b1f5cd14", "score": "0.64238524", "text": "function clearDelPostModal() {\r\n const delPostId = document.getElementById('delete-post-id');\r\n delPostId.innerHTML = '';\r\n window.location.reload();\r\n}", "title": "" }, { "docid": "c8b08faddb0897e0a238d36535c42129", "score": "0.6414158", "text": "function limpiarPopup(){\n\t$(\"#mesajeResultado\").hide();\n\t$(\"#mesajeResultado\").text(\"\");\n\t$(\"#formulario_pop\").get(0).reset();\n\n}", "title": "" }, { "docid": "5a06d9e04c3130ab26303532d56a82fb", "score": "0.6411705", "text": "function closeEditBacklogItem() {\n document.getElementById(\"form_edit_BacklogItem\").reset();\n $(\"#modal_edit_backlogItem\").modal(\"hide\");\n}", "title": "" }, { "docid": "5a06d9e04c3130ab26303532d56a82fb", "score": "0.6411705", "text": "function closeEditBacklogItem() {\n document.getElementById(\"form_edit_BacklogItem\").reset();\n $(\"#modal_edit_backlogItem\").modal(\"hide\");\n}", "title": "" }, { "docid": "c3662e671fd3451427eff44050533c79", "score": "0.6410625", "text": "function ocultar5() {\n let modal = document.getElementById(\"myModal5\");\n modal.style.display = \"none\";\n}", "title": "" }, { "docid": "e2f46b93aa9e89985c8eed2998e4cb17", "score": "0.6409994", "text": "function setModalClose() {\n props.setIsModalNow(false);\n }", "title": "" }, { "docid": "41c0c01027d56450ffea1126e2ca5718", "score": "0.6408094", "text": "reset() {\n\t\tplayer.reset(); \n\t\tif(document.querySelector('.hidden') === null) {\n\t\t\tdocument.querySelector('.modal').classList.add('hidden');\n\t\t}\n\t}", "title": "" }, { "docid": "e04248dd0d936e5e2869c43fdfac8107", "score": "0.6406556", "text": "function closeModal() {\r\n modal.style.display = 'none';\r\n }", "title": "" }, { "docid": "e04248dd0d936e5e2869c43fdfac8107", "score": "0.6406556", "text": "function closeModal() {\r\n modal.style.display = 'none';\r\n }", "title": "" }, { "docid": "17d388ae2382a476a9d8552ac705dd46", "score": "0.640288", "text": "function close_modal() {\n //close the modal after legitmitate submit format\n myModal.style.display = \"none\";\n //reset the modal content to its orignal content\n modal_posts.innerHTML = '';\n}", "title": "" }, { "docid": "41adc837666254cfaccdd5372246d81d", "score": "0.6402175", "text": "function ocultar4() {\n let modal = document.getElementById(\"myModal4\");\n modal.style.display = \"none\";\n}", "title": "" }, { "docid": "28ddc6b6553fe3c22b2188ca22c49bce", "score": "0.6398486", "text": "showCreationModal(){\n newListingModal.show();\n }", "title": "" }, { "docid": "06ccae6e9eb0afb4b82f8621c2441dbd", "score": "0.63920075", "text": "function documentsReset(){\n // close modals\n $(\".modal\").modal(\"hide\");\n $(\"input[type=text]\").val(\"\");\n $(\".dropify-clear\").click();\n }", "title": "" }, { "docid": "d04936e564614335214177ad3845a586", "score": "0.638526", "text": "function close_model(){ $(\"#modal-default\").hide(\"slow\"); }", "title": "" }, { "docid": "388bc0175dbc9f24dfba84b9b69899af", "score": "0.6384935", "text": "function closeModal() {\n addModal.style.display = \"none\";\n modal.style.display = \"none\";\n letstalk.style.display = \"none\";\n input.value = \"\";\n}", "title": "" }, { "docid": "5afea8cc81b705d8ff18e9ff5ee6d138", "score": "0.6384881", "text": "showModal() {\n this.modal.modal(\"show\");\n this.appendBasicInfo();\n this.appendAttributes();\n this.selectAttributes();\n this.addNewCategory();\n this.appendDimentions();\n this.appendVariants()\n this.appendProductImgs()\n this.appendAditionalInfo();\n this.activatefunctions();\n }", "title": "" }, { "docid": "260dfb37813c907a29b1eaafe53cddcb", "score": "0.63848233", "text": "function showModal() {\n resetModal();\n document.getElementById(\"myModal\").style.display = \"block\";\n}", "title": "" }, { "docid": "f21375937c5f75ea866ba79cdcebc536", "score": "0.63799", "text": "function removeModal() {\n dom.getElement('.modal-container').remove();\n}", "title": "" }, { "docid": "233c766ba65b7d208af535c6c478cf38", "score": "0.6374598", "text": "function emptyNewIssueModal() {\n\tvar button1 = createButton(\"btn btn-default\", \"\", \"closeNewIssueentityButton\", \"Abbrechen\", \"\", \"\", \"\", \"\");\n\tbutton1.setAttribute(\"data-dismiss\", \"modal\");\n\tvar button2 = createButton(\"btn btn-primary\", \"\", \"saveNewIssueentityButton\", \"Speichern\", \"\", \"createIssue();\", \"\", \"\");\n\tbuildModalOneFooter(button1, button2);\n\tbuildModalOneHeader(\"Neues Issue\");\n\tvar radio1 = createRadioButton(\"newIssueSelect\", \"newIssue\", \"newIssueSelectCreateNewIssue\", \"newIssueSelectCreateNewIssue();\")\n\tvar radio2 = createRadioButton(\"newIssueSelect\", \"selectIssue\", \"newIssueSelectSelectIssue\", \"interaction.getAllIssueDraft(false);\")\n\tvar label1 = createLabel(\"newIssueSelectCreateNewIssue\", document.createTextNode(\"Neues Issue\"));\n\tvar label2 = createLabel(\"newIssueSelectSelectIssue\", document.createTextNode(\"Issue w\\u00e4hlen\"));\n\tvar body = document.getElementById(\"modalOneBody\");\n\tfor(var i = body.childNodes.length; i > 0; i--) {\n\t\tbody.removeChild(body.lastChild);\n\t}\n\tbody.appendChild(radio1);\n\tbody.appendChild(label1);\n\tbody.appendChild(radio2);\n\tbody.appendChild(label2);\n}", "title": "" }, { "docid": "e9b0388dcdc0cbe58f5bbfca694755cb", "score": "0.63731426", "text": "function ocultar10() {\n let modal = document.getElementById(\"myModal10\");\n modal.style.display = \"none\";\n}", "title": "" } ]
289b8ad14897e979ef100b56437e0fab
Must be a Uint8Array
[ { "docid": "f82d4d91e28921b29651c48171020222", "score": "0.0", "text": "loadProgram (program) {\n console.log(program)\n\n // Load the program in memory\n // Chip 8 programs start in 0x200 memory location\n let memPosCounter = 0x200\n for (let byte of program) {\n this.memory[memPosCounter] = byte\n memPosCounter++\n }\n }", "title": "" } ]
[ { "docid": "26a0c53a03b169a2d7c2617c2442a6d7", "score": "0.69917315", "text": "u8_array() {\n let len = this.varint();\n\n this.throw_if_less_than(len);\n let data = this.buffer.subarray(this.pos, this.pos + len);\n this.pos += len;\n return data;\n }", "title": "" }, { "docid": "58b535367c4ece1754f198866ebd2b04", "score": "0.6960546", "text": "function isBytesArray(bytes) {\n return bytes.byteLength === 20;\n}", "title": "" }, { "docid": "81fa447bde229014b114c7a4ba5d7f5b", "score": "0.684695", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "81fa447bde229014b114c7a4ba5d7f5b", "score": "0.684695", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "81fa447bde229014b114c7a4ba5d7f5b", "score": "0.684695", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "81fa447bde229014b114c7a4ba5d7f5b", "score": "0.684695", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "44c74106a06d0f4ef1cb652978f0dbdf", "score": "0.68245226", "text": "function assertUint8Array(obj, what) {\n if (!(obj instanceof Uint8Array)) {\n throw new Error('invalid ' + what + ': ' + obj);\n }\n}", "title": "" }, { "docid": "06e6ece565003b78c2eaa1df7b228708", "score": "0.68232346", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "06e6ece565003b78c2eaa1df7b228708", "score": "0.68232346", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "06e6ece565003b78c2eaa1df7b228708", "score": "0.68232346", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "06e6ece565003b78c2eaa1df7b228708", "score": "0.68232346", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "06e6ece565003b78c2eaa1df7b228708", "score": "0.68232346", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "06e6ece565003b78c2eaa1df7b228708", "score": "0.68232346", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "06e6ece565003b78c2eaa1df7b228708", "score": "0.68232346", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "06e6ece565003b78c2eaa1df7b228708", "score": "0.68232346", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "06e6ece565003b78c2eaa1df7b228708", "score": "0.68232346", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "06e6ece565003b78c2eaa1df7b228708", "score": "0.68232346", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "06e6ece565003b78c2eaa1df7b228708", "score": "0.68232346", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "06e6ece565003b78c2eaa1df7b228708", "score": "0.68232346", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "06e6ece565003b78c2eaa1df7b228708", "score": "0.68232346", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "06e6ece565003b78c2eaa1df7b228708", "score": "0.68232346", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "96f9a890c1bf1a2f1ee4d72b66761193", "score": "0.6819653", "text": "function LazyUint8Array() {\r\n this.lengthKnown = false;\r\n this.chunks = []; // Loaded chunks. Index is the chunk number\r\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "314051ce8f4205381f34596ecc808aa3", "score": "0.6811569", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "66d94fd6536631d5db77b756d80795c0", "score": "0.6798868", "text": "function LazyUint8Array() {\nthis.lengthKnown = false;\nthis.chunks = []; // Loaded chunks. Index is the chunk number\n}", "title": "" }, { "docid": "f27da2b952231372a43c3d90e1d7a421", "score": "0.67691153", "text": "function LazyUint8Array() {\n this.lengthKnown = false;\n this.chunks = []; // Loaded chunks. Index is the chunk number\n }", "title": "" }, { "docid": "90bfe207c8b81c9561a8b57175805e7d", "score": "0.6721931", "text": "function isByteArray(data) {\n return (typeof data === 'object' && Array.isArray(data) \n && data.length > 0 && typeof data[0] === 'number')\n}", "title": "" }, { "docid": "9f504faff216f1123376ac7fe5bf8e6a", "score": "0.6628343", "text": "function assertUint8ArrayAvailable(){if(typeof Uint8Array==='undefined'){throw new index_esm_FirestoreError(Code.UNIMPLEMENTED,'Uint8Arrays are not available in this environment.');}}", "title": "" }, { "docid": "046bbed332a9f847d616226e2ab3f075", "score": "0.6549113", "text": "supportsByteArrayValues() {\n return true;\n }", "title": "" }, { "docid": "69b5913dd187830d7b07ac5bcf3505a9", "score": "0.65393037", "text": "function isArrayBuffer (o) { return o instanceof ArrayBuffer }", "title": "" }, { "docid": "69b5913dd187830d7b07ac5bcf3505a9", "score": "0.65393037", "text": "function isArrayBuffer (o) { return o instanceof ArrayBuffer }", "title": "" }, { "docid": "50b7017fc5bd03e4e5a7ff5e5a03e759", "score": "0.64689475", "text": "function isArrayBuffer(obj){return obj instanceof ArrayBuffer||obj!=null&&obj.constructor!=null&&obj.constructor.name===\"ArrayBuffer\"&&typeof obj.byteLength===\"number\"}", "title": "" }, { "docid": "656fc48e0c8b34e2652d718ee437adff", "score": "0.6438045", "text": "function mc() {\n if (\"undefined\" == typeof Uint8Array) throw new S(_.UNIMPLEMENTED, \"Uint8Arrays are not available in this environment.\");\n}", "title": "" }, { "docid": "3c5928ee7a3eb71f005ef363f57a7c87", "score": "0.64207315", "text": "_pushTypedArray(gen, obj) {\n if(obj instanceof Uint8Array) {\n // treat Uint8Array as a simple byte string\n return gen._pushByteString(\n gen, new Uint8Array(obj.buffer, obj.byteOffset, obj.byteLength));\n }\n\n // see https://tools.ietf.org/html/rfc8746\n\n let typ = 0b01000000;\n let sz = obj.BYTES_PER_ELEMENT;\n const {name} = obj.constructor;\n\n if(name.startsWith('Float')) {\n typ |= 0b00010000;\n sz /= 2;\n } else if(!name.includes('U')) {\n typ |= 0b00001000;\n }\n if(name.includes('Clamped') || ((sz !== 1) && !util.isBigEndian())) {\n typ |= 0b00000100;\n }\n typ |= {\n 1: 0b00,\n 2: 0b01,\n 4: 0b10,\n 8: 0b11\n }[sz];\n if(!gen._pushTag(typ)) {\n return false;\n }\n return gen._pushByteString(\n gen, new Uint8Array(obj.buffer, obj.byteOffset, obj.byteLength));\n }", "title": "" }, { "docid": "ac9b7b125cbbd94ea6e4baa90219093b", "score": "0.64094394", "text": "function assertUint8ArrayAvailable() {\n if (typeof Uint8Array === 'undefined') {\n throw new FirestoreError(Code.UNIMPLEMENTED, 'Uint8Arrays are not available in this environment.');\n }\n}", "title": "" }, { "docid": "ac9b7b125cbbd94ea6e4baa90219093b", "score": "0.64094394", "text": "function assertUint8ArrayAvailable() {\n if (typeof Uint8Array === 'undefined') {\n throw new FirestoreError(Code.UNIMPLEMENTED, 'Uint8Arrays are not available in this environment.');\n }\n}", "title": "" }, { "docid": "ac9b7b125cbbd94ea6e4baa90219093b", "score": "0.64094394", "text": "function assertUint8ArrayAvailable() {\n if (typeof Uint8Array === 'undefined') {\n throw new FirestoreError(Code.UNIMPLEMENTED, 'Uint8Arrays are not available in this environment.');\n }\n}", "title": "" }, { "docid": "15c3dc9a6815b57ded5b906d358a7716", "score": "0.6405849", "text": "_Base64ToUint8Array(base64) {\r\n let raw = window.atob(base64); //this._Base64DecodeUnicode(base64); //\r\n let rawLength = raw.length;\r\n let array = new Uint8Array(new ArrayBuffer(rawLength));\r\n\r\n for(let i = 0; i < rawLength; i++) {\r\n array[i] = raw.charCodeAt(i);\r\n }\r\n return array;\r\n }", "title": "" }, { "docid": "7e49ca5d31d07b5038ffb5da3c24ca1e", "score": "0.64029557", "text": "toUint8Array() {\n let [pausePoint] = this.pausePoints;\n if (pausePoint === undefined)\n pausePoint = this.size;\n return new Uint8Array(this.buffer, 0, pausePoint);\n }", "title": "" }, { "docid": "46f61ec1a2a70f2608bb7777ae83dde9", "score": "0.6329346", "text": "function lt(){try{var n=new Uint8Array(1);return n.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},n.foo()===42&&typeof n.subarray==\"function\"&&n.subarray(1,1).byteLength===0}catch(t){return!1}}", "title": "" }, { "docid": "13f3b8face065a6322eff207f3d33b21", "score": "0.632613", "text": "function isArrayBuffer(value) {\n return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n}", "title": "" }, { "docid": "13f3b8face065a6322eff207f3d33b21", "score": "0.632613", "text": "function isArrayBuffer(value) {\n return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n}", "title": "" }, { "docid": "13f3b8face065a6322eff207f3d33b21", "score": "0.632613", "text": "function isArrayBuffer(value) {\n return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n}", "title": "" }, { "docid": "13f3b8face065a6322eff207f3d33b21", "score": "0.632613", "text": "function isArrayBuffer(value) {\n return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n}", "title": "" }, { "docid": "13f3b8face065a6322eff207f3d33b21", "score": "0.632613", "text": "function isArrayBuffer(value) {\n return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n}", "title": "" }, { "docid": "13f3b8face065a6322eff207f3d33b21", "score": "0.632613", "text": "function isArrayBuffer(value) {\n return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n}", "title": "" }, { "docid": "13f3b8face065a6322eff207f3d33b21", "score": "0.632613", "text": "function isArrayBuffer(value) {\n return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n}", "title": "" }, { "docid": "13f3b8face065a6322eff207f3d33b21", "score": "0.632613", "text": "function isArrayBuffer(value) {\n return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n}", "title": "" }, { "docid": "13f3b8face065a6322eff207f3d33b21", "score": "0.632613", "text": "function isArrayBuffer(value) {\n return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n}", "title": "" }, { "docid": "13f3b8face065a6322eff207f3d33b21", "score": "0.632613", "text": "function isArrayBuffer(value) {\n return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n}", "title": "" }, { "docid": "13f3b8face065a6322eff207f3d33b21", "score": "0.632613", "text": "function isArrayBuffer(value) {\n return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n}", "title": "" }, { "docid": "13f3b8face065a6322eff207f3d33b21", "score": "0.632613", "text": "function isArrayBuffer(value) {\n return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n}", "title": "" }, { "docid": "13f3b8face065a6322eff207f3d33b21", "score": "0.632613", "text": "function isArrayBuffer(value) {\n return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n}", "title": "" }, { "docid": "1123934432b6f850f2df9a2e3eb15d47", "score": "0.63174725", "text": "function dataResult (buffer, bytes) {\n\t\treturn new Uint8Array(\n\t\t\tnew Uint8Array(Module.HEAPU8.buffer, buffer, bytes)\n\t\t);\n\t}", "title": "" }, { "docid": "f74ba3e06e336ffe4402fca8d288decb", "score": "0.63156724", "text": "function buffer2Uint8array(buff) {\n if (buff instanceof Uint8Array) {\n // BFS & Node v4.0 buffers *are* Uint8Arrays.\n return buff;\n }\n else {\n // Uint8Arrays can be constructed from arrayish numbers.\n // At this point, we assume this isn't a BFS array.\n return new Uint8Array(buff);\n }\n}", "title": "" }, { "docid": "a31058fd4ac3d6333f6fa434af1b08c2", "score": "0.6281257", "text": "function isTypedArray(array) {\n return array instanceof Int8Array || array instanceof Uint8Array || array instanceof Uint8ClampedArray || array instanceof Int16Array || array instanceof Uint16Array || array instanceof Int32Array || array instanceof Uint32Array || array instanceof Float32Array || array instanceof Float64Array;\n}", "title": "" }, { "docid": "51865dd28ff536f5cc2e200a3fada948", "score": "0.6270267", "text": "function isArrayBuffer(value) {\n return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n }", "title": "" }, { "docid": "79434461d95a870c97c47d9b6ab2d9b2", "score": "0.6245875", "text": "static dataArray (length = 0) {\n if (Uint8ClampedArray) {\n return new Uint8ClampedArray(length)\n }\n return new Array(length)\n }", "title": "" }, { "docid": "1878cf035c439383915c727e69f485c5", "score": "0.62446606", "text": "function assertUint8ArrayAvailable() {\n if (typeof Uint8Array === 'undefined') {\n throw new __WEBPACK_IMPORTED_MODULE_2__util_error__[\"a\" /* FirestoreError */](__WEBPACK_IMPORTED_MODULE_2__util_error__[\"b\" /* Code */].UNIMPLEMENTED, 'Uint8Arrays are not available in this environment.');\n }\n}", "title": "" }, { "docid": "1878cf035c439383915c727e69f485c5", "score": "0.62446606", "text": "function assertUint8ArrayAvailable() {\n if (typeof Uint8Array === 'undefined') {\n throw new __WEBPACK_IMPORTED_MODULE_2__util_error__[\"a\" /* FirestoreError */](__WEBPACK_IMPORTED_MODULE_2__util_error__[\"b\" /* Code */].UNIMPLEMENTED, 'Uint8Arrays are not available in this environment.');\n }\n}", "title": "" }, { "docid": "d9c28c6af527a57673fc4b160d5ccfcc", "score": "0.6243329", "text": "function convertTypedArraytoArray(uint8arr) {\n var arr = [];\n for (var i = 0; i < uint8arr.length; i++) {\n arr[i] = uint8arr[i];\n }\n return arr;\n}", "title": "" }, { "docid": "a1a4d331bbb042c531c83191d0b19ea6", "score": "0.62429357", "text": "constructor() {\n let size;\n if(typeof arguments[0] === 'number') {\n this.array = new Uint8Array(arguments[0])\n } else {\n this.array = arguments[0]\n }\n\n this.readPosition = 0\n this.writePosition = 0\n }", "title": "" }, { "docid": "4f266471d72a33af04733edae3d40da1", "score": "0.6230868", "text": "function isArrayBuffer(value) {\n return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n}", "title": "" }, { "docid": "4f266471d72a33af04733edae3d40da1", "score": "0.6230868", "text": "function isArrayBuffer(value) {\n return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n}", "title": "" }, { "docid": "936bf814a983f7f1cd397520f1ade1c7", "score": "0.6229988", "text": "get data() {\n DEBUG && debugAssert(this._data);\n return new Uint8Array(\n this._data.buffer.slice(this._dataIdx, this._dataIdx + this._dataLen)\n );\n }", "title": "" }, { "docid": "66f0f9d40d2691df19a5d6d1b7bcc750", "score": "0.622859", "text": "function assertUint8ArrayAvailable() {\n if (typeof Uint8Array === 'undefined') {\n throw new __WEBPACK_IMPORTED_MODULE_2__util_error__[\"b\" /* FirestoreError */](__WEBPACK_IMPORTED_MODULE_2__util_error__[\"a\" /* Code */].UNIMPLEMENTED, 'Uint8Arrays are not available in this environment.');\n }\n}", "title": "" }, { "docid": "7fcc354f86ed1b72c0d7baa315920571", "score": "0.6185886", "text": "function setBytesFrom () {\n var byteArray = interpreterProxy.stackValue(1),\n\t result = interpreterProxy.stackValue(0).jsObject\n\n byteArray.bytes = new Uint8Array(result)}", "title": "" }, { "docid": "30c38fc9164d3624327dfed38889f5b1", "score": "0.6183941", "text": "function yc() {\n if (\"undefined\" == typeof Uint8Array) throw new T(E.UNIMPLEMENTED, \"Uint8Arrays are not available in this environment.\");\n}", "title": "" }, { "docid": "053cfcb10ef93591279f83cdb3cbbda2", "score": "0.6181411", "text": "async bytes() {\n this.throwIfDisposed();\n const data = await trackerFn().read(this.dataId);\n if (this.dtype === 'string') {\n return data;\n }\n else {\n return new Uint8Array(data.buffer);\n }\n }", "title": "" }, { "docid": "61c7df7f1ef016c4b3aa021903ca1f62", "score": "0.61755127", "text": "function normalizeInput (input) {\n var ret\n if (input instanceof Uint8Array) {\n ret = input\n } else if (input instanceof Buffer) {\n ret = new Uint8Array(input)\n } else if (typeof (input) === 'string') {\n ret = new Uint8Array(Buffer.from(input, 'utf8'))\n } else {\n throw new Error(ERROR_MSG_INPUT)\n }\n return ret\n}", "title": "" }, { "docid": "61c7df7f1ef016c4b3aa021903ca1f62", "score": "0.61755127", "text": "function normalizeInput (input) {\n var ret\n if (input instanceof Uint8Array) {\n ret = input\n } else if (input instanceof Buffer) {\n ret = new Uint8Array(input)\n } else if (typeof (input) === 'string') {\n ret = new Uint8Array(Buffer.from(input, 'utf8'))\n } else {\n throw new Error(ERROR_MSG_INPUT)\n }\n return ret\n}", "title": "" }, { "docid": "61c7df7f1ef016c4b3aa021903ca1f62", "score": "0.61755127", "text": "function normalizeInput (input) {\n var ret\n if (input instanceof Uint8Array) {\n ret = input\n } else if (input instanceof Buffer) {\n ret = new Uint8Array(input)\n } else if (typeof (input) === 'string') {\n ret = new Uint8Array(Buffer.from(input, 'utf8'))\n } else {\n throw new Error(ERROR_MSG_INPUT)\n }\n return ret\n}", "title": "" }, { "docid": "61c7df7f1ef016c4b3aa021903ca1f62", "score": "0.61755127", "text": "function normalizeInput (input) {\n var ret\n if (input instanceof Uint8Array) {\n ret = input\n } else if (input instanceof Buffer) {\n ret = new Uint8Array(input)\n } else if (typeof (input) === 'string') {\n ret = new Uint8Array(Buffer.from(input, 'utf8'))\n } else {\n throw new Error(ERROR_MSG_INPUT)\n }\n return ret\n}", "title": "" }, { "docid": "61c7df7f1ef016c4b3aa021903ca1f62", "score": "0.61755127", "text": "function normalizeInput (input) {\n var ret\n if (input instanceof Uint8Array) {\n ret = input\n } else if (input instanceof Buffer) {\n ret = new Uint8Array(input)\n } else if (typeof (input) === 'string') {\n ret = new Uint8Array(Buffer.from(input, 'utf8'))\n } else {\n throw new Error(ERROR_MSG_INPUT)\n }\n return ret\n}", "title": "" }, { "docid": "61c7df7f1ef016c4b3aa021903ca1f62", "score": "0.61755127", "text": "function normalizeInput (input) {\n var ret\n if (input instanceof Uint8Array) {\n ret = input\n } else if (input instanceof Buffer) {\n ret = new Uint8Array(input)\n } else if (typeof (input) === 'string') {\n ret = new Uint8Array(Buffer.from(input, 'utf8'))\n } else {\n throw new Error(ERROR_MSG_INPUT)\n }\n return ret\n}", "title": "" }, { "docid": "f202651352f8b0ed6bf01c3c0e60c2d9", "score": "0.61693", "text": "_pushArrayBuffer(gen, obj) {\n return gen._pushTypedArray(gen, new Uint8Array(obj));\n }", "title": "" } ]
67be3f8b381b70a10dc45ee3b34e4927
but to remain compatibility with other libs (Preact) fall back to check evt.cancelBubble
[ { "docid": "bc405790b139d841bfc5d384d815b974", "score": "0.61805964", "text": "function isPropagationStopped(evt) {\n if (typeof evt.isPropagationStopped === 'function') {\n return evt.isPropagationStopped();\n } else if (typeof evt.cancelBubble !== 'undefined') {\n return evt.cancelBubble;\n }\n\n return false;\n} // React's synthetic events has evt.isDefaultPrevented,", "title": "" } ]
[ { "docid": "79b2113c5fdb76f2db47291f773d3764", "score": "0.731109", "text": "function cancelBubleEv(e)\n{\n e = e || event;\n e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true;\n\n}", "title": "" }, { "docid": "9b93644301c8b8c4e1f82a801591d88a", "score": "0.72397304", "text": "function PreventBubbleHandler(event)\n{\n if (!event) event = window.event;\n event.cancelBubble = true;\n}", "title": "" }, { "docid": "4400f7e5e3544ab9e644b9535bce595d", "score": "0.7093692", "text": "function cancelEvent(e)\r\n{\r\n e.returnValue = false;\r\n e.cancelBubble = true;\r\n\r\n if (e.stopPropagation)\r\n {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n }\r\n}", "title": "" }, { "docid": "b5bc153d2e06da20904db8774dfaf245", "score": "0.68543285", "text": "function catchInput(event) {\n event.cancelBubble = true;\n return false;\n }", "title": "" }, { "docid": "ca5583e5b8e819468bcf8699a1c75f28", "score": "0.6839306", "text": "function stopBubble(e)\n{\n\tif (!e) var e = window.event;\n\te.cancelBubble = true;\n\tif (e.stopPropagation) e.stopPropagation();\n\t//alert(\"stop bubble!\");\n}", "title": "" }, { "docid": "f4b01848b4622d816697deec2ebc24fd", "score": "0.68018246", "text": "function fnCancelEvent() { event.returnValue = false; }", "title": "" }, { "docid": "adfe1b1387b973afacafc6a0075e1c1f", "score": "0.6771599", "text": "function DisableRClick() {\n\t/*\n\tevent.cancelBubble = true;\n\treturn false\n\t*/\n}", "title": "" }, { "docid": "7ecb85174470b0040436775885f9b192", "score": "0.66952866", "text": "function cancelHandler(event) {\n event.cancelBubble = true;\n\n if (event.stopPropagation) {\n event.stopPropagation();\n }\n } // This handler ignores the current event in the InfoBox and conditionally prevents", "title": "" }, { "docid": "35703cafdd7558236b8e7db88a103308", "score": "0.66727775", "text": "function cancelHandler(event) {\n event.cancelBubble = true;\n\n if (event.stopPropagation) {\n event.stopPropagation();\n }\n } // This handler ignores the current event in the InfoBox and conditionally prevents", "title": "" }, { "docid": "18a3fa40363100c38996580533955c58", "score": "0.6671191", "text": "function stopEventBubble(e){\n\tif (!e) {\n\t\tvar e = window.event;\n\t\t}\n\tif (!e){\n\t\treturn;\n\t\t}\n\te.cancelBubble = true;\n\tif (e.stopPropagation) e.stopPropagation();\n\t}", "title": "" }, { "docid": "7341a2054e04f4b6c0cdd4b21a7c3361", "score": "0.6517771", "text": "function cancel(e) {\n e.stopPropagation(); // = ?????\n if (e.preventDefault) { e.preventDefault(); }\n return false;\n }", "title": "" }, { "docid": "9d75314e12bc5e8201b286cfa550fd30", "score": "0.64655554", "text": "function preventBubblePopper() {\n Timeline.OriginalEventPainter.prototype._showBubble = function(x, y, evt) {\n //stop the bubble from appearing!\n };\n}", "title": "" }, { "docid": "3de1fa48914a4f108e23d48a9a6488d7", "score": "0.6445174", "text": "function noShow(){ \n event.cancelBubble=true;\n if(event.stopPropagation){\n event.stopPropagation();\n }\n return false;\n}", "title": "" }, { "docid": "7c0047947d5fbeba5623fb970d1f3d77", "score": "0.64001733", "text": "function stopPropagation(){\r\n\t\tif(this.bubbles){\r\n\t\t\tthis.cancelBubble=false;\r\n\t\t}\r\n\t}", "title": "" }, { "docid": "7a4c61112e0318e2efc6ae24c1729579", "score": "0.638514", "text": "function igtbl_cancelEvent(evnt)\r\n{\r\n\tig_cancelEvent(evnt);\r\n\treturn false;\r\n}", "title": "" }, { "docid": "73ca69e050ddf072e09d6fcc1db7cb2c", "score": "0.6377196", "text": "function checkEvent(evt) {\n if (!evt) {var evt = window.event;}\n evt.stopPropagation();\n return evt;\n }", "title": "" }, { "docid": "aa5d07f85f88c20554e6167f667d8dd1", "score": "0.63726264", "text": "function forceDefaultActionEvent(moduleObject, element, event)\n{\n // IE6/7 code\n if(window.BROWSER_IE) { \n event.cancelBubble = true;\n return true;\n } else {\n // FF code\n event.forceDefaultAction = true;\n }\n}", "title": "" }, { "docid": "0e19a327ee226ca7bff5c04c20f4bd23", "score": "0.63519675", "text": "function zop(e) {\n\tif (zot(e)) return;\n\tif (e.stopImmediatePropagation) e.stopImmediatePropagation();\n\tif (window.event) window.event.cancelBubble=true;\n}", "title": "" }, { "docid": "9e11acf14a3248d05ac681546b3ebe54", "score": "0.62810844", "text": "function CancelDeActivation (event) {\n\t\t \n\t\t // prevent the propagation of the current event\n\t\t if (event.stopPropagation) {\n\t\t event.stopPropagation();\n\t\t }\n\t\t else {\n\t\t event.cancelBubble = true;\n\t\t }\n\t\t // cancel the current event\n\t\t return false;\n\t }", "title": "" }, { "docid": "1385533380b3a9141da07e667eaf3df6", "score": "0.6245401", "text": "function onMouseCancel (event) {\r\n\r\n // Defaults\r\n\t\tevent.preventDefault();\r\n\t\t\r\n\t\t// Sets mouse pressed\r\n\t\t_mousePressed = false;\r\n\r\n\t\t// Stops dragging\r\n\t\t_draggingSelected = false;\r\n\t\tscope.dispatchEvent( { type: 'dragend', object: _hovered } );\r\n\r\n // Log it\r\n console.log(\"Mouse is canceled...\");\r\n }", "title": "" }, { "docid": "59e680e83c23a7f694c80a931281145c", "score": "0.6244929", "text": "function cancelPropagation(e) {\n if (!e)\n var e = window.event;\n e.cancelBubble = true;\n if (e.stopPropagation) e.stopPropagation();\n}", "title": "" }, { "docid": "617d6561a9d3da32405cb0ff650c7d4f", "score": "0.6235145", "text": "handleClick(evt) {\n evt.stopPropagation();\n }", "title": "" }, { "docid": "ae8c4d5c2ea1a021e2676e6475f66853", "score": "0.6215066", "text": "function stop_bubbling(e){\n\t\tif (!e) var e = window.event;\n\t\te.cancelBubble = true;\n\t\tif (e.stopPropagation) \n\t\t\te.stopPropagation();\n\t\te.preventDefault();\n\t}", "title": "" }, { "docid": "4e8f75739d3ac2fd6d36f8aa23dc2c77", "score": "0.62119484", "text": "function cancelEventSafari() {\n return false; \n}", "title": "" }, { "docid": "10a682090b7841c228aad01938d4ca09", "score": "0.6207017", "text": "function stopPropagation(e) {\n e.cancelBubble = true;\n if (e.stopPropagation) { e.stopPropagation(); }\n return false;\n }", "title": "" }, { "docid": "b5a42366973d91fda99183bf216681af", "score": "0.61752933", "text": "function cancel(e) {\n e.stopPropagation();\n e.preventDefault();\n}", "title": "" }, { "docid": "6dbc6286ca9618705dc403d463d33d04", "score": "0.6160979", "text": "function stopPropagation(ev) {\r\n\tif (!ev) var ev = window.event;\r\n\tev.cancelBubble = true;\r\n\tif (ev.stopPropagation) ev.stopPropagation();\r\n}", "title": "" }, { "docid": "2c0262df2b2423bd8fb513b29c024b72", "score": "0.6140282", "text": "function stopPropagation() {\n this.cancelBubble = true\n}", "title": "" }, { "docid": "60c991d096076a7895672cf3b1ccd384", "score": "0.6135915", "text": "function uueventstop(event) { // @param EventObjectEx:\n//{@mb\n if (event.stopPropagation) {\n//}@mb\n event.stopPropagation();\n event.preventDefault();\n//{@mb\n } else {\n event.cancelBubble = _true;\n event.returnValue = _false;\n // [IE6][FIX]\n if (_env.ie6 && (event.type === \"mouseover\" ||\n event.type === \"mouseout\")) {\n event.returnValue = _true; // preventDefault\n }\n }\n//}@mb\n}", "title": "" }, { "docid": "72bbde08fe718cc93060bac235def443", "score": "0.61329365", "text": "function stopPropogation() {\n event.cancelBubble = true;\n if(event.stopPropagation) event.stopPropagation();\n}", "title": "" }, { "docid": "5717afcf762b7dc016555e64ff35a545", "score": "0.61232954", "text": "function cancel(event) {\n\tevent.preventDefault();\n\tevent.stopPropagation();\n\treturn false;\n}", "title": "" }, { "docid": "519994630197cf472094a5a860263952", "score": "0.6113276", "text": "function prevent() {\n //prevent and stop the default execution\n evt.preventDefault();\n evt.stopPropagation();\n return true;\n }", "title": "" }, { "docid": "d9ea92364ef598ac223aa541e5028abe", "score": "0.60908276", "text": "function bubbleEvent(event) {\r\n var triggeringElement = (event && event.target) || (iframeWindow.event && iframeWindow.event.srcElement);\r\n return triggeringElement && iframeDocument == triggeringElement.ownerDocument;\r\n }", "title": "" }, { "docid": "267a5280a44a7f73d08f6023ed922742", "score": "0.60875547", "text": "function cancelDragDrop(event) {\n event.stopPropagation();\n event.preventDefault();\n return false;\n }", "title": "" }, { "docid": "0f6fd1d1c552ddc876fe0c751d66580d", "score": "0.6075765", "text": "function isEventHandled(value){return value==='handled'||value===true;}", "title": "" }, { "docid": "a947c5d1f12f48522079638b119c57e9", "score": "0.6074098", "text": "function stopEvent(e)\n{\n\tvar ev = e || window.event;\n\tev.cancelBubble = true;\n\tif(ev.stopPropagation) ev.stopPropagation();\n\treturn false;\n}", "title": "" }, { "docid": "01ab878f798c487f32ea471b02ada6de", "score": "0.6036558", "text": "function killev(evt) {\n if (!evt) return;\n evt.stopPropagation();\n evt.preventDefault();\n return false;\n}", "title": "" }, { "docid": "df3c7d3176fe29e8683d8b7e9ed143a7", "score": "0.6028874", "text": "function $bubbleEvent( event )\n{\n\t// Save check\n\tif( event.target == this )\n\t\treturn;\n\t\t\n\tthis.fireEvent(event.type, event); \n}", "title": "" }, { "docid": "d169a4bf926f3e7d6a311244ccd492ee", "score": "0.60263866", "text": "function onPointerCancel(e) {\n eventLog.innerText = \"Pointer canceled\";\n }", "title": "" }, { "docid": "0959fe7f78b1bc4185c0b8f99c57c5b4", "score": "0.60109246", "text": "function cancelGridClickBubble(grid){\n\tgrid.on('click', function(e){\n\t\te.stopPropagation();\n\t\tif(selectedGridIds.indexOf(this.id) == -1)\n\t\t\tselectedGridIds.push(this.id);\t//Joze\n\t});\n\tif (grid.bbar != null && grid.bbar != '') \n\t\tgrid.bbar.on('click', function(e){\n\t\t\te.stopPropagation();\n\t\t});\n\tif (grid.tbar != null && grid.tbar != '') \n\t\tgrid.tbar.on('click', function(e){\n\t\t\te.stopPropagation();\n\t\t});\n}", "title": "" }, { "docid": "53c3f70c3f4183e07536ed510183e967", "score": "0.5993923", "text": "_cancel (e) {\n this.hide()\n // The 'composed: true' configuration allows the event to leave the shadow DOM tree\n // You can set to it false to see the effect\n const cancelEvent = new Event('cancel', { bubbles: true, composed: true })\n e.target.dispatchEvent(cancelEvent)\n }", "title": "" }, { "docid": "8bfba26c2d513330fce122c9584ca69c", "score": "0.5990455", "text": "function stopEvent(event) {\n\tif (event.preventDefault) {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t}\n\telse {\n\t\tevent.returnValue = false;\n\t\tevent.cancelBubble = true;\n\t}\n}", "title": "" }, { "docid": "10247d34e4a8413d7a3433f90abe2977", "score": "0.59871453", "text": "function absorbEvent(event) {\r\n var e = event || window.event;\r\n e.preventDefault && e.preventDefault();\r\n e.stopPropagation && e.stopPropagation();\r\n e.cancelBubble = true;\r\n e.returnValue = false;\r\n return false;\r\n}", "title": "" }, { "docid": "9b83b4bcf39d397aa19f667c5ea6f6fe", "score": "0.59804296", "text": "blockEvent(e) {\n e.stopPropagation();\n }", "title": "" }, { "docid": "cff756cfd6e4690b9792e0dd443cb6c7", "score": "0.59780806", "text": "stopEvent(e){\n e.preventDefault();\n e.stopPropagation();\n }", "title": "" }, { "docid": "1facee7dbc5973d389f0c1b1e574c30e", "score": "0.5975295", "text": "cancelUp(event) {\r\n // Resets cancel value\r\n this.cancel_draw = false;\r\n\r\n // restore alpha of cancle button, since there is no graphics on screen to cancel\r\n this.cancel_button.alpha = 0.33;\r\n }", "title": "" }, { "docid": "200e9fdcae4230621b4ffe02e5773f5c", "score": "0.5963157", "text": "function gcb_clickBuster (event)\r\n{\r\n //console.log (\"Clicked \" + event.clientX + \", \" + event.clientY );\r\n if (gcb_ignoreClick(event.clientX, event.clientY))\r\n {\r\n //console.log (\"... and ignored it.\");\r\n event.stopPropagation();\r\n event.preventDefault();\r\n }\r\n}", "title": "" }, { "docid": "56704535a67dcea2a02f1f6cf616223d", "score": "0.5948672", "text": "_onTouchCancel(event) {\n this.active = false;\n if(!this.props.disabled) {\n this._resetComponent();\n }\n if (this.props.onTouchCancel) {\n this.props.onTouchCancel(event);\n }\n }", "title": "" }, { "docid": "991d0c9b3b2c7ffd58a16f65f213424c", "score": "0.5939296", "text": "function HideFromClick(event)\r\n{\r\n\tvar objClicked = window.event.srcElement;\r\n\tvar objParent = objClicked.parentNode.parentNode;\r\n\t\r\n\tif (objParent.id != oMTPS_DD_PopUpDiv.id && objParent.id != oMTPS_DD_Div.id ) \r\n\t{\r\n\t\tsetTimeout(HideThisMenu, 0);\r\n\t\treturn;\r\n\t}\r\n\telse\r\n\t{\r\n\t\twindow.event.cancelBubble = true;\r\n\t\treturn;\r\n\t}\r\n}", "title": "" }, { "docid": "8a62b3d8de7c0661bb228d688f661ec8", "score": "0.59294283", "text": "function UserInputCancel() {\n\t\n\t//Cancel keystroke.\n\tevent.returnValue = false;\n}", "title": "" }, { "docid": "49d1dd280319fa07629819fe83da52e4", "score": "0.5925665", "text": "function myRightMouseDown(evt) { // For opera .\r\n//============================\r\n var MyNumber=0;\r\n if (evt) MyNumber = evt.button;\r\n else MyNumber = event.which;\r\n\r\n if ((MyNumber == 2) || (MyNumber == 3)) {\r\n alert(\"Right button is inactive\");\r\n evt.preventBubble(); // Cannot function\r\n evt.stopPropagation(); // Cannot function\r\n if (evt) evt.preventDefault(); // It works !!! Work for Netscape 6+\r\n }\r\n return false;\r\n } // myRightMouseDown", "title": "" }, { "docid": "963d528c540c806a6132327fd8bc0e5a", "score": "0.5903576", "text": "function checkCancel(event) {\n\n if (event.which === 27) {\n event.preventDefault();\n\n cancel();\n }\n }", "title": "" }, { "docid": "9edde2dbdb6ad3f8aef35e47bd72448f", "score": "0.59019643", "text": "function gcb_ignoreClick (x, y, nopop, noadd)\r\n{\r\n for (var i=0;i<gcb_clickPointX.length;i++)\r\n {\r\n var testX = gcb_clickPointX[i];\r\n var testY = gcb_clickPointY[i];\r\n\t\t// Hack by Nex: we don't need threshold\r\n //if ( ( Math.abs(x - testX) < 15 ) && ( Math.abs(y - testY) < 15 ) )\r\n if ((x == testX) && (y == testY))\r\n return true;\r\n }\r\n\tif (!noadd)\r\n\t\tgcb_addClick (x, y, nopop);\r\n return false;\r\n}", "title": "" }, { "docid": "7c9b08641771af78698a76f074fdfc95", "score": "0.5889768", "text": "onPreBubbleEvent(dc, event) {\n return __awaiter(this, void 0, void 0, function* () {\n return false;\n });\n }", "title": "" }, { "docid": "1dbbebc8a8abc0e3de6a38a5164362ad", "score": "0.5883539", "text": "consumeEvent(e) {\n e.preventDefault();\n e.stopPropagation();\n }", "title": "" }, { "docid": "b46b676e6e3b15a5aca525b53ab835dd", "score": "0.58764744", "text": "function pde(e){\n\t\tif(e.preventDefault)\n\t\t\te.preventDefault();\n\t\telse\n\t\t\te.returnValue = false;\n\t}", "title": "" }, { "docid": "f5cf953d16a3110a869bfdd5df1e6e94", "score": "0.58647996", "text": "function knackerEvent(eventObject) {\n if (eventObject && eventObject.stopPropagation) {\n eventObject.stopPropagation();\n }\n if (window.event && window.event.cancelBubble ) {\n window.event.cancelBubble = true;\n }\n \n if (eventObject && eventObject.preventDefault) {\n eventObject.preventDefault();\n }\n if (window.event) {\n window.event.returnValue = false;\n }\n}", "title": "" }, { "docid": "6a187d3c1d7b833e8479c792eed00569", "score": "0.58614945", "text": "canHandleEvent(target, type) {\n // Nothing needs to be done here\n }", "title": "" }, { "docid": "00f6f81df3adb20a3dd3611594c5729a", "score": "0.5845689", "text": "function handleClick(evt) {\n}", "title": "" }, { "docid": "9806920300aa617bc00a4a7910ae27cf", "score": "0.5826564", "text": "_handleClick(event) {\n if (this.disabled) {\n event.preventDefault();\n }\n else {\n event.stopPropagation();\n }\n }", "title": "" }, { "docid": "975df32f6637cff8a8d126cc1ddc6420", "score": "0.5821313", "text": "function onMouseUp(event){if(preventMouseUp){event.preventDefault();}}", "title": "" }, { "docid": "54b0d9167097129c087510c73c9a41f2", "score": "0.5820686", "text": "function PreventEvent( event ) {\n\tevent.preventDefault ? event.preventDefault() : ( event.returnValue = false );\n}", "title": "" }, { "docid": "2709e3d525d5c68f39ef81e151235d33", "score": "0.5820265", "text": "function preventMouseEvents(ev) {\n ev.preventDefault();\n ev.stopPropagation();\n }", "title": "" }, { "docid": "6c674a70e6ebf196112be7e41f3e2088", "score": "0.58020633", "text": "function preventDefault(evt) {\n // Because sendEvent from utils.eventdispatcher clones evt objects instead of passing them\n // we cannot call evt.preventDefault() on them\n if (!(evt instanceof MouseEvent) && !(evt instanceof window.TouchEvent)) {\n return;\n }\n if (evt.preventManipulation) {\n evt.preventManipulation();\n }\n // prevent scrolling\n if (evt.preventDefault) {\n evt.preventDefault();\n }\n}", "title": "" }, { "docid": "6c674a70e6ebf196112be7e41f3e2088", "score": "0.58020633", "text": "function preventDefault(evt) {\n // Because sendEvent from utils.eventdispatcher clones evt objects instead of passing them\n // we cannot call evt.preventDefault() on them\n if (!(evt instanceof MouseEvent) && !(evt instanceof window.TouchEvent)) {\n return;\n }\n if (evt.preventManipulation) {\n evt.preventManipulation();\n }\n // prevent scrolling\n if (evt.preventDefault) {\n evt.preventDefault();\n }\n}", "title": "" }, { "docid": "143bdc91b934f87e6828c3aed0bb31d1", "score": "0.58014923", "text": "onBubbleEvent(event) {\n if (event.name === 'onKeyUp') {\n this.dom.state.validated = false;\n this.dom.setTimeout(`trigger-validation`, () => {\n this._triggerFormValidation();\n }, 500);\n }\n if (IsValidFieldPatchEvent(this.core, event) || event.name === 'onBlur') {\n this.dom.setTimeout(`trigger-validation`, () => {\n this._triggerFormValidation();\n }, 500);\n }\n else {\n // if a field is focused we want a chance to validate again\n // this.dom.state.validated = false;\n }\n // if( event.type === 'field' && event.name === 'onChange' ) event.form = this.ui.form;\n this.events.emit(event);\n }", "title": "" }, { "docid": "d1770b955eba2838bf4d0714e1c09ef4", "score": "0.5798477", "text": "dispatchEvent(event) {\n let target = event.target = this;\n let cancelable = event.cancelable;\n let handler;\n let i;\n\n do {\n event.currentTarget = target;\n handler = target._handlers[event.type.toLowerCase()];\n if(handler) {\n for(i=handler.length; i--;) {\n if((handler[i].call(target, event) == false || event._end) && cancelable) {\n event.defaultPrevented = true;\n }\n }\n }\n } while (event.bubbles && !(cancelable && event._stop) && (target = target.parentNode));\n\n return handler != null;\n }", "title": "" }, { "docid": "84029e60421e1e58606e3f4660e38c97", "score": "0.5791297", "text": "function preventDefault(){\r\n\t\tif(this.cancelable){\r\n\t\t\tthis.defaultPrevented=true;\r\n\t\t\tthis.returnValue=false;\r\n\t\t}\r\n\t}", "title": "" }, { "docid": "4010d5bc1bc0f8a3b7dd1deba13e04b4", "score": "0.57765496", "text": "function isDefaultPrevented(evt) {\n if (typeof evt.defaultPrevented !== 'undefined') {\n return evt.defaultPrevented;\n } else if (typeof evt.isDefaultPrevented === 'function') {\n return evt.isDefaultPrevented();\n }\n\n return false;\n}", "title": "" }, { "docid": "e1cf8a8af3cef23e1d7fc523624a96e3", "score": "0.5769209", "text": "handleCancel(e) {\n e.preventDefault();\n e.stopPropagation();\n this.props.cancellingCompose(this.props.listItem.id);\n }", "title": "" }, { "docid": "ab7aad78f315e1e761d08a8aadde54c9", "score": "0.5767928", "text": "function onClick(tracker, event) {\n if (tracker.clickHandler) {\n $.cancelEvent(event);\n }\n }", "title": "" }, { "docid": "04f2eccb4a5a30ffa16fe4b468d3194c", "score": "0.5762191", "text": "function nocontextmenu() // this function only applies to IE4, ignored otherwise.\n{\n event.cancelBubble = true\n event.returnValue = false;\n\n return false;\n}", "title": "" }, { "docid": "0fb6bb5c6fb12978dbfa7b7f8c2051a2", "score": "0.5757436", "text": "handleClick(event){\n event.stopPropagation();\n }", "title": "" }, { "docid": "7462c95997a91a21e39a7c03f971aa72", "score": "0.5756279", "text": "onClick(event) {\n event.stopPropagation();\n }", "title": "" }, { "docid": "8a0ed79b1fdfe282e285938aca6a32b3", "score": "0.57484746", "text": "function click(evt)\n{ // rationalise event syntax\nvar e=(evt)?evt :window.event;\nvar message=\"You cannot do that\";\n// test for IE\nif(typeof e.which==\"undefined\")\n{ // right click event\nif(e.button==2)\n{ \nreturn false;\n// ---------\n}\nelse\n{ // other types of events\n\n}\n}\nelse\n{ // for other browsers\nif(e.which==3)\n{ \ne.preventDefault();\ne.stopPropagation();\nreturn false;\n// -----------\n}\nelse\n{ // other types of events\n}\n}\n}", "title": "" }, { "docid": "b01836fddf309defdc3c9dad37cb2337", "score": "0.574645", "text": "function dragHandler(evt) {\n evt.preventDefault();\n evt.stopPropagation();\n}", "title": "" }, { "docid": "2bfe21a653bd93df7322e05d5cfc957f", "score": "0.5742362", "text": "function _explorerTreeStopGeckoSelect(evt) {\r\n if (!evt) var evt = window.event;\r\n if (evt.preventDefault) {\r\n evt.preventDefault();\r\n }\r\n return true;\r\n}", "title": "" }, { "docid": "110a8560e39b3567f330cd37bf5bfed7", "score": "0.57384175", "text": "function isPropagationStopped(event) {\r\n if (typeof event.isPropagationStopped === \"function\") {\r\n return event.isPropagationStopped();\r\n } else if (typeof event.cancelBubble !== \"undefined\") {\r\n return event.cancelBubble;\r\n }\r\n return false;\r\n}", "title": "" }, { "docid": "a7d851162aecd87a21e37056263952c2", "score": "0.5730205", "text": "function _dragndropPreventDefault (event) {\n event.stopPropagation();\n event.preventDefault();\n}", "title": "" }, { "docid": "09bd26ebb386416b3475b0ee19ae84de", "score": "0.57273734", "text": "function cancel(e) {\n e.preventDefault();\n if (e.dataTransfer) e.dataTransfer.dropEffect = 'copy';\n}", "title": "" }, { "docid": "a4a831367dfc18c559dd450959c1e901", "score": "0.5709422", "text": "function onCancel() {\r\n\t\t\t\t __dlg_close(null);\r\n\t\t\t\t return false;\r\n\t\t\t\t}", "title": "" }, { "docid": "6aecb22a128ed53aa99f476884218797", "score": "0.5701184", "text": "function preventBubble(handler, target) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n return function (e) {\n e.stopPropagation();\n // handler.apply(target, [...args, e])\n handler.bind(target).apply(void 0, __spreadArrays(args, [e]));\n };\n }", "title": "" }, { "docid": "0fd1ec61b19791196fdd89cdba3162ea", "score": "0.5699449", "text": "handleClick(event) {\n event.stopPropagation();\n }", "title": "" }, { "docid": "c8d8a930b01944335841d3ef21134958", "score": "0.569466", "text": "function preventDefault(evt) {\n evt.preventDefault();\n}", "title": "" }, { "docid": "c94096c2d0fde3cdccdfc785ca737270", "score": "0.56890893", "text": "_stopEventPropagation(e) {\n if (e.keyCode !== this.UP_KEY_CODE && e.keyCode !== this.DOWN_KEY_CODE) {\n e.stopPropagation();\n }\n }", "title": "" }, { "docid": "6cb11cfc148252aabb23ce76d11b931f", "score": "0.5686425", "text": "get isOtherInteracting() {\n return (\n pseudoEvent !== null &&\n pseudoEvent.original !== event\n );\n }", "title": "" }, { "docid": "84b9893f51191f61c9f1760bef2c7b3d", "score": "0.56840014", "text": "preventDefault(evt) {\n evt.preventDefault();\n }", "title": "" }, { "docid": "0a1db7fd41d127915ab07921b97aa42a", "score": "0.56836164", "text": "static swallowEvent(event) {\n if (event) {\n event.stopPropagation();\n event.preventDefault();\n }\n }", "title": "" }, { "docid": "f1f659e4178900bad4082fdd617cf031", "score": "0.56828636", "text": "function nonstandardClick(event) {\n return event.button !== 0 ||\n event.altKey ||\n event.ctrlKey ||\n event.shiftKey ||\n event.metaKey;\n }", "title": "" }, { "docid": "61605a2239097fd4a5919e818fe62f62", "score": "0.56805646", "text": "function preventBehavior(e){ \n e.preventDefault(); \n}", "title": "" }, { "docid": "186aa02ad6d287db35d14ff133d01bb0", "score": "0.56771624", "text": "function preventEvent(e) {\n\tvar ev = e || window.event;\n\tif (ev.preventDefault) ev.preventDefault();\n\telse ev.returnValue = false;\n\tif (ev.stopPropagation)\n\t\tev.stopPropagation();\n\treturn false;\n}", "title": "" }, { "docid": "fb74a7ac635ac79fb43596d482dceeee", "score": "0.56739676", "text": "onMouseDown(pEvent) {\n\t}", "title": "" }, { "docid": "c33f24f82b6d52b225552040e08b4ff5", "score": "0.5673051", "text": "function fixEvent(evt, elem) {\n var e = evt || window.event, t = e.target, doc, body;\n e.preventDefault = e.preventDefault || function() {this.returnValue = false;};\n e.stopPropagation = e.stopPropagation || function() {this.cancelBubble = true;};\n \n if(!t) {\n t = e.target = e.srcElement || elem;\n e.currentTarget = elem; //ofcourse :D\n }\n \n // bug in safari? for text nodes\n if(t.nodeType === 3 ) {\n e.target = e.target.parentNode;\n }\n \n if(!e.relatedTarget && e.fromElement) {\n e.relatedTarget = e.fromElement === e.target ? e.toElement : e.fromElement;\n }\n \n // fix buttons\n if(!e.buttons) {\n e.buttons = e.button;\n }\n \n // positioning\n if(!e.pageX || !e.pageY) {\n if(e.clientX || e.clientY) {\n doc = e.target.ownerDocument || document;\n body = doc.body;\n e.pageX = e.clientX + body.scrollLeft;\n e.pageY = e.clientY + body.scrollTop;\n }\n }\n }", "title": "" }, { "docid": "a8ccf41189990f6388d09d6de9f1b830", "score": "0.5672517", "text": "onClick(pEvent) {\n\t}", "title": "" }, { "docid": "da06666bc1adf3e8459db0d581247495", "score": "0.5668759", "text": "function preventEvent(event) {\n if (event.cancelable) {\n // если событие может быть отменено и предотвращено\n event.preventDefault(); // отменяем действие события по умолчанию\n console.log('Событие ' + event.type + ' отменено'); // выводим в консоль информацию о том какое событие было отменено\n } else {\n // если событие не может быть отменено и предотвращено\n console.warn('Событие ' + event.type + ' не может быть отменено'); // выводим в консоль информацию о том, что данное событие не может быть отменено\n }\n}", "title": "" }, { "docid": "9db9dff98121c00a021f966be7e52ba9", "score": "0.56653094", "text": "handleEvent() {\n return true; // continue event propagation\n }", "title": "" }, { "docid": "d728ea29abbb3163bf2531840fea1178", "score": "0.5660394", "text": "cancel() {\n assert_js_1.assert(!this._handled, 'Cannot cancel FileChooser which is already handled!');\n this._handled = true;\n }", "title": "" }, { "docid": "68f3b06406509397ba7190976b3243a4", "score": "0.5658489", "text": "handleEvent() {\n return true; // continue event propagation\n }", "title": "" }, { "docid": "8aac44766c82245545f704a20b776724", "score": "0.56574297", "text": "function onClick( tracker, event ) {\n if ( tracker.clickHandler ) {\n $.cancelEvent( event );\n }\n }", "title": "" }, { "docid": "8aac44766c82245545f704a20b776724", "score": "0.56574297", "text": "function onClick( tracker, event ) {\n if ( tracker.clickHandler ) {\n $.cancelEvent( event );\n }\n }", "title": "" } ]
940a8ed1de7aa139241ad02981940d5c
a single array value to transport through one Promise. wrap each value into its own promise:
[ { "docid": "41cdb1be2a28e22f13ccda8a057e03ad", "score": "0.0", "text": "function foo(bar,baz) {\n\tvar x = bar * baz;\n\n\t// return both promises\n\treturn [\n\tPromise.resolve(x),\n\tgetY( x )\n\t];\n}", "title": "" } ]
[ { "docid": "71ce9979e9453e8c83e63911ab3ab0ad", "score": "0.72774255", "text": "resolve () {\n const promise = this.then(async function (array) {\n const result = new Array(array.length)\n for (let i = 0, length = array.length; i < length; ++i) {\n result[i] = await array[i]\n }\n return result\n })\n return PromisedArray.fromPromise(promise)\n }", "title": "" }, { "docid": "24383367d7a3be550cb1e0b74616645c", "score": "0.7244234", "text": "static fromArray (array) {\n const promise = Promise.resolve(array)\n return PromisedArray.fromPromise(promise)\n }", "title": "" }, { "docid": "78fbf8607e6213e23c110aeea65581af", "score": "0.6851094", "text": "resolveConcurrently () {\n const promise = this.then(function (array) {\n return Promise.all(array)\n })\n return PromisedArray.fromPromise(promise)\n }", "title": "" }, { "docid": "51f216bbb82140139709c6f9de71b40c", "score": "0.680671", "text": "function promisesInSerial(arr) {\n arr.reduce(function(curr, next) {\n return curr.then(next)\n }, Promise.resolve());\n}", "title": "" }, { "docid": "2ea7c3de507037df8343d1d0547b6dba", "score": "0.6466731", "text": "function hell1() {\n let arr = [12, 4, 5, 6];\n return new Promise(resolve => {\n resolve(arr); //returns array\n })\n}", "title": "" }, { "docid": "4671ad5f06b714c8b9aa74cd7025dd16", "score": "0.64665806", "text": "all(arr) {\n\t\treturn this.then(() => Promise.all(arr));\n\t}", "title": "" }, { "docid": "f2375a7c78f9d52237c7a07c9588314e", "score": "0.64340395", "text": "static race(iterable) {\n return new Cromise(function(resolve, reject) {\n let done = false\n for (let i = 0, length = iterable.length; i < length && !done; i++) {\n Cromise.resolve(iterable[i]).then(\n value => ((!done && resolve(value)), done = true), \n reject\n )\n }\n })\n }", "title": "" }, { "docid": "3316289910a098587d095dac191baa7b", "score": "0.6398875", "text": "function oneAfterTheOther(arr) {\n\tvar promise = new Promise((resolve) => {\n\t\tif (arr && arr[0]) {\n\t\t\tlet results = [];\n\t\t\tinternalExecutor(arr, results, resolve);\n\t\t} else {\n\t\t\tresolve();\n\t\t}\n\t});\n\treturn promise;\n}", "title": "" }, { "docid": "30d9c1fbec318e4694fd3d22845a04fa", "score": "0.6140858", "text": "function workPositionArray(array) {\n return new Promise(function(resolve, reject) {\n var i\n var list = []\n for (i = 0; i < array.length; i++) {\n workPosition(array[i][1]).then(function(work) {\n\n list.push(work)\n //list = list + work\n //console.log(work)\n\n })\n resolve(list)\n }\n\n\n\n })\n }", "title": "" }, { "docid": "a5d4bde5bb4c1909e37539ac019f056e", "score": "0.61299986", "text": "function runPromiseInSequence(arr, input) {\r\n return arr.reduce(\r\n (promiseChain, currentFunction) => promiseChain.then(currentFunction),\r\n Promise.resolve(input)\r\n )\r\n}", "title": "" }, { "docid": "05a64d2f35580b190e9741458e66d21c", "score": "0.61002564", "text": "function promise_all(arg) {\n if (Array.isArray(arg)) {\n return Promise.all(escape_quoted_promises(arg)).then(unescape_quoted_promises);\n }\n\n return arg;\n } // ----------------------------------------------------------------------", "title": "" }, { "docid": "3b6e6c0dc1ffe9d38695edf332a8e5cd", "score": "0.6091764", "text": "function resolveAsArray(value) {\n if (isArray(value)) {\n // found an array, thus its _per type_\n return value.map(function (v) { return resolve(v); });\n }\n // it's a single entity, so just resolve it normally\n return [resolve(value)];\n }", "title": "" }, { "docid": "10eb95719f2f4be51f06d0422ccbd957", "score": "0.60736084", "text": "function toPromise(obs) {\n const res = [];\n return new Promise((resolve, reject) => {\n obs.forEach((item) => { res.push(item); }).then(() => resolve(res), reject);\n });\n}", "title": "" }, { "docid": "1adbcba3cb7c5775cbd0bbfa13dbec36", "score": "0.60298795", "text": "function getPromiseData(promisesArray) {\n\treturn new Promise(function (resolve, reject) {\n\t\t// call promise.all on array of fetch calls\n\t\tPromise.all(promisesArray)\n\t\t// get json data\n\t\t.then(function (res) {\n\t\t\treturn res.map(function (type) {\n\t\t\t\treturn type.json();\n\t\t\t});\n\t\t})\n\t\t// array of json calls passed to callback\n\t\t.then(function (res) {\n\t\t\tPromise.all(res).then(resolve);\n\t\t}).catch(reject);\n\t});\n}", "title": "" }, { "docid": "d23d47bc89253fcd42234a6ff4c7fb35", "score": "0.6012155", "text": "function getItems() {\n const items = [6, 9, 3];\n return Promise.resolve(items);\n}", "title": "" }, { "docid": "6a058324a05469ec158838a0716e8048", "score": "0.6009392", "text": "async awaitEval(array, values, log) {\n let promises = [];\n for (let i = 0; i < array.length; ++i) {\n promises.push(eval(`this.${array[i]}Eval(values, log)`))\n }\n return Promise.all(promises);\n }", "title": "" }, { "docid": "25a02843c4828307f92f954cca950592", "score": "0.5995957", "text": "static all(iterable) {\n return new Cromise(function(resolve, reject) {\n (function recursion(i) {\n return Cromise.resolve(iterable[i]).then(value => {\n iterable[i] = value\n if (i < iterable.length - 1) {\n recursion(i + 1)\n } else {\n resolve(iterable)\n }\n },\n reject\n )\n })(0)\n })\n }", "title": "" }, { "docid": "c4adf25a53874cf903e0bba7e7cf8aed", "score": "0.5982245", "text": "each(array, operator) {\n if (array.length > 0) {\n const results = []\n const counter = { count: -1 }\n const run = () => {\n const i = (counter.count += 1)\n if (i < array.length) {\n return this.then(_ => operator(array[i])).then(result => {\n results[i] = result\n return run()\n })\n }\n }\n return run().then(_ => results)\n } else {\n return this.resolve([])\n }\n }", "title": "" }, { "docid": "b60fd6c2eaf1ba3f8cb3dccfdd0ca8e9", "score": "0.59728986", "text": "function show(){\n return new Promise(resolve=>{\n \n \n arr = [a,b]\n \n })\n}", "title": "" }, { "docid": "b21c2ef1cc9fe90ef30534e79ec7b02d", "score": "0.595885", "text": "function getAllData(arr) {\n return new Promise(function(resolve, reject) {\n \n let promises = [];\n\n promises = arr.map(function(movie) {\n let url = CONFIG.movieDetails;\n url = url.replace('MOVIE_ID', movie.id);\n\n return serverCall(url);\n });\n\n Promise.allSettled(promises)\n .then(function(res) {\n \n resolve(parseFullResult(res));\n })\n .catch(function(error) {\n\n reject('error');\n });\n });\n}", "title": "" }, { "docid": "dbbad300b6ef81a30b8aca228e33ccbf", "score": "0.5955193", "text": "function ASyncSum(arr)\n{\n var prom = new Promise(resolve => \n {\n var result = arr.reduce((x,y) => x.concat(y)).reduce((x,y) => x+y);\n \n setTimeout(() => resolve(result), 2000);\n })\n \n return prom;\n}", "title": "" }, { "docid": "8c5013d1172ebd0e6179e42a6265226b", "score": "0.595337", "text": "function mapAndChain(array, promiseFn) {\n // Start the promise chain with a resolved promise.\n return array.reduce((chain, item) => chain.then(() => promiseFn(item)), Promise.resolve());\n}", "title": "" }, { "docid": "761170537c9a3c9f91ed695faac83975", "score": "0.5940673", "text": "forEach (callback, context) {\n const promise = this.then(async function (array) {\n for (let i = 0, length = array.length; i < length; ++i) {\n await callback.call(context, array[i], i, array)\n }\n return array\n })\n return PromisedArray.fromPromise(promise)\n }", "title": "" }, { "docid": "a8b443608bebb840a3a3d35a7fbaa6d6", "score": "0.59064746", "text": "function connectionFromPromisedArray(dataPromise, args) {\n\t return dataPromise.then(function (data) {\n\t return connectionFromArray(data, args);\n\t });\n\t}", "title": "" }, { "docid": "4e56fc925ed262ea519d16001821cdf6", "score": "0.5883782", "text": "function forEachPromise(anArray, step, ifEmpty) {\n var i,c=0,n=anArray.length\n if (n===0) return step(ifEmpty, 0, n)\n for(i=0; i<n; ++i) {\n var p = anArray[i]\n if (p!=null && typeof p.then === 'function')\n p.then(step_true, step_false)\n else step(true, ++c, n)\n }\n function step_true() {step(true, ++c, n)}\n function step_false() {step(false, ++c, n)}\n }", "title": "" }, { "docid": "9d4025f43f7f3453b4679d845e8c693f", "score": "0.586738", "text": "function asyncSeries(arr, iter) {\n arr = arr.slice(0);\n\n var memo = [];\n\n // Run one at a time\n return new Promise(function (resolve, reject) {\n var next = function () {\n if (arr.length === 0) {\n resolve(memo);\n return;\n }\n Promise.cast(iter(arr.shift())).then(function (res) {\n memo.push(res);\n next();\n }, reject);\n };\n next();\n });\n}", "title": "" }, { "docid": "d116a4b8740e5b97c27104cffff8c7ad", "score": "0.58540195", "text": "map (callback, context) {\n const promise = this.then(async function (array) {\n const result = new Array(array.length)\n for (let i = 0, length = array.length; i < length; ++i) {\n result[i] = await callback.call(context, array[i], i, array)\n }\n return result\n })\n return PromisedArray.fromPromise(promise)\n }", "title": "" }, { "docid": "d42254245af1685df747b278f8d09c74", "score": "0.58307326", "text": "static any() {\n const args = from(arguments);\n return Promise.all(args).reduce(flatten, []);\n }", "title": "" }, { "docid": "6c096c07e4cc6413b0ae5f6afb2c379f", "score": "0.58260846", "text": "function connectionFromPromisedArray(dataPromise, args) {\n return dataPromise.then((data) => connectionFromArray(data, args));\n}", "title": "" }, { "docid": "26922fc652576c41f19c4c6196aa41aa", "score": "0.5825993", "text": "function multi(prom, args){\n\n var p=new Promise(function(resolve,reject){\n\tif(args.length===0) return resolve([]);\n\tvar R=[], N=args.length; \n\tfor(var i=0;i<N;i++){\n\t prom(args[i])\n\t\t.then(function(r){\n\t\t R.push(r); N--; if(N===0){ resolve(R); }\n\t\t})\n\t\t.catch(function(error){ reject(error)} );\n\t //pri(args)\n\t}\n });\n return p;\n}", "title": "" }, { "docid": "7a56a33f2d00f4f598cbc3f3126acc53", "score": "0.5816502", "text": "function myPromiseAll(taskList) {\n const results = []\n let promisesCompleted = 0;\n return new Promise((resolve, reject) => {\n taskList.forEach((promise, index) => {\n promise.then((val) => {\n results[index] = val;\n promisesCompleted += 1;\n if (promisesCompleted === taskList.length) {\n resolve(results)\n }\n })\n .catch(error => {\n reject(error)\n })\n })\n });\n}", "title": "" }, { "docid": "84132a5fa13b6c6d065d8b02c448f6fa", "score": "0.5804944", "text": "function s$1K(t){return Promise.all(t)}", "title": "" }, { "docid": "a8fef827497cbb69ee6f2f4f905816c5", "score": "0.580332", "text": "function promiseMap(){\n var Promise = require(\"bluebird\");\n var endPoint = \"https://jsonplaceholder.typicode.com\";\n\n let userIds = [1, 2, 3, 4];\n //hace varias promesas con distinta id de user,\n //en \"data\" estan todas las respuestas de las promesas\n Promise.map(userIds, userId => {\n return axios.get(`${endPoint}/users/${userId}`);\n })\n .then( data => {\n for(var i=0; i<userIds.length;i++){\n console.log(data[i].data)\n }\n });\n}", "title": "" }, { "docid": "d879d739eda15538757981b19a148b1a", "score": "0.579704", "text": "function eachSeries(arr, fun) {\n\t return arr.reduce(function (p, e) {\n\t return p.then(function () {\n\t return fun(e);\n\t });\n\t }, Promise.resolve());\n\t}", "title": "" }, { "docid": "dca05c60fec811cdbe211553158c8e02", "score": "0.5782041", "text": "function connectionFromPromisedArray(dataPromise, args) {\n return dataPromise.then(function (data) {\n return connectionFromArray(data, args);\n });\n}", "title": "" }, { "docid": "d41c664c5931fea71623401fbd277520", "score": "0.5765256", "text": "function promiseCollector(promFunc, arr) {\r\n\r\n const promises = [];\r\n arr.forEach((item) => {\r\n promises.push(new Promise((resolve, reject) => {\r\n promFunc(item, resolve, reject)\r\n }))\r\n })\r\n\r\n return Promise.all(promises)\r\n\r\n}", "title": "" }, { "docid": "de2fd896d663c53fa2cc4316b684b5eb", "score": "0.5754057", "text": "function futureSequence(values, ec) {\n return Future.create(cb => {\n try {\n // This can throw, handling error below\n const futures = futureIterableToArray(values, ec);\n // Short-circuit in case the list is empty, otherwise the\n // futureSequenceLoop fails (must be non-empty as an invariant)\n if (futures.length === 0)\n return cb(Success([]));\n const cRef = Cancelable.of(() => futureCancelAll(futures, ec));\n // Creating race condition\n let isDone = false;\n let finishedCount = 0;\n let finalArray = [];\n for (let index = 0; index < futures.length; index++) {\n const fi = index;\n const fa = futures[index];\n fa.onComplete(result => {\n finishedCount += 1;\n if (result.isSuccess()) {\n if (!isDone) {\n finalArray[fi] = result.get();\n isDone = finishedCount === futures.length;\n if (isDone)\n cb(Success(finalArray));\n }\n }\n else {\n if (!isDone) {\n isDone = true;\n cRef.cancel();\n cb(result);\n }\n else {\n ec.reportFailure(result.failed().get());\n }\n }\n });\n }\n return cRef;\n }\n catch (e) {\n // If an error happens here, it means the conversion from iterable to\n // array failed, and the futures we've seen are already canceled\n cb(Failure(e));\n }\n }, ec);\n}", "title": "" }, { "docid": "9d1d8e253f040697b361cbd3986fdcfa", "score": "0.5740915", "text": "static isPromisedArray (array) {\n return array instanceof Promise && typeof array.map === 'function'\n }", "title": "" }, { "docid": "d728c3d9a622b4381223a3a7a5e9fdd1", "score": "0.5723648", "text": "then(...args) { return this.toPromise().then(...args); }", "title": "" }, { "docid": "0e7fd353e2e80a51c6c6d2ed6e02bb9d", "score": "0.5716331", "text": "function batchGetValue(xs) {\n return xs.map(function (x) {\n return x.read();\n });\n}", "title": "" }, { "docid": "d15b3e00e9e5c3482537556ed663022a", "score": "0.57142586", "text": "function workMyCollection(arr) {\n return arr.reduce((promise, item) => {\n return promise\n .then((result) => {\n return ship(item)\n })\n .catch(console.error)\n }, Promise.resolve())\n }", "title": "" }, { "docid": "6fa4e70f16b2af6a98a069827e5d631f", "score": "0.5708927", "text": "function postResults(EmployeeArray) {\n return new Promise(function (resolve, reject) {\n $.ajax({\n url: '/Hr/AccruePto',\n method: \"POST\",\n contentType: \"application/json\",\n data: JSON.stringify(EmployeeArray)\n\n }).done(function (data) {\n resolve(data)\n })\n .error(function (err) {\n reject(err)\n })\n })\n}", "title": "" }, { "docid": "1fda6a75f58e3f7c6e58054f160c47d6", "score": "0.5704733", "text": "function getAll(arr){\n\treturn Promise.all( arr.map(function(key){\n\t\treturn cart.getItem(key);\n\t}) );\n}", "title": "" }, { "docid": "c21f5ce561d7d457e384b33dc7d6dbb4", "score": "0.5697944", "text": "function batchGetValue(xs) {\n return xs.map(function (x) { return x.read(); });\n}", "title": "" }, { "docid": "7e9b032b5f23061f7a5db7d3beecb01d", "score": "0.5695895", "text": "async function generatorToArray(resp) {\n let result = []\n for await (let x of resp) {\n result.push(x)\n }\n return result\n}", "title": "" }, { "docid": "debc23470362c8129a807469e5a6324e", "score": "0.56950355", "text": "function multiPromInSequence() {\n function all(prom1, prom2) {\n let counter = 0;\n // return only when both are completed\n return new Promise(((fulfill, reject) => {\n const allValue = [];\n\n function incremAndSend() {\n counter++;\n // console.log(counter);\n if (counter == 2) {\n fulfill(allValue);\n }\n }\n\n prom1.then((data1) => {\n allValue[0] = data1;\n // console.log(data1);\n incremAndSend();\n });\n\n prom2.then((data2) => {\n // console.log(\"Data2\");\n allValue[1] = data2;\n incremAndSend();\n });\n }));\n }\n\n all(getPromise1(), getPromise2()).then((data) => {\n console.log(data);\n });\n} // multiPromInSequence(); // Multiple promises Exercise 11 of 13", "title": "" }, { "docid": "b1031606f058d522d61ac5e50eb6544d", "score": "0.56420946", "text": "function myPromiseFunc(myString, arr) {\n console.log('Called 2!');\n return new Promise(function (resolve, reject) {\n for (let val of arr) {\n myString = myString.replace(val, \"***\");\n }\n resolve(myString);\n });\n}", "title": "" }, { "docid": "eac9a22d3fc889cfcd90fcb049b82bbf", "score": "0.55947524", "text": "addMultipleFast(vals) {\n return this.db.then(async db => new Promise((resolve, reject) => {\n let i = 0;\n const request = db.transaction('items', 'readwrite')\n const tx = request.objectStore('items');\n vals.forEach(val => {\n const req = tx.add(val);\n req.onerror = reject;\n req.onsuccess = handleSuccess;\n });\n function handleSuccess(e) {\n i++;\n if (i === vals.length) resolve(e);\n }\n }));\n }", "title": "" }, { "docid": "caf3bcfc4670027cd324e1f11a704ffb", "score": "0.55885935", "text": "function sequence(values, fn, initialValue) {\n var result = Promise.resolve(initialValue);\n values.forEach(function (value) {\n result = result.then(function (lastResult) { return fn(value, lastResult); });\n });\n return result;\n}", "title": "" }, { "docid": "caf3bcfc4670027cd324e1f11a704ffb", "score": "0.55885935", "text": "function sequence(values, fn, initialValue) {\n var result = Promise.resolve(initialValue);\n values.forEach(function (value) {\n result = result.then(function (lastResult) { return fn(value, lastResult); });\n });\n return result;\n}", "title": "" }, { "docid": "24ec5fee0ffda26c596d813ad26f42fa", "score": "0.5583563", "text": "insertAllEventsInSequence(arr) {\n // chain the inserting\n return arr.reduce((promise, eventItem) =>\n promise.then((result) =>\n this.insertEvent(result, eventItem).then(() => {\n this.$log.debug(`finished item ${this.insertProgressCount}`);\n this.insertProgressCount++;\n })\n ),\n this.$q.when([]));\n }", "title": "" }, { "docid": "70358c2c3473c450a1998faca889591a", "score": "0.5574873", "text": "static async promiseChainThen(promiseParameters) {\n const promiseArray = [];\n promiseParameters.forEach((promiseParameter) => {\n promiseArray.push(\n async () => {\n return PromiseHelpers.makePromise(\n promiseParameter.instance,\n promiseParameter.endCondition,\n promiseParameter.preResolveMethod,\n promiseParameter.pollMethod,\n promiseParameter.pollTime\n );\n });\n });\n\n let result;\n for (const f of promiseArray) {\n result = await f(result);\n }\n\n\t\treturn result;\n }", "title": "" }, { "docid": "70358c2c3473c450a1998faca889591a", "score": "0.5574873", "text": "static async promiseChainThen(promiseParameters) {\n const promiseArray = [];\n promiseParameters.forEach((promiseParameter) => {\n promiseArray.push(\n async () => {\n return PromiseHelpers.makePromise(\n promiseParameter.instance,\n promiseParameter.endCondition,\n promiseParameter.preResolveMethod,\n promiseParameter.pollMethod,\n promiseParameter.pollTime\n );\n });\n });\n\n let result;\n for (const f of promiseArray) {\n result = await f(result);\n }\n\n\t\treturn result;\n }", "title": "" }, { "docid": "eeb30ebff920d54e52b40d9dc7151451", "score": "0.5567029", "text": "function resolve_promises(arg) {\n var promises = [];\n traverse(arg);\n\n if (promises.length) {\n return resolve(arg);\n }\n\n return arg;\n\n function traverse(node) {\n if (is_promise(node)) {\n promises.push(node);\n } else if (node instanceof Pair) {\n if (!node.haveCycles('car')) {\n traverse(node.car);\n }\n\n if (!node.haveCycles('cdr')) {\n traverse(node.cdr);\n }\n } else if (node instanceof Array) {\n node.forEach(traverse);\n }\n }\n\n function promise(_x16) {\n return _promise.apply(this, arguments);\n }\n\n function _promise() {\n _promise = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee19(node) {\n var pair;\n return regenerator.wrap(function _callee19$(_context20) {\n while (1) {\n switch (_context20.prev = _context20.next) {\n case 0:\n _context20.t0 = Pair;\n\n if (!node.haveCycles('car')) {\n _context20.next = 5;\n break;\n }\n\n _context20.t1 = node.car;\n _context20.next = 8;\n break;\n\n case 5:\n _context20.next = 7;\n return resolve(node.car);\n\n case 7:\n _context20.t1 = _context20.sent;\n\n case 8:\n _context20.t2 = _context20.t1;\n\n if (!node.haveCycles('cdr')) {\n _context20.next = 13;\n break;\n }\n\n _context20.t3 = node.cdr;\n _context20.next = 16;\n break;\n\n case 13:\n _context20.next = 15;\n return resolve(node.cdr);\n\n case 15:\n _context20.t3 = _context20.sent;\n\n case 16:\n _context20.t4 = _context20.t3;\n pair = new _context20.t0(_context20.t2, _context20.t4);\n\n if (node[__data__]) {\n pair[__data__] = true;\n }\n\n return _context20.abrupt(\"return\", pair);\n\n case 20:\n case \"end\":\n return _context20.stop();\n }\n }\n }, _callee19);\n }));\n return _promise.apply(this, arguments);\n }\n\n function resolve(node) {\n if (node instanceof Array) {\n return promise_all(node.map(resolve));\n }\n\n if (node instanceof Pair && promises.length) {\n return promise(node);\n }\n\n return node;\n }\n } // -------------------------------------------------------------------------", "title": "" }, { "docid": "bcac48d3b1f3be319b365e4210f867e4", "score": "0.55537987", "text": "function ArrayTester(Promise) {\n\tvar memo = {}\n\t\n\t// These are the functions used to map source values to input values.\n\t// Each permutation of these options will be tested for a given source array.\n\t// These functions are invoked with a `this` value of a Context object.\n\tvar options = [\n\t\n\t\t// the value itself\n\t\tfunction (i) {\n\t\t\tif (i in this.source) {\n\t\t\t\tthis.input[i] = this.source[i]\n\t\t\t}\n\t\t\tthis.description[i] = 'value'\n\t\t},\n\t\t\n\t\t// a settled promise of the value\n\t\tfunction (i) {\n\t\t\tvar item = this.getItem(i)\n\t\t\tthis.input[i] = item.rejected ? Promise.reject(item.value).catchLater() : Promise.resolve(item.value)\n\t\t\tthis.description[i] = 'settled promise'\n\t\t},\n\t\t\n\t\t// an eventually-settled promise of the value\n\t\tfunction (i) {\n\t\t\tvar item = this.getItem(i)\n\t\t\tvar afters = this.afters\n\t\t\tthis.input[i] = new Promise(function (res, rej) {\n\t\t\t\tafters.push(function () {\n\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t;(item.rejected ? rej : res)(item.value)\n\t\t\t\t\t}, 1)\n\t\t\t\t})\n\t\t\t})\n\t\t\tthis.description[i] = 'eventual promise'\n\t\t},\n\t\t\n\t\t// an already-settled foreign thenable object\n\t\tfunction (i) {\n\t\t\tvar item = this.getItem(i)\n\t\t\tvar thenable = this.input[i] = new Thenable\n\t\t\tthenable[item.rejected ? 'reject' : 'resolve'](item.value)\n\t\t\tthis.description[i] = 'settled thenable'\n\t\t},\n\t\t\n\t\t// an eventually-settled foreign thenable object\n\t\tfunction (i) {\n\t\t\tvar item = this.getItem(i)\n\t\t\tvar afters = this.afters\n\t\t\tvar thenable = this.input[i] = new Thenable\n\t\t\tafters.push(function () {\n\t\t\t\tsetTimeout(function () {\n\t\t\t\t\tthenable[item.rejected ? 'reject' : 'resolve'](item.value)\n\t\t\t\t}, 1)\n\t\t\t})\n\t\t\tthis.description[i] = 'eventual thenable'\n\t\t}\n\t\t\n\t]\n\t\n\t// This function runs the given test for each possible permutation of the\n\t// given source array. Permutations are created by transforming the source\n\t// array items through different \"options\" (listed above).\n\tthis.test = function (source, test) {\n\t\tvar permutations = memo[source.length]\n\t\t\n\t\tif (!permutations) {\n\t\t\tmemo[source.length] = permutations = permutate(options, source.length)\n\t\t\t// In addition to the standard permutations, we also want to have\n\t\t\t// test cases where every value in the source array is transformed\n\t\t\t// through the same option.\n\t\t\tfor (var i=0; i<options.length; i++) {\n\t\t\t\tvar extraTextCase = new Array(source.length)\n\t\t\t\tfor (var j=0; j<source.length; j++) {\n\t\t\t\t\textraTextCase[j] = options[i]\n\t\t\t\t}\n\t\t\t\tpermutations.push(extraTextCase)\n\t\t\t}\n\t\t}\n\t\t\n\t\tpermutations.forEach(function (options) {\n\t\t\tvar context = new Context(source)\n\t\t\tfor (var i=0, len=source.length; i<len; i++) {\n\t\t\t\toptions[i].call(context, i)\n\t\t\t}\n\t\t\tcontext.doTest(test)\n\t\t})\n\t}\n\t\n\t// Objects of this class are used to store information required to build a\n\t// single test case.\n\tfunction Context(source) {\n\t\tthis.source = source\n\t\tthis.input = new Array(source.length)\n\t\tthis.description = new Array(source.length)\n\t\tthis.afters = []\n\t}\n\tContext.prototype.getItem = function (i) {\n\t\tvar value = this.source[i]\n\t\tif (value instanceof Promise) {\n\t\t\tvar inspection = value.inspect()\n\t\t\tif ('reason' in inspection) {\n\t\t\t\tvalue.catchLater()\n\t\t\t\treturn {value: inspection.reason, rejected: true}\n\t\t\t} else {\n\t\t\t\tthrow new Error('ArrayTester only accepts arrays of values and rejected promises.')\n\t\t\t}\n\t\t}\n\t\treturn {value: value, rejected: false}\n\t}\n\tContext.prototype.doTest = function (test) {\n\t\tvar ctx = this\n\t\tvar indexOfRaceWinner = getRaceWinner(ctx.description)\n\t\tspecify('[' + ctx.description.join(', ') + ']', function () {\n\t\t\tvar ret = test(ctx.input, ctx.source, indexOfRaceWinner)\n\t\t\tctx.afters.forEach(function (fn) {fn()})\n\t\t\treturn ret\n\t\t})\n\t}\n}", "title": "" }, { "docid": "f6e132963903ea25f4d8b4a44e965a9f", "score": "0.5544943", "text": "function createPromise(table, key = 0, value){\n return table.findAll((key == 0 ? {} : {where: {[key]: value}}))\n .then((data)=>{\n if(data.length == 0) throw 'No results returned'\n return data;\n });\n}", "title": "" }, { "docid": "c60756f06258928fa8786d14e800cfa6", "score": "0.55292904", "text": "function any(promises) {\n\t return iterablePromise(new Any(), promises);\n\t}", "title": "" }, { "docid": "3d941e1ea9a12e88d6620b76604b45f9", "score": "0.5527893", "text": "function getData() {\n return new Promise(function (resolve, reject) {\n resolve([\n { name: 'Knatte' },\n { name: 'Fnatte' },\n { name: 'Tjatte' },\n ]);\n });\n}", "title": "" }, { "docid": "9eea9b2a8ced5a55f8dd51e2c007e13d", "score": "0.5519942", "text": "function connectionFromPromisedArraySlice(dataPromise, args, arrayInfo) {\n\t return dataPromise.then(function (data) {\n\t return connectionFromArraySlice(data, args, arrayInfo);\n\t });\n\t}", "title": "" }, { "docid": "cdc4ae9af7bce24e8a292f3903e6cd2d", "score": "0.54971915", "text": "function forEachPromise(items, fn) {\n return items.reduce((promise, item) => {\n return promise.then(() => {\n return fn(item);\n });\n }, Promise.resolve());\n}", "title": "" }, { "docid": "751b347f5a7d98cdb6094ddbd4a37d1f", "score": "0.5497032", "text": "function promiseEach(parameters, func, maxConcurrent) {\n if(!maxConcurrent) maxConcurrent = 1; // if not supplied default to 1\n\n // bite off maxConcurrent number of aruguments off the head of the array (splice mutates the undlying array)\n let params = parameters.splice(0, maxConcurrent);\n \n // apply the arguments to the promise returning function and wait for them to complete with Promise.all\n return Promise.all(params.map(param => {\n if(Array.isArray(param))\n return func.apply(null, param);\n\n return func(param)\n }))\n .then(results => {\n // i want to return one flat array of results, hence flattening...\n let flatResults = [].concat.apply([], results);\n\n // base case, we've consumed the entire array of promises, just return the flattened array of \n // results\n if(parameters.length === 0) {\n return flatResults;\n }\n\n // soooo here is the trick, remember up above where i mentioned that splice mutates the array?\n // after we process a bite off the array of arguments, check if the entire array has been consumed\n // if not recursively call this function with the remaining arguments array\n //\n // note this isn't really recurision because this is a promise returning function, the function returns\n // right away, so it shouldn't blow up the stack.\n return promiseEach(parameters, func, maxConcurrent)\n .then(function(otherResults) {\n return flatResults.concat(otherResults);\n });\n });\n}", "title": "" }, { "docid": "8fe7927cee1bea6b54830df5be79ecbb", "score": "0.5479876", "text": "function getData() {\n return new Promise(function(resolve, reject) {\n resolve([\n {name: 'Knatte'},\n {name: 'Fnatte'},\n {name: 'Tjatte'},\n ]);\n });\n}", "title": "" }, { "docid": "f9a9b5fd52673f205b6a980d5c76a7ba", "score": "0.5471285", "text": "function some(promisesOrValues, howMany, callback, errback, progressHandler) {\n\t\tvar toResolve, results, ret, deferred, resolver, rejecter, handleProgress;\n\n\t\ttoResolve = Math.max(0, Math.min(howMany, promisesOrValues.length));\n\t\tresults = [];\n\t\tdeferred = defer();\n\t\tret = (callback || errback || progressHandler)\n\t\t\t? deferred.then(callback, errback, progressHandler)\n\t\t\t: deferred.promise;\n\n\t\t// Resolver for promises. Captures the value and resolves\n\t\t// the returned promise when toResolve reaches zero.\n\t\t// Overwrites resolver var with a noop once promise has\n\t\t// be resolved to cover case where n < promises.length\n\t\tresolver = function(val) {\n\t\t\tresults.push(val);\n\t\t\tif(--toResolve === 0) {\n\t\t\t\tresolver = handleProgress = noop;\n\t\t\t\tdeferred.resolve(results);\n\t\t\t}\n\t\t};\n\n\t\t// Wrapper so that resolver can be replaced\n\t\tfunction resolve(val) {\n\t\t\tresolver(val);\n\t\t}\n\n\t\t// Rejecter for promises. Rejects returned promise\n\t\t// immediately, and overwrites rejecter var with a noop\n\t\t// once promise to cover case where n < promises.length.\n\t\t// TODO: Consider rejecting only when N (or promises.length - N?)\n\t\t// promises have been rejected instead of only one?\n\t\trejecter = function(err) {\n\t\t\trejecter = handleProgress = noop;\n\t\t\tdeferred.reject(err);\n\t\t};\n\n\t\t// Wrapper so that rejecer can be replaced\n\t\tfunction reject(err) {\n\t\t\trejecter(err);\n\t\t}\n\n\t\thandleProgress = function(update) {\n\t\t\tdeferred.progress(update);\n\t\t};\n\n\t\tfunction progress(update) {\n\t\t\thandleProgress(update);\n\t\t}\n\n\t\tif(toResolve === 0) {\n\t\t\tdeferred.resolve(results);\n\t\t} else {\n\t\t\tvar promiseOrValue, i = 0;\n\t\t\twhile((promiseOrValue = promisesOrValues[i++])) {\n\t\t\t\twhen(promiseOrValue, resolve, reject, progress);\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t}", "title": "" }, { "docid": "eaa073bec229702c02aebd8ee7144771", "score": "0.5470812", "text": "function array(a) {\n return a.map((v) => value(v));\n}", "title": "" }, { "docid": "189efcb705cc1648856a924b74057213", "score": "0.54637104", "text": "forEachConcurrently (callback, context) {\n const promise = this.then(async function (array) {\n const promises = array.map(callback, context)\n await Promise.all(promises)\n return array\n })\n return PromisedArray.fromPromise(promise)\n }", "title": "" }, { "docid": "23c73e60e1edc46a4689cce9a3c5827a", "score": "0.5463153", "text": "async trigger(ctx) {\n const webhooks = await Webhook.findAll();\n let urls = [] \n //create list of urls\n webhooks.forEach(element => {\n urls.push(element.dataValues.targetUrl)\n });\n var products = []\n\n // create list of promises\n let requests = urls.map(url => {\n return new Promise((resolve, reject) => {\n request({\n uri: url,\n method: 'POST'\n },\n (err, res, body) => {\n if(err) { reject(err)}\n resolve(body)\n })\n })\n })\n //resolve each promise\n Promise.all(requests).then((body) => {\n body.forEach(res => {\n if(res)\n products.push(JSON.parse(res))\n })\n console.log(products);\n }).catch(err => console.log(err)) \n }", "title": "" }, { "docid": "a5f067e5d391564aecacd56a846188f1", "score": "0.5463103", "text": "function myPromiseFunc(myString, arr) {\n return new Promise(function (resolve, reject) {\n for (let val of arr) {\n myString = myString.replace(val, \"***\");\n }\n resolve(myString);\n });\n}", "title": "" }, { "docid": "d5000e398d1fa80fa19f6082a5944d0f", "score": "0.5456279", "text": "static fromPromise (promise) {\n Object.assign(promise, promisedArrayPrototype)\n Object.defineProperty(promise, 'length', promisedLength)\n return promise\n }", "title": "" }, { "docid": "6c66c50f1b4e06c0a02087320ea8386a", "score": "0.54455465", "text": "function retArgs () { return Promise.resolve(arguments) }", "title": "" }, { "docid": "695eec740da1e26a6c0f15926790f8db", "score": "0.5443656", "text": "async function TeamInfo(team_ids_array){\r\n let TeamInfo=[];\r\n let promises=[];\r\n team_ids_array.map((team_id) =>\r\n promises.push(\r\n axios.get(`${api_domain}/teams/${team_id}`, {\r\n params: {\r\n include: \"country\",\r\n api_token: process.env.api_token,\r\n },\r\n })\r\n )\r\n );\r\n let teams_info= await Promise.all(promises);\r\n return extraactRelvantTeamData(teams_info) \r\n}", "title": "" }, { "docid": "5eea0c3a12ab6ecc0cc28f3e7c952d53", "score": "0.54413694", "text": "function settle(promises) {\n\t var handler = new Settle(resolve, resultsArray(promises));\n\t return iterablePromise(handler, promises);\n\t}", "title": "" }, { "docid": "7f3a2aaf3304549f32114dbd929935c7", "score": "0.543476", "text": "function PromiseAllResolveElementFunction() {\n var F = function(x) {\n var alreadyCalled = F['[[AlreadyCalled]]'];\n if (alreadyCalled.value) return undefined;\n alreadyCalled.value = true;\n var index = F['[[Index]]'];\n var values = F['[[Values]]'];\n var promiseCapability = F['[[Capabilities]]'];\n var remainingElementsCount = F['[[RemainingElements]]'];\n try {\n values[index] = x;\n } catch (result) {\n promiseCapability['[[Reject]]'].call(undefined, result);\n return promiseCapability['[[Promise]]'];\n }\n remainingElementsCount.value -= 1;\n if (remainingElementsCount.value === 0)\n return promiseCapability['[[Resolve]]'].call(undefined, values);\n return undefined;\n };\n return F;\n }", "title": "" }, { "docid": "273a4ee1244decc59f57b7c38cee98bd", "score": "0.54319805", "text": "onResolve(value) {\n let temp = value;\n try{\n this.promiseChain.forEach( (nextFunc) => {\n temp = nextFunc(temp);\n });\n }\n catch(error){\n this.promiseChain = [];\n this.onReject(error);\n }\n }", "title": "" }, { "docid": "8e008c22dcd541b03ba2539abaca317f", "score": "0.5428276", "text": "async function fetchData(value, i) {\n return new Promise(resolve => {\n setTimeout(() => {\n resolve(value)\n }, i * 1000)\n })\n}", "title": "" }, { "docid": "4ed21964c87ffa6ab29aa3e0ffb2f815", "score": "0.54190886", "text": "function when(items) {\n items = items || [];\n var resolveAll, rejectAll,\n allResolvedPromise = new Promise(function(resolve, reject) {\n resolveAll = resolve;\n rejectAll = reject;\n });\n\n var remaining = 0,\n settledWith = [],\n itemsCopy = Array.isArray(items) ?\n items.slice() :\n [items];\n\n var resolveWith = function(data, index) {\n settledWith[index] = data;\n\n if (--remaining <= 0) {\n resolveAll(settledWith);\n }\n };\n\n remaining = itemsCopy.length;\n\n if (remaining <= 0) {\n resolveAll();\n return allResolvedPromise;\n }\n\n itemsCopy.forEach(function(item, index) {\n var promise;\n if (isPromise(item)) {\n promise = item;\n } else if (typeof item === 'function') {\n var res;\n try {\n res = item();\n if (isPromise(res)) {\n promise = res;\n } else if (shouldReject(res)) {\n promise = Promise.reject(res);\n } else {\n promise = Promise.resolve(res);\n }\n } catch(err) {\n promise = Promise.reject(err);\n }\n } else {\n promise = new Promise(function(resolve, reject) {\n shouldReject(item) ?\n reject(item) :\n resolve(item);\n });\n }\n promise.then(\n function(data) {\n resolveWith(data, index);\n }\n ).catch(rejectAll.bind(rejectAll));\n });\n\n return allResolvedPromise;\n}", "title": "" }, { "docid": "5e7a12c3405956137b640afed42103b6", "score": "0.54158354", "text": "reduce (callback, result, context) {\n return this.then(async function (array) {\n for (let i = 0, length = array.length; i < length; ++i) {\n result = await callback.call(context, result, array[i], i, array)\n }\n return result\n })\n }", "title": "" }, { "docid": "62f9e3a61cb5e613222902eb17f45bcb", "score": "0.5402931", "text": "function createUpdateJson(array) {\n return new Promise(function(resolve, reject) {\n try {\n isDivisibleByTwo(array.length);\n const keys = array.slice(0, array.length / 2);\n const values = array.slice(array.length / 2);\n\n let counter = 0;\n let formattedObj = {};\n while (counter < keys.length) {\n formattedObj[keys[counter]] = values[counter];\n counter++;\n\n if (counter === keys.length) resolve(formattedObj);\n }\n } catch (error) {\n reject(error);\n }\n });\n}", "title": "" }, { "docid": "811a98100650b04930bc299090195165", "score": "0.5397364", "text": "resolveAll() {\n this.requests.forEach((request) => request.resolve());\n return Ember.RSVP.Promise.all(this.requests);\n }", "title": "" }, { "docid": "5b19756efb5a8e6a0abb7f48e5ec5f0a", "score": "0.5388549", "text": "function createThen(iterable) {\n const iterator = iterable[Symbol.asyncIterator]();\n return (onResolved, onRejected) => iterator.next()\n .then(item => item.value)\n .then(onResolved, onRejected);\n}", "title": "" }, { "docid": "9423280e07d10543a923da19718afe3b", "score": "0.5379634", "text": "static mapToArray({ response, stunServers, turnServers }) {\n const promise = new Promise((resolve) => {\n if (response) {\n resolve({ error: 404, stunServers: [], turnServers: [] });\n }\n resolve({\n stunServers: stunServers.map(server => server.url),\n turnServers: turnServers.map(server => server.url),\n });\n });\n return promise;\n }", "title": "" }, { "docid": "cb74db95d74abeca852c08013cb5d7ea", "score": "0.53784114", "text": "function makeActorPromises() {\n // empty arr that actors is pushed into\n let promiseArray = [];\n // loops through moviesArry (movie data)\n for (let i = 0; i < movieArr.length; i++) {\n // sets actorURL to url that gets actor info\n let actorURL = `https://api.themoviedb.org/3/movie/${movieArr[i]}/credits?api_key=${dbGet.key}`;\n // adds actors to promiseArr\n promiseArray.push(getActors(actorURL));\n }\n return promiseArray;\n}", "title": "" }, { "docid": "1c5f49772adb42af946a75fc5c7fc85f", "score": "0.53679895", "text": "async function test1() {\n for (const obj of promises) {\n console.log(obj);\n }\n}", "title": "" }, { "docid": "47394a095dd7a085b2861cab9e4cfa33", "score": "0.5363976", "text": "function getPathCoords(path) //path is an array of waypoints in str form\n {\n return new Promise(function(resolve, reject) {\n let coords = [];\n\n $.post(\"/getCoordsGPS\", {'path':path}, function (data) {\n $.each(data, function (i, item) {\n coords.push(\n $.map(item.coordonnees.split(\",\"), function(value) {\n return parseFloat(+value, 10);\n })\n );\n });\n resolve(coords)\n },'json');\n });\n }", "title": "" }, { "docid": "9e83aec0d842ef3e268c4981d9801dba", "score": "0.5361048", "text": "async function exibePergunta (arrayPerguntas, seletor) {\n\tseletor.innerHTML = ''\n\tconsole.log(\"Posicao dentro da funcao \"+contadorPerguntas);\n console.log(arrayPerguntas);\n arrayPerguntas.then(v => {\n console.log(\"Posicao dentro do then \"+contadorPerguntas);\n \tv[contadorPerguntas].then(resposta => {\n \t\tconsole.log(resposta);\n \t\tseletor.insertAdjacentHTML('afterbegin',resposta)\n contadorPerguntas++\n \t})\n })\n}", "title": "" }, { "docid": "ec54c39a118fde34a044ddc673a33886", "score": "0.53551495", "text": "function PromiseAllResolveElementFunction () {\n return function F ( x ) {\n var index = F['[[Index]]'],\n values = F['[[Values]]'],\n promiseCapability = F['[[Capabilities]]'],\n remainingElementsCount = F['[[RemainingElements]]'];\n try {\n values[index] = x;\n } catch ( e ) {\n return IfAbruptRejectPromise(e, promiseCapability);\n }\n remainingElementsCount['[[value]]']--;\n if ( remainingElementsCount['[[value]]'] === 0 ) {\n promiseCapability['[[Resolve]]'].call(undefined, values);\n }\n return undefined;\n };\n }", "title": "" }, { "docid": "21289b4c7c656e5ed786a39bb06d357a", "score": "0.5351403", "text": "function mapAfterAllReturn(arr, mapper, returnValue) {\n var results = new Array(arr.length);\n var containsPromise = false;\n\n for (var i = 0, l = arr.length; i < l; ++i) {\n results[i] = mapper(arr[i]);\n\n if (isPromise(results[i])) {\n containsPromise = true;\n }\n }\n\n if (containsPromise) {\n return Promise.all(results).then(function () {\n return returnValue;\n });\n } else {\n return returnValue;\n }\n}", "title": "" }, { "docid": "393d112c00516ac84b316ec25daffb70", "score": "0.5343732", "text": "function getTransactions(i) {\n return new Promise(function(resolve, reject) {\n //for (var i = 0; i < NUM_ACCTS; i++) {\n $.post('/transactions', {\n params: {\n var_i: i\n }\n }).success(\n function(success) {\n //console.log(success);\n resolve(success);\n }).error(\n function(error) {\n console.log(error);\n });\n // }\n });\n}", "title": "" }, { "docid": "3078adf3dc5a647ad61a1f67be913824", "score": "0.5341436", "text": "function promiseAll() {\n let promise1 = new Promise(\n (resolve, reflect) => resolve(\"primera promesa resuelta\")\n )\n let promise2 = new Promise(\n (resolve, reflect) => {\n setTimeout(\n () => resolve(\"segundo promesa resuelta\"),\n 2000\n )\n }\n )\n let promise3 = new Promise(\n (resolve, reflect) => {\n setTimeout(\n () => resolve(\"tercero promesa resuelta\"),\n 4000\n )\n }\n )\n let promise4 = new Promise(\n (resolve, reflect) => {\n setTimeout(\n () => resolve(\"cuarta promesa resuelta\"),\n 6000\n )\n }\n )\n \n Promise.all([promise1, promise2, promise3, promise4]).\n then( values => {\n console.log(`Los valores son: ${values}`)\n }).catch( error => {\n console.log(`Ocurrio un error: ${error}`)\n })\n}", "title": "" }, { "docid": "e7748edf5f91c3d831a41a5b04dd370d", "score": "0.5340231", "text": "function any(promisesOrValues, callback, errback, progressHandler) {\n\t\treturn some(promisesOrValues, 1, callback, errback, progressHandler);\n\t}", "title": "" }, { "docid": "105fb92e871f13c69fd8b1cfc3f7e57e", "score": "0.5324949", "text": "function getItems(i) {\n return new Promise(function(resolve, reject) {\n $.post('/item', {\n params: {\n var_i: i\n }\n }).success(\n function(success) {\n //console.log(\"returning\");\n resolve(success);\n }).error(\n function(error) {\n console.log(error);\n });\n });\n}", "title": "" }, { "docid": "8cb90c3ffde2eeb8659c9261e98732c1", "score": "0.5322164", "text": "async function p() {\n requestNumbers().then(function(data){\n returnedResults.push(data);\n })\n}", "title": "" }, { "docid": "1c29aba3539806bfefc54aef9c7f2ad6", "score": "0.5321131", "text": "function promiseAll2() {\n var endPoint = \"https://jsonplaceholder.typicode.com\"\n\n Promise.all([\n axios.get(`${endPoint}/users`),\n axios.get(`${endPoint}/todos`)\n ]).\n then( ([users, todos]) => {\n console.log(users.data)\n console.log(todos.data)\n });\n}", "title": "" }, { "docid": "d878e3dd32ab55b793de682e562b13d9", "score": "0.5312763", "text": "function SerialPromises(items, taskizer) {\n return items.reduce(\n function(acc, item) {\n return acc.then(function(result) {\n return taskizer(item).then(Array.prototype.concat.bind(result))\n })\n },\n Promise.resolve([]))\n}", "title": "" }, { "docid": "7618ba522d3cb98088f311464dacc8ba", "score": "0.53086394", "text": "function PromiseSeries() {\n\n this._mainDefer = null;\n this._commands = [];\n this._results = [];\n this._resultsAsObject = {};\n this._isResultsObject = false;\n}", "title": "" }, { "docid": "e33a0efb4623d321ca7bd512272edcbc", "score": "0.5306647", "text": "get values() {\n return this._array;\n }", "title": "" }, { "docid": "8754aaaa5255ec9e1ba5fb2ad1d243be", "score": "0.52996457", "text": "function promiseReduce(values, callback, initialValue) {\n return values.reduce(function (previous, value) {\n return (0, _isPromise.default)(previous) ? previous.then(function (resolved) {\n return callback(resolved, value);\n }) : callback(previous, value);\n }, initialValue);\n}", "title": "" }, { "docid": "8754aaaa5255ec9e1ba5fb2ad1d243be", "score": "0.52996457", "text": "function promiseReduce(values, callback, initialValue) {\n return values.reduce(function (previous, value) {\n return (0, _isPromise.default)(previous) ? previous.then(function (resolved) {\n return callback(resolved, value);\n }) : callback(previous, value);\n }, initialValue);\n}", "title": "" }, { "docid": "8754aaaa5255ec9e1ba5fb2ad1d243be", "score": "0.52996457", "text": "function promiseReduce(values, callback, initialValue) {\n return values.reduce(function (previous, value) {\n return (0, _isPromise.default)(previous) ? previous.then(function (resolved) {\n return callback(resolved, value);\n }) : callback(previous, value);\n }, initialValue);\n}", "title": "" }, { "docid": "8754aaaa5255ec9e1ba5fb2ad1d243be", "score": "0.52996457", "text": "function promiseReduce(values, callback, initialValue) {\n return values.reduce(function (previous, value) {\n return (0, _isPromise.default)(previous) ? previous.then(function (resolved) {\n return callback(resolved, value);\n }) : callback(previous, value);\n }, initialValue);\n}", "title": "" }, { "docid": "a6360ff7e76de2ce365d7be6a922de6c", "score": "0.52968174", "text": "function getAdvQtyBySkus(skus_arr) {\n return new Promise((res, rej) => {\n $.ajax({\n type: \"GET\",\n url: `${apiRootUrl}/getAdvQtyList?store_hash=${bypass_store_hash}&variant_skus=${skus_arr.join(\",\")}`,\n success: (data) => {\n console.log(\"AdvQtyActive Lists\", data);\n if (data.code == '200') {\n res(data.response.productQuantityList);\n } else {\n rej(data);\n }\n },\n error: (jqXHR, textStatus, errorThrown) => {\n console.log(JSON.stringify(jqXHR));\n }\n });\n });\n}", "title": "" }, { "docid": "ec2cb11f94e099771a6105d259bc7991", "score": "0.5283838", "text": "function loopGetUserKitties(err, res){\n\tvar promiseArray = []\n\tarray = new Array();\n\t//Most likely only need last 1000 cats or so, the rest is already present.\n\tfor (i = 0; i < amountOfCalls; i++) {\n \tarray[i] = i;\n\t}\n\treturn Promise.map(array, fetch, {concurrency: 2});\n}", "title": "" } ]
d3fa98317b0a3681a4da8f83a5e38bc5
Padding provided by `mdinputcontainer`
[ { "docid": "75b2f9fce8e6145b853268213db20ed2", "score": "0.0", "text": "function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $mdTheming, $window,\n $animate, $rootElement, $attrs, $q) {\n //-- private variables\n var ctrl = this,\n itemParts = $scope.itemsExpr.split(/ in /i),\n itemExpr = itemParts[ 1 ],\n elements = null,\n cache = {},\n noBlur = false,\n selectedItemWatchers = [],\n hasFocus = false,\n lastCount = 0,\n fetchesInProgress = 0;\n\n //-- public variables with handlers\n defineProperty('hidden', handleHiddenChange, true);\n\n //-- public variables\n ctrl.scope = $scope;\n ctrl.parent = $scope.$parent;\n ctrl.itemName = itemParts[ 0 ];\n ctrl.matches = [];\n ctrl.loading = false;\n ctrl.hidden = true;\n ctrl.index = null;\n ctrl.messages = [];\n ctrl.id = $mdUtil.nextUid();\n ctrl.isDisabled = null;\n ctrl.isRequired = null;\n ctrl.isReadonly = null;\n ctrl.hasNotFound = false;\n\n //-- public methods\n ctrl.keydown = keydown;\n ctrl.blur = blur;\n ctrl.focus = focus;\n ctrl.clear = clearValue;\n ctrl.select = select;\n ctrl.listEnter = onListEnter;\n ctrl.listLeave = onListLeave;\n ctrl.mouseUp = onMouseup;\n ctrl.getCurrentDisplayValue = getCurrentDisplayValue;\n ctrl.registerSelectedItemWatcher = registerSelectedItemWatcher;\n ctrl.unregisterSelectedItemWatcher = unregisterSelectedItemWatcher;\n ctrl.notFoundVisible = notFoundVisible;\n ctrl.loadingIsVisible = loadingIsVisible;\n\n return init();\n\n //-- initialization methods\n\n /**\n * Initialize the controller, setup watchers, gather elements\n */\n function init () {\n $mdUtil.initOptionalProperties($scope, $attrs, { searchText: null, selectedItem: null });\n $mdTheming($element);\n configureWatchers();\n $mdUtil.nextTick(function () {\n gatherElements();\n moveDropdown();\n focusElement();\n $element.on('focus', focusElement);\n });\n }\n\n /**\n * Calculates the dropdown's position and applies the new styles to the menu element\n * @returns {*}\n */\n function positionDropdown () {\n if (!elements) return $mdUtil.nextTick(positionDropdown, false, $scope);\n var hrect = elements.wrap.getBoundingClientRect(),\n vrect = elements.snap.getBoundingClientRect(),\n root = elements.root.getBoundingClientRect(),\n top = vrect.bottom - root.top,\n bot = root.bottom - vrect.top,\n left = hrect.left - root.left,\n width = hrect.width,\n offset = getVerticalOffset(),\n styles;\n // Adjust the width to account for the padding provided by `md-input-container`\n if ($attrs.mdFloatingLabel) {\n left += INPUT_PADDING;\n width -= INPUT_PADDING * 2;\n }\n styles = {\n left: left + 'px',\n minWidth: width + 'px',\n maxWidth: Math.max(hrect.right - root.left, root.right - hrect.left) - MENU_PADDING + 'px'\n };\n if (top > bot && root.height - hrect.bottom - MENU_PADDING < MAX_HEIGHT) {\n styles.top = 'auto';\n styles.bottom = bot + 'px';\n styles.maxHeight = Math.min(MAX_HEIGHT, hrect.top - root.top - MENU_PADDING) + 'px';\n } else {\n styles.top = (top - offset) + 'px';\n styles.bottom = 'auto';\n styles.maxHeight = Math.min(MAX_HEIGHT, root.bottom + $mdUtil.scrollTop() - hrect.bottom - MENU_PADDING) + 'px';\n }\n\n elements.$.scrollContainer.css(styles);\n $mdUtil.nextTick(correctHorizontalAlignment, false);\n\n /**\n * Calculates the vertical offset for floating label examples to account for ngMessages\n * @returns {number}\n */\n function getVerticalOffset () {\n var offset = 0;\n var inputContainer = $element.find('md-input-container');\n if (inputContainer.length) {\n var input = inputContainer.find('input');\n offset = inputContainer.prop('offsetHeight');\n offset -= input.prop('offsetTop');\n offset -= input.prop('offsetHeight');\n // add in the height left up top for the floating label text\n offset += inputContainer.prop('offsetTop');\n }\n return offset;\n }\n\n /**\n * Makes sure that the menu doesn't go off of the screen on either side.\n */\n function correctHorizontalAlignment () {\n var dropdown = elements.scrollContainer.getBoundingClientRect(),\n styles = {};\n if (dropdown.right > root.right - MENU_PADDING) {\n styles.left = (hrect.right - dropdown.width) + 'px';\n }\n elements.$.scrollContainer.css(styles);\n }\n }\n\n /**\n * Moves the dropdown menu to the body tag in order to avoid z-index and overflow issues.\n */\n function moveDropdown () {\n if (!elements.$.root.length) return;\n $mdTheming(elements.$.scrollContainer);\n elements.$.scrollContainer.detach();\n elements.$.root.append(elements.$.scrollContainer);\n if ($animate.pin) $animate.pin(elements.$.scrollContainer, $rootElement);\n }\n\n /**\n * Sends focus to the input element.\n */\n function focusElement () {\n if ($scope.autofocus) elements.input.focus();\n }\n\n /**\n * Sets up any watchers used by autocomplete\n */\n function configureWatchers () {\n var wait = parseInt($scope.delay, 10) || 0;\n $attrs.$observe('disabled', function (value) { ctrl.isDisabled = $mdUtil.parseAttributeBoolean(value, false); });\n $attrs.$observe('required', function (value) { ctrl.isRequired = $mdUtil.parseAttributeBoolean(value, false); });\n $attrs.$observe('readonly', function (value) { ctrl.isReadonly = $mdUtil.parseAttributeBoolean(value, false); });\n $scope.$watch('searchText', wait ? $mdUtil.debounce(handleSearchText, wait) : handleSearchText);\n $scope.$watch('selectedItem', selectedItemChange);\n angular.element($window).on('resize', positionDropdown);\n $scope.$on('$destroy', cleanup);\n }\n\n /**\n * Removes any events or leftover elements created by this controller\n */\n function cleanup () {\n if(!ctrl.hidden) {\n $mdUtil.enableScrolling();\n }\n\n angular.element($window).off('resize', positionDropdown);\n if ( elements ){\n var items = 'ul scroller scrollContainer input'.split(' ');\n angular.forEach(items, function(key){\n elements.$[key].remove();\n });\n }\n }\n\n /**\n * Gathers all of the elements needed for this controller\n */\n function gatherElements () {\n elements = {\n main: $element[0],\n scrollContainer: $element[0].getElementsByClassName('md-virtual-repeat-container')[0],\n scroller: $element[0].getElementsByClassName('md-virtual-repeat-scroller')[0],\n ul: $element.find('ul')[0],\n input: $element.find('input')[0],\n wrap: $element.find('md-autocomplete-wrap')[0],\n root: document.body\n };\n elements.li = elements.ul.getElementsByTagName('li');\n elements.snap = getSnapTarget();\n elements.$ = getAngularElements(elements);\n }\n\n /**\n * Finds the element that the menu will base its position on\n * @returns {*}\n */\n function getSnapTarget () {\n for (var element = $element; element.length; element = element.parent()) {\n if (angular.isDefined(element.attr('md-autocomplete-snap'))) return element[ 0 ];\n }\n return elements.wrap;\n }\n\n /**\n * Gathers angular-wrapped versions of each element\n * @param elements\n * @returns {{}}\n */\n function getAngularElements (elements) {\n var obj = {};\n for (var key in elements) {\n if (elements.hasOwnProperty(key)) obj[ key ] = angular.element(elements[ key ]);\n }\n return obj;\n }\n\n //-- event/change handlers\n\n /**\n * Handles changes to the `hidden` property.\n * @param hidden\n * @param oldHidden\n */\n function handleHiddenChange (hidden, oldHidden) {\n if (!hidden && oldHidden) {\n positionDropdown();\n\n if (elements) {\n $mdUtil.nextTick(function () {\n $mdUtil.disableScrollAround(elements.ul);\n }, false, $scope);\n }\n } else if (hidden && !oldHidden) {\n $mdUtil.nextTick(function () {\n $mdUtil.enableScrolling();\n }, false, $scope);\n }\n }\n\n /**\n * When the user mouses over the dropdown menu, ignore blur events.\n */\n function onListEnter () {\n noBlur = true;\n }\n\n /**\n * When the user's mouse leaves the menu, blur events may hide the menu again.\n */\n function onListLeave () {\n if (!hasFocus) elements.input.focus();\n noBlur = false;\n ctrl.hidden = shouldHide();\n }\n\n /**\n * When the mouse button is released, send focus back to the input field.\n */\n function onMouseup () {\n elements.input.focus();\n }\n\n /**\n * Handles changes to the selected item.\n * @param selectedItem\n * @param previousSelectedItem\n */\n function selectedItemChange (selectedItem, previousSelectedItem) {\n if (selectedItem) {\n getDisplayValue(selectedItem).then(function (val) {\n $scope.searchText = val;\n handleSelectedItemChange(selectedItem, previousSelectedItem);\n });\n }\n\n if (selectedItem !== previousSelectedItem) announceItemChange();\n }\n\n /**\n * Use the user-defined expression to announce changes each time a new item is selected\n */\n function announceItemChange () {\n angular.isFunction($scope.itemChange) && $scope.itemChange(getItemAsNameVal($scope.selectedItem));\n }\n\n /**\n * Use the user-defined expression to announce changes each time the search text is changed\n */\n function announceTextChange () {\n angular.isFunction($scope.textChange) && $scope.textChange();\n }\n\n /**\n * Calls any external watchers listening for the selected item. Used in conjunction with\n * `registerSelectedItemWatcher`.\n * @param selectedItem\n * @param previousSelectedItem\n */\n function handleSelectedItemChange (selectedItem, previousSelectedItem) {\n selectedItemWatchers.forEach(function (watcher) { watcher(selectedItem, previousSelectedItem); });\n }\n\n /**\n * Register a function to be called when the selected item changes.\n * @param cb\n */\n function registerSelectedItemWatcher (cb) {\n if (selectedItemWatchers.indexOf(cb) == -1) {\n selectedItemWatchers.push(cb);\n }\n }\n\n /**\n * Unregister a function previously registered for selected item changes.\n * @param cb\n */\n function unregisterSelectedItemWatcher (cb) {\n var i = selectedItemWatchers.indexOf(cb);\n if (i != -1) {\n selectedItemWatchers.splice(i, 1);\n }\n }\n\n /**\n * Handles changes to the searchText property.\n * @param searchText\n * @param previousSearchText\n */\n function handleSearchText (searchText, previousSearchText) {\n ctrl.index = getDefaultIndex();\n // do nothing on init\n if (searchText === previousSearchText) return;\n\n getDisplayValue($scope.selectedItem).then(function (val) {\n // clear selected item if search text no longer matches it\n if (searchText !== val) {\n $scope.selectedItem = null;\n\n // trigger change event if available\n if (searchText !== previousSearchText) announceTextChange();\n\n // cancel results if search text is not long enough\n if (!isMinLengthMet()) {\n ctrl.matches = [];\n setLoading(false);\n updateMessages();\n } else {\n handleQuery();\n }\n }\n });\n\n }\n\n /**\n * Handles input blur event, determines if the dropdown should hide.\n */\n function blur () {\n hasFocus = false;\n if (!noBlur) {\n ctrl.hidden = shouldHide();\n }\n }\n\n /**\n * Force blur on input element\n * @param forceBlur\n */\n function doBlur(forceBlur) {\n if (forceBlur) {\n noBlur = false;\n hasFocus = false;\n }\n elements.input.blur();\n }\n\n /**\n * Handles input focus event, determines if the dropdown should show.\n */\n function focus () {\n hasFocus = true;\n //-- if searchText is null, let's force it to be a string\n if (!angular.isString($scope.searchText)) $scope.searchText = '';\n ctrl.hidden = shouldHide();\n if (!ctrl.hidden) handleQuery();\n }\n\n /**\n * Handles keyboard input.\n * @param event\n */\n function keydown (event) {\n switch (event.keyCode) {\n case $mdConstant.KEY_CODE.DOWN_ARROW:\n if (ctrl.loading) return;\n event.stopPropagation();\n event.preventDefault();\n ctrl.index = Math.min(ctrl.index + 1, ctrl.matches.length - 1);\n updateScroll();\n updateMessages();\n break;\n case $mdConstant.KEY_CODE.UP_ARROW:\n if (ctrl.loading) return;\n event.stopPropagation();\n event.preventDefault();\n ctrl.index = ctrl.index < 0 ? ctrl.matches.length - 1 : Math.max(0, ctrl.index - 1);\n updateScroll();\n updateMessages();\n break;\n case $mdConstant.KEY_CODE.TAB:\n // If we hit tab, assume that we've left the list so it will close\n onListLeave();\n\n if (ctrl.hidden || ctrl.loading || ctrl.index < 0 || ctrl.matches.length < 1) return;\n select(ctrl.index);\n break;\n case $mdConstant.KEY_CODE.ENTER:\n if (ctrl.hidden || ctrl.loading || ctrl.index < 0 || ctrl.matches.length < 1) return;\n if (hasSelection()) return;\n event.stopPropagation();\n event.preventDefault();\n select(ctrl.index);\n break;\n case $mdConstant.KEY_CODE.ESCAPE:\n event.stopPropagation();\n event.preventDefault();\n clearValue();\n\n // Force the component to blur if they hit escape\n doBlur(true);\n\n break;\n default:\n }\n }\n\n //-- getters\n\n /**\n * Returns the minimum length needed to display the dropdown.\n * @returns {*}\n */\n function getMinLength () {\n return angular.isNumber($scope.minLength) ? $scope.minLength : 1;\n }\n\n /**\n * Returns the display value for an item.\n * @param item\n * @returns {*}\n */\n function getDisplayValue (item) {\n return $q.when(getItemText(item) || item);\n\n /**\n * Getter function to invoke user-defined expression (in the directive)\n * to convert your object to a single string.\n */\n function getItemText (item) {\n return (item && $scope.itemText) ? $scope.itemText(getItemAsNameVal(item)) : null;\n }\n }\n\n /**\n * Returns the locals object for compiling item templates.\n * @param item\n * @returns {{}}\n */\n function getItemAsNameVal (item) {\n if (!item) return undefined;\n\n var locals = {};\n if (ctrl.itemName) locals[ ctrl.itemName ] = item;\n\n return locals;\n }\n\n /**\n * Returns the default index based on whether or not autoselect is enabled.\n * @returns {number}\n */\n function getDefaultIndex () {\n return $scope.autoselect ? 0 : -1;\n }\n\n /**\n * Sets the loading parameter and updates the hidden state.\n * @param value {boolean} Whether or not the component is currently loading.\n */\n function setLoading(value) {\n if (ctrl.loading != value) {\n ctrl.loading = value;\n }\n\n // Always refresh the hidden variable as something else might have changed\n ctrl.hidden = shouldHide();\n }\n\n /**\n * Determines if the menu should be hidden.\n * @returns {boolean}\n */\n function shouldHide () {\n if (ctrl.loading && !hasMatches()) return true; // Hide while loading initial matches\n else if (hasSelection()) return true; // Hide if there is already a selection\n else if (!hasFocus) return true; // Hide if the input does not have focus\n else return !shouldShow(); // Defer to standard show logic\n }\n\n /**\n * Determines if the menu should be shown.\n * @returns {boolean}\n */\n function shouldShow() {\n return (isMinLengthMet() && hasMatches()) || notFoundVisible();\n }\n\n /**\n * Returns true if the search text has matches.\n * @returns {boolean}\n */\n function hasMatches() {\n return ctrl.matches.length ? true : false;\n }\n\n /**\n * Returns true if the autocomplete has a valid selection.\n * @returns {boolean}\n */\n function hasSelection() {\n return ctrl.scope.selectedItem ? true : false;\n }\n\n /**\n * Returns true if the loading indicator is, or should be, visible.\n * @returns {boolean}\n */\n function loadingIsVisible() {\n return ctrl.loading && !hasSelection();\n }\n\n /**\n * Returns the display value of the current item.\n * @returns {*}\n */\n function getCurrentDisplayValue () {\n return getDisplayValue(ctrl.matches[ ctrl.index ]);\n }\n\n /**\n * Determines if the minimum length is met by the search text.\n * @returns {*}\n */\n function isMinLengthMet () {\n return ($scope.searchText || '').length >= getMinLength();\n }\n\n //-- actions\n\n /**\n * Defines a public property with a handler and a default value.\n * @param key\n * @param handler\n * @param value\n */\n function defineProperty (key, handler, value) {\n Object.defineProperty(ctrl, key, {\n get: function () { return value; },\n set: function (newValue) {\n var oldValue = value;\n value = newValue;\n handler(newValue, oldValue);\n }\n });\n }\n\n /**\n * Selects the item at the given index.\n * @param index\n */\n function select (index) {\n //-- force form to update state for validation\n $mdUtil.nextTick(function () {\n getDisplayValue(ctrl.matches[ index ]).then(function (val) {\n var ngModel = elements.$.input.controller('ngModel');\n ngModel.$setViewValue(val);\n ngModel.$render();\n }).finally(function () {\n $scope.selectedItem = ctrl.matches[ index ];\n setLoading(false);\n });\n }, false);\n }\n\n /**\n * Clears the searchText value and selected item.\n */\n function clearValue () {\n // Set the loading to true so we don't see flashes of content.\n // The flashing will only occour when an async request is running.\n // So the loading process will stop when the results had been retrieved.\n setLoading(true);\n\n // Reset our variables\n ctrl.index = 0;\n ctrl.matches = [];\n $scope.searchText = '';\n\n // Per http://www.w3schools.com/jsref/event_oninput.asp\n var eventObj = document.createEvent('CustomEvent');\n eventObj.initCustomEvent('input', true, true, { value: $scope.searchText });\n elements.input.dispatchEvent(eventObj);\n\n elements.input.focus();\n }\n\n /**\n * Fetches the results for the provided search text.\n * @param searchText\n */\n function fetchResults (searchText) {\n var items = $scope.$parent.$eval(itemExpr),\n term = searchText.toLowerCase(),\n isList = angular.isArray(items),\n isPromise = !!items.then; // Every promise should contain a `then` property\n\n if (isList) handleResults(items);\n else if (isPromise) handleAsyncResults(items);\n\n function handleAsyncResults(items) {\n if ( !items ) return;\n\n items = $q.when(items);\n fetchesInProgress++;\n setLoading(true);\n\n $mdUtil.nextTick(function () {\n items\n .then(handleResults)\n .finally(function(){\n if (--fetchesInProgress === 0) {\n setLoading(false);\n }\n });\n },true, $scope);\n }\n\n function handleResults (matches) {\n cache[ term ] = matches;\n if ((searchText || '') !== ($scope.searchText || '')) return; //-- just cache the results if old request\n\n ctrl.matches = matches;\n ctrl.hidden = shouldHide();\n\n // If loading is in progress, then we'll end the progress. This is needed for example,\n // when the `clear` button was clicked, because there we always show the loading process, to prevent flashing.\n if (ctrl.loading) setLoading(false);\n\n if ($scope.selectOnMatch) selectItemOnMatch();\n\n updateMessages();\n positionDropdown();\n }\n }\n\n /**\n * Updates the ARIA messages\n */\n function updateMessages () {\n getCurrentDisplayValue().then(function (msg) {\n ctrl.messages = [ getCountMessage(), msg ];\n });\n }\n\n /**\n * Returns the ARIA message for how many results match the current query.\n * @returns {*}\n */\n function getCountMessage () {\n if (lastCount === ctrl.matches.length) return '';\n lastCount = ctrl.matches.length;\n switch (ctrl.matches.length) {\n case 0:\n return 'There are no matches available.';\n case 1:\n return 'There is 1 match available.';\n default:\n return 'There are ' + ctrl.matches.length + ' matches available.';\n }\n }\n\n /**\n * Makes sure that the focused element is within view.\n */\n function updateScroll () {\n if (!elements.li[0]) return;\n var height = elements.li[0].offsetHeight,\n top = height * ctrl.index,\n bot = top + height,\n hgt = elements.scroller.clientHeight,\n scrollTop = elements.scroller.scrollTop;\n if (top < scrollTop) {\n scrollTo(top);\n } else if (bot > scrollTop + hgt) {\n scrollTo(bot - hgt);\n }\n }\n\n function isPromiseFetching() {\n return fetchesInProgress !== 0;\n }\n\n function scrollTo (offset) {\n elements.$.scrollContainer.controller('mdVirtualRepeatContainer').scrollTo(offset);\n }\n\n function notFoundVisible () {\n var textLength = (ctrl.scope.searchText || '').length;\n\n return ctrl.hasNotFound && !hasMatches() && (!ctrl.loading || isPromiseFetching()) && textLength >= getMinLength() && (hasFocus || noBlur) && !hasSelection();\n }\n\n /**\n * Starts the query to gather the results for the current searchText. Attempts to return cached\n * results first, then forwards the process to `fetchResults` if necessary.\n */\n function handleQuery () {\n var searchText = $scope.searchText || '',\n term = searchText.toLowerCase();\n //-- if results are cached, pull in cached results\n if (!$scope.noCache && cache[ term ]) {\n ctrl.matches = cache[ term ];\n updateMessages();\n } else {\n fetchResults(searchText);\n }\n\n ctrl.hidden = shouldHide();\n }\n\n /**\n * If there is only one matching item and the search text matches its display value exactly,\n * automatically select that item. Note: This function is only called if the user uses the\n * `md-select-on-match` flag.\n */\n function selectItemOnMatch () {\n var searchText = $scope.searchText,\n matches = ctrl.matches,\n item = matches[ 0 ];\n if (matches.length === 1) getDisplayValue(item).then(function (displayValue) {\n var isMatching = searchText == displayValue;\n if ($scope.matchInsensitive && !isMatching) {\n isMatching = searchText.toLowerCase() == displayValue.toLowerCase();\n }\n\n if (isMatching) select(0);\n });\n }\n\n}", "title": "" } ]
[ { "docid": "ca79a4dd1a3cef9e36a352d075251e70", "score": "0.5832099", "text": "function Padding() {\n HTMLDecorators.Decorator.call(this);\n }", "title": "" }, { "docid": "ca79a4dd1a3cef9e36a352d075251e70", "score": "0.5832099", "text": "function Padding() {\n HTMLDecorators.Decorator.call(this);\n }", "title": "" }, { "docid": "5269fcb975d5e61cdb5eb05160900c3c", "score": "0.5816567", "text": "set padding(value) {\n if (!latte._isNumber(value))\n throw new latte.InvalidArgumentEx('value');\n // Set value\n this._padding = value;\n if (latte._isNumber(value)) {\n // Margin of container\n this.container.css('padding', value);\n // Bottom margin of elements\n this.container.children().css('margin-bottom', value);\n }\n else {\n // Delete properties\n this.container.css('padding', '');\n this.container.children().css('margin-bottom', '');\n }\n }", "title": "" }, { "docid": "cf1837021de02b9c4f9e0836641fa568", "score": "0.56748456", "text": "get padding() {\n return this._padding;\n }", "title": "" }, { "docid": "cf1837021de02b9c4f9e0836641fa568", "score": "0.56748456", "text": "get padding() {\n return this._padding;\n }", "title": "" }, { "docid": "cf1837021de02b9c4f9e0836641fa568", "score": "0.56748456", "text": "get padding() {\n return this._padding;\n }", "title": "" }, { "docid": "1e4c1fa827294b4b3e93c1d3eb7af2fa", "score": "0.5673228", "text": "getPadding() {\n return this.padding;\n }", "title": "" }, { "docid": "57af51fb3abad7433727f6caaed04758", "score": "0.5616047", "text": "set padding(value) {\n this._padding = value;\n this.container.css('padding', value);\n }", "title": "" }, { "docid": "7588e07023858fa7b70fc2ac4ed0400a", "score": "0.5592022", "text": "pad(input) {\n let value = input.toString();\n\n if(value.length < 2 && value.length !=0) {\n return \"0\" + value;\n }\n return value;\n }", "title": "" }, { "docid": "fdedc4481a6ba66d0c57b60ea26ecd04", "score": "0.5572978", "text": "function padLeft(value, padding) {\n // ...\n}", "title": "" }, { "docid": "87124b23d65a470bbf744ebb78e3ee8a", "score": "0.5568214", "text": "function SearchInputResize() {\n\tvar get_search_button_size = jQuery('#searchsubmit').width();\n\tvar padding = get_search_button_size + 50;\n\tjQuery('#searchform div').css('padding-right',padding);\n}", "title": "" }, { "docid": "3d146bfd686e3bd3f6b28fd4c83b5b0c", "score": "0.5497545", "text": "function fixup() {\n var width = $(\"#wholesale .sp div span\").width();\n $(\"#wholesale .sp div input\").css('paddingLeft', width + 12);\n }", "title": "" }, { "docid": "b4bd3b95e0a629941d466979c6d4d35b", "score": "0.5387115", "text": "function setPseudoCheckboxPaddingSize() {\n if (!SELECT_MULTIPLE_PANEL_PADDING_X && this.props.multiple) {\n const pseudoCheckbox = this.PANEL.querySelector('.mat-pseudo-checkbox');\n if (pseudoCheckbox) {\n SELECT_MULTIPLE_PANEL_PADDING_X = SELECT_PANEL_PADDING_X * 1.5 + pseudoCheckbox.offsetWidth;\n }\n }\n}", "title": "" }, { "docid": "e971a684bf75818d04e62cddabfc471f", "score": "0.5375419", "text": "function padFunction() {\n\n\n}", "title": "" }, { "docid": "8eb8b7abe453dd37cf86db1d38128889", "score": "0.53358984", "text": "get padBottom(){ return this.__button.ui.padBottom; }", "title": "" }, { "docid": "f35ee40938d882e1013f6d738a7a3f24", "score": "0.52447575", "text": "styleTextInputContainer() {\n return {\n borderBottomWidth: 2,\n borderBottomColor: this.props.colorController\n }\n }", "title": "" }, { "docid": "f0d2bb0fcf8c5d5bbecdb4f9c7482067", "score": "0.52427554", "text": "set padding(value) {\n if (value == null)\n value = 0;\n this._padding = value;\n // Adjust margins\n this.itemsElement.children().css('marginRight', value);\n this.itemsElement.css('paddingLeft', value);\n this.sideItemsElement.children().css('marginLeft', value);\n this.sideItemsElement.css('paddingRight', value);\n }", "title": "" }, { "docid": "f82dff0b9fa7e855b302cfa428d00e60", "score": "0.5236919", "text": "function updatePadding(selection, root) {\n // Get item with pad string\n let padNode = null;\n let targetNode = null;\n selection.items.forEach(item => {\n if (item.name.substr(0, 3) === \"pad\") {\n padNode = item;\n } else {\n targetNode = item;\n }\n });\n\n // Extract H/V padding values from layer name\n const padding = padNode.name.match(/\\b(\\d+)\\b/);\n\n let pT = 0;\n let pR = 0;\n let pB = 0;\n let pL = 0;\n if (padding.length === 1) {\n pT = parseFloat(padding);\n pR = parseFloat(padding);\n pB = parseFloat(padding);\n pL = parseFloat(padding);\n }\n if (padding.length === 2) {\n pT = parseFloat(padding[0]);\n pR = parseFloat(padding[1]);\n pB = parseFloat(padding[0]);\n pL = parseFloat(padding[1]);\n }\n if (padding.length === 3) {\n pT = parseFloat(padding[0]);\n pR = parseFloat(padding[1]);\n pB = parseFloat(padding[2]);\n pL = parseFloat(padding[1]);\n }\n if (padding.length === 4) {\n pT = parseFloat(padding[0]);\n pR = parseFloat(padding[1]);\n pB = parseFloat(padding[2]);\n pL = parseFloat(padding[3]);\n }\n\n const contentBounds = targetNode.boundsInParent;\n padNode.resize(\n contentBounds.width + pR + pL,\n contentBounds.height + pT + pB\n );\n padNode.placeInParentCoordinates(targetNode.localBounds, {\n // move frame's visual top left to appropriate place\n x: contentBounds.x - pL,\n y: contentBounds.y - pT\n });\n}", "title": "" }, { "docid": "4675de30b87db5e7693934351a624b61", "score": "0.5194982", "text": "_pad() {\n const sliderRect = this.getBoundingClientRect(), firstPageRect = this.getFirstPageRect(), lastPageRect = this.getLastPageRect();\n let padStart = 0, padEnd = 0;\n // different calculation depending on direction\n if (this.props.direction === 'vertical') {\n // calculate padStart\n padStart = (sliderRect.height - firstPageRect.height) * 0.5;\n padEnd = (sliderRect.height - lastPageRect.height) * 0.5;\n }\n else {\n // calculate padStart\n padStart = (sliderRect.width - firstPageRect.width) * 0.5;\n padEnd = (sliderRect.width - lastPageRect.width) * 0.5;\n }\n // set the css property\n this.style.setProperty('--s-slider-pad-start', `${Math.round(padStart)}px`);\n this.style.setProperty('--s-slider-pad-end', `${Math.round(padEnd)}px`);\n }", "title": "" }, { "docid": "c83f0470c36d84fdef6b3479eb9f4c70", "score": "0.51765805", "text": "function _sizing() {\n\t\tfieldinput.css({\n\t\t\tfontSize: static_span.css('fontSize'),\n\t\t\tfontFamily: static_span.css('fontFamily'),\n\t\t\tfontWeight: static_span.css('fontWeight'),\n\t\t\tletterSpacing: static_span.css('letterSpacing'),\n\t\t\ttextAlign: static_span.css('textAlign')\n\t\t});\n\t\tif (!fieldinput.data('inplace')) {\n\t\t\tfieldinput.data('inplace', {});\n\t\t}\n\t\tif (container_span.hasClass('Q_editing')) {\n\t\t\tfieldinput.data('inplace').widthWasAdjusted = true;\n\t\t\tfieldinput.data('inplace').heightWasAdjusted = true;\n\t\t}\n\t\tif (fieldinput.is('textarea') && !fieldinput.val()) {\n\t\t\tvar height = static_span.outerHeight() + 'px';\n\t\t\tfieldinput.add(static_span).css('min-height', height);\n\t\t}\n\t}", "title": "" }, { "docid": "75d95f715be8cf1102381cf4d071f551", "score": "0.51734024", "text": "get columnPadding() {\n return this._paddingColumns;\n }", "title": "" }, { "docid": "004e413b80ecd06875806e3efeeb45b6", "score": "0.5152635", "text": "get pad(){ return this.__button.ui.pad; }", "title": "" }, { "docid": "c5aacc04a1b88c0f7840b382f3b8c538", "score": "0.51367295", "text": "get padLeft(){ return this.__button.ui.padLeft; }", "title": "" }, { "docid": "353f4e2c88c8613e59197fabe0f33104", "score": "0.5111477", "text": "getOffsetWidth() { return this.placeholder.offsetWidth; }", "title": "" }, { "docid": "3de9c26ddc56ab173ebd05acd46b97c1", "score": "0.5054917", "text": "function SpacingInset({size, displayStyle, children}) {\n return (\n <div style={{ padding: getSize(size), display: displayStyle}}>\n {children}\n </div>\n )\n}", "title": "" }, { "docid": "7a131baf7daeedf304b7eb87f688686c", "score": "0.50270903", "text": "function getPaddingBytes(size, alignment) {\n return (alignment - (size % alignment)) % alignment;\n}", "title": "" }, { "docid": "cab48f15bc39434f2081c29c4edf1626", "score": "0.50006557", "text": "function _getInputWrapperHeight() {\n var _inputMargins = 38; /* Default sum of paddings and margins to correct wrapper element height */\n var _inputAttachmentsHeight = _inputAttachments.offsetHeight; /* Attachments section height */\n return _inputHeight === 20 ? 'auto' : _inputHeight + _inputMargins + _inputAttachmentsHeight + 'px';\n }", "title": "" }, { "docid": "170003f2eadadd56b1d810cef406bd65", "score": "0.49993905", "text": "function loginpadding(){\n\t\t\tvar winH \t= parseInt($(window).height(),10)/2,\n\t\t\t\tdocH \t= parseInt($(window).height(),10),\n\t\t\t\tloginH \t= parseInt($('.login-box-lg').height(),10)/2,\n\t\t\t\tpadd \t= winH - loginH;\n\t\t\t$('.login-page .pageWrapper').css('padding-top',padd+'px');\n\t\t\t$('.fullscreen').css('height',docH+'px');\n\t\t}", "title": "" }, { "docid": "364932386787e0f1d21655f5407baaa3", "score": "0.49869698", "text": "function PaddingFrame () {\n Frame.call(this);\n\n this._padded = false;\n this.padding = null;\n}", "title": "" }, { "docid": "52eb82c2b32ccbe7bd6975bb18340e71", "score": "0.49718636", "text": "adjustHeight() {\n const element = this.get('element');\n /** @type {HTMLElement} */\n const inputWrapper = element && element.querySelector('.tknz-input-wrapper')[0];\n /** @type {HTMLElement} */\n const wrapper = element && element.querySelector('.tknz-wrapper')[0];\n if (!inputWrapper || !wrapper) {\n return;\n }\n if (inputWrapper.offsetTop + inputWrapper.offsetHeight > wrapper.offsetHeight) {\n const currentHeight = parseInt(globals.window.getComputedStyle(wrapper).height);\n wrapper.style.height = currentHeight + 24 + 'px';\n }\n }", "title": "" }, { "docid": "72867c6db04bea498e71cf7e0b78183c", "score": "0.49689725", "text": "function pad(d) {\r\n\t\t\treturn (d < 10) ? '0' + d.toString() : d.toString();\r\n\t\t}", "title": "" }, { "docid": "c40483cf2e3c22f6de6b7f7945d8f0db", "score": "0.4967652", "text": "set columnPadding(value) {\n this.container.find('.column-content').css('margin', value);\n this.container.find('.column-content > .latte-item').css('margin-bottom', value);\n this._paddingColumns = value;\n }", "title": "" }, { "docid": "1a86225df19e834aca184625213b56fb", "score": "0.49496385", "text": "function inputFieldSizeHack() {\n var height = $('#submit_span').outerHeight();\n $('#submit').outerHeight(height);\n $('#input_field').outerHeight(height)\n}", "title": "" }, { "docid": "0b16e56567d6f318e66d39ccc2e8081f", "score": "0.494653", "text": "get padTop(){ return this.__button.ui.padTop; }", "title": "" }, { "docid": "2996a922c6c6f18c84e81d73ad322a56", "score": "0.49375856", "text": "function padding(value) {\n const valueString = value + \"\";\n\n if (valueString.length < 2) {\n return \"0\" + valueString;\n }\n else {\n return valueString;\n }\n}", "title": "" }, { "docid": "c387553c62e4e9adbfa64e4eeb1278b6", "score": "0.49361077", "text": "function pad(d) {\n return (d < 10) ? '0' + d.toString() : d.toString();\n }", "title": "" }, { "docid": "59565b984532b31e03c101781ea36ccd", "score": "0.49256307", "text": "function pad( what, filler, size )\n{\n\tvar result = null;\n\t\n\t// Make sure the provided value is a string\n\tresult = new String( what );\n\t\n\t// While the content length is less than provided size\n\t// Tack on extra provided character to the end\n\twhile( result.length < size )\n\t{\n\t\tresult = result + filler;\t\n\t}\n\t\n\t// Return the formatted result\n\treturn result;\n}", "title": "" }, { "docid": "283cc67628a68ccfe64e45282b6872eb", "score": "0.49197963", "text": "function padMe(menuItem) {\n\tlet spaces =\"\";\n\tif (menuItem.length < 30) {\n\t\tfor (space=1;space<= 30-menuItem.length;space++){\n\t\t\tspaces+=\" \";\n\t\t}\n\t\tmenuItem+=spaces;\n\t}\n\treturn menuItem;\n}", "title": "" }, { "docid": "525c7bd809d404fa452ed7e9b26f7e26", "score": "0.4918423", "text": "getLinesWithPadding() {\n const top = new Array(this.paddingTop).fill('').map(this.getEmptyLineNode);\n const bottom = new Array(this.paddingBottom).fill('').map(this.getEmptyLineNode);\n return top.concat(this.state.content).concat(bottom);\n }", "title": "" }, { "docid": "5fd9c290fcf979abb6506630b0041f90", "score": "0.4886208", "text": "function setupInputBox() {\n var input = document.getElementById(ids.userInput);\n var dummy = document.getElementById(ids.userInputDummy);\n var minFontSize = 9;\n var maxFontSize = 16;\n var minPadding = 5;\n var maxPadding = 9;\n\n // If no dummy input box exists, create one\n if (dummy === null) {\n var dummyJson = {\n 'tagName': 'div',\n 'attributes': [{\n 'name': 'id',\n 'value': (ids.userInputDummy)\n }]\n };\n\n dummy = Common.buildDomElement(dummyJson);\n document.body.appendChild(dummy);\n }\n\n function adjustInput() \n {\n \n if (input.value === '') {\n // If the input box is empty, remove the underline\n Common.removeClass(input, 'underline');\n input.setAttribute('style', 'width:' + '100%');\n input.style.width = '100%';\n } else {\n // otherwise, adjust the dummy text to match, and then set the width of\n // the visible input box to match it (thus extending the underline)\n Common.addClass(input, classes.underline);\n var txtNode = document.createTextNode(input.value);\n ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height',\n 'text-transform', 'letter-spacing'].forEach(function(index) {\n dummy.style[index] = window.getComputedStyle(input, null).getPropertyValue(index);\n });\n dummy.textContent = txtNode.textContent;\n\n var padding = 0;\n var htmlElem = document.getElementsByTagName('html')[0];\n var currentFontSize = parseInt(window.getComputedStyle(htmlElem, null).getPropertyValue('font-size'), 10);\n if (currentFontSize) {\n padding = Math.floor((currentFontSize - minFontSize) / (maxFontSize - minFontSize)\n * (maxPadding - minPadding) + minPadding);\n } else {\n padding = maxPadding;\n }\n\n var widthValue = ( dummy.offsetWidth + padding) + 'px';\n input.setAttribute('style', 'width:' + widthValue);\n input.style.width = widthValue;\n }\n }\n\n // Any time the input changes, or the window resizes, adjust the size of the input box\n input.addEventListener('input', adjustInput);\n window.addEventListener('resize', adjustInput);\n\n // Trigger the input event once to set up the input box and dummy element\n Common.fireEvent(input, 'input');\n }", "title": "" }, { "docid": "7ffabe2732f8e2b5280b8667fef8e447", "score": "0.48682994", "text": "function setupInputBox() {\n var input = document.getElementById(ids.userInput);\n var dummy = document.getElementById(ids.userInputDummy);\n var minFontSize = 9;\n var maxFontSize = 16;\n var minPadding = 5;\n var maxPadding = 9;\n\n // If no dummy input box exists, create one\n if (dummy === null) {\n var dummyJson = {\n 'tagName': 'div',\n 'attributes': [{\n 'name': 'id',\n 'value': (ids.userInputDummy)\n }]\n };\n\n dummy = Common.buildDomElement(dummyJson);\n document.body.appendChild(dummy);\n }\n\n function adjustInput() {\n if (input.value === '') {\n // If the input box is empty, remove the underline\n Common.removeClass(input, 'underline');\n input.setAttribute('style', 'width:' + '100%');\n input.style.width = '100%';\n } else {\n // otherwise, adjust the dummy text to match, and then set the width of\n // the visible input box to match it (thus extending the underline)\n Common.addClass(input, classes.underline);\n var txtNode = document.createTextNode(input.value);\n ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height',\n 'text-transform', 'letter-spacing'\n ].forEach(function (index) {\n dummy.style[index] = window.getComputedStyle(input, null).getPropertyValue(index);\n });\n dummy.textContent = txtNode.textContent;\n\n var padding = 0;\n var htmlElem = document.getElementsByTagName('html')[0];\n var currentFontSize = parseInt(window.getComputedStyle(htmlElem, null).getPropertyValue('font-size'), 10);\n if (currentFontSize) {\n padding = Math.floor((currentFontSize - minFontSize) / (maxFontSize - minFontSize) *\n (maxPadding - minPadding) + minPadding);\n } else {\n padding = maxPadding;\n }\n\n var widthValue = (dummy.offsetWidth + padding) + 'px';\n input.setAttribute('style', 'width:' + widthValue);\n input.style.width = widthValue;\n }\n }\n\n // Any time the input changes, or the window resizes, adjust the size of the input box\n input.addEventListener('input', adjustInput);\n window.addEventListener('resize', adjustInput);\n\n // Trigger the input event once to set up the input box and dummy element\n Common.fireEvent(input, 'input');\n }", "title": "" }, { "docid": "503e8025fabb6f0cc40d8bdf37578432", "score": "0.48469588", "text": "function getPadding(padding, xPadding, yPadding) {\n let tempPadding = padding;\n if (xPadding || yPadding) {\n tempPadding = {x: xPadding || 6, y: yPadding || 6};\n }\n return toPadding(tempPadding);\n}", "title": "" }, { "docid": "e13db241d72fe147c335151caca5de4b", "score": "0.48156956", "text": "function updateTextPadding() {\n\t\t\tvar styles = wrapper.styles,\n\t\t\t\ttextAlign = styles && styles.textAlign,\n\t\t\t\tx = padding,\n\t\t\t\ty;\n\t\t\t\n\t\t\t// determin y based on the baseline\n\t\t\ty = baseline ? 0 : baselineOffset;\n\n\t\t\t// compensate for alignment\n\t\t\tif (defined(width) && (textAlign === 'center' || textAlign === 'right')) {\n\t\t\t\tx += { center: 0.5, right: 1 }[textAlign] * (width - bBox.width);\n\t\t\t}\n\n\t\t\t// update if anything changed\n\t\t\tif (x !== text.x || y !== text.y) {\n\t\t\t\ttext.attr({\n\t\t\t\t\tx: x,\n\t\t\t\t\ty: y\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// record current values\n\t\t\ttext.x = x;\n\t\t\ttext.y = y;\n\t\t}", "title": "" }, { "docid": "a889ca852eaf2a7d6a5011ccba30c3cf", "score": "0.4813448", "text": "static createInNativeLayoutContentUnderWidgets(container) {\n internal.createInVersionCheck(container.model, PasswordTextBox.structureTypeName, { start: \"8.0.0\" });\n return internal.instancehelpers.createElement(container, PasswordTextBox, \"widgets\", true);\n }", "title": "" }, { "docid": "c23e3887d79dd8e8ba961cffae54e175", "score": "0.4810213", "text": "function calculateInputWidth(lastTag) {\n const w = container.offsetWidth\n if(!w) return\n let t = w - (lastTag.offsetWidth + lastTag.offsetLeft) - 5\n t = Math.max(t, w / 5)\n return t\n }", "title": "" }, { "docid": "ea37933f863afe0309618f3702cec395", "score": "0.48084462", "text": "function pad(d) {\n return (d < 10) ? '0' + d.toString() : d.toString();\n}", "title": "" }, { "docid": "863c2c8d0a505a71c9db928130e8e508", "score": "0.4804301", "text": "static createInNativeLayoutUnderWidgets(container) {\n internal.createInVersionCheck(container.model, PasswordTextBox.structureTypeName, { start: \"7.21.0\", end: \"7.23.0\" });\n return internal.instancehelpers.createElement(container, PasswordTextBox, \"widgets\", true);\n }", "title": "" }, { "docid": "796e5ccc096c18939ebf8a75807f5723", "score": "0.47995377", "text": "function calculateColumnsAndMargin() {\n var sel = $.fn.pinner.opts.pinSelector;\n var gutter = $.fn.pinner.opts.gutter;\n var ctr = $.fn.pinner.opts.container;\n\n var ctrWidth = $(ctr).width();\n var colWidth = $(sel).outerWidth() + gutter;\n var cols = parseInt(ctrWidth / colWidth, 10);\n var leftMar = ((ctrWidth - (cols * colWidth) - gutter) / 2);\n return {numCols: cols, leftMargin: leftMar};\n }", "title": "" }, { "docid": "7c743d5b6f9342778dd3bcf1258eb82c", "score": "0.47887844", "text": "pad (string, length) {\n if (length <= string.length){\n return string\n }\n \n let startPaddingLength = Math.floor(Math.abs(string.length - length) / 2 )\n \n let endPaddingLength = (length - string.length) - startPaddingLength\n \n let paddedString = ' '.repeat(startPaddingLength) + string + ' '.repeat(endPaddingLength)\n \n return paddedString\n }", "title": "" }, { "docid": "555bc413df3699483d70078e72cfca01", "score": "0.47876287", "text": "function updateTextPadding() {\n\t\t\tvar styles = wrapper.styles,\n\t\t\t\ttextAlign = styles && styles.textAlign,\n\t\t\t\tx = paddingLeft + padding * (1 - alignFactor),\n\t\t\t\ty;\n\t\t\t\n\t\t\t// determin y based on the baseline\n\t\t\ty = baseline ? 0 : baselineOffset;\n\n\t\t\t// compensate for alignment\n\t\t\tif (defined(width) && (textAlign === 'center' || textAlign === 'right')) {\n\t\t\t\tx += { center: 0.5, right: 1 }[textAlign] * (width - bBox.width);\n\t\t\t}\n\n\t\t\t// update if anything changed\n\t\t\tif (x !== text.x || y !== text.y) {\n\t\t\t\ttext.attr({\n\t\t\t\t\tx: x,\n\t\t\t\t\ty: y\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// record current values\n\t\t\ttext.x = x;\n\t\t\ttext.y = y;\n\t\t}", "title": "" }, { "docid": "2da05d79989f99018434a307fdd26b3f", "score": "0.47809944", "text": "styleTextInput() {\n return {\n padding: 5,\n height: 40,\n color: this.props.theme.primaryTextColor,\n }\n }", "title": "" }, { "docid": "08643f3a39823da73f5a8a7da57d8c73", "score": "0.47791517", "text": "function padLeft(input, padding, length) {\n var result = input;\n\n var padLength = length - input.length;\n for (var i = 0; i < padLength; i++) {\n result = padding + result;\n }\n\n return result;\n}", "title": "" }, { "docid": "e0763adf2c4ed333b5f7330ae9bdee39", "score": "0.47707585", "text": "static createInLayoutGridColumnUnderWidget(container) {\n internal.createInVersionCheck(container.model, PasswordTextBox.structureTypeName, { start: \"7.0.2\", end: \"7.14.0\" });\n return internal.instancehelpers.createElement(container, PasswordTextBox, \"widget\", false);\n }", "title": "" }, { "docid": "e28eb0c70f43b3037ec260fe4913b59c", "score": "0.47692257", "text": "function padding() {\n\tif (div.parentElement.clientWidth > 1270) {\n\t\tdocument.getElementById(\"calltoaction\").style.paddingTop = \"20%\";\n\t} else if (div.parentElement.clientWidth > 794) {\n\t\tdocument.getElementById(\"calltoaction\").style.paddingTop = \"10%\";\n\t} else {\n\t\tdocument.getElementById(\"calltoaction\").style.paddingTop = \"0\";\n\t}\n}", "title": "" }, { "docid": "90f9e5e917353c94ca75b90917c2a17e", "score": "0.476811", "text": "static createInLayoutGridColumnUnderWidgets(container) {\n internal.createInVersionCheck(container.model, PasswordTextBox.structureTypeName, { start: \"7.15.0\" });\n return internal.instancehelpers.createElement(container, PasswordTextBox, \"widgets\", true);\n }", "title": "" }, { "docid": "3d10b5c277b015d01ca4e501406cc419", "score": "0.47603494", "text": "function setupInputBox() {\n var input = document.getElementById('textInput');\n var dummy = document.getElementById('textInputDummy');\n var minFontSize = 14;\n var maxFontSize = 16;\n var minPadding = 4;\n var maxPadding = 6;\n\n // If no dummy input box exists, create one\n if (dummy === null) {\n var dummyJson = {\n tagName: 'div',\n attributes: [\n {\n name: 'id',\n value: 'textInputDummy'\n }\n ]\n };\n\n dummy = Common.buildDomElement(dummyJson);\n document.body.appendChild(dummy);\n }\n\n function adjustInput() {\n if (input.value === '') {\n // If the input box is empty, remove the underline\n input.classList.remove('underline');\n input.setAttribute('style', 'width:' + '100%');\n input.style.width = '100%';\n } else {\n // otherwise, adjust the dummy text to match, and then set the width of\n // the visible input box to match it (thus extending the underline)\n input.classList.add('underline');\n var txtNode = document.createTextNode(input.value);\n [\n 'font-size',\n 'font-style',\n 'font-weight',\n 'font-family',\n 'line-height',\n 'text-transform',\n 'letter-spacing'\n ].forEach(function(index) {\n dummy.style[index] = window\n .getComputedStyle(input, null)\n .getPropertyValue(index);\n });\n dummy.textContent = txtNode.textContent;\n\n var padding = 0;\n var htmlElem = document.getElementsByTagName('html')[0];\n var currentFontSize = parseInt(\n window.getComputedStyle(htmlElem, null).getPropertyValue('font-size'),\n 10\n );\n if (currentFontSize) {\n padding = Math.floor(\n ((currentFontSize - minFontSize) / (maxFontSize - minFontSize)) *\n (maxPadding - minPadding) +\n minPadding\n );\n } else {\n padding = maxPadding;\n }\n\n var widthValue = dummy.offsetWidth + padding + 'px';\n input.setAttribute('style', 'width:' + widthValue);\n input.style.width = widthValue;\n }\n }\n\n // Any time the input changes, or the window resizes, adjust the size of the input box\n input.addEventListener('input', adjustInput);\n window.addEventListener('resize', adjustInput);\n\n // Trigger the input event once to set up the input box and dummy element\n Common.fireEvent(input, 'input');\n }", "title": "" }, { "docid": "34e84cec63f9e1e451f85eb0208e9a4c", "score": "0.47563022", "text": "function pad(d) {\n \t//Allows for time to display as example: 12:04 instead of 12:4\n return (d < 10) ? '0' + d.toString() : d.toString();\n }", "title": "" }, { "docid": "4de3f251ddd797421194a84431a4e09d", "score": "0.47512653", "text": "_fixCustomContentPadding() {\n let customContentPaddingValue = getComputedStyle(this).getPropertyValue('--dw-dialog-content-padding').trim();\n if(customContentPaddingValue) {\n this.setAttribute('custom-content-padding-applied', '');\n } else {\n this.removeAttribute('custom-content-padding-applied');\n }\n }", "title": "" }, { "docid": "a18a584d88bfad513333bfeabee173b1", "score": "0.47469252", "text": "function updatePadding(element, css, reductionFactor){\n var pb = css.getPropertyValue('padding-bottom'),\n pt = css.getPropertyValue('padding-top'),\n pr = css.getPropertyValue('padding-right'),\n pl = css.getPropertyValue('padding-left'),\n paddingBottom = parseInt(pb)*reductionFactor,\n paddingTop = parseInt(pt)*reductionFactor,\n paddingRight = parseInt(pr)*reductionFactor,\n paddingLeft = parseInt(pl)*reductionFactor;\n\n element.style.paddingBottom = getSize(paddingBottom, pb.indexOf('%') >= 0);\n element.style.paddingTop = getSize(paddingTop, pt.indexOf('%') >= 0);\n element.style.paddingRight = getSize(paddingRight, pr.indexOf('%') >= 0);\n element.style.paddingLeft = getSize(paddingLeft, pl.indexOf('%') >= 0);\n return [paddingBottom+paddingTop, paddingRight+paddingLeft];\n}", "title": "" }, { "docid": "f6597dc0e3c76a50050e1d78e8ee7a59", "score": "0.47409672", "text": "function updateTextPadding() {\n var styles = wrapper.styles, textAlign = styles && styles.textAlign, x = paddingLeft + padding * (1 - alignFactor), y;\n // determin y based on the baseline\n y = baseline ? 0 : baselineOffset;\n // compensate for alignment\n if (defined(width) && bBox && (textAlign === 'center' || textAlign === 'right')) {\n x += {\n center: 0.5,\n right: 1\n }[textAlign] * (width - bBox.width);\n }\n // update if anything changed\n if (x !== text.x || y !== text.y) {\n text.attr('x', x);\n if (y !== UNDEFINED) {\n text.attr('y', y);\n }\n }\n // record current values\n text.x = x;\n text.y = y;\n }", "title": "" }, { "docid": "5404cf5e27c9ecb43a038372e56956cc", "score": "0.47408587", "text": "function updateTextPadding() {\n\t\t\t\tvar styles = wrapper.styles,\n\t\t\t\t\ttextAlign = styles && styles.textAlign,\n\t\t\t\t\tx = paddingLeft + padding * (1 - alignFactor),\n\t\t\t\t\ty;\n\n\t\t\t\t// determin y based on the baseline\n\t\t\t\ty = baseline ? 0 : baselineOffset;\n\n\t\t\t\t// compensate for alignment\n\t\t\t\tif (defined(width) && bBox && (textAlign === 'center' || textAlign === 'right')) {\n\t\t\t\t\tx += { center: 0.5, right: 1 }[textAlign] * (width - bBox.width);\n\t\t\t\t}\n\n\t\t\t\t// update if anything changed\n\t\t\t\tif (x !== text.x || y !== text.y) {\n\t\t\t\t\ttext.attr('x', x);\n\t\t\t\t\tif (y !== UNDEFINED) {\n\t\t\t\t\t\ttext.attr('y', y);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// record current values\n\t\t\t\ttext.x = x;\n\t\t\t\ttext.y = y;\n\t\t\t}", "title": "" }, { "docid": "2486c8c788fce5c09744b70a612e8826", "score": "0.47336394", "text": "function pad(d) {\n return (d < 10) ? '0' + d.toString() : d.toString();\n}", "title": "" }, { "docid": "2486c8c788fce5c09744b70a612e8826", "score": "0.47336394", "text": "function pad(d) {\n return (d < 10) ? '0' + d.toString() : d.toString();\n}", "title": "" }, { "docid": "d83913333cafeee5c8b9ed64afc7ff5b", "score": "0.4729406", "text": "get padRight(){ return this.__button.ui.padRight; }", "title": "" }, { "docid": "f6a8567bf64dc3706ed95f449153bcfa", "score": "0.4726106", "text": "layout () {\n this.inputEditor.layout({\n width: (this.rootRef.current.clientWidth - 30) / 2 - 5,\n height: this.rootRef.current.clientHeight - 35\n })\n this.outputEditor.layout({\n width: (this.rootRef.current.clientWidth - 30) / 2 - 5,\n height: this.rootRef.current.clientHeight - 35\n })\n }", "title": "" }, { "docid": "f299b69d0b5116cf87378daf8d3ca0ec", "score": "0.47259104", "text": "function setupInputBox() {\n var input = document.getElementById('textInput');\n var dummy = document.getElementById('textInputDummy');\n var minFontSize = 14;\n var maxFontSize = 16;\n var minPadding = 4;\n var maxPadding = 6;\n\n // If no dummy input box exists, create one\n if (dummy === null) {\n var dummyJson = {\n 'tagName': 'div',\n 'attributes': [{\n 'name': 'id',\n 'value': 'textInputDummy'\n }]\n };\n\n dummy = Common.buildDomElement(dummyJson);\n document.body.appendChild(dummy);\n }\n\n function adjustInput() {\n if (input.value === '') {\n // If the input box is empty, remove the underline\n input.classList.remove('underline');\n input.setAttribute('style', 'width:' + '100%');\n input.style.width = '100%';\n } else {\n // otherwise, adjust the dummy text to match, and then set the width of\n // the visible input box to match it (thus extending the underline)\n input.classList.add('underline');\n var txtNode = document.createTextNode(input.value);\n ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height',\n 'text-transform', 'letter-spacing'].forEach(function(index) {\n dummy.style[index] = window.getComputedStyle(input, null).getPropertyValue(index);\n });\n dummy.textContent = txtNode.textContent;\n\n var padding = 0;\n var htmlElem = document.getElementsByTagName('html')[0];\n var currentFontSize = parseInt(window.getComputedStyle(htmlElem, null).getPropertyValue('font-size'), 10);\n if (currentFontSize) {\n padding = Math.floor((currentFontSize - minFontSize) / (maxFontSize - minFontSize)\n * (maxPadding - minPadding) + minPadding);\n } else {\n padding = maxPadding;\n }\n\n var widthValue = ( dummy.offsetWidth + padding) + 'px';\n input.setAttribute('style', 'width:' + widthValue);\n input.style.width = widthValue;\n }\n }\n\n // Any time the input changes, or the window resizes, adjust the size of the input box\n input.addEventListener('input', adjustInput);\n window.addEventListener('resize', adjustInput);\n\n // Trigger the input event once to set up the input box and dummy element\n Common.fireEvent(input, 'input');\n }", "title": "" }, { "docid": "df309656787ea17bcd618d5d83aa7f33", "score": "0.47209093", "text": "getVarPaddingTop () {\n return this.getVarOffset(this.delta.start)\n }", "title": "" }, { "docid": "1895cc1575a09be95c5d7365a1f55c9a", "score": "0.47194073", "text": "function _resizeInput() {\n window.setTimeout(function() {\n var input = this.getPart('input');\n var button = this.getPart('button');\n var buttonBorderWidth = parseInt($(button.node).css('border-left-width') || 0, 10) - parseInt($(button.node).css('border-right-width') || 0, 10);\n $(input.node).width($(this.node).width() - $(button.node).width() - buttonBorderWidth);\n }.bind(this), 0);\n }", "title": "" }, { "docid": "3eae830b51f51c38bcc814da0b7bcfc4", "score": "0.4712581", "text": "pad(string, length){\n if (string.length >= length) {\n return string;//\n }\n let startPaddingLength = Math.floor((length - string.length) / 2); \n let endPaddingLength = length - string.length - startPaddingLength;\n let paddedString = ' '.repeat(startPaddingLength).concat(string).concat(' '.repeat(endPaddingLength));\n return paddedString;\n }", "title": "" }, { "docid": "4883333b6c38d9ad2cfb5c39dcbf4335", "score": "0.47079924", "text": "_generatePad() {\n //LAYOUT TO KEYS\n const padLayout = [\n \"1\", \"2\", \"3\",\n \"4\", \"5\", \"6\",\n \"7\", \"8\", \"9\",\n \"del\", \"0\", \"=\"\n ];\n \n //FOR each key figure out if we need line break\n padLayout.forEach(key => {\n const insertBreak = key.search(/[369]/) !== -1; \n //if this key is 3,6,9 then return -1 if cant be found\n const keyEl = document.createElement(\"div\"); //element for the key\n\n keyEl.classList.add(\"pin-login__key\");\n keyEl.textContent = key;\n //when click pass in the key\n keyEl.addEventListener(\"click\", () => { this._handleKeyPress(key) });\n //add key to numpad\n this.el.numPad.appendChild(keyEl);\n\n //if insert line break append it\n if (insertBreak) {\n this.el.numPad.appendChild(document.createElement(\"br\"));\n }\n });\n }", "title": "" }, { "docid": "5180a840fb7ce9f44accc52bf0d7cac1", "score": "0.47045693", "text": "function pad(num, size) {\n var s = \"0000000\" + num;\n return s.substr(s.length-size);\n }", "title": "" }, { "docid": "d1af4bc88409cf5447a9b546d76a97d8", "score": "0.47037202", "text": "function resizeInput() {\n var numberInput = $element.find('input')[0];\n if (!lodash.isNil(numberInput)) {\n numberInput.size = !lodash.isEmpty(ctrl.currentValue) || lodash.isNumber(ctrl.currentValue) ? ctrl.currentValue.toString().length : !lodash.isEmpty(ctrl.placeholder) ? ctrl.placeholder.length : 1;\n }\n }", "title": "" }, { "docid": "ca676ae61d991533f6aa76824eb5e816", "score": "0.47003287", "text": "positionPlaceholder() {\n const inputEl = this.nativeInput;\n if (!inputEl) {\n return;\n }\n const isRTL = document.dir === 'rtl';\n const iconEl = (this.el.shadowRoot || this.el).querySelector('.searchbar-search-icon');\n if (this.shouldAlignLeft) {\n inputEl.removeAttribute('style');\n iconEl.removeAttribute('style');\n }\n else {\n // Create a dummy span to get the placeholder width\n const doc = document;\n const tempSpan = doc.createElement('span');\n tempSpan.innerHTML = sanitizeDOMString(this.placeholder) || '';\n doc.body.appendChild(tempSpan);\n // Get the width of the span then remove it\n const textWidth = tempSpan.offsetWidth;\n tempSpan.remove();\n // Calculate the input padding\n const inputLeft = 'calc(50% - ' + (textWidth / 2) + 'px)';\n // Calculate the icon margin\n const iconLeft = 'calc(50% - ' + ((textWidth / 2) + 30) + 'px)';\n // Set the input padding start and icon margin start\n if (isRTL) {\n inputEl.style.paddingRight = inputLeft;\n iconEl.style.marginRight = iconLeft;\n }\n else {\n inputEl.style.paddingLeft = inputLeft;\n iconEl.style.marginLeft = iconLeft;\n }\n }\n }", "title": "" }, { "docid": "6c58e1b6acb792e651a32e7e0deb527e", "score": "0.46990395", "text": "static createInLayoutUnderWidget(container) {\n internal.createInVersionCheck(container.model, PasswordTextBox.structureTypeName, { start: \"7.0.2\", end: \"7.14.0\" });\n return internal.instancehelpers.createElement(container, PasswordTextBox, \"widget\", false);\n }", "title": "" }, { "docid": "5666c6bc972ad8e06ce1a03f4a21ec15", "score": "0.4688851", "text": "function padInput(number) {\n return number < 10 ? \"0\" + number : number.toString();\n}", "title": "" }, { "docid": "e281782fe24f9e0f2283b7bc5016be17", "score": "0.46885976", "text": "function padInput(number) {\n return number < 10 ? (\"0\" + number) : number.toString();\n}", "title": "" }, { "docid": "919cb88ccb58c72786f54fb439bb7c52", "score": "0.4686894", "text": "_paddingIndent() {\n const nodeLevel = this._treeNode.data && this._tree.treeControl.getLevel\n ? this._tree.treeControl.getLevel(this._treeNode.data)\n : null;\n const level = this._level == null ? nodeLevel : this._level;\n return typeof level === 'number' ? `${level * this._indent}${this.indentUnits}` : null;\n }", "title": "" }, { "docid": "fdced7fd517ba20b0cc81370885c3bfd", "score": "0.46865016", "text": "_setIndentInput(indent) {\n let value = indent;\n let units = 'px';\n if (typeof indent === 'string') {\n const parts = indent.split(cssUnitPattern);\n value = parts[0];\n units = parts[1] || units;\n }\n this.indentUnits = units;\n this._indent = coerceNumberProperty(value);\n this._setPadding();\n }", "title": "" }, { "docid": "b04646b4bc46af24048ccce7b952714d", "score": "0.4684903", "text": "static createInLayoutUnderWidgets(container) {\n internal.createInVersionCheck(container.model, PasswordTextBox.structureTypeName, { start: \"7.15.0\", end: \"7.23.0\" });\n return internal.instancehelpers.createElement(container, PasswordTextBox, \"widgets\", true);\n }", "title": "" }, { "docid": "04d27603bfee65bc16aac7ebaf32ff43", "score": "0.4670345", "text": "calculateOffsetRows() {\n this.#layout.map((line, num) => {\n\n // Width\n this.#keyboardWidthX[num] = this.countCharactersRow(num) * this.#singleKeyboardWidth\n\n // Positions\n this.#keyboardPositionX[num] =\n this.#keyboardDefaultPositionX +\n (this.#keyboardWidth - this.#keyboardWidthX[num]) / 2 +\n this.#singleKeyboardWidth / 2\n })\n }", "title": "" }, { "docid": "669d6b27a697d4c791587f2f3b1fe575", "score": "0.46572393", "text": "function adjust_chat_input_height() {\n\t\tvar height = $('#chat_input').height();\n\t\theight = height / parseFloat($(\"body\").css('font-size'));\n\t\tif (height < 3.2)\n\t\t{\n\t\t\theight += 1;\n\t\t\t//$('#chat_input').css('margin-top', margin_height + 'em');\n\t\t\t$('#chat_input').css('height', height + 'em');\n\t\t\t$('#chat_input_row').css('height', (height+1.5) + 'em');\n\t\t\t$('#chat_input_column').css('height', (height+1.5) + 'em');\n\t\t\tadjust_chat_body_height();\n\t\t}\n\t}", "title": "" }, { "docid": "79b986ccd4a6963d34a745cd9782f3d5", "score": "0.46491474", "text": "function zpad(len, input) {\r\n\t\t\tvar ret = String(input);\r\n\t\t\twhile (ret.length < len)\r\n\t\t\t\tret = '0' + ret;\r\n\t\t\treturn ret;\r\n\t\t}", "title": "" }, { "docid": "9efb1d1f577ee9d9a71e28111d9872e2", "score": "0.4647321", "text": "function adjustContentPadding() {\n var topElem = document.getElementsByClassName('oj-applayout-fixed-top')[0];\n var contentElem = document.getElementsByClassName('oj-applayout-content')[0];\n var bottomElem = document.getElementsByClassName('oj-applayout-fixed-bottom')[0];\n\n if (topElem) {\n contentElem.style.paddingTop = topElem.offsetHeight+'px';\n }\n if (bottomElem) {\n contentElem.style.paddingBottom = bottomElem.offsetHeight+'px';\n }\n // Add oj-complete marker class to signal that the content area can be unhidden.\n // See the CSS demo tab to see when the content area is hidden.\n contentElem.classList.add('oj-complete');\n \n }", "title": "" }, { "docid": "ee1e26a9944666ab4dc1b5d1e6985779", "score": "0.46450168", "text": "function getComputedPadding(basePlacement, padding, distancePx) {\n if (padding === void 0) {\n padding = 5;\n }\n\n var freshPaddingObject = {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n };\n var keys = Object.keys(freshPaddingObject);\n return keys.reduce(function (obj, key) {\n obj[key] = typeof padding === 'number' ? padding : padding[key];\n\n if (basePlacement === key) {\n obj[key] = typeof padding === 'number' ? padding + distancePx : padding[basePlacement] + distancePx;\n }\n\n return obj;\n }, freshPaddingObject);\n}", "title": "" }, { "docid": "ee1e26a9944666ab4dc1b5d1e6985779", "score": "0.46450168", "text": "function getComputedPadding(basePlacement, padding, distancePx) {\n if (padding === void 0) {\n padding = 5;\n }\n\n var freshPaddingObject = {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n };\n var keys = Object.keys(freshPaddingObject);\n return keys.reduce(function (obj, key) {\n obj[key] = typeof padding === 'number' ? padding : padding[key];\n\n if (basePlacement === key) {\n obj[key] = typeof padding === 'number' ? padding + distancePx : padding[basePlacement] + distancePx;\n }\n\n return obj;\n }, freshPaddingObject);\n}", "title": "" }, { "docid": "cacefc6d9f3d14635f78635e9620cbbf", "score": "0.46418834", "text": "function pad(num, size, operator) {\n var s = num + \"\";\n while (s.length < size) {\n s = \"0\" + s;\n }\n return (`[${operator}]${s}`);\n}", "title": "" }, { "docid": "3d3bfb7bc52bf6dfe97f659ea43e29d3", "score": "0.46414286", "text": "function formatPadding(ch, pad) {\n var res = pad ? pad + ch : ch;\n\n if (pad && ch.toString().charAt(0) === \"-\") {\n res = \"-\" + pad + ch.toString().substr(1);\n }\n\n return res.toString();\n }", "title": "" }, { "docid": "d97597a8e472dc247878d6972db0d6ad", "score": "0.46390504", "text": "function zpad(len, input) {\r\n\t\tvar ret = String(input);\r\n\t\twhile (ret.length < len)\r\n\t\t\tret = '0' + ret;\r\n\t\treturn ret;\r\n\t}", "title": "" }, { "docid": "3834dbb7601b3dad11cf08c0809086ad", "score": "0.46325177", "text": "function pad(source){\n if (source.length < 2)\n return \"0\" + source;\n return source;\n }", "title": "" }, { "docid": "bff17586f3464f4c9d0450f92af7233b", "score": "0.46303397", "text": "function setupInputBox()\n\t{\n\t\tvar input = document.getElementById('textInput');\n\t\tvar dummy = document.getElementById('textInputDummy');\n\t\tvar minFontSize = 14;\n\t\tvar maxFontSize = 16;\n\t\tvar minPadding = 4;\n\t\tvar maxPadding = 6;\n\n\t\t// If no dummy input box exists, create one\n\t\tif (dummy === null)\n\t\t{\n\t\t\tvar dummyJson = {\n\t\t\t\t'tagName' : 'div',\n\t\t\t\t'attributes' : [ {\n\t\t\t\t\t'name' : 'id',\n\t\t\t\t\t'value' : 'textInputDummy'\n\t\t\t\t} ]\n\t\t\t};\n\n\t\t\tdummy = Common.buildDomElement(dummyJson);\n\t\t\tdocument.body.appendChild(dummy);\n\t\t}\n\n\t\tfunction adjustInput()\n\t\t{\n\t\t\tif (input.value === '')\n\t\t\t{\n\t\t\t\t// If the input box is empty, remove the underline\n\t\t\t\tinput.classList.remove('underline');\n\t\t\t\tinput.setAttribute('style', 'width:' + '100%');\n\t\t\t\tinput.style.width = '100%';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// otherwise, adjust the dummy text to match, and then set the width of\n\t\t\t\t// the visible input box to match it (thus extending the underline)\n\t\t\t\tinput.classList.add('underline');\n\t\t\t\tvar txtNode = document.createTextNode(input.value);\n\t\t\t\t[ 'font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform',\n\t\t\t\t\t\t'letter-spacing' ].forEach(function(index)\n\t\t\t\t{\n\t\t\t\t\tdummy.style[index] = window.getComputedStyle(input, null).getPropertyValue(index);\n\t\t\t\t});\n\t\t\t\tdummy.textContent = txtNode.textContent;\n\n\t\t\t\tvar padding = 0;\n\t\t\t\tvar htmlElem = document.getElementsByTagName('html')[0];\n\t\t\t\tvar currentFontSize = parseInt(window.getComputedStyle(htmlElem, null).getPropertyValue('font-size'),\n\t\t\t\t\t\t10);\n\t\t\t\tif (currentFontSize)\n\t\t\t\t{\n\t\t\t\t\tpadding = Math.floor((currentFontSize - minFontSize) / (maxFontSize - minFontSize)\n\t\t\t\t\t\t\t* (maxPadding - minPadding) + minPadding);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpadding = maxPadding;\n\t\t\t\t}\n\n\t\t\t\tvar widthValue = (dummy.offsetWidth + padding) + 'px';\n\t\t\t\tinput.setAttribute('style', 'width:' + widthValue);\n\t\t\t\tinput.style.width = widthValue;\n\t\t\t}\n\t\t}\n\n\t\t// Any time the input changes, or the window resizes, adjust the size of the input box\n\t\tinput.addEventListener('input', adjustInput);\n\t\twindow.addEventListener('resize', adjustInput);\n\n\t\t// Trigger the input event once to set up the input box and dummy element\n\t\tCommon.fireEvent(input, 'input');\n\t}", "title": "" }, { "docid": "47171305bd257b2c77d870b78d128b1f", "score": "0.46281362", "text": "static createInDivContainerUnderWidget(container) {\n internal.createInVersionCheck(container.model, PasswordTextBox.structureTypeName, { start: \"7.0.2\", end: \"7.14.0\" });\n return internal.instancehelpers.createElement(container, PasswordTextBox, \"widget\", false);\n }", "title": "" }, { "docid": "f86ce1eafbcb892a08a23de1dbeb7611", "score": "0.46272907", "text": "function formatPadding(ch, pad) {\n var res = pad ? pad + ch : ch;\n if (pad && ch.toString().charAt(0) === '-') {\n res = '-' + pad + ch.toString().substr(1);\n }\n return res.toString();\n}", "title": "" }, { "docid": "c01a8c31ed5f6b15045660736f41be98", "score": "0.4622864", "text": "function setMargin() {\n // Getting the item input and the datepicker div by XPath\n let itemInput = getElementByXpath(\"//input[contains(@class, 'form__input')]\")\n let datePicker = getElementByXpath(\"//div[contains(@class, 'date-picker-items')]\")\n // Checking if they are not null. It may be null if they have not been rendered yet.\n if (itemInput && datePicker) {\n // Getting the coordinates of the left and right relative to the left end of the page, and the top and\n // bottom relative to the top of the page. So in this case rect.left will be the offset of the element from\n // the left and rect.right will be rect.left + width of the element (i.e. the offset of the right end from\n // the left of the page). Similarly rect.top is the offset of the element from the top and rect.bottom is\n // rect.top + height of the element\n let rect = itemInput.getBoundingClientRect();\n // If the left offset is more than 40 we set a fixed margin for the date-picker-items div of 40 px\n if (rect.left > 40) {\n datePicker.style.marginLeft = \"40px\";\n }\n // If it is equal to or less than 40 then we set the margin to the value of rect.left so that it is aligned\n // with the bottom\n else {\n datePicker.style.marginLeft = rect.left + \"px\";\n }\n }\n }", "title": "" }, { "docid": "5bb6631bfddf403d67b5d2433688d9c0", "score": "0.46224755", "text": "function formatPadding(ch, pad) {\n\t var res = pad ? pad + ch : ch;\n\t if (pad && ch.toString().charAt(0) === '-') {\n\t res = '-' + pad + ch.toString().substr(1);\n\t }\n\t return res.toString();\n\t}", "title": "" }, { "docid": "5bb6631bfddf403d67b5d2433688d9c0", "score": "0.46224755", "text": "function formatPadding(ch, pad) {\n\t var res = pad ? pad + ch : ch;\n\t if (pad && ch.toString().charAt(0) === '-') {\n\t res = '-' + pad + ch.toString().substr(1);\n\t }\n\t return res.toString();\n\t}", "title": "" }, { "docid": "5f00979d6997d245fda82aef5044c08d", "score": "0.4617225", "text": "function pad(d) {\r\n return (d < 10) ? '0' + d : d;\r\n}", "title": "" }, { "docid": "cf40fdbd6d89ed832340141903587eb2", "score": "0.4606356", "text": "static createInScrollContainerRegionUnderWidget(container) {\n internal.createInVersionCheck(container.model, PasswordTextBox.structureTypeName, { start: \"7.0.2\", end: \"7.14.0\" });\n return internal.instancehelpers.createElement(container, PasswordTextBox, \"widget\", false);\n }", "title": "" }, { "docid": "2df1714247f595aebd26cc4b01e5ed0f", "score": "0.46014637", "text": "function resizeInput(){\n inputs.forEach( input => {\n input.style.width = input.value.length - 2 + 'ch';\n })\n}", "title": "" }, { "docid": "246cf292b6b0aba59af6f86e492c4cd4", "score": "0.4600138", "text": "function pad(num, size) {\n let result = num.toString();\n while (result.length < size)\n result = '0' + result;\n return result;\n }", "title": "" }, { "docid": "165ef2e4a864a922b4ee0f49420c66d2", "score": "0.45912716", "text": "function createPadding (width) {\n\t var result = ''\n\t var string = ' '\n\t var n = width\n\t do {\n\t if (n % 2) {\n\t result += string;\n\t }\n\t n = Math.floor(n / 2);\n\t string += string;\n\t } while (n);\n\n\t return result;\n\t}", "title": "" }, { "docid": "b6deb3c7eb657020d641df7698a73d8a", "score": "0.45880178", "text": "withPadding(padding) {\n let r = this.clone();\n\n r.x += padding;\n r.width -= padding * 2;\n\n r.y += padding;\n r.height -= padding * 2;\n\n return r;\n }", "title": "" } ]
673fce1a2882a1ea831269144e9664b6
function called twoDice that returns the sum of rolling 2 six sided dice
[ { "docid": "81193e57a2a7a295d253579048417bdf", "score": "0.7770725", "text": "function twoDice(firstRoll, secondRoll) {\n firstRoll = (Math.floor(Math.random()* 6) + 1);\n secondRoll = (Math.floor(Math.random()* 6) + 1);\n console.log(\"The first roll is \" + parseInt(firstRoll));\n console.log(\"The second roll is \" + parseInt(secondRoll));\n return \"The sum of your rolls is \" + parseInt(firstRoll + secondRoll);\n\n}", "title": "" } ]
[ { "docid": "035d574912de50e7b74139f78586d6d5", "score": "0.80339795", "text": "function twoDice() {\n var first = Math.floor(Math.random() * (5)) + 1;\n var second = Math.floor(Math.random() * (5)) + 1;\n return first + second;\n}", "title": "" }, { "docid": "2f1b569ab6f0d489d0bd4450fa319137", "score": "0.79685193", "text": "function rollTwoDice() {\n\trollDice();\n\trollDice();\n}", "title": "" }, { "docid": "a911474278581f6a1b2dc8cb308c4a0d", "score": "0.78897667", "text": "function twoDice() {\nvar diceOne = Math.floor(Math.random() * (6) + 1);\n\nvar diceTwo = Math.floor(Math.random() * (6) + 1);\n console.log(\"diceTwo = \" + diceTwo + \" diceOne = \" + diceOne + \" is: \" +(parseInt(diceTwo + diceOne )));\n\nreturn diceOne + diceTwo;\n}", "title": "" }, { "docid": "ed46732a668b7885b4a75bbed9d314d9", "score": "0.7507185", "text": "function calSumOFDiceNUmber()\n{\n return number1+number2;\n}", "title": "" }, { "docid": "fc3a716d5fcf1a44f8d2d8ffbe8db6af", "score": "0.733832", "text": "function rollDice () {\n return (Math.random() % 2)\n}", "title": "" }, { "docid": "a5274d2160f0eddc2ee7d442dfafb715", "score": "0.7285339", "text": "function rollDice() {\n var die1 = 0;\n var die2 = 0;\n die1 = Math.floor(Math.random() * 6) + 1;\n die2 = Math.floor(Math.random() * 6) + 1;\n return die1 + die2;\n}", "title": "" }, { "docid": "5d1c2aea5bf8442286e1104fdb3374f7", "score": "0.71799105", "text": "rollDice() {\n\t\treturn Math.floor(Math.random() * 2);\n\t}", "title": "" }, { "docid": "54b699bbdd96bf7bcc32da626039373d", "score": "0.6894147", "text": "function roll_dice(){\n var dice1=Math.floor(Math.random()*5);\n var dice2=Math.floor(Math.random()*5);\n\n\n return {\n first_roll : dice1,\n second_roll : dice2,\n total: dice1+dice2,\n };\n}", "title": "" }, { "docid": "7b9e7a7c6f6aa5245a44e695ed1133d1", "score": "0.67948806", "text": "function rollDice() {\r\n return Math.floor(1 + Math.random() * 6);\r\n}", "title": "" }, { "docid": "50202dbd768d14c13cd68cd1f8308e0e", "score": "0.6768215", "text": "function rollDice () {\r\n const sides = 6;\r\n return Math.floor(Math.random() * sides) + 1;\r\n}", "title": "" }, { "docid": "d969894a6c0ed9120f8cea61d89133b7", "score": "0.67445546", "text": "function rollDice () {\n const sides = 6;\n return Math.floor(Math.random() * sides) + 1;\n}", "title": "" }, { "docid": "979f58957c653f630c45aac8385a8fe4", "score": "0.6743902", "text": "function rollDice() {\n const sides = 6;\n return Math.floor(Math.random() * sides) + 1;\n}", "title": "" }, { "docid": "7c87f269b311b48d18c3b36e504368ed", "score": "0.66599", "text": "function rollDice(dice1, dice2) {\r\n setTitle(dice1, dice2);\r\n setDice(dice1, dice2);\r\n}", "title": "" }, { "docid": "884d92036afcbeebe7dce36c48329fac", "score": "0.66516227", "text": "function generateDiceSide()\n{\n return Math.floor((Math.random() * 6) + 1);\n}", "title": "" }, { "docid": "ba6996b175733ab92490ad0e55784b75", "score": "0.6650498", "text": "function roll2() {\n let randNum = Math.floor((Math.random() * 6) + 1);\n return randNum;\n}", "title": "" }, { "docid": "71d289010aee4e94dbedfad3fa77922d", "score": "0.66096663", "text": "function rollDice() {\n\tvar diceNumber = Math.floor(Math.random() * 6) + 1;\n\treturn diceNumber;\n}", "title": "" }, { "docid": "609902732c46e8e30a4decfc8039c048", "score": "0.6587753", "text": "function getDiceTotal(totalDice, no) {\n return totalDice + no;\n} // work out total value", "title": "" }, { "docid": "1021a91e0a96892f358781babc3a22b9", "score": "0.6577463", "text": "function rollDice(){\n return Math.floor(Math.random() * 6 + 1);\n}", "title": "" }, { "docid": "3e5a5ac12f1a7a7d751b52f202e55f28", "score": "0.6562095", "text": "function diceRoll() {\n return Math.floor(Math.random() * (6 - 1) + 1) + 1;\n }", "title": "" }, { "docid": "f5ed305b6d65c68d2c4d7fc1ef082d00", "score": "0.6556479", "text": "function generateDieRolls() {\n let num1 = Math.floor(Math.random() * 6) + 1;\n let num2 = Math.floor(Math.random() * 6) + 1;\n return [num1, num2];\n}", "title": "" }, { "docid": "7452fbddeb6cc305d7044404fcd610c3", "score": "0.6533059", "text": "function rollDice() {\n var dice = Math.floor((Math.random() * 6) + 1);\n //var dice = 3;\n return dice;\n\n }", "title": "" }, { "docid": "b4ec965511c2d1e3b80380b23c7f7d5f", "score": "0.65307647", "text": "function rollDice(dice) {\n var total = 0;\n for (var i = 0, len = dice.length; i < len; i++) {\n total += Math.ceil(Math.random() * dice[i]);\n }\n return total;\n}", "title": "" }, { "docid": "6726e1ec37ccca6dc1fab23ab9297058", "score": "0.65277535", "text": "function dice(n, sides){\n\tvar agg = 0\n\twhile(n){\n\t\tagg += Math.random() * sides\n\t\t--n\n\t}\n\treturn agg\n}", "title": "" }, { "docid": "777d723ccddfe3a475a808a2d70e1089", "score": "0.6525714", "text": "function rollDice() {\n //TBD: Set the game state\n return Math.floor(Math.random()*6)\n}", "title": "" }, { "docid": "06b1727ef2f11525a8c6d2ef354b37a4", "score": "0.65042025", "text": "function rollDice() {\n for (let i = 0; i < flip; i++) {\n dice1 = Math.floor(Math.random() * 6) + 1;\n dice2 = Math.floor(Math.random() * 6) + 1;\n\n console.log(\"DiceRoll-\" + i + \": \" + dice1 + \" & \" + dice2);\n }\n}", "title": "" }, { "docid": "1df28af2d2e8cb0f37da67bdcab1bc01", "score": "0.6500332", "text": "function rollDie6(numSides = 6){\r\n return Math.floor(Math.random()*numSides) + 1;\r\n}", "title": "" }, { "docid": "b55cdeb84d7abc067cde86fbcb736da1", "score": "0.64338326", "text": "function Dice() {\n this.roll = function() {\n return Math.floor((Math.random()*6)+1);\n }\n\n this.testDice = function(times) {\n var rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n for(var i = 0; i < 100; i++)\n {\n var result = this.roll();\n rolls[result-1]++;\n }\n console.log(\"======> Dice result: \" + rolls);\n }\n}", "title": "" }, { "docid": "89f6e8acc05694c3a5966fae9575fd90", "score": "0.643225", "text": "function twentySideDie() {\n var dice = Math.floor(Math.random() * (20) + 1);\n return dice\n}", "title": "" }, { "docid": "a4a28cb28989a25211820f0ed0b5fa5e", "score": "0.64301467", "text": "function rollDice(){\r\n //set dice value to random number between 1 and 6\r\n diceValue = Math.floor(Math.random()* 6 + 1);\r\n //return value\r\n return diceValue;\r\n}", "title": "" }, { "docid": "5fa83cf792f818cf61b8c8ff3f06ec7a", "score": "0.6375843", "text": "function rollDice (args) {\n let numberOfDiceRolls = [];\n function diceLimit(min, max) {\n return Math.floor(Math.random() * (max - min) + min);\n }\n\n function calcRolls (number) {\n for (var step = 0; step < number; step++) {\n numberOfDiceRolls.push(diceLimit(1, 7));\n }\n return numberOfDiceRolls.join(', ');\n }\n return calcRolls(args);\n}", "title": "" }, { "docid": "0591f8e529b0a48f36c1c98a6d856049", "score": "0.6373893", "text": "rollDice(){\r\n\t\tlet number = Math.floor(Math.random() * 6) + 1\r\n\t\tconsole.log(`El dado cayó en ${number}`)\r\n\t\treturn number\r\n\t}", "title": "" }, { "docid": "1d9bb00950f369735b41600817ef40cb", "score": "0.63684446", "text": "function rollDice() {\n var diceRoll = [\" \", \" \"];\n var outCome = [0, 0];\n for (var roll = 0; roll < 2; roll++) {\n outCome[roll] = Math.floor((Math.random() * 6) + 1);\n switch (outCome[roll]) {\n case (outCome[roll], 1, 1):\n diceRoll[roll] = \"1\",\n dieOne++;\n break;\n case (outCome[roll], 2, 2):\n diceRoll[roll] = \"2\";\n dieTwo++;\n break;\n case (outCome[roll], 3, 3):\n diceRoll[roll] = \"3\";\n dieThree++;\n break;\n case (outCome[roll], 4, 4):\n diceRoll[roll] = \"4\";\n dieFour++;\n break;\n case (outCome[roll], 5, 5):\n diceRoll[roll] = \"5\";\n dieFive++;\n break;\n case (outCome[roll], 6, 6):\n diceRoll[roll] = \"6\";\n dieSix++;\n break;\n }\n }\n return diceRoll;\n }", "title": "" }, { "docid": "fd7b3c9a8f44ad8e4ebb18018a6570f7", "score": "0.6339423", "text": "function rollDice(numSides) {\r\n return Math.floor(Math.random() * numSides) + 1;\r\n}", "title": "" }, { "docid": "fe9921ac9cfe6af53ff66e53c6de8bbb", "score": "0.6338006", "text": "function rollDice() {\n\n var roll1 = rollDie(\"d1\");\n var roll2 = rollDie(\"d2\");\n var total = roll1 + roll2;\n\n console.log(\"Total: \" + total);\n\n checkRoll(total); \n if (turn == 1){\n turn = 2;\n $(\"#triang1\").css(\"visibility\", \"hidden\");\n $(\"#triang2\").css(\"visibility\", \"visible\");\n } else {\n turn = 1;\n $(\"#triang1\").css(\"visibility\", \"visible\");\n $(\"#triang2\").css(\"visibility\", \"hidden\");\n }\n}", "title": "" }, { "docid": "794f542abf7264fea81d79b6a2eae955", "score": "0.63005364", "text": "function rollDice () {\n const sides = 20;\n return Math.floor(Math.random() * sides) + 1;\n}", "title": "" }, { "docid": "794f542abf7264fea81d79b6a2eae955", "score": "0.63005364", "text": "function rollDice () {\n const sides = 20;\n return Math.floor(Math.random() * sides) + 1;\n}", "title": "" }, { "docid": "794f542abf7264fea81d79b6a2eae955", "score": "0.63005364", "text": "function rollDice () {\n const sides = 20;\n return Math.floor(Math.random() * sides) + 1;\n}", "title": "" }, { "docid": "794f542abf7264fea81d79b6a2eae955", "score": "0.63005364", "text": "function rollDice () {\n const sides = 20;\n return Math.floor(Math.random() * sides) + 1;\n}", "title": "" }, { "docid": "006c78e6d30d69f50519680714317186", "score": "0.6295366", "text": "function roll_dice() {\n return Math.floor(Math.random() * 8) + 1\n\n}", "title": "" }, { "docid": "5f75ccbcc0f678e6bfe813ce68b943f4", "score": "0.6293317", "text": "function getDiceNumber()\n{\n return Math.floor(Math.random() * 6) + 1;\n \n}", "title": "" }, { "docid": "c15919885197a63523bb326863def880", "score": "0.6286477", "text": "function displayDice(diceNumber1, diceNumber2) {\n const dice1 = document.querySelector('#dice-1').setAttribute(\"src\", \"./assets/img/dice-\" + diceNumber1 + '.png');\n const dice2 = document.querySelector('#dice-2').setAttribute(\"src\", \"./assets/img/dice-\" + diceNumber2 + '.png');;\n \n // if snake eyes are rolled, display box shadow\n if (diceNumber1 === diceNumber2) {\n document.querySelector('#dice-1').style.boxShadow = \"0 0 25px blue\"\n document.querySelector('#dice-2').style.boxShadow = \"0 0 25px blue\"\n } else {\n document.querySelector('#dice-1').style.boxShadow = \"none\"\n document.querySelector('#dice-2').style.boxShadow = \"none\"\n }\n\n // parse string to add up as integers\n let totalNumber1 = parseInt(diceNumber1, 10);\n let totalNumber2 = parseInt(diceNumber2, 10);\n\n // total of dice\n diceTotal.innerHTML = totalNumber1 + totalNumber2;\n\n // roll history function\n rollHistory(totalNumber1, totalNumber2);\n}", "title": "" }, { "docid": "baeebb6409a69d66e7edc28123bf7d9a", "score": "0.62844014", "text": "function dice(){\r\n let diceRoll = Math.random() * 5 + 1\r\n let diceRollRound = Math.round(diceRoll)\r\n return diceRollRound\r\n}", "title": "" }, { "docid": "f842570b37a054e7f7dad66d86d4076c", "score": "0.62698907", "text": "function rollDice(numSides) {\n return Math.floor(Math.random() * numSides) + 1;\n}", "title": "" }, { "docid": "7108c0d9600375c4f89ed5eca91bd280", "score": "0.62691796", "text": "function rollMultiple(numberOfSides, numberOfDice) {\n var counts = [];\n var i;\n for (i = 0; i < numberOfSides; i++) {\n counts[i] = 0;\n\n }\n var roll;\n for (i = 0; i < numberOfDice; i++) {\n roll = rollSingle(numberOfSides);\n counts[roll - 1]++;\n }\n return counts;\n}", "title": "" }, { "docid": "87bace16e9b0512a76b8ba715da08c14", "score": "0.6268153", "text": "function rollDie(numSides = 6) {\n // old way\n // if (numSides === undefined) {\n // numSides = 6\n // }\n return Math.floor(Math.random() * numSides) + 1;\n}", "title": "" }, { "docid": "8aac067d543b3f8c1a10beaf765bbe21", "score": "0.6265638", "text": "function twelveSideDie() {\n var dice = Math.floor(Math.random() * (12) + 1);\n return dice\n}", "title": "" }, { "docid": "cff25cc99864f8fbc80a41b2cc935b92", "score": "0.62640214", "text": "function rollingDice(sides){\n let randomNumber = Math.floor(Math.random() * sides) + 1;\n return randomNumber;\n}", "title": "" }, { "docid": "b8c82bc0f2a56e0d516405d15fc57589", "score": "0.62589175", "text": "function rollDice() {\n //make the hold button visible\n document.getElementById(\"btnHold\").style.visibility = \"visible\";\n //genrate two random numbers\n var rNumOne = Math.floor(Math.random() * 6) + 1;\n var rNumTwo = Math.floor(Math.random() * 6) + 1;\n\n //asign the dices\n dice1 = document.getElementById(\"diceOne\").innerHTML = rNumOne;\n dice2 = document.getElementById(\"diceTwo\").innerHTML = rNumTwo;\n diceTotal = rNumOne + rNumTwo; //dice total\n //reset the dice color\n document.getElementById(\"diceOne\").style.border = \"2px solid #33CCCC\";\n document.getElementById(\"diceTwo\").style.border = \"2px solid #33CCCC\";\n diceColor(dice1, dice2, diceTotal);\n //the display box, used here to display the dice total.\n document.getElementById(\"result\").innerHTML = \"You have rolled (\"\n + diceTotal + \")\";\n\n //player one turn\n if (player1Turn) {\n document.getElementById(\"btnRoll\").innerHTML = \"Player One Turn\";\n playerColor(player1Turn);\n if (dice1 === 1 || dice2 === 1 || diceTotal === 2) {\n player1Turn = false;\n player1Total = 0; //reset the total\n document.getElementById(\"player1Total\").innerHTML = player1Total;\n document.getElementById(\"btnRoll\").innerHTML = \"Player Two Turn\";\n playerColor(player1Turn);\n //check if both dices have the number 1.\n if (diceTotal === 2) { \n player1Points = 0;\n document.getElementById(\"pointsPlayer1\")\n .innerHTML = player1Points;\n }\n } else {\n player1Total += diceTotal;\n document.getElementById(\"player1Total\").innerHTML = player1Total;\n }\n } else { //player two turn\n if (dice1 === 1 || dice2 === 1 || diceTotal === 2) {\n player1Turn = true;\n player2Total = 0; //reset the total\n document.getElementById(\"btnRoll\").innerHTML = \"Player One Turn\";\n document.getElementById(\"player2Total\").innerHTML = player2Total;\n playerColor(player1Turn);\n //check if both dices have the number 1.\n if (diceTotal === 2) { \n player2Points = 0;\n document.getElementById(\"pointsPlayer2\")\n .innerHTML = player2Points;\n }\n } else {\n player2Total += diceTotal;\n document.getElementById(\"player2Total\").innerHTML = player2Total;\n }\n }\n\n}", "title": "" }, { "docid": "3dcecbc248c522844d8ab1ea90d33d22", "score": "0.62570745", "text": "function rollDice(numberOfSides){\n let randomNumber = Math.floor((Math.random() * (numberOfSides) + 1));\n return randomNumber\n}", "title": "" }, { "docid": "5eaa465becc1ebbfdb96551ae2d0ad83", "score": "0.62373704", "text": "function Dice(numberOfSides) {\n this.roll = function(){\n this.lastRoll = Math.floor(Math.random()*numberOfSides);\n return this.lastRoll;\n }\n}", "title": "" }, { "docid": "eb1b74bbc34ec04a947caa0f4fccc9bd", "score": "0.6213903", "text": "function rollDice(numSides) {\n\treturn Math.floor(Math.random() * numSides) + 1;\n}", "title": "" }, { "docid": "ab3f84d7a7e70e0572a126f56adcd4a1", "score": "0.62055564", "text": "diceRoll() {\r\n return Math.floor(Math.random() * 20) + 1\r\n }", "title": "" }, { "docid": "3b1ab00628be486d815763bd19a9a1bc", "score": "0.6182084", "text": "function turnCount() { \n return turncount % 2;\n}", "title": "" }, { "docid": "933af9f9ea46b9350a314248b376291f", "score": "0.6164996", "text": "function dice(sideCount, dieCount) {\n var distribution = die(sideCount);\n return function (engine) {\n var result = [];\n for (var i = 0; i < dieCount; ++i) {\n result.push(distribution(engine));\n }\n return result;\n };\n }", "title": "" }, { "docid": "7d7761fb63203c6dd0a821155a0838e5", "score": "0.6161364", "text": "function diceGame(arr) {\n\tlet total = 0;\n\tfor(let [R1, R2] of arr) {\n\t\tif (R1 === R2) {\n\t\t\ttotal = 0;\n\t\t\tbreak;\n\t\t}\n\t\ttotal += (R1 + R2);\n\t}\n\treturn total;\n}", "title": "" }, { "docid": "bcba55ee6dce5450edca12401b6d58c3", "score": "0.6157837", "text": "function score( dice ) {\n var six=0, five=0, four=0, three=0, too=0, one=0;\n var i = 0;\n while (i < 5) {\n if (dice[i] == 6) { six++; }\n if (dice[i] == 5) { five++; }\n if (dice[i] == 4) { four++; }\n if (dice[i] == 3) { three++; }\n if (dice[i] == 2) { too++; }\n if (dice[i] == 1) { one++; }\n i++;\n }\n var r = 0;\n if (one > 2) { r += 1000; one -= 3;}\n if (six > 2) { r += 600; }\n if (five > 2) { r += 500; five -= 3;}\n if (four > 2) { r += 400; }\n if (three > 2) { r += 300; }\n if (too > 2) { r += 200; }\n r += one * 100;\n r += five * 50;\n return r;\n}", "title": "" }, { "docid": "d3fdf239ec50c762f04f832289ad5d8b", "score": "0.6152928", "text": "function diceResult(dice1, dice2) {\r\n if (dice1 > dice2) {\r\n return \"🚩 Player 1 wins!\";\r\n } else if (dice1 < dice2) {\r\n return \"Player 2 wins! 🚩\";\r\n } else {\r\n return \"It's a draw!\";\r\n }\r\n}", "title": "" }, { "docid": "0501beeba31913b166ea310b3991e8b5", "score": "0.61163193", "text": "function rollDice2() {\r\n randomNumber2 = Math.floor((Math.random()*6) + 1);\r\n var randomImageSource2 = \"images/dice\" + randomNumber2 + \".png\";\r\n return document.querySelector(\"img.img2\").setAttribute(\"src\", randomImageSource2);\r\n}", "title": "" }, { "docid": "2fcbc920e3a71603fcdce2f3a183cccd", "score": "0.61070746", "text": "function randomDice(sides = 6) {\n var roll = Math.ceil(Math.random() * sides);\n return roll;\n}", "title": "" }, { "docid": "32cf7509ac285e7e939137dc679daa84", "score": "0.60884976", "text": "function rollDice_2(){\n let position=Math.floor(Math.random()*6)+1;\n console.log(\"Player two rolls\", position)\n changePosition_2(player2[2],position);\n}", "title": "" }, { "docid": "5b62849575fab9acacffabe8b63e910f", "score": "0.6065002", "text": "function rollDice(){\n\tvar random1= Math.round(Math.random()*5+1)\n\tvar random2= Math.round(Math.random()*5+1)\n\t// console.log(random1)\n\t// console.log(random2)\n\n\tvar roll1='dice-'+random1\n\tvar roll2='dice-'+random2\n\t// console.log(roll1)\n\t// console.log(roll2)\n\n\tfirstDie.className=roll1\n\tsecondDie.className=roll2\n}", "title": "" }, { "docid": "8e24e7d5768d64826f504efaf432ee11", "score": "0.6058953", "text": "function rollTheDice () {\n let numberRolled = Math.ceil(Math.random() *6 ); //not accesible outside of this function\n\n}", "title": "" }, { "docid": "177f97346fd8521759cdda1006d0fb03", "score": "0.6058835", "text": "function dado (){ // entrega el resultado de 2 dados y los suma las caras que resultaron\r\n //cara 1 //cara 2\r\nlet n = Math.floor((Math.random() * 6)) + Math.floor((Math.random() * 6)) ;\r\nreturn n;}", "title": "" }, { "docid": "127975fd35cec8a0f6c3af06ace8edff", "score": "0.6048522", "text": "function rollTheDice() {\n let curClick = new Date().getTime();\n if (curClick - lastClicked < 1000) return;\n lastClicked = curClick;\n\n this.blur(); // Unfocus the button\n clearTimeout(visibleTimeout);\n clearTimeout(blurTimeout);\n\n let [roll1, roll2] = generateDieRolls();\n setDiceImages(roll1, roll2);\n displayWinner(roll1, roll2);\n}", "title": "" }, { "docid": "aa9520129aa5966c11a7d21846a29472", "score": "0.604734", "text": "function rollDice() {\r\n\r\n var randomNumber1 = Math.floor(Math.random() * 6) + 1; //random 1-6\r\n var randomDiceImage1 = \"dice\" + randomNumber1 + \".png\"; //dice1.png - dice6.png\r\n var randomImageSource1 = \"images/\" + randomDiceImage1; //images/dice1.png - images/dice6.png\r\n var diceP1 = document.querySelectorAll(\"img\")[0];\r\n diceP1.setAttribute(\"src\", randomImageSource1); //change dice image player1\r\n\r\n var randomNumber2 = Math.floor(Math.random() * 6) + 1; //random 1-6\r\n var randomDiceImage2 = \"dice\" + randomNumber2 + \".png\"; //dice1.png - dice6.png\r\n var randomImageSource2 = \"images/\" + randomDiceImage2; //images/dice1.png - images/dice6.png\r\n var diceP2 = document.querySelectorAll(\"img\")[1];\r\n diceP2.setAttribute(\"src\", randomImageSource2); //change dice image player2\r\n\r\n //if each player wins\r\n\r\n if (randomNumber1 > randomNumber2) {\r\n document.querySelector(\".dice-1 p\").innerHTML = \"PLAYER ONE WINS! 😄\";\r\n document.querySelector(\".dice-2 p\").innerHTML = \"PLAYER TWO LOSES 😞\";\r\n } else if (randomNumber2 > randomNumber1) {\r\n document.querySelector(\".dice-2 p\").innerHTML = \"PLAYER TWO WINS! 😄\";\r\n document.querySelector(\".dice-1 p\").innerHTML = \"PLAYER ONE LOSES 😞\";\r\n } else {\r\n document.querySelector(\".dice-2 p\").innerHTML = \"IT'S A DRAW 😑\";\r\n document.querySelector(\".dice-1 p\").innerHTML = \"IT'S A DRAW 😒\";\r\n }\r\n\r\n}", "title": "" }, { "docid": "a1d50099455b209561a5d7dcb0310383", "score": "0.6044159", "text": "static dice(boardactionresult) {\n // Casualty dice are also doubled up, and also both rolls appear when an apoc is used (so the last one is the valid one)\n var dice = super.dice(boardactionresult);\n dice = dice.slice(0, dice.length / 2);\n return [dice[dice.length - 1]];\n }", "title": "" }, { "docid": "bda6d7a55daa941c88c3288f21d4d457", "score": "0.6016804", "text": "function DiceRoll() {\n\tlet random = Math.floor(Math.random() * 6 + 1);\n\tconsole.log(random);\n}", "title": "" }, { "docid": "64a66174e4783d163e540b51d6b7661d", "score": "0.5998469", "text": "function rollDie() {\n var die = Math.floor(Math.random() * (6) + 1);\n return die\n}", "title": "" }, { "docid": "767671ae4589818ee11ba38b9f82f40b", "score": "0.59904337", "text": "function moveDice() {\n num1 = Math.floor((Math.random() * 6) + 1);\n num2 = Math.floor((Math.random() * 6) + 1);\n // console.log(num1, num2);\n document.getElementById(\"diceBottom\").innerHTML = `<img class=\"diceImg\" src=\"images/dice${num1}.png\"><img class=\"diceImg\" src=\"images/dice${num2}.png\">`;\n return num1 + num2\n}", "title": "" }, { "docid": "6572b5c9ebfb0edfb87bcfa8c887de62", "score": "0.5980167", "text": "function rollDice() {\n dice1 = Math.ceil(Math.random()*6);\n dice2 = Math.ceil(Math.random()*6);\n document.getElementById('dice1-text').innerHTML = dice1;\n document.getElementById('dice2-text').innerHTML = dice2;\n\n if (dice1 + dice2 == 7) {\n //YOU WIN $4\n money+=4;\n console.log(\"you win $4, now you have $\" + money)\n updateMoney();\n } else {\n //YOU LOSE $1\n money--;\n console.log(\"you loss $1, now you have $\" + money)\n updateMoney();\n };\n\n if (money == 0 ) {\n console.log(\"--You're OUT OF money!--\")\n //highest amount won is the max value of the wonAmounts array\n highestAmountWon = Math.max.apply( null, wonAmounts );\n console.log(\"highest amount: \"+ highestAmountWon)\n\n //the roll-count of the highest number is the index + 1 of the highestAmountWon\n rollCountAtHighest = wonAmounts.indexOf(highestAmountWon) + 1;\n console.log(\"highest amount won at round: \"+ rollCountAtHighest )\n printResults();\n }\n}", "title": "" }, { "docid": "d3482f23d3425a0d48b15982d934acd2", "score": "0.5961462", "text": "function rollImage(dice, roll, roll2){\n // d6 roll\n if(dice === 'd6'){\n const d6Roll = document.querySelector('#d6-roll');\n const d6path = './images/d6';\n\n switch(roll){\n case 1: d6Roll.src = `${d6path}/1.png`;\n break;\n\n case 2: d6Roll.src = `${d6path}/2.png`;\n break;\n\n case 3: d6Roll.src = `${d6path}/3.png`;\n break;\n\n case 4: d6Roll.src = `${d6path}/4.png`;\n break;\n\n case 5: d6Roll.src = `${d6path}/5.png`;\n break;\n\n case 6: d6Roll.src = `${d6path}/6.png`;\n break;\n\n default: d6Roll.src = './images/start/d6.png'\n }\n }\n\n // double d6 roll\n if(dice === 'double d6'){\n const double6Roll1 = document.querySelector('#double-d6-roll-1');\n const double6Roll2 = document.querySelector('#double-d6-roll-2');\n const double6path = './images/d6';\n \n switch(roll){\n case 1: double6Roll1.src = `${double6path}/1.png`;\n break;\n \n case 2: double6Roll1.src = `${double6path}/2.png`;\n break;\n \n case 3: double6Roll1.src = `${double6path}/3.png`;\n break;\n \n case 4: double6Roll1.src = `${double6path}/4.png`;\n break;\n \n case 5: double6Roll1.src = `${double6path}/5.png`;\n break;\n \n case 6: double6Roll1.src = `${double6path}/6.png`;\n break;\n \n default: double6Roll1.src = './images/start/d6.png'\n }\n \n switch(roll2){\n case 1: double6Roll2.src = `${double6path}/1.png`;\n break;\n \n case 2: double6Roll2.src = `${double6path}/2.png`;\n break;\n \n case 3: double6Roll2.src = `${double6path}/3.png`;\n break;\n \n case 4: double6Roll2.src = `${double6path}/4.png`;\n break;\n \n case 5: double6Roll2.src = `${double6path}/5.png`;\n break;\n \n case 6: double6Roll2.src = `${double6path}/6.png`;\n break;\n \n default: double6Roll1.src = './images/start/d6.png'\n double6Roll1.src = './images/start/d6.png';\n }\n }\n\n // d12 roll\n if(dice === 'd12'){\n const d12Roll = document.querySelector('#d12-roll');\n const d12path = './images/numbers';\n\n switch(roll){\n case 1: d12Roll.src = `${d12path}/1.png`;\n break;\n\n case 2: d12Roll.src = `${d12path}/2.png`;\n break;\n\n case 3: d12Roll.src = `${d12path}/3.png`;\n break;\n\n case 4: d12Roll.src = `${d12path}/4.png`;\n break;\n\n case 5: d12Roll.src = `${d12path}/5.png`;\n break;\n\n case 6: d12Roll.src = `${d12path}/6.png`;\n break;\n\n case 7: d12Roll.src = `${d12path}/7.png`;\n break;\n\n case 8: d12Roll.src = `${d12path}/8.png`;\n break;\n\n case 9: d12Roll.src = `${d12path}/9.png`;\n break;\n\n case 10: d12Roll.src = `${d12path}/10.png`;\n break;\n\n case 11: d12Roll.src = `${d12path}/11.png`;\n break;\n\n case 12: d12Roll.src = `${d12path}/12.png`;\n break;\n\n default: d12Roll.src = './images/start/d12.png'\n }\n }\n\n // d20 roll\n if(dice === 'd20'){\n const d20Roll = document.querySelector('#d20-roll');\n const d20path = './images/numbers';\n\n switch(roll){\n case 1: d20Roll.src = `${d20path}/1.png`;\n break;\n\n case 2: d20Roll.src = `${d20path}/2.png`;\n break;\n\n case 3: d20Roll.src = `${d20path}/3.png`;\n break;\n\n case 4: d20Roll.src = `${d20path}/4.png`;\n break;\n\n case 5: d20Roll.src = `${d20path}/5.png`;\n break;\n\n case 6: d20Roll.src = `${d20path}/6.png`;\n break;\n\n case 7: d20Roll.src = `${d20path}/7.png`;\n break;\n\n case 8: d20Roll.src = `${d20path}/8.png`;\n break;\n\n case 9: d20Roll.src = `${d20path}/9.png`;\n break;\n\n case 10: d20Roll.src = `${d20path}/10.png`;\n break;\n\n case 11: d20Roll.src = `${d20path}/11.png`;\n break;\n\n case 12: d20Roll.src = `${d20path}/12.png`;\n break;\n\n case 13: d20Roll.src = `${d20path}/13.png`;\n break;\n\n case 14: d20Roll.src = `${d20path}/14.png`;\n break;\n\n case 15: d20Roll.src = `${d20path}/15.png`;\n break;\n\n case 16: d20Roll.src = `${d20path}/16.png`;\n break;\n\n case 17: d20Roll.src = `${d20path}/17.png`;\n break;\n\n case 18: d20Roll.src = `${d20path}/18.png`;\n break;\n\n case 19: d20Roll.src = `${d20path}/19.png`;\n break;\n\n case 20: d20Roll.src = `${d20path}/20.png`;\n break;\n\n default: d20Roll.src = './images/start/d20.png'\n }\n }\n\n}", "title": "" }, { "docid": "b646fd20281010a3c68d0761c013aecc", "score": "0.59527504", "text": "function rollD6(){\n let result = Math.floor(Math.random() * 6) + 1;\n sixes.push(result);\n\n insertText('#d6', sixes);\n\n rollImageShort('d6', result);\n}", "title": "" }, { "docid": "31b77da30dea66b0212496c1af923027", "score": "0.5951425", "text": "function game(n) {\n let total = 0;\n let val = 0.5;\n for (let i = 1; i <= n; i++){\n total += val;\n val += 1;\n };\n return (total % 2 ? [total*2, 2] : [total]);\n }", "title": "" }, { "docid": "e0048a4dd2ae118af2afada38df97fe8", "score": "0.5940942", "text": "function d6() {\n var roll = Math.floor(Math.random() * 6) + 1;\n\n return roll;\n}", "title": "" }, { "docid": "cd67e9e48eb84a3330978f1b7edcdea1", "score": "0.59396756", "text": "function rollButton_clicked() {\n generateRandom();\n let imagesDice1 = switchImage(randomNumber1);\n let imagesDice2 = switchImage(randomNumber2);\n diceButton1.image.src = imagesDice1; \n diceButton2.image.src = imagesDice2; \n diceLabel1.text = randomNumber1;\n diceLabel2.text = randomNumber2;\n let result = randomNumber1 + randomNumber2;\n console.log(\"While Adding Both Dice: \" ,result);\n }", "title": "" }, { "docid": "6153d24470cbea4fc9fa13e9655f72b6", "score": "0.5921261", "text": "function rollDice(sides) {\n return Math.floor(Math.random()* sides + 1);\n }", "title": "" }, { "docid": "e895e8ab54641def1599aa043be434dd", "score": "0.5911261", "text": "function realDiceRoll (){\n\n clearInterval(interval)\n diceResult = Math.floor(Math.random() * 6) + 1;\n diceDom.src = diceImgs[diceResult];\n addToCurrentScore();\n diceRolling = false;\n\n }", "title": "" }, { "docid": "24cf7d4790e95f23a6f7f4ea63007779", "score": "0.5910136", "text": "function sumOfNumbers2(n) {\n return (n * (n+1))/2\n}", "title": "" }, { "docid": "29f6d4b1616a918f413e13dadb6932d6", "score": "0.5909962", "text": "function sum_odd(){\n var sum = 0;\n for (var i = 7; i <= 19; i++) {\n if (i % 2 === 1) {\n sum += i;\n }\n }\n return sum; \n }", "title": "" }, { "docid": "2af5a66304bd052b8ff7f2a8fa7eb3a7", "score": "0.5909132", "text": "function diceThrow() {\n var roll_value = Math.floor((Math.random() * 6));\n return roll_value;\n }", "title": "" }, { "docid": "63593b7d67bcfd0751539c533288b5b9", "score": "0.59065586", "text": "function roll_dice (dice_size){\n return Math.floor(Math.random() * (dice_size - 1 + 1)) + 1;\n}", "title": "" }, { "docid": "5929d7b5ce3c5dc39712811f9d9afe95", "score": "0.59023446", "text": "function rollAndSum(count, sides) {\n return roll(count, sides).reduce((prev, cur) => prev + cur, 0);\n}", "title": "" }, { "docid": "5a3051046302e1049ce9aa474c306de3", "score": "0.5892922", "text": "function rollDie() {\n const roll = Math.floor(Math.random() * 6) + 1;\n console.log(roll);\n}", "title": "" }, { "docid": "fecdfc433c8152061a5f5615edb8f620", "score": "0.588365", "text": "function rollDice (sides, amount) {\n var total = 0;\n for (var i = 1; i <= amount; i++) {\n total += Math.floor(Math.random() * sides + 1)\n }\n return total;\n}", "title": "" }, { "docid": "d5bb820a393f2b17cf586df45badd22e", "score": "0.58797914", "text": "function diceFn(range){return function(){return this.natural(range);};}", "title": "" }, { "docid": "f28db1ef75ad1347520ccb8cd6fb8eaf", "score": "0.58748823", "text": "function listOfRollsFromDieFunc(numberOfRolls, diceFunction) {\n return numberOfRolls * diceFunction\n\n}", "title": "" }, { "docid": "9de0637608321e3703531ba741be7510", "score": "0.5869825", "text": "function describeDiceSum(sum) {\n return sum;\n}", "title": "" }, { "docid": "d7c2a672ec00b3ab68ce6c234564650e", "score": "0.5869165", "text": "function combineDie(rando){\n return `dice-${rando}`\n}", "title": "" }, { "docid": "0b859d511ec81f2927c44f4915ec3d8b", "score": "0.5861996", "text": "function rollDice(integer) {\n integer = (Math.floor(Math.random()* 6) + 1);\n return \"this is your random roll \" + integer;\n}", "title": "" }, { "docid": "038ffc26ea38f257d562d5f317bc0a90", "score": "0.5845813", "text": "function odd_5000(){\n sum = 0\n for (var i=1; i<=5000; i+=2){\n sum += i\n }\n return sum\n}", "title": "" }, { "docid": "7050f8c4c67916071c2f5db0760ec4f6", "score": "0.5805311", "text": "function roll4add3() {\n const first = rollDice(6);\n const second = rollDice(6);\n const third = rollDice(6);\n const fourth = rollDice(6);\n \n let rolls = [first, second, third, fourth];\n rolls.sort(function(a, b){return b - a});\n\n const total = rolls[0] + rolls[1] + rolls[2];\n return total;\n}", "title": "" }, { "docid": "6b1ce4add4a10511cfc2ef00cde7cf37", "score": "0.58046967", "text": "function rollDice() {\n if (player1Position >= 64 || player2Position >= 64)\n return\n //generate a random number between 1 and 6\n const diceRoll = Math.floor(Math.random() * 6) + 1\n const diceRoll2 = Math.floor(Math.random() * 6) + 1\n //update h2 to tell player who rolled what number\n h3.innerHTML = `Player 1 rolled ${diceRoll} & Player 2 rolled ${diceRoll2}`\n //Add diceRoll number to data-id square that player is on\n player1NewPosition = player1Position += diceRoll\n player2NewPosition = player2Position += diceRoll2\n displayWinner()\n squareToMoveTo = document.querySelector(`[data-id=\"${player1NewPosition}\"]`)\n squareToMoveTo2 = document.querySelector(`[data-id=\"${player2NewPosition}\"]`)\n //add class of player to squareToMoveTo\n addPlayer1ToSquare()\n addPlayer2ToSquare()\n newPositionAfterSnakeOrLadder(newBoard.slice(0,3), ladderAlert)\n newPositionAfterSnakeOrLadder(newBoard.slice(3), snakeAlert)\n console.log(player1NewPosition)\n console.log(player2NewPosition)\n\n }", "title": "" }, { "docid": "a6349b11541cdf7de985d4fccdcab819", "score": "0.57977456", "text": "function play() {\r\n //create a die1 variable and assigns 1-6\r\n var die1 = Math.ceil(Math.random() * 6);\r\n\r\n //create a die2 variable and assigns 1-6\r\n var die2 = Math.ceil(Math.random() * 6);\r\n\r\n\r\n //this adds up the dice values of each one \r\n var sum = die1 + die2\r\n //printing out die1 results\r\n document.getElementById(\"die1Res\").innerHTML = \"Die 1 is: \" + die1;\r\n //printing out die2 results\r\n document.getElementById(\"die2Res\").innerHTML = \"Die 2 is: \" + die2;\r\n //printing out die1 results\r\n document.getElementById(\"sumRes\").innerHTML = \"The sum is: \" + sum;\r\n \r\n //sum of dice not equal to 7 or 11\r\n if (sum == 7 || sum == 11) {\r\n document.getElementById(\"finalRes\").innerHTML = \"Craps you lose!\";\r\n }\r\n //dice 1 is equal to dice2 and they're even\r\n else if (die1 == die2 && die1 % 2 == 0) {\r\n document.getElementById(\"finalRes\").innerHTML = \"DOUBLES - you win\";\r\n }\r\n //neither equal to 7 or 11\r\n else {\r\n document.getElementById(\"finalRes\").innerHTML = \"push, please try again\";\r\n }\r\n \r\n\r\n}", "title": "" }, { "docid": "2d2aed46b14683e719e5d47aeeb4c2ae", "score": "0.57875735", "text": "function dieroll(player) { \n var result = []; //empty array to hold the results of the individual die rolls\n var dice = []; //empty array to hold the unicode dice characters\n for (var i = 0; i < player.dice ; i++){\n result.push( Math.floor(Math.random() * 6));\n } //rolls the dice\n for (var d = 0; d < result.length; d++){\n dice.push(\"&#x268\" + result[d] + \";\");\n } //creates the unicode dice characters\n player.dom.find('.showDice').html(dice); //displays the dice \n var sum = result.reduce (function(a,b) { \n return a + b;\n }); // adds the dice together \n player.dom.find('.currentRoll, .attack, .takeDamage').html( sum + (1*dice.length) ); // I had to add 1*the number of dice because the unicode starts at 0 to represent the number 1.\n}", "title": "" }, { "docid": "398acdfc203d2101082e2c2e61fefd20", "score": "0.57871693", "text": "function diceGame(arr){\n let total = 0;\n for(var i in arr){\n if (arr[i][0] === arr[i][1]){\n return 0;\n }\n total += arr[i][0] + arr[i][1]\n }\n return total;\n}", "title": "" }, { "docid": "92b5a0fec96c0f1a40611e023c41318a", "score": "0.57864934", "text": "function p1DiceRoll() {\n p1Dice.innerHTML = \"\";\n const diceRoll = Math.floor(Math.random() * 6) + 1;\n for (let i = 0; i < diceRoll; i++) {\n p1Dice.innerHTML += `<span class=\"pip\"></span>`;\n }\n player1Score += diceRoll;\n scoreSync();\n diceClass2();\n}", "title": "" }, { "docid": "84f71990d8d0c973c043521c36b6f34a", "score": "0.5781173", "text": "function diceRoll() {\n var randomNumber = Math.floor(Math.random() * 4) + 1;\n return randomNumber;\n}", "title": "" }, { "docid": "04011eacd184b6fa82a29b7ba83fd60b", "score": "0.5778472", "text": "function rollForTurn( ) {// this is the rolling of the dice function\n //(this has not been called yet see line)\n var xArray = [ ] ; // initializing our empty array\n var ranNum = ' ' ;// initializing the ranNum variable\n var minimum = 2 ;//Posible lowest roll for pair of dice\n var maximum = 12 ;//Possible highest roll for pair of dice\n var first = ' ' ; //will hold which player is determined to go first\n var txt1 = ' ' ;// will hold the text that pops up in display message box \n //( who goes first, result of dice roll, etc)\n for ( var i = 0 ; i < 2; i++) {// this lets us roll the dice twice\n // random whole number between 1 and 10\n ranNum = Math.floor(Math.random() * (maximum - minimum) + minimum);\n //figures the randum number and rounds to the nearest whole nuber\n xArray.push(ranNum) ;//pushes randon dice roll value into the array\n }\n\n diceRoll ( ) ; //play dice sound effect for each players turn at rolling\n // the dice and build the string to display each players roll of the dice\n for (i = 0 ; i < xArray.length; i++) {//iterating through the saved dice\n //roll values.\n var result = i + 1; // the two dice rolls(player One and player 2)\n var pOne = xArray[0];//saves player one dice roll\n var pTwo = xArray[1];//saves player two dice roll\n if (pOne == pTwo) {//need to rig so that there is no tie on the roll \n //of the dice...causes bugs( so if there is a tie player one goes\n //first.\n pOne = 1;//if tie value o dice roll then make player 1 go first\n pTwo = 2;//if tie make player 2 second player\n }\n txt1 = \"Player 1 rolled [\" + pOne + \"] <br>\";// first message to write \n //to display box\n writeMsg(txt1);//Write to screen what player 1 rolled\n txt1 = txt1 + 'Player 2 rolled [' + pTwo+ '] <br><br>';//second message\n // to write to display box( player 2's roll)\n setTimeout(function(){writeMsg(txt1);}, 1000); // time delay for \n //dramatic effect before writing to screen what player 2 rolled\n }\n //determine and concatenate string showing which player won the roll\n if(pOne > pTwo) {//conditional statement for if player 1 roll was higher\n first = \"Player 1\";// player 1 goes first\n setTimeout (function( ) {//pause before displaying the next prompt\n txt1 = txt1 + \"Player 1 wins, please choose a square.\";\n } , 2000);\n setTimeout (function() {\n writeMsg(txt1); //write player 1 goes first\n } , 2000);\n } else if (pOne < pTwo) {//if player 2 roll was higher\n first = \"Player 2\";\n setTimeout (function( ) {\n txt1 = txt1 + \"Player 2 wins, please choose a square.\";\n } , 2000);\n setTimeout (function() {\n writeMsg(txt1); //write to screen player2 goes first\n } , 2000);\n }\n //pass which player won the roll(..and therefore plays first position\n return first;\n}", "title": "" }, { "docid": "ae2ff5ae65c176873a6d51a4cc03c95a", "score": "0.5773052", "text": "function buildDice() {\r\n total += 1;\r\n const die = rollDice();\r\n const dieDiv = document.createElement('div');\r\n dieDiv.innerHTML = die;\r\n dieDiv.classList.add(\"dice\", `dice-${die}`)\r\n diceBoard.append(dieDiv);\r\n if (total === 1) {\r\n diceTitle.innerText = \"1 Total Die\";\r\n } else {\r\n diceTitle.innerText = `${total} Total Dice`;\r\n }\r\n\r\n // if die is a hit(5 or 6) create element and add to hits board. Also track total hits\r\n if (die > 4) {\r\n hitsTotal += 1;\r\n const hitsDiv = document.createElement(\"div\");\r\n hitsDiv.innerHTML = die;\r\n hitsDiv.classList.add(\"dice\", `dice-${die}`)\r\n hitsBoard.append(hitsDiv);\r\n\r\n if( hitsTotal === 1) {\r\n hitsTitle.innerText = \"1 Hit\"\r\n } else {\r\n hitsTitle.innerText = `${hitsTotal} Hits`\r\n }\r\n }\r\n return die;\r\n}", "title": "" }, { "docid": "0d3742490931447e98225d034df499e6", "score": "0.5771854", "text": "function throwDice() {\r\n let dice = Math.floor(Math.random() * 12) + 2;\r\n if (dice === 13) {\r\n alert(\"vous avez fait \"+dice-1)\r\n return dice-1 ; \r\n }\r\n alert(\"vous avez fait \"+dice)\r\n return dice ;\r\n}", "title": "" } ]
a363e415dba37ade2dc4b7774b7bd088
Fetch repos when this component mount.
[ { "docid": "010e1b3480dd992a080b268c6f34811b", "score": "0.625213", "text": "componentDidMount() {\n store.getRepos().then((response) => {\n const orderedRepos = orderBy(response.items, ['stargazers', 'forks', 'watchers', 'name'], ['desc', 'desc', 'desc', 'asc'])\n each(orderedRepos, (repo, index) => repo.position = index + 1)\n this.setState({\n repos: orderedRepos,\n loading: !response.ready,\n error: response.error,\n })\n })\n }", "title": "" } ]
[ { "docid": "f79fc905b5ea7a4fd36622db1ebf23e7", "score": "0.7754291", "text": "componentDidMount() {\n console.log('RepoList: didMount')\n // Fetch\n this.fetchRepos()\n }", "title": "" }, { "docid": "d531f914a8aedf07af6529c7148fae3f", "score": "0.6752967", "text": "componentDidMount() {\n this.renderRepos();\n }", "title": "" }, { "docid": "6c14b3af6886c1caabf93300687eb1ca", "score": "0.67266566", "text": "componentDidMount() {\n this.getUserRepos();\n }", "title": "" }, { "docid": "e6c2d35b3851de0060e9392f482584ee", "score": "0.66671616", "text": "function init() {\r\n listRepos();\r\n }", "title": "" }, { "docid": "880859e31bfbf605163949039ecebbfa", "score": "0.6366073", "text": "componentDidMount(){\n this.fetchRepos(this.state.activelanguage)\n }", "title": "" }, { "docid": "a0c8ea69087a4be0ce365e3d5ac208e5", "score": "0.63374484", "text": "ComponentWillMount() {\n console.log('Repolist willMount()')\n }", "title": "" }, { "docid": "c49bacb8a3a653253f6875a35489d6bc", "score": "0.6331649", "text": "async function fetchData() {\n const data = await fetch(`${user.repos_url}?per_page=5&sort=updated`);\n const repos = await data.json();\n \n setRepos(repos);\n }", "title": "" }, { "docid": "c98230e70b3343b315906cc77d195942", "score": "0.63191736", "text": "async loadRepo () {\n const graph = await Itemman._request('getGraph', this.rootKey, 1)\n if (_.isEmpty(graph.getItemsMap())) {\n await this._initRepo()\n }\n this.emit('repo:load', this.serviceItems.visibleItem)\n }", "title": "" }, { "docid": "d11f64f94de7e915a1e6812c155d460f", "score": "0.6292579", "text": "componentDidMount() {\n console.log('Repolist didMount()')\n }", "title": "" }, { "docid": "d5439ab72eee5cab0cd34e6e0f000739", "score": "0.62917846", "text": "static doFetchRepos(repos) {\n console.log(`Repo Link ${repos}`);\n //This is how we define a new method(or function) that will return a Promise. Remember that in Objects or Classes functions are called methods.\n //It has 2 callback functions, resolve and reject. Resolve states that the thing has succeeded and we can pass some data back IF WE WANT TO, its not compulsory\n //Reject tells the promise that something failed, again we should send the error back up the chain so it can be fed back to the user, but its not required.\n return new Promise(\n (resolve, reject) => {\n let options = {\n username: process.env.GIT_USERNAME,\n password: process.env.GIT_PWD\n }\n //This is the restler NPM module that we included above. You can find the docs online for all the various options and methods available inside of it.\n rest.get(repos, options).on('complete', function (result) { //gets the repos - don't need the url again here\n if (result instanceof Error) {\n console.log('Error:', result.message);\n reject(result);\n } else {\n resolve(result);\n }\n });\n }\n )\n }", "title": "" }, { "docid": "ec18f2627144782c53168ffa5f670246", "score": "0.62368965", "text": "function allRepos(){return maybeResolveAsUserPath(this._path()).pushComponents('repos').makeBuilder();}", "title": "" }, { "docid": "717702914ab4386ce1ad6ebddb25fad6", "score": "0.6110871", "text": "function load_orgs() {\n\tif (orgs.length > 0) {\n var org_list = [];\n orgs.forEach(function(item) {\n (item.type === 'repo') ? repos.push(item) : org_list.push(item);\n });\n\n if (org_list.length > 0) {\n org_list.forEach(function(item){\n var t = new Object();\n t.opts = clone(optionsgit);\n t.func = get_repos;\n var org = item.name;\n t.opts = clone(optionsgit);\n t.opts.path = '/' + item.type + 's/' + org + '/repos?per_page=100' + '&access_token=' + gittoken + '&call=get_repos';\n t.source = 'load_orgs';\n throttle(t);\n });\n }\n // start fetching data once the orgs have been enumerated\n monitor = setInterval(function(){\n if ((timer === null) && (timer_db === null) && (repos.length > 0)) {\n fetch_git_data(repos.shift());\n }\n logger.info('Repo Q:', repos.length, 'GitHub Q:',stack.length, 'Cloudant Q:',stack_db.length);\n },2000);\n\t}\n}", "title": "" }, { "docid": "7a9783c6922aba6158e0f3cf2abf5275", "score": "0.6090538", "text": "function loadRepos() {\n fetch(`https://api.github.com/users/${input.value}/repos`)\n .then(res => {\n //in here we can handle different status code errors if needed\n //here we can include errors, which are not going to send back documentation url,\n //since we are not reaching the API at all\n if (!res.ok && res.status !== 404 && res.status >= 500) {\n throw new Error(`${res.status} | ${res.statusText}`);\n }\n return res.json();\n })\n .then(handleErrors)\n .then(processData)\n .then(drawHTML)\n .catch(console.error);\n}", "title": "" }, { "docid": "16350f21e79c0127b454f075775d18b9", "score": "0.60679245", "text": "function defineLazyLoadedRepos() {\r\n repoNames.forEach(function(name) {\r\n Object.defineProperty(service, name, {\r\n configurable: true, // will redefine this property once\r\n get: function() {\r\n // The 1st time the repo is request via this property,\r\n // we ask the repositories for it (which will inject it).\r\n var repo = getRepo(name);\r\n // Rewrite this property to always return this repo;\r\n // no longer redefinable\r\n Object.defineProperty(service, name, {\r\n value: repo,\r\n configurable: false,\r\n enumerable: true\r\n });\r\n return repo;\r\n }\r\n });\r\n });\r\n }", "title": "" }, { "docid": "fb1f84fbd16087a59a06d9480851b4c5", "score": "0.60574883", "text": "async doMapAndRepos() {\n const keys = Object.keys(this.reposConf);\n for (let i = 0; i < keys.length; i++) {\n const clonedRepo = await getGitRepo(\n this.reposConf[keys[i]],\n keys[i],\n this.__dirname\n );\n if (clonedRepo) this.addRepo(clonedRepo);\n }\n }", "title": "" }, { "docid": "da4e3a7b5ab0b435827418f6e60e938b", "score": "0.6015194", "text": "async function loadRepos2() {\n try {\n //we are awaiting the result from the fetch\n //this will unpack the Promise\n const response = await fetch(\n `https://api.github.com/users/${input.value}/repos`\n );\n const json = await response.json();\n handleErrors(json);\n const fullNames = processData(json);\n drawHTML(fullNames);\n } catch (err) {\n console.error;\n }\n}", "title": "" }, { "docid": "7d33b3265d950b5cdccec8ebef09e466", "score": "0.59040546", "text": "async componentDidMount() {\n this.fetchNewReleases().then(this.handleNewReleases);\n this.fetchFeaturedPlaylists().then(this.handleFeaturedPlaylists);\n this.fetchCategories().then(this.handleCategories);\n }", "title": "" }, { "docid": "cfe670bb60adf9309bd03aff7a055ff3", "score": "0.58991295", "text": "getAll() {\n return {\n repos: _data\n };\n }", "title": "" }, { "docid": "987787c03cd883d607d1f0749505e52d", "score": "0.57695484", "text": "function loadAll() {\n var repos = [{\n 'name': 'Angular 1',\n 'url': 'https://github.com/angular/angular.js',\n 'watchers': '3,623',\n 'forks': '16,175',\n }, {\n 'name': 'Angular 2',\n 'url': 'https://github.com/angular/angular',\n 'watchers': '469',\n 'forks': '760',\n }, {\n 'name': 'Angular Material',\n 'url': 'https://github.com/angular/material',\n 'watchers': '727',\n 'forks': '1,241',\n }, {\n 'name': 'Bower Material',\n 'url': 'https://github.com/angular/bower-material',\n 'watchers': '42',\n 'forks': '84',\n }, {\n 'name': 'Material Start',\n 'url': 'https://github.com/angular/material-start',\n 'watchers': '81',\n 'forks': '303',\n }];\n return repos.map(function(repo) {\n repo.value = repo.name.toLowerCase();\n return repo;\n });\n }", "title": "" }, { "docid": "b43079a840efe47dbd947d44e1b63cce", "score": "0.575712", "text": "_fetchGitHubProjects() {\n /////////////////////////////////////\n // get the user from Component's props\n let user = this.props.user;\n /////////////////////////////////////\n // since the `this` inside the callback is not the component anymore,\n // need to close over it\n let component = this;\n /////////////////////////////////////\n jQuery.ajax({\n url: `https://api.github.com/users/${user}/repos?per_page=1000`,\n jsonp: true,\n method: \"GET\",\n dataType: \"json\",\n success: function (res) {\n if (typeof res === \"object\") {\n // res is an Array of objects\n gitHCards._languages = component._myLanguages(res);\n component.setState(\n {\n projectCards: component._sortByDate(res).map(component._constructProjectCards)\n }\n );\n // console.log(res);\n //////////////////////////////////////////////////\n // component.forceUpdate(() => console.log(\"done!\"));\n //////////////////////////////////////////////////\n } else {\n console.log(\"Not a valid response, please contact Sid :)\");\n }\n },\n error: function (e, status) {\n console.log(e, status);\n }\n });\n }", "title": "" }, { "docid": "fde83a39e48c084402b2f757cb122d82", "score": "0.5755281", "text": "componentWillMount() {\n this.loadCompanies();\n }", "title": "" }, { "docid": "d402a56cbae05cfb8d43b1c2e4ad00d2", "score": "0.5750587", "text": "componentDidMount() {\n // run get getProjects\n this.getProject();\n }", "title": "" }, { "docid": "4967a0eef384f2695271ed5730d377c4", "score": "0.573212", "text": "componentDidMount() {\n fetch.getRepoDetails(this.props.user, this.props.repo).then(data => {\n if (data) {\n this.setState({\n name: data.name,\n description: data.description,\n stars: data.stargazers_count,\n subscribers: data.subscribers_count,\n avatar: data.owner[\"avatar_url\"],\n loading: false\n });\n }\n });\n }", "title": "" }, { "docid": "4553cecec81c0d97288c2cf6f0005c91", "score": "0.57226", "text": "componentDidMount() {\n this.props.fetchQuotes();\n this.props.fetchAuthors();\n }", "title": "" }, { "docid": "3720bdbdea21fe1d2b7c493239326811", "score": "0.5710738", "text": "componentDidMount() {\n this.setState({\n isFetching: true\n });\n\n this.getItemCharacteristics();\n this.getItemPackaging();\n this.getItemProperties();\n this.getItemCategory();\n this.getAllPackages();\n this.getAllCategories();\n }", "title": "" }, { "docid": "43a69af91c4875fcde6e7e16dd3cbc17", "score": "0.5707393", "text": "function qhLoadRepos() {\n $http.get($scope.userData.data.repos_url)\n .then(function(data) {\n $scope.repoData = data.data;\n qhSetlang();\n }, function() {\n console.log(\"Repo data Not Found !\");\n });\n }", "title": "" }, { "docid": "baabd9fadb5d22d4da738cdc36402c28", "score": "0.57041955", "text": "componentDidMount() {\n this.getProjects()\n }", "title": "" }, { "docid": "26295b3f2e2cbdb6f0cfa747f88ae6f0", "score": "0.5693478", "text": "componentDidMount() {\n this.getProjects();\n }", "title": "" }, { "docid": "26295b3f2e2cbdb6f0cfa747f88ae6f0", "score": "0.5693478", "text": "componentDidMount() {\n this.getProjects();\n }", "title": "" }, { "docid": "85bbc6d0215318b21c25cebf458680b9", "score": "0.5690088", "text": "componentDidMount() {\n this.getCollections();\n }", "title": "" }, { "docid": "f25f3d7df59a08127e6e0aa3bdf7d9a7", "score": "0.56861424", "text": "fetchOrgs() {\n this.orgsSerivce.find({query: this.defaultQuery})\n .then(message => {\n this.setState({orgs: message.data, orgsLoaded: true});\n })\n .catch(err => {\n printToConsole(err);\n displayErrorMessages('fetch', 'organizers', err, this.updateMessagePanel, 'reload');\n this.setState({orgsLoaded: false});\n });\n }", "title": "" }, { "docid": "f7cce4f52deda8a36697788daa68400b", "score": "0.5648012", "text": "async getTeamRepos () {\n\t\tthis.teamRepos = await this.data.repos.getByQuery(\n\t\t\t{ \n\t\t\t\tteamId: this.team.id,\n\t\t\t\tdeactivated: false\n\t\t\t},\n\t\t\t{ \n\t\t\t\thint: RepoIndexes.byTeamId \n\t\t\t}\n\t\t);\n\t}", "title": "" }, { "docid": "8e8c4ae71b23dbc9f4ea1d2d15983f95", "score": "0.562488", "text": "componentDidMount() {\n\t\tif (!this.isCreator())\n\t\t\tthis.fetchData();\n\n\t\t// Fetch side resources\n\t\tif (!this.props.usertypes.fetched)\n\t\t\tthis.props.dispatch(apiActions.usertypes.all());\n\t\tif (!this.props.fields.fetched)\n\t\t\tthis.props.dispatch(apiActions.fields.all());\n\t}", "title": "" }, { "docid": "0e81fd50968059e9128065d9bc797c5f", "score": "0.5616798", "text": "componentDidMount(){\n const url='https://github-trending-api.now.sh/repositories?since=weekly';\n fetch(url)\n .then(res=>res.json())\n .then(json=>{\n this.setState({\n isLoaded:true,\n repos:json,\n })\n }).catch(err=>console.log(err));\n\n }", "title": "" }, { "docid": "2660c4a5c20b0410b8f49b3f80f9b555", "score": "0.5607403", "text": "componentDidMount() {\n this.props.actions.loadPackageDetailsAction(this.props.packageId);\n this.props.actions.loadPackageDependenciesAction(this.props.packageId);\n this.props.actions.loadPackageParentsAction(this.props.packageId);\n }", "title": "" }, { "docid": "46367fdd87fc7aa65561ac043437a349", "score": "0.5596808", "text": "function getRepos(){\n var repoUrl = 'https://api.github.com/users/' + userReturn.login + '/repos';\n $.ajax(repoUrl).done(function(data){\n reposReturned = data;\n recurseRepos(reposReturned, 0);\n //recurseRepos recursively does an ajax call to the individual\n //repo api endpoint for each repo we retrieved to get more indepth\n //data for those repos\n });\n}", "title": "" }, { "docid": "48f9e1dce259c84af4eebfd7426a93fe", "score": "0.5595602", "text": "async function getReposforDiscipline() {\n // Make a GET request while sending the domain name (aka value) along\n const res = await Axios.get(`/api/domain/fetchDropdownRepos/${value}`, {\n headers: { \"x-auth-token\": localStorage.getItem(\"token\") },\n });\n\n console.log(res);\n // Update the state of the repos (it should reflect in the repo dropdown)\n setRepoOptions(res.data.repos);\n }", "title": "" }, { "docid": "f65f29ac992db18908b9c000209a3c6c", "score": "0.5594378", "text": "componentDidMount() {\n\n //Axios is promise-based async/await library for the readable asynchronous code\n axios\n .get(window.encodeURI(\n `https://jsonplaceholder.typicode.com/users`,\n ),)\n .then(response => {\n const repos = response.data;\n this.setState({\n repos,\n loading: false,\n });\n })\n .catch(error => {\n this.setState({\n error: error,\n loading: false,\n });\n });\n }", "title": "" }, { "docid": "67d47e6783b56098aba1d4ee6f4b0924", "score": "0.55930066", "text": "componentDidMount() {\n super.componentDidMount();\n\n const services = new Map([\n [this.orgsSerivce, this.fetchOrgs],\n [this.venuesService, this.fetchVenues],\n [this.tagsService, this.fetchTags]\n ]);\n\n for (let [service, dataFetcher] of services) {\n service\n .on('created', () => dataFetcher())\n .on('updated', () => dataFetcher())\n .on('patched', () => dataFetcher())\n .on('removed', () => dataFetcher())\n }\n\n this.liveEventsService\n .on('created', () => {\n this.updateMessagePanel({status: 'info', details: 'Event added to live list.'});\n this.fetchLiveEvents();\n })\n .on('removed', () => {\n this.updateMessagePanel({status: 'info', details: 'Event removed from live list.'});\n this.fetchLiveEvents();\n });\n\n this.eventsTagsLookupService\n .on('created', () => {\n this.updateMessagePanel({status: 'info', details: 'Linked tag with event.'});\n })\n .on('removed', () => {\n this.updateMessagePanel({status: 'info', details: 'Removed link between tag and event.'});\n });\n }", "title": "" }, { "docid": "c19ec1c320e1b169c5c2eb08776af79d", "score": "0.55929655", "text": "function postMount() {\n fetchReleases().then(response => {\n $$invalidate('releases', releases = response.data);\n });\n }", "title": "" }, { "docid": "1a4f8eac28c3a7ec988166cff63bf34b", "score": "0.55853647", "text": "async function fetchAllRepos() {\n let data = null;\n\n try {\n const response = await axios(apiUrls.FETCH_ALL);\n\n data = response.data.repositories;\n } catch (error) {\n data = null;\n }\n\n return data;\n}", "title": "" }, { "docid": "dd19e901f8c70f0f9461d55d921723ee", "score": "0.55785966", "text": "componentWillMount(){\n this.props.fetchProjects()\n }", "title": "" }, { "docid": "73b6f5b206d257b14eb05773f6badb88", "score": "0.5578184", "text": "getUserRepos() {\n\t\t$.ajax({\n\t\t\turl: \"https://api.github.com/users/\" + this.state.username + '/repos?per_page=' + this.state.perPage + '&client_id=' + this.props.clientId + '&client_secret=' + this.props.clientSecret + '&sort=created',\n\t\t\tdataType: 'json',\n\t\t\tcache: false,\n\t\t\tsuccess: function (data) {\n\t\t\t\t// console.log(data);\n\t\t\t\tthis.setState({ userRepos: data });\n\t\t\t}.bind(this),\n\t\t\terror: function (xhr, status, error) {\n\t\t\t\tthis.setState({ userData: null });\n\t\t\t}.bind(this)\n\t\t});\n\t}", "title": "" }, { "docid": "f45baf1643fca7f1380396cc6f02eb12", "score": "0.5576304", "text": "listRepos (options, cb) {\n\t\tgetStrategy(options, (error, strategy) => {\n\t\t\tcheckError(error, 969, cb, () => {\n\t\t\t\tstrategy.listRepos(options, cb);\n\t\t\t});\n\t\t});\n\t}", "title": "" }, { "docid": "8898407fae3294a74f52dad7fc0ed98c", "score": "0.556387", "text": "componentDidMount() {\n\t\tthis.fetchImage();\n\t\tthis.fetchWikiPage();\n\t}", "title": "" }, { "docid": "b5082b383fb8bd0430ab75ac0a6662d4", "score": "0.5552948", "text": "componentDidMount() {\n // call to load project data\n this.loadProjectData();\n }", "title": "" }, { "docid": "e84f9e111e527c2879b74d941696d36f", "score": "0.55447966", "text": "componentDidMount() {\n this.context.fetchAllBeans();\n fetch(`${config.API_ENDPOINT}/allflavors`, {\n method: 'GET',\n headers: {\n 'content-type': 'application/json',\n authorization: `Bearer ${TokenService.getAuthToken()}`,\n },\n })\n .then((res) => {\n if (!res.ok) {\n return res.json().then((error) => Promise.reject(error));\n }\n return res.json();\n })\n .then((flavors) => {\n this.setState({\n flavors,\n error: null,\n });\n })\n .catch((error) => {\n console.error(error);\n this.setState({ error });\n });\n }", "title": "" }, { "docid": "2156845270a41318143f1065babd341d", "score": "0.55354995", "text": "componentDidMount() {\n this.loadCatalog();\n \n }", "title": "" }, { "docid": "a26e4128fe654efb956d583edba4624a", "score": "0.55276936", "text": "componentDidMount() {\n fetch('https://api.github.com/users/gaearon/gists')\n .then(response => response.json)\n .then(gists => this.setState({ gists }));\n }", "title": "" }, { "docid": "223422e4af9a1f6f4db0c2ad5b676ae9", "score": "0.55058444", "text": "componentDidMount(){\n\t\tthis.fetchCommunities();\n\t}", "title": "" }, { "docid": "6439ffe374a8dbc345eb653126bc0912", "score": "0.54907066", "text": "componentWillMount() {\n this.fetchImages('cat');\n }", "title": "" }, { "docid": "a21db6e5b681f8a6a5d9922d99c8929c", "score": "0.54882103", "text": "getData({ props, state, card, template, stack, project }) {\n const fetcher = state.list || new Meteor.Images.ListFetcher({ delegate: this });\n fetcher.set({\n selector: props.selector,\n sort: props.sort,\n filter: props.filter,\n });\n this.setState({ list: fetcher });\n }", "title": "" }, { "docid": "1c1dd8ba475d9b2481cd2011e99f28cf", "score": "0.54844207", "text": "componentDidMount() {\n\t\tthis.setState({\n\t\t\tloading: true // activate loading indicator\n\t\t});\n\n\t\t// fetches names for cross-ref links based on display type\n\t\tif (this.props.type === 'people') {\n\t\t\tfetch(this.state.speciesLink)\n\t\t\t\t.then(res => res.json())\n\t\t\t\t.then(data => {\n\t\t\t\t\tthis.setState({\n\t\t\t\t\t\tspeciesName: data.name,\n\t\t\t\t\t\tloading: false // deactivate loading indicator\n\t\t\t\t})\n\t\t\t});\n\t\t}\n\t\tif (this.props.type === 'people' || 'species') {\n\t\t\tfetch(this.state.homeworldLink)\n\t\t\t\t.then(res => res.json())\n\t\t\t\t.then(data => {\n\t\t\t\t\tthis.setState({\n\t\t\t\t\t\thomeworldName: data.name,\n\t\t\t\t\t\tloading: false // deactivate loading indicator\n\t\t\t\t})\n\t\t\t});\n\t\t}\n\t}", "title": "" }, { "docid": "fcfea65d1a8d39254797043103592a39", "score": "0.5474221", "text": "fetchUserRepositories({handle}) {\n return this.getData({path:`/users/${handle}/repos`})\n .then(response => {\n return response.data;\n });\n }", "title": "" }, { "docid": "2921e92d008bd19a342c731e78587956", "score": "0.54711574", "text": "async componentDidMount() {\n const { match } = this.props;\n const repoName = decodeURIComponent(match.params.repository);\n await api\n .get('/detail-repo', {\n params: {\n reponame: repoName,\n },\n })\n .then((res) => {\n this.setState({\n repository: res.data,\n load: false,\n });\n })\n .catch((err) => {\n if (err.response) {\n this.setState({\n error: 'Make sure you searched the correct repository.',\n });\n } else if (err.request) {\n this.setState({ error: 'Make sure you have internet connection.' });\n } else {\n this.setState({\n error:\n 'We could not make this happen. Check for problems or try again later.',\n });\n }\n });\n }", "title": "" }, { "docid": "84996d10b06b04830bd00db386a3016f", "score": "0.5460455", "text": "async goFetchRemoteData() {\n this.setRemoteFetchingStatus(RemoteFetchingStatusEnum.loading);\n const reducer = await Fetcher.fetch(this.getAjaxInjections());\n this.setState(reducer);\n this.setRemoteFetchingStatus(RemoteFetchingStatusEnum.finished);\n }", "title": "" }, { "docid": "56ee220a4f636e48a0d4d45e33f2d40c", "score": "0.54565793", "text": "componentDidMount() {\n const repositories = localStorage.getItem('repositories');\n\n if (repositories) {\n this.setState({ repositories: JSON.parse(repositories) })\n }\n }", "title": "" }, { "docid": "a81d8dd0c188119d3429c82cc116d751", "score": "0.5450523", "text": "componentDidMount() {\n this.updateDimensions();\n this.props.fetchComp();\n this.props.fetchParticipants();\n this.getDefaultShots();\n }", "title": "" }, { "docid": "8ccd6e6b34fe440b164d2b9264178b71", "score": "0.54490167", "text": "fetchRepos(lang){\n this.setState({\n loading: true // ensures the loading animation remains active when we are clicking through languages [at which point, loading had become false]\n })\n\n window.API.fetchPopulaRepos(lang)\n .then((repos) => {\n this.setState({\n loading: false,\n repos,\n })\n })\n }", "title": "" }, { "docid": "2760fd5800d64f00fad295a63e7501a4", "score": "0.54452103", "text": "componentDidMount(){\n this.fetchData();\n this.fetchAll();\n }", "title": "" }, { "docid": "33749d9815dfa03b855ac20dade55eca", "score": "0.54389626", "text": "componentDidMount() {\n this.fetchCompanyData();\n }", "title": "" }, { "docid": "4f90b7a3bf8b895f6e73421aa493170a", "score": "0.54380107", "text": "componentDidMount () {\n // Cargar ciudades.\n this.fetchCities()\n }", "title": "" }, { "docid": "91c45729f9e67c3e71c48add9a978309", "score": "0.5436961", "text": "componentDidMount() {\n this.getModules();\n }", "title": "" }, { "docid": "b909df92726b16743bad33f946ad94da", "score": "0.5434355", "text": "function fetchRepositories(userLogin) {\n const configObj = {\n method: 'GET',\n headers: {\n Accept: 'application/vnd.github.v3+json'\n }\n }\n fetch(`https://api.github.com/users/${userLogin}/repos`)\n .then(resp => resp.json())\n .then(repos => {\n repoList.innerHTML = `<h3>${userLogin} Repositories</h3> `\n repos.forEach(repo => appendRepoLi(createRepoLi(repo['clone_url'])))\n })\n}", "title": "" }, { "docid": "f28ad04ba9542f29d51abefa16d123cd", "score": "0.5433383", "text": "componentWillMount() {\n this.fetchMemes();\n this.fetchCategories();\n }", "title": "" }, { "docid": "2cb3af486bedcc5a9758cacb5cc8cc23", "score": "0.54309404", "text": "componentDidMount() {\n this.props.getUser(this.props.match.params.login);\n//Repos & RepoItem Component & Data - 3:08 You could call the get repos from the repos component, but then you'd have to pass it up twice. That's that's called prop drilling when you keep passing up props through components, because we're actually going to embed the repos here, the repos component. So I'm just going to call it right when we call get user, which is up here in the componentDidMount. 3:42 Make sure to pass this into propTypes. 4:07 Now, we could just stick it right in the user component, but it's with react with any front end framework that's component base. You want to break everything up. So we want to create a new component, lets create a folder called \"repos\" and then two files inside called \"Repos.js\" and \"RepoItem.js\". (4:30 go to Repos.js)\n this.props.getUserRepos(this.props.match.params.login);\n }", "title": "" }, { "docid": "f46b432e0ff226a6238181dae51edf99", "score": "0.5425224", "text": "componentWillMount() {\n\t\tthis.BookFetcher();\n\t}", "title": "" }, { "docid": "d3f41b7159f8d49d8ec0a19505632396", "score": "0.5425162", "text": "async loadCurrentRepo() {\n await this.GotReader.loadCurrentRepo(this.user.managedRepoAuthor)\n }", "title": "" }, { "docid": "032c755db2d50e32a24bd9386b442aa6", "score": "0.54230607", "text": "function getRepos() {\n if (Username.value == \"\") {\n\n reposData.innerHTML = \"<span>Please write Github Username</span>\";\n\n }else {\n\n fetch(`http://api.github.com/users/${Username.value}/repos`)\n .then((response) => response.json())\n .then((repositories) => {\n\n console.log(repositories);\n\n reposData.innerHTML = \"\";\n\n if(repositories && repositories.length > 0){\n \n repositories.forEach((repo) => {\n //Create The Main Div Element\n let repoItem = crElement(\"div\");\n \n //Set Class name to repoItem\n repoItem.classList.add(\"repo-box\");\n \n //Set Repo Name\n repoName(repo, repoItem);\n \n //Create container to repo options\n let optionButtons = crElement(\"div\");\n optionButtons.setAttribute(\"class\",\"option-buttons\");\n appendElement(repoItem, optionButtons);\n \n //Set Repo link to optionButtons div\n repoURL(repo, \"Code\", optionButtons);\n \n //Set Repo Stars\n repoStars(repo, optionButtons);\n \n //Set Repo Forks\n repoForks(repo, optionButtons);\n \n appendElement(reposData, repoItem);\n \n });\n }else{\n reposData.innerHTML = \"Erorr\";\n }\n });\n }\n}", "title": "" }, { "docid": "2f9fc16e3f4bb28b965d4758709cbf38", "score": "0.5422396", "text": "fetchData() {\n\t\thelpers.getUser().listProjects().then(projects => {\n\t\t\tvar projectEntries = projects.entities.map(project => helpers.getUser().getDataTable(project.id).listCells())\n\t\t\tPromise.all(projectEntries).then(projectEntries => {\n\t\t\t\tvar cells = projectEntries.map(cell => cell.entities)\n\t\t\t\tthis.setState({cells: cells, authenticated: true, projects: projects.entities})\n\t\t\t})\n\t\t})\n\t}", "title": "" }, { "docid": "e8cee99e8c5a3af70c14a9ce3c2c5cb1", "score": "0.5417374", "text": "componentWillMount() {\n this.sdkHelper.getFiles(null, (err, res) => {\n this._processItems(err, res);\n });\n }", "title": "" }, { "docid": "3d24c3a89949217f160079a738d37a21", "score": "0.5414404", "text": "componentDidMount() {\n const base = window.location.origin.toString();\n\n this.setState({\n loading: true,\n loadingTitle: \"Loading projects\",\n }, () => {\n fetchProjects(\n base, \"GET\", null\n ).then(result => {\n if (Array.isArray(result)) {\n this.setState(({projects}) => ({\n projects: [\n ...projects,\n ...result.map(item => new Project(item))\n ]\n }));\n } else {\n this.setState({\n alertProps: {\n message: \"Server isn't responding :(\",\n open: true,\n severity: \"error\"\n }\n });\n }\n }).catch(error => {\n this.setState({ alertProps: error });\n }).finally(() => {\n this.setState({\n loading: false,\n serverBase: base\n });\n });\n });\n }", "title": "" }, { "docid": "2bc917f29c58ad93c4cb86b21b879032", "score": "0.54127043", "text": "componentDidMount() {\n console.log(\"Sales:componentDidMount\");\n\n this.fetchSaleData();\n this.fetchCustomerData();\n this.fetchProductData();\n this.fetchStoreData();\n }", "title": "" }, { "docid": "5eae72471fa9fa194a2c00c5a83892bc", "score": "0.54112256", "text": "componentDidMount() {\n $.getJSON('/api/v1/layers')\n .then(response => this.setState({allImages: response}));\n $.getJSON('/api/v1/all/layers')\n .then(response => this.setState({layers: response}));\n $.getJSON('api/v1/maps')\n .then(response => this.setState({maps: response}))\n }", "title": "" }, { "docid": "6adc2cffc076335b9ffb475e730c5fa2", "score": "0.54084116", "text": "componentDidMount() {\n console.log('Hello React World oF DidMount!');\n this.fetchUsers();\n this.fetchCars();\n }", "title": "" }, { "docid": "b35f280bc81a4e53981d6396feaba7db", "score": "0.5407685", "text": "componentDidMount(){\n\n //do not render shelves till data is available \n this.setState({libraryDataAvailable: false}); \n\n BooksAPI.getAll().then(\n allBooks => {\n this.setState({\n books: allBooks, \n libraryDataAvailable: true\n })})\n\n}", "title": "" }, { "docid": "b386ccdf8ca45d6c044341ae6166f366", "score": "0.53952837", "text": "function get_repo_data() {\n $(\".main-wrapper-repo\").html(\"\");\n $.ajax({\n url: repositories_url,\n success: function (data) {\n\t\t\t\tif(data.length == 0){\n\t\t\t\t\t// If user has no (public) repos, empty array is returned\n\t\t\t\t\t$(\"<div class='repo-wrapper'>\").append(\"<h4>No (public) repos found for this user.</h4>\").appendTo('.main-wrapper-repo');\n\t\t\t\t}else{\n\t\t\t\t$.each(data, function (i, item) {\n var contributors_url = \"\";\n\t\t\t\t\tvar repo_name = \"\";\n contributors_url = data[i].contributors_url + \"?access_token=\" + access_token_github;\n repo_name = data[i].full_name;\n \n $(\"<div class='repo-wrapper'>\").append(\"<a href='#' class='repo' repo-url='\"+data[i].contributors_url+\"' repo-name='\"+repo_name+\"'>\"+repo_name+\"</a>\").appendTo('.main-wrapper-repo');\n });\t\r\n\t\t\t\t}\n \n }, error: function (e) {\n //Repo not found / User not found\n $(\"<div class='repo-wrapper'>\").append(\"<h4>No such user found.</h4>\").appendTo('.main-wrapper-repo');\n }\n });\n }", "title": "" }, { "docid": "a41010ea42c5e7ef7a69cd12efcb0817", "score": "0.5393684", "text": "componentWillMount() {\n this.fetchFilters();\n this.fetchFruit();\n }", "title": "" }, { "docid": "92f4239851945e729d661bb3066497d9", "score": "0.53888154", "text": "function fetchRepos({ term, sortBy, orderBy }) {\n if (term) {\n return fetch(`https://api.github.com/search/repositories?q=user:${term}&sort=${sortBy}&order=${orderBy}`, {\n headers: {\n 'content-type': 'application/json'\n },\n method: 'GET'\n }).then(handleResponse)\n }\n\n return Promise.resolve()\n}", "title": "" }, { "docid": "fe879ad724c7e895ef65b79fbf8dfa0d", "score": "0.5380182", "text": "function loadRepoData(accessKey){\n toggleLoading();\n axios.get(`/api/repo/${accessKey}`)\n .then((res) => {\n // Load in data from server\n const repo = new Repo(res.data);\n repo.displayRepoInfo();\n repo.refreshEntryList();\n // Only bother with setting up editing listeners if we're authorized to edit\n if (viewState === AUTH.edit){\n initEditEventListeners(repo);\n modalCloseHandlers();\n }\n toggleLoading();\n })\n .catch((err) => {\n if ((err.response) && (err.response.status === 401 || err.response.status === 403)){\n // Redirect on unauthorized\n window.location = `/repo/auth?access_key=${accessKey}`;\n }\n flash('Critical Error: Could not load repo data.', 'danger');\n toggleLoading();\n });\n}", "title": "" }, { "docid": "413647b5d0234a85bfa2b7b8ef3d1299", "score": "0.537452", "text": "componentWillMount() {\n\n // Get languages list from catalogs\n this.getLanguagesList();\n }", "title": "" }, { "docid": "6c089d76973a2303031f8c02c1c772c0", "score": "0.53695333", "text": "componentDidMount() {\n this.fetchImages();\n }", "title": "" }, { "docid": "4ebf205e7bc86d83a1e03d81d60f3b08", "score": "0.5368332", "text": "async function fetchProjects() {\n try {\n const response = await fetch('/api/projects');\n const data = await response.json();\n setProjects(data.projects);\n } catch (error) {\n console.error('Failed to fetch projects:', error);\n }\n }", "title": "" }, { "docid": "8169f14b6d947baabab96c70e03cdfef", "score": "0.536328", "text": "componentDidMount() {\n this.getList(); // refresh the list when we're done\n }", "title": "" }, { "docid": "f608e32b338cf62776fe2514ade4d0ad", "score": "0.5356698", "text": "fetchData(str, isAdding) {\n \n fetch(`https://api.github.com/search/repositories?q=${str}&page=${this.state.page}&per_page=100`, {\n headers: {\n \"Content-Type\": \"application/json\"\n },\n method: 'GET'\n })\n .then(resp => {\n if(resp.ok) return resp.json();\n else throw Error(resp.statusText);\n })\n .then(data => {\n //Process the response data\n let {total_count, items} = data;\n //if there is no repos from GitHub\n if(!items.length){\n this.setState({\n end: true,\n });\n return;\n }\n \n // Everytime, we store all the request data in repoStore, and we pop out 10 items to repos and render them.\n let repos = items.slice(0, 10);\n let repoStore = items;\n repoStore.splice(0, 10);\n\n this.setState({\n total_count: total_count,\n repos: isAdding? [...this.state.repos, ...repos]:repos,\n searching: true,\n loading: false,\n searchKeyWord: str,\n repoStore: repoStore,\n });\n })\n .catch(err => {\n console.error(err);\n })\n }", "title": "" }, { "docid": "c2f380636314233a4b26fd776689cedd", "score": "0.53561556", "text": "async _pullData() {\n let response = await fetch(this._url);\n let commits = await response.json();\n return commits;\n }", "title": "" }, { "docid": "ddd067c0262adcc2298c683b5d463ac5", "score": "0.5353171", "text": "function getWorks() {\n $.ajax({\n url: reposUrl,\n headers: {\n Accept: 'application/vnd.github.mercy-preview+json'\n },\n success: function (repos) {\n if (repos.length > 0) {\n renderWorks(repos);\n }\n }\n });\n}", "title": "" }, { "docid": "374737160b48717a3bfc48a600f8549e", "score": "0.534965", "text": "componentDidMount() {\n this.fetchRecipes();\n this.fetchAutologin();\n this.getFavorites();\n }", "title": "" }, { "docid": "ff9549af93b475f8133c98d82916dc33", "score": "0.5346506", "text": "componentDidMount() {\n // Chaining fetch methods from AnimalManager\n AnimalManager.getAllAnimals().then(allAnimals => {\n this.setState({\n animals: allAnimals\n })\n })\n\n EmployeeManager.getAllEmployees().then(allEmployees => {\n this.setState({\n employees: allEmployees\n })\n })\n\n LocationManager.getAllLocations().then(allLocations => {\n this.setState({\n locations:allLocations\n })\n })\n\n OwnerManager.getAllOwners().then(allOwners => {\n this.setState({\n owners:allOwners\n })\n })\n }", "title": "" }, { "docid": "a8cf1b8bab7ba96c5c2286e360dd7846", "score": "0.53249824", "text": "componentDidMount() {\n this.getContent(); // refresh the list when we're done\n }", "title": "" }, { "docid": "930a6d674113bfb0fbf3d199accbbe56", "score": "0.53215325", "text": "componentDidMount() {\n\t\tthis.fetchHouses();\n\t}", "title": "" }, { "docid": "fa1c353aeec7e99f351197adedc6093b", "score": "0.53070724", "text": "componentWillMount(){\n this.props.clearErrorMessage(this.state.randomFloat);\n this.props.startProjectsLoading();\n this.props.setActiveRequests(1);\n this.props.getProjects(this.props.token);\n }", "title": "" }, { "docid": "b8e1020c5d64f11f9d325aa332e5b7fa", "score": "0.5297541", "text": "componentDidMount() {\n this.getItems()\n }", "title": "" }, { "docid": "b874f29fe64fc16ec981818dda2242e2", "score": "0.529741", "text": "componentDidMount() {\n this.retrieveDistricts();\n //this.retrieveParties();\n this.retrievePollingStations();\n this.retrieveSections();\n this.retrieveCandidates();\n }", "title": "" }, { "docid": "ee789fe45fe2107f863ccce33711fc80", "score": "0.5296337", "text": "componentDidMount() {\n this.ensureDataFetched();\n }", "title": "" }, { "docid": "f2e24eaaead706dbeb06ae70bbe8ad8a", "score": "0.52955943", "text": "componentDidMount() {\n //comPonentDidMount is using here mainly to fetch api\n // this.setState({ robots: robots });\n // console.log(\"componentDidMount\");\n fetch(\"https://jsonplaceholder.typicode.com/users\")\n .then((res) => res.json())\n .then((users) => this.setState({ robots: users }));\n }", "title": "" }, { "docid": "f7f7bf15663806a7458af13268ea47a7", "score": "0.52923024", "text": "function loadRepositories() {\n fetch('/api/repositories').then(function (response) {\n if (response.status != 200) {\n throw new Error('fail to fetch repositories');\n }\n return response.json();\n }).then(function (items) {\n let dataSet = Object.keys(items).map(function (name) {\n const item = items[name];\n const sizeMo = (item.size / (1024 * 1024)).toFixed(1);\n return [\n `<a href=\"https://${name}\">${name}</a>`,\n `<span class=\"${item.readme ? \"text-success\" : \"text-danger\"}\">${item.readme ? \"FOUND\" : \"MISSING\"}</span>`,\n `<span class=\"${item.license ? \"text-success\" : \"text-danger\"}\">${item.license ? item.license : \"MISSING\"}</span>`,\n getLastActivity(item),\n sizeMo,\n item.trivy\n ];\n });\n $('#repositories').DataTable({\n data: dataSet,\n columns: [\n { title: \"Name\"},\n { title: \"README\" },\n { title: \"LICENSE\" },\n { title: \"Last Activity\" },\n { title: \"Size (Mo)\" },\n { \n title: \"Trivy\", \n render: function (trivy, type) {\n if ( type === 'sort' || type === 'type' ) {\n return trivy.summary.CRITICAL + trivy.summary.HIGH;\n } else {\n return renderTrivy(trivy);\n }\n }\n }\n ],\n \"paging\": false,\n \"info\": false\n });\n }).catch(function (error) {\n $('#repositories').DataTable({\n data: [[\n `<span class=\"text-danger\">fail to load repositories (run 'bin/console git:stats')</span>`,\n ]],\n columns: [\n { title: \"Error\" },\n ],\n \"paging\": false,\n \"info\": false\n });\n });\n}", "title": "" }, { "docid": "278efa4ecfb36ef844070e4bbecb8094", "score": "0.528855", "text": "componentDidMount() {\r\n const { fetchCollectionsStartAsync } = this.props;\r\n fetchCollectionsStartAsync();\r\n }", "title": "" }, { "docid": "fea9f80fd16cea0d622ee0e52cb1b979", "score": "0.5286621", "text": "componentWillMount(){\n this.props.startTagsLoading();\n this.props.startStatusesLoading();\n this.props.startTaskProjectsLoading();\n this.props.startCompaniesLoading();\n \n this.props.getTags(this.props.token);\n this.props.getStatuses(this.props.statusesUpdateDate,this.props.token);\n this.props.getTaskProjects(this.props.token);\n this.props.getCompanies(this.props.companiesUpdateDate,this.props.token);\n }", "title": "" }, { "docid": "da190bf1f1d8910e5c881467c2faf85d", "score": "0.5284988", "text": "beforeMount() {\n\t\tthis.getCategories()\n\t}", "title": "" } ]
3260bd2cfa78d866af57378a7c993ff8
Makes a call to fetch counter from specified endpoint Creates a counter array if not able to fetch it NOT MAKING USE OF THIS YET
[ { "docid": "45c700181bb71f31e86df44a8402fc2b", "score": "0.73790187", "text": "function getCounter(){\r\n // Add fetch to make calls every x seconds (x~5 ideally)\r\n // To avoid polling, can make use of sockets\r\n var getOptions = {\r\n\r\n }\r\n fetch(url)\r\n .then(checkStatus)\r\n .then(getJSON)\r\n .then(function(){\r\n\r\n })\r\n .catch(function(err){\r\n\r\n });\r\n}", "title": "" } ]
[ { "docid": "b73fc11c82d405396f5473ec8e60a7ae", "score": "0.653565", "text": "function getCounters(req, res) {\n var userId = req.user.sub;\n if (req.params.id) {\n userId = req.params.id;\n }\n getCountFollow(userId).then((value) => {\n // if (err) return res.status(200).send({ err });\n return res.status(200).send({ value });\n });\n}", "title": "" }, { "docid": "6a7e3b2c4501673ea53d3c49feabb553", "score": "0.6475429", "text": "function fetchCounts(query, nextPageUrl) {\n // console.log(\"fetchCounts building a CALL_API action for url: \", nextPageUrl)\n return {\n query,\n [CALL_API]: {\n types: [ COUNTS_REQUEST, COUNTS_SUCCESS, COUNTS_FAILURE ],\n endpoint: nextPageUrl,\n schema: Schemas.COUNTS_ARRAY\n }\n }\n}", "title": "" }, { "docid": "a2f945b7119ba8d5c55e112435d80799", "score": "0.6191957", "text": "function fetchCount() {\n var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n return new Promise(function (resolve) {\n return setTimeout(function () {\n return resolve({\n data: amount\n });\n }, 500);\n });\n}", "title": "" }, { "docid": "088c7c6d1233ec002a685f71e50bb507", "score": "0.6088605", "text": "count(req, res){\n const ProxyEngineService = this.app.services.ProxyEngineService\n ProxyEngineService.count('Subscription')\n .then(count => {\n const counts = {\n subscriptions: count\n }\n return res.json(counts)\n })\n .catch(err => {\n return res.serverError(err)\n })\n }", "title": "" }, { "docid": "088c7c6d1233ec002a685f71e50bb507", "score": "0.6088605", "text": "count(req, res){\n const ProxyEngineService = this.app.services.ProxyEngineService\n ProxyEngineService.count('Subscription')\n .then(count => {\n const counts = {\n subscriptions: count\n }\n return res.json(counts)\n })\n .catch(err => {\n return res.serverError(err)\n })\n }", "title": "" }, { "docid": "9a7facb1726226034f5aad05c94c20e7", "score": "0.6032872", "text": "async function getCount() {\r\n const response = await fetch('http://68.7.7.158:8181/api/v2?apikey=*************************&cmd=get_libraries');\r\n const json = await response.json();\r\n return json;\r\n}", "title": "" }, { "docid": "aad1c525cc2f61980da453ae01b70065", "score": "0.60003406", "text": "async callbackAwait() {\n try {\n const response = await fetch(`http://localhost:3001/counters`);\n if (!response.ok) {\n throw Error(response.statusText);\n }\n const json = await response.json();\n this.setState({ counters: json });\n } catch (error) {\n this.setState({ counters: [{ id: 1, count: 5 }, { id: 2, count: 3 }] });\n }\n }", "title": "" }, { "docid": "b81132ced1ce52116b9d7a99508d23d6", "score": "0.59981334", "text": "function counterRequest(req, res, next) {\n counter++;\n\n console.log(`Number of requests ${counter}`);\n\n return next();\n}", "title": "" }, { "docid": "80eccc14357706dfbed40a36ecfcf7e7", "score": "0.5964618", "text": "async function getCount(){\n \t\t\tconst response = await fetch('getcount.php')\n\t\t\t\tconst conteo = await response.json()\n\t\t\t\treturn conteo;\n\t\t}", "title": "" }, { "docid": "9e25d3be9a4cabd4046192484835f3fc", "score": "0.59533054", "text": "async collect(aCount) {\n let response = await this.kojac.performRequest(this);\n\t\tlet result = response.result();\n\t\tif (!_.isArray(result) || result.length===0)\n\t\t\treturn result;\n\t\tvar resource = response.request.ops[0].key;\n\t\treturn this.kojac.collectIds(resource,result,null,aCount);\n\t}", "title": "" }, { "docid": "75398bce3e0b913e5127b17982d50637", "score": "0.594058", "text": "async getCount() {\n return axios\n .get(UrlBuilder[this.storeType].paths.count, createHeaders())\n .then(response => response.data)\n .catch(error => handleError(error.response))\n }", "title": "" }, { "docid": "116b3c8dfe7f8052c5c45908dfdc923f", "score": "0.5902315", "text": "async function getServiceCalls() {\n const data = await API.get(\"instapostservicecallsapi\", `/service-calls`);\n updateServiceCalls(data.service_calls_count[\"service-calls\"]);\n setLoading(true);\n }", "title": "" }, { "docid": "0d47ff53a5faf02c008767441c4662a9", "score": "0.5883828", "text": "function requestApplicationCounters(applicationId, start_time, end_time, resolution, counter, success, failure) {\n var params = {};\n if (start_time) params.start_time = start_time;\n if (end_time) params.end_time = end_time;\n if (resolution) params.resolution = resolution;\n if (counter) params.counter = counter;\n params.pad = true;\n apiGetRequest(\"/\" + self.currentOrganization + \"/\" + applicationId + \"/counters\", params, success, failure);\n }", "title": "" }, { "docid": "6e6ff1bf24a154a7009154f3cffe6a5b", "score": "0.58438313", "text": "getCounter() {\n precondition.ensureNotNull('this.ctxPtr', this.ctxPtr);\n\n let proxyResult;\n proxyResult = Module._vscr_ratchet_message_get_counter(this.ctxPtr);\n return proxyResult;\n }", "title": "" }, { "docid": "e8ce5c04f37694278bb0bea958b23aaf", "score": "0.58358103", "text": "function getNumberOfHolders(address){\r\n for(i = 0 ; i<=2; i++){ //request the same URL for maximun 10 times (concurrency = 1)\r\n url_pool.push(composeRequestConfig(0, address)); //&start=0 \r\n } \r\n\r\n var poolPromise = pool.start(); // Start the pool\r\n\r\n return poolPromise.then(function () {\r\n //console.log('----------------------All promises fulfilled-----------------------');\r\n console.log(total);\r\n return total;\r\n }\r\n );\r\n\r\n}", "title": "" }, { "docid": "bc11bea80c21cbbed4ddda28d1516066", "score": "0.57868093", "text": "function fetchCount(amount = 1) {\n return new Promise(resolve => setTimeout(() => resolve({\n data: amount\n }), 500));\n}", "title": "" }, { "docid": "4e759a406ab8e1c6fb312ee0e2b1dceb", "score": "0.5750611", "text": "registerAsCounted() {\n const options = this.options;\n if (options.counters && options.counterUrl) {\n connectButtonToService(this.serviceName, this.setDisplayedCounter.bind(this), options);\n }\n }", "title": "" }, { "docid": "6e8da39c20b49217c01fbf3f5d358b76", "score": "0.574936", "text": "function asyncCounter(numCalls, callback){\r\n this.callback = callback;\r\n this.numCalls = numCalls;\r\n this.calls = 0;\r\n}", "title": "" }, { "docid": "713a5d5d4f5af0a34d2f666d6aad454b", "score": "0.5747868", "text": "function initilizeCounter(){\n axios.get('https://api.countapi.xyz/create?namespace=1ccb732e-b55a-4404-ad3f-0f99c02fe44e&key=moodDay&enable_reset=1')\n .then(response => { \n console.log(response); \n }).catch(error => {\n document.querySelector(\".tug-days\").innerHTML = 0;\n return;\n });\n \n}", "title": "" }, { "docid": "05133d1feb7868843846d632194e8018", "score": "0.5726689", "text": "function getData() {\n //use the number of records info from the first API call\n return rp(getNum)\n .then(function(ret) {\n // console.log(\"**from keys.js * totalSize = \" + ret.totalSize);\n //determine the number of API calls needed\n size = ret.totalSize;\n callNumber = Math.ceil(size / 200);\n var requestPromiseArray = [];\n for (j = 0; j < callNumber; j++) {\n //create the requestPromiseArray using a loop\n options = {\n method: 'GET',\n uri: 'https://api.salesforceiq.com/v2/lists/57114e10e4b0a3f93805ebc6/listitems?_start=' + URLcounter + '&_limit=200',\n headers: {\n 'Authorization': auth,\n 'Content-type': 'application/json'\n },\n json: true\n }\n if (!options.uri) {}\n //push each call result into the array\n requestPromiseArray.push(rp(options));\n URLcounter = URLcounter + 200;\n }\n //return all the API calls\n return Promise.all(requestPromiseArray); \n })\n .then(function(totalRecords) {\n //join the API calls into one array\n return totalRecords.reduce(function(initial, following) {\n return initial.concat(following.objects);\n }, []);\n })\n .catch(function(err) {\n console.log(\"error in API call\")\n });\n}", "title": "" }, { "docid": "d66c14046af60fdea770feb88db12632", "score": "0.5714723", "text": "@action\n addCounter() {\n this.counters.push({\n id: String(Math.random() * 1000000),\n state: new CounterState(this.startingCount),\n });\n }", "title": "" }, { "docid": "1f1c2dfe616cd93aa589d9a0440ff13a", "score": "0.56195015", "text": "function IncrementAction() {\n console.log(\"in increment\");\n // Endpoint: http://ip_adr:port/intensity/incr for up'ing by incr (incr being an integer)\n fetch(\"http://\" + location.hostname + \":\" + location.port + \"/intensity/\" + intensityIncrement, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n }\n })\n .then(\n function (response) {\n HandleResponse(response)\n }\n )\n .catch(function (err) {\n console.log('Fetch Error :-S', err);\n });\n}", "title": "" }, { "docid": "ec8c2e67dcccbfc54af1bc748282add0", "score": "0.5581271", "text": "function toCall(offset){\n\t\t\t\t//update the key\n\t\t\t\tif(hubCache.get(\"config\").type == \"hapikey\"){\n\t\t\t\t\tvar key = hubCache.get(\"config\").value\n\t\t\t\t\taxios.get(endpoint + \"?hapikey=\" + key + '&count=100' + '&offset=' + offset)\n\t\t\t\t .then(response =>{\n\t\t\t\t\t companies = companies.concat(response.data.results)\n\t\t\t\t\t if (response.data['hasMore']){\n\t\t\t\t\t \tsetTimeout(function(){\n\t\t\t\t\t \t\ttoCall(response.data['offset']) \t\t\n\t\t\t\t\t \t},101)\n\t\t\t\t\t \n\t\t\t\t\t }else{ \t\n\t\t\t\t\t \tresolve(companies)\n\t\t\t\t\t }\n\t\t\t\t \t}).catch(error => {\n\t\t\t\t\t \t//look through 429 error codes for daily or secondly(as in time) limit\n\t\t\t\t\t\tif(error.response.status == 404){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have a 404 error for endpoint not found.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 429){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have exceeded your call limit for the day.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 401){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You are not authorized to hit this endpoint.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You received a \" + error.response.status + \" error.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}\n\t\t\t\t \t})\n\t\t\t\t}else{\n\t\t\t\t\tvar token = hubCache.get(\"config\").value\n\t\t\t\t\taxios.get(endpoint + '?offset=' + offset + '&count=100',\n\t\t\t\t\t\t{headers: {\"Authorization\": \"Bearer \" + token }\n\t\t\t\t\t})\n\t\t\t\t .then(response =>{\n\t\t\t\t\t companies = companies.concat(response.data.results)\n\t\t\t\t\t if (response.data['hasMore']){\n\t\t\t\t\t \tsetTimeout(function(){\n\t\t\t\t\t \t\tconsole.log(companies)\n\t\t\t\t\t \t\ttoCall(response.data['offset']) \t\t\n\t\t\t\t\t \t},101)\n\t\t\t\t\t }else{ \t\n\t\t\t\t\t \tresolve(companies)\n\t\t\t\t\t }\n\t\t\t\t \t}).catch(error => {\n\t\t\t\t\t \t//look through 429 error codes for daily or secondly(as in time) limit\n\t\t\t\t\t\tif(error.response.status == 404){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have a 404 error for endpoint not found.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 429){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have exceeded your call limit for the day.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 401){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You are not authorized to hit this endpoint.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You received a \" + error.response.status + \" error.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}\n\t\t\t\t \t})\n\t\t\t\t}//end of oauth block\n\t\t\t\t\n\t\t\n\t\t}", "title": "" }, { "docid": "ea80930869539c30a36fb604bf6856fb", "score": "0.5566786", "text": "function onCounterValueChange() {\n if (activeHttpRequestCounter.count == 0) { loadingSpinnerOff(); }\n else { loadingSpinnerOn(0,true,true); }\n}", "title": "" }, { "docid": "1b70fcb00ce14934030ec9b5a0032c4a", "score": "0.55559844", "text": "function getCount() {\n return count;\n}", "title": "" }, { "docid": "38d4ebb3ac8fac297479bdcac3f7ba6e", "score": "0.5553236", "text": "function statuses(endpoint, res) {\n sync.pullStatuses(endpoint, function(err, repeatAfter, diaryEntry) {\n if(err) {\n res.writeHead(401, {'Content-Type': 'application/json'});\n res.end(JSON.stringify({error:err}));\n return;\n } else {\n locker.at('/getNew/' + endpoint, repeatAfter);\n locker.diary(diaryEntry);\n res.writeHead(200, {'Content-Type': 'application/json'});\n res.end(JSON.stringify({success:\"got \"+endpoint+\", happy day\"}));\n }\n });\n }", "title": "" }, { "docid": "6097ba924fa9fd773659df741e92f417", "score": "0.555298", "text": "async countDocuments (uuid, state) {\n return 200\n }", "title": "" }, { "docid": "d0cd33e7c3ad71a05fc5f4bccf8f0a02", "score": "0.5533702", "text": "function collectors(n){\n\tvar url = \"https://\"+user+\":\"+password+\"@\"+apiUrl+\"collectors?limit=\"+pageLimit+\"&offset=\"+n\n\treturn fetch(url)\n}", "title": "" }, { "docid": "4e370b68ef99406590c5cbfb821d5ace", "score": "0.55295104", "text": "function toCall(offset){\n\t\t\t\t//update the key\n\t\t\t\tif(hubCache.get(\"config\").type == \"hapikey\"){\n\t\t\t\t\tvar key = hubCache.get(\"config\").value\n\t\t\t\t\taxios.get(endpoint + \"?hapikey=\" + key + '&count=100' + '&offset=' + offset,{headers: {\"content-type\": \"application/json\" }\n\t\t\t\t\t}).then(response =>{\n\t\t\t\t\t companies = companies.concat(response.data.results)\n\t\t\t\t\t if (response.data['hasMore']){\n\t\t\t\t\t \tsetTimeout(function(){\n\t\t\t\t\t \t\ttoCall(response.data['offset']) \t\t\n\t\t\t\t\t \t},101)\n\t\t\t\t\t \n\t\t\t\t\t }else{ \t\n\t\t\t\t\t \tresolve(companies)\n\t\t\t\t\t }\n\t\t\t\t \t}).catch(error => {\n\t\t\t\t \t//look through 429 error codes for daily or secondly(as in time) limit\n\t\t\t\t\tif(error.response.status == 404){\n\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\tadvice: \"You have a 404 error for endpoint not found.\",\n\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t}\n\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t}else if(error.response.status == 429){\n\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\tadvice: \"You have exceeded your call limit for the day.\",\n\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t}\n\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t}else if(error.response.status == 401){\n\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\tadvice: \"You are not authorized to hit this endpoint.\",\n\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t}\n\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t}else{\n\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\tadvice: \"You received a \" + error.response.status + \" error.\",\n\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t}\n\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t}\n\t\t\t\t })\n\t\t\t\t}else{\n\t\t\t\t\tvar token = hubCache.get(\"config\").value\n\t\t\t\t\taxios.get(endpoint + '?offset=' + offset + '&count=100',\n\t\t\t\t\t\t{headers: {\"Authorization\": \"Bearer \" + token,\"content-type\": \"application/json\" }\n\t\t\t\t\t})\n\t\t\t\t .then(response =>{\n\t\t\t\t\t companies = companies.concat(response.data.results)\n\t\t\t\t\t if (response.data['hasMore']){\n\t\t\t\t\t \tsetTimeout(function(){\n\t\t\t\t\t \t\ttoCall(response.data['offset']) \t\t\n\t\t\t\t\t \t},101)\n\t\t\t\t\t }else{ \t\n\t\t\t\t\t \tresolve(companies)\n\t\t\t\t\t }\n\t\t\t\t \t}).catch(error => {\n\t\t\t\t\t \t//look through 429 error codes for daily or secondly(as in time) limit\n\t\t\t\t\t\tif(error.response.status == 404){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have a 404 error for endpoint not found.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 429){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have exceeded your call limit for the day.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 401){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You are not authorized to hit this endpoint.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You received a \" + error.response.status + \" error.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}\n\t\t\t\t \t})\n\t\t\t\t}//end of oauth block\n\t\t\t\t\n\t\t\n\t\t}", "title": "" }, { "docid": "637564f9d4df9c61f03a4342bb5f6f71", "score": "0.5528027", "text": "getProductsCount() {\n return this.$fetch('GET', 'catalog/products/count', { auth: 'token' });\n }", "title": "" }, { "docid": "775be72002605b1c1338d0d7add7dc41", "score": "0.5516266", "text": "function loop_request(){\r\n let waisted_count = 0; // set to 0\r\n \r\n //requset from api\r\n async function StartR() \r\n {\r\n // request, fetch api data\r\n const response = await fetch(api_url); //fetch\r\n const data = await response.json(); //api\r\n let json_split = JSON.parse(JSON.stringify(data)); // split api data\r\n\r\n // only for the first request\r\n if (beginvar == true){\r\n console.log(\"first try\");\r\n render_call(json_split, waisted_count, beginvar);\r\n last_api = json_split[0].id;\r\n beginvar = false; \r\n } \r\n else{\r\n console.log(\"secound try\");\r\n waisted_count = while_count(last_api, json_split);\r\n render_call(json_split, waisted_count, beginvar);\r\n }\r\n console.log(\"assync vege 15perc \" + \"Last API: \" + last_api);\r\n }\r\n StartR();\r\n}", "title": "" }, { "docid": "8163378787cc0e8492e8f3ea73a9ef10", "score": "0.5512956", "text": "async function displayNews (source = defaultSource) {\n const res = await fetch(setFullUrl(source));\n const response = await res.json();\n response.articles.map(respArticle => {\n createArticle(respArticle);\n createArticle.counter++;\n });\n console.log(createArticle.counter);\n}", "title": "" }, { "docid": "4506c9537f0e4346f1a4131f803202c2", "score": "0.5506761", "text": "async function fetch() {\n const result = await axios(\"https://readalright-backend.khanysorn.me/reading/last\");\n\n // setReadingIdD(result.data.reading[0].reading_id);\n console.log(result.data.reading[0].reading_id)\n var number = parseInt(result.data.reading[0].reading_id)\n var count = number + 1\n console.log(count)\n setReadingId2(count)\n\n\n }", "title": "" }, { "docid": "724bc02af599bbb5f2ff888197a42e72", "score": "0.54864854", "text": "async function getCountMetricsAsync() {\n return new Promise((resolve, reject) => {\n let counters = []\n db.createReadStream({ gt: NODE_STATS_COUNTER_MIN_BINARY_KEY, lt: NODE_STATS_COUNTER_MAX_BINARY_KEY })\n .on('data', async data => {\n counters.push({\n key: data.key.toString(),\n value: data.value.readDoubleBE()\n })\n })\n .on('error', error => {\n let err = `Error reading counter : ${error.message}`\n return reject(err)\n })\n .on('end', async () => {\n return resolve(counters)\n })\n })\n}", "title": "" }, { "docid": "7a75eec2bbec72c9cafd243cf208cc6c", "score": "0.54751325", "text": "getConnectorCounters()\n {\n this.api.getConnectorList(this.botid,'messenger').then(connectors => {\n this.messengerConnectorCount = connectors.length;\n });\n this.api.getConnectorList(this.botid,'telegram').then(connectors => {\n this.telegramConnectorCount = connectors.length;\n });\n this.api.getConnectorList(this.botid,'website').then(connectors => {\n this.websiteConnectorCount = connectors.length;\n });\n\n }", "title": "" }, { "docid": "0786243bb035ea6209b06003768084e2", "score": "0.546886", "text": "function occAvailAPICall__2020() {\n fetch('https://adevu-metric-dashboard.herokuapp.com/getOccAvail2020')\n .then(response => response.json())\n //.then(data => { console.log( (JSON.parse(data)).length ) });\n .then(data => loadOccAvailData__2020(data));\n}", "title": "" }, { "docid": "07b9c8b64387ebadaba71add63312cc7", "score": "0.5454707", "text": "countCases(): Promise <number>{\n return axios.get(url+'/countCases');\n }", "title": "" }, { "docid": "3e79ed5543b8aba704963e26f56cbeee", "score": "0.5444507", "text": "function requestApplicationCounterNames(applicationId, success, failure) {\n apiGetRequest(\"/\" + self.currentOrganization + \"/\" + applicationId + \"/counters\", null, success, failure);\n }", "title": "" }, { "docid": "bfa62145bacf15167a0bbea4486385a9", "score": "0.5419979", "text": "function initialize(fetch, inToken, inLimit, inInterval) {\n\tvar i = 0;\n\tif (inToken != undefined) {\n\t\tclearInterval(intTimer);\n\t\ttoken = inToken;\n\t\tlimit = inLimit;\n\t\tSC.initialize({\n\t\t\tclient_id: \"2b161e5544f1f7f4cab5ff3c76c6c7b8\",\n\t\t\taccess_token: token\n\t\t});\n\t\tintTimer = setInterval(fetchTracks, 60 * inInterval * 1000);\n\t\tif (fetch === 1) {\n\t\t\tfor (i = 0; i < trackData.length; i++) {\n\t\t\t\ttrackData[i].length = 0;\n\t\t\t}\n\t\t\tfor (i = 0; i < favData.length; i++) {\n\t\t\t\tfavData[i].length = 0;\n\t\t\t}\n\t\t\tfetchTracks(0);\n\t\t}\n\t}\n\telse {\n\t\tclearInterval(intTimer);\n\t}\t\n}", "title": "" }, { "docid": "bee67148cd4677c8703431e77cd24d98", "score": "0.54092145", "text": "function getRequestCounterWaypoint(index) {\n\t\treturn requestCounterWaypoints[index];\n\t}", "title": "" }, { "docid": "20f14f791be59283294acb03c3f2c504", "score": "0.5390978", "text": "function HackManagementInitializeCounts(operation) {\n const counts = operation.counts;\n console.log('Hack Management Initialize Counts ' + JSON.stringify(counts));\n browser.get(defs.serverHack);\n const that = this;\n Object.keys(counts).forEach(countKey => {\n const tableName = counts[countKey];\n console.log('Init Counter ' + countKey + ' with table ' + tableName);\n const transformation = {[countKey]: \"$\"}; //transformation[countKey] = \"$\";\n const promise = element(by.name(tableName)).all(by.repeater(defs.itemInTableList)).count();\n promise.then(function (value) {\n doTransformation.call(that, transformation, value)\n });\n });\n}", "title": "" }, { "docid": "e699191987fe44a6205cbf692a14f6c0", "score": "0.5387151", "text": "function occAvailAPICall__03() {\n fetch('https://adevu-metric-dashboard.herokuapp.com/getOccAvail03')\n .then(response => response.json())\n .then(data => loadOccAvailData__03(data));\n}", "title": "" }, { "docid": "3ea6916402b1849e1d73bbe321a6f371", "score": "0.53857225", "text": "async howManyNotify(id) {\n // no of notificatons\n let response = await axios.get(`${API_URL}/requests/${id}/checkRequests`);\n // console.log(response);\n return response;\n }", "title": "" }, { "docid": "818da6c2b0a43219a1b8e90ef20563fa", "score": "0.5377951", "text": "async countDocuments (uuid, state) {\n return 200\n }", "title": "" }, { "docid": "818da6c2b0a43219a1b8e90ef20563fa", "score": "0.5377951", "text": "async countDocuments (uuid, state) {\n return 200\n }", "title": "" }, { "docid": "763085d03cd6b276ab90cdd0d0dc9b6e", "score": "0.5368558", "text": "getHomeCount(){\n return _mm.request({\n type:'post',\n url:'/manage/statistic/base_count.do'\n })\n }", "title": "" }, { "docid": "4c74cf8342cc6ccc20f1713f40431cd1", "score": "0.53513706", "text": "function toCall(offset){\n\t\t\t\t//update the key\n\t\t\t\tif(hubCache.get(\"config\").type == \"hapikey\"){\n\t\t\t\t\tvar key = hubCache.get(\"config\").value\n\t\t\t\t\taxios.get(endpoint + \"?hapikey=\" + key + '&limit=200' + '&offset=' + offset + propString)\n\t\t\t\t .then(response =>{\n\t\t\t\t\t companies = companies.concat(response.data.companies)\n\t\t\t\t\t if (response.data['has-more']){\n\t\t\t\t\t \tsetTimeout(function(){\n\t\t\t\t\t \t\ttoCall(response.data['offset']) \t\t\n\t\t\t\t\t \t},101)\n\t\t\t\t\t \n\t\t\t\t\t }else{ \t\n\t\t\t\t\t \tresolve(companies)\n\t\t\t\t\t }\n\t\t\t\t \t}).catch(error => {\n\t\t\t\t\t \t//look through 429 error codes for daily or secondly(as in time) limit\n\t\t\t\t\t\tif(error.response.status == 404){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have a 404 error for endpoint not found.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 429){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have exceeded your call limit for the day.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 401){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You are not authorized to hit this endpoint.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You received a \" + error.response.status + \" error.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}\n\t\t\t\t \t})\n\t\t\t\t}else{\n\t\t\t\t\tvar token = hubCache.get(\"config\").value\n\t\t\t\t\taxios.get(endpoint + '?offset=' + offset + '&limit=200' + propString,\n\t\t\t\t\t\t{headers: {\"Authorization\": \"Bearer \" + token }\n\t\t\t\t\t})\n\t\t\t\t .then(response =>{\n\t\t\t\t\t companies = companies.concat(response.data.companies)\n\t\t\t\t\t if (response.data['has-more']){\n\t\t\t\t\t \tsetTimeout(function(){\n\t\t\t\t\t \t\ttoCall(response.data['offset']) \t\t\n\t\t\t\t\t \t},101)\n\t\t\t\t\t }else{ \t\n\t\t\t\t\t \tresolve(companies)\n\t\t\t\t\t }\n\t\t\t\t \t}).catch(error => {\n\t\t\t\t\t \t//look through 429 error codes for daily or secondly(as in time) limit\n\t\t\t\t\t\tif(error.response.status == 404){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have a 404 error for endpoint not found.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 429){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have exceeded your call limit for the day.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 401){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You are not authorized to hit this endpoint.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You received a \" + error.response.status + \" error.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}\n\t\t\t\t \t})\n\t\t\t\t}//end of oauth block\n\t\t\t\t\n\t\t\n\t\t}", "title": "" }, { "docid": "9f27e40acf463f8f21fc45551818c022", "score": "0.5348913", "text": "static async apiGetAccidentsCount(res,req,next){\n const data = await req.on('data',function (data){\n options = JSON.parse(data);\n });\n console.log(options.State);\n try{\n const response = await AccidentService.getAccidentsCount(options.State);\n console.log(response);\n res.write(JSON.stringify(response));\n }catch (error){\n res.statusCode = 500;\n }\n }", "title": "" }, { "docid": "662423a74b0d7c59ffc7f4b707d2b03c", "score": "0.5340289", "text": "function buildCounter(page){ return page; }", "title": "" }, { "docid": "ab7ba1e8f4e725ca40b687cf2e2a683a", "score": "0.5327765", "text": "getDeviceStatus(deviceId, callback, retryCounter) {\n let ip;\n if (!retryCounter) retryCounter = 0;\n if (retryCounter > 2) {\n return callback && callback(new Error('timeout on response'));\n }\n if (deviceId.includes('#')) {\n if (!this.knownDevices[deviceId] || !this.knownDevices[deviceId].ip) {\n return callback && callback('device unknown');\n }\n ip = this.knownDevices[deviceId].ip;\n }\n else ip = deviceId;\n this.logger && this.logger('CoAP device status request for ' + deviceId + ' to ' + ip + '(' + retryCounter + ')');\n\n let retryTimeout = null;\n try {\n const req = coap.request({\n host: ip,\n method: 'GET',\n pathname: '/cit/s',\n });\n\n retryTimeout = setTimeout(() => {\n this.getDeviceStatus(deviceId, callback, ++retryCounter);\n callback = null;\n }, 2000);\n req.on('response', (res) => {\n clearTimeout(retryTimeout);\n this.handleDeviceStatus(res, (deviceId, payload) => {\n return callback && callback(null, deviceId, payload, this.knownDevices[deviceId].ip);\n });\n });\n req.on('error', (error) => {\n // console.log(error);\n callback && callback(error);\n });\n req.end();\n }\n catch (e) {\n if (retryTimeout) clearTimeout(retryTimeout);\n callback && callback(e);\n callback = null;\n }\n }", "title": "" }, { "docid": "c50b14ab50e1b3e6871ce040c6e84db7", "score": "0.5318763", "text": "fetchStrategy() {\n // no support for parallel query\n // 1. 1 active request allowed at a time\n // 2. Do not create a new request when the buffer is full\n // 3. If there are no more items to fetch, exit\n if (this.activeRequests.length > 0 || this.bufferSize > this.bufferCapacity || !this.nextToken) {\n return this.activeRequests[0] || null;\n }\n const request = {\n ...(this.request.Limit && { Limit: this.request.Limit - this.totalReturned }),\n ...this.request,\n ...(Boolean(this.nextToken) && typeof this.nextToken === \"object\" && { ExclusiveStartKey: this.nextToken }),\n };\n const promise = this.documentClient[this.operation](request).promise();\n return promise;\n }", "title": "" }, { "docid": "59e5180e3a96bc59dc292e3824c60a8e", "score": "0.5315764", "text": "async function storeCount () {\n console.log(\"storeCount starts\")\n var date = new Date();\n var obj = { \n date:date,\n cashtagCount:cashtagCount,\n errorCount:errorCount\n };\n counterStore.push(obj);\n cashtagCount = 0;\n errorCount = 0;\n runCount = runCount + 1;\n setTimeout(storeCount, 120000);\n }", "title": "" }, { "docid": "526fd5b7e765eafb8b5ce559db8552e8", "score": "0.5314901", "text": "async request() {\n if (this.isTest()) { console.log(\"in getAllCalls\"); }\n // GET first page (and number of pages)\n await this.getCallsPage();\n \n if (this.isTest()) { console.log(`getLastPage = ` + this.getLastPage()); }\n // GET the remaining pages\n for (let pageNum = 2; pageNum <= this.getLastPage(); pageNum++) {\n await Util.throttle(this.#config.throttle);\n await this.getCallsPage(pageNum);\n }\n }", "title": "" }, { "docid": "c89853edefc74443cca32ab62c9b4a58", "score": "0.53143126", "text": "function counters(){\n counters.count++;\n}", "title": "" }, { "docid": "dcf0ca2897ad369191c4afb6d7d5655f", "score": "0.53051704", "text": "function UpdateCounts(collectionName, counterName, isDelete){\n console.log('called function UpdateDocumentCounts')\n var getCurrentMetadataPromise = db.doc('metadata/PpmSaO7W089QJuMBY9Md').get()\n return getCurrentMetadataPromise.then((snap)=>{\n var curCount = snap.data()[counterName];\n console.log('get curCount ',curCount)\n if(curCount==-1){\n var getCurrentDocumentsRef= db.collection(collectionName)\n getCurrentDocumentsRef.get().then((snap2)=>{\n var newCount = snap2.docs.length\n var item={};\n item[counterName] = newCount;\n snap.ref.set(item, {merge:true})\n });\n }\n else{\n if(isDelete)curCount=curCount-1;\n else curCount=curCount+=1;\n var item={};\n item[counterName] = curCount;\n snap.ref.set(item, {merge:true})\n }\n })\n}", "title": "" }, { "docid": "e6b3c5de1d60743f5f149327b09ed4bb", "score": "0.5304301", "text": "function getCounterparties(req,res,callback){\n\tvar bankName = requestingBank;\n var response = [];\n var orgname = helper.getOrg(bankName);\n var channels = helper.channelList(bankName);\n for(var i = 0; i < channels.length ; i++ ){\n if( !helper.multilateralChannels.includes(channels[i]) ){\n var placeholder = {};\n placeholder.channel = channels[i]\n placeholder.bic = helper.getCounterparty(orgname,channels[i])\n response.push(placeholder)\n }\n }\n callback(response);\n}", "title": "" }, { "docid": "7704164d8e100e1e31fb9d8f754fa454", "score": "0.5282978", "text": "function counter() {\n return counter.count++; // counter++;\n }", "title": "" }, { "docid": "71b437c12dbb8860efea5cace9c9efe3", "score": "0.5282223", "text": "unseenMessages() {\n return axios.get('/api/message/unseen_counter')\n }", "title": "" }, { "docid": "7a6c4521d7c28a1bdf0b0f49c930f284", "score": "0.5282192", "text": "function ReqCount(req, res, next) {\r\n requests++;\r\n console.log(`Number of requests: ${requests}`);\r\n return next();\r\n}", "title": "" }, { "docid": "6d682c7a9c5ac2bfcee2b3ae9745d7f2", "score": "0.52643836", "text": "function refCountCallback() {\n\t if (disposed) {\n\t return;\n\t }\n\n\t --count;\n\n\t // If the count becomes 0, then its time to notify the\n\t // listener that the request is done.\n\t if (count === 0) {\n\t cb();\n\t }\n\t }", "title": "" }, { "docid": "9f4d45d9a2875954f39622e9fa646361", "score": "0.5263076", "text": "function DecrementAction() {\n console.log(\"in decrement\");\n\n // Endpoint: http://ip_adr:port/intensity/-incr for down'ing by incr (incr being an integer)\n fetch(\"http://\" + location.hostname + \":\" + location.port + \"/intensity/-\" + intensityIncrement, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n }\n })\n .then(\n function (response) {\n HandleResponse(response)\n }\n )\n .catch(function (err) {\n console.log('Fetch Error :-S', err);\n });\n}", "title": "" }, { "docid": "aa329b83c4f875773f9bb79c4be10fdd", "score": "0.52505064", "text": "function rxFetchUserCount() {\n logger.info(`shortDelay: ${shortDelay} shortUpdateDuration:${shortUpdateDuration}`);\n rx.Observable.timer(shortDelay, shortUpdateDuration).flatMap(() => {\n logger.info(`[time task] rxFetchUserCount :::`);\n return user.getUserCount();\n }).subscribe(data => {\n logger.info(`[time task] fetch user count next ${JSON.stringify(data)}`);\n global.userCount = data;\n ServerConfig.userCount = data;\n }, error => {\n logger.error(`[time task] fetch user count error ${error}`);\n })\n}", "title": "" }, { "docid": "01758fc7e3433eb695bee1e9467076b5", "score": "0.5218012", "text": "function InvocationCounter() {\r\n}", "title": "" }, { "docid": "e3409c74af7c4353a09e3873ecbaeb6e", "score": "0.5216754", "text": "function sum(req, res) {\n var id = req.swagger.params.id.value;\n var n = req.swagger.params.n.value;\n var backend = req.locals.backend;\n if (!backend) {\n res.status(500).json({message: 'backend is null'});\n return;\n }\n log.debug('sum/id:%s/n:%s', id, n);\n backend.addAndGet(id, n, function addAndGetCallback(err, new_counter) {\n if (err) {\n log.error(err, 'failed to increase counter %s by %d : %s', id, n, err);\n res.status(502).json({message:'backend error: ' + err});\n } else {\n log.info('new sum for id %s is %d', id, new_counter);\n res.json({id:id, value:new_counter});\n }\n });\n}", "title": "" }, { "docid": "379f2b29082cf6e7d7de4777eb3f62fa", "score": "0.52029234", "text": "async function createCounter(value) {\n console.log(\"models\", value);\n console.log(\"models\", value.counter);\n console.log(\"models\", value.zero);\n const res = await query(\n `INSERT INTO counters (counter, count)\n values ($1, $2)`,\n [value.counter, value.zero]\n );\n return res;\n}", "title": "" }, { "docid": "5fe02845131e0da8b74252dcc5116951", "score": "0.51964366", "text": "function increaseCounter(){\n countNbCall++;\n if(debug){logCounter(countNbCall);}\n return countNbCall;\n }", "title": "" }, { "docid": "364126f042841803389824331a7573a9", "score": "0.5194313", "text": "static get data() {\n return { numcount:[] }\n }", "title": "" }, { "docid": "cb9a817df75ee6ad9c7f5afd9a295934", "score": "0.5180463", "text": "getCountAsync () {\n return new Promise((resolve, reject) => {\n this.getCount(function (err, data) {\n if (err) return reject(err)\n resolve(data)\n })\n })\n }", "title": "" }, { "docid": "e0aa2b722f137e6909d750c1336eab6d", "score": "0.5174338", "text": "count() {}", "title": "" }, { "docid": "633a481f827b326f12ca6801b00ce1c8", "score": "0.5173923", "text": "async function incrementCounter(id) {\n const res = await query(\n `UPDATE counters\n SET count = count + 1\n WHERE id = ${id}`\n );\n console.log(\"models - increment counter\", id);\n return res;\n}", "title": "" }, { "docid": "db2d5674fb446d5019bea2e3a7511d6f", "score": "0.51713353", "text": "function on_counter (args) {\n\n var counter = args[0];\n var id = args[1];\n var type = args[2];\n\n console.log(\"-----------------------\");\n console.log(\"on_counter event, counter value: \", counter);\n console.log(\"from component \" + id + \" (\" + type + \")\");\n\n }", "title": "" }, { "docid": "a4e900a624f4b8f0de9b6f710986ced2", "score": "0.51671845", "text": "function clickCounter() {\n\tajax_view = new XMLHttpRequest();\n\tajax_view.open('POST', './php/click_counter.php', true);\n\tajax_view.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n\tajax_view.send();\n\tajax_view.onreadystatechange = function() {\n\t\tif (this.readyState == 4 && this.status == 200) {\n\t\t\tvar result = JSON.parse(this.responseText);\n\t\t\tvar biz_click = document.querySelector('#' + biz_id);\n\t\t\tbiz_click.onclick = function() {\n\t\t\t\tviewCounter();\n\t\t\t};\n\t\t\tfor (var i = 0; i < result.length && i < offset; i++) {\n\t\t\t\tvar biz_view_cnt = result[i].biz_view_cnt;\n\t\t\t\tfunction viewCounter() {\n\t\t\t\t\tbiz_view_cnt += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n}", "title": "" }, { "docid": "fb5f28196d3e3be87deed1cb349dbd6e", "score": "0.51576823", "text": "async findORCreateDayTimeFrame(res, resDate, bank, branch, service) {\r\n var counters = [];\r\n\r\n var timeFramesRef = database.getDocumentFromCollection(bank, branch).collection('TimeFrames');\r\n var day, month, year;\r\n day = resDate.getDate();\r\n month = resDate.getMonth() + 1;\r\n year = resDate.getFullYear();\r\n\r\n var servicesSnapShot = await database.getCollection('Services').where('Service Name', '==', service).get()\r\n\r\n if (servicesSnapShot.empty)\r\n return res.status(500).json({ error: \"The service is unavailable in all counters\" });\r\n\r\n var countersRef = await database.getDocumentFromCollection(bank, branch).collection('Counters').get()\r\n\r\n for (let counterSnap of countersRef.docs) {\r\n var timeFrameOnDate = await timeFramesRef.where('day', '==', day).where('month', '==', month).where('year', '==', year).get()\r\n if (timeFrameOnDate.empty) {\r\n try {\r\n var createdTimeSlots = await this.createDayTimeFrame(bank, branch, service);\r\n counters.push({ 'counterId': counterSnap.id, 'timeSlots': createdTimeSlots });\r\n }\r\n catch (error) {\r\n console.log(error, \" -- returnAvailableSlots route\")\r\n return res.status(500).json({ error: \"Something went wrong, try again later\" })\r\n }\r\n\r\n } else {\r\n try {\r\n var counterTimeSlots = await this.findCounterTimeSlots(bank, branch, timeFrameOnDate, service, counterSnap.id);\r\n counters.push({ 'counterId': counterSnap.id, 'timeSlots': counterTimeSlots });\r\n }\r\n catch (error) {\r\n console.log(error, \" -- returnAvailableSlots route\")\r\n return res.status(500).json({ error: \"Something went wrong, try again later\" })\r\n }\r\n }\r\n }\r\n\r\n return res.status(200).json(counters)\r\n }", "title": "" }, { "docid": "e4ba160b69a03088828424b0c55ea01e", "score": "0.51557976", "text": "save(counters) {\n if (this._client == null)\n return;\n let dimensions = [];\n dimensions.push({\n Name: \"InstanceID\",\n Value: this._instance\n });\n let now = new Date();\n let data = [];\n counters.forEach(counter => {\n data.push(this.getCounterData(counter, now, dimensions));\n if (data.length >= 20) {\n async.series([\n (callback) => {\n this._client.putMetricData(params, function (err, data) {\n if (err) {\n if (this._logger)\n this._logger.error(\"cloudwatch_counters\", err, \"putMetricData error\");\n }\n callback(err);\n });\n },\n (callback) => {\n data = [];\n callback();\n }\n ]);\n }\n });\n var params = {\n MetricData: data,\n Namespace: this._source\n };\n if (data.length > 0) {\n this._client.putMetricData(params, function (err, data) {\n if (err) {\n if (this._logger)\n this._logger.error(\"cloudwatch_counters\", err, \"putMetricData error\");\n }\n });\n }\n }", "title": "" }, { "docid": "e076317146af80166e312208d863e8f1", "score": "0.51509315", "text": "getBugCounts() {\n for (const query of this.config.bugQueries) {\n // Use an inner `async` so the loop continues\n (async () => {\n const { bug_count } = await this.getJSON(`${query.url}&count_only=1`);\n\n if (bug_count !== undefined) {\n query.count = bug_count;\n this.displayCount(query);\n }\n })();\n }\n }", "title": "" }, { "docid": "20cabaad718558efc03013cacd76f433", "score": "0.5149165", "text": "function counter(state, action) {\n if (typeof state === 'undefined') {\n return 0;\n }\n\n switch (action.type) {\n case 'INCREMENT':\n return state + 1;\n\n case 'DECREMENT':\n console.log(\"decress by 5 and axio\")\n console.log(state);\n return state - 5;\n\n // case 'SELECT_1ST_LOCATION':\n\n\n\n default:\n return state;\n }\n}", "title": "" }, { "docid": "4dac896e2220437500d5a6d831182c2b", "score": "0.5148525", "text": "constructor(endpoint, calls = ['list', 'getById', 'create', 'update', 'remove']) {\n this.endpoint = endpoint;\n this.calls = calls;\n }", "title": "" }, { "docid": "64069dcb3baca1c6fb3e7d7807b74e63", "score": "0.51481897", "text": "getCount(options,callback=()=>{}) {\n let params = { method: 'POST', body: JSON.stringify(options), headers: {'Content-Type':'application/json'}};\n Backend.request('/api/'+this.itemName+'/count',params, function(error,response) {\n if (error) {\n callback(error,0);\n return;\n }\n if (!response || response.status !== 200) {\n callback(null,0);\n return;\n }\n response.text().then(function(text) {\n if (!isNaN(text)) {\n callback(null,parseInt(text,10));\n } else {\n callback(null,0);\n }\n }).catch(function() {\n callback(null, 0);\n })\n })\n }", "title": "" }, { "docid": "db99995605b0953bf5254bb1be1b998e", "score": "0.5132265", "text": "function getCount(req, res, next) {\n db.query(\"SELECT COUNT(*) FROM entreprises\", function (errors, results, fields) {\n if (errors) {\n console.log(errors)\n res.status(500)\n .json({\n status: \"ko\",\n data: \"error\"\n })\n }\n res.status(200)\n .json({\n status: \"ok\",\n data: results[0]\n })\n });\n}", "title": "" }, { "docid": "9442812c0d9fdbf30105e26240082769", "score": "0.51297", "text": "static async apiGetAccidentsWhereCount(res,req){\n const data = await req.on('data',function (data){\n options = JSON.parse(data);\n });\n console.log(options);\n try {\n const accidents = await AccidentService.getAccidentsWhereCount(options);\n res.write(JSON.stringify(accidents));\n }catch (error){\n console.log(`ERROR : ${error.message}`);\n res.statusCode = 500;\n }\n }", "title": "" }, { "docid": "931132b6f2876043a9a21164d7db231b", "score": "0.51266414", "text": "getClientCalls() {\n\n }", "title": "" }, { "docid": "ec2a5588becea7ddab59ee712609e03d", "score": "0.5126011", "text": "function getCounts() {\n return Promise.all([\n redisCommand('get', MUTANT),\n redisCommand('get', HUMAN)\n ])\n}", "title": "" }, { "docid": "155e3dd1ab23a7a1b1027ad1fdbac4dc", "score": "0.51219887", "text": "get count() {}", "title": "" }, { "docid": "daa35e02d249f1f6ca1879f5b7c0c2cc", "score": "0.51124436", "text": "count(req, res, next) {\n let { success, code } = checkValidation(req, paramValidation.count)\n if (!success) {\n return res.status(422).send(responseCreator(code))\n }\n req.query = convertData(req.query, dataConverts.count)\n next();\n }", "title": "" }, { "docid": "1a6d14f5e6ff84ef7ff693191b1c05d4", "score": "0.5109976", "text": "function getLoginCounter()\n{\n //get the counter of loggedPeople\n $.ajax({\n type: \"POST\",\n url: serviceLink + \"/getLoginCounter\",\n async: false,\n\n success: function (data) {\n\n return data.d;\n\n },\n error: function (er) {\n alert('error:' + JSON.stringify(er));\n }\n });\n}", "title": "" }, { "docid": "07e7e754bdf5ce1664ec24abcaf2299f", "score": "0.5107185", "text": "async function getPhotos()\n{\n try{\n const response=await fetch(apiUrl);\n photosArray=await response.json();\n displayPhotos(); \n if (isInitialLoad) { \n updateAPIURLWithNewCount(30);\n isInitialLoad = false;\n }\n\n }catch(error)\n {\n\n }\n}", "title": "" }, { "docid": "e84b3827e21b6ffc4c47920e80c4cb54", "score": "0.51004916", "text": "static async getUserCounts(req, res, next) {\n try {\n const counts = await this.database.getUserCounts();\n return res.send(counts);\n } catch (error) {\n next(error);\n }\n }", "title": "" }, { "docid": "0afd54b527e297e89da418bbb4d80e48", "score": "0.50995237", "text": "async function fetch(url, tryNextKey = keysCount, rotating = false) {\n function rotateKeys(err) {\n if (tryNextKey > 0) {\n if (err.isAxiosError && err.response) {\n if (err.response.status === 403) {\n if (maybePromise === null || rotating) {\n currentKey = (currentKey + 1) % keysCount;\n maybePromise = fetch(url, tryNextKey - 1, true).finally(() => {\n maybePromise = null;\n });\n return maybePromise;\n } else {\n return maybePromise.then(() => fetch(url, 0, false));\n }\n }\n }\n }\n\n throw err;\n }\n\n api.defaults.headers.Authorization = `Bearer ${keys[currentKey]}`;\n\n const count = counterFetch.get();\n if (!rotating) {\n const countStr = count.toString().padStart(6, \" \");\n logger.info(`[${countStr}]: ${url}`);\n }\n\n return await api.get(url).catch(rotateKeys).catch(catchSafeErrors);\n}", "title": "" }, { "docid": "6bfe5253878bf8d75c4542e8207de110", "score": "0.5096734", "text": "function GetNumberOfCalls(){\n\n const calls = useSelector(state => state.calls.calls);\n const dispatch = useDispatch();\n\n // query the DB for changes\n useFirestoreCollection({\n query: () => getCallsFromDB(),\n data: calls => dispatch(loadData(calls)),\n deps: [dispatch]\n });\n\n return calls.length;\n\n}", "title": "" }, { "docid": "857af5608c73f1a0f133c03d1dd3506a", "score": "0.5082023", "text": "function incrRequestCounterWaypoint(index) {\n\t\trequestCounterWaypoints[index]++;\n\t}", "title": "" }, { "docid": "c353307e153d6b7b5599e3a38158e571", "score": "0.5080044", "text": "afterCount(result, params) {\n console.log(\"Hereeeeeeeeeee 10\");\n }", "title": "" }, { "docid": "6c21ab2008c11dfda81f664548cdb021", "score": "0.5079737", "text": "countBlackList(req, res) {\n // Count the hits\n config.TOTAL_HITS++;\n\n CpfsModel.count({ where: {'blackList': \"block\" }}).then(blackList => {\n return res.status(200).json({cpfAtBlackList: blackList});\n });\n }", "title": "" }, { "docid": "93fd6ccf1b47db113f856eacc8321a17", "score": "0.50769377", "text": "incrGet(key, value = null, on_response = empty_fun) {\n let cb = function(resp) {\n on_response(parseInt(resp.getValue()));\n };\n (null === value) ?\n this.httpPost('get-incr', cb, key ) :\n this.httpPost('get-incr', cb, `${key}\\n${value}` );\n }", "title": "" }, { "docid": "84a34feeb0a6ecb27b35577da2a88954", "score": "0.50750554", "text": "function tapCounterFunc(tapCounter){\n tapCounter.counter++;\n }", "title": "" }, { "docid": "237281dd21554add1683ff34a997e783", "score": "0.5071638", "text": "function getUnreadCount() {\n console.log('getUnreadCount');\n var xhr = new XMLHttpRequest ();\n xhr.onreadystatechange = function () {\n if ( this.readyState == 4 ) {\n switch ( this.status ) {\n case 200:\n var json = JSON.parse(xhr.responseText);\n setUnreadCount(json.unreadcounts[0] != null ? json.unreadcounts[0].count : 0);\n break;\n case 401: // Unauthorized\n setError(this.statusText);\n break;\n }\n }\n }\n xhr.open('GET', BAZ_QUX_URL, false );\n xhr.send();\n}", "title": "" }, { "docid": "f2aaeed5f3061ac7a65cec50df15bfac", "score": "0.5070293", "text": "function getCountersState() {\n return {\n counters: store.getAll()\n };\n}", "title": "" }, { "docid": "029733159d0d8f2fecc4a5e4ccfebe55", "score": "0.50677496", "text": "getIntents(botId) {\n try {\n //setting the selected bot\n this.bot = this.bot_list.filter(x => x.id == this.selectedBotId)[0];\n //getting the language\n this.bot_language = this.bot.bot_language;\n //clearing values\n this.allRecords = [];\n this.tableRecords = [];\n this.intentList = [];\n this.totalRecords = 0;\n this.api.getIntentCount(this.selectedBotId).then(numberOfRecords => {\n this.numberOfRecords = numberOfRecords;\n this.botSelected = true;\n if(this.numberOfRecords <= 0) {\n this.countLabel = \"The selected bot has no intents\";\n }\n else {\n this.countLabel = \"\";\n //setting the number of petitions to make to the backend depending of the number of records of variables\n this.numberOfPetitions = (this.numberOfRecords / this.recordsPerPetition)+1;\n if (this.numberOfPetitions == 0) {\n this.numberOfPetitions = 1;\n }\n //start getting the records\n for(let iteration = 0; iteration < this.numberOfPetitions;iteration++) {\n let inf_limit = this.recordsPerPetition * iteration;\n let sup_limit = inf_limit + this.recordsPerPetition;\n this.api.getBotIntents(this.selectedBotId,inf_limit,sup_limit).then(response => {\n //getting all the contacts from the logged Messages\n for(let n = 0;n<response.intents.length;n++) {\n let record = response.intents[n];\n this.addRecord(\n record.id,\n record.bot_id,\n record.context_id,\n record.name\n );\n }\n this.totalRecords = this.tableRecords.length;\n this.hasRecords = true;\n });\n }\n }\n });\n }\n catch(err) {\n console.log(err);\n }\n }", "title": "" }, { "docid": "dba97703c8a382505c5c04548dca2768", "score": "0.5066894", "text": "function Counter(base = 0) {\n var _count = base\n return {\n increment: () => {_count += 1},\n get : () => _count,\n decrement: () => {_count -= 1}\n }\n\n}", "title": "" }, { "docid": "29fb59197d14e63e9c15549eaf53d845", "score": "0.5066026", "text": "async function getPhotos() {\n try {\n let response = await fetch(apiUrl);\n photosArray = await response.json();\n displayPhotos();\n if(isInitialLoad){ //18\n updateAPIURLWithNewCount(30);\n isInitialLoad = false;\n } \n } catch (error) {\n //Catch Error Here\n \n }\n\n}", "title": "" }, { "docid": "d7c103ad53418bf12dbd1324070114a8", "score": "0.50611687", "text": "function get_counters(o, name) {\n var c = o.sections[name];\n if (!c) {\n c = {\"reqtotal\":0, \"reqtransf\":0, \"reqcached\":0,\n \"kbtotal\":0, \"kbtransf\":0, \"kbcached\":0};\n o.sections[name] = c;\n }\n return c;\n}", "title": "" } ]
15dd29c29947e97fc9fcba590dceb19d
format date using native date object
[ { "docid": "2923086ff129513837f903d316046337", "score": "0.0", "text": "function formatMoment(m, format) {\n if (!m.isValid()) {\n return m.localeData().invalidDate();\n }\n\n format = expandFormat(format, m.localeData());\n formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);\n\n return formatFunctions[format](m);\n}", "title": "" } ]
[ { "docid": "8c834698947346468ac9465182b4f277", "score": "0.75320816", "text": "formatDate(date) {\n\t\treturn date.toString()\n\t\t.replace(/(\\d{4})(\\d{2})(\\d{2})/, (string, year, month, day) => `${year}-${month}-${day}`);\n\t}", "title": "" }, { "docid": "b86f1aa91822834ecdc9448850991424", "score": "0.7421278", "text": "static formatDate(date) {\n return new Date(date).toLocaleDateString();\n }", "title": "" }, { "docid": "d729bf77a7d7e72be822aa9d866a358b", "score": "0.7386446", "text": "formatTheDate(date, format) {\n const [ year, month, day ] = (date.toISOString()).substr(0, 10).split('-');\n return dateFns.format(new Date(\n year,\n (month - 1),\n day,\n ), format);\n }", "title": "" }, { "docid": "c6c923c5ad684b47d7787f242b4886bb", "score": "0.7386206", "text": "function formatDate(obj) {\n const date = new Date(obj.date).toLocaleString(\"default\", {\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n });\n obj.date = date;\n return obj;\n}", "title": "" }, { "docid": "5fd2e791585a156fad0c81ad17f8b076", "score": "0.73497903", "text": "function formatDate(date) {\n return format(new Date(date), 'yyyy-MM-dd')\n}", "title": "" }, { "docid": "59800b3c875543eb508e1113effd817a", "score": "0.7336332", "text": "getFormattedDate(date) {\n return dayjs(date).format(\"MMM MM, YYYY\");\n }", "title": "" }, { "docid": "087217e9f59e73926e4111327407f3e0", "score": "0.73048234", "text": "function formatDate(date) {\n var d = new Date(date);\n d = d.toLocaleString();\n return d;\n }", "title": "" }, { "docid": "4baa5c9fa189fada4204daa39f279644", "score": "0.7300858", "text": "function formatDate(d) {\n return `${d.year}-${d.month}-${d.day}`\n }", "title": "" }, { "docid": "a4fc1d335d8683cfac98297d3990daf6", "score": "0.7292591", "text": "_format(dtf, date) {\n // Passing the year to the constructor causes year numbers <100 to be converted to 19xx.\n // To work around this we use `setUTCFullYear` and `setUTCHours` instead.\n const d = new Date();\n d.setUTCFullYear(date.getFullYear(), date.getMonth(), date.getDate());\n d.setUTCHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());\n return dtf.format(d);\n }", "title": "" }, { "docid": "a4fc1d335d8683cfac98297d3990daf6", "score": "0.7292591", "text": "_format(dtf, date) {\n // Passing the year to the constructor causes year numbers <100 to be converted to 19xx.\n // To work around this we use `setUTCFullYear` and `setUTCHours` instead.\n const d = new Date();\n d.setUTCFullYear(date.getFullYear(), date.getMonth(), date.getDate());\n d.setUTCHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());\n return dtf.format(d);\n }", "title": "" }, { "docid": "a4fc1d335d8683cfac98297d3990daf6", "score": "0.7292591", "text": "_format(dtf, date) {\n // Passing the year to the constructor causes year numbers <100 to be converted to 19xx.\n // To work around this we use `setUTCFullYear` and `setUTCHours` instead.\n const d = new Date();\n d.setUTCFullYear(date.getFullYear(), date.getMonth(), date.getDate());\n d.setUTCHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());\n return dtf.format(d);\n }", "title": "" }, { "docid": "f1673c79506c980fe6a16c4108fb00a0", "score": "0.7221218", "text": "function _getFormattedDate(date) {\n var year = date.getFullYear();\n var month = (1 + date.getMonth()).toString();\n month = month.length > 1 ? month : '0' + month;\n var day = date.getDate().toString();\n day = day.length > 1 ? day : '0' + day;\n return month + '/' + day + '/' + year;\n }", "title": "" }, { "docid": "f719c9ec12e15ff58eafb359abae77cc", "score": "0.7213261", "text": "function formatDate(date, format) {\n return format\n .replace(/yyyy/i, util_toString(date.getFullYear()))\n .replace(/MM/i, lpad(date.getMonth() + 1))\n .replace(/M/i, util_toString(date.getMonth()))\n .replace(/dd/i, lpad(date.getDate()))\n .replace(/d/i, util_toString(date.getDate()));\n}", "title": "" }, { "docid": "36335a69435d3343c9b226b5bb2b2010", "score": "0.7210653", "text": "function formatDate(date) {\n var day = date.getDate();\n var month = date.getMonth() + 1; //Months are zero based\n var year = date.getFullYear();\n var formattedDate = year + \"-\" + month + \"-\" + day;\n return formattedDate;\n }", "title": "" }, { "docid": "394273d61f44227789e59f106a0e16a6", "score": "0.7188191", "text": "function formatDate(date) {\n\tif (date == null) {\n\t\treturn null;\n\t}\n\tvar d = date.getDate();\n\tvar m = date.getMonth() + 1;\n\tvar y = date.getFullYear();\n\treturn '' + (d <= 9 ? '0' + d : d) + '-' + (m <= 9 ? '0' + m : m) + '-' + y;\n}", "title": "" }, { "docid": "bc510902f64f9f82f27f5a892b982b9f", "score": "0.71826464", "text": "function formatDate(date) {\n let source = new Date(date);\n let day = source.getDate();\n let month = source.getMonth() + 1;\n let year = source.getFullYear();\n\n return `${day}/${month}/${year}`;\n }", "title": "" }, { "docid": "8b23d3585ef5fc2592def305b998fe07", "score": "0.71783525", "text": "function formatDate(date) {\n\treturn new Date(date.split(' ').join('T'))\n}", "title": "" }, { "docid": "ef9106ae703255a23f9f03fb6977052f", "score": "0.71683335", "text": "function formatDate(date) {\r\n date = new Date(date);\r\n let DD = date.getDate();\r\n if (DD < 10) {\r\n DD = \"0\" + DD;\r\n }\r\n let MM = date.getMonth() +1;\r\n if (MM < 10) {\r\n MM = \"0\" + MM;\r\n }\r\n const YYYY = date.getFullYear();\r\n return DD + \"/\" + MM + \"/\" + YYYY;\r\n }", "title": "" }, { "docid": "0e530642be499f99efb0753fee49254a", "score": "0.71673006", "text": "getFormattedDate(date) {\n const year = date.getFullYear();\n const month = (date.getUTCMonth() + 1).toString().padStart(2, '0');\n const day = (date.getUTCDate()).toString().padStart(2, '0');\n // Logger.log(`Day: ${day}, Month: ${month}, Year:${year}`)\n const dateFormatted = `${year}-${month}-${day}`;\n return dateFormatted;\n }", "title": "" }, { "docid": "10b427fc7b4ad5a5753883df120c9b70", "score": "0.71582985", "text": "function formatDate(date) {\n \n var dd = date.getDate();\n if (dd < 10) {\n dd = '0' + dd;\n }\n \n var mm = date.getMonth() + 1;\n if (mm < 10) {\n mm = '0' + mm;\n }\n \n var yy = date.getFullYear();\n if (yy < 10) {\n yy = '0' + yy;\n }\n \n return mm + '/' + dd + '/' + yy;\n }", "title": "" }, { "docid": "1d22b49d450c9a592f19f615b491d9d1", "score": "0.7136396", "text": "function formatDate(date) {\r\n\r\n let dd = date.getDate();\r\n if (dd < 10) dd = '0' + dd;\r\n\r\n let mm = date.getMonth() + 1;\r\n if (mm < 10) mm = '0' + mm;\r\n\r\n let yy = date.getFullYear() % 100;\r\n if (yy < 10) yy = '0' + yy;\r\n\r\n return dd + '.' + mm + '.' + yy;\r\n}", "title": "" }, { "docid": "f650fde7df61ae8e0421cac775d39b4c", "score": "0.71351296", "text": "function formatDate(date) {\r\n date = new Date(date);\r\n let DD = date.getDate();\r\n if (DD < 10) {\r\n DD = \"0\" + DD;\r\n }\r\n let MM = date.getMonth() +1;\r\n if (MM < 10) {\r\n MM = \"0\" + MM;\r\n }\r\n const YYYY = date.getFullYear();\r\n return DD + \"/\" + MM + \"/\" + YYYY;\r\n}", "title": "" }, { "docid": "4509f5718ac50df1b4f4dcbdcea761d3", "score": "0.7116119", "text": "function formatDate(date){\n\t\tvar formatted = {\n\t\t\tdate:date,\n\t\t\tyear:date.getFullYear().toString().slice(2),\n\t\t\tmonth:s.months[date.getMonth()],\n\t\t\tmonthAbv:s.monthsAbv[date.getMonth()],\n\t\t\tmonthNum:date.getMonth() + 1,\n\t\t\tday:date.getDate(),\n\t\t\tslashDate:undefined,\n\t\t\ttime:formatTime(date)\n\t\t}\n\t\tformatted.slashDate = formatted.monthNum + '/' + formatted.day + '/' + formatted.year;\n\t\treturn formatted;\n\t}", "title": "" }, { "docid": "2b198c512c23f480148fdec79fb525a3", "score": "0.7094242", "text": "function formatDate(date) {\n var day = (\"0\" + date.getDate()).slice(-2);\n var month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n var year = date.getFullYear().toString().slice(-2);\n return day + month + year;\n}", "title": "" }, { "docid": "4d30aa288f33095e6032dd4b2930ea96", "score": "0.706227", "text": "function formatDate(date,formatStr){return renderFakeFormatString(getParsedFormatString(formatStr).fakeFormatString,date);}", "title": "" }, { "docid": "a55d0edfe18ea61815ac21e49d39c92e", "score": "0.70609725", "text": "function formatDate(date)\n{\n g_date=date.getDate();\n if(g_date <=9)\n {\n g_date=\"0\"+g_date;\n }\n g_month=date.getMonth();\n g_year=date.getFullYear();\n if (g_year < 2000) g_year += 1900;\n return todaysMonthName(date)+\" \"+g_date+\", \"+g_year;\n}", "title": "" }, { "docid": "9f9e6b570b92d8139d528a1cb02d2e9a", "score": "0.704927", "text": "_stringify(date){\n date = date.toLocaleDateString();\n return date;\n }", "title": "" }, { "docid": "e5d0e27c7c97911acbc308ee222d7d8b", "score": "0.7048684", "text": "function getFormattedDate(date) {\n return $filter('date')(date, 'yyyy-MM-dd');\n }", "title": "" }, { "docid": "6d7178b3506caf7cb4511c0118b3cdd7", "score": "0.703367", "text": "function formatDate(date, format){\n if(!date){\n return '0000-00-00';\n }\n var dd = date.substring(0, 2);\n var mm = date.substring(3, 5);\n var yy = date.substring(6);\n if (format == 'dmy') {\n return dd + '-' + mm + '-' + yy;\n } else {\n return yy + '-' + mm + '-' + dd;\n }\n }", "title": "" }, { "docid": "d3ad859e48950ba6ba286d174a62fa46", "score": "0.70264095", "text": "formatDate (date){\n var d = new Date(date),\n month = (d.getMonth() + 1),\n day = d.getDate(),\n year = d.getFullYear();\n if (month.length < 2)\n month = '0' + month;\n if (day.length < 2)\n day = '0' + day;\n return [year, month, day].join('-');\n }", "title": "" }, { "docid": "b04e78dc1b1916a9cff23a1dcb1bb01b", "score": "0.7026313", "text": "function formatDate(date) {\n var day = date.getDate();\n if (day < 10) {\n day = \"0\" + day;\n }\n\n var month = date.getMonth() + 1;\n if (month < 10) {\n month = \"0\" + month;\n }\n\n var year = date.getFullYear();\n\n return day + \".\" + month + \".\" + year;\n}", "title": "" }, { "docid": "4505fc011b1f3fbc0b76867dc42b6aee", "score": "0.7015168", "text": "function convertToFormat (dateObj, dateFormat) {\r\n var month = dateObj.getMonth() + 1;\r\n var date = dateObj.getDate();\r\n var year = dateObj.getFullYear();\r\n var dateString;\r\n switch (dateFormat) {\r\n case 'yyyy.m.d':\r\n dateString = year + '.' + month + '.' + date;\r\n break;\r\n case 'yyyy-m-d':\r\n dateString = year + '-' + month + '-' + date;\r\n break;\r\n case 'yyyy/m/d':\r\n dateString = year + '/' + month + '/' + date;\r\n break;\r\n case 'yyyy/mm/dd':\r\n dateString = year + '/' + _makeTwoDigits(month) + '/' + _makeTwoDigits(date);\r\n break;\r\n case 'dd/mm/yyyy':\r\n dateString = _makeTwoDigits(date) + '/' + _makeTwoDigits(month) + '/' + year;\r\n break;\r\n case 'dd-mm-yyyy':\r\n dateString = _makeTwoDigits(date) + '-' + _makeTwoDigits(month) + '-' + year;\r\n break;\r\n case 'd-m-yyyy':\r\n dateString = date + '-' + month + '-' + year;\r\n break;\r\n case 'd/m/yyyy':\r\n dateString = date + '/' + month + '/' + year;\r\n break;\r\n case 'd/mm/yyyy':\r\n dateString = date + '/' + _makeTwoDigits(month) + '/' + year;\r\n break;\r\n case 'dd.mm.yyyy':\r\n dateString = _makeTwoDigits(date) + '.' + _makeTwoDigits(month) + '.' + year;\r\n break;\r\n case 'm/d/yyyy':\r\n dateString = month + '/' + date + '/' + year;\r\n break;\r\n default:\r\n dateString = _makeTwoDigits(date) + '.' + _makeTwoDigits(month) + '.' + year;\r\n }\r\n return dateString;\r\n }", "title": "" }, { "docid": "29aea0dc73037038d259584a89cb51a0", "score": "0.7003348", "text": "function formatDate(){\n if (!Date.prototype.toISODate) {\n Date.prototype.toISODate = function() {\n return this.getFullYear() + '-' +\n ('0'+ (this.getMonth()+1)).slice(-2) + '-' +\n ('0'+ this.getDate()).slice(-2);\n }\n }\n }", "title": "" }, { "docid": "69edaa90de66fb058e5090cbc345d5a7", "score": "0.6994713", "text": "function formatDate(date) {\n const d = new Date(date);\n return d.getFullYear() + \"-\" + twoDigits(d.getMonth() + 1) + \"-\" + twoDigits(d.getDate());\n}", "title": "" }, { "docid": "1f026bc60f179a71e40b7d1c501abc67", "score": "0.6985144", "text": "function formattedDate(d) {\n let month = String(d.getMonth() + 1);\n let day = String(d.getDate());\n const year = String(d.getFullYear());\n\n if (month.length < 2) month = '0' + month;\n if (day.length < 2) day = '0' + day;\n\n return `${year}-${month}-${day}`;\n }", "title": "" }, { "docid": "296b0861191e54baed4be608943331e2", "score": "0.6984923", "text": "function formatDate(d) {\n if (d === undefined){\n d = (new Date()).toISOString()\n }\n let currDate = new Date(d);\n let year = currDate.getFullYear();\n let month = currDate.getMonth() + 1;\n let dt = currDate.getDate();\n let time = currDate.toLocaleTimeString('en-SG')\n\n if (dt < 10) {\n dt = '0' + dt;\n }\n if (month < 10) {\n month = '0' + month;\n }\n\n return dt + \"/\" + month + \"/\" + year + \" \" + time ;\n }", "title": "" }, { "docid": "a032ab131febf762e5e27e4dd33d0e9f", "score": "0.69840693", "text": "function formattedDate(date) {\r\n\t\t\t\t\tvar d = new Date(date),\r\n\t\t\t\t\t\tmonth = '' + (d.getMonth() + 1),\r\n\t\t\t\t\t\tday = '' + d.getDate(),\r\n\t\t\t\t\t\tyear = d.getFullYear();\r\n\r\n\t\t\t\t\tif (month.length < 2) month = '0' + month;\r\n\t\t\t\t\tif (day.length < 2) day = '0' + day;\r\n\t\t\t\t\treturn [year, month, day].join('-');\r\n\t\t\t\t}", "title": "" }, { "docid": "46e008cbc24c703cf83b183c4ea617e9", "score": "0.6977675", "text": "function getFormattDate(date) {\n let month = (1 + date.getMonth()).toString();\n month = month.length > 1 ? month : \"0\" + month;\n\n let day = date.getDate().toString();\n day = day.length > 1 ? day : \"0\" + day;\n\n return (date.getFullYear() + \"-\" + month + \"-\" + day);\n}", "title": "" }, { "docid": "46e008cbc24c703cf83b183c4ea617e9", "score": "0.6977675", "text": "function getFormattDate(date) {\n let month = (1 + date.getMonth()).toString();\n month = month.length > 1 ? month : \"0\" + month;\n\n let day = date.getDate().toString();\n day = day.length > 1 ? day : \"0\" + day;\n\n return (date.getFullYear() + \"-\" + month + \"-\" + day);\n}", "title": "" }, { "docid": "af6727136c431ef3ef37cade30bba3e3", "score": "0.6977597", "text": "function formatDate(date) {\r\n var d = date ? new Date(date) : new Date()\r\n month = '' + (d.getMonth() + 1),\r\n day = '' + d.getDate(),\r\n year = d.getFullYear();\r\n if (month.length < 2)\r\n month = '0' + month;\r\n if (day.length < 2)\r\n day = '0' + day;\r\n\r\n return `${day}${month}${year}`;\r\n}", "title": "" }, { "docid": "3b57bd16cfeb038744b5cc1a2dc5c635", "score": "0.69757605", "text": "function _formatDate(date) {\n\t//remove timezone GMT otherwise move time\n\tvar offset = date.getTimezoneOffset() * 60000;\n\tvar dateFormatted = new Date(date - offset);\n dateFormatted = dateFormatted.toISOString();\n if (dateFormatted.indexOf(\"T\") > 0)\n dateFormatted = dateFormatted.split('T')[0];\n return dateFormatted;\n}", "title": "" }, { "docid": "e778fd9a5b1e1e62fe2bdf400337f40d", "score": "0.6975543", "text": "function formatDate(date) {\n const month = date.getMonth() + 1;\n const day = date.getDate();\n const year = date.getFullYear();\n \n return `${month}/${day}/${year}`;\n }", "title": "" }, { "docid": "fcbcd6d26100fc17d03d06d50f961ecc", "score": "0.6970286", "text": "function formatDate(date) {\r\n return date.getFullYear().toString() + (date.getMonth() + 1).toString().padStart(2, '0') + date.getDate().toString() \r\n + date.getHours().toString().padStart(2, '0') + date.getMinutes().toString().padStart(2, '0');\r\n }", "title": "" }, { "docid": "66c1314ce50103f8cc53391321a8cc23", "score": "0.6963518", "text": "function formatDate(date) {\n var dd = date.getDate()\n if (dd < 10) dd = '0' + dd;\n var mm = date.getMonth() + 1\n if (mm < 10) mm = '0' + mm;\n var yy = date.getFullYear();\n if (yy < 10) yy = '0' + yy;\n return dd + '.' + mm + '.' + yy;\n}", "title": "" }, { "docid": "a90dff2f7979078d8f9807f76d57dd8f", "score": "0.6961424", "text": "formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n if (month.length < 2) \n month = '0' + month;\n if (day.length < 2) \n day = '0' + day;\n return [year, month, day].join('-');\n }", "title": "" }, { "docid": "e6dca6e92433c9910cd4cea111756977", "score": "0.69570905", "text": "function formatDate(date) {\n // date is a date object\n const options = { year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC' };\n return date.toLocaleDateString('en-US', options);\n}", "title": "" }, { "docid": "cf51091068907ac92ff75cc741d33a40", "score": "0.69568783", "text": "function formatDate(date) {\n // date is a date object\n const options = { year: 'numeric', month: 'short', day: 'numeric', timeZone: 'UTC' };\n return date.toLocaleString('en-US', options);\n}", "title": "" }, { "docid": "5b5797da18d6ed105bbb4881b9dcb4da", "score": "0.69550544", "text": "function _date(obj) {\n return exports.PREFIX.date + ':' + obj.toISOString();\n}", "title": "" }, { "docid": "2c523f1deb3d83ffaf005d3e318db5bf", "score": "0.694989", "text": "function get_formatted_date(date) {\n function get_formatted_num(num, expected_length) {\n var str = \"\";\n var num_str = num.toString();\n var num_zeros = expected_length - num_str.length;\n for (var i = 0; i < num_zeros; ++i) {\n str += '0';\n }\n str += num_str;\n return str;\n }\n var msg = get_formatted_num(date.getFullYear(), 4) + \"-\";\n msg += get_formatted_num(date.getMonth() + 1, 2) + \"-\";\n msg += get_formatted_num(date.getDate(), 2) + \" \";\n msg += get_formatted_num(date.getHours(), 2) + \":\";\n msg += get_formatted_num(date.getMinutes(), 2) + \":\";\n msg += get_formatted_num(date.getSeconds(), 2);\n return msg;\n}", "title": "" }, { "docid": "e2c3dabcd3c4e53e8eb377c2777c05f6", "score": "0.6949591", "text": "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n \n if (month.length < 2) month = '0' + month;\n if (day.length < 2) day = '0' + day;\n \n return [year, month, day].join('-');\n }", "title": "" }, { "docid": "4e832dfad146acec0dff98cda62c4ee1", "score": "0.6942341", "text": "function formattedDate(date) {\n\n // Récupération\n var month = String(date.getMonth() + 1);\n var day = String(date.getDate());\n var year = String(date.getFullYear());\n\n // Ajout du 0\n if (month.length < 2) \n month = '0' + month;\n\n // Ajout du 0\n if (day.length < 2) \n day = '0' + day;\n\n return day+'/'+month+'/'+year;\n }", "title": "" }, { "docid": "3998c332092c29f9ee496da8f060bcf3", "score": "0.6942232", "text": "function formatDate(date,format) {\n if (!format){\n format = \"yyyy-MM-dd\";\n }\n if (date === null){\n return null;\n }\n if (!(date instanceof Date)){\n date = new Date(date);\n }\n let day = date.getDate();\n let month = date.getMonth();\n let year = date.getFullYear();\n let hour = date.getHours();\n let min = date.getMinutes();\n let sec = date.getSeconds();\n\n let str = format.replace(\"yyyy\",year)\n .replace(\"MM\",fillString(month+1,2,-1,\"0\"))\n .replace(\"dd\",fillString(day,2,-1,\"0\"))\n .replace(\"HH\",fillString(hour,2,-1,\"0\"))\n .replace(\"mm\",fillString(min,2,-1,\"0\"))\n .replace(\"ss\",fillString(sec,2,-1,\"0\"))\n ;\n return str;\n }", "title": "" }, { "docid": "1066648dd7094f65e9e0fbf08d1ac428", "score": "0.6940583", "text": "function prettyFormatDate(date) {\n return Utilities.formatDate(new Date(date), \"GMT-7\", \"MM/dd/yy\").toString();\n}", "title": "" }, { "docid": "36f5ecdc77f541279898733c4fe98207", "score": "0.69388914", "text": "function formatDate(date) {\n var newDate = new Date(date);\n var dd = newDate.getDate();\n var mm = newDate.getMonth() + 1; // January is 0!\n\n var yyyy = newDate.getFullYear();\n\n if (dd < 10) {\n dd = \"0\".concat(dd);\n }\n\n if (mm < 10) {\n mm = \"0\".concat(mm);\n }\n\n var formatedDate = \"\".concat(dd, \"/\").concat(mm, \"/\").concat(yyyy);\n return formatedDate;\n}", "title": "" }, { "docid": "0ca8f16b66cc80ef8487ccc578c6866c", "score": "0.6935119", "text": "function formatDate(date) {\n var day = date.getDate();\n var month = date.getMonth();\n var year = date.getFullYear();\n month++;\n if (month < 10)\n month = '0' + month;\n if (day < 10)\n day = '0' + day;\n return [year, month, day].join('-').toString();\n}", "title": "" }, { "docid": "996603203d1ecc5774068d4dd4d13d86", "score": "0.6934607", "text": "formatDate(date) {\n return date.toISOString().replaceAll(\"-\", \"\").substring(0, 8);\n }", "title": "" }, { "docid": "96cd2a7221579b913df5d0a9c88a08da", "score": "0.6933395", "text": "function formatDate(date) {\n\t\tvar day = date.getDate();\n\t\t\n\t\t// Add '0' if needed\n\t\tif (parseInt(day / 10) == 0) {\n\t\t\tday = \"0\" + day;\n\t\t}\n\t\t\n\t\tvar month = date.getMonth() + 1; // months start at 0\n\t\t\n\t\t// Add '0' if needed\n\t\tif (parseInt(month / 10) == 0) {\n\t\t\tmonth = \"0\" + month;\n\t\t}\n\t\t\n\t\tvar year = date.getFullYear();\n\t\t\n\t\treturn day + \"/\" + month + \"/\" + year;\n\t}", "title": "" }, { "docid": "7ab6a58b6da21b18f1c0aa9b1216a940", "score": "0.69221574", "text": "function formatDate(date) {\n\t\treturn (date.getMonth() + 1 + '/' + date.getDate() + '/' + date.getFullYear() + ' - ' + formatTime([date.getHours(), date.getMinutes()]));\n\t}", "title": "" }, { "docid": "a366e4a5b27f615860eabcf8fecb4d05", "score": "0.69161093", "text": "_convertDateObjToString(obj) {\n\n let date = \"\";\n\n if (obj && obj.day && obj.month && obj.year) {\n let month = String(obj.month);\n let day = String(obj.day);\n let year = String(obj.year);\n\n if (month.length < 2) {\n month = \"0\" + month;\n }\n\n if (day.length < 2) {\n day = \"0\" + day;\n }\n\n if (year.length < 4) {\n var l = 4 - year.length;\n for (var i = 0; i < l; i++) {\n year = \"0\" + year;\n }\n }\n date = year + \"-\" + month + \"-\" + day;\n }\n\n return date;\n }", "title": "" }, { "docid": "de95eaea46047d37b5a14b0d1eb982f4", "score": "0.6916095", "text": "function formatDate(date)\n{\n date = new Date(date * 1000);\n return '' + date.getFullYear() + '/' + lpad(date.getMonth(), 2, '0') + '/' + lpad(date.getDate(), 2, '0') + ' ' + lpad(date.getHours(), 2, '0') + ':' + lpad(date.getMinutes(), 2, '0');\n}", "title": "" }, { "docid": "3a30f318c640226a044fd73fad473ffa", "score": "0.69148", "text": "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n\n if (month.length < 2) {\n month = '0' + month;\n }\n if (day.length < 2) {\n day = '0' + day;\n }\n\n return [year, month, day].join('-');\n}", "title": "" }, { "docid": "b7c53f78bcf4805e5bad02f971422bcd", "score": "0.6909679", "text": "formatDate(x) {\n let date = new Date(x)\n let _month = date.getMonth() + 1 < 10 ? `0${date.getMonth() + 1}` : date.getMonth() + 1\n let _date = date.getDate() < 10 ? `0${date.getDate()}` : date.getDate()\n let _hour = date.getHours() < 10 ? `0${date.getHours()}` : date.getHours()\n let _minute = date.getMinutes() < 10 ? `0${date.getMinutes()}` : date.getMinutes()\n let _second = date.getSeconds() < 10 ? `0${date.getSeconds()}` : date.getSeconds()\n let dateStr = `${date.getFullYear()}-${_month}-${_date} ${_hour}:${_minute}:${_second}`\n return dateStr\n }", "title": "" }, { "docid": "170d1f5c56e85aaed12c63fce9984736", "score": "0.68973136", "text": "returnDateFormat(date){\n var day = new Date(date);\n return day.toDateString();\n }", "title": "" }, { "docid": "70e9db249540a924d019ef3aada08c3d", "score": "0.6889287", "text": "function formatDate (date) {\n if (date) {\n const year = date.getFullYear()\n const month = date.getMonth() + 1\n const day = date.getDate()\n return year + '-' + month.toString().padStart(2, '0') + '-' + day.toString().padStart(2, '0')\n } else {\n return ''\n }\n}", "title": "" }, { "docid": "06f17594464246da1845a6ab96e07a3a", "score": "0.68878007", "text": "formatDateTime(date, format) {\n date = new Date(date);\n var result = format || 'y-m-d h:i:s';\n result = result.replace('y', date.getFullYear());\n result = result.replace('m', this.pad(date.getMonth() + 1, 2));\n result = result.replace('d', this.pad(date.getDate(), 2));\n result = result.replace('h', this.pad(date.getHours(), 2));\n result = result.replace('i', this.pad(date.getMinutes(), 2));\n result = result.replace('s', this.pad(date.getSeconds(), 2));\n return result;\n }", "title": "" }, { "docid": "f1df3f210cfd36127a12153eeb787236", "score": "0.6875211", "text": "function formatDate(date) {\n var date = new Date(date * 1000);\n return `${date.getMonth() + 1}/${date.getDate()}/${date.getUTCFullYear()}`;\n}", "title": "" }, { "docid": "4fffcbee274e01e5e5096facbc8d54dd", "score": "0.68711346", "text": "static formatDate(date) {\n let formattedDate = '';\n\n formattedDate += date.getUTCFullYear();\n formattedDate += '-' + ('0' + (date.getUTCMonth() + 1)).substr(-2);\n formattedDate += '-' + ('0' + date.getUTCDate()).substr(-2);\n\n return formattedDate;\n }", "title": "" }, { "docid": "49ca9ca7ca67c6427c45343e20ec6a7f", "score": "0.6871014", "text": "formatted_date() {\n return this.created_at.toLocaleDateString()\n }", "title": "" }, { "docid": "a59fe4aa63f470e2a10694542058f0e4", "score": "0.68709546", "text": "function formatDate(date) {\n var year = date.getFullYear()\n var month = (1 + date.getMonth()).toString()\n var day = date.getUTCDate()\n return month + \"/\" + day + \"/\" + year\n}", "title": "" }, { "docid": "e5335341efa13cf6296b05686a50f5a1", "score": "0.68678564", "text": "function formatDate(date){\n var yr = date.getFullYear();\n var mnth = date.getMonth()+1;\n if(mnth < 10){\n mnth = `0${mnth}`;\n }\n var day = date.getDate()\n if(day < 10){\n day = `0${day}`;\n }\n return yr+\"-\"+mnth+\"-\"+day;\n}", "title": "" }, { "docid": "274e623a42ab9daaf0208154272ec97e", "score": "0.68650454", "text": "function formatDate(date){\n var dd = date.getDate(),\n mm = date.getMonth()+1, //January is 0!\n yyyy = date.getFullYear();\n\n if(dd<10) dd='0'+dd;\n if(mm<10) mm='0'+mm;\n\n return yyyy+'-'+mm+'-'+dd;\n}", "title": "" }, { "docid": "3901e67c1e072a8a129c06cbd75398cf", "score": "0.6862945", "text": "function dateformat(date) {\n \n // Main array that will be used to sort out the date.\n let dateArray = date.split('-');\n // Sorts days\n let dayArray = dateArray[2].split('T');\n let day = dayArray[0];\n // Sets up month and year months\n let month = dateArray[1];\n let year = dateArray[0];\n // Using the global standard or writing DOB\n let formatedDOB = [day, month, year].join('-');\n // Retuns the data from the formatted DOB.\n return formatedDOB;\n }", "title": "" }, { "docid": "fb7b59ffa05ee66b7f51edf5ef5d1ba8", "score": "0.6851623", "text": "function formatDate ( date ) {\n return date.getDate() + nth(date.getDate()) + \" \" +\n months[date.getMonth()] + \" \" +\n date.getFullYear();\n}", "title": "" }, { "docid": "aa58d1b74895437ce3ab2f5cf51e805c", "score": "0.68475795", "text": "function formatDate(date) {\n if (date) {\n var formattedDate = new Date(date);\n return formattedDate.toLocaleDateString();\n } else {\n return null;\n }\n}", "title": "" }, { "docid": "90eea3222c511b8ccef155bd550a01d3", "score": "0.684524", "text": "function formatDate(date) {\n return date.getFullYear() + '-' +\n (date.getMonth() < 9 ? '0' : '') + (date.getMonth()+1) + '-' +\n (date.getDate() < 10 ? '0' : '') + date.getDate();\n}", "title": "" }, { "docid": "9a61e9d840951f2f72f13ced89964184", "score": "0.68389064", "text": "function formatDate(date, formatStr) {\n\t\treturn formatDateWithChunks(date, getFormatStringChunks(formatStr));\n\t}", "title": "" }, { "docid": "79cd01792bb5806c9bb3fa6c4e1b9ee5", "score": "0.6835438", "text": "function formatDate(date) {\n\t\t\t\treturn date.getDate() + \"-\" + (date.getMonth()+1) + \"-\" + date.getFullYear();\n\t\t\t}", "title": "" }, { "docid": "55b643b07f3e3ab880ea491fb73b28c7", "score": "0.6835073", "text": "function pgFormatDate(date) {\n /* Via http://stackoverflow.com/questions/3605214/javascript-add-leading-zeroes-to-date */\n return String(date.getFullYear()+'-'+(date.getMonth()+1)+'-'+date.getDate()); \n}", "title": "" }, { "docid": "0207fb3abc512584ef3bff3e82310499", "score": "0.6827606", "text": "function setFormatoDate(data) {\n let dd = (\"0\" + (data.getDate())).slice(-2);\n let mm = (\"0\" + (data.getMonth() + 1)).slice(-2);\n let yyyy = data.getFullYear();\n return dd + '/' + mm + '/' + yyyy;\n}", "title": "" }, { "docid": "21b136668c26881d30a9828e1e73b95a", "score": "0.6824828", "text": "function formatDate(date, format, options) {\n\treturn formatDates(date, null, format, options);\n}", "title": "" }, { "docid": "21b136668c26881d30a9828e1e73b95a", "score": "0.6824828", "text": "function formatDate(date, format, options) {\n\treturn formatDates(date, null, format, options);\n}", "title": "" }, { "docid": "21b136668c26881d30a9828e1e73b95a", "score": "0.6824828", "text": "function formatDate(date, format, options) {\n\treturn formatDates(date, null, format, options);\n}", "title": "" }, { "docid": "52fe3f670508f12b409c9d54498ecbca", "score": "0.6824674", "text": "prettyBirthday() {//Can be put in method\n return dayjs(this.person.dob.date)\n .format('DD MMMM YYYY')//change in assignment to different format not default\n }", "title": "" }, { "docid": "bfde5ebf272f8316930c477796b54520", "score": "0.6817718", "text": "function dateFormatter(date){\n var year = date.getFullYear();\n var month = date.getMonth() + 1;\n var day = date.getDate();\n return year + '-' + ('0' + month).slice(-2) + '-' + day; // the '0' and the slicing is for left padding\n}", "title": "" }, { "docid": "e8e86fd220fa93d15a9b79b30d1b85ba", "score": "0.6815951", "text": "static formatDate (date, format) {\n let year = date.getFullYear(),\n month = Timer.zero(date.getMonth()+1),\n day = Timer.zero(date.getDate()),\n hours = Timer.zero(date.getHours()),\n minute = Timer.zero(date.getMinutes()),\n second = Timer.zero(date.getSeconds()),\n week = date.getDay();\n return format.replace(/yyyy/g, year)\n .replace(/MM/g, month)\n .replace(/dd/g, day)\n .replace(/hh/g, hours)\n .replace(/mm/g, minute)\n .replace(/ss/g, second)\n .replace(/ww/g, Timer.weekName(week));\n }", "title": "" }, { "docid": "c601b274f8907157dbaea8c718488886", "score": "0.681486", "text": "function formatDate(date){\n var yyyy = date.getFullYear();\n var mm = date.getMonth() + 1;\n var dd = date.getDate();\n //console.log(\"This is dd\" + dd);\n if(dd<10){\n dd='0'+ dd;\n }\n if(mm<10){\n mm='0'+mm;\n } \n return ( mm + '/' + dd + '/' + yyyy);\n \n }", "title": "" }, { "docid": "d69b8dd2a7bcbfb74969bfdd3a2313f3", "score": "0.68108004", "text": "dateFormate(d) {\n const date = new Date(d)\n const j = date.getDate()\n const m = (date.getUTCMonth() + 1)\n const a = date.getUTCFullYear()\n return (\"0\" + j).slice(-2) + '/' + (\"0\" + m).slice(-2) + '/' + a\n }", "title": "" }, { "docid": "c5feff956d317121856a429019d2e9bd", "score": "0.68101245", "text": "function format(d) {\n const month = d.getMonth() >= 9 ? d.getMonth() + 1 : `0${d.getMonth() + 1}`;\n const day = d.getDate() >= 10 ? d.getDate() : `0${d.getDate()}`;\n const year = d.getFullYear();\n return `${month}/${day}/${year}`;\n}", "title": "" }, { "docid": "230b4bbdbbe2e446d2368ff81aeb4955", "score": "0.68099517", "text": "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n if (month.length < 2) month = '0' + month;\n if (day.length < 2) day = '0' + day;\n return [year, month, day].join('-');\n }", "title": "" }, { "docid": "3caa278f748c8eb5ee97e1534bb4a32b", "score": "0.6809602", "text": "function formatDate(dateToConvert) {\n\treturn format(new Date(dateToConvert));\n}", "title": "" }, { "docid": "455cd99abfe7dfcad04ff658ab88ce2f", "score": "0.68090725", "text": "function formatDate(date) {\n let year = date.getFullYear();\n let month = date.getMonth() + 1;\n let day = date.getDate();\n return [year, month, day].join('-');\n}", "title": "" }, { "docid": "61397acdfc4497cfdd5cb4200c733bf7", "score": "0.68019825", "text": "formatDate(value, format) {\n format = format || '';\n if (value) {\n return window.moment(value)\n .format(format);\n }\n return \"n/a\";\n }", "title": "" }, { "docid": "d387cd8b0284bc0d0e9763cc76e1f836", "score": "0.6801209", "text": "function formatDate(date) {\n result = \"\";\n if (date) {\n result += date.getDate() + \"/\"; // Day\n result += (date.getMonth() + 1) + \"/\";\n result += (date.getYear() + 1900);\n }\n return result;\n}", "title": "" }, { "docid": "809926c2df6d5b46c2c7d07f69164f5e", "score": "0.67929906", "text": "formatDate(d) {\n return moment(d).format('DD/MM/YYYY')\n }", "title": "" }, { "docid": "a9944ed75a526ae4829c256bc4714696", "score": "0.6790544", "text": "function formattedDate(d = new Date()) {\n return [d.getDate(), d.getMonth() + 1, d.getFullYear()]\n .map((n) => (n < 10 ? `0${n}` : `${n}`))\n .join(\"/\")\n .concat(` at ${getTime(d)}`);\n }", "title": "" }, { "docid": "3f76d794e9f53507445b5078bcdf3445", "score": "0.6789918", "text": "_formatDate(date, tzOffset) {\n let str = window.iotlg.dateFormat;\n let actualDate = new Date();\n actualDate.setTime(date.getTime() + this._getMilliseconds(tzOffset, UNIT_HOUR));\n let hours = (actualDate.getUTCHours());\n let day = (actualDate.getUTCDate());\n\n str = str.replace(\"yyyy\", actualDate.getUTCFullYear());\n str = str.replace(\"mm\", this._fillUp(actualDate.getUTCMonth() + 1, 2));\n str = str.replace(\"dd\", this._fillUp(day, 2));\n str = str.replace(\"hh\", this._fillUp(hours, 2));\n str = str.replace(\"MM\", this._fillUp(actualDate.getUTCMinutes(), 2));\n str = str.replace(\"ss\", this._fillUp(actualDate.getUTCSeconds(), 2));\n str = str.replace(\" \", \"\\n\");\n return str;\n }", "title": "" }, { "docid": "4afb18f5c3cb4e1d289280f2e0d4577b", "score": "0.67863476", "text": "function formatDate(rawDate) {\n return rawDate.replace(/(\\d{4})[-/](\\d{2})[-/](\\d{2})/, '$3.$2.$1');\n}", "title": "" }, { "docid": "05fd92200f9417d7d7d5415796227982", "score": "0.6785376", "text": "getDateFormated(date) {\n const formatDate = new Intl.DateTimeFormat('en-GB', {\n day: 'numeric',\n month: 'short',\n year: 'numeric'\n }).format;\n return formatDate(date);\n }", "title": "" }, { "docid": "2141a6e0f85120f7ab3d5dd0084dcc22", "score": "0.67850566", "text": "function formatDate(val) {\n var d = new Date(val),\n day = d.getDate(),\n month = d.getMonth() + 1,\n year = d.getFullYear();\n\n if (day < 10) {\n day = \"0\" + day;\n }\n if (month < 10) {\n month = \"0\" + month;\n }\n return month + \"/\" + day + \"/\" + year;\n}", "title": "" }, { "docid": "5b8806f829153a530b807eef025f1d20", "score": "0.67833906", "text": "function formattedDate(d = new Date) {\n\treturn [d.getDate(), d.getMonth()+1, d.getFullYear()]\n\t\t.map(n => n < 10 ? `0${n}` : `${n}`).join('/');\n }", "title": "" }, { "docid": "1140b357e9966767ecf935eb06ae147c", "score": "0.67782235", "text": "function reFormatDate(date) {\n const d= new Date(Date.parse(date));\n let mm = d.getMonth() + 1;\n const yyyy = d.getFullYear();\n let dd = d.getDate();\n\n if (dd < 10) {\n dd = `0${dd}`;\n }\n if (mm < 10) {\n mm = `0${mm}`;\n }\n return `${yyyy}-${mm}-${dd}`;\n }", "title": "" } ]
d3de77fcc31877f8b100a5790de31682
Toggle the search results based on whether or not the search input has focus
[ { "docid": "774a8fc18cca3b5b3309152d6cb1776c", "score": "0.6566098", "text": "handleFocus(e) {\n\t\tif (this.search && this.search.contains(e.target)) {\n\t\t\tthis.setState({ searchIsOpen: true });\n\t\t} else {\n\t\t\tthis.setState({ searchIsOpen: false });\n\t\t}\n\t}", "title": "" } ]
[ { "docid": "6de57e0b15ec36572865158874d702bc", "score": "0.7768789", "text": "toggleSearch() {\n const visibleClass = this.visibleClass.substring(1);\n const isVisible = this.$searchBox.classList.contains(visibleClass);\n if (isVisible) {\n this.$searchBox.classList.remove(visibleClass);\n this.$searchInput.blur();\n this.stopFindInPage();\n }\n else {\n this.$searchBox.classList.add(visibleClass);\n this.$searchInput.focus();\n }\n }", "title": "" }, { "docid": "bff0e32f71981c56fc9bbba45c7cfa68", "score": "0.7712092", "text": "function toggleSearchResults(event) {\n let target = document.querySelector(\"#searchBand .searchResults\");\n\n //skip hiding if switching to results panel\n let loosingFocusToSearchResult = event.type == \"blur\" && event.relatedTarget && event.relatedTarget.parentElement.classList.contains(\"searchResults\");\n if (loosingFocusToSearchResult) return;\n\n event.type == \"focus\" && event.currentTarget.value ? target.classList.add('show') : target.classList.remove('show');\n}", "title": "" }, { "docid": "6044731e21c15b7c11ba2daf169680fd", "score": "0.7607619", "text": "function search() {\r\n input.fadeToggle();\r\n input.focus();\r\n}", "title": "" }, { "docid": "739ac6665c489c6b9f8f61160caf5f58", "score": "0.7560665", "text": "function toggleSearchInputFocus() {\n ctrl.isSearchInputFocused = !ctrl.isSearchInputFocused;\n }", "title": "" }, { "docid": "ca38d69b6136899df3f5268873c260ef", "score": "0.7368546", "text": "function doSearch()\n{\n if ( typeof( mtbSearch ) == 'object' )\n {\n mtbSearch.click();\n toggleSearch();\n }\n}", "title": "" }, { "docid": "45b512f1c17e058a537a2412bdc264ff", "score": "0.7353667", "text": "function toggleSearch() {\r\n\tif (isSearchExpanded()) minimizeSearch();\r\n\telse expandSearch();\r\n}", "title": "" }, { "docid": "15dc2cb1c3984204c7fc31752ea45fa5", "score": "0.7265807", "text": "function _showAndFocusSearch() {\n $('.active-search-container').show();\n $('#active_search_input').focus();\n}", "title": "" }, { "docid": "369ffa8645d5dc5afcc0158156b936f1", "score": "0.72631586", "text": "searchVisible(){\n this.searchInput =! this.searchInput;\n }", "title": "" }, { "docid": "d0bcf2e400fce65f2d749aeaa4c10deb", "score": "0.721597", "text": "function toggleSearch() {\n vm.showingSearch = !vm.showingSearch;\n if(vm.showingSearch) {\n vm.filter = 'all';\n } else {\n vm.query = '';\n }\n applyFilter();\n }", "title": "" }, { "docid": "16b410d2c201121790ce4ace7388310f", "score": "0.7190666", "text": "function focusInputText (){\n isSearchInputSelected = true;\n}", "title": "" }, { "docid": "a6f84dd3b1580adb41b962c37df594a7", "score": "0.7149153", "text": "function focusOnSearch() {\r\n $(\"#search-input\").focus();\r\n } // End of function focusOnSearch", "title": "" }, { "docid": "0bee2f485174167a357c3c07ef48dbb9", "score": "0.7145898", "text": "function focusOnSearch(){\r\n if($(\"#searchMobile\").is(':visible')) $(\"#search2\").focus()\r\n else $(\"#search\").focus()\r\n}", "title": "" }, { "docid": "849455ac7b0f1f2150613b4fcc3099c8", "score": "0.70973426", "text": "function searchFocus() {\n\tvar $this = $(\"#search_query\");\n\tif ($this.val() == $this.attr('title')) {\n\t\t$this.val(\"\");\n\t\t$(\"#search_btn\").addClass(\"typing\");\n\t\t$this.parent().addClass(\"highlight\");\n\t} else if ($this.val() !== \"\" && $this.val() !== $this.attr('title')) {\n\t\t$(\"#search_btn\").addClass(\"typing\");\n\t\t$this.parent().addClass(\"highlight\");\n\t}\n}", "title": "" }, { "docid": "6456d594c3fd4423e232720f7d88ff2a", "score": "0.7056971", "text": "isSearchboxFocused() {\r\n return (this.getResultElements().includes(this.getFocusedElement()) ||\r\n this.winRef.document.querySelector('input[aria-label=\"search\"]') ===\r\n this.getFocusedElement());\r\n }", "title": "" }, { "docid": "e5a878cf862ff118e9d2c3f8f7387f65", "score": "0.70230657", "text": "showSearch() {\n this.active = true;\n this.$.input.focus();\n }", "title": "" }, { "docid": "042fe964b0305829c3878970aabb56d6", "score": "0.7010816", "text": "function focus() {\n vm.inSearch = true;\n vm.onFocus();\n }", "title": "" }, { "docid": "d37241a9e2a3183dcb7b2a39d074e0c7", "score": "0.69564897", "text": "function toggleSearchButton() {\n\tif ($(\"#criteria li:not(.newCriterion):not(.titlerow)\").length == 0\n\t\t\t&& $(\"#queryField\").val() == \"\") {\n\t\t$('.submitcriteria').attr('disabled', true);\n\t} else {\n\t\t$('.submitcriteria').removeAttr(\"disabled\");\n\t}\n\n}", "title": "" }, { "docid": "a820cb30dfce3535f9fa470681688da2", "score": "0.6925441", "text": "function toggleSearchButton(){\n\tif ($('.searchfield').val()) {\n\t\t//Change the icon to show the cross instead of the search icon\n\t\t$('#textbox-icon').removeClass('fa fa-search').addClass('fa fa-times');\n\t\t//hide the documents tree\n\t\t//$('#jstree').fadeOut( \"slow\", function() {});\n\t}else{\n\t\t$('#results').html('');\n\t\t//Change the icon to show the search instead of the cross\n\t\t$('#textbox-icon').removeClass('fa fa-times').addClass('fa fa-search');\n\t\t//hide the documents tree\n\t\t//$('#jstree').fadeIn( \"slow\", function() {});\n\t}\n}", "title": "" }, { "docid": "f51bb090e2c5cf750137b06c61030bb2", "score": "0.68888116", "text": "function toggleSearchBox(){\n let menu = document.querySelector('form.search-form');\n if (menu.classList.contains(\"visible\")) {\n menu.classList.remove('visible');\n } else {\n menu.classList.add('visible');\n menu.querySelector('input').focus()\n }\n}", "title": "" }, { "docid": "19a277f0db2b77a16a4b06e1af9f95ef", "score": "0.68805707", "text": "function searchToggle(obj, evt) {\n var container = $(obj).closest(\".search-box\");\n var keyword = $(\".search-input\").val();\n\n if (!container.hasClass(\"active\")) {\n container.addClass(\"active\");\n evt.preventDefault();\n }\n else if (container.hasClass(\"active\") && $(obj).closest(\".input-holder\").length == 0) {\n container.removeClass(\"active\");\n container.find(\".search-input\").val(\"\");\n }\n else if (container.hasClass(\"active\") && keyword !== \"\") {\n search($(\".search-input\").val());\n }\n }", "title": "" }, { "docid": "75d4cfbb6ecdb04943f55e9702bcc353", "score": "0.6856069", "text": "async searchBoxToggle() {\n this.showSearchBox = true;\n }", "title": "" }, { "docid": "0489075d7e19fa38972800e46b7475f3", "score": "0.68557245", "text": "function searchButtonClickListener() {\n\tconst searchBar = document.querySelector(\"._2EoyP\");\n\tconst displayStatus = getComputedStyle(searchBar).display;\n\n\tif (displayStatus === \"block\") {\n\t\tsearchBar.style.display = \"none\";\n\t} else {\n\t\tsearchBar.style.display = \"block\";\n\n\t\t// to focus a contentEditable div, change the tabIndex property first\n\t\t// thanks to @wafs https://stackoverflow.com/a/51129008\n\t\tlet searchInputContainer = document.querySelector(\"._2FVVk.cBxw-\");\n\t\tsearchInputContainer.tabIndex = 1;\n\n\t\tsearchInputContainer.lastChild.focus();\n\t}\n}", "title": "" }, { "docid": "75a325dbe92cec3a0d49737bb43bf4cb", "score": "0.68416756", "text": "function clickSearch() {\n searchRecipes();\n if(searchInput.value === \"\"){\n backBtn.style.display = 'none';\n mainBtn.style.display = 'block';\n }else{\n backBtn.style.display = 'block';\n mainBtn.style.display = 'none';\n }\n\n return false;\n}", "title": "" }, { "docid": "a3f0924074c68b41e9b03f3b70c1af84", "score": "0.68065214", "text": "hideSearch() {\n this.active = false;\n this.term = \"\";\n }", "title": "" }, { "docid": "f4f27fb90590f4113bd9924edbfc8e07", "score": "0.6800328", "text": "handleOpenSearch(event) {\n this.searchButton = !this.searchButton;\n }", "title": "" }, { "docid": "df8d7467f2d2227633431640448bb51d", "score": "0.6761675", "text": "toggleSearch() {\n this.setState({\n search: !this.state.search\n });\n }", "title": "" }, { "docid": "e29a95b400b153ea3b9beedf30c7f3a1", "score": "0.673009", "text": "function focus () {\n hasFocus = true;\n //-- if searchText is null, let's force it to be a string\n if (!angular.isString($scope.searchText)) $scope.searchText = '';\n ctrl.hidden = shouldHide();\n if (!ctrl.hidden) handleQuery();\n }", "title": "" }, { "docid": "e29a95b400b153ea3b9beedf30c7f3a1", "score": "0.673009", "text": "function focus () {\n hasFocus = true;\n //-- if searchText is null, let's force it to be a string\n if (!angular.isString($scope.searchText)) $scope.searchText = '';\n ctrl.hidden = shouldHide();\n if (!ctrl.hidden) handleQuery();\n }", "title": "" }, { "docid": "fa450725b6b7a0b5939582f1fee1179e", "score": "0.6728424", "text": "function openSearch() {\n $('header.small .search').addClass('open');\n $('header.small .search').find('input').focus();\n }", "title": "" }, { "docid": "2e3c556d721486d89aa5c98bcface3d7", "score": "0.6713505", "text": "function handleFocus() {\n if (searchIsVisible()) {\n searchWideWrapper.querySelector('input[type=\"search\"]').focus();\n } else if (searchWideWrapper.contains(document.activeElement)) {\n // Return focus to button only if focus was inside of the search wrapper.\n searchWideButton.focus();\n }\n }", "title": "" }, { "docid": "e9dcd14ff2e08c16b3794d70ddd6462e", "score": "0.6676226", "text": "showSearchContainer(e) {\n e.preventDefault();\n this.setState({\n showingSearch: !this.state.showingSearch\n });\n\n if(this.state.showingSearch){\n document.getElementById(\"text\").value = \"\";\n this.setState({results: []});\n }\n\n }", "title": "" }, { "docid": "0784f6b93afdeaec94f2c57b3deb8887", "score": "0.666686", "text": "searchResults() {\n document.getElementById(\"searchArray\").style.display = \"none\";\n document.getElementById('openSearchResults').click()\n }", "title": "" }, { "docid": "12eb144a2bef734b6399eb4a0ce2f796", "score": "0.66345185", "text": "switchToSearchMode() {\n\t\tthis.setState({\n\t\t\theaderInput: this.defaultSearchHeaderActions,\n\t\t\tdisplayMode: DISPLAY_MODE_SEARCH,\n\t\t});\n\t}", "title": "" }, { "docid": "d783e96dc61a3561e2fde8c56aa1fbbc", "score": "0.6631387", "text": "function search(){\n $('a[href=\"#search\"]').on('click', function(event) { \n $('#search').addClass('open');\n $('#search > form > input[type=\"search\"]').focus();\n }); \n $('#search, #search button.close').on('click keyup', function(event) {\n if (event.target == this || event.target.className == 'close' || event.keyCode == 27) {\n $(this).removeClass('open');\n }\n }); \n }", "title": "" }, { "docid": "2089e1f3be7bbad70466fdc3e4cac698", "score": "0.6594728", "text": "function _searchOpen( $this ) {\n\t\t$this.addClass( 'activated' ).find( '.search-box' ).fadeIn( 'fast' ).find( 'input[type=\"search\"]' ).focus();\n\t}", "title": "" }, { "docid": "1cac81da19120e01639fecefea104007", "score": "0.658218", "text": "SearchBoxFocus(e) {\n e.preventDefault();\n this.setState({\n searchFocus: !this.state.searchFocus\n })\n }", "title": "" }, { "docid": "569486761320ac4ae64157db6e0cdd0e", "score": "0.65809035", "text": "function handleSearch() {\t\r\n\t\t\r\n\t\t$('#custom-search-button').on(\"click\", function(e) { \r\n\t\t\r\n\t\t\te.preventDefault();\r\n\t\t\t\r\n\t\t\tif(!$(\"#custom-search-button\").hasClass('open')) {\r\n\t\t\t\r\n\t\t\t\t$(\"#custom-search-form\").fadeIn();\r\n\t\t\t\t$(\"#custom-search-button\").addClass('open');\r\n\t\t\t\t$(\"#custom-search-form #s\").focus();\r\n\t\t\t\t\r\n\t\t\t} else {\r\n\t\t\t\t\r\n\t\t\t\t$(\"#custom-search-form\").fadeOut();\r\n\t\t\t\t$(\"#custom-search-button\").removeClass('open');\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t});\r\n\t\t\r\n\t}", "title": "" }, { "docid": "517b8f81ca7ab61524cf842338a5ba23", "score": "0.65763414", "text": "function toggleSearch()\n{\n\t$(\"#bysearchTab\").toggle\n\t(\n\t\tfunction()\n\t\t{\n\t\t\tif(browseType == \"bymodule\")\n\t\t\t{\n\t\t\t\t$(\"#bymoduleTab\").removeClass(\"active\")\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$(\"#\" + browseType + \"Tab\").removeClass(\"active\")\n\t\t\t}\n\t\t\t$(\"#bysearchTab\").addClass(\"active\")\n\t\t\tajaxGetSearchForm()\n\t\t\t$(\"#querybox\").addClass(\"show\")\n\t\t},\n\t\tfunction()\n\t\t{\n\t\t\tif(browseType == \"bymodule\")\n\t\t\t{\n\t\t\t\t$(\"#bymoduleTab\").addClass(\"active\")\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$(\"#\" + browseType +\"Tab\").addClass(\"active\")\n\t\t\t}\n\t\t\t$(\"#bysearchTab\").removeClass(\"active\")\n\t\t\t$(\"#querybox\").removeClass(\"show\")\n\t\t} \n\t)\n}", "title": "" }, { "docid": "ae971176abff8df21be67e7b911424b8", "score": "0.65228975", "text": "search () {\n \n \n this.inputSearchBox.click(); \n \n this.inputPhisicalCategory.click(); \n \n this.inputLanguageCategory.click(); \n \n this.inputOcupationalCategory.click(); \n \n this.searchfield.click(); \n this.mariaresult.click();\n \n }", "title": "" }, { "docid": "01f440aca213c811a0c060c78fa81a68", "score": "0.65096915", "text": "function change_search(){\r\n $input_node = jQuery('#search-form input[type=\"text\"]');\r\n $input_node.focus(function(){\r\n jQuery(this).stop(true,true).animate({\r\n width:'255px'\r\n },100);\r\n });\r\n $input_node.blur(function(){\r\n jQuery(this).stop(true,true).animate({\r\n width:'230px'\r\n },100);\r\n })\r\n }", "title": "" }, { "docid": "ad69aba3ca630ec4da284c084a17d917", "score": "0.6504964", "text": "function td_aj_search_input_remove_focus() {\n if (td_aj_search_results !== 0) {\n jQuery('.td-search-form').css('opacity', 0.5);\n }\n}", "title": "" }, { "docid": "666b5229e86a5bcbeeb273c107bc4a71", "score": "0.6499375", "text": "function focus () {\n hasFocus = true;\n //-- if searchText is null, let's force it to be a string\n if (!angular.isString($scope.searchText)) $scope.searchText = '';\n if ($scope.minLength > 0) return;\n ctrl.hidden = shouldHide();\n if (!ctrl.hidden) handleQuery();\n }", "title": "" }, { "docid": "3759030863f0a3533ba59d6d1c9357a5", "score": "0.64990664", "text": "function td_aj_search_input_focus() {\n td_aj_search_cur_sel = 0;\n td_aj_first_down_up = true;\n jQuery('.td-search-form').fadeTo(100, 1);\n jQuery('.td_mod_aj_search').removeClass('td-aj-cur-element');\n}", "title": "" }, { "docid": "ed171d91df6b8f2f3382d2f5fcc265dc", "score": "0.64663273", "text": "function startTextSearch() {\n\t$('#ss-show-btn').removeClass('active');\n\t$('#text-search-start-btn').addClass('active');\n\t$('#spatial-search-div').css('display', 'none');\n\t$('#text-search-div').css('display', 'block');\n}", "title": "" }, { "docid": "861bdb65cb0b18476dec0ca72ae49f0d", "score": "0.64606476", "text": "function searching() {\n $('#CDSSearchButton').prop( \"disabled\", true );\n $('#CDSSearchBox').prop( \"disabled\", true );\n\t\t\n\t\t//show spinner\n\t\t$('.SearchSpinner').css('display', 'block');\n\t\t\n }", "title": "" }, { "docid": "5cde127f18cf92867eb64fb281272dd2", "score": "0.6429053", "text": "function searchLayerToggle() {\n\tvar activeNav;\n\tif (mobileNav) {\n\t\tvar activeNav = $(mobNav);\n\t}\n\tif (!mobileNav) {\n\t\tvar activeNav = $(deskNav);\n\t}\n\tvar searchInput = $(activeNav).find('.search-input');\n\tvar searchResLayer = $(activeNav).find('.search-results-layer');\n\tvar navBtnSearch = $(activeNav).find('.search-btn');\n\tif ($(navBtnSearch).hasClass('active') || mobileNav) {\n\t\t$(searchInput).focus();\n\t\t$(searchInput).bind(\"change paste keyup\", function() {\n\t\t\tif ($(searchInput).val() == '') {\n\t\t\t\tif ($(searchResLayer).hasClass('has-results')) {\n\t\t\t\t\t$(searchResLayer).removeClass('has-results').addClass('no-results');\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ($(searchResLayer).hasClass('no-results')) {\n\t\t\t\t\t$(searchResLayer).removeClass('no-results').addClass('has-results');\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tsetTimeout(function() {\n\t\t\t$(navAccordion).css('overflow', 'visible');\n\t\t\t$(navBtnSearch).css('overflow', 'visible');\n\t\t\t$(searchResLayer).removeClass('hidden');\n\t\t}, 300);\n\t} else {\n\t\t$(navAccordion).css('overflow', 'hidden');\n\t\t$(navBtnSearch).css('overflow', 'hidden !important');\n\t\t$(searchResLayer).addClass('hidden');\n\t\t$(searchInput).blur();\n\t}\n\n}", "title": "" }, { "docid": "ff29ea38554f64349750e64799eaf921", "score": "0.64259887", "text": "function blurInputText (){\n isSearchInputSelected = false;\n}", "title": "" }, { "docid": "c5a3a63b4cdc007c172a1f94364bcb52", "score": "0.64257735", "text": "function smsearch(){\n var smsearch = document.getElementById('sm_searchbox');\n smsearch.classList.toggle('mobsearchactive');\n }", "title": "" }, { "docid": "f15479f83d71816b9f51d76aa85f4ed0", "score": "0.6407321", "text": "function navBarSearch() {\n var query = $(\"#searchBarForm input\").val();\n \n if($(\"#textualSearchButton\").parent().hasClass(\"active\"))\n textualSearch(query);\n else\n visualSearchWithControl(query);\n}", "title": "" }, { "docid": "45fc7d095690d6c254166c583b4e3e76", "score": "0.6402821", "text": "handleSearch() {\n this.setState({searchBoxEnable:true});\n this.setState({displayFav:false});\n this.setState({drawer:false});\n }", "title": "" }, { "docid": "b2487c57007e4a1b945cc8d88d103716", "score": "0.6402516", "text": "search() {\n this.searchField.valueHasMutated();\n }", "title": "" }, { "docid": "df8c8e161eef880e3d59624e1a666c89", "score": "0.6371335", "text": "function searchOpen() {\n $(\"#searchbox\").fadeIn();\n }", "title": "" }, { "docid": "28f0633f5a6c0e1f25444f124d5441c9", "score": "0.6369798", "text": "searchHandler() {\n this.searchSpotify(this.state.query);\n\n //This will clear the input field after search\n this._input.value = \"\";\n this._input.focus();\n\n this.setState({\n showResults: true\n });\n }", "title": "" }, { "docid": "36d1bb0158b55162f6d9681593580b16", "score": "0.63691443", "text": "updateSearch(event){\n this.setState({search:event.target.value})\n this.setState({searchResultDisplayed: true})\n }", "title": "" }, { "docid": "f2231215bbb08168fb05e374cee4a053", "score": "0.6367516", "text": "search() {\n this.dispatchEvent(new CustomEvent('search', {detail: {value: this.term}}));\n this.hideSearch();\n }", "title": "" }, { "docid": "6e5887a4b0f7a74ffd7f63c9154dc218", "score": "0.63494086", "text": "function openSearch() {\n $('.search-list').show();\n}", "title": "" }, { "docid": "b55f190edb18ee764cb21a91e71aee64", "score": "0.6334927", "text": "toggleSearchContainer(e) {\n e.preventDefault();\n this.setState({\n showingSearch: !this.state.showingSearch\n });\n }", "title": "" }, { "docid": "01060ee58de071b645988a2fb54ae840", "score": "0.6333074", "text": "function handleSearch(e) {\n setQuery(e.target.value);\n if (e.target.value === \"\") {\n setSearched(false);\n } else {\n setSearched(true);\n }\n }", "title": "" }, { "docid": "050ffdb1cbaae6272643f44800d80dff", "score": "0.6323681", "text": "function checkText() {\n if($(\"query\").value) {\n $(\"go-search\").disabled = false;\n } else {\n $(\"go-search\").disabled = true;\n }\n }", "title": "" }, { "docid": "924e369197dd320c34ae3d8e15243221", "score": "0.6321161", "text": "toggleSearchBar() {\n const expand = (this.state.expand === false) ? true : false;\n this.setState({\n expand: expand\n })\n }", "title": "" }, { "docid": "1d08e9e110148d47f8b0043d80d0580d", "score": "0.6309044", "text": "function searchChangeHandler() {\n var query = document.querySelector('#searchBox').value.toLowerCase();\n var names = document.querySelectorAll('.list-group-item');\n\n // home rolled O(n) search... what could go wrong?\n var displayedStrings = 0;\n for (var i = 0; i < names.length; i += 1) {\n if (names[i].innerText.toLowerCase().indexOf(query) > -1) {\n names[i].style.display = 'block';\n displayedStrings += 1;\n } else {\n names[i].style.display = 'none';\n }\n }\n\n if (displayedStrings === 0) {\n document.querySelector('#noResults').style.display = 'block';\n } else {\n document.querySelector('#noResults').style.display = 'none';\n }\n\n document.querySelector('.container').scrollTop = 0;\n}", "title": "" }, { "docid": "47d71caad182110b883c5bc30f040cea", "score": "0.63034827", "text": "handleQuickSearchEvent() {\n var i;\n var txtValue;\n var tr = this.template.querySelector('c-data-table-component').getElement();\n let input = this.template.querySelector('.quickSearchInput');\n let filter = input.value.toUpperCase();\n for (i = 0; i < tr.length; i++) {\n txtValue = tr[i].textContent;\n if (txtValue.toUpperCase().indexOf(filter) > -1) {\n tr[i].style.display = \"\";\n } else {\n tr[i].style.display = \"none\";\n }\n }\n }", "title": "" }, { "docid": "e04ed2fc28daa678e2ffded9cc78b231", "score": "0.62850994", "text": "function showSearchBox() {\n getById(searchForm).classList.add(showSearch);\n getById(headerLinks).classList.add(showSearch);\n getById(searchTextbox).focus();\n }", "title": "" }, { "docid": "d8f5cb85edc35ece65348eb5026ce4b7", "score": "0.6279327", "text": "function focusResult($event) {\n\n\t//listen for down arrow\n\tif ($event.keyCode == 40) {\n\t\t$event.preventDefault();\n\t $event.stopPropagation();\n\n\t //first results\n\t var firstResult = $window.document.getElementById( 'globalSearchResults' ).getElementsByTagName( 'li' )[0].getElementsByTagName( 'a' )[0];\n\n\t console.log(firstResult);\n\n\t //if item - focus\n\t if(firstResult) {\n\t \tfirstResult.focus();\n\t }\n\t} \n\t// enter\n\telse if($event.keyCode == 13 && $scope.data.globalSearch) {\n\t\t//close dropdown\n\t\t$scope.data.globalDropdownOpen = false;\n\t\t//go to search results page\n\t\t$state.go('app.search', {'q': $scope.data.globalSearch});\n\n\t}\n}", "title": "" }, { "docid": "b1b11a78d061f05f7e6a22af403ca55f", "score": "0.6275461", "text": "function tapSearch(e) {\n\tautocomplete();\n\t$('#eligible-all').trigger('tap');\n\t\n\t// tap the search input\n}", "title": "" }, { "docid": "ccb667547d00255203eb1afd099d4a3c", "score": "0.62715614", "text": "function searchBtn_onclick() {\r\n\tlanguageListDiv.visible = false;\r\n lookup(wordQuery.value);\r\n}", "title": "" }, { "docid": "1484565d5c8e1f32a507f86e63989b18", "score": "0.626844", "text": "function inputSearchSuggestionsHandler() {\n whenSearchingIsActive(switchButtonsIcons, showSuggestions);\n const isActive = heroSearchInput.value.trim();\n if (isActive) {\n showSuggestionsInSearchBox();\n }\n }", "title": "" }, { "docid": "d526bfd0c3c8539b14512c8c307de6f5", "score": "0.6259704", "text": "click(){\r\n if ( !this.isDisabled && !this.readnly ){\r\n this.getRef('input').focus();\r\n if ( this.filteredData.length ){\r\n this.isOpened = !this.isOpened;\r\n }\r\n }\r\n }", "title": "" }, { "docid": "5abe427fb1c0023d7cec6c52f91d88ed", "score": "0.6257709", "text": "doSearch(e) {\n this.setState({\n searchVal: e.target.value\n });\n if (e.target.value.length < 2) {\n this.props.dispatch(clearSearch);\n this.setState({\n hasResults: \"hide\"\n })\n } else {\n this.props.dispatch(doNavSearch(e.target.value, this.props.token));\n this.setState({\n hasResults: \"hasResults\"\n })\n }\n }", "title": "" }, { "docid": "74c23dacc261b7c9d5cf979ece69cc3c", "score": "0.62547034", "text": "focusInput() {\n this.searchInput.focus();\n this.setState({\n showSearch: true,\n highlightedOption: this.state.highlightedOption || 0\n });\n }", "title": "" }, { "docid": "d425503e3c69ecb1c94ad4fdf855caf3", "score": "0.62542236", "text": "function showResults(e) {\n e.preventDefault();\n if (searchBooks) { showBooks(); }\n if (searchMovies) { showMovies(); }\n if (searchHome) { showHome(); }\n if (searchCooking) { showCooking(); }\n if (searchMakeup) { showMakeup(); }\n if (searchGames) { showGames(); }\n }", "title": "" }, { "docid": "d4089b2fa3d06d7430ce6e7ea3a8062a", "score": "0.62512106", "text": "onOpenSearch() {\n this.expanded = true;\n // Set state here even though it'll happen again during onFocusIn.\n // If we wait until onFocusIn the animation has a bit of jank to it.\n store.setState({isSearchExpanded: true});\n this.requestUpdate().then(() => {\n this.inputEl.focus();\n });\n }", "title": "" }, { "docid": "3f6f0dc4f8b908ebef2c45245456fcc5", "score": "0.6249456", "text": "function expandedSearch(event) {\n\tif (event.target.className !== 'otherLangSearch') {\n\t\tif ($(event.target.parentNode).find(\"ul.search\").length !== 0) {\n\t\t\tif (event.target.className === 'DirectHypernym' || event.target.className === 'InheritedHypernym' || event.target.className === 'DirectHyponym' || event.target.className === 'FullHyponym' || event.target.className === 'DirectTroponym' || event.target.className == 'FullTroponym') {\n\t\t\t\tif ($(event.target.parentNode.children[2]).prop(\"class\") !== event.target.className + ' search') {\n\t\t\t\t\texpandRequest(event, true);\n\t\t\t\t} else {\n\t\t\t\t\t$(event.target.parentNode.children[2]).fadeToggle('slow');\n\t\t\t\t}\n\t\t\t} else {\n\n\t\t\t\t$(event.target.parentNode.children[1]).fadeToggle('slow');\n\t\t\t}\n\t\t} else {\n\t\t\texpandRequest(event);\n\t\t}\n\t} else {\n\t\tadvancedSearchLangs(event);\n\t}\n}", "title": "" }, { "docid": "6472be40775848db764570e951ad7072", "score": "0.6245923", "text": "function searchInput(value)\n {\n $results.empty();\n $selectedElem = null;\n\n // if (timeXHR) clearTimeout(timeXHR);\n // timeXHR = setTimeout(function() {\n // AJAXSearch(value);\n // });\n \n $data.hide();\n if(value) {\n $data.filter(\":Contains('\" + value + \"')\").show();\n } else {\n $data.show();\n }\n }", "title": "" }, { "docid": "cd2f9df5038394deef4113ca96df5f55", "score": "0.62390304", "text": "function searchClicked(input, sel) {\n $(`.collapse_heading`).each(function (index) {\n let id = $(this).data(\"id\");\n if (index == 0) {\n $(\"#search_concept\").html(id);\n $(`#collapse_${id}`).addClass(\"in\");\n $(`.switch_btn_${id}`).addClass(\"active\");\n $(`#_btns_${id}`)[0].checked = true;\n if (!sel.includes(id.toLowerCase())) {\n sel.push(id.toLocaleLowerCase());\n }\n } else {\n $(`#collapse_${id}`).removeClass(\"in\");\n $(`.switch_btn_${id}`).removeClass(\"active\");\n $(`#_btns_${id}`)[0].checked = false;\n sel = sel.filter((v) => v != id.toLocaleLowerCase());\n }\n });\n setTimeout(() => {\n $(\"#searchInput\").blur();\n }, 100);\n\n searchResult(input, sel);\n }", "title": "" }, { "docid": "343546265ce59f6b810e53540c3540a5", "score": "0.62376195", "text": "onInputButtonClick(event) {\n let x=event.target.value\n if(x.length > 0) {\n this.setState({query: x, onResultsPage: true, inputValue: \"\"}) //query only changes on search submission\n }\n }", "title": "" }, { "docid": "1b6bd909ec6f4d469bee6e91f4cd1cee", "score": "0.6236519", "text": "handlerToggleSearch() {\n this.setState({\n openSearch: !this.state.openSearch,\n });\n if (this.state.openMenu) {\n this.setState({\n openMenu: !this.state.openMenu,\n });\n }\n }", "title": "" }, { "docid": "3bf2326a69803523330c2603bdfc4e80", "score": "0.6228988", "text": "search(e) {\n const searchTerm = e.target.value;\n const searchResults = this.filterByTerm(this.state.values, searchTerm);\n let highlighted = this.state.highlightedOption;\n if (!highlighted || highlighted < 0) {\n highlighted = 0;\n } else if (highlighted > searchResults.length - 1) {\n highlighted = searchResults.length - 1;\n }\n\n this.setState({\n searchResults: searchResults,\n searchTerm: searchTerm,\n showSearch: true,\n highlightedOption: highlighted\n });\n }", "title": "" }, { "docid": "842c31ce0916ac105b919212f3b4b907", "score": "0.6226214", "text": "function focusOnInput() {\n controls.$searchQuery.focus();\n }", "title": "" }, { "docid": "f6f7055f82bd38e1675ab9abdcdd5cbc", "score": "0.6225378", "text": "function showSearchPage() {\t\n\t$(\"#search_view_container\").addClass(\"active_view\");\n\t$(\"#trail_view_container\").removeClass(\"active_view\");\n\n\twindow.showingSearchPage = true;\n\tif(isMobile())\n\t\twindow.scrollTo(0,window.searchScroll);\n\t\n\t$(\"#search_button\").val(isDesktop()?\"Search For Trails\":\"Search\");\n}", "title": "" }, { "docid": "d0970b5ad37e97e5cd366b4f86565c3c", "score": "0.6220146", "text": "function activateField(e) {\n \n \n props.setSearchButtonActive( true)\n \n }", "title": "" }, { "docid": "e03974c6fea3d8e4d23a3c1952a5b204", "score": "0.62162405", "text": "function toggleSearchFields(){$(\"#s_tipo\").val()==\"1\"||$(\"#s_tipo\").val()==\"2\"?($(\"#tipo1\").show(),$(\"#tipo3\").hide()):$(\"#s_tipo\").val()==\"3\"?($(\"#tipo1\").hide(),$(\"#tipo3\").show()):($(\"#tipo1\").hide(),$(\"#tipo3\").hide())}", "title": "" }, { "docid": "501dedde2f1a78e880b404c27f0ec22b", "score": "0.6212035", "text": "function searchAndDisplayResults () {\n\n $state.go('root.search', {\n query: utils.slugify(vm.searchPhrase, '+'),\n showCaptionMatches: vm.showCaptionMatches\n });\n }", "title": "" }, { "docid": "b5c91418311c6188f680d1d1031ceca9", "score": "0.6211056", "text": "function showResults() {\n document.getElementById(\"resultList\").style.display = \"block\";\n var search_box = document.getElementById(\"search_box\");\n var currentText = search_box.value;\n\n if (isEmpty(currentText)) {\n document.getElementById(\"resultList\").style.display = 'none';\n }\n\n if (!isEmpty(currentText)) {\n noResults();\n }\n\n}", "title": "" }, { "docid": "4d2b91453b1bb372a43984e456634ca4", "score": "0.6210337", "text": "open() {\r\n this.searchBoxComponentService.toggleBodyClass('searchbox-is-active', true);\r\n }", "title": "" }, { "docid": "7696e917bafaf23fa849d38beaed776c", "score": "0.62072563", "text": "function focusSearchBox() {\n searchBox.firstElementChild.focus({\n preventScroll: true\n });\n }", "title": "" }, { "docid": "a87e7f6c523d07acb65410e082a2515e", "score": "0.6206374", "text": "function slideSearchUp(){\n\tif(resultsAreShown && !isFocused){\n\t\tEffect.BlindUp('search-results',\n\t\t\t{\n\t\t\t\tbeforeStart: function(){\n\t\t\t\t\tanimation = true;\n\t\t\t\t\tEffect.Fade('search-results-close');\n\t\t\t\t},\n\t\t\t\tafterFinish: function(){\n\t\t\t\t\tanimation = false;\n\t\t\t\t\tresultsAreShown = false;\n\t\t\t\t}\n\t\t\t} \n\t\t)\n\t}\n}", "title": "" }, { "docid": "aaf834f651c2d6620e161b1a0d5face7", "score": "0.619076", "text": "openSearch() {\n if (this.$.search_input.classList.contains('opened')) {\n this._startSearch();\n } else {\n this.$.search_input.classList.add('opened');\n this.$.search_input.focus();\n this.$.close_button.style.display = 'inline-block';\n this.$.search_input.value = '';\n let searchSize = 500;\n if (window.innerWidth < 1040) {\n dom(this.root.host.offsetParent).querySelector('#toolbar_title_box')\n .setAttribute('style', 'visibility:hidden')\n }\n let searchWidth;\n if (window.innerWidth > 840) {\n searchWidth = window.innerWidth - searchSize;\n } else if (window.innerWidth > 480) {\n searchWidth = window.innerWidth - (searchSize - 210);\n } else {\n this.$.tools_menu.classList.add('search-open');\n searchWidth = window.innerWidth - (searchSize - 320);\n }\n if (searchWidth > 360) {\n searchWidth = 360\n }\n this.shadowRoot.querySelector('.opened').style.width = `${searchWidth}px`;\n }\n }", "title": "" }, { "docid": "e445b45f1014dcdfe1be9439c6aac2b4", "score": "0.61857647", "text": "function searchTerm(e) {\r\n let eventList = document.querySelectorAll(\".empty_div\");\r\n let input = e.target.value.toLowerCase();\r\n Array.from(eventList).forEach((eventItem) => {\r\n let toSearch = eventItem.childNodes[0].children[0].childNodes[0].innerText;\r\n if (toSearch.toLowerCase().indexOf(input) != -1) {\r\n eventItem.style.display = \"block\";\r\n } else {\r\n eventItem.style.display = \"none\";\r\n }\r\n });\r\n}", "title": "" }, { "docid": "e41bc65f513ef3aff0ae168c9d37e382", "score": "0.61765563", "text": "function showSearchBar() {\n\tif (searchForm.className == \"active\") {\n\t\tsearchForm.className = \"\";\n\t}\n\telse {\n\t\tsearchForm.className = \"active\"\n\t}\n}", "title": "" }, { "docid": "3cd3718190d48e6897f6b6e94353d0ad", "score": "0.6168879", "text": "searchButtonClicked() {}", "title": "" }, { "docid": "0b2f9154528943955c9c2c2ca4fce328", "score": "0.61609787", "text": "search(query) {\r\n this.searchBoxComponentService.search(query, this.config);\r\n // force the searchbox to open\r\n this.open();\r\n }", "title": "" }, { "docid": "d0bb2ca9497cc96b98e555ece661434f", "score": "0.6159574", "text": "showSearchContainer(e) {\n e.preventDefault();\n this.setState({\n showingSearch: !this.state.showingSearch\n });\n }", "title": "" }, { "docid": "fdcc9f5cd32dfcc47f5206614b2b5033", "score": "0.61476076", "text": "function toggle() {\n\t\n\tif (document.getElementById('search-bar').style.display == 'block') {\n \tdocument.getElementById('search-bar').style.display = \"none\";\n\t\tdocument.getElementById('toggle-text').innerHTML = '<span class=\"glyphicon glyphicon-chevron-up\" aria-hidden=\"true\"></span> Refine Search';\n\t} else {\n \tdocument.getElementById('search-bar').style.display = \"block\";\n\t\tdocument.getElementById('toggle-text').innerHTML = '<span class=\"glyphicon glyphicon-chevron-up\" aria-hidden=\"true\"></span> Hide Search Bar';\n\t}\n}", "title": "" }, { "docid": "2cbf4e9b46627f2305f166df7024dfa7", "score": "0.61440927", "text": "function do_search() {\n var query = input_box.val().toLowerCase();\n\n if(query && query.length) {\n if(selected_token) {\n deselect_token($(selected_token), POSITION.AFTER);\n }\n\n if(query.length >= settings.minChars) {\n show_dropdown_searching();\n clearTimeout(timeout);\n\n timeout = setTimeout(function(){\n run_search(query);\n }, settings.searchDelay);\n } else {\n hide_dropdown();\n }\n }\n }", "title": "" }, { "docid": "96bc9dbf73964f4fefc159d53ae044ee", "score": "0.6135911", "text": "function handleQuery() {\n var searchText = self.searchText || '';\n fetchResults(searchText);\n self.hidden = shouldHide();\n }", "title": "" }, { "docid": "67556dc23dad36ba3a64cace52a7eca6", "score": "0.6131851", "text": "function bysearch(element){\n hideAllElements();\n document.getElementById('searchtodo').style.display = 'block';\n if(element.value == 'tdate'){\n document.getElementById('bytdate').style.display = 'block';\n document.getElementById('bytname').style.display = 'none';\n document.getElementById('search-box').value = 'select';\n }\n else if(element.value == \"search-tname\"){\n document.getElementById('bytdate').style.display = 'none';\n document.getElementById('bytname').style.display = 'block';\n document.getElementById('search-box').value = 'select';\n }\n}", "title": "" }, { "docid": "7161653de1b9f607e07f35d6ebc1b0f1", "score": "0.6128849", "text": "function showFieldSearch() {\n var $toolbar = $('.fixed-table-toolbar');\n var $searchBox = $toolbar.find('div.search');\n if($searchBox.css('visibility') == 'hidden') {\n $searchBox.css('visibility', 'visible');\n } else {\n $searchBox.css('visibility', 'hidden'); \n }\n}", "title": "" }, { "docid": "01b87aad80dbcf04022ead85e6cf53a7", "score": "0.6128016", "text": "function beginsearch(val) {\n const $container = document.querySelector(\".container\");\n if (!$container.classList.contains(\"top-container\")) {\n $container.classList.add(\"top-container\");\n }\n\n const $resultsContainer = resetResults();\n fetchResults (val,$resultsContainer);\n}", "title": "" }, { "docid": "2ddb63b07d6861baa2e64da3fe123203", "score": "0.61228734", "text": "function searchClick(){\n $( '.nav-link' ).click( function( event ) {\n // check if the navlink clicked is the search button\n if( $( this ).hasClass( 'search' ) ) {\n // it's the search button - toggle the search form\n // fade out the nav links to make room for the search form\n $( '.nav-links.main' ).fadeOut( 250, function() {\n // fade in the search form\n $( '.nav-search' ).fadeIn( 250, function() {\n // focus on the input when it loads\n $( '.search-input' ).focus();\n // perform check every time a letter is typed into the form\n // let's submit the search form\n $( '.nav-search' ).submit( function( event ) {\n // get the inputs value and seperate words with a dash\n var query = $( this ).find( 'input' ).val().replace( /\\s+/g, '-' ).toLowerCase();\n // fade in the results container\n $( '.result-load' ).fadeIn( 250 );\n // load the results into the container\n $( '.search-results .results' ).load( '../_includes/search.inc.php?p=' + query + '', function() {\n $( '.result-load' ).fadeOut( 250 );\n // create an array for duplicate results\n var seen = {};\n // run a check on each search result\n $( '.search-result' ).each( function() {\n // get the id of each result\n var id = $( this ).attr( 'data-product' );\n // get the level of likeness of each result\n var likeness = $( this ).attr( 'data-likeness' );\n // check if the result has already been cataloged\n if( seen[id] ) {\n // already cataloged - remove it\n $(this).remove();\n } else {\n // hasn't been cataloged yet - catalog it\n seen[id] = true;\n }\n } );\n // get total number of results returned\n var numResults = $( '.search-result' ).length;\n // emty the results list and replace it with the truncated results\n $( '.result-count' ).empty().append( numResults );\n // fade the number of results in\n $( '.result-count' ).fadeIn( 250 );\n // check how many results have been returned\n if( numResults > 0 ) {\n // there's at least 1 result - show it\n $( '.search-results' ).fadeIn( 250 );\n } else {\n // there's no results - hide them forever\n $( '.search-results' ).fadeOut( 250 );\n }\n // append a label for related search results\n $( '.search-result.related' ).first().before( \"<div class='also-interested'>Products You may also be interested in:</div>\" );\n } );\n } );\n // handle the closing of the search form\n $( '.close-nav-search' ).click( function() {\n // fade out the search form\n $( '.nav-search' ).fadeOut( 250, function() {\n // reset the value of the search input\n $( this ).find( 'input' ).val( '' );\n // fade the navlinks back in\n $( '.nav-links.main' ).fadeIn( 250, function() {\n // empty the search results\n $( '.search-results .results' ).empty();\n // hide the results container\n $( '.search-results' ).hide();\n } );\n } );\n } );\n } );\n } );\n } else {\n // just a normal navlink was clicked - don't open search form\n }\n } );\n}", "title": "" } ]
cfca7758dbc6fa206c657142eb65df64
date from string and array of format strings
[ { "docid": "81c65fac11471175c510ae69f503d6bd", "score": "0.0", "text": "function configFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n getParsingFlags(config).invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._f = config._f[i];\n configFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += getParsingFlags(tempConfig).charsLeftOver;\n\n //or tokens\n currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;\n\n getParsingFlags(tempConfig).score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" } ]
[ { "docid": "579ca415e239846cd1f1468bab9983a9", "score": "0.6991519", "text": "function makeDateFromStringAndArray(string, formats) {\n var output,\n inputParts = string.match(parseMultipleFormatChunker) || [],\n formattedInputParts,\n scoreToBeat = 99,\n i,\n currentDate,\n currentScore;\n for (i = 0; i < formats.length; i++) {\n currentDate = makeDateFromStringAndFormat(string, formats[i]);\n formattedInputParts = formatMoment(new Moment(currentDate), formats[i]).match(parseMultipleFormatChunker) || [];\n currentScore = compareArrays(inputParts, formattedInputParts);\n if (currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n output = currentDate;\n }\n }\n return output;\n }", "title": "" }, { "docid": "579ca415e239846cd1f1468bab9983a9", "score": "0.6991519", "text": "function makeDateFromStringAndArray(string, formats) {\n var output,\n inputParts = string.match(parseMultipleFormatChunker) || [],\n formattedInputParts,\n scoreToBeat = 99,\n i,\n currentDate,\n currentScore;\n for (i = 0; i < formats.length; i++) {\n currentDate = makeDateFromStringAndFormat(string, formats[i]);\n formattedInputParts = formatMoment(new Moment(currentDate), formats[i]).match(parseMultipleFormatChunker) || [];\n currentScore = compareArrays(inputParts, formattedInputParts);\n if (currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n output = currentDate;\n }\n }\n return output;\n }", "title": "" }, { "docid": "ba804a4273a6266ec682ec342c262a64", "score": "0.6980215", "text": "function makeDateFromStringAndArray(string, formats) {\n var output, inputParts = string.match(parseMultipleFormatChunker) || [],\n formattedInputParts, scoreToBeat = 99,\n i, currentDate, currentScore;\n for (i = 0; i < formats.length; i++) {\n currentDate = makeDateFromStringAndFormat(string, formats[i]);\n formattedInputParts = formatMoment(new Moment(currentDate), formats[i]).match(parseMultipleFormatChunker) || [];\n currentScore = compareArrays(inputParts, formattedInputParts);\n if (currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n output = currentDate;\n }\n }\n return output;\n }", "title": "" }, { "docid": "caccc85603abff625e5dd89e8d90c441", "score": "0.6910817", "text": "function makeDateFromStringAndFormat(string, format) {\n var datePartArray = [0, 0, 1, 0, 0, 0, 0],\n config = {\n tzh : 0, // timezone hour offset\n tzm : 0 // timezone minute offset\n },\n tokens = format.match(formattingTokens),\n i, parsedInput;\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i]).exec(string) || [])[0];\n string = string.replace(getParseRegexForToken(tokens[i]), '');\n addTimeToArrayFromToken(tokens[i], parsedInput, datePartArray, config);\n }\n // handle am pm\n if (config.isPm && datePartArray[3] < 12) {\n datePartArray[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config.isPm === false && datePartArray[3] === 12) {\n datePartArray[3] = 0;\n }\n // handle timezone\n datePartArray[3] += config.tzh;\n datePartArray[4] += config.tzm;\n // return\n return config.isUTC ? new Date(Date.UTC.apply({}, datePartArray)) : dateFromArray(datePartArray);\n }", "title": "" }, { "docid": "f8f15050da27d3bec68fbac98e8988e8", "score": "0.68754214", "text": "function makeDateFromStringAndFormat(string, format) {\n var datePartArray = [0, 0, 1, 0, 0, 0, 0],\n config = {\n tzh: 0,\n // timezone hour offset\n tzm: 0 // timezone minute offset\n },\n tokens = format.match(formattingTokens),\n i, parsedInput;\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i]).exec(string) || [])[0];\n string = string.replace(getParseRegexForToken(tokens[i]), '');\n addTimeToArrayFromToken(tokens[i], parsedInput, datePartArray, config);\n }\n // handle am pm\n if (config.isPm && datePartArray[3] < 12) {\n datePartArray[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config.isPm === false && datePartArray[3] === 12) {\n datePartArray[3] = 0;\n }\n // handle timezone\n datePartArray[3] += config.tzh;\n datePartArray[4] += config.tzm;\n // return\n return config.isUTC ? new Date(Date.UTC.apply({}, datePartArray)) : dateFromArray(datePartArray);\n }", "title": "" }, { "docid": "84d70c0d6219045b4725ae208f29ce82", "score": "0.68673915", "text": "function makeDateFromStringAndFormat(string, format) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n // We store some additional data on the array for validation\n // datePartArray[7] is true if the Date was created with `Date.UTC` and false if created with `new Date`\n // datePartArray[8] is false if the Date is invalid, and undefined if the validity is unknown.\n var datePartArray = [0, 0, 1, 0, 0, 0, 0],\n config = {\n tzh : 0, // timezone hour offset\n tzm : 0 // timezone minute offset\n },\n tokens = format.match(formattingTokens),\n i, parsedInput;\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i]).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, datePartArray, config);\n }\n }\n // handle am pm\n if (config.isPm && datePartArray[3] < 12) {\n datePartArray[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config.isPm === false && datePartArray[3] === 12) {\n datePartArray[3] = 0;\n }\n // return\n return dateFromArray(datePartArray, config.isUTC, config.tzh, config.tzm);\n }", "title": "" }, { "docid": "731e7675bfe4de3fc83b3efe7e36f05f", "score": "0.68672967", "text": "static createFromFormat(format, date) {\n const result = new DateExtended();\n for (let i = 0; i < format.length; i++) {\n let match = null;\n switch (format[i]) {\n case 'd':\n case 'j':\n match = date.match(format[i] === 'd' ? /^[0-9]{2}/ : /^[0-9]{1,2}/);\n if (match !== null) {\n match = match[0];\n if (match > 0 && match < 32) {\n result.setDate(parseInt(match));\n }\n else {\n match = null;\n }\n }\n break;\n case 'F':\n case 'M': {\n const array = format[i] === 'F'\n ? locales[result.getLocale()].monthNames\n : locales[result.getLocale()].monthShortNames;\n for (let m = 0; m < array.length; m++) {\n match = date.match(new RegExp('^' + array[m]));\n if (match !== null) {\n match = match[0];\n result.setMonthSafely(m);\n break;\n }\n }\n break;\n }\n case 'm':\n case 'n':\n match = date.match(format[i] === 'm' ? /^[0-9]{2}/ : /^[0-9]{1,2}/);\n if (match !== null) {\n match = match[0];\n if (match > 0 && match < 13) {\n result.setMonthSafely(match - 1);\n }\n else {\n match = null;\n }\n }\n break;\n case 'Y':\n case 'y':\n match = date.match(format[i] === 'Y' ? /^[0-9]{4}/ : /^[0-9]{2}/);\n if (match !== null) {\n match = match[0];\n result.setFullYear(parseInt(format[i] === 'Y' ? match : '20' + match));\n }\n break;\n case 'g':\n case 'G':\n case 'h':\n case 'H':\n match = date.match(format[i] === 'h' || format[i] === 'H' ? /^[0-9]{2}/ : /^[0-9]{1,2}/);\n if (match !== null) {\n match = match[0];\n if (match >= 0\n && (((format[i] === 'g' || format[i] === 'h') && match < 13)\n || ((format[i] === 'G' || format[i] === 'H') && match < 24))) {\n result.setHours(parseInt(match));\n }\n else {\n match = null;\n }\n }\n break;\n case 'i':\n case 's':\n match = date.match(/^[0-9]{2}/);\n if (match !== null) {\n match = match[0];\n if (match > 0 && match < 60) {\n if (format[i] === 'i') {\n result.setMinutes(parseInt(match));\n }\n else {\n result.setSeconds(parseInt(match));\n }\n }\n }\n break;\n default:\n match = format[i];\n break;\n }\n if (match === null) {\n result.setTime(NaN); // make it an invalid date\n break;\n }\n date = date.replace(match, '');\n }\n return result;\n }", "title": "" }, { "docid": "a4684adce70a87e67a09554f14ea2bec", "score": "0.68408686", "text": "function makeDateFromStringAndArray(string, formats) {\n var output,\n inputParts = string.match(inputCharacters),\n scores = [],\n scoreToBeat = 99,\n i,\n curDate,\n curScore;\n for (i = 0; i < formats.length; i++) {\n curDate = makeDateFromStringAndFormat(string, formats[i]);\n curScore = compareArrays(inputParts, formatDate(curDate, formats[i]).match(inputCharacters));\n if (curScore < scoreToBeat) {\n scoreToBeat = curScore;\n output = curDate;\n }\n }\n return output;\n }", "title": "" }, { "docid": "ca0d4030141985816ad21d188d6219bf", "score": "0.68302864", "text": "function stringToDate(input, format) {\n\n\tvar stringparts = input.split('-');\n\tif (stringparts.length == 1) {\n\t\treturn new Date(input, 0);\n\t} else {\n\t\tformat = format || 'yyyy-mm-dd'; // default format\n\t\tvar parts = input.match(/(\\d+)/g),\n\t\t\ti = 0,\n\t\t\tfmt = {};\n\t\t// extract date-part indexes from the format\n\t\tformat.replace(/(yyyy|dd|mm)/g, function(part) {\n\t\t\tfmt[part] = i++;\n\t\t});\n\t\treturn new Date(parts[fmt['yyyy']], parts[fmt['mm']] - 1, parts[fmt['dd']]);\n\t}\n}", "title": "" }, { "docid": "6ca74b9f56dd311eea8b272c9bd93454", "score": "0.6810983", "text": "function makeDateFromStringAndArray(string, formats) {\n var output,\n inputParts = string.match(inputCharacters),\n scores = [],\n scoreToBeat = 99,\n i,\n curDate,\n curScore;\n for (i = 0; i < formats.length; i++) {\n curDate = makeDateFromStringAndFormat(string, formats[i]);\n curScore = compareArrays(inputParts, formatMoment(new Moment(curDate), formats[i]).match(inputCharacters));\n if (curScore < scoreToBeat) {\n scoreToBeat = curScore;\n output = curDate;\n }\n }\n return output;\n }", "title": "" }, { "docid": "7c83ebbd029fa2bdf81b70eb258863b7", "score": "0.6737283", "text": "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var tokens = config._f.match(formattingTokens),\n string = config._i,\n i, parsedInput;\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i]).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "title": "" }, { "docid": "9e719923867a13f268f0ad345d7a4b3a", "score": "0.67108166", "text": "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var tokens = config._f.match(formattingTokens),\n string = config._i,\n i, parsedInput;\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i], config).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n\n // add remaining unparsed input to the string\n if (string) {\n config._il = string;\n }\n\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "title": "" }, { "docid": "9e719923867a13f268f0ad345d7a4b3a", "score": "0.67108166", "text": "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var tokens = config._f.match(formattingTokens),\n string = config._i,\n i, parsedInput;\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i], config).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n\n // add remaining unparsed input to the string\n if (string) {\n config._il = string;\n }\n\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "title": "" }, { "docid": "f500c335d2c712624a7d4657b6e5baba", "score": "0.66442466", "text": "function parseDate(input,format) {\n\t\tif ( format == \"european\" ) {\n\t\t\tvar parts = input.split('-');\n\t\t} else if ( format == \"american\" ) {\n\t\t\tvar parts = input.split('/');\n\t\t}\n\t\t// new Date(year, month [, day [, hours[, minutes[, seconds[, ms]]]]])\n\t\tif ( format == \"european\" ) {\n\t\t\treturn new Date(parts[2], parts[1]-1, parts[0]); // Note: months are 0-based\n\t\t} else if ( format == \"american\" ) {\n\t\t\treturn new Date(parts[2], parts[0]-1, parts[1]); // Note: months are 0-based\n\t\t}\n\t}", "title": "" }, { "docid": "cdeca56d1da73793a72783a9a37e2ee2", "score": "0.6586129", "text": "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (getParseRegexForToken(token, config).exec(string) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "cdeca56d1da73793a72783a9a37e2ee2", "score": "0.6586129", "text": "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (getParseRegexForToken(token, config).exec(string) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "154a666aeb8bb40caff35e2e14d380f5", "score": "0.65733665", "text": "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "154a666aeb8bb40caff35e2e14d380f5", "score": "0.65733665", "text": "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "154a666aeb8bb40caff35e2e14d380f5", "score": "0.65733665", "text": "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "154a666aeb8bb40caff35e2e14d380f5", "score": "0.65733665", "text": "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "154a666aeb8bb40caff35e2e14d380f5", "score": "0.65733665", "text": "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "154a666aeb8bb40caff35e2e14d380f5", "score": "0.65733665", "text": "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "154a666aeb8bb40caff35e2e14d380f5", "score": "0.65733665", "text": "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "154a666aeb8bb40caff35e2e14d380f5", "score": "0.65733665", "text": "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "154a666aeb8bb40caff35e2e14d380f5", "score": "0.65733665", "text": "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "154a666aeb8bb40caff35e2e14d380f5", "score": "0.65733665", "text": "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "154a666aeb8bb40caff35e2e14d380f5", "score": "0.65733665", "text": "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "a0920d56d94503dbedf5316dc914c9ea", "score": "0.6477506", "text": "function parseDateField (s) {\n let tmp = s\n\n // Sometimes AZ decides to output their dates differently, eg\n // T_5122020,T_5202013 -- note the first is m/dd/yyyy, the next is\n // m/yyyy/dd. Great job, AZ! Doing fixes for specific dates, b/c\n // who knows what will happen in 2021.\n const flipYearDay = [\n 'T_3202021',\n 'T_3202022',\n 'T_3202023',\n 'T_3202024',\n 'T_3202025',\n 'T_3202026',\n 'T_3202027',\n 'T_3202028',\n 'T_5202013',\n 'T_5202014',\n 'T_5202015',\n 'T_5202016',\n 'T_5202017',\n 'T_5202018',\n 'T_5202019'\n ]\n const fixDates = flipYearDay.reduce((hsh, t) => {\n hsh[t] = t.replace('2020', '') + '2020'\n return hsh\n }, {})\n\n // Other weird dates:\n fixDates.T_04212020 = 'T_4212020'\n fixDates.T_72352020 = 'T_7252020' // Between T_7242020 and T_7262020\n\n tmp = fixDates[tmp] || tmp\n\n let d = tmp.split('_')[1]\n d = d.padStart(8, '0')\n const month = d.slice(0, 2)\n const day = d.slice(2, 4)\n const year = d.slice(4)\n\n const p = n => parseInt(n, 10)\n assert(p(day) >= 1 && p(day) <= 31, `day ${day} valid for ${d}`)\n assert(p(month) >= 1 && p(month) <= 12, `month ${month} valid for ${d}`)\n assert(p(year) >= 2020 && p(year) <= new Date().getFullYear(), `year ${year} valid for ${d}`)\n\n const ret = [ year, month, day ]\n .map(n => `${n}`)\n .map(s => s.padStart(2, '0'))\n .join('-')\n return ret\n}", "title": "" }, { "docid": "a4bd7cab24bdcb41ec3e51fdf1a37ce8", "score": "0.6475452", "text": "function dateFromString(date, format) {\n\tif (!format) {\n\t\treturn moment(date);\n\t}\n\t// try parsing csv format\n\treturn moment(date, format);\n}", "title": "" }, { "docid": "342ffd53c3fbea28478fd1e06c83e80a", "score": "0.6460356", "text": "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "title": "" }, { "docid": "7e1f0c65d6d90983fe64a32a1f608580", "score": "0.6419414", "text": "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "title": "" }, { "docid": "7e1f0c65d6d90983fe64a32a1f608580", "score": "0.6419414", "text": "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "title": "" }, { "docid": "60f4b41a5d4486b19bd15766244ef63f", "score": "0.6418691", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "6b9562146a46d98639f1b24ceea5f376", "score": "0.6407858", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "6b9562146a46d98639f1b24ceea5f376", "score": "0.6407858", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "6b9562146a46d98639f1b24ceea5f376", "score": "0.6407858", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "6b9562146a46d98639f1b24ceea5f376", "score": "0.6407858", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "6b9562146a46d98639f1b24ceea5f376", "score": "0.6407858", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "6b9562146a46d98639f1b24ceea5f376", "score": "0.6407858", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "6b9562146a46d98639f1b24ceea5f376", "score": "0.6407858", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "6b9562146a46d98639f1b24ceea5f376", "score": "0.6407858", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "6b9562146a46d98639f1b24ceea5f376", "score": "0.6407858", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "fba7063791016a9c58b2e05824b5a522", "score": "0.6394346", "text": "parseDate(value, format) {\n if (format == null || value == null) {\n throw \"Invalid arguments\";\n }\n value = (typeof value === \"object\" ? value.toString() : value + \"\");\n if (value === \"\") {\n return null;\n }\n let iFormat, dim, extra, iValue = 0, shortYearCutoff = (typeof this.shortYearCutoff !== \"string\" ? this.shortYearCutoff : new Date().getFullYear() % 100 + parseInt(this.shortYearCutoff, 10)), year = -1, month = -1, day = -1, doy = -1, literal = false, date, lookAhead = (match) => {\n let matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);\n if (matches) {\n iFormat++;\n }\n return matches;\n }, getNumber = (match) => {\n let isDoubled = lookAhead(match), size = (match === \"@\" ? 14 : (match === \"!\" ? 20 :\n (match === \"y\" && isDoubled ? 4 : (match === \"o\" ? 3 : 2)))), minSize = (match === \"y\" ? size : 1), digits = new RegExp(\"^\\\\d{\" + minSize + \",\" + size + \"}\"), num = value.substring(iValue).match(digits);\n if (!num) {\n throw \"Missing number at position \" + iValue;\n }\n iValue += num[0].length;\n return parseInt(num[0], 10);\n }, getName = (match, shortNames, longNames) => {\n let index = -1;\n let arr = lookAhead(match) ? longNames : shortNames;\n let names = [];\n for (let i = 0; i < arr.length; i++) {\n names.push([i, arr[i]]);\n }\n names.sort((a, b) => {\n return -(a[1].length - b[1].length);\n });\n for (let i = 0; i < names.length; i++) {\n let name = names[i][1];\n if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) {\n index = names[i][0];\n iValue += name.length;\n break;\n }\n }\n if (index !== -1) {\n return index + 1;\n }\n else {\n throw \"Unknown name at position \" + iValue;\n }\n }, checkLiteral = () => {\n if (value.charAt(iValue) !== format.charAt(iFormat)) {\n throw \"Unexpected literal at position \" + iValue;\n }\n iValue++;\n };\n if (this.view === 'month') {\n day = 1;\n }\n for (iFormat = 0; iFormat < format.length; iFormat++) {\n if (literal) {\n if (format.charAt(iFormat) === \"'\" && !lookAhead(\"'\")) {\n literal = false;\n }\n else {\n checkLiteral();\n }\n }\n else {\n switch (format.charAt(iFormat)) {\n case \"d\":\n day = getNumber(\"d\");\n break;\n case \"D\":\n getName(\"D\", this.getTranslation(primeng_api__WEBPACK_IMPORTED_MODULE_6__[\"TranslationKeys\"].DAY_NAMES_SHORT), this.getTranslation(primeng_api__WEBPACK_IMPORTED_MODULE_6__[\"TranslationKeys\"].DAY_NAMES));\n break;\n case \"o\":\n doy = getNumber(\"o\");\n break;\n case \"m\":\n month = getNumber(\"m\");\n break;\n case \"M\":\n month = getName(\"M\", this.getTranslation(primeng_api__WEBPACK_IMPORTED_MODULE_6__[\"TranslationKeys\"].MONTH_NAMES_SHORT), this.getTranslation(primeng_api__WEBPACK_IMPORTED_MODULE_6__[\"TranslationKeys\"].MONTH_NAMES));\n break;\n case \"y\":\n year = getNumber(\"y\");\n break;\n case \"@\":\n date = new Date(getNumber(\"@\"));\n year = date.getFullYear();\n month = date.getMonth() + 1;\n day = date.getDate();\n break;\n case \"!\":\n date = new Date((getNumber(\"!\") - this.ticksTo1970) / 10000);\n year = date.getFullYear();\n month = date.getMonth() + 1;\n day = date.getDate();\n break;\n case \"'\":\n if (lookAhead(\"'\")) {\n checkLiteral();\n }\n else {\n literal = true;\n }\n break;\n default:\n checkLiteral();\n }\n }\n }\n if (iValue < value.length) {\n extra = value.substr(iValue);\n if (!/^\\s+/.test(extra)) {\n throw \"Extra/unparsed characters found in date: \" + extra;\n }\n }\n if (year === -1) {\n year = new Date().getFullYear();\n }\n else if (year < 100) {\n year += new Date().getFullYear() - new Date().getFullYear() % 100 +\n (year <= shortYearCutoff ? 0 : -100);\n }\n if (doy > -1) {\n month = 1;\n day = doy;\n do {\n dim = this.getDaysCountInMonth(year, month - 1);\n if (day <= dim) {\n break;\n }\n month++;\n day -= dim;\n } while (true);\n }\n date = this.daylightSavingAdjust(new Date(year, month - 1, day));\n if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) {\n throw \"Invalid date\"; // E.g. 31/02/00\n }\n return date;\n }", "title": "" }, { "docid": "fba7063791016a9c58b2e05824b5a522", "score": "0.6394346", "text": "parseDate(value, format) {\n if (format == null || value == null) {\n throw \"Invalid arguments\";\n }\n value = (typeof value === \"object\" ? value.toString() : value + \"\");\n if (value === \"\") {\n return null;\n }\n let iFormat, dim, extra, iValue = 0, shortYearCutoff = (typeof this.shortYearCutoff !== \"string\" ? this.shortYearCutoff : new Date().getFullYear() % 100 + parseInt(this.shortYearCutoff, 10)), year = -1, month = -1, day = -1, doy = -1, literal = false, date, lookAhead = (match) => {\n let matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);\n if (matches) {\n iFormat++;\n }\n return matches;\n }, getNumber = (match) => {\n let isDoubled = lookAhead(match), size = (match === \"@\" ? 14 : (match === \"!\" ? 20 :\n (match === \"y\" && isDoubled ? 4 : (match === \"o\" ? 3 : 2)))), minSize = (match === \"y\" ? size : 1), digits = new RegExp(\"^\\\\d{\" + minSize + \",\" + size + \"}\"), num = value.substring(iValue).match(digits);\n if (!num) {\n throw \"Missing number at position \" + iValue;\n }\n iValue += num[0].length;\n return parseInt(num[0], 10);\n }, getName = (match, shortNames, longNames) => {\n let index = -1;\n let arr = lookAhead(match) ? longNames : shortNames;\n let names = [];\n for (let i = 0; i < arr.length; i++) {\n names.push([i, arr[i]]);\n }\n names.sort((a, b) => {\n return -(a[1].length - b[1].length);\n });\n for (let i = 0; i < names.length; i++) {\n let name = names[i][1];\n if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) {\n index = names[i][0];\n iValue += name.length;\n break;\n }\n }\n if (index !== -1) {\n return index + 1;\n }\n else {\n throw \"Unknown name at position \" + iValue;\n }\n }, checkLiteral = () => {\n if (value.charAt(iValue) !== format.charAt(iFormat)) {\n throw \"Unexpected literal at position \" + iValue;\n }\n iValue++;\n };\n if (this.view === 'month') {\n day = 1;\n }\n for (iFormat = 0; iFormat < format.length; iFormat++) {\n if (literal) {\n if (format.charAt(iFormat) === \"'\" && !lookAhead(\"'\")) {\n literal = false;\n }\n else {\n checkLiteral();\n }\n }\n else {\n switch (format.charAt(iFormat)) {\n case \"d\":\n day = getNumber(\"d\");\n break;\n case \"D\":\n getName(\"D\", this.getTranslation(primeng_api__WEBPACK_IMPORTED_MODULE_6__[\"TranslationKeys\"].DAY_NAMES_SHORT), this.getTranslation(primeng_api__WEBPACK_IMPORTED_MODULE_6__[\"TranslationKeys\"].DAY_NAMES));\n break;\n case \"o\":\n doy = getNumber(\"o\");\n break;\n case \"m\":\n month = getNumber(\"m\");\n break;\n case \"M\":\n month = getName(\"M\", this.getTranslation(primeng_api__WEBPACK_IMPORTED_MODULE_6__[\"TranslationKeys\"].MONTH_NAMES_SHORT), this.getTranslation(primeng_api__WEBPACK_IMPORTED_MODULE_6__[\"TranslationKeys\"].MONTH_NAMES));\n break;\n case \"y\":\n year = getNumber(\"y\");\n break;\n case \"@\":\n date = new Date(getNumber(\"@\"));\n year = date.getFullYear();\n month = date.getMonth() + 1;\n day = date.getDate();\n break;\n case \"!\":\n date = new Date((getNumber(\"!\") - this.ticksTo1970) / 10000);\n year = date.getFullYear();\n month = date.getMonth() + 1;\n day = date.getDate();\n break;\n case \"'\":\n if (lookAhead(\"'\")) {\n checkLiteral();\n }\n else {\n literal = true;\n }\n break;\n default:\n checkLiteral();\n }\n }\n }\n if (iValue < value.length) {\n extra = value.substr(iValue);\n if (!/^\\s+/.test(extra)) {\n throw \"Extra/unparsed characters found in date: \" + extra;\n }\n }\n if (year === -1) {\n year = new Date().getFullYear();\n }\n else if (year < 100) {\n year += new Date().getFullYear() - new Date().getFullYear() % 100 +\n (year <= shortYearCutoff ? 0 : -100);\n }\n if (doy > -1) {\n month = 1;\n day = doy;\n do {\n dim = this.getDaysCountInMonth(year, month - 1);\n if (day <= dim) {\n break;\n }\n month++;\n day -= dim;\n } while (true);\n }\n date = this.daylightSavingAdjust(new Date(year, month - 1, day));\n if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) {\n throw \"Invalid date\"; // E.g. 31/02/00\n }\n return date;\n }", "title": "" }, { "docid": "5eab5c2b210f4729e195b35595a6ed17", "score": "0.6393673", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n initializeParsingFlags(tempConfig);\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "5eab5c2b210f4729e195b35595a6ed17", "score": "0.6393673", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n initializeParsingFlags(tempConfig);\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "5eab5c2b210f4729e195b35595a6ed17", "score": "0.6393673", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n initializeParsingFlags(tempConfig);\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "5eab5c2b210f4729e195b35595a6ed17", "score": "0.6393673", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n initializeParsingFlags(tempConfig);\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "5eab5c2b210f4729e195b35595a6ed17", "score": "0.6393673", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n initializeParsingFlags(tempConfig);\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "5eab5c2b210f4729e195b35595a6ed17", "score": "0.6393673", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n initializeParsingFlags(tempConfig);\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "21b250239e0090ed4a8770afeccd1cf0", "score": "0.63722515", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "73903f1c82c7b60db753e1755e164eb7", "score": "0.63715315", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "73903f1c82c7b60db753e1755e164eb7", "score": "0.63715315", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "73903f1c82c7b60db753e1755e164eb7", "score": "0.63715315", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "73903f1c82c7b60db753e1755e164eb7", "score": "0.63715315", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "73903f1c82c7b60db753e1755e164eb7", "score": "0.63715315", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "73903f1c82c7b60db753e1755e164eb7", "score": "0.63715315", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "73903f1c82c7b60db753e1755e164eb7", "score": "0.63715315", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "73903f1c82c7b60db753e1755e164eb7", "score": "0.63715315", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "73903f1c82c7b60db753e1755e164eb7", "score": "0.63715315", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "73903f1c82c7b60db753e1755e164eb7", "score": "0.63715315", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "8cdf7bab268d1be1846ce9379c510df5", "score": "0.63642794", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "8cdf7bab268d1be1846ce9379c510df5", "score": "0.63642794", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "8cdf7bab268d1be1846ce9379c510df5", "score": "0.63642794", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "8cdf7bab268d1be1846ce9379c510df5", "score": "0.63642794", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "8cdf7bab268d1be1846ce9379c510df5", "score": "0.63642794", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "8cdf7bab268d1be1846ce9379c510df5", "score": "0.63642794", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "8cdf7bab268d1be1846ce9379c510df5", "score": "0.63642794", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "8cdf7bab268d1be1846ce9379c510df5", "score": "0.63642794", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "8cdf7bab268d1be1846ce9379c510df5", "score": "0.63642794", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "8cdf7bab268d1be1846ce9379c510df5", "score": "0.63642794", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "8cdf7bab268d1be1846ce9379c510df5", "score": "0.63642794", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "8cdf7bab268d1be1846ce9379c510df5", "score": "0.63642794", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "8cdf7bab268d1be1846ce9379c510df5", "score": "0.63642794", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "8cdf7bab268d1be1846ce9379c510df5", "score": "0.63642794", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "8cdf7bab268d1be1846ce9379c510df5", "score": "0.63642794", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "8cdf7bab268d1be1846ce9379c510df5", "score": "0.63642794", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "8cdf7bab268d1be1846ce9379c510df5", "score": "0.63642794", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "8cdf7bab268d1be1846ce9379c510df5", "score": "0.63642794", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "67aa456f0b260212e98e29efd5b61b26", "score": "0.6350665", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "67aa456f0b260212e98e29efd5b61b26", "score": "0.6350665", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "67aa456f0b260212e98e29efd5b61b26", "score": "0.6350665", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "67aa456f0b260212e98e29efd5b61b26", "score": "0.6350665", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "67aa456f0b260212e98e29efd5b61b26", "score": "0.6350665", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "67aa456f0b260212e98e29efd5b61b26", "score": "0.6350665", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "67aa456f0b260212e98e29efd5b61b26", "score": "0.6350665", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "67aa456f0b260212e98e29efd5b61b26", "score": "0.6350665", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "0b887867dc6ea476ca291f0162a91c97", "score": "0.63492936", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "0b887867dc6ea476ca291f0162a91c97", "score": "0.63492936", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "0b887867dc6ea476ca291f0162a91c97", "score": "0.63492936", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "0b887867dc6ea476ca291f0162a91c97", "score": "0.63492936", "text": "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "title": "" }, { "docid": "4cddc2cf2f7a90fe7f407508a7582e04", "score": "0.6341776", "text": "function makeDateFromStringAndArray(config) {\n\t var tempConfig,\n\t bestMoment,\n\n\t scoreToBeat,\n\t i,\n\t currentScore;\n\n\t if (config._f.length === 0) {\n\t config._pf.invalidFormat = true;\n\t config._d = new Date(NaN);\n\t return;\n\t }\n\n\t for (i = 0; i < config._f.length; i++) {\n\t currentScore = 0;\n\t tempConfig = copyConfig({}, config);\n\t if (config._useUTC != null) {\n\t tempConfig._useUTC = config._useUTC;\n\t }\n\t tempConfig._pf = defaultParsingFlags();\n\t tempConfig._f = config._f[i];\n\t makeDateFromStringAndFormat(tempConfig);\n\n\t if (!isValid(tempConfig)) {\n\t continue;\n\t }\n\n\t // if there is any input that was not parsed add a penalty for that format\n\t currentScore += tempConfig._pf.charsLeftOver;\n\n\t //or tokens\n\t currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n\t tempConfig._pf.score = currentScore;\n\n\t if (scoreToBeat == null || currentScore < scoreToBeat) {\n\t scoreToBeat = currentScore;\n\t bestMoment = tempConfig;\n\t }\n\t }\n\n\t extend(config, bestMoment || tempConfig);\n\t }", "title": "" }, { "docid": "fcab92cc8ddaa5f86bc07267370a5d08", "score": "0.6341595", "text": "parseDate(str, format) {\n var date;\n\n date = moment(str, format || this._o.inputFormats);\n date = date.isValid() ? date.toDate() : null;\n\n return date;\n }", "title": "" }, { "docid": "19eb9029b99a3759d2c5f58fc7716d17", "score": "0.6341498", "text": "function makeDateFromStringAndFormat(config) {\n\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "19eb9029b99a3759d2c5f58fc7716d17", "score": "0.6341498", "text": "function makeDateFromStringAndFormat(config) {\n\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "81fa4f6971aa8aabeb853b08a9ab2500", "score": "0.63260144", "text": "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 4; i > 0; i--) {\n if (match[i]) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i - 1] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "title": "" }, { "docid": "81fa4f6971aa8aabeb853b08a9ab2500", "score": "0.63260144", "text": "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 4; i > 0; i--) {\n if (match[i]) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i - 1] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "title": "" }, { "docid": "042d9a8abe1745df37d2bb6c41802418", "score": "0.63236946", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "042d9a8abe1745df37d2bb6c41802418", "score": "0.63236946", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "042d9a8abe1745df37d2bb6c41802418", "score": "0.63236946", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" }, { "docid": "042d9a8abe1745df37d2bb6c41802418", "score": "0.63236946", "text": "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n dateFromConfig(config);\n checkOverflow(config);\n }", "title": "" } ]
e4d5f4ca434db2b5a6e348d546ff8a1c
here's where we render stuff
[ { "docid": "7fac89c8d89f234fdbc7f34fa8cc6fc8", "score": "0.0", "text": "render() {\n\t\treturn (\n\t\t\t// create a container \"div\"\n\t\t\t// and render the popcorn image inside of it\n\t\t\t<View style={styles.container}>\n\t\t\t\t<Image source={popcornImg} style={{ height: 200, width: 200 }}/>\n\t\t\t</View>\n\n\t\t)\n\t}", "title": "" } ]
[ { "docid": "b5c1ae356522f027b4482cc54d40a3d3", "score": "0.76207453", "text": "render(ctx) {}", "title": "" }, { "docid": "a73ed9f76d16d5533192777d7070f623", "score": "0.7553413", "text": "_onRender() {}", "title": "" }, { "docid": "52a3157dccc8fb8d993576cc5df0cf6d", "score": "0.7522712", "text": "render() {}", "title": "" }, { "docid": "52a3157dccc8fb8d993576cc5df0cf6d", "score": "0.7522712", "text": "render() {}", "title": "" }, { "docid": "52a3157dccc8fb8d993576cc5df0cf6d", "score": "0.7522712", "text": "render() {}", "title": "" }, { "docid": "52a3157dccc8fb8d993576cc5df0cf6d", "score": "0.7522712", "text": "render() {}", "title": "" }, { "docid": "52a3157dccc8fb8d993576cc5df0cf6d", "score": "0.7522712", "text": "render() {}", "title": "" }, { "docid": "52a3157dccc8fb8d993576cc5df0cf6d", "score": "0.7522712", "text": "render() {}", "title": "" }, { "docid": "55a471b24674cd3c488584140711ea11", "score": "0.7441996", "text": "render () {}", "title": "" }, { "docid": "afde40addb00551fa54904f5f23c9103", "score": "0.7401815", "text": "render () {\n\t\tgithub.render();\n\t\tcommit.render();\n\t\tplayer.render();\t\n\t\tcat.render();\t\n\t\t\t\n\t}", "title": "" }, { "docid": "87dad3b23eed89ec2f521715e8c9922c", "score": "0.73789024", "text": "render() {\n }", "title": "" }, { "docid": "81ca7d6215c1c18a05ae9d367ad6a954", "score": "0.73323125", "text": "onRender() {}", "title": "" }, { "docid": "417940a0b67c289606039bcf168c9152", "score": "0.73078954", "text": "function render() {\n\t\tinternalRender();\n\t}", "title": "" }, { "docid": "32ac13d21d8086c89c8444285e35ff26", "score": "0.7275752", "text": "renderContent() { }", "title": "" }, { "docid": "a197bb9a564cded0e6656e189204d649", "score": "0.7271819", "text": "postRendering() {}", "title": "" }, { "docid": "d2595ef449c6f89b157d1adeb705334e", "score": "0.72606534", "text": "render() { }", "title": "" }, { "docid": "0071baf457b4ca625f2ba94b391df821", "score": "0.72418326", "text": "render(context) {}", "title": "" }, { "docid": "febb6a4b1e88448d1bf1bdcc58116b6e", "score": "0.7192411", "text": "render(ctx)\n {\n }", "title": "" }, { "docid": "92d47ca593dd753f2daac54454a741c8", "score": "0.7168236", "text": "renderedCallback() { }", "title": "" }, { "docid": "458e2c5391d25fdce4343167c4b3002e", "score": "0.71173763", "text": "function render () {\n }", "title": "" }, { "docid": "c03bf2968afd65df17c9d3b68c6c9d47", "score": "0.69420636", "text": "function render() {\r\n\r\n}", "title": "" }, { "docid": "c03bf2968afd65df17c9d3b68c6c9d47", "score": "0.69420636", "text": "function render() {\r\n\r\n}", "title": "" }, { "docid": "c03bf2968afd65df17c9d3b68c6c9d47", "score": "0.69420636", "text": "function render() {\r\n\r\n}", "title": "" }, { "docid": "f37f4a6bd6ccbdf62098c6047b35d6a4", "score": "0.6938254", "text": "renderContent() {\n }", "title": "" }, { "docid": "1d132c47bb41552af2f1998fc230ffb0", "score": "0.6936651", "text": "function render() {\n self.render();\n }", "title": "" }, { "docid": "ce52db1c4ad1f8f4d863de5d46cc9d61", "score": "0.68437684", "text": "function render() {\n}", "title": "" }, { "docid": "52a76e5dd7c7945ca20bdcdde9caac3b", "score": "0.68297666", "text": "initialRender() {}", "title": "" }, { "docid": "f2972cf748d7a64e9188a6ba92a6117c", "score": "0.6828301", "text": "render() {\n }", "title": "" }, { "docid": "c9db8ad561add7fb71bb490ffde3a570", "score": "0.6818467", "text": "function render() {\n renderPrizes();\n renderUsers();\n}", "title": "" }, { "docid": "011b9c2d65f54d3a6551477c277fbbfa", "score": "0.6813416", "text": "render() {\n //\n }", "title": "" }, { "docid": "0ce8474e7099560937702082d446a5c5", "score": "0.6782553", "text": "render() {\n\n }", "title": "" }, { "docid": "65ded68292c0f90f0675737730c107ff", "score": "0.67707014", "text": "function render() {\n\n}", "title": "" }, { "docid": "65ded68292c0f90f0675737730c107ff", "score": "0.67707014", "text": "function render() {\n\n}", "title": "" }, { "docid": "1698af9375e9876221051b474ef16474", "score": "0.6708087", "text": "function render() {\n renderEntities();\n }", "title": "" }, { "docid": "f8d2b91b35ec97d559891f88017e4062", "score": "0.6697967", "text": "render () { \n\n }", "title": "" }, { "docid": "7f10bb1f739cd4f0335b71aed1126617", "score": "0.6675769", "text": "onFirstRender() {}", "title": "" }, { "docid": "93017876117b46487e13344671f717f7", "score": "0.667043", "text": "render() {\n\n }", "title": "" }, { "docid": "93017876117b46487e13344671f717f7", "score": "0.667043", "text": "render() {\n\n }", "title": "" }, { "docid": "93017876117b46487e13344671f717f7", "score": "0.667043", "text": "render() {\n\n }", "title": "" }, { "docid": "93017876117b46487e13344671f717f7", "score": "0.667043", "text": "render() {\n\n }", "title": "" }, { "docid": "93017876117b46487e13344671f717f7", "score": "0.667043", "text": "render() {\n\n }", "title": "" }, { "docid": "5822c47eea4715ef37bb5a3c23ebe157", "score": "0.66422236", "text": "executeRender()\n {\n\n if(this.state.isError)\n {\n\n return this.renderError();\n\n }\n else if(this.state.isLoaded)\n {\n\n return this.renderLoaded();\n\n }\n else\n {\n\n return this.renderLoading();\n\n }\n\n }", "title": "" }, { "docid": "335a1b1e055702fceaccd007b9b0575e", "score": "0.6631282", "text": "function render() {\n isRendered = true;\n renderSource();\n }", "title": "" }, { "docid": "2a805c3bdc18da3e07bea24483809f31", "score": "0.66277134", "text": "function renderEverything() {\n renderButtons()\n renderPrice()\n }", "title": "" }, { "docid": "379581c2cc9b23a36cb9ca670a8bab73", "score": "0.662341", "text": "render() {\n this.rendered = true;\n }", "title": "" }, { "docid": "df2ae315888a8b0763e896d559aaff80", "score": "0.6616082", "text": "function render() {\n\t\tclear();\n \tboard.render();\n \tscore.render();\n \tinputReleaseIndicator.render();\n }", "title": "" }, { "docid": "db2a8dd3f0618c85a6fad7c423a3b53c", "score": "0.66055304", "text": "render() {\n super.render();\n }", "title": "" }, { "docid": "db2a8dd3f0618c85a6fad7c423a3b53c", "score": "0.66055304", "text": "render() {\n super.render();\n }", "title": "" }, { "docid": "a9c5145439a0832b4ca7543bb761e2e7", "score": "0.6604662", "text": "function render() {\n if (!STORE.quizStarted) {\n startPageTemplate();\n } else if (STORE.feedback == true) {\n feedbackTemplate();\n } else if (STORE.questionNumber >= STORE.questions.length) {\n summaryTemplate();\n } else {\n questionTemplate();\n }\n}", "title": "" }, { "docid": "f1f01d1c4e3de5ef929c2cad83d344ca", "score": "0.6603946", "text": "render(g) { throw new Error('Implement me') }", "title": "" }, { "docid": "6eef7792aed2e9bdb15752b3aa3b39c2", "score": "0.65980357", "text": "afterRender() {}", "title": "" }, { "docid": "353d149e865d19ef7a08cdac2b485513", "score": "0.6592434", "text": "willRender() {}", "title": "" }, { "docid": "353d149e865d19ef7a08cdac2b485513", "score": "0.6592434", "text": "willRender() {}", "title": "" }, { "docid": "353d149e865d19ef7a08cdac2b485513", "score": "0.6592434", "text": "willRender() {}", "title": "" }, { "docid": "d0b54cade4582bbc0106e7ba12399c58", "score": "0.65855885", "text": "_firstRendered() { }", "title": "" }, { "docid": "d0b54cade4582bbc0106e7ba12399c58", "score": "0.65855885", "text": "_firstRendered() { }", "title": "" }, { "docid": "fef862dc2e56d7192e505c12a8264ac5", "score": "0.6581311", "text": "function render() {\r\n if(store.message !== '') {\r\n console.log('Showing message', store.message);\r\n $('main').html(templateMessage());\r\n } else if(!store.quizStarted) {\r\n $('main').html(startPage());\r\n } else if (store.questionNumber === store.questions.length) { \r\n $('main').html(endPage());\r\n } else {\r\n $('main').html(Question());\r\n }\r\n}", "title": "" }, { "docid": "710e68b187aecd75b752a2648c95c3e2", "score": "0.6569043", "text": "function renderEverything() {\n renderPepperonni()\n renderMushrooms()\n renderGreenPeppers()\n renderWhiteSauce()\n renderGlutenFreeCrust()\n\n renderButtons()\n renderPrice()\n}", "title": "" }, { "docid": "09cec39c6b7f564c3507791ba0a0450c", "score": "0.65670294", "text": "_firstRendered() {}", "title": "" }, { "docid": "11f26cce4cc8ccac874c8540963448bb", "score": "0.6560552", "text": "didRender() { }", "title": "" }, { "docid": "ed75a4a00c4123d3fffb37f29e83dbd1", "score": "0.6558752", "text": "didRender() {}", "title": "" }, { "docid": "ed75a4a00c4123d3fffb37f29e83dbd1", "score": "0.6558752", "text": "didRender() {}", "title": "" }, { "docid": "ed75a4a00c4123d3fffb37f29e83dbd1", "score": "0.6558752", "text": "didRender() {}", "title": "" }, { "docid": "7f81c5d64c0c382974b53f4026664cce", "score": "0.65551287", "text": "function render() {\r\n let html = '';\r\n //genereate start screen is boolean in false\r\n if (store.quizStarted === false) {\r\n $('main').html(generateStartScreenHtml());\r\n return;\r\n }\r\n // handles start and next question\r\n else if (store.currentQuestion >= 0 && store.currentQuestion < store.questions.length) {\r\n //updated score and question back fill with raw html\r\n html = generateQuestionNumberAndScoreHtml();\r\n html += generateQuestionHtml(currentQuestion());\r\n //grab html element \"main\" then adding html generated from above fuctions\r\n $('main').html(html);\r\n \r\n }\r\n else {\r\n $('main').html(generateQuizResultsString());\r\n }\r\n}", "title": "" }, { "docid": "f198d14cd3566dd7d988a74ab6f5e53f", "score": "0.6544291", "text": "function renderEverything() {\n renderPepperonni();\n renderMushrooms();\n renderGreenPeppers();\n renderWhiteSauce();\n renderGlutenFreeCrust();\n\n renderButtons();\n renderPrice();\n}", "title": "" }, { "docid": "55faddb525bfbd71c70c02915f767aac", "score": "0.65388554", "text": "function renderEverything() {\n renderPepperoni();\n renderMushrooms();\n renderGreenPeppers();\n renderWhiteSauce();\n renderGlutenFreeCrust();\n renderButtons();\n renderPrice();\n}", "title": "" }, { "docid": "03aa46eadbca28480a56e225e57fe929", "score": "0.65383685", "text": "render() {\n }", "title": "" }, { "docid": "d53dca5ea3b958b5e1d0a48126377bb7", "score": "0.6535553", "text": "preRendering() {}", "title": "" }, { "docid": "24d8d85db0f06e300d41b846f466011b", "score": "0.65309536", "text": "render (self) { return html``; }", "title": "" }, { "docid": "c574fc8c489045c55554df0bce33d9ee", "score": "0.65227735", "text": "function renderEverything() {\n renderPepperoni();\n renderMushrooms();\n renderGreenPeppers();\n renderWhiteSauce();\n renderGlutenFreeCrust();\n\n renderButtons();\n renderPrice();\n}", "title": "" }, { "docid": "f9eed01699bf5bd95817844e376a4e3e", "score": "0.6503265", "text": "function render() {\n\n if(gameState.current==='menu') {\n renderMenu();\n }\n else if(gameState.current==='game') {\n if(!complete) {\n renderSteps();\n renderWalls();\n renderLivesAndItems();\n renderEntities();\n }\n }\n else if(gameState.current==='end') {\n renderLivesAndItems();\n renderEnd();\n }\n }", "title": "" }, { "docid": "95ef98dcb2fe391afaa6113054cb1eb2", "score": "0.65015286", "text": "afterRender () {}", "title": "" }, { "docid": "19e0a8933ede99714d4b54b6a534eef1", "score": "0.64967525", "text": "render() {\n this._renderObjects();\n }", "title": "" }, { "docid": "3cc853f25ec36dc4d015e68db9e33ce5", "score": "0.6489687", "text": "function renderViewer(){\n renderProjectsInSidebar();\n renderMap();\n // renderImageViewer();\n renderProjectDetails();\n}", "title": "" }, { "docid": "1ac02682801166c01b80088dff347953", "score": "0.6474656", "text": "function _render(){\n $ul.html(Mustache.render(template, {people:people}));\n //stats.setPeople(people.length);\n events.emit('peopleChanged', people.length);\n }", "title": "" }, { "docid": "af094de9611a01b7428b6819947067d5", "score": "0.6472579", "text": "function render() {\n\n // flat background that changes color based on player state\n renderBackground();\n\n // show amount of life left in seconds\n var lifeString = clockString(Math.round(player.life));\n renderCountdown(lifeString);\n\n // render accumulated points\n renderPlayerPoints();\n\n // terrain assets from Udacity\n renderTerrain();\n\n // character assets\n renderEntities();\n }", "title": "" }, { "docid": "522b85aa7e3e262f3d64db7658ec17a3", "score": "0.64691234", "text": "render() { return null; }", "title": "" }, { "docid": "522b85aa7e3e262f3d64db7658ec17a3", "score": "0.64691234", "text": "render() { return null; }", "title": "" }, { "docid": "522b85aa7e3e262f3d64db7658ec17a3", "score": "0.64691234", "text": "render() { return null; }", "title": "" }, { "docid": "c024f950238d67a344aea0bc4a518d77", "score": "0.6467462", "text": "function render(){\n\t// Draw methods\n}", "title": "" }, { "docid": "2aa74a891633b15dad3cc0ed208f66d8", "score": "0.6463711", "text": "function render()\n {\n modReadline.cursorTo(process.stdout, 0, 0);\n\n switch (m_displayMode)\n {\n case \"epg\":\n renderEpg();\n break;\n case \"info\":\n renderInfo();\n break;\n }\n\n modReadline.clearScreenDown(process.stdout);\n }", "title": "" }, { "docid": "34a9081de66aa50c2c66c8c1f5403377", "score": "0.64583945", "text": "didRender() {\n // to be overridden by subclasses\n }", "title": "" }, { "docid": "18d613b662a069c665801e8ba222a2fa", "score": "0.6455486", "text": "function render() {\n $playerName.text(playerData.search_player_all.queryResults.row.name_display_first_last);\n $currentTeam.text(playerData.search_player_all.queryResults.row.team_abbrev);\n $positionPlayed.text(playerData.search_player_all.queryResults.row.position);\n $bats.text(playerData.search_player_all.queryResults.row.bats);\n $weight.text(playerData.search_player_all.queryResults.row.weight);\n $throws.text(playerData.search_player_all.queryResults.row.throws);\n $placeOfBirth.text(playerData.search_player_all.queryResults.row.birth_country);\n}", "title": "" }, { "docid": "42ab8bc20b208a7660add95ee7ce1c5d", "score": "0.6454572", "text": "_render() {\n this.ctx.clearRect(0, 0, this.width, this.height);\n this._starfield.render(this.ctx);\n this._quiz.render(this.ctx);\n this._player.render(this.ctx);\n // render cookie at mouse position\n this.ctx.drawImage(this.cookie, this.cursor.x - 10, this.cursor.y - 10);\n }", "title": "" }, { "docid": "199267b16cc0b73252654b795589d9f2", "score": "0.64511216", "text": "preRender(){}", "title": "" }, { "docid": "199267b16cc0b73252654b795589d9f2", "score": "0.64511216", "text": "preRender(){}", "title": "" }, { "docid": "a3014a4f087246aa560dfbecbe953389", "score": "0.64502555", "text": "willRender() { }", "title": "" }, { "docid": "2477a8dd0d889ee21b3159fdf273dc44", "score": "0.6441937", "text": "render() {\n return super.render();\n }", "title": "" }, { "docid": "21d3cf9d61f20747dd0e7766ad99f5bf", "score": "0.64374113", "text": "render()\n\t{\n\t\treturn (\n\t\t\t\t\t<h1>\n\t\t\t\t\t\t<FormattedMessage id=\"load\"/>\n\t\t\t\t\t</h1>\n\t\t\t );//return\n\t}", "title": "" }, { "docid": "0b8b57e14185ce984e2b4dd193299f7d", "score": "0.64356214", "text": "function render() {\n if (STORE.step === \"start\") {\n $('main').html(generateStartScreenHtml());\n } else if (STORE.step === \"firstQuestion\") {\n $('.js-question-and-score').html(generateQuestionAndScoreHtml());\n $('main').html(generateQuestionHtml());\n } else if(STORE.step === \"right\") {\n $('main').html(rightAnswerHtml());\n } else if(STORE.step === \"wrong\") {\n $('main').html(wrongAnswerHtml());\n } else if(STORE.step === \"nextQuestion\") {\n $('main').html(generateQuestionHtml());\n } else {\n $('main').html(finalScoreHtml());\n } \n console.log('`render` ran')\n}", "title": "" }, { "docid": "e419a6b85d1dfdd04d904c9e4d7b36ad", "score": "0.6413039", "text": "render() {\n\n // Different values go in depending on the view. That's why we have the switch statements.\n switch(this.state.view) {\n case \"byStudent\":\n return this.renderByStudent();\n case \"byPoem\":\n return this.renderByPoem();\n default:\n return this.renderByStudent();\n }\n \n }", "title": "" }, { "docid": "6b0ac4478e8c2ce12a790a79d02a798f", "score": "0.6405649", "text": "render() {\n return super.render();\n }", "title": "" }, { "docid": "6b0ac4478e8c2ce12a790a79d02a798f", "score": "0.6405649", "text": "render() {\n return super.render();\n }", "title": "" }, { "docid": "ee984d139b3d68e72c4a0b0799803b17", "score": "0.64041287", "text": "function render() {\n removeToolTips();\n displayProshares();\n displaySelectedProshares();\n displayPerformanceGraph();\n addToolTips();\n}", "title": "" }, { "docid": "fad9c4d4481bd79bf608043c387ea161", "score": "0.6394939", "text": "render() {\n // Nothing to do\n }", "title": "" }, { "docid": "f42e962de74fdf06c9481aeda89d113c", "score": "0.63736796", "text": "_render() {\n\t\t\tif (this._template && this.renderer) {\n\t\t\t\tthis.renderer(this._template.apply(this, this.getTemplateArgs()), this.element);\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "f62d0323519bea45f754ee3e2e5fa6fe", "score": "0.63685846", "text": "function GRenderStrategy()\r\n{\r\n}", "title": "" }, { "docid": "f62d0323519bea45f754ee3e2e5fa6fe", "score": "0.63685846", "text": "function GRenderStrategy()\r\n{\r\n}", "title": "" }, { "docid": "b454a5b841ed7ed31aaf49c524026660", "score": "0.63682884", "text": "function render() {\n //\n // YOUR CODE HERE\n //\n}", "title": "" }, { "docid": "5454543fc896487c51a25c69af51af0a", "score": "0.63651454", "text": "function render() {\n let html = '';\n \n if (store.quizStarted === false) {\n $('main').html(generateStartScreen());\n return;\n }\n else if (store.questionNumber >= 0 && store.questionNumber < store.questions.length) {\n html = generateQuizNumberAndScore();\n html += generateQuestion();\n $('main').html(html);\n }\n else {\n $('main').html(generateResults());\n }\n }", "title": "" }, { "docid": "6ccf5c9c9cc7b374dc2f311b5e4406d7", "score": "0.6360236", "text": "finishRender() {}", "title": "" } ]
f982ee395159d9245d7093fae8a62db8
Implement the identical functionality for filter and not
[ { "docid": "47c05cc1639e9d7bce82a172a07a77ed", "score": "0.0", "text": "function winnow( elements, qualifier, not ) {\n\tif ( jQuery.isFunction( qualifier ) ) {\n\t\treturn jQuery.grep( elements, function( elem, i ) {\n\t\t\t/* jshint -W018 */\n\t\t\treturn !!qualifier.call( elem, i, elem ) !== not;\n\t\t} );\n\n\t}\n\n\tif ( qualifier.nodeType ) {\n\t\treturn jQuery.grep( elements, function( elem ) {\n\t\t\treturn ( elem === qualifier ) !== not;\n\t\t} );\n\n\t}\n\n\tif ( typeof qualifier === \"string\" ) {\n\t\tif ( risSimple.test( qualifier ) ) {\n\t\t\treturn jQuery.filter( qualifier, elements, not );\n\t\t}\n\n\t\tqualifier = jQuery.filter( qualifier, elements );\n\t}\n\n\treturn jQuery.grep( elements, function( elem ) {\n\t\treturn ( indexOf.call( qualifier, elem ) > -1 ) !== not;\n\t} );\n}", "title": "" } ]
[ { "docid": "f98f0c02d654f745960b19063da7da6a", "score": "0.7361846", "text": "function notFilter(func) {\n return function () {\n return !func.apply(this, arguments);\n };\n }", "title": "" }, { "docid": "959cd5250cff6de1ed224ed2831ccfea", "score": "0.7125867", "text": "function filterNone(_) { return true; }", "title": "" }, { "docid": "72dab6abaf7ce6ecea2dba583413cbd1", "score": "0.6946449", "text": "function filterOut(facts,filter){\r\n\t//filtered results\r\n\treturn sift(filter,facts);\r\n}", "title": "" }, { "docid": "ffab8a5f076f0ab9ba72c0dbfb3e602e", "score": "0.6852985", "text": "function filter(){\n \n}", "title": "" }, { "docid": "e9fdb9c0242cb5406d8011c186ce3809", "score": "0.682534", "text": "function filterHandler() {}", "title": "" }, { "docid": "50e10a4d77d0b55ba547e997f6d062a0", "score": "0.6784153", "text": "getFilterFn() {}", "title": "" }, { "docid": "a63686a60f7b073713c2119186a30ff5", "score": "0.6716295", "text": "function noFilter(filterObj) {\r\n for (var key in filterObj) {\r\n if (filterObj[key]) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }", "title": "" }, { "docid": "66ca5a77f1ed18e161d30e62e276826c", "score": "0.6703263", "text": "function filter(a,b){ return a - b;}", "title": "" }, { "docid": "46fd6ac0cd5e5c2d04a81d5273ce2b79", "score": "0.65933704", "text": "function FilterTest() {}", "title": "" }, { "docid": "0f6a29b644d82ae916b7aebc23d4d768", "score": "0.653706", "text": "function filter_(self, f) {\n concrete(self);\n return self.filter(f);\n}", "title": "" }, { "docid": "fa59d3fc611467a2e085a05d155da885", "score": "0.6449377", "text": "filter (...args) {\n const filtered = super.filter(...args)\n filtered.comparer = this.comparer\n\n testUnsorted(filtered)\n\n return filtered\n }", "title": "" }, { "docid": "cfdbe1d9a804bb694e4a59f3ab809cf1", "score": "0.64369076", "text": "function not_filters(e) {\n return e.children().not('.view-filters');\n }", "title": "" }, { "docid": "9d041bb613745c57b1fb217d190268ef", "score": "0.643305", "text": "_filtered(){\n return this.filter((obj)=>{\n return !obj.ignoreSprite;\n })\n }", "title": "" }, { "docid": "6585dad2d714bd8fe8df9f01a13df78e", "score": "0.6427066", "text": "function filter_method() {\r\n return filter_nodes(this, arguments, 'filter');\r\n }", "title": "" }, { "docid": "007b4588db95afcb45d5b780ea26e70f", "score": "0.6419595", "text": "function filter(list, pred) {\n }", "title": "" }, { "docid": "33f30322a3a7edb5f4f99a85467c421b", "score": "0.6395678", "text": "function filterElements() {}", "title": "" }, { "docid": "f28c825bbeb59f1fc11ed6bcbe0d7bbf", "score": "0.6319942", "text": "static invertArrayFilter(filter){return function(data,...additionalParameter){if(data){const filteredData=filter.call(this,data,...additionalParameter);let result=[];/* eslint-disable curly */if(filteredData.length){for(const date of data)if(!filteredData.includes(date))result.push(date)}else/* eslint-enable curly */result=data;return result}return data}}", "title": "" }, { "docid": "9abc640b78a4ed6ae581e27854e9870f", "score": "0.6310172", "text": "function filterTwos(elem) { return elem != 2; }", "title": "" }, { "docid": "15ada64f2ba3a099eb343a37956e585b", "score": "0.6209709", "text": "filterByCallback() {\n return true\n }", "title": "" }, { "docid": "f007056e67631df0dd6c68d8efdcdd4a", "score": "0.61998075", "text": "function NullFilter () {\n }", "title": "" }, { "docid": "f007056e67631df0dd6c68d8efdcdd4a", "score": "0.61998075", "text": "function NullFilter () {\n }", "title": "" }, { "docid": "87aed0d1d0de5ea2ecb38480d6e919d9", "score": "0.6198611", "text": "function filter(f) {\n return self => filter_(self, f);\n}", "title": "" }, { "docid": "c8f5c5be9d4513c7badb0c949db817b8", "score": "0.6151996", "text": "function k(val){ //function for filtering\n \n return val!=args[i]; //return \"TRUE\" for values not equal to args \n }", "title": "" }, { "docid": "983e7693292251bd6aeb0721a7071d94", "score": "0.6145383", "text": "function defaultFilter(){return!event.button;}", "title": "" }, { "docid": "40ff2305f445ec08465e99948c5563b1", "score": "0.6138595", "text": "function bouncer(arr) {\n // callback function for filter method\n function noFalsy(value) {\n // Retreive primitive Boolean value based on the element in array currently being tested via filter method\n // This primitive Boolean value equates to false if the value being added is omitted or is 0, -0, null, false, NaN, undefined, or \"\"\n var x = new Boolean(value);\n if (x == false)\n//returning false to the filter method removes the element from the array\n return false;\n //returning true to the filter method keeps the element in the array\n else\n return true;\n }\n //return the array after modifying it with the filter method\n return arr.filter(noFalsy);\n}", "title": "" }, { "docid": "dc77cbb965d9abe7a4ec8b8d0e1e3ca0", "score": "0.61157775", "text": "filter(conditionFnOrObject){\n let cnstctr = this.__proto__.constructor;\n if(typeof(conditionFnOrObject) === \"function\"){\n return new cnstctr(this.items.filter(conditionFnOrObject));\n }\n else if(utils.isObject(conditionFnOrObject)){\n return new cnstctr(this.findAllByProperty(conditionFnOrObject));\n }\n return new cnstctr();\n }", "title": "" }, { "docid": "68723b24de763e409152c4f6e2135186", "score": "0.61045337", "text": "filter(fn) {\r\n let result = []\r\n\r\n this.each(x => {\r\n if (fn(x)) result.push(x)\r\n })\r\n\r\n return FArray(result)\r\n }", "title": "" }, { "docid": "ed018be229c9430663ef65616cbdc30c", "score": "0.6070485", "text": "@computed get filteredTodos() {\n // filter is reg_exp\n // this.filter is input\n var matchesFilter = new RegExp(this.filter, \"i\")\n // we use this.filter input, to test a single todo.value\n return this.todos.filter(todo => !this.filter || matchesFilter.test(todo.value))\n }", "title": "" }, { "docid": "6d9a624b3ebf56b67d9f07db05562ce7", "score": "0.60657555", "text": "isFiltered(book){\n const thisBL = this;\n let filtered = false;\n const adultsChecked = thisBL.filters.indexOf('adults') !== -1;\n const nonFictionChecked = thisBL.filters.indexOf('nonFiction') !== -1;\n if ((adultsChecked && book.details.adults) || (nonFictionChecked && book.details.nonFiction)){\n filtered = true;\n } \n if (adultsChecked && nonFictionChecked) {\n if (book.details.adults && book.details.nonFiction) {\n filtered = true;\n } else {\n filtered = false;\n } \n }\n if (!adultsChecked && !nonFictionChecked){\n filtered = true;\n }\n return filtered;\n }", "title": "" }, { "docid": "7a0de060c2b2c97bfd934354eec3d957", "score": "0.6041602", "text": "filteredtrellos () {\n return filters[this.visibility](this.trellos);\n }", "title": "" }, { "docid": "2235d6f9922954820e9475ffcd0a8dd8", "score": "0.60063267", "text": "function defaultFilter$1(){return!event.button;}", "title": "" }, { "docid": "3d8845888357378202b8fc2c598c59c9", "score": "0.5993371", "text": "function defaultFilter() {\n return !on_event.button;\n}", "title": "" }, { "docid": "3d8845888357378202b8fc2c598c59c9", "score": "0.5993371", "text": "function defaultFilter() {\n return !on_event.button;\n}", "title": "" }, { "docid": "09aab65f4f72898954e6f6f026b536b4", "score": "0.5991955", "text": "function myFilter(array, g){\n var myArr = [];\n myEach(array,function(x){\n if(g(x)===true){\n myArr.push(x);\n }\n });\n return myArr;\n }", "title": "" }, { "docid": "fabd87123021dfd2150042a1700e4200", "score": "0.5951136", "text": "function filter(pred) {\n return function(xs) {\n return Z.filter (pred, xs);\n };\n }", "title": "" }, { "docid": "f9c1bcc21b56002fe478c93b36928aea", "score": "0.5938566", "text": "function not(predicate) {\n return a => !predicate(a);\n}", "title": "" }, { "docid": "1d2135388233e4f09170552782951b18", "score": "0.5932624", "text": "function filterResults(data) {\n\n\n}", "title": "" }, { "docid": "701d1977ada40ed7ecde5e502ba74ca0", "score": "0.5925508", "text": "filter(f) {\n return new FilterInternal(this.stream, this.key, this.buffer, f);\n }", "title": "" }, { "docid": "4362079c6201c69f9e456e4295675de2", "score": "0.5917214", "text": "function filtrator(s){\n var x = filter()\n}", "title": "" }, { "docid": "a7d3ac3cec805bd579b186ae3949d380", "score": "0.5912474", "text": "filterFunction(value) {\n let matchesFilters = value.name.toUpperCase().match(this.state.query.toUpperCase());\n if(matchesFilters == null){\n return false\n }else{\n return true\n }\n }", "title": "" }, { "docid": "0202ca711fb8acff1a1c11b01d0f7075", "score": "0.59104425", "text": "filter(stateData) {\n\t\t//0: All, 1: Completed, 2: Uncompleted\n\t\tconst view = stateData.filter((todo)=>{\n\t\t\tif(this.state.filterType == 0) {\n\t\t\t\treturn true;\n\t\t\t} else if(this.state.filterType == 1 && todo.isDone) {\n\t\t\t\treturn true;\n\t\t\t} else if(this.state.filterType == 2 && !todo.isDone) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t});\n\t\t//return a filtered list\n\t\treturn view;\n\t}", "title": "" }, { "docid": "30dcd9eaf658b5db67a038defb19e24c", "score": "0.5909515", "text": "function defaultFilter$2() {\n\t\t return !exports.event.button;\n\t\t}", "title": "" }, { "docid": "2dc9b0ffe93dd2521439824ba4f90a40", "score": "0.5903316", "text": "function filterInput(f) {\n return self => filterInput_(self, f);\n}", "title": "" }, { "docid": "feacfddd1fe65bbb32152f1051757b70", "score": "0.5898615", "text": "async transform(value) {\n // These are the keys of the items we will filter out or for.\n const filterItems = _.get(this, 'options.filterItems', []);\n // This is the bias.\n const filterBias = _.get(this, 'options.filterBias', 'out');\n\n const tempValue = _.pickBy(value, (predicate) => {\n const filterPath = Object.keys(predicate)\n .find((predicateKey) => filterItems.find(\n (fullPath) => fullPath.startsWith(predicateKey)\n ));\n return (\n (filterBias === 'out' && !_.get(predicate, filterPath))\n || (filterBias !== 'out' && _.get(predicate, filterPath))\n );\n });\n\n return super.transform(tempValue);\n }", "title": "" }, { "docid": "158c6ea9572629043b8d8debae110758", "score": "0.5895994", "text": "isFilterQueryChanged() {\n return !(this.state.page === 1 &&\n this.state.search === undefined &&\n this.state.perpage === this.DEFAULT_PER_PAGE &&\n this.state.sortProperty === undefined &&\n this.state.sortOrderDesc === true &&\n Object.keys(this.state.filter).length === 0);\n }", "title": "" }, { "docid": "574f9101e78dde19b37b66ba2164fdf9", "score": "0.58814895", "text": "function filterInput_(self, f) {\n return filterInputM_(self, a => T.succeed(f(a)));\n}", "title": "" }, { "docid": "031283dd65f61984f28fa336dec858fe", "score": "0.5873916", "text": "function defaultFilter$2() {\n return !exports.event.button;\n}", "title": "" }, { "docid": "031283dd65f61984f28fa336dec858fe", "score": "0.5873916", "text": "function defaultFilter$2() {\n return !exports.event.button;\n}", "title": "" }, { "docid": "031283dd65f61984f28fa336dec858fe", "score": "0.5873916", "text": "function defaultFilter$2() {\n return !exports.event.button;\n}", "title": "" }, { "docid": "031283dd65f61984f28fa336dec858fe", "score": "0.5873916", "text": "function defaultFilter$2() {\n return !exports.event.button;\n}", "title": "" }, { "docid": "031283dd65f61984f28fa336dec858fe", "score": "0.5873916", "text": "function defaultFilter$2() {\n return !exports.event.button;\n}", "title": "" }, { "docid": "031283dd65f61984f28fa336dec858fe", "score": "0.5873916", "text": "function defaultFilter$2() {\n return !exports.event.button;\n}", "title": "" }, { "docid": "031283dd65f61984f28fa336dec858fe", "score": "0.5873916", "text": "function defaultFilter$2() {\n return !exports.event.button;\n}", "title": "" }, { "docid": "49887a02b7e8828f82737a2d30bbc7d5", "score": "0.5871018", "text": "function defaultFilter$2() {\n\t return !exports.event.button;\n\t}", "title": "" }, { "docid": "49887a02b7e8828f82737a2d30bbc7d5", "score": "0.5871018", "text": "function defaultFilter$2() {\n\t return !exports.event.button;\n\t}", "title": "" }, { "docid": "49887a02b7e8828f82737a2d30bbc7d5", "score": "0.5871018", "text": "function defaultFilter$2() {\n\t return !exports.event.button;\n\t}", "title": "" }, { "docid": "49887a02b7e8828f82737a2d30bbc7d5", "score": "0.5871018", "text": "function defaultFilter$2() {\n\t return !exports.event.button;\n\t}", "title": "" }, { "docid": "39808f9e016ca07279eda56acf746e18", "score": "0.58636427", "text": "setFilter (state, payload) {\n }", "title": "" }, { "docid": "8fe64c9b50ad6d8b141ce4e10c21480c", "score": "0.5857327", "text": "function customFilter(arr, callback) {}", "title": "" }, { "docid": "02b93810390e5abba662f0a1e4f6738b", "score": "0.5842556", "text": "function defaultFilter$2() {\n return !exports.event.button;\n }", "title": "" }, { "docid": "02b93810390e5abba662f0a1e4f6738b", "score": "0.5842556", "text": "function defaultFilter$2() {\n return !exports.event.button;\n }", "title": "" }, { "docid": "7b1e551964bd4128dc862d8c52ae301b", "score": "0.584037", "text": "filter(predicate) {\n return new FilterIterator(this, predicate);\n }", "title": "" }, { "docid": "e6b9070484ae26f974cd104788183178", "score": "0.58380705", "text": "filter(f){\n this.iterable = this.iterable.filter(f);\n return this;\n }", "title": "" }, { "docid": "859080a01f31c938d76dae3b611dc782", "score": "0.5831646", "text": "function defaultFilter$1() {\n\t\t return !exports.event.button;\n\t\t}", "title": "" }, { "docid": "c89833afcdb3aaaf70fe9f16afcadb81", "score": "0.5827809", "text": "none(predicate, thisArg) {\n return this.every((v, i, a) => !predicate(v, i, a), thisArg);\n }", "title": "" }, { "docid": "2e88ad7d5947de6d82a4036e2525a1d2", "score": "0.5824165", "text": "function filterFunctions() { \n \n // Filter accepts a single argument indicating the element in the array\n const oddNumbers = numbers.filter(number => Math.abs(number % 2) == 1);\n console.table(oddNumbers);\n\n const evenNumbers = numbers.filter(number => number % 2 == 0);\n console.table(evenNumbers);\n \n const evenPositives = numbers.filter(number => number % 2 == 0 && number > 0);\n console.table(evenPositives); \n}", "title": "" }, { "docid": "d347a7cb2f3f0f80aca1914ed3334f62", "score": "0.5821513", "text": "function defaultFilter$1() {\n\t return !exports.event.button;\n\t}", "title": "" }, { "docid": "d347a7cb2f3f0f80aca1914ed3334f62", "score": "0.5821513", "text": "function defaultFilter$1() {\n\t return !exports.event.button;\n\t}", "title": "" }, { "docid": "d347a7cb2f3f0f80aca1914ed3334f62", "score": "0.5821513", "text": "function defaultFilter$1() {\n\t return !exports.event.button;\n\t}", "title": "" }, { "docid": "d347a7cb2f3f0f80aca1914ed3334f62", "score": "0.5821513", "text": "function defaultFilter$1() {\n\t return !exports.event.button;\n\t}", "title": "" }, { "docid": "4973f556927dd0bc0323f7ba1cf7eb08", "score": "0.5817814", "text": "function defaultFilter$1() {\n return !event.button;\n}", "title": "" }, { "docid": "c8488f943ee60dff2fee7367a8380849", "score": "0.5816732", "text": "filter(predicate) {\r\n const self = this;\r\n return new Observable(function subscribe(observer) {\r\n const subscription = self.subscribe({\r\n next(v) {\r\n if (predicate(v)) {\r\n observer.next(v);\r\n }\r\n },\r\n error(err) {\r\n observer.error(err);\r\n },\r\n });\r\n return subscription;\r\n });\r\n }", "title": "" }, { "docid": "fb5e8cede003214624960fdba891daf7", "score": "0.58162713", "text": "apply(data, el) {\n if (this.mode == 'off')\n return true;\n let value = this.filter(data, el, this.mode);\n let result = typeof value == \"number\" ? value > 0 : value;\n if (this.mode == 'on')\n return result;\n if (this.mode == 'opposite')\n return !result;\n }", "title": "" }, { "docid": "ed53dde196da461774ecfa84bdf1f5ea", "score": "0.5815523", "text": "function defaultFilter$1() {\n return !exports.event.button;\n}", "title": "" }, { "docid": "ed53dde196da461774ecfa84bdf1f5ea", "score": "0.5815523", "text": "function defaultFilter$1() {\n return !exports.event.button;\n}", "title": "" }, { "docid": "ed53dde196da461774ecfa84bdf1f5ea", "score": "0.5815523", "text": "function defaultFilter$1() {\n return !exports.event.button;\n}", "title": "" }, { "docid": "ed53dde196da461774ecfa84bdf1f5ea", "score": "0.5815523", "text": "function defaultFilter$1() {\n return !exports.event.button;\n}", "title": "" }, { "docid": "ed53dde196da461774ecfa84bdf1f5ea", "score": "0.5815523", "text": "function defaultFilter$1() {\n return !exports.event.button;\n}", "title": "" }, { "docid": "ed53dde196da461774ecfa84bdf1f5ea", "score": "0.5815523", "text": "function defaultFilter$1() {\n return !exports.event.button;\n}", "title": "" }, { "docid": "ed53dde196da461774ecfa84bdf1f5ea", "score": "0.5815523", "text": "function defaultFilter$1() {\n return !exports.event.button;\n}", "title": "" }, { "docid": "80597982706fb5f8e2e65033353a67c7", "score": "0.581272", "text": "default(chunk, context, bodies, params) {\n\t\t// does not require any params\n\t\tif (params) {\n\t\t\tparams.filterOpType = 'default';\n\t\t}\n\t\treturn filter(chunk, context, bodies, params, () => true);\n\t}", "title": "" }, { "docid": "bd5bf56a56ae249f11a3600a7c5a6853", "score": "0.5805458", "text": "function filter() {\n\n vm.filteredTracks = [];\n\n angular.forEach(vm.mergedTracks, function (track, key) {\n\n goodSearch = true;\n\n if (!vm.filterData.artist == \"\" && !track.artist.name.match(new RegExp(vm.filterData.artist, \"i\"))) {\n goodSearch = false;\n }\n\n if (!vm.filterData.title == \"\" && !track.songname.match(new RegExp(vm.filterData.title, \"i\"))) {\n goodSearch = false;\n }\n\n\n if (goodSearch) {\n vm.filteredTracks.push(track);\n }\n })\n }", "title": "" }, { "docid": "e532b8a8d92caae5eca2687615acf648", "score": "0.57842594", "text": "function destroyer (arr) {\n // // Method I\n\n // let excludedList = Array.from(arguments).slice(1);\n\n // function test(el){\n // // return excludedList.indexOf(el) == -1;\n // return !excludedList.includes(el);\n // }\n\n // return arr.filter(test);\n\n // Method II\n\n let excludedList = Array.from(arguments).slice(1)\n let newArr = []\n\n for (let i = 0; i < arr.length; i++) {\n let found = false\n for (let j = 0; j < excludedList.length; j++) {\n if (arr[i] === excludedList[j]) {\n found = true\n }\n }\n if (!found) {\n newArr.push(arr[i])\n }\n }\n return newArr\n}", "title": "" }, { "docid": "f8f1f8a7c61a0fd15ac35b0809268045", "score": "0.578335", "text": "function not(f) {\n return function () {\n var originResult = f.apply(this, arguments);\n return !originResult;\n }\n}", "title": "" }, { "docid": "b6d4f7f1c62d6787b56a5e511a3ca27a", "score": "0.5782459", "text": "function filter() {\n if (event.target.innerHTML === \"Filter good dogs: OFF\") {\n filterGoodDog();\n event.target.innerHTML = \"Filter good dogs: ON\"\n } else {\n filterAllDog();\n event.target.innerHTML = \"Filter good dogs: OFF\"\n }\n}", "title": "" }, { "docid": "d4ce4ffe41560bcb4a7e6aa20949c75f", "score": "0.57761043", "text": "_filterCards(attributes) {\n return Object.entries(attributes).filter(elem => (elem[0] != \"friendly_name\" && elem[0] != \"homebridge_hidden\" && elem[0] != \"icon\" && elem[0] != \"hidden\"));\n }", "title": "" }, { "docid": "912fbd17226de6b9bee09d01b67c9efc", "score": "0.5773163", "text": "function defaultFilter$1() {\n return !exports.event.button;\n }", "title": "" }, { "docid": "912fbd17226de6b9bee09d01b67c9efc", "score": "0.5773163", "text": "function defaultFilter$1() {\n return !exports.event.button;\n }", "title": "" }, { "docid": "c199d81e4e10ca5b7f7b31ed12923b1e", "score": "0.57641894", "text": "applyFilter (list) {\n switch (this.filter) {\n case VisibilityFilters.SHOW_ACTIVE:\n return list.filter(todo => !todo.complete)\n\n case VisibilityFilters.SHOW_COMPLETED:\n return list.filter(todo => todo.complete)\n\n default:\n return list\n }\n }", "title": "" }, { "docid": "b6da67c2ccdc8f3a2d845a590bb1fef6", "score": "0.57608765", "text": "function refilter(caller) {\n restoreData();\n let filterFunctions = [priceFilterChanged, petsFilterChanged, kidsFilterChanged];\n for (filter of filterFunctions) {\n if (filter != caller) {\n filter(refilterFirst=false);\n }\n }\n}", "title": "" }, { "docid": "4d0f00736cfdefed0c75b598cde43479", "score": "0.5759155", "text": "function filter(array, test){\n // Array to hold the scripts\n let living = [];\n for (let element of array) {\n if(!test(element)){\n living.push(element);\n }\n }\n return living;\n}", "title": "" }, { "docid": "1b7708cf141a2d9fb164b6b53271b714", "score": "0.5754961", "text": "filter(predicate) {\n if (this.isSome()) {\n let ret = predicate(this.value)\n if (typeof ret !== 'boolean') {\n throw TypeError(\n 'Expected `predicate` to return boolean, received ' + _getType(ret)\n )\n }\n if (ret === true) {\n return this\n }\n return None()\n }\n return this\n }", "title": "" }, { "docid": "237ad25de77960048273a5c6e4be5759", "score": "0.5753802", "text": "function defaultFilter() {\n\t\t return !exports.event.button;\n\t\t}", "title": "" }, { "docid": "ba61244cab73180c6c2ceb2c21f319ae", "score": "0.57470524", "text": "function not(predicate) {\n return function (a) { return !predicate(a); };\n}", "title": "" }, { "docid": "f77264acd083dee75212f71904957865", "score": "0.574687", "text": "function unfilter() {\r\n\t//Show all products\r\n\tfor (var i=0; i<allProducts.length; i++) {\r\n\t\t\tallProducts[i].classList.remove('no-display');\r\n\t}\r\n\r\n\t//Make first page active and hide rest of pages\r\n\tremoveActive();\r\n\tmakeActive(0);\r\n\tgetPaginatedProducts();\r\n}", "title": "" }, { "docid": "d18a16f72f636ff872db38fba5781971", "score": "0.5742099", "text": "function dooCollectionMethodFilter() {\n return dooCollectionMethodSlice.apply(\n filter.apply( this, arguments )\n );\n }", "title": "" }, { "docid": "ba3f88025e6e92b82c00c43f1267f8c0", "score": "0.5738444", "text": "function filter(data) {\n if (data.constructor !== Object)\n return;\n return {\n filter: $.param(data)\n };\n }", "title": "" }, { "docid": "85180f8ae3092a271d93bbdf258a235b", "score": "0.5735863", "text": "function applyFilter() {\n setFilteredCars(\n singleCarsData.filter(car =>\n !car.model.toLowerCase().indexOf(modelFilter.toLowerCase()) &&\n !car.make.toLowerCase().indexOf(makeFilter.toLowerCase()) &&\n ((Number(upperPrice) >= Number(car.price)) && (Number(car.price) >= Number(lowerPrice))) &&\n ((Number(upperMiles) >= Number(car.miles)) && (Number(car.miles) >= Number(lowerMiles))) &&\n ((Number(upperYear) >= Number(car.year)) && (Number(car.year) >= Number(lowerYear)))\n )\n )\n }", "title": "" }, { "docid": "39ff722b534ade094ea587d8c5829596", "score": "0.57351506", "text": "function filter(array, fn) {\n // Your code here\n}", "title": "" }, { "docid": "7975031f0bdcf0f5e19ddfae8fcf388f", "score": "0.5725404", "text": "filterCompanies(searchString) {\n let newCompanies = this.state.companies.slice();\n newCompanies.map((company)=>{\n //mandatory because of the first passage here\n if(company.hidden === undefined) {\n company.hidden = false;\n }\n var initialState=company.hidden;\n if (company.name.toUpperCase().includes(searchString.toUpperCase()) || company.phone.toUpperCase().includes(searchString.toUpperCase())) {\n // if the searchString correspond with company name or phone useless to filter on users\n company.hidden = false;\n } else {\n // else, we keep visible the company only if filter on users match /!\\ test on presence of users on the company\n if(company.users.length > 0) {\n company.users.map((user)=>{\n if(user.username.toUpperCase().includes(searchString.toUpperCase())) {\n company.hidden = false;\n } else {\n company.hidden = true;\n }\n return true;\n })\n } else {\n company.hidden = true; \n }\n }\n /** STATS CONTROL */\n //si a la base l'item etait caché\n if(initialState) {\n // s'il y a eu un changement l'item est apparru donc on incremente\n if(initialState!==company.hidden) {\n nbClients++;\n }\n } else {\n //sinon litem etait visible. En cas de changement on decremente\n if(initialState!==company.hidden) {\n nbClients--;\n }\n }\n return 'filter done';\n })\n this.setState({companies: newCompanies});\n \n }", "title": "" }, { "docid": "224e78a99c2bcc2192e36811fb06a7ee", "score": "0.57203484", "text": "function defaultFilter() {\n return !event.button;\n}", "title": "" } ]
083e881337c61b79f396d191355eaa36
LessWrongPortable/exampleEPUBfiles/OEBPF/content $ cat .xhtml|grep > ../../../missed.html cd
[ { "docid": "084c0e2020b2efb6f87675d80776b5c5", "score": "0.0", "text": "function makeToc(links) {\n const tableOfContents = ['<h2>Table Of Contents</h2>', '<ul class=\"contents\">'];\n\n links.forEach(link => {\n // console.log(`${link.link}#${link.title}`) // epub link, title\n if (link.itemType === 'main') {\n if (link.title.indexOf('Book ') !== -1) {\n tableOfContents.push(`<li><h1><a href=\"${link.link}\">${link.title}</a></h1></li>`);\n } else if (link.title.indexOf('Part ') !== -1) {\n tableOfContents.push(`<li><h2><a href=\"${link.link}\">${link.title}</a></h2></li>`);\n } else {\n tableOfContents.push(`<li><a href=\"${link.link}\">${link.title}</a></li>`);\n }\n }\n });\n\n tableOfContents.push('</ul>');\n\n return tableOfContents.join('\\n');\n}", "title": "" } ]
[ { "docid": "8305455c51686c7715b73d1ef98f133b", "score": "0.5805897", "text": "function validateHtml() {\n var htmlFiles = config.htmlFiles;\n\n var chunks = [];\n var stream = gulp.src(htmlFiles);\n stream.on(\"data\", function (chunk){\n chunks.push(chunk);\n });\n\n stream.on(\"end\", function () {\n for (var i = 0; i < chunks.length; i++) {\n execute(`java -jar ${vnu} --verbose ${chunks[i].path}`, (error, stdout) => {\n if (error) {\n console.log(error);\n } else {\n console.log(stdout);\n }\n });\n }\n });\n}", "title": "" }, { "docid": "d8a74fbc3c2d399e19c0b2b212f77b83", "score": "0.5755793", "text": "function html() {\n let output_dir = \"./build/\" + browser + \"/\";\n return gulp\n .src([\"./src/**/!(result|loading|error).html\"], { base: \"src\" })\n .pipe(gulp.dest(output_dir));\n}", "title": "" }, { "docid": "523c55c672a0af4fdb0f164a1c9a8e64", "score": "0.5627454", "text": "function stripHtml() {\n return gulp.src(pugDest)\n .pipe(strip())\n .pipe(gulp.dest(htmlDest));\n}", "title": "" }, { "docid": "b6059f1de94598e7f5a0d42e5d240a12", "score": "0.54643136", "text": "function processHTML (){\n return gulp.src(files.htmlPath)\n .pipe(gulp.dest('dist'));\n}", "title": "" }, { "docid": "b3f2d5ba7ad0d119c16225af17910625", "score": "0.5461536", "text": "async function htmlssi() {\n return gulp\n .src([\"./markup/html/**/*\", \"./markup/coding_list.html\", \"!./markup/html/include\"])\n .pipe(includer())\n .pipe(gulp.dest(\"./dist/\"))\n}", "title": "" }, { "docid": "5b35307a9b8898078d81e7f3a27884b5", "score": "0.545387", "text": "function copyHtml() {\n return gulp.src(paths.html.src)\n .pipe(useref())\n .pipe(gulpIf('*.js', uglify()))\n .pipe(gulpIf('*.css', cleanCSS()))\n .pipe(gulp.dest('dist'));\n}", "title": "" }, { "docid": "84d57780854117a8b9b53105294ec3a3", "score": "0.53450733", "text": "function html_process() {\n\treturn gulp.src(paths.html.src, {base: 'src/'})\n\t.pipe(gulp.dest(paths.html.dest))\n}", "title": "" }, { "docid": "cf5db68c2f2c1149382039d6e9675136", "score": "0.52929646", "text": "function devHTML(){\n return src(`${options.paths.src.base}/**/*.html`).pipe(dest(options.paths.dist.base));\n}", "title": "" }, { "docid": "0ad2dc544eaaf467884a0da053ea9f4a", "score": "0.5177471", "text": "function html() {\r\n return gulp.src([paths.html.src, 'src/*.php'])\r\n .pipe(gulp.dest(paths.html.dest));\r\n }", "title": "" }, { "docid": "559ce156a9834c7031930b0faf4652ec", "score": "0.514669", "text": "function filesValid(p) {\n//check if file valid\n\tvar f = new File(p);\n\tvar s = f.readline();\n\ts = f.readline();\n\tf.close(); \n\n\tif (s != \"<!DOCTYPE fcpxml>\") {\n\t\terror(\"This file does not seem to be a Final Cut XML export. Aborting.\");\n\t\treturn 0;\n\t}\n\n\n\t \n}", "title": "" }, { "docid": "33c7a2b5dfbbb0cd17dc51b0b6f2af7f", "score": "0.5142125", "text": "async dontSeeInSource(text) {\n const source = await this.page.content();\n stringIncludes('HTML source of a page').negate(text, source);\n }", "title": "" }, { "docid": "b7d9333c23fc7df12f3535e2a9d97259", "score": "0.51402366", "text": "function html(){\n return gulp.src(ALL_HTML)\n .pipe(debug())\n .pipe(gulp.dest(STATIC_FOLDER))\n .pipe(livereload());\n}", "title": "" }, { "docid": "b7599f3f83b9176889f23dd6c92c1284", "score": "0.5097623", "text": "function validatepPagesBuilt() {\n\n // config options for the html validator\n const options_validator = {\n \"errors-only\": false,\n \"format\": \"text\",\n };\n\n return src([paths.pagesBuiltGLOB])\n .pipe(htmlvalidator(options_validator))\n .pipe(debug({title: \"validating:\"}))\n .on(\"error\", err => glog(\"PAGE validation error:\\n\" + err.message))\n .on(\"end\", () => glog(\"PAGES validated\"));\n}", "title": "" }, { "docid": "2685fd4ee149e211e268f487b9654ec3", "score": "0.5075512", "text": "function html() {\n let output_dir = `./build/${browser}/`;\n return gulp.src([\"./src/**/*.html\"], { base: \"src\" }).pipe(gulp.dest(output_dir));\n}", "title": "" }, { "docid": "6f93314c13bc40a69edbc80adcfd76da", "score": "0.5061338", "text": "function compileHTML (done) {\n\tgulp.src([\n\t\t'./src/**/index.html',\n\t\t'./src/**/about.html'\n\t])\n\t\t.pipe(fileinclude({\n\t\t\tprefix: '@@',\n\t\t\tbasepath: '@file'\n\t\t}))\n\t\t.pipe(gulp.dest('./public/'));\n\tdone();\n}", "title": "" }, { "docid": "e6952806496eb0db5532b894ed85e546", "score": "0.5022697", "text": "function html() {\n\treturn src('dev/*.html')\n\t\t.pipe(htmlmin({ collapseWhitespace: true }))\n\t\t.pipe(dest('dist'))\n}", "title": "" }, { "docid": "86c2e41738bb94f9a05b732d65ca5e3a", "score": "0.5015299", "text": "function checkAllLinks(filePath) {\r\n var wholeText = readFile(filePath);\r\n var document = new ActiveXObject(\"htmlfile\");\r\n document.write(wholeText);\r\n\r\n var wholeDocument = document.getElementsByTagName(\"html\")[0];\r\n\r\n function checkLinksByTag(tagName, attrName) {\r\n var elements = document.getElementsByTagName(tagName);\r\n for (var i = 0, len = elements.length; i < len; i++) {\r\n var element = elements[i];\r\n\r\n var regex = new RegExp(attrName + \"=\\\"([^\\\"]*)\");\r\n var link = element.outerHTML.match(regex)[1];\r\n\r\n // line number todo:\r\n var lineIndices = getLineNumbers(wholeText, element.outerHTML);\r\n\r\n var status = getLinkStatus(link);\r\n var msg = (status === \"NG\" ? \" !!\" : \" \")\r\n + \"[\" + status + \"] Line \" + lineIndices + \": \" + element.outerHTML;\r\n\r\n // output to stdout.\r\n stdout(msg);\r\n\r\n // output to corresponding files.\r\n switch(status) {\r\n case \"OK\":\r\n appendToFile(outputFileForOK.path, msg);\r\n break;\r\n case \"NG\":\r\n appendToFile(outputFileForNG.path, msg);\r\n break;\r\n case \"--\":\r\n appendToFile(outputFileForWWW.path, msg);\r\n break;\r\n default:\r\n echo(\"Unknown error.\");\r\n destroyObjects();\r\n WScript.quit();\r\n break;\r\n }\r\n }\r\n }\r\n\r\n checkLinksByTag(\"a\", \"href\");\r\n checkLinksByTag(\"img\", \"src\");\r\n\r\n document = null;\r\n}", "title": "" }, { "docid": "ceba366369c4d35694836e9b4d86ca16", "score": "0.50144327", "text": "function pack(callback) {\r\n\tvar fs = require('fs');\r\n\tsrc(dir + '/tmp/temp.html', { allowEmpty: true })\r\n\t\t.pipe(replace('{TITLE}', title, replaceOptions))\r\n\t\t.pipe(replace('minimum-scale=1,maximum-scale=1,', '', replaceOptions))\r\n\t\t.pipe(gulpif(!pwa, replace('<link rel=\"manifest\" href=\"mf.webmanifest\">', '', replaceOptions)))\r\n\t\t.pipe(htmlmin({ collapseWhitespace: true, removeComments: true }))\r\n\t\t.pipe(replace('\"', '', replaceOptions))\r\n\t\t.pipe(replace('rep_css', '<style>' + fs.readFileSync(dir + '/tmp/temp.css', 'utf8') + '</style>', replaceOptions))\r\n\t\t.pipe(replace('rep_js', '<script>' + fs.readFileSync(dir + '/tmp/temp.js', 'utf8') + '</script>', replaceOptions))\r\n\t\t.pipe(gulpif(!debug, replace('\"use strict\";', '', replaceOptions)))\r\n\t\t.pipe(concat('index.html'))\r\n\t\t.pipe(dest(dir + '/'))\r\n\t\t.on('end', callback);\r\n}", "title": "" }, { "docid": "30ca19ab3a196103014e55739f1a8ee5", "score": "0.5001252", "text": "function copyHtml(cb){\n src(\"src/views/**/*.html\").pipe(dest(DEST_DIR))\n cb();\n}", "title": "" }, { "docid": "4cd27571c56e62caeab62140de7f238f", "score": "0.4978658", "text": "function copy_html() {\n return gulp.src(['*.html'])\n .pipe(gulp.dest('dist'))\n}", "title": "" }, { "docid": "9f9cace2bd587fc2cd31a9e92b0177fb", "score": "0.49725735", "text": "function compileHtml() {\n return gulp.src(SRC_HTML)\n .pipe(gulp.dest(DIST_HTML, { mode: '0777' }))\n}", "title": "" }, { "docid": "1b46f65ffd4bb09d21991ab876a2fba6", "score": "0.496493", "text": "function completeHtml () {\n const html = `</div>\n </div>\n </div>\n </body>\n </html>`;\n fs.writeFile(\"./dist/index.html\", html, function(err) {\n if(err) {\n console.log(err);\n };\n });\n console.log(\"complete\")\n}", "title": "" }, { "docid": "327f90523e63cd88872714b4ed6ab5a5", "score": "0.49622583", "text": "function buildHtml(){\n\treturn gulp.src(baseDir + '/html/index.mustache')\n\t\t.pipe(plumber({errorHandler: map_error}))\n\t\t.pipe(musatche(baseDir + '/html/data.json'))\n\t\t.pipe(rename('index.html'))\n\t\t.pipe(gulp.dest(baseDir + '/'));\n}", "title": "" }, { "docid": "5c2ca9f840941528d8fa99d1ee21afb9", "score": "0.49466103", "text": "function htmlTask() {\n return src(files.htmlPath)\n .pipe(htmlmin({ removeComments: true }))\n .pipe(dest('pub')\n );\n}", "title": "" }, { "docid": "8bd1069d8b7dd4cf7bfb3655ceffc60e", "score": "0.49196455", "text": "function logErrorToHtml(e){\n if(!e){return;}\n console.log(e.toString());\n var stream = source('index.html')\n stream.end(e.toString());\n stream\n .pipe(gulp.dest(paths.buildDir))\n .pipe(gulp.dest(paths.productionDir));\n}", "title": "" }, { "docid": "80dfcdf883a771a3b1b5502f5d3a8c5e", "score": "0.49082875", "text": "function copyHtml() {\n gulp.src('src/app/my-lib/**/*.html')\n .pipe(gulp.dest('./dist')).on('end', copyAssets);\n}", "title": "" }, { "docid": "f03f949cdd0369edf6d7f4d2dd2556fe", "score": "0.4902744", "text": "function buildDocsHtml() {\n return gulp\n .src('../src/docs/pages/*.html')\n .pipe(\n include({\n prefix: '@@',\n basepath: '@file',\n indent: true,\n filters: {\n escape: escapehtml\n }\n })\n )\n .pipe(gulp.dest('../docs'));\n}", "title": "" }, { "docid": "60f97c3c23e96f996a56f5aa1e28f9d1", "score": "0.48985052", "text": "function rmvTags(str){\nstr=str.replace(/^<HEAD><\\/HEAD>\\r\\n<BODY>/g,\"\");\nstr=str.replace(/<\\/BODY>$/g,\"\");\nreturn str;\n}//endFunction", "title": "" }, { "docid": "56729e6808d889d869674b90331a2e16", "score": "0.4896128", "text": "function html() {\n return gulp.src([path.src.html + \"*.html\", path.src.html + \"CNAME\"])\n .pipe(changed(path.build.html)) // Ignore unchanged files\n .pipe(gulp.dest(path.build.html))\n .pipe(browserSync.stream());\n}", "title": "" }, { "docid": "26330d6a0a41eec86802bddd2ff131f0", "score": "0.48801827", "text": "function html() {\n return gulp\n .src(paths.html, { base: 'src' })\n .pipe(changed(paths.dist))\n .pipe(htmlmin({ collapseWhitespace: true }))\n .pipe(gulp.dest(paths.dist))\n .pipe(gulpif(!argv.prod, browserSync.stream()))\n}", "title": "" }, { "docid": "f3dd0f6b02ebeee614ea4106e2f26b82", "score": "0.48733422", "text": "function writeFullHTML(page) {\r\n var content = page.content; // the full HTML with all js loaded \r\n fs.write(outFile,content,'w'); \r\n console.log(\"Finished writing to output file.\"); \r\n}", "title": "" }, { "docid": "e4f9df0dc8a4a103a05fa8099df51e26", "score": "0.48467258", "text": "function testFileContents(regEx, filename) {\n var fileToTest = course.content.find(file => {\n return file.name === filename;\n });\n if (fileToTest.ext === '.xml') {\n return regEx.test(fileToTest.dom.xml());\n } else {\n return regEx.test(fileToTest.dom.html());\n }\n }", "title": "" }, { "docid": "6e0f79a9c1527cf6f21a9ce6b7a1bf33", "score": "0.48436782", "text": "function finishHtml() {\n const html = `</div>\n </div>\n\n </body>\n </html>`;\n\n fs.appendFile(\"./src/team.html\", html, function(err) {\n if (err) {\n console.log(err);\n };\n console.log(\"end\");\n });\n \n \n}", "title": "" }, { "docid": "8d240faf6ec7a77c05d5babd64bad74a", "score": "0.48296985", "text": "function extract_text(){setmessage(\"Showing Only Plane Text within This File\");var o=cuf_body,x=1,a='',c=0,u='',l=0,s,i,i2,re;\n//strip js\nfor(redo=1;redo>0;){redo=0;s=o.toLowerCase();i=s.indexOf(\"<script\");if(i>0){i2=s.indexOf(\"</script\",i);\ni2=s.indexOf(\">\",i2);o=o.substr(0,i-1)+o.substr(i2+1);redo=1;};};\n//strip css\nfor(redo=1;redo>0;){redo=0;s=o.toLowerCase();i=s.indexOf(\"<style\");if(i>0){i2=s.indexOf(\"</style\",i);\nif(i2>0){i2=s.indexOf(\">\",i2);o=o.substr(0,i-1)+o.substr(i2+1);redo=1;};};};\n//trim\nre=/\\f/g;o=o.replace(re,\"§§\");re=/\\n/g;o=o.replace(re,\"§§\");re=/\\r/g;o=o.replace(re,\"§§\");re=/\\t/g;o=o.replace(re,\"§§\");re=/\\v/g;o=o.replace(re,\"§§\");\n//br 2 cr\nre=/<BR>/g;o=o.replace(re,\"§§\");re=/<br>/g;o=o.replace(re,\"§§\");\n//strip tags\nx=1;u=\"\";l=o.length;for(t=0;t<l;t++){a=o.substr(t,1);if(a==\"<\"){x=0;}else if(a==\">\"){x=1;}else{if(x)u+=a;};};o=u;u=\"\";\n//cr 2 br\nre=/§§§§/g;o=o.replace(re,\"§§\");o=o.replace(re,\"§§\");o=o.replace(re,\"§§\");o=o.replace(re,\"§§\");o=o.replace(re,\"§§\");o=o.replace(re,\"§§\");re=/§§/g;o=o.replace(re,\"<br>\");\nreturn '<TABLE align=center cellspacing=1 cellpadding=1 border=0 bgcolor=white><TR><TH colspan=1>ONLY PLAIN TEXT WITHIN THIS FILE</TH></TR><TR><TD align=left>'+o+'</TD></TR></TABLE>';}", "title": "" }, { "docid": "fcc12d35cd67f2b6138b78377362f85b", "score": "0.48261172", "text": "function deliverXHTML(res, path, stat) {\n if (path.endsWith(\".ejs\")) {\n res.header(\"Content-Type\", \"application/xhtml+xml\");\n }\n}", "title": "" }, { "docid": "9c16be61e6f81018099060debb2e7d80", "score": "0.4823997", "text": "function buildHTML() {\n return gulp.src(paths.html.input)\n .pipe(nunjucksRender({\n data: {\n isDevelopment\n },\n path: paths.html.nunjunks,\n watch: false\n }))\n .pipe(htmlMinimizer({\n removeComments: true,\n removeEmptyAttributes: true,\n sortAttributes: true,\n sortClassName: true,\n collapseWhitespace: true,\n collapseBooleanAttributes: true,\n keepClosingSlash: true,\n minifyCSS: true,\n minifyJS: true\n }))\n .pipe(gulp.dest(paths.html.output))\n .pipe(size({ pretty: true, showFiles: true, showTotal: false }))\n .pipe(browserSync.reload({ stream: true }));\n }", "title": "" }, { "docid": "688e2a38f9eb32008b1bbb596bcc2cb5", "score": "0.48235387", "text": "function compile () {\n return src('./src/*.html')\n .pipe(useref())\n .pipe(gulpif('*.html', htmlmin({ \n collapseWhitespace: true,\n removeComments: true\n })))\n .pipe(gulpif('*.js', uglify()))\n .pipe(gulpif('*.css', minifyCss()))\n .pipe(dest('./dist'))\n}", "title": "" }, { "docid": "2042eb335fe21377f54299d03cd7643b", "score": "0.4812789", "text": "function isHTML(file) {\n\treturn path.extname(file) == \".html\";\n}", "title": "" }, { "docid": "51faad8827b2ef44b3ebbc9e9d7562ef", "score": "0.48106572", "text": "[Syntax.Document](node){\n\t\t\t//recherche du sous titre 1.But du projet dans le document\n\t\t\tconst text = getSource(node);\n\t\t\tconst match = text.match(/## 1. But du projet/i);\n\t\t\tif(!match){\n\t\t\t\treport(node, new RuleError(`Sous-titre \"1.But du projet\" absent`));\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "b19ccfb5bb026e843bf172d0544b0a1e", "score": "0.47723028", "text": "function deliverXHTML(res, _path, _stat) {\n if (_path.endsWith('.html')) {\n res.header('Content-Type', 'application/xhtml+xml');\n }\n}", "title": "" }, { "docid": "a52fe88938af507ee2d1eba0d2078c9e", "score": "0.4760529", "text": "function dropUnusedFiles(entry) {\n fs.unlinkSync(path.join(entry, \"index.fb.html\"));\n}", "title": "" }, { "docid": "fa6015ac1fbd576c3dda3cfa5ac1f54a", "score": "0.4757224", "text": "function copyHtml() {\n return gulp.src('src/*.html')\n .pipe(gulp.dest('pub')) // Save a copy of html-files to pub-folder\n}", "title": "" }, { "docid": "8b60b5f0ca4fb30391a5d487cf93fec4", "score": "0.47408706", "text": "function html() {\n return src(\"src/**\").pipe(dest(\"dist\"));\n}", "title": "" }, { "docid": "e048d3a461d9a3bd13f4cab1f7d6322b", "score": "0.47259486", "text": "function NonXHTMLTagFilter() {\n /* filter out non-XHTML tags*/\n \n // A mapping from element name to whether it should be left out of the \n // document entirely. If you want an element to reappear in the resulting \n // document *including* it's contents, add it to the mapping with a 1 value.\n // If you want an element not to appear but want to leave it's contents in \n // tact, add it to the mapping with a 0 value. If you want an element and\n // it's contents to be removed from the document, don't add it.\n if (arguments.length) {\n // allow an optional filterdata argument\n this.filterdata = arguments[0];\n } else {\n // provide a default filterdata dict\n this.filterdata = {'html': 1,\n 'body': 1,\n 'head': 1,\n 'title': 1,\n \n 'a': 1,\n 'abbr': 1,\n 'acronym': 1,\n 'address': 1,\n 'b': 1,\n 'base': 1,\n 'blockquote': 1,\n 'br': 1,\n 'caption': 1,\n 'cite': 1,\n 'code': 1,\n 'col': 1,\n 'colgroup': 1,\n 'dd': 1,\n 'dfn': 1,\n 'div': 1,\n 'dl': 1,\n 'dt': 1,\n 'em': 1,\n 'h1': 1,\n 'h2': 1,\n 'h3': 1,\n 'h4': 1,\n 'h5': 1,\n 'h6': 1,\n 'h7': 1,\n 'i': 1,\n 'img': 1,\n 'kbd': 1,\n 'li': 1,\n 'link': 1,\n 'meta': 1,\n 'ol': 1,\n 'p': 1,\n 'pre': 1,\n 'q': 1,\n 'samp': 1,\n 'script': 1,\n 'span': 1,\n 'strong': 1,\n 'style': 1,\n 'sub': 1,\n 'sup': 1,\n 'table': 1,\n 'tbody': 1,\n 'td': 1,\n 'tfoot': 1,\n 'th': 1,\n 'thead': 1,\n 'tr': 1,\n 'ul': 1,\n 'u': 1,\n 'var': 1,\n\n // even though they're deprecated we should leave\n // font tags as they are, since Kupu sometimes\n // produces them itself.\n 'font': 1,\n 'center': 0\n };\n };\n \n this.initialize = function(editor) {\n /* init */\n this.editor = editor;\n };\n\n this.filter = function(ownerdoc, htmlnode) {\n return this._filterHelper(ownerdoc, htmlnode);\n };\n\n this._filterHelper = function(ownerdoc, node) {\n /* filter unwanted elements */\n if (node.nodeType == 3) {\n return ownerdoc.createTextNode(node.nodeValue);\n } else if (node.nodeType == 4) {\n return ownerdoc.createCDATASection(node.nodeValue);\n };\n // create a new node to place the result into\n // XXX this can be severely optimized by doing stuff inline rather \n // than on creating new elements all the time!\n var newnode = ownerdoc.createElement(node.nodeName);\n // copy the attributes\n for (var i=0; i < node.attributes.length; i++) {\n var attr = node.attributes[i];\n newnode.setAttribute(attr.nodeName, attr.nodeValue);\n };\n for (var i=0; i < node.childNodes.length; i++) {\n var child = node.childNodes[i];\n var nodeType = child.nodeType;\n var nodeName = child.nodeName.toLowerCase();\n if (nodeType == 3 || nodeType == 4) {\n newnode.appendChild(this._filterHelper(ownerdoc, child));\n };\n if (nodeName in this.filterdata && this.filterdata[nodeName]) {\n newnode.appendChild(this._filterHelper(ownerdoc, child));\n } else if (nodeName in this.filterdata) {\n for (var j=0; j < child.childNodes.length; j++) {\n newnode.appendChild(this._filterHelper(ownerdoc, \n child.childNodes[j]));\n };\n };\n };\n return newnode;\n };\n}", "title": "" }, { "docid": "692d1d74ba28d4d9831dc6a6ab86a980", "score": "0.47227156", "text": "function getHtml(program) {\n const inputLocation = program.input ? program.input : './input.txt'\n const html = fs.readFileSync(inputLocation);\n return cheerio.load(html);\n}", "title": "" }, { "docid": "fcc5d2ec1a014f9e4a42e7fb9d609d57", "score": "0.47222313", "text": "function compressHTML(src){return src.replace(/(\\n+|\\s+)?&lt;/g,'<').replace(/&gt;(\\n+|\\s+)?/g,'>').replace(/&amp;/g,'&').replace(/\\n/g,'').replace(/child\" > False/,'child\">') }", "title": "" }, { "docid": "a3128fe89f1412092d99b1cc3870be1a", "score": "0.4661892", "text": "function copyHTML() {\n return src(files.htmlPath)\n .pipe(htmlmin({ collapseWhitespace: true}))\n .pipe(dest(\"pub\"))\n .pipe(browserSync.stream());\n}", "title": "" }, { "docid": "fe51dbfd3ee46996d2f08347a477ff03", "score": "0.4656327", "text": "function replaceCssHashLinkInHtml() {\n return gulp.src([\n 'src/manifest-for-hash-css/*.json', 'dist/*.html'])\n .pipe(revCollector({\n replaceReved: true,\n dirReplacements: {\n css: 'css',\n },\n }))\n .pipe(gulp.dest('dist'));\n}", "title": "" }, { "docid": "64ecb61eae0d05b65b9219807ac99a72", "score": "0.46510246", "text": "function extract_links(){\nsetmessage(\"Showing All Links from This File\");var u='<TABLE align=center cellspacing=1 cellpadding=1 border=0 bgcolor=white><TR><TH colspan=2>URL LINKS REFERRED IN THIS FILE</TH></TR>',o=cuf_body.toLowerCase();\n//css\nu+='<TR><TD colspan=2><HR><FONT COLOR=\"#aa0000\"><B>REFERENCES TO EXTERNAL CSS FILES</B></FONT></TD></TR>';\nvar qz=0;\ni=o.indexOf(\"<link\");if(i>0){e=o.indexOf(\">\",i);r=o.indexOf(\"rel=stylesheet\",i);\nif(r<i || r>e){r=o.indexOf(\"rel='stylesheet'\",i);};\nif(r<i || r>e){r=o.indexOf('rel=\"stylesheet\"',i);};\nif(r>i && r<e){ai=6+o.indexOf(\"href='\",i);ae=o.indexOf(\"'\",ai)\nif(ai<i || ai>e){ai=6+o.indexOf('href=\"',i);ae=o.indexOf('\"',ai);};\nif(ai<i || ai>e){ai=5+o.indexOf('href=',i);ae=o.indexOf(' ',ai);};\nif(ai>i && ai<e){url=cuf_body.substr(ai,ae-ai);u+='<TR><TD align=right><A HREF=\"#\" TITLE=\"Open in Jinx: '+url+'\" ONCLICK=\"gotoFile=\\''+absoluteUrl(url)+'\\';return false;\">'+url+'</A></TD><TD align=left>external CSS</TD></TR>';qz++;};};};\nif(qz<1){u+='<TR><TD align=center colspan=2>none</TD></TR>'};\n\n//scripts\nu+='<TR><TD colspan=2><FONT COLOR=\"#aa0000\"><HR><B>REFERENCED TO EXTERNAL SCRIPT FILES</B></font></TD></TR>';\nqz=0;\nfor(i=0;i<o.length;i++){i=o.indexOf(\"<script\",i);if(i>0){e=o.indexOf(\">\",i);ai=5+o.indexOf(\"src='\",i);ae=o.indexOf(\"'\",ai)\nif(ai<i || ai>e){ai=5+o.indexOf('src=\"',i);ae=o.indexOf('\"',ai);};\nif(ai<i || ai>e){ai=4+o.indexOf('src=',i);ae=o.indexOf(' ',ai);};\nif(ai>i && ai<e){url=cuf_body.substr(ai,ae-ai);u+='<TR><TD align=right><A HREF=\"#\" TITLE=\"Open in Jinx: '+url+'\" ONCLICK=\"gotoFile=\\''+absoluteUrl(url)+'\\';return false;\">'+url+'</A></TD><TD align=left>external Script</TD></TR>';qz++;};};if(i<1)i=99999999;};\nif(qz<1){u+='<TR><TD align=center colspan=2>none</TD></TR>'};\n\n//icon\n\n//html\nu+='<TR><TD colspan=2><FONT COLOR=\"#aa0000\"><HR><B>LINKS IN COMMON A TAGS</B></font></TD></TR>';\nqz=0;\nfor(i=0;i<o.length;i++){i=o.indexOf(\"<a \",i);if(i>0){e=o.indexOf(\">\",i);\nai=7+o.indexOf(\"title='\",i);ae=o.indexOf(\"'\",ai)\nif(ai<i || ai>e){ai=7+o.indexOf('title=\"',i);ae=o.indexOf('\"',ai);};\nif(ai<i || ai>e){ai=6+o.indexOf('title=',i);ae=o.indexOf(' ',ai);};\nif(ai>i && ai<e){tit=cuf_body.substr(ai,ae-ai);}else{tit=\"\";};\nai=6+o.indexOf(\"href='\",i);ae=o.indexOf(\"'\",ai)\nif(ai<i || ai>e){ai=6+o.indexOf('href=\"',i);ae=o.indexOf('\"',ai);};\nif(ai<i || ai>e){ai=5+o.indexOf('href=',i);ae=o.indexOf(' ',ai);};\nif(ai>i && ai<e){url=cuf_body.substr(ai,ae-ai);u+='<TR><TD align=right><A HREF=\"#\" TITLE=\"Open in Jinx: '+url+'\" ONCLICK=\"gotoFile=\\''+absoluteUrl(url)+'\\';return false;\">'+url+'</A></TD><TD align=left>'+tit+'</TD></TR>';qz++;};\n};if(i<1)i=99999999;};\nif(qz<1){u+='<TR><TD align=center colspan=2>none</TD></TR>'};\n\n//hidden\n\nreturn u+'</TABLE>';}", "title": "" }, { "docid": "ada760ee4b0e1d0d73b95a4f93d037d7", "score": "0.4647428", "text": "function mjmlPages() {\n\treturn gulp.src(['paniniComplete/**/*.html', '!src/pages/archive/**/*.html'])\n\t.pipe(flatmap(function(stream, file) {\n\t\treturn stream\n\t\t.pipe(mjml());\n\t}))\n//\t.pipe(mjml())\n\t.pipe(gulp.dest('mjmlComplete/pages'));\n}", "title": "" }, { "docid": "1408e5ee025ae8f3f0879a26a504fa6e", "score": "0.46424147", "text": "async function validateHtmlFixtures() {\n const globs = argv.include_skipped\n ? htmlFixtureGlobs.filter((glob) => !glob.startsWith('!'))\n : htmlFixtureGlobs;\n const filesToCheck = getFilesToCheck(globs, {}, '.gitignore');\n if (filesToCheck.length == 0) {\n return;\n }\n await runCheck(filesToCheck);\n}", "title": "" }, { "docid": "390fdacd88b3735b94bc43a883a2f189", "score": "0.46352303", "text": "function epubXHTMLFromRedditHTML(html) {\n return html.replace(/<a href=\"\\//gi, '<a href=\"https://www.reddit.com/') // Make reddit internal links absolute. Makes assumptions.\n .replace(/&\\w+\\;/g, function(match) { // Replace named HTML entities with XHTML compatible numbered ones\n return entitiesMap[match] || match;\n });\n}", "title": "" }, { "docid": "1e8efc058b3bb91a1221ea7b3ab02d7f", "score": "0.46195146", "text": "function mungePage(conf, mapuri, contents) {\n var uri = mapuri === '/' ? '/index.html' : mapuri,\n file = path.join(conf.build.dir, uri);\n\n if (MUNGE_EXT_RE.test(uri)) {\n if (conf.build.attachManifest) {\n contents = injectManifestAttr(uri, contents);\n }\n if (conf.build.forceRelativePaths) {\n contents = forceRelativePaths(uri, contents);\n }\n if (conf.build.insertCharset) {\n contents = insertCharset(conf.build.insertCharset, contents);\n }\n }\n\n wr.write(file, contents);\n return contents;\n}", "title": "" }, { "docid": "56a3ba292d46934c65c1beeb8a5c7773", "score": "0.4606695", "text": "function html() {\n return src(path.src.html)\n .pipe(plumber())\n .pipe(fileinclude())\n .pipe(webphtml())\n .pipe(dest(path.build.html))\n .pipe(browserSync.stream());\n}", "title": "" }, { "docid": "9dce7fc4472eeecc04fe0ccf15ab8f07", "score": "0.46021634", "text": "function patcherpath(p) {\n\txsltpath = p+\"support/mcp.transform.xsl\";\n\t\n\t//check for xslt file\n\t f = new File(xsltpath);\n\t var s = f.readline();\n\t f.close(); \n\t if (s != '<?xml version=\"1.0\" encoding=\"utf-8\"?>') {\n\t\terror(\"Cannot find valid XSLT file. Aborting.\");\n\t\treturn 0;\n\t}\n\t\n\treturn 1;\n}", "title": "" }, { "docid": "6b8185a63ea1a5eef29e7ae41ecf1f5e", "score": "0.45830166", "text": "function outputErrors(file){\r\n\thasCostCode(file);\r\n\tdoesClientExist(file);\r\n\tdoesOfficeExist(file);\r\n\thasInvoicePrefix(file);\r\n\tdescriptionLength(file);\r\n\tinvoiceValue(file);\r\n\thasTaxCode(file);\r\n\ttaxValue(file);\r\n\thasExtraDelimiter(file);\r\n\t//markupCharacter(file);\r\n}", "title": "" }, { "docid": "df1bd3dd7a6e1398ab063bc51c312631", "score": "0.45801967", "text": "function devMarkup() {\n return gulp.src(SRC_DIR + 'index.html')\n .pipe(gulp.dest(BUILD_DIR))\n .pipe(browserSync.reload({stream: true}));\n}", "title": "" }, { "docid": "946d953b40688073d286d6cfabc81a06", "score": "0.45608786", "text": "static stripChromeExtraTags(html) {\n return html.replace(/<\\/*(html|head|body)>/g, '').replace(/\\r?\\n|\\r|\\s+/g, '');\n }", "title": "" }, { "docid": "0da516e2ff9f0e22e88970da2439df35", "score": "0.45566568", "text": "function isWripeFormat (fn) {\n return /page-\\d+\\.txt/.test(path.basename(fn))\n}", "title": "" }, { "docid": "ddbda4379c152ae1d7efc6ab0af0f127", "score": "0.45538592", "text": "async function includeAndMinifyHtml() {\n return gulp\n .src(\n [\n '*.html',\n 'components[!banner.html, !header.html, !nav.html, !footer.html]',\n ],\n )\n .pipe(fileInclude(\n {\n prefix: '@@',\n basepath: '@file',\n }\n ))\n .pipe(htmlmin(\n {\n collapseWhitespace: true,\n }\n ))\n .pipe(\n gulp\n .dest(PATHS.root.dest)\n );\n}", "title": "" }, { "docid": "3fcfe7c846946bed2b409e0c113f5f2e", "score": "0.4552504", "text": "function nunjucks(cb) {\n cb();\n\n return gulp.src(`${config.nunjucksPages}/*.+(html|njk)`)\n .pipe(changed(config.basePathSrc))\n .pipe(njkRender({\n path: [config.nunjucksTemplate],\n }))\n .on('error', notify.onError())\n .pipe(prettify({\n indent_size: 2,\n }))\n .pipe(gulp.dest(config.basePathBuild));\n}", "title": "" }, { "docid": "8513f84450dd98f28c7f5c1bea3a1068", "score": "0.45489898", "text": "function getNexusErrorFromHtml (html) {\n return html\n .replace(/^.*<div class=\"content-section\">/s, '')\n .replace(/<\\/.*$/s, '')\n .trim();\n}", "title": "" }, { "docid": "582edaeb0c5a28eec97501a9e02521b7", "score": "0.45436022", "text": "function processContent() {\n return gulp\n .src(content.in)\n // Only process changed/new content.\n .pipe(changed(content.out))\n // Minify HTML.\n .pipe(htmlmin(content.htmlMinOpts))\n // Write final content files.\n .pipe(gulp.dest(content.out));\n}", "title": "" }, { "docid": "e76b1de8b52bafe06669ff950079d211", "score": "0.45396957", "text": "checkHtmlText() {\n this.innerHtmlText = null;\n if (startsWith(this.text, '<html>', true)) {\n const htmlText = this.text.trim();\n const s = htmlText.toLocaleLowerCase();\n if (s.indexOf('<body') === -1) {\n const s2 = s.indexOf('</html>');\n if (s2 >= 0)\n this.innerHtmlText = htmlText.substr(6, s2);\n }\n }\n }", "title": "" }, { "docid": "021a76d2966bba6516582336efc60f37", "score": "0.45388466", "text": "function htmlTask() {\n return src(filePaths.htmlPath)\n .pipe(htmlmin({ collapseWhitespace: true }))\n .pipe(dest(\"pub\"))\n .pipe(browserSync.stream());\n}", "title": "" }, { "docid": "74e5f80190c06f62ebf1bcedb80a09d7", "score": "0.4507794", "text": "function strip_tags (input) { //\n // making sure the allowed arg is a string containing only tags in lowercase (<a><b><c>)\n var tags = /<\\/?([a-z][a-z0-9]*)\\b[^>]*>/gi;\n var commentsAndPhpTags = /<!--[\\s\\S]*?-->|<\\?(?:php)?[\\s\\S]*?\\?>/gi;\n var output = input.replace(commentsAndPhpTags, '');\n return (input == output);\n}", "title": "" }, { "docid": "ade5d806c3252d04af475fa445be4199", "score": "0.4497274", "text": "function cb(error, response, html) {\n if (error) {\n console.error('error:', error); // Print the error if one occurred\n }\n else extractHTML(html);\n}", "title": "" }, { "docid": "7d274dc84a39a53d50cb5be1a87a4cc7", "score": "0.44887757", "text": "function fetchHTML(inputPath) {\n\tconsole.log('Reading \"' + config.inputFile + '\"...');\n\treturn Fs.readFileSync(inputPath, 'utf8');\n}", "title": "" }, { "docid": "95acd3f67140d21e6aacf87b18c7c0c0", "score": "0.44734555", "text": "removeExternalFlts() {\n if (!this.isExternalFlt()) {\n return;\n }\n let ids = this.externalFltIds;\n ids.forEach((id) => {\n let externalFlt = elm(id);\n if (externalFlt) {\n externalFlt.innerHTML = '';\n }\n });\n }", "title": "" }, { "docid": "fc56273881c0eb7fdb6e5275e48810d2", "score": "0.44728664", "text": "function cleanSource(html) {\n var lines = html.split(/\\n/);\n\n lines.shift();\n lines.splice(-1, 1); // remove the source button at the end\n\n var indentSize = lines[0].length - lines[0].trim().length,\n re = new RegExp(\" {\" + indentSize + \"}\");\n\n lines = lines.map(function(line){\n if (line.match(re)) {\n line = line.substring(indentSize);\n }\n\n return line;\n });\n\n lines = lines.join(\"\\n\");\n\n return lines;\n }", "title": "" }, { "docid": "33a2cb99c297cf3a9329fe983759ea42", "score": "0.44496498", "text": "function copyHTML(){\n \n return src(files.htmlPath)\n .pipe(browserSync.stream())\n .pipe(dest(\"pub\")\n \n );\n }", "title": "" }, { "docid": "f5ff8166d6b429dc3e1df2c1b1c67f0b", "score": "0.44390076", "text": "function checkHTMLForBrokenLinks( content )\n{\n var brokenlinks = \"\";\n \n try\n {\n var tags = content.match(/(((href\\s*=\\s*(\"|'))|(src\\s*=\\s*(\"|')))([^\\\"\\']*)(\"|'))/g);\n }\n catch( error )\n {\n return '-';\n }\n \n if ( tags )\n { \n for( var i = 0; i < tags.length; i++)\n {\n var link = tags[i].substring( tags[i].indexOf('\"') + 1, tags[i].length - 1 );\n var code = HTTPResponse( link );\n \n \n if( code >= 400 && code < 600 || code == 0 )\n brokenlinks += link + \" (\" + code +\"), \";\n \n }//end-for \n } \n \n if( brokenlinks == \"\" )\n return brokenlinks = \"-\";\n \n return brokenlinks;\n}", "title": "" }, { "docid": "49543b8563985d75a670d9cda61c725b", "score": "0.44281593", "text": "function processFile (fileURL) {\n if (!isHTMLType(fileURL))\n return;\n scanDocument(fileURL);\n}", "title": "" }, { "docid": "549ff36a52fe2930a22ab0b76b5a66ac", "score": "0.4426673", "text": "function copydevHtml(cb){\n copyHtml(config.devHtml, config.srcDir)\n cb()\n}", "title": "" }, { "docid": "d48bfbf0bcd7a6510725d96bc2c764ff", "score": "0.44216627", "text": "function removeDoctypeLineInDev(html) {\n\treturn html.slice(-100);\n}", "title": "" }, { "docid": "0d7a19da97661c07dd8dfb345f321a43", "score": "0.44192868", "text": "function pug() {\n return src(\"src/pug/structure/**/*.pug\")\n // install gulp-plumber and gulp-notify if you want to see beautiful errors in console\n /*.pipe(\n glp.plumber({\n errorHandler: glp.notify.onError(function (err) {\n return {\n title: \"PUG error\",\n message: err.message,\n };\n }),\n })\n )*/\n .pipe(\n glp.pug({\n pretty: true,\n })\n )\n .pipe(strip())\n .pipe(dest(\"dist/\"))\n .on(\"end\", browserSync.reload);\n}", "title": "" }, { "docid": "c920d1f9531d868c5a7e559bbd7607ca", "score": "0.44178632", "text": "function rxGetEphoxBodyContent(doc)\r\n{\r\n var lDoc = doc.toLowerCase();\r\n var sBodyPos = lDoc.indexOf(\"<body\");\r\n if(sBodyPos == -1)\r\n\t return doc;\r\n var eBodyPos = lDoc.indexOf(\">\", sBodyPos + 5);\r\n if(eBodyPos == -1) \r\n\t return doc;\r\n var cBodyPos = lDoc.lastIndexOf(\"</body>\");\r\n if(cBodyPos == -1)\r\n\t return doc;\r\n return doc.substring(eBodyPos + 1, cBodyPos);\r\n}", "title": "" }, { "docid": "8e84c17d255ab32a210896cf74558918", "score": "0.44165644", "text": "function cleanHTML() {\n test(\"current DOM\", 0, function () {\n runHTML5Lint(\"current DOM\", runHTML5Lint);\n });\n\n return {\"url\": null, \"src\": null};\n }", "title": "" }, { "docid": "5d49630214b62bafdaf07b6593c44f7c", "score": "0.4407698", "text": "function generateHTML() {\r\n return src('./src/index.html')\r\n .pipe(dest('./build'))\r\n}", "title": "" }, { "docid": "68707bc881175c588a771136fc6171b3", "score": "0.44036728", "text": "function pages() {\n return gulp.src(PATHS.src+'/**/*.html')\n .pipe(gulp.dest(PATHS.dist));\n}", "title": "" }, { "docid": "bfe5c89422b9de8bc47ebe3b154ace3e", "score": "0.43894622", "text": "function extractText(args) {\n var regex = /<.*?>/ig,\n result = '',\n line;\n\n for (line of args) {\n result += line.replace(regex, '').trim();\n }\n\n console.log(result)\n}", "title": "" }, { "docid": "4fe224ce181dc08e260e2eea86ab2c1b", "score": "0.4389174", "text": "function filterToSSML(html) {\n //Because s and sub have html meanings, they are prefixed with \"ssml:\"\n var ssml_content = html.replace(/ssml:/g, \"\")\n\n //&nbsp; breaks marytts ssml parser.\n //Declare the entity?\n ssml_content = ssml_content.replace(/&nbsp;/g, \" \")\n\n //remove unclosed br tags (even closed come out wrong)\n //ssml_content = ssml_content.replace(/<br>/g, \"<br/>\")\n ssml_content = ssml_content.replace(/<br>/g, \" \")\n\n return ssml_content;\n \n}", "title": "" }, { "docid": "beb117c1d5274432759cd5d0b755e387", "score": "0.43887016", "text": "function renderHTML(path, response){\n response.writeHead(200, {'Content-Type' : 'text/html'});\n fs.readFile(path, null, function(error, data) {\n if(error){\n response.writeHead(404);\n response.write('File not found');\n }else{\n response.write(data);\n }\n response.end();\n })\n}", "title": "" }, { "docid": "c89d066871f0ee6bb398170ce8f55177", "score": "0.43855244", "text": "function filterData(data){\r\n\t//data = data.replace(/<?/body[^>]*>/g,'');\r\n\tdata = data.replace(/[r|n]+/g,'');\r\n\t//data = data.replace(/<--[Ss]*?-->/g,'');\r\n\t//data = data.replace(/<noscript[^>]*>[Ss]*?</noscript>/g,'');\r\n\t//data = data.replace(/<script[^>]*>[Ss]*?</script>/g,'');\r\n\t//data = data.replace(/<script.*/>/,'');\r\n\treturn data;\r\n}", "title": "" }, { "docid": "d9f9b9dc9091a81424e68c6fffd31519", "score": "0.43840894", "text": "function get_body(content) {\n var x = content.indexOf(\"<main\");\n x = content.indexOf(\">\", x);\n var y = content.lastIndexOf(\"</main>\");\n return content.slice(x + 1, y);\n}", "title": "" }, { "docid": "dede029ec89df712aa94aecce2016d7b", "score": "0.43793824", "text": "function markup() {\n\treturn gulp\n\t\t.src([paths.markup.src])\n\t\t.pipe(\n\t\t\tembedSvg({\n\t\t\t\troot: app_base,\n\t\t\t})\n\t\t)\n\t\t.pipe(rename('index.html')) // rename file to 'index.html'\n\t\t.pipe(htmlmin({ collapseWhitespace: true })) // minify HTML\n\t\t.pipe(gulp.dest(paths.markup.dest));\n}", "title": "" }, { "docid": "7b5d40b8192857d2afdea84a89a753b0", "score": "0.43767294", "text": "function filterHTMLTags(htmlStr) {\n var harmTags = [\"script\", \"embed\", \"link\",\n \"listing\", \"meta\", \"noscript\", \n \"object\", \"plaintext\", \"xmp\"];\n \n for (var i = 0; i < harmTags.length; i++) {\n var matchStr = \"<\" + harmTags[i] + \"[^>]*>\";\n\n if (harmTags[i] != \"meta\" && harmTags[i] != \"link\")\n { \n matchStr += \".*?</\" + harmTags[i] + \">?\";\n }\n var regObj = new RegExp(matchStr, \"i\");\n htmlStr = htmlStr.replace(regObj, \"WARNING\");\n }\n return htmlStr;\n}", "title": "" }, { "docid": "e5ec5ee0f40188644d383cb31834d4e9", "score": "0.43757942", "text": "function XhtmlValidation(editor) {\n // Support functions\n this.Set = function(ary) {\n if (typeof(ary)==typeof('')) ary = [ary];\n if (ary instanceof Array) {\n for (var i = 0; i < ary.length; i++) {\n this[ary[i]] = 1;\n }\n }\n else {\n for (var v in ary) { // already a set?\n this[v] = 1;\n }\n }\n }\n\n this._exclude = function(array, exceptions) {\n var ex;\n if (exceptions.split) {\n ex = exceptions.split(\"|\");\n } else {\n ex = exceptions;\n }\n var exclude = new this.Set(ex);\n var res = [];\n for (var k=0; k < array.length;k++) {\n if (!exclude[array[k]]) res.push(array[k]);\n }\n return res;\n }\n this.setAttrFilter = function(attributes, filter) {\n for (var j = 0; j < attributes.length; j++) {\n var attr = attributes[j];\n this.attrFilters[attr] = filter || this._defaultCopyAttribute;\n }\n }\n\n this.setTagAttributes = function(tags, attributes) {\n for (var j = 0; j < tags.length; j++) {\n this.tagAttributes[tags[j]] = attributes;\n }\n }\n\n // define some new attributes for existing tags\n this.includeTagAttributes = function(tags, attributes) {\n for (var j = 0; j < tags.length; j++) {\n var tag = tags[j];\n this.tagAttributes[tag] = this.tagAttributes[tag].concat(attributes);\n }\n }\n\n this.excludeTagAttributes = function(tags, attributes) {\n var bad = new this.Set(attributes);\n var tagset = new this.Set(tags);\n for (var tag in tagset) {\n var val = this.tagAttributes[tag];\n for (var i = val.length; i >= 0; i--) {\n if (bad[val[i]]) {\n val = val.concat(); // Copy\n val.splice(i,1);\n }\n }\n this.tagAttributes[tag] = val;\n // have to store this to allow filtering for nodes on which\n // '*' is set as allowed, this allows using '*' for the attributes\n // but also filtering some out\n this.badTagAttributes[tag] = attributes;\n }\n }\n\n this.excludeTags = function(badtags) {\n if (typeof(badtags)==typeof('')) badtags = [badtags];\n for (var i = 0; i < badtags.length; i++) {\n delete this.tagAttributes[badtags[i]];\n }\n }\n\n this.excludeAttributes = function(badattrs) {\n this.excludeTagAttributes(this.tagAttributes, badattrs);\n for (var i = 0; i < badattrs.length; i++) {\n delete this.attrFilters[badattrs[i]];\n }\n }\n if (editor.getBrowserName()==\"IE\") {\n this._getTagName = function(htmlnode) {\n var nodename = htmlnode.nodeName.toLowerCase();\n if (htmlnode.scopeName && htmlnode.scopeName != \"HTML\") {\n nodename = htmlnode.scopeName+':'+nodename;\n }\n return nodename;\n }\n } else {\n this._getTagName = function(htmlnode) {\n return htmlnode.nodeName.toLowerCase();\n }\n };\n\n // Supporting declarations\n this.elements = new function(validation) {\n // A list of all attributes\n this.attributes = [\n 'abbr','accept','accept-charset','accesskey','action','align','alink',\n 'alt','archive','axis','background','bgcolor','border','cellpadding',\n 'cellspacing','char','charoff','charset','checked','cite','class',\n 'classid','clear','code','codebase','codetype','color','cols','colspan',\n 'compact','content','coords','data','datetime','declare','defer','dir',\n 'disabled','enctype','face','for','frame','frameborder','headers',\n 'height','href','hreflang','hspace','http-equiv','id','ismap','label',\n 'lang','language','link','longdesc','marginheight','marginwidth',\n 'maxlength','media','method','multiple','name','nohref','noshade','nowrap',\n 'object','onblur','onchange','onclick','ondblclick','onfocus','onkeydown',\n 'onkeypress','onkeyup','onload','onmousedown','onmousemove','onmouseout',\n 'onmouseover','onmouseup','onreset','onselect','onsubmit','onunload',\n 'profile','prompt','readonly','rel','rev','rows','rowspan','rules',\n 'scheme','scope','scrolling','selected','shape','size','span','src',\n 'standby','start','style','summary','tabindex','target','text','title',\n 'type','usemap','valign','value','valuetype','vlink','vspace','width',\n 'xml:lang','xml:space','xmlns'];\n\n // Core attributes\n this.coreattrs = ['id', 'title', 'style', 'class'];\n this.i18n = ['lang', 'dir', 'xml:lang'];\n // All event attributes are here but commented out so we don't\n // have to remove them later.\n this.events = []; // 'onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup'.split('|');\n this.focusevents = []; // ['onfocus','onblur']\n this.loadevents = []; // ['onload', 'onunload']\n this.formevents = []; // ['onsubmit','onreset']\n this.inputevents = [] ; // ['onselect', 'onchange']\n this.focus = ['accesskey', 'tabindex'].concat(this.focusevents);\n this.attrs = [].concat(this.coreattrs, this.i18n, this.events);\n\n // entities\n this.special_extra = ['object','applet','img','map','iframe'];\n this.special_basic=['br','span','bdo'];\n this.special = [].concat(this.special_basic, this.special_extra);\n this.fontstyle_extra = ['big','small','font','basefont'];\n this.fontstyle_basic = ['tt','i','b','u','s','strike'];\n this.fontstyle = [].concat(this.fontstyle_basic, this.fontstyle_extra);\n this.phrase_extra = ['sub','sup'];\n this.phrase_basic=[\n 'em','strong','dfn','code','q',\n 'samp','kbd','var', 'cite','abbr','acronym'];\n this.inline_forms = ['input','select','textarea','label','button'];\n this.misc_inline = ['ins','del'];\n this.misc = ['noscript'].concat(this.misc_inline);\n this.inline = ['a'].concat(this.special, this.fontstyle, this.phrase, this.inline_forms);\n\n this.Inline = ['#PCDATA'].concat(this.inline, this.misc_inline);\n\n this.heading = ['h1','h2','h3','h4','h5','h6'];\n this.lists = ['ul','ol','dl','menu','dir'];\n this.blocktext = ['pre','hr','blockquote','address','center','noframes'];\n this.block = ['p','div','isindex','fieldset','table'].concat(\n this.heading, this.lists, this.blocktext);\n\n this.Flow = ['#PCDATA','form'].concat(this.block, this.inline);\n }(this);\n\n this._commonsetting = function(self, names, value) {\n for (var n = 0; n < names.length; n++) {\n self[names[n]] = value;\n }\n }\n \n // The tagAttributes class returns all valid attributes for a tag,\n // e.g. a = this.tagAttributes.head\n // a.head -> [ 'lang', 'xml:lang', 'dir', 'id', 'profile' ]\n this.tagAttributes = new function(el, validation) {\n this.title = el.i18n.concat('id');\n this.html = this.title.concat('xmlns');\n this.head = this.title.concat('profile');\n this.base = ['id', 'href', 'target'];\n this.meta = this.title.concat('http-equiv','name','content', 'scheme');\n this.link = el.attrs.concat('charset','href','hreflang','type', 'rel','rev','media','target');\n this.style = this.title.concat('type','media','title', 'xml:space');\n this.script = ['id','charset','type','language','src','defer', 'xml:space'];\n this.iframe = [\n 'longdesc','name','src','frameborder','marginwidth',\n 'marginheight','scrolling','align','height','width'].concat(el.coreattrs);\n this.body = ['background','bgcolor','text','link','vlink','alink'].concat(el.attrs, el.loadevents);\n validation._commonsetting(this,\n ['p','div'].concat(el.heading),\n ['align'].concat(el.attrs));\n this.dl = this.dir = this.menu = el.attrs.concat('compact');\n this.ul = this.menu.concat('type');\n this.ol = this.ul.concat('start');\n this.li = el.attrs.concat('type','value');\n this.hr = el.attrs.concat('align','noshade','size','width');\n this.pre = el.attrs.concat('width','xml:space');\n this.blockquote = this.q = el.attrs.concat('cite');\n this.ins = this.del = this.blockquote.concat('datetime');\n this.a = el.attrs.concat(el.focus,'charset','type','name','href','hreflang','rel','rev','shape','coords','target');\n this.bdo = el.coreattrs.concat(el.events, 'lang','xml:lang','dir');\n this.br = el.coreattrs.concat('clear');\n validation._commonsetting(this,\n ['noscript','noframes','dt', 'dd', 'address','center','span','em', 'strong', 'dfn','code',\n 'samp','kbd','var','cite','abbr','acronym','sub','sup','tt',\n 'i','b','big','small','u','s','strike', 'fieldset'],\n el.attrs);\n\n this.basefont = ['id','size','color','face'];\n this.font = el.coreattrs.concat(el.i18n, 'size','color','face');\n this.object = el.attrs.concat('declare','classid','codebase','data','type','codetype','archive','standby','height','width','usemap','name','tabindex','align','border','hspace','vspace');\n this.param = ['id','name','value','valuetype','type'];\n this.applet = el.coreattrs.concat('codebase','archive','code','object','alt','name','width','height','align','hspace','vspace');\n this.img = el.attrs.concat('src','alt','name','longdesc','height','width','usemap','ismap','align','border','hspace','vspace');\n this.map = this.title.concat('title','name', 'style', 'class', el.events);\n this.area = el.attrs.concat('shape','coords','href','nohref','alt','target', el.focus);\n this.form = el.attrs.concat('action','method','name','enctype',el.formevents,'accept','accept-charset','target');\n this.label = el.attrs.concat('for','accesskey', el.focusevents);\n this.input = el.attrs.concat('type','name','value','checked','disabled','readonly','size','maxlength','src','alt','usemap',el.input,'accept','align', el.focus);\n this.select = el.attrs.concat('name','size','multiple','disabled','tabindex', el.focusevents,el.input);\n this.optgroup = el.attrs.concat('disabled','label');\n this.option = el.attrs.concat('selected','disabled','label','value');\n this.textarea = el.attrs.concat('name','rows','cols','disabled','readonly', el.inputevents, el.focus);\n this.legend = el.attrs.concat('accesskey','align');\n this.button = el.attrs.concat('name','value','type','disabled',el.focus);\n this.isindex = el.coreattrs.concat('prompt', el.i18n);\n this.table = el.attrs.concat('summary','width','border','frame','rules','cellspacing','cellpadding','align','bgcolor');\n this.caption = el.attrs.concat('align');\n this.col = this.colgroup = el.attrs.concat('span','width','align','char','charoff','valign');\n this.thead = el.attrs.concat('align','char','charoff','valign');\n this.tfoot = this.tbody = this.thead;\n this.tr = this.thead.concat('bgcolor');\n this.td = this.th = this.tr.concat('abbr','axis','headers','scope','rowspan','colspan','nowrap','width','height');\n }(this.elements, this);\n\n this.badTagAttributes = new this.Set({});\n\n // State array. For each tag identifies what it can contain.\n // I'm not attempting to check the order or number of contained\n // tags (yet).\n this.States = new function(el, validation) {\n\n var here = this;\n function setStates(tags, value) {\n var valset = new validation.Set(value);\n\n for (var i = 0; i < tags.length; i++) {\n here[tags[i]] = valset;\n }\n }\n \n setStates(['html'], ['head','body']);\n setStates(['head'], ['title','base','script','style', 'meta','link','object','isindex']);\n setStates([\n 'base', 'meta', 'link', 'hr', 'param', 'img', 'area', 'input',\n 'br', 'basefont', 'isindex', 'col',\n ], []);\n\n setStates(['title','style','script','option','textarea'], ['#PCDATA']);\n setStates([ 'noscript', 'iframe', 'noframes', 'body', 'div',\n 'li', 'dd', 'blockquote', 'center', 'ins', 'del', 'td', 'th',\n ], el.Flow);\n\n setStates(el.heading, el.Inline);\n setStates([ 'p', 'dt', 'address', 'span', 'bdo', 'caption',\n 'em', 'strong', 'dfn','code','samp','kbd','var',\n 'cite','abbr','acronym','q','sub','sup','tt','i',\n 'b','big','small','u','s','strike','font','label',\n 'legend'], el.Inline);\n\n setStates(['ul', 'ol', 'menu', 'dir', 'ul', ], ['li']);\n setStates(['dl'], ['dt','dd']);\n setStates(['pre'], validation._exclude(el.Inline, \"img|object|applet|big|small|sub|sup|font|basefont\"));\n setStates(['a'], validation._exclude(el.Inline, \"a\"));\n setStates(['applet', 'object'], ['#PCDATA', 'param','form'].concat(el.block, el.inline, el.misc));\n setStates(['map'], ['form', 'area'].concat(el.block, el.misc));\n setStates(['form'], validation._exclude(el.Flow, ['form']));\n setStates(['select'], ['optgroup','option']);\n setStates(['optgroup'], ['option']);\n setStates(['fieldset'], ['#PCDATA','legend','form'].concat(el.block,el.inline,el.misc));\n setStates(['button'], validation._exclude(el.Flow, ['a','form','iframe'].concat(el.inline_forms)));\n setStates(['table'], ['caption','col','colgroup','thead','tfoot','tbody','tr']);\n setStates(['thead', 'tfoot', 'tbody'], ['tr']);\n setStates(['colgroup'], ['col']);\n setStates(['tr'], ['th','td']);\n }(this.elements, this);\n\n // Permitted elements for style.\n this.styleWhitelist = new this.Set(['text-align', 'list-style-type', 'float']);\n this.classBlacklist = new this.Set(['MsoNormal', 'MsoTitle', 'MsoHeader', 'MsoFootnoteText',\n 'Bullet1', 'Bullet2']);\n\n this.classFilter = function(value) {\n var classes = value.split(' ');\n var filtered = [];\n for (var i = 0; i < classes.length; i++) {\n var c = classes[i];\n if (c && !this.classBlacklist[c]) {\n filtered.push(c);\n }\n }\n return filtered.join(' ');\n }\n this._defaultCopyAttribute = function(name, htmlnode, xhtmlnode) {\n var val = htmlnode.getAttribute(name);\n if (val) xhtmlnode.setAttribute(name, val);\n }\n // Set up filters for attributes.\n var filter = this;\n this.attrFilters = new function(validation, editor) {\n var attrs = validation.elements.attributes;\n for (var i=0; i < attrs.length; i++) {\n this[attrs[i]] = validation._defaultCopyAttribute;\n }\n this['class'] = function(name, htmlnode, xhtmlnode) {\n var val = htmlnode.getAttribute('class');\n if (val) val = validation.classFilter(val);\n if (val) xhtmlnode.setAttribute('class', val);\n }\n // allow a * wildcard to make all attributes valid in the filter\n // note that this is pretty slow on IE\n this['*'] = function(name, htmlnode, xhtmlnode) {\n var nodeName = filter._getTagName(htmlnode);\n var bad = filter.badTagAttributes[nodeName];\n for (var i=0; i < htmlnode.attributes.length; i++) {\n var attr = htmlnode.attributes[i];\n if (bad && bad.contains(attr.name)) {\n continue;\n };\n if (attr.value !== null && attr.value !== undefined) {\n xhtmlnode.setAttribute(attr.name, attr.value);\n };\n };\n }\n if (editor.getBrowserName()==\"IE\") {\n this['class'] = function(name, htmlnode, xhtmlnode) {\n var val = htmlnode.className;\n if (val) val = validation.classFilter(val);\n if (val) xhtmlnode.setAttribute('class', val);\n }\n this['http-equiv'] = function(name, htmlnode, xhtmlnode) {\n var val = htmlnode.httpEquiv;\n if (val) xhtmlnode.setAttribute('http-equiv', val);\n }\n this['xml:lang'] = this['xml:space'] = function(name, htmlnode, xhtmlnode) {\n try {\n var val = htmlnode.getAttribute(name);\n if (val) xhtmlnode.setAttribute(name, val);\n } catch(e) {\n }\n }\n }\n this.rowspan = this.colspan = function(name, htmlnode, xhtmlnode) {\n var val = htmlnode.getAttribute(name);\n if (val && val != '1') xhtmlnode.setAttribute(name, val);\n }\n this.style = function(name, htmlnode, xhtmlnode) {\n var val = htmlnode.style.cssText;\n if (val) {\n var styles = val.split(/; */);\n for (var i = styles.length; i >= 0; i--) if (styles[i]) {\n var parts = /^([^:]+): *(.*)$/.exec(styles[i]);\n var name = parts[1].toLowerCase();\n if (validation.styleWhitelist[name]) {\n styles[i] = name+': '+parts[2];\n } else {\n styles.splice(i,1); // delete\n }\n }\n if (styles[styles.length-1]) styles.push('');\n val = styles.join('; ').strip();\n }\n if (val) xhtmlnode.setAttribute('style', val);\n }\n }(this, editor);\n\n // Exclude unwanted tags.\n this.excludeTags(['center']);\n\n if (editor.config && editor.config.htmlfilter) {\n this.filterStructure = editor.config.htmlfilter.filterstructure;\n \n var exclude = editor.config.htmlfilter;\n if (exclude.a)\n this.excludeAttributes(exclude.a);\n if (exclude.t)\n this.excludeTags(exclude.t);\n if (exclude.c) {\n var c = exclude.c;\n if (!c.length) c = [c];\n for (var i = 0; i < c.length; i++) {\n this.excludeTagAttributes(c[i].t, c[i].a);\n }\n }\n if (exclude.xstyle) {\n var s = exclude.xstyle;\n for (var i = 0; i < s.length; i++) {\n this.styleWhitelist[s[i]] = 1;\n }\n }\n if (exclude['class']) {\n var c = exclude['class'];\n for (var i = 0; i < c.length; i++) {\n this.classBlacklist[c[i]] = 1;\n }\n }\n };\n\n // Copy all valid attributes from htmlnode to xhtmlnode.\n this._copyAttributes = function(htmlnode, xhtmlnode, valid) {\n if (valid.contains('*')) {\n // allow all attributes on this tag\n this.attrFilters['*'](name, htmlnode, xhtmlnode);\n return;\n };\n for (var i = 0; i < valid.length; i++) {\n var name = valid[i];\n var filter = this.attrFilters[name];\n if (filter) filter(name, htmlnode, xhtmlnode);\n }\n }\n\n this._convertToSarissaNode = function(ownerdoc, htmlnode, xhtmlparent) {\n return this._convertNodes(ownerdoc, htmlnode, xhtmlparent, new this.Set(['html']));\n };\n \n this._convertNodes = function(ownerdoc, htmlnode, xhtmlparent, permitted) {\n var name, parentnode = xhtmlparent;\n var nodename = this._getTagName(htmlnode);\n var nostructure = !this.filterstructure;\n\n // TODO: This permits valid tags anywhere. it should use the state\n // table in xhtmlvalid to only permit tags where the XHTML DTD\n // says they are valid.\n var validattrs = this.tagAttributes[nodename];\n if (validattrs && (nostructure || permitted[nodename])) {\n try {\n var xhtmlnode = ownerdoc.createElement(nodename);\n parentnode = xhtmlnode;\n } catch (e) { };\n\n if (validattrs && xhtmlnode)\n this._copyAttributes(htmlnode, xhtmlnode, validattrs);\n }\n\n var kids = htmlnode.childNodes;\n var permittedChildren = this.States[parentnode.tagName] || permitted;\n\n if (kids.length == 0) {\n if (htmlnode.text && htmlnode.text != \"\" &&\n (nostructure || permittedChildren['#PCDATA'])) {\n var text = htmlnode.text;\n var tnode = ownerdoc.createTextNode(text);\n parentnode.appendChild(tnode);\n }\n } else {\n for (var i = 0; i < kids.length; i++) {\n var kid = kids[i];\n\n if (kid.parentNode !== htmlnode) {\n if (kid.tagName == 'BODY') {\n if (nodename != 'html') continue;\n } else if (kid.parentNode.tagName === htmlnode.tagName) {\n continue; // IE bug: nodes appear multiple places\n }\n }\n \n if (kid.nodeType == 1) {\n var newkid = this._convertNodes(ownerdoc, kid, parentnode, permittedChildren);\n if (newkid != null) {\n parentnode.appendChild(newkid);\n };\n } else if (kid.nodeType == 3) {\n if (nostructure || permittedChildren['#PCDATA'])\n parentnode.appendChild(ownerdoc.createTextNode(kid.nodeValue));\n } else if (kid.nodeType == 4) {\n if (nostructure || permittedChildren['#PCDATA'])\n parentnode.appendChild(ownerdoc.createCDATASection(kid.nodeValue));\n }\n }\n } \n return xhtmlnode;\n };\n}", "title": "" }, { "docid": "092d0b606effb9f957278207abf68bed", "score": "0.43731943", "text": "function templateContent() {\n const html = fs.readFileSync(\n path.resolve(process.cwd(), 'app/project-files/index.html')\n ).toString();\n\n if (!dllPlugin) {\n return html; }\n\n const doc = cheerio(html);\n return doc.toString();\n}", "title": "" }, { "docid": "751f76415a77d34fc560b77ad2f6ef02", "score": "0.43675587", "text": "function copyProdHtml(cb){\n copyHtml(config.distHtml, config.build)\n cb();\n}", "title": "" }, { "docid": "72e7dab209d4f894e84361642d2c3aa7", "score": "0.43652102", "text": "function processHtml(entry) {\n\t// console.log(\"PROCESSHTML ENTRY\", entry);\n\tif (!entry) {\n\t\tconsole.error(\"Error: No entry in processHtml\");\n\t\treturn;\n\t}\n\tif (!entry.humdrumOutput) {\n\t\treturn;\n\t}\n\tlet parameters = getHumdrumParameters(entry.humdrumOutput);\n\t// console.log(\"EXTRACTED PARAMETERS\", parameters);\n\n\tif (!parameters) {\n\t\treturn;\n\t}\n\n\tlet preHtml = parameters.PREHTML;\n\tlet postHtml = parameters.POSTHTML;\n\n\tlet preElement = entry.container.querySelector(\"div.PREHTML\");\n\tlet postElement = entry.container.querySelector(\"div.POSTHTML\");\n\n\tif (!preHtml) {\n\t\tif (preElement) {\n\t\t\tpreElement.style.display = \"none\";\n\t\t}\n\t}\n\tif (!postHtml) {\n\t\tif (postElement) {\n\t\t\tpostElement.style.display = \"none\";\n\t\t}\n\t}\n\tif (!preHtml && !postHtml) {\n\t\treturn;\n\t}\n\n\t// Also deal with paged content: show preHtml only above first page\n\t// and postHtml only below last page.\n\n\tlet lang = entry.options.lang || \"\";\n\tlet langs = lang.split(/[^A-Za-z0-9_-]+/).filter(e => e);\n\tlet preContent = \"\";\n\tlet postContent = \"\";\n\tif (langs.length > 0) {\n\t\tfor (let i=0; i<langs.length; i++) {\n\t\t\tif (preHtml) {\n\t\t\t\tpreContent = preHtml[`CONTENT-${langs[i]}`];\n\t\t\t} \n\t\t\tif (typeof preContent !== 'undefined') {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor (let i=0; i<langs.length; i++) {\n\t\t\tif (postHtml) {\n\t\t\t\tpostContent = postHtml[`CONTENT-${langs[i]}`];\n\t\t\t} \n\t\t\tif (typeof postContent !== 'undefined') {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (typeof preContent === 'undefined') {\n\t\t\tif (preHtml) {\n\t\t\t\tpreContent = preHtml.CONTENT;\n\t\t\t}\n\t\t}\n\t\tif (typeof postContent === 'undefined') {\n\t\t\tif (postHtml) {\n\t\t\t\tpostContent = postHtml.CONTENT;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif (preHtml) {\n\t\t\tpreContent = preHtml.CONTENT;\n\t\t}\n\t\tif (postHtml) {\n\t\t\tpostContent = postHtml.CONTENT;\n\t\t}\n\t}\n\n\tpreContent = applyParameters(text, parameters.PREHTML, parameters._REFS, langs);\n\tpostContent = applyParameters(text, parameters.POSTHTML, parameters._REFS, langs);\n\n\t// Get the first content-lang parameter:\n\tif (typeof preContent === 'undefined') {\n\t\tif (preHtml) {\n\t\t\tfor (var name in preHtml) {\n\t\t\t\tif (name.match(/^CONTENT/)) {\n\t\t\t\t\tpreContent = preHtml[name];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (typeof postContent === 'undefined') {\n\t\tif (postHtml) {\n\t\t\tfor (var name in postHtml) {\n\t\t\t\tif (name.match(/^CONTENT/)) {\n\t\t\t\t\tpostContent = postHtml[name];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tlet preStyle = \"\";\n\tlet postStyle = \"\";\n\n\tif (preHtml) {\n\t\tpreStyle = preHtml.STYLE || \"\";\n\t}\n\tif (postHtml) {\n\t\tpostStyle = postHtml.STYLE || \"\";\n\t}\n\n\tif (!preContent) {\n\t\tif (preElement) {\n\t\t\tpreElement.style.display = \"none\";\n\t\t}\n\t} else if (preElement) {\n\t\tpreElement.style.display = \"block\";\n\t\tif (preStyle) {\n\t\t\tpreElement.style.cssText = preStyle;\n\t\t}\n\t\tpreElement.innerHTML = preContent;\n\t}\n\n\tif (!postContent) {\n\t\tif (postElement) {\n\t\t\tpostElement.style.display = \"none\";\n\t\t}\n\t} else if (postElement) {\n\t\tpostElement.style.display = \"block\";\n\t\tif (postStyle) {\n\t\t\tpostElement.style.cssText = postStyle;\n\t\t}\n\t\tpostElement.innerHTML = postContent;\n\t}\n}", "title": "" }, { "docid": "3fe7eac80f0c6d4fbbe00824c30c82a2", "score": "0.43632367", "text": "static matcher() {\n return function(file) {\n if (file.match(/\\.html\\.jsx$/)) {\n return true;\n } else {\n log(`${file} is not a .jsx. Ignoring...`);\n return false;\n }\n };\n }", "title": "" }, { "docid": "2263d6d48c0c3f1b9dc2f90d90d1bfb4", "score": "0.43625882", "text": "function buildHtmlFn(sources, dest){\n return gulp.src(sources)\n .pipe(htmlmin({collapseWhitespace: true, removeComments: true}))\n .pipe(gulp.dest(dest));\n}", "title": "" }, { "docid": "e4afb93e540bf030f77f85efb6d7c975", "score": "0.4359004", "text": "function getHTML(request, response){\n\nif(request.url === \"/\"){\nresponse.writeHead(200, {'Content-Type': 'text/html'});\nvar readHTML = fs.readFileSync('../../index.html', {encoding: 'utf8'});\nresponse.end(readHTML);\n\n}\n}", "title": "" }, { "docid": "4d7ffd86c07ad8d0e58a300923db971a", "score": "0.43542072", "text": "function pages() {\n if(!template){\n console.log('Sorry, you must specify the name of the template in the command line. Please see README.md');\n process.exit();\n }\n return gulp.src([`${path.src}/pages/**/*.html`, `!${path.src}/pages/archive/**/*.html`])\n .pipe(panini({\n root: `${path.src}/pages`,\n layouts: `${path.src}/layouts`,\n partials: `${path.src}/partials`,\n data: `${path.src}/data`,\n helpers: `${path.src}/helpers`\n }))\n //.pipe($.if(PRODUCTION, $.replace('./img', `${awsURL}`)))\n .pipe($.replace(/#\\[br]/g, '<br/>'))\n .pipe($.replace(/#\\[(\\w+)(\\((.*)\\))?\\s?(.*?)]/g, '<$1 $3>$4</$1>')) // Simple inline tag in yaml, like strong, em. etc. Mask #[htmltag text]\n .pipe($.htmlEntities('decode'))\n .pipe(inky())\n .pipe($.replace('<br>', '&nbsp;<br/>'))\n .pipe(gulp.dest(`${path.dist}`));\n}", "title": "" }, { "docid": "03a85abe1b147d7cbd4da3900c8f3664", "score": "0.43499786", "text": "required_file(req, res) {\n\n if (req.url == '/') {\n res.writeHead(200, { 'Content-Type': 'text/html' });\n var RS = fs.createReadStream(__dirname + '/../build/index.html')\n RS.pipe(res);\n }\n if (req.url.substring(0, 5) == \"/sear\") {\n res.writeHead(200, { 'Content-Type': 'text/html' });\n var RS = fs.createReadStream(__dirname + '/../build/index.html')\n RS.pipe(res);\n console.log(req.url.substring(0, 5));\n console.log(req.url.substring(5, req.url.length));\n }\n if (req.url.split('.').pop() == 'css') {\n res.writeHead(200, { 'Content-Type': 'text/css' });\n var RS = fs.createReadStream(__dirname + '/../build/' + req.url)\n RS.pipe(res);\n }\n\n if (req.url.split('.').pop() == 'js') {\n res.writeHead(200, { 'Content-Type': 'text/javascript ' });\n var RS = fs.createReadStream(__dirname + '/../build/' + req.url)\n RS.pipe(res);\n }\n\n if (req.url.split('.').pop() == 'png') {\n res.writeHead(200, { 'Content-Type': 'image/png' });\n var RS = fs.createReadStream(__dirname + '/../build/' + req.url)\n RS.pipe(res);\n }\n if (req.url.split('.').pop() == 'gif') {\n res.writeHead(200, { 'Content-Type': 'image/gif' });\n var RS = fs.createReadStream(__dirname + '/../build/' + req.url)\n RS.pipe(res);\n }\n // handling Scrabing request----------------------------------------->\n if (req.url == '/requesting_items') {\n let $ = cheerio.load(Html);\n\n $('.name').each((i, element) => {\n item_text[i] = $(element).children().attr('href').substring(1);\n\n });\n\n $('.img').each((i, element) => {\n item_link[i] = $(element).find('a img').attr('src');\n console.log(item_link[i]);\n\n });\n\n\n res.end(JSON.stringify(item_text))\n\n }\n\n for (let i = 0; i < item_text.length; i++) {\n const element = '/' + item_text[i];\n if (req.url == element) {\n //console.log('https://images.gogoanime.tv/cover'+element+'.png');\n\n Request(item_link[i]).pipe(res)\n }\n }\n for (let i = 0; i < item_text.length; i++) {\n const element = '/videos/' + item_text[i];\n\n if (req.url == element) {\n console.log('enter');\n Request('https://www14.gogoanimes.tv/' + item_text[i], (error, response, html) => {\n console.log('enter');\n let $ = cheerio.load(html);\n let video = $('.rapidvideo').find('a').attr('data-video');\n console.log(video);\n\n Request(video + '&q=720p', (error, response, html) => {\n console.log('enter2');\n let $ = cheerio.load(html);\n let video_mp4 = $('.video-js').find('source').attr('src');\n console.log(video_mp4);\n\n res.end(JSON.stringify(video_mp4));\n\n\n });\n });\n }\n }\n\n if(req.url.substring(0, 5) == \"/Sear\"){\n console.log(req.url.substring(5, req.url.length));\n item_text = [];\n item_link = [];\n Request('https://www2.gogoanime.io/search.html?keyword=' + req.url.substring(5, req.url.length), (error, response, html) => {\n console.log('search will be made');\n let $ = cheerio.load(html);\n $('.name').each((i, element) => {\n item_text[i] = $(element).children().attr('title').replace(/ /g, \"-\");\n console.log(item_text[i]);\n });\n \n $('.img').each((i, element) => {\n item_link[i] = $(element).find('a img').attr('src');\n //console.log(item_link[i]);\n \n });\n \n res.end(JSON.stringify(item_text))\n\n \n\n });\n }\n\n\n\n }", "title": "" }, { "docid": "095eecff21ea58cd1766a1bf8a87c46a", "score": "0.4346905", "text": "function pages() {\n return gulp.src('src/pages/**/*.{html,hbs,handlebars}')\n .pipe(panini({\n root: 'src/pages/',\n layouts: 'src/layouts/',\n partials: 'src/partials/', \n data: 'src/data/',\n helpers: 'src/helpers/'\n }))\n .pipe($.if(PRODUCTION,$.htmlmin({collapseWhitespace: true})))\n .pipe(gulp.dest(PATHS.dist));\n}", "title": "" }, { "docid": "7bbcc43665910e0d8f90de4dee271f14", "score": "0.43427297", "text": "function copyExtraFiles() {\n return src(cfg.extraFiles, {cwd: cfg.htmlSource, base: cfg.htmlSource, allowEmpty: true})\n .pipe(rename(path => {\n if (path.dirname.startsWith('..')) {\n path.dirname = path.dirname.replace(/\\.\\.[/\\\\]*/gi, '')\n }\n }))\n .pipe(dest(cfg.buildRoot))\n }", "title": "" }, { "docid": "9aa6d3cc500365276b782c2031183d17", "score": "0.43385166", "text": "function strip_HTML(str) {\n var findHtml = /<(.|\\n)*?>/gi;\n return str.replace(findHtml,\"\");\n}", "title": "" }, { "docid": "9aa6d3cc500365276b782c2031183d17", "score": "0.43385166", "text": "function strip_HTML(str) {\n var findHtml = /<(.|\\n)*?>/gi;\n return str.replace(findHtml,\"\");\n}", "title": "" }, { "docid": "1acf67083bebd6b6c343f61e4dd23734", "score": "0.43372127", "text": "function cleanDocument() {\n // RASH depends on JQuery, so we can leverage it here as well.\n // We remove all elements with the \"cgen\" class, introduced automatically by RASH.\n $('.cgen').remove();\n $('body header').remove();\n // To do: citations should be reverted as well\n// now revert the remaining MathJax page alterations\n $('head style').remove();\n $('#MathJax_Hidden').parents('div').remove();\n $('#MathJax_Font_Test').parents('div').remove();\n $('#MathJax_Message').remove();\n $('.MathJax_Preview').remove();\n}", "title": "" } ]
599efd85ee1367b5c33dc62d513eb0b1
Format is ABCDEF eslintdisablenextline classmethodsusethis
[ { "docid": "145be1817b4d8614d01385b5522c990d", "score": "0.0", "text": "_getRandomColor() {\n const colors = ServerConfig.SNAKES.COLORS;\n const max = colors.length;\n const index = Math.floor(Math.random() * Math.floor(max));\n return colors[index];\n }", "title": "" } ]
[ { "docid": "81436bb268ae3d0554d5b32cfbb5ca92", "score": "0.57909125", "text": "_formatMethod(method) {\n return `${this.name}.${method}`;\n }", "title": "" }, { "docid": "fad27d7b637063c3200929c31038c18b", "score": "0.57385516", "text": "function format() {\n\n\t\t}", "title": "" }, { "docid": "1d619e8133f0425d8b14de2f4ef56be0", "score": "0.571007", "text": "function formatStringInClass(instance_name, string_in_class){\n var index_of_self=-1;\n //printf(\"INSTANCE_NAME \"++\"\\n\",instance_name);\n //printf(\"STRING IN CLASS \\n|\"++\"|\\n\",string_in_class);\n string_in_class=toCString(string_in_class);\n while (TRUE) {\n index_of_self=find_from_index_not_in_string(string_in_class, \"self.\", index_of_self+1);\n //printf(\"index_of_self is |\"++\"|\",index_of_self);\n if (index_of_self==-1) {\n break;\n }\n if (index_of_self==0||string_in_class[index_of_self-1]==' '||isSign(string_in_class[index_of_self-1])||isJudgeSign(string_in_class[index_of_self-1])) {\n string_in_class=replace_from_index_to_index(string_in_class, \"self.\", append(instance_name, \".\"), index_of_self, index_of_self+5);\n }\n \n \n }\n \n // if (find_not_in_string(string_in_class, \"<@\")!=-1) {\n // string_in_class=replace(string_in_class, \"<@\", append(\"<@\", instance_name));\n // }\n \n // printf(\"string_in_class |\"++\"|\\n\",string_in_class);\n \n var begin=0;\n var index_of_exp=0;\n var space_of_exp=0;\n //exit(0);\n while (TRUE) {\n index_of_exp=find_from_index_not_in_string(string_in_class, \" exp\", begin);\n if (index_of_exp==-1) {\n break;\n }\n var index_of_gang_n=find_from_index_not_in_string(string_in_class, \"\\\\n\", index_of_exp+7);\n if (index_of_gang_n==-1) {\n break;\n //index_of_gang_n=string_in_class.length;\n }\n if (find(substr(string_in_class, index_of_exp+7, index_of_gang_n), \":\")==-1) {\n begin=index_of_gang_n+2;\n continue;\n }\n else {\n ///printf(\"Find expression\");\n space_of_exp=space_ahead_for_formatStringInClass(string_in_class, index_of_exp+4);\n //printf(\"space_of_exp is \"++\"\\n\",space_of_exp);\n var index_of_gang_n2=index_of_gang_n;\n var instance_with_space=append(\" \", append(instance_name,\" \")); //\"x\"-->\" x \"\n while (TRUE) {\n var a=index_of_gang_n2+2;\n var space_num=0;\n for (;a<string_in_class.length; a++) {\n //printf(\"|%c|\\n\",string_in_class[a]);\n if (string_in_class[a]==' ') {\n space_num++;\n }\n else{\n break;\n }\n }\n //printf(\"space num \"++\" space_of_exp \"++\"\\n\",space_num,space_of_exp);\n var begin2=a;\n index_of_gang_n2=find_from_index_not_in_string(string_in_class,\"\\\\n\", begin2);\n var replace_str=substr(string_in_class, begin2-1, index_of_gang_n2);\n var begin3=find(replace_str,\" self \");\n if (space_num-4==space_of_exp) {\n if (begin3!=0) {\n printf(\"@@ |\"+CURRENT_INPUT_STR+\"|\\n\");\n\n printf(\"Mistake Occurred whiling defining expression in Class Functions\\n'self 'must be added at the most ahead position\\n\");\n exit(1);\n }\n else {\n //printf(\"Begin replace\\n\");\n string_in_class=replace_from_index_to_index(string_in_class,\" self \" ,instance_with_space, begin2-1, index_of_gang_n2);\n begin=index_of_gang_n2+2+instance_with_space.length-6;\n index_of_gang_n2=index_of_gang_n2+instance_with_space.length-6;\n }\n }\n else{\n break;\n }\n \n }\n \n }\n }\n \n //printf(\"string_in_class |\"++\"|\\n\",string_in_class);\n //string_in_class=replace(string_in_class, \" self \", append(\" \",append(instance_name,\" \")));\n return string_in_class;\n}", "title": "" }, { "docid": "00e3258e8c7f982c8a3b6acd76a55cf4", "score": "0.5601908", "text": "get format() {}", "title": "" }, { "docid": "3d6d43e0616941a390828cf01f4853d8", "score": "0.5552236", "text": "function Formatter(code) {\n this._code = code.replace(/\\r/g, '');\n }", "title": "" }, { "docid": "5183c8d5a29dea26c6800692db264f3d", "score": "0.54828036", "text": "function space_ahead_for_formatStringInClass(string_in_class, begin){\n var num=0;\n begin=begin-1;\n //printf(\"####\\n|\"++\"|\\nbegin \"++\"\\n\",string_in_class,begin);\n for (; begin>=0; begin--) {\n if (string_in_class[begin]==' ') {\n num++;\n }\n else{\n break;\n }\n }\n return num;\n}", "title": "" }, { "docid": "266adc9365e90af58a8408b22f7563fc", "score": "0.5439354", "text": "function MyFormatter() {// No need to call Formatter ctor here\n\n}", "title": "" }, { "docid": "499b536d44e0c283aa399cc24f2a30b4", "score": "0.53661716", "text": "function PhantomFormatter() {}", "title": "" }, { "docid": "1cfa9bfee6f2c5b6ae821237eb5c8871", "score": "0.53019124", "text": "function WrongFormat() {\n console.log('@Warning: Wrong Command Format');\n console.log('Please try format: node master.js -f/d/h [number of function tests]. See examples below:');\n console.log('Funtional Test: node master.js -f 120');\n console.log('Hit Unit Test: node master.js -h');\n console.log('Direction Unit Test: node master.js -d');\n}", "title": "" }, { "docid": "fb063416fe5edd2e853da1424d428d6d", "score": "0.52719694", "text": "format() {\n return `${this.client} owes #${this.amount} for ${this.details}`;\n }", "title": "" }, { "docid": "9e0c113dc73878a0fa38526440709b85", "score": "0.52506906", "text": "_setDiscription(){\n //so this will give us nice formatted string to put a time stamp\n //let's do it\n //if you want our bestie prettier to ignore some formatting then do this\n //prettier-ignore\n const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];\n this.description = `${this.type[0].toUpperCase()}${this.type.slice(1)} on \n ${months[this.date.getMonth()]} ${this.date.getDate()}`\n }", "title": "" }, { "docid": "0cd283e82e6625572e449e886c7757cc", "score": "0.5193514", "text": "get formatString() {\n return this._format.formatString\n }", "title": "" }, { "docid": "787186f9bfae6ce16fc7a7ba5ed0422f", "score": "0.51713306", "text": "prettyPrint(){\n console.log(`Attribut ${this.getAttributeKey()} -> ${this.getValue()} :`);\n console.log(`\\ttexte long : \"${this.getLongText()}\"\\n\\ttexte court : \"${this.getShortText()}\"`);\n }", "title": "" }, { "docid": "a5a357f3ecd827c3cf492fe96f1028d2", "score": "0.5131962", "text": "get formatString() {\n return this.i.kc;\n }", "title": "" }, { "docid": "adf79e9a0a96b8564db0e6b61cebfa73", "score": "0.51146954", "text": "function $a(e){e.classed(\"token\",(function(e,t){return!0})).classed(\"new-line\",(function(e,t){return\"\\n\"===e.token||\"\\n\\n\"===e.token})).classed(\"token-part\",(function(e,t){return e.token.length>1&&\" \"!==e.token[0]||!(1!==e.token.length||!Pa(\"^\\\\pL+$\").test(e.token))})).classed(\"input-token\",(function(e,t){return\"input\"===e.type})).classed(\"output-token\",(function(e,t){return\"output\"===e.type}))}", "title": "" }, { "docid": "8121bb5d27ec26d7a04da70ef93a0616", "score": "0.5062735", "text": "buildStyleText(style) {\n let\n css = [],\n // `deco` is css's `text-decoration` values.\n deco = [];\n\n Object.keys(PROPS).forEach((prop) => {\n if (style[prop]) {\n css.push(PROPS[prop]);\n }\n });\n\n \n ['underline', 'strike'].forEach((prop) => {\n if (style[prop]) {\n deco.push(prop === 'strike' ? 'line-through' : prop);\n }\n });\n if (deco.length > 0) {\n css.push('text-decoration: ' + deco.join(' '));\n }\n\n ['color', 'backgrund'].forEach((prop) => {\n if (style[prop]) {\n css.push(prop + ': ' + style[prop]);\n }\n });\n\n if (style.style) {\n css = css.concat(style.style);\n }\n\n this.args.push(css.join('; '));\n return '%c';\n }", "title": "" }, { "docid": "75ae3b76e59eb31b6dcd50cef8f74398", "score": "0.5038547", "text": "function formatArgs(args) {\n args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);\n\n if (!this.useColors) {\n return;\n }\n\n const c = 'color: ' + this.color;\n args.splice(1, 0, c, 'color: inherit');\n\n // The final \"%c\" is somewhat tricky, because there could be other\n // arguments passed either before or after the %c, so we need to\n // figure out the correct index to insert the CSS into\n let index = 0;\n let lastC = 0;\n args[0].replace(/%[a-zA-Z%]/g, match => {\n if (match === '%%') {\n return;\n }\n index++;\n if (match === '%c') {\n // We only are interested in the *last* %c\n // (the user may have provided their own)\n lastC = index;\n }\n });\n\n args.splice(lastC, 0, c);\n }", "title": "" }, { "docid": "6feb2af880f7d758f61e71c8873fba2e", "score": "0.5032638", "text": "function formatArgs(args) {\n\t\targs[0] = (this.useColors ? '%c' : '') +\n\t\t\tthis.namespace +\n\t\t\t(this.useColors ? ' %c' : ' ') +\n\t\t\targs[0] +\n\t\t\t(this.useColors ? '%c ' : ' ') +\n\t\t\t'+' + module.exports.humanize(this.diff);\n\n\t\tif (!this.useColors) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst c = 'color: ' + this.color;\n\t\targs.splice(1, 0, c, 'color: inherit');\n\n\t\t// The final \"%c\" is somewhat tricky, because there could be other\n\t\t// arguments passed either before or after the %c, so we need to\n\t\t// figure out the correct index to insert the CSS into\n\t\tlet index = 0;\n\t\tlet lastC = 0;\n\t\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\t\tif (match === '%%') {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tindex++;\n\t\t\tif (match === '%c') {\n\t\t\t\t// We only are interested in the *last* %c\n\t\t\t\t// (the user may have provided their own)\n\t\t\t\tlastC = index;\n\t\t\t}\n\t\t});\n\n\t\targs.splice(lastC, 0, c);\n\t}", "title": "" }, { "docid": "6feb2af880f7d758f61e71c8873fba2e", "score": "0.5032638", "text": "function formatArgs(args) {\n\t\targs[0] = (this.useColors ? '%c' : '') +\n\t\t\tthis.namespace +\n\t\t\t(this.useColors ? ' %c' : ' ') +\n\t\t\targs[0] +\n\t\t\t(this.useColors ? '%c ' : ' ') +\n\t\t\t'+' + module.exports.humanize(this.diff);\n\n\t\tif (!this.useColors) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst c = 'color: ' + this.color;\n\t\targs.splice(1, 0, c, 'color: inherit');\n\n\t\t// The final \"%c\" is somewhat tricky, because there could be other\n\t\t// arguments passed either before or after the %c, so we need to\n\t\t// figure out the correct index to insert the CSS into\n\t\tlet index = 0;\n\t\tlet lastC = 0;\n\t\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\t\tif (match === '%%') {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tindex++;\n\t\t\tif (match === '%c') {\n\t\t\t\t// We only are interested in the *last* %c\n\t\t\t\t// (the user may have provided their own)\n\t\t\t\tlastC = index;\n\t\t\t}\n\t\t});\n\n\t\targs.splice(lastC, 0, c);\n\t}", "title": "" }, { "docid": "6feb2af880f7d758f61e71c8873fba2e", "score": "0.5032638", "text": "function formatArgs(args) {\n\t\targs[0] = (this.useColors ? '%c' : '') +\n\t\t\tthis.namespace +\n\t\t\t(this.useColors ? ' %c' : ' ') +\n\t\t\targs[0] +\n\t\t\t(this.useColors ? '%c ' : ' ') +\n\t\t\t'+' + module.exports.humanize(this.diff);\n\n\t\tif (!this.useColors) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst c = 'color: ' + this.color;\n\t\targs.splice(1, 0, c, 'color: inherit');\n\n\t\t// The final \"%c\" is somewhat tricky, because there could be other\n\t\t// arguments passed either before or after the %c, so we need to\n\t\t// figure out the correct index to insert the CSS into\n\t\tlet index = 0;\n\t\tlet lastC = 0;\n\t\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\t\tif (match === '%%') {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tindex++;\n\t\t\tif (match === '%c') {\n\t\t\t\t// We only are interested in the *last* %c\n\t\t\t\t// (the user may have provided their own)\n\t\t\t\tlastC = index;\n\t\t\t}\n\t\t});\n\n\t\targs.splice(lastC, 0, c);\n\t}", "title": "" }, { "docid": "37edac6ee362cc7949d62ffa82a3763e", "score": "0.50308836", "text": "function fmt(t) {\r\n //applied class to the current line\r\n let fma = '';\r\n let fml = t.length;\r\n\r\n //fmr: return value\r\n let fmr = '';\r\n\r\n //fmo: open span counter\r\n let fmo = 0;\r\n let fmp = true;\r\n\r\n /*@2.1 start*/\r\n //fcom: indicates whenever a line have a block comment\r\n let fcom = false;\r\n /*@2.1 end*/\r\n\r\n //prf contains class names\r\n /* 0 1 2 3 4 5*/\r\n //var prf = ['class=\"b_ei_opc\"', 'class=\"b_ei_opd\"', 'class=\"b_ei_opk\"', 'class=\"b_ei_opt\"', 'class=\"b_ei_opT\"', 'class=\"b_ei_opy\"'];\r\n if (mc == 'b_ei_gral') {\r\n //is main class gral code?\r\n if (opc) {\r\n //are we on a doc block (/**)?\r\n fma = prf[0];\r\n fmo++;\r\n } else if (opd) {\r\n //are we on a comment block (/*)?\r\n fma = prf[1];\r\n fmo++;\r\n }\r\n }\r\n\r\n //I guess this was a To Do, as opt and opT are always false\r\n /*if (opt) {\r\n fma = prf[3];\r\n fmo++;\r\n } else if (opT) {\r\n fma = prf[4];\r\n fmo++;\r\n }*/\r\n\r\n //Search for specific \"hilite\" lines\r\n let fmh = t.split('[hilite]');\r\n\r\n if (fmh.length == 2) {\r\n //if the line starts with \"hilite\", we add specific style then end (do not treat the line)\r\n return '<span class=\"b_ei_hilite\">' + fmh.join('') + '</span>';\r\n }\r\n\r\n //create the main span with fma\r\n fmr = '<span ' + fma + '>';\r\n\r\n //iterate for each char on the line\r\n for (fmi = 0; fmi < fml; fmi++) {\r\n fmx = t.charAt(fmi);\r\n\r\n //specific block checkin for \"gral\" coding\r\n if (mc == 'b_ei_gral') {\r\n if (t.substring(fmi, (opX.length + fmi)) == opX && (!opd)) {\r\n /* We are on a doc block (/**).\r\n * \r\n * This only happens on \"gral\", as \"cobol\", \"net\", and \"sql\" have\r\n * no block comment (have to comment each line.\r\n */\r\n\r\n //toggle on the documentation switch\r\n opd = true;\r\n\r\n //create dedicated span\r\n fmr += '<span ' + prf[1] + '>';\r\n\r\n //increase span counter\r\n fmo++;\r\n\r\n /*@2.1 start*/\r\n fcom = true;\r\n /*@2.1 end*/\r\n } else if (t.substring(fmi, (opx.length + fmi)) == opx && (!opc)) {\r\n /* We are on a comment block (/*).\r\n * \r\n * This only happens on \"gral\", as \"cobol\", \"net\", and \"sql\" have\r\n * no block comment (have to comment each line.\r\n */\r\n opc = true;\r\n fmr += '<span ' + prf[0] + '>';\r\n fmo++;\r\n\r\n /*@2.1 start*/\r\n fcom = true;\r\n /*@2.1 end*/\r\n } else if (t.substring(fmi, (ops.length + fmi)) == ops) {\r\n /* We are on a closing doc/comment block (* /).\r\n * \r\n * This only happens on \"gral\", as \"cobol\", \"net\", and \"sql\" have\r\n * no block comment (have to comment each line.\r\n */\r\n opd = false;\r\n opc = false;\r\n fmr += ops + '</span>';\r\n fmo--;\r\n fmp = false;\r\n }\r\n\r\n //I guess this is another To Do, as opi and opk are merely informational here\r\n //I think I putted this to do a (+) function to collapse code maybe?\r\n if (fmx == '{') {\r\n /* We are on a opening function block ({).\r\n * \r\n * This only happens on \"gral\", as \"cobol\", \"net\", and \"sql\" have\r\n * no block comment (have to comment each line.\r\n */\r\n opi++;\r\n\r\n //we indicate that we are on a new identation block\r\n opk[opi] = true;\r\n } else if (fmx == '}') {\r\n /* We are on a closing function block ({).\r\n * \r\n * This only happens on \"gral\", as \"cobol\", \"net\", and \"sql\" have\r\n * no block comment (have to comment each line.\r\n */\r\n\r\n //we indicate that we are exiting the identation block\r\n opk[opi] = false;\r\n opi--;\r\n }\r\n }\r\n\r\n //are we on a commented line?\r\n if (t.substring(fmi, (opy.length + fmi)) == opy) {\r\n if (opc || opd) {} else {\r\n //only apply comment color if we're not on a comment/doc block\r\n fmr += '<span ' + prf[5] + '>';\r\n fmo++;\r\n }\r\n }\r\n\r\n //if we're not on a closing comment/doc block, add the char, as we already putted it out\r\n if (fmp) {\r\n fmr += fmx;\r\n }\r\n }\r\n\r\n //for each opened span, add a closing span\r\n for (fmi = 0; fmi < fmo; fmi++) {\r\n fmr += '</span>';\r\n }\r\n\r\n //ending treatment for html coherence\r\n if (fmo <= 0) {\r\n //to indicate the quote char, we use ~\"text~\" or ~'text~'\r\n\r\n //get all pieces for double quotted text\r\n fmS = fmr.split('~\"');\r\n fmSi = fmS.length;\r\n\r\n //fmSS: final text\r\n fmSS = fmS[0];\r\n\r\n //for each piece of text\r\n for (fmi = 1; fmi < fmSi; fmi++) {\r\n if (fmi % 2 == 1) {\r\n //fmi is odd, that means we put the \"opening\" quote and start a text span\r\n fmSS += \"\\\"<span \" + prf[3] + \">\" + fmS[fmi];\r\n } else {\r\n //fmi is even. We close the text span and put the \"ending\" quote\r\n fmSS += \"</span>\\\"\" + fmS[fmi];\r\n }\r\n }\r\n\r\n //we repeat the same operation for simple quoted text\r\n fmS = fmSS.split(\"~'\");\r\n fmSi = fmS.length;\r\n fmSS = fmS[0];\r\n\r\n for (fmi = 1; fmi < fmSi; fmi++) {\r\n if (fmi % 2 == 1) {\r\n fmSS += '\\'<span ' + prf[4] + '>' + fmS[fmi];\r\n } else {\r\n fmSS += '</span>\\'' + fmS[fmi];\r\n }\r\n }\r\n\r\n //override fmr with fmSS\r\n fmr = fmSS;\r\n\r\n //add span for reserved words (prn / ptr)\r\n /*@2.1 start*/\r\n //fcom = false means we're not on a comment block\r\n if (fcom === false) {\r\n /*@2.1 end*/\r\n for (fmi = 0; fmi < prnI; fmi++) {\r\n //xxx: reserved word\r\n //yyy: associated class\r\n\r\n //replace \" xxx \" by \" <span class=\"yyy\">xxx</span> \"\r\n fmr = replaceAll(fmr, '&nbsp;' + prn[fmi] + '&nbsp;', '&nbsp;<span class=\"' + prt[fmi] + '\">' + prn[fmi] + '</span>&nbsp;');\r\n\r\n //replace \"xxx \" by \"<span class=\"yyy\">xxx</span> \"\r\n fmr = replaceAll(fmr, prn[fmi] + '&nbsp;', '<span class=\"' + prt[fmi] + '\">' + prn[fmi] + '</span>&nbsp;');\r\n\r\n //replace \" xxx\" by \" <span class=\"yyy\">xxx</span>\"\r\n fmr = replaceAll(fmr, '&nbsp;' + prn[fmi], '&nbsp;<span class=\"' + prt[fmi] + '\">' + prn[fmi] + '</span>');\r\n\r\n //replace \".\" by \"<span class=\"yyy\">.</span> \" --> This is just for COBOL\r\n fmr = replaceAll(fmr, '.' + prn[fmi], '.<span class=\"' + prt[fmi] + '\">' + prn[fmi] + '</span>');\r\n }\r\n /*@2.1 start*/\r\n }\r\n /*@2.1 end*/\r\n }\r\n\r\n //return\r\n return fmr;\r\n}", "title": "" }, { "docid": "9f106bf772d37e9e2918b064db9d1775", "score": "0.5027674", "text": "function checkNewLineError() {\n return {\n code: formatCode(\n 'a()',\n ' .b().c;'\n ),\n errors: [\n {\n message: 'Identifier \"c\" should be on a new line',\n type: 'Identifier',\n },\n ],\n output: formatCode(\n 'a()',\n ' .b()',\n ' .c;'\n ),\n };\n}", "title": "" }, { "docid": "f1b2e1290be3ecef6a00de896d71c74c", "score": "0.50170547", "text": "function formatArgs(args) {\n \targs[0] = (this.useColors ? '%c' : '') +\n \t\tthis.namespace +\n \t\t(this.useColors ? ' %c' : ' ') +\n \t\targs[0] +\n \t\t(this.useColors ? '%c ' : ' ') +\n \t\t'+' + module.exports.humanize(this.diff);\n\n \tif (!this.useColors) {\n \t\treturn;\n \t}\n\n \tconst c = 'color: ' + this.color;\n \targs.splice(1, 0, c, 'color: inherit');\n\n \t// The final \"%c\" is somewhat tricky, because there could be other\n \t// arguments passed either before or after the %c, so we need to\n \t// figure out the correct index to insert the CSS into\n \tlet index = 0;\n \tlet lastC = 0;\n \targs[0].replace(/%[a-zA-Z%]/g, match => {\n \t\tif (match === '%%') {\n \t\t\treturn;\n \t\t}\n \t\tindex++;\n \t\tif (match === '%c') {\n \t\t\t// We only are interested in the *last* %c\n \t\t\t// (the user may have provided their own)\n \t\t\tlastC = index;\n \t\t}\n \t});\n\n \targs.splice(lastC, 0, c);\n }", "title": "" }, { "docid": "ba70d2c6303a112f9c17804d98fc2eab", "score": "0.50144666", "text": "function IpadicFormatter() {\n}", "title": "" }, { "docid": "8bf9ecae39f5c0f3deb09b3592c00b5c", "score": "0.4994763", "text": "function formatArgs(args) {\n args[0] = (this.useColors ? \"%c\" : \"\") + this.namespace + (this.useColors ? \" %c\" : \" \") + args[0] + (this.useColors ? \"%c \" : \" \") + \"+\" + module.exports.humanize(this.diff);\n if (!this.useColors) return;\n const c = \"color: \" + this.color;\n args.splice(1, 0, c, \"color: inherit\");\n // The final \"%c\" is somewhat tricky, because there could be other\n // arguments passed either before or after the %c, so we need to\n // figure out the correct index to insert the CSS into\n let index = 0;\n let lastC = 0;\n args[0].replace(/%[a-zA-Z%]/g, (match)=>{\n if (match === \"%%\") return;\n index++;\n if (match === \"%c\") // We only are interested in the *last* %c\n // (the user may have provided their own)\n lastC = index;\n });\n args.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "6288612eb7b49b9154040c0c597fe889", "score": "0.49936137", "text": "function formatArgs(args) {\n args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);\n\n if (!this.useColors) {\n return;\n }\n\n var c = 'color: ' + this.color;\n args.splice(1, 0, c, 'color: inherit'); // The final \"%c\" is somewhat tricky, because there could be other\n // arguments passed either before or after the %c, so we need to\n // figure out the correct index to insert the CSS into\n\n var index = 0;\n var lastC = 0;\n args[0].replace(/%[a-zA-Z%]/g, function (match) {\n if (match === '%%') {\n return;\n }\n\n index++;\n\n if (match === '%c') {\n // We only are interested in the *last* %c\n // (the user may have provided their own)\n lastC = index;\n }\n });\n args.splice(lastC, 0, c);\n }", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "d0b8f953e2fb0116895f838e0d4566c4", "score": "0.49922583", "text": "function formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}", "title": "" }, { "docid": "94e5015a98ff9db22e3061fc690b3fc1", "score": "0.49912748", "text": "function formatArgs(args) {\n args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);\n\n if (!this.useColors) {\n return;\n }\n\n var c = 'color: ' + this.color;\n args.splice(1, 0, c, 'color: inherit'); // The final \"%c\" is somewhat tricky, because there could be other\n // arguments passed either before or after the %c, so we need to\n // figure out the correct index to insert the CSS into\n\n var index = 0;\n var lastC = 0;\n args[0].replace(/%[a-zA-Z%]/g, function (match) {\n if (match === '%%') {\n return;\n }\n\n index++;\n\n if (match === '%c') {\n // We only are interested in the *last* %c\n // (the user may have provided their own)\n lastC = index;\n }\n });\n args.splice(lastC, 0, c);\n }", "title": "" }, { "docid": "9eaa1edd9a58ce6ac52afb9aa5d04658", "score": "0.49856505", "text": "function formatArgs(args) {\n \tconst {namespace: name, useColors} = this;\n\n \tif (useColors) {\n \t\tconst c = this.color;\n \t\tconst colorCode = '\\u001B[3' + (c < 8 ? c : '8;5;' + c);\n \t\tconst prefix = ` ${colorCode};1m${name} \\u001B[0m`;\n\n \t\targs[0] = prefix + args[0].split('\\n').join('\\n' + prefix);\n \t\targs.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\\u001B[0m');\n \t} else {\n \t\targs[0] = getDate() + name + ' ' + args[0];\n \t}\n }", "title": "" }, { "docid": "0c237c17c891aef20b02674ced81cdcd", "score": "0.49834386", "text": "function formatArgs(A){var e=this.useColors;if(A[0]=(e?\"%c\":\"\")+this.namespace+(e?\" %c\":\" \")+A[0]+(e?\"%c \":\" \")+\"+\"+t.humanize(this.diff),e){var n=\"color: \"+this.color;A.splice(1,0,n,\"color: inherit\");\n// the final \"%c\" is somewhat tricky, because there could be other\n// arguments passed either before or after the %c, so we need to\n// figure out the correct index to insert the CSS into\nvar i=0,o=0;A[0].replace(/%[a-zA-Z%]/g,function(A){\"%%\"!==A&&(i++,\"%c\"===A&&(\n// we only are interested in the *last* %c\n// (the user may have provided their own)\no=i))}),A.splice(o,0,n)}}", "title": "" }, { "docid": "a1fd52e9be364dde4eb8d27563c11e15", "score": "0.49817696", "text": "function customPrototype() {\r\n\t\t\tString.prototype.format = function(replace) {\r\n\t\t\t\tvar string = this;\r\n\t\t\t\tfor (var key in replace) {\r\n\t\t\t\t\tstring = string.replace(new RegExp(\"\\\\{\" + key + \"\\\\}\", \"g\"), replace[key]);\r\n\t\t\t\t}\r\n\t\t\t\treturn string;\r\n\t\t\t}\r\n\r\n\t\t\tString.prototype.toSentenceCase = function() {\r\n\t\t\t\treturn this.toLowerCase().replace(/^(.)|\\s(.)/g, function(char) { return char.toUpperCase(); });\r\n\t\t\t}\r\n\t\t}", "title": "" }, { "docid": "1ba47e605a498936f0a40a92b799cedb", "score": "0.49811363", "text": "function formatColor (msg, caller, stack) {\n\t var formatted = '\\x1b[36;1m' + this._namespace + '\\x1b[22;39m' + // bold cyan\n\t ' \\x1b[33;1mdeprecated\\x1b[22;39m' + // bold yellow\n\t ' \\x1b[0m' + msg + '\\x1b[39m' // reset\n\n\t // add stack trace\n\t if (this._traced) {\n\t for (var i = 0; i < stack.length; i++) {\n\t formatted += '\\n \\x1b[36mat ' + callSiteToString(stack[i]) + '\\x1b[39m' // cyan\n\t }\n\n\t return formatted\n\t }\n\n\t if (caller) {\n\t formatted += ' \\x1b[36m' + formatLocation(caller) + '\\x1b[39m' // cyan\n\t }\n\n\t return formatted\n\t}", "title": "" }, { "docid": "1ba47e605a498936f0a40a92b799cedb", "score": "0.49811363", "text": "function formatColor (msg, caller, stack) {\n\t var formatted = '\\x1b[36;1m' + this._namespace + '\\x1b[22;39m' + // bold cyan\n\t ' \\x1b[33;1mdeprecated\\x1b[22;39m' + // bold yellow\n\t ' \\x1b[0m' + msg + '\\x1b[39m' // reset\n\n\t // add stack trace\n\t if (this._traced) {\n\t for (var i = 0; i < stack.length; i++) {\n\t formatted += '\\n \\x1b[36mat ' + callSiteToString(stack[i]) + '\\x1b[39m' // cyan\n\t }\n\n\t return formatted\n\t }\n\n\t if (caller) {\n\t formatted += ' \\x1b[36m' + formatLocation(caller) + '\\x1b[39m' // cyan\n\t }\n\n\t return formatted\n\t}", "title": "" }, { "docid": "8b3b067d16c13eb459bc3930151aa9a0", "score": "0.49795294", "text": "function formatArgs(args) {\n args[0] =\n (this.useColors ? \"%c\" : \"\") +\n this.namespace +\n (this.useColors ? \" %c\" : \" \") +\n args[0] +\n (this.useColors ? \"%c \" : \" \") +\n \"+\" +\n module.exports.humanize(this.diff);\n\n if (!this.useColors) {\n return;\n }\n\n var c = \"color: \" + this.color;\n args.splice(1, 0, c, \"color: inherit\"); // The final \"%c\" is somewhat tricky, because there could be other\n // arguments passed either before or after the %c, so we need to\n // figure out the correct index to insert the CSS into\n\n var index = 0;\n var lastC = 0;\n args[0].replace(/%[a-zA-Z%]/g, function (match) {\n if (match === \"%%\") {\n return;\n }\n\n index++;\n\n if (match === \"%c\") {\n // We only are interested in the *last* %c\n // (the user may have provided their own)\n lastC = index;\n }\n });\n args.splice(lastC, 0, c);\n }", "title": "" }, { "docid": "231b51dbfef9da8c489cce84c60c781d", "score": "0.49770975", "text": "function line(str) {\n code.push(' ' + (str || ''));\n }", "title": "" }, { "docid": "231b51dbfef9da8c489cce84c60c781d", "score": "0.49770975", "text": "function line(str) {\n code.push(' ' + (str || ''));\n }", "title": "" }, { "docid": "2c3774fd8e8a201813571e2da3a1348b", "score": "0.49755114", "text": "function formatColor (msg, caller, stack) {\n var formatted = '\\x1b[36;1m' + this._namespace + '\\x1b[22;39m' + // bold cyan\n ' \\x1b[33;1mdeprecated\\x1b[22;39m' + // bold yellow\n ' \\x1b[0m' + msg + '\\x1b[39m' // reset\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n \\x1b[36mat ' + callSiteToString(stack[i]) + '\\x1b[39m' // cyan\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' \\x1b[36m' + formatLocation(caller) + '\\x1b[39m' // cyan\n }\n\n return formatted\n}", "title": "" }, { "docid": "2c3774fd8e8a201813571e2da3a1348b", "score": "0.49755114", "text": "function formatColor (msg, caller, stack) {\n var formatted = '\\x1b[36;1m' + this._namespace + '\\x1b[22;39m' + // bold cyan\n ' \\x1b[33;1mdeprecated\\x1b[22;39m' + // bold yellow\n ' \\x1b[0m' + msg + '\\x1b[39m' // reset\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n \\x1b[36mat ' + callSiteToString(stack[i]) + '\\x1b[39m' // cyan\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' \\x1b[36m' + formatLocation(caller) + '\\x1b[39m' // cyan\n }\n\n return formatted\n}", "title": "" } ]
ef12030402b5dd9b1469561a6c5232ac
comment me... document me... Copy from oltk, because it's very nice. To determine the current state of HTTP
[ { "docid": "b1d195023932b1fcea22aa82921ce2f4", "score": "0.0", "text": "function __isDocumentOk(http) {\n\tvar stat = http.status || 0;\n\treturn ( (stat >= 200) && (stat < 300) ) || // allow any 2XX response code\n\t\t(stat == 304) || // get it out of the cache\n\t\t(stat == 1223) || // IE mangled the status code\n\t\t(!stat && (location.protocol == 'file:' || location.protocol == 'chrome:'));\n}", "title": "" } ]
[ { "docid": "c7609c8c79a21ee6f9d4ebdf0dae1e20", "score": "0.64754546", "text": "function newstatHTTP(keyname, NewState, httpType) {\n \n //Zeitstempel erstellen\n var timeStamp = Utilities.formatDate(new Date(),Session.getScriptTimeZone() , 'dd.MM.yyyy HH:mm:ss'); \n //Neuen Status setzen\n if (ChangeState(keyname, NewState) == 0) {return 0;};\n \n //Loggen uns Status setzen je nach HTTP-Typ\n if (httpType == 'GET') {\n LogfileRaw(keyname, NewState, timeStamp, 'by HTTP-GET'); \n STATE |= STATE_NEWHTTPGET; \n }\n if (httpType == 'POST') {\n LogfileRaw(keyname, NewState, timeStamp, 'by HTTP-POST'); \n STATE |= STATE_NEWHTTPPOST;\n }\n return 1;\n}", "title": "" }, { "docid": "32f2facf894f64d1792d7e308da73575", "score": "0.63500285", "text": "function requestStatus(http){\n\tif(http.readyState != 4){return false;}\n\tif(http.status == 200){return true;}\n\telse {return false;}\n}", "title": "" }, { "docid": "0580f470f5bd51da7f94a1e80f6be5b5", "score": "0.60161555", "text": "get state() {\n if (!this.conn) return 0;\n return this.conn.readyState;\n }", "title": "" }, { "docid": "2a791728d5a80acdc64f7edcf6aa85c8", "score": "0.5957545", "text": "function state() {\n var requests = [\n { url: \"/photos\", status: \"complete\" },\n { url: \"/albums\", status: \"pending\" },\n { url: \"/users\", status: \"failed\" }\n ];\n\n var inProgress = requests.some(function(request) {\n return request.status === \"pending\";\n });\n}", "title": "" }, { "docid": "3ad5e8d3aef9f3eb552db1bce1984ef9", "score": "0.59572846", "text": "static getStatusFromURL(url) {\n const vars = AuthController.getQueryParamsFromURL(url);\n //TODO check validity of status\n return vars.prYvstatus;\n }", "title": "" }, { "docid": "5be8acdc11d53eb5e20432f765c06539", "score": "0.59531313", "text": "function checkState(request) { return (request.readyState == 4); }", "title": "" }, { "docid": "2669e02afc8020513894b86de455bb9a", "score": "0.5944611", "text": "getState() {}", "title": "" }, { "docid": "8ff6e5d6eb86f4448592c4e9cec0297e", "score": "0.59344286", "text": "function AJAX_isCallInProgress(http)\r\n{\r\n switch (http.readyState)\r\n {\r\n case 1:\r\n case 2:\r\n case 3:\r\n return true;\r\n break;\r\n }\r\n\r\n return false;\r\n}", "title": "" }, { "docid": "3b05e955fb03441b57e651b61f4aa01a", "score": "0.59013957", "text": "status() {\n return apacheCore.status();\n }", "title": "" }, { "docid": "9b17eefbda5e762906ee99beb05d7837", "score": "0.5876131", "text": "getStatus() {\n return this._request('/status', {});\n }", "title": "" }, { "docid": "dae046739dfd06a6a3d327cc904d0233", "score": "0.5809073", "text": "function requestTextState(elm)\n {\n logDebug(\"requestTextState: \", elm.request, \", \", elm.source) ;\n if ( elm.source )\n {\n var def = doTimedXMLHttpRequest(elm.source, pollerTimeout) ;\n def.addBoth(updateTextStatus, elm) ;\n }\n else\n {\n logError(\"requestTextState (nop source)\") ;\n }\n return ;\n }", "title": "" }, { "docid": "d725bb2b138eee0fbcb57b4db61b8ba5", "score": "0.5789069", "text": "function checkState(request) { return (request.readyState == request.DONE); }", "title": "" }, { "docid": "cdbd146baa92067c42204564d6f8b760", "score": "0.5775533", "text": "function stateChanged() {\n if (xhr.readyState == 4 && xhr.status == 200 ){\n\tvar result = xhr.responseText; // Get the reponse text\n }\n}", "title": "" }, { "docid": "7f0a3aae39630503e5dbf62e688df7fb", "score": "0.576883", "text": "function getStatus() {\n\tif (!charles_proxy) {\n\t\tif (!isDone) {\n\t\t\tif (isGettingTimings) {\n\t\t\t\tif (!tracker_parsing_mode)\n\t\t\t\t\treturn 'timings';\n\t\t\t\telse\n\t\t\t\t\treturn 'trackers';\n\t\t\t} else {\n\t\t\t\treturn 'begin';\n\t\t\t}\n\t\t} else {\n\t\t\treturn 'done';\n\t\t}\n\t}\n\n\tif (charles_proxy) {\n\n\t\treturn 'charles'\n\t}\n}", "title": "" }, { "docid": "aa8e548a01e41277c92302c4d80ed28d", "score": "0.5741412", "text": "function xhrReadyStateChange()\r\n{\r\n console.log('readyState: ' + xhr.readyState);\r\n}", "title": "" }, { "docid": "89cb6d5c81a81d55663e3490d9bfc39e", "score": "0.567086", "text": "function getState() {\n //console.log(`GET ${HEART_URL}...`);\n request\n .get(HEART_URL, { timeout: TIMEOUT })\n .on('response', (response) => {\n console.log(`Received status code: ${response.statusCode}`);\n sendState(response.statusCode < 400 ? 'alive' : 'dead');\n })\n .on('error', (err) => {\n console.log(err);\n sendState('dead');\n });\n}", "title": "" }, { "docid": "ca031b964ec678575567525c99b4825a", "score": "0.56641024", "text": "static get REQUESTINFO() { return \"REQUESTINFO\" }", "title": "" }, { "docid": "885724880a8a719d2a31c83139982f10", "score": "0.56282544", "text": "function srvTime() {\n try {\n xmlHttp = new XMLHttpRequest();\n } catch (err1) {\n try {\n xmlHttp = new ActiveXObject(\"Msxml2.XMLHTTP\");\n } catch (err2) {\n try {\n xmlHttp = new ActiveXObject(\"Microsoft.XMLHTTP\");\n } catch (err3) {\n console.warn(\"AJAX not supported\");\n }\n }\n }\n xmlHttp.open(\"HEAD\", window.location.href.toString(), false);\n xmlHttp.setRequestHeader(\"Content-Type\", \"text/html\");\n xmlHttp.send(\"\");\n return xmlHttp.getResponseHeader(\"Date\");\n}", "title": "" }, { "docid": "cdb0cd441bc96435e3daccc34d18a87c", "score": "0.56049067", "text": "function _getState(){\n\n }", "title": "" }, { "docid": "a7bdc27d0a6125ae828ce7b8a24226e4", "score": "0.5461305", "text": "async getFullStatus() {\n const result = await this._request('/status', {}, null, true);\n if (result === null) {\n throw new Error('false');\n } else {\n return result;\n }\n }", "title": "" }, { "docid": "b35c4fe687e8eaae3253ed55f5de863e", "score": "0.5457036", "text": "function callInProgress (xmlhttp) { \r\n\tswitch (xmlhttp.readyState) {\r\n\t\tcase 1: case 2: case 3:\r\n\t\t\treturn true;\r\n\t\t\tbreak;\r\n\t\t// Case 4 and 0\r\n\t\tdefault:\r\n\t\t\treturn false;\r\n\t\t\tbreak;\r\n\t}\r\n}", "title": "" }, { "docid": "440ee93c377b108bb79e570257f0d881", "score": "0.54451", "text": "function getState() {\n if (debug) fct.printLog(`Current state: ${auth_state.state}.`);\n return auth_state.state;\n}", "title": "" }, { "docid": "b267520f69e2cd4e2bc76a8cc3e60116", "score": "0.5444224", "text": "function successfulRequest(request) {\n return request.readyState === 4 && request.status == 200;\n}", "title": "" }, { "docid": "3c14b613d3831c26158ab7d9d59b4074", "score": "0.5433814", "text": "static get STATUS() {\n return 0;\n }", "title": "" }, { "docid": "98d35af43d4e5e7d7de2e3e0fb26c852", "score": "0.5432452", "text": "function checkState() {\r\n try {\r\n var state = getDoc(io).readyState;\r\n log('state = ' + state);\r\n if (state && state.toLowerCase() == 'uninitialized')\r\n setTimeout(checkState,50);\r\n }\r\n catch(e) {\r\n log('Server abort: ' , e, ' (', e.name, ')');\r\n cb(SERVER_ABORT);\r\n if (timeoutHandle)\r\n clearTimeout(timeoutHandle);\r\n timeoutHandle = undefined;\r\n }\r\n }", "title": "" }, { "docid": "2b911f2adba9e83811bc32e1067a6a42", "score": "0.5412921", "text": "getStatus() {\n\t \treturn this.status;\n\t }", "title": "" }, { "docid": "2b911f2adba9e83811bc32e1067a6a42", "score": "0.54125905", "text": "getStatus() {\n\t \treturn this.status;\n\t }", "title": "" }, { "docid": "2b911f2adba9e83811bc32e1067a6a42", "score": "0.54125905", "text": "getStatus() {\n\t \treturn this.status;\n\t }", "title": "" }, { "docid": "2b911f2adba9e83811bc32e1067a6a42", "score": "0.54125905", "text": "getStatus() {\n\t \treturn this.status;\n\t }", "title": "" }, { "docid": "2b911f2adba9e83811bc32e1067a6a42", "score": "0.54125905", "text": "getStatus() {\n\t \treturn this.status;\n\t }", "title": "" }, { "docid": "2b911f2adba9e83811bc32e1067a6a42", "score": "0.54125905", "text": "getStatus() {\n\t \treturn this.status;\n\t }", "title": "" }, { "docid": "fdf1ef3ffc55fec1d95726ce4208f627", "score": "0.5410372", "text": "function state_request()\n{\n // Remove previous timer object.\n state_timer = null;\n\n // Get current request flags and parameters.\n var flags = state_get_flags();\n var params = state_get_params();\n\n DebugConsole.debug(9, null, \"state_request(): flags: \" + \n dump(flags) + \" params: \" + dump(params));\n\n if (flags > 0)\n {\n DebugConsole.debug(9, null, \"Doing a state request with flags '\" + flags + \"'.\");\n\n // Do the request now.\n // (one-time flags and parameters will be reset only in the success handler)\n var req_dict = { version: state_version, req_id:++state_req_id, req_flags:flags, req_params:params };\n var req_json = Object.toJSON(req_dict);\n \n /* Unlike Rails, Pylons doesn't know how to interpret nested paramters to build the request.params dictionary correctly, so the best way is to jsonify/dejosinfy the nested get params.\n * However, do not just encode the JSON string and append it to the url, instead, pass it as the 'parameters' argument of Ajax.request, \n * which will call the smart Object.toQueryString and will encode it appropriately.\n */\n \n // Send the request.\n var url = get_url_path('teambox_updater') + \"/\" + kws_id;\n DebugConsole.debug(7, null, \"State request url: '\" + url + \"'.\");\n new KAjax('updater').jsonRequest(url, {state_request:req_json},\n state_request_success, state_request_failure);\n }\n else\n {\n DebugConsole.debug(9, null, \"Postponing state request.\");\n // Postpone the request.\n state_restart_loop();\n }\n}", "title": "" }, { "docid": "e8a115544e9edbd9c50cec09e2c818e9", "score": "0.5403609", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "e8a115544e9edbd9c50cec09e2c818e9", "score": "0.5403609", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "e8a115544e9edbd9c50cec09e2c818e9", "score": "0.5403609", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "e8a115544e9edbd9c50cec09e2c818e9", "score": "0.5403609", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "e8a115544e9edbd9c50cec09e2c818e9", "score": "0.5403609", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "e8a115544e9edbd9c50cec09e2c818e9", "score": "0.5403609", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "e8a115544e9edbd9c50cec09e2c818e9", "score": "0.5403609", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "e8a115544e9edbd9c50cec09e2c818e9", "score": "0.5403609", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "e8a115544e9edbd9c50cec09e2c818e9", "score": "0.5403609", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "e8a115544e9edbd9c50cec09e2c818e9", "score": "0.5403609", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "e8a115544e9edbd9c50cec09e2c818e9", "score": "0.5403609", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "8b5736e4f276e485f6e751f6aa4d8f0d", "score": "0.54032856", "text": "function checkState() {\n\t\t\t\ttry {\n\t\t\t\t\tvar state = getDoc(io).readyState;\n\t\t\t\t\tlog('state = ' + state);\n\t\t\t\t\tif (state.toLowerCase() == 'uninitialized')\n\t\t\t\t\t\tsetTimeout(checkState,50);\n\t\t\t\t}\n\t\t\t\tcatch(e) {\n\t\t\t\t\tlog('Server abort: ' , e, ' (', e.name, ')');\n\t\t\t\t\tcb(SERVER_ABORT);\n\t\t\t\t\ttimeoutHandle && clearTimeout(timeoutHandle);\n\t\t\t\t\ttimeoutHandle = undefined;\n\t\t\t\t}\n\t\t\t}", "title": "" }, { "docid": "8b5736e4f276e485f6e751f6aa4d8f0d", "score": "0.54032856", "text": "function checkState() {\n\t\t\t\ttry {\n\t\t\t\t\tvar state = getDoc(io).readyState;\n\t\t\t\t\tlog('state = ' + state);\n\t\t\t\t\tif (state.toLowerCase() == 'uninitialized')\n\t\t\t\t\t\tsetTimeout(checkState,50);\n\t\t\t\t}\n\t\t\t\tcatch(e) {\n\t\t\t\t\tlog('Server abort: ' , e, ' (', e.name, ')');\n\t\t\t\t\tcb(SERVER_ABORT);\n\t\t\t\t\ttimeoutHandle && clearTimeout(timeoutHandle);\n\t\t\t\t\ttimeoutHandle = undefined;\n\t\t\t\t}\n\t\t\t}", "title": "" }, { "docid": "8b5736e4f276e485f6e751f6aa4d8f0d", "score": "0.54032856", "text": "function checkState() {\n\t\t\t\ttry {\n\t\t\t\t\tvar state = getDoc(io).readyState;\n\t\t\t\t\tlog('state = ' + state);\n\t\t\t\t\tif (state.toLowerCase() == 'uninitialized')\n\t\t\t\t\t\tsetTimeout(checkState,50);\n\t\t\t\t}\n\t\t\t\tcatch(e) {\n\t\t\t\t\tlog('Server abort: ' , e, ' (', e.name, ')');\n\t\t\t\t\tcb(SERVER_ABORT);\n\t\t\t\t\ttimeoutHandle && clearTimeout(timeoutHandle);\n\t\t\t\t\ttimeoutHandle = undefined;\n\t\t\t\t}\n\t\t\t}", "title": "" }, { "docid": "0508ea9cf38bf735faaf10ed39097d2d", "score": "0.5400191", "text": "function checkState() {\r\n try {\r\n var state = getDoc(io).readyState;\r\n log('state = ' + state);\r\n if (state && state.toLowerCase() == 'uninitialized') {\r\n setTimeout(checkState,50);\r\n }\r\n }\r\n catch(e) {\r\n log('Server abort: ' , e, ' (', e.name, ')');\r\n cb(SERVER_ABORT);\r\n if (timeoutHandle) {\r\n clearTimeout(timeoutHandle);\r\n }\r\n timeoutHandle = undefined;\r\n }\r\n }", "title": "" }, { "docid": "4edeba246cc674ce52122684fd89e9f0", "score": "0.53932124", "text": "function getStatus(callback){\n request(FIRE_URL, function (error, response, body) {\n if(error){\n callback(false)\n return console.log('Error:', error);\n }\n\n if(response.statusCode !== 200){\n callback(false)\n return console.log('Invalid Status Code Returned:', response.statusCode);\n }\n\n var resp = JSON.parse(body); // Show the HTML for the Modulus homepage.\n callback(resp.message);\n });\n}", "title": "" }, { "docid": "e0d1b2a8604c33bd6ee3cc2ccbd27897", "score": "0.5380763", "text": "requestState() {\n this.set('isLoading', true);\n this.wsSend({\n status: 'request-state',\n sender: 'web-client'\n });\n }", "title": "" }, { "docid": "09740b521cec94f4ea88f318e68ad800", "score": "0.5380302", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "93ddfb61e379267458ffbac6e617ef5e", "score": "0.5375586", "text": "function LMSGetStatus() {\r\n // get the number of objectives, and initialize the id array, primary objectives references\r\n var n = LMSNumberOfObjectives();\r\n // get the sco and primary objectives status\r\n _cs=LMSGetValue(\"cmi.completion_status\");\r\n _ps=LMSGetValue(\"cmi.success_status\");\r\n if (_pox>=0) {\r\n _ocs=LMSGetObjective(_pox,\"completion_status\");\r\n _ops=LMSGetObjective(_pox,\"success_status\");\r\n } else {\r\n _ocs=_cs;\r\n _ops=_ps;\r\n }\r\n // sync the completed/passed local status with the (prior) objective status\r\n if (_ocs==\"completed\"||_ops==\"passed\") {\r\n if (_cs!=\"completed\") {\r\n LMSSetValue(\"cmi.completion_status\",\"completed\");\r\n _cs=\"completed\";\r\n }\r\n if (_ps!=\"passed\") {\r\n LMSSetValue(\"cmi.success_status\",\"passed\");\r\n _ps=\"passed\";\r\n }\r\n if (_ocs!=\"completed\") {\r\n LMSSetObjective(_pox,\"completion_status\",\"completed\");\r\n _ocs=\"completed\";\r\n }\r\n if (_ops!=\"passed\") {\r\n LMSSetObjective(_pox,\"success_status\",\"passed\");\r\n _ops=\"passed\";\r\n }\r\n }\r\n}", "title": "" }, { "docid": "d14401d4049d11657197a583afef9a19", "score": "0.5372903", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "d14401d4049d11657197a583afef9a19", "score": "0.5372903", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "d14401d4049d11657197a583afef9a19", "score": "0.5372903", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "d14401d4049d11657197a583afef9a19", "score": "0.5372903", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "d14401d4049d11657197a583afef9a19", "score": "0.5372903", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "d14401d4049d11657197a583afef9a19", "score": "0.5372903", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "d14401d4049d11657197a583afef9a19", "score": "0.5372903", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "d14401d4049d11657197a583afef9a19", "score": "0.5372903", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "d14401d4049d11657197a583afef9a19", "score": "0.5372903", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "924c294eaa735ce57e4c3bd701d77fcf", "score": "0.5371792", "text": "getStatus() {\n return {\n state: this.state,\n platform: this.platform,\n channel: this.channel,\n channelChanged: this.channelChanged,\n currentVersion: this.currentVersion,\n releaseNotes: this.releaseNotes,\n updateVersion: this.updateVersion,\n errorMessage: this.errorMessage,\n timestamp: this.timestamp\n };\n }", "title": "" }, { "docid": "bd7080dd76ab6daa541b0e925da43b48", "score": "0.53707474", "text": "function fillHTTPStatus(response) { \n\tvar protocolElement = document.getElementById('protocolElement');\n\tif (response != null && response.protocol != null) {\n\t\tif (0 == response.protocol.localeCompare(\"https:\")) {\n\t\t\tprotocolElement.innerHTML = \"HTTP Status: This website is secure by SSL TLS\";\n\t\t} else if (0 == response.protocol.localeCompare(\"http:\")){\n\t\t\tprotocolElement.innerHTML = \"HTTP Status: This webiste is not secure by SSL TLS\";\n\t\t} else {\n\t\t\tprotocolElement.innerHTML = \"HTTP Status: N/A\";\n\t\t}\n\t} else {\n\t\t// error handling\n\t\tprotocolElement.innerHTML = \"HTTP Status: N/A\";\n\t}\n}", "title": "" }, { "docid": "4735ccdd1635865b023e130d66e0a0a3", "score": "0.53688467", "text": "function checkState() {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar state = getDoc(io).readyState;\n\t\t\t\t\t\tlog('state = ' + state);\n\t\t\t\t\t\tif (state && state.toLowerCase() == 'uninitialized')\n\t\t\t\t\t\t\tsetTimeout(checkState, 50);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tlog('Server abort: ', e, ' (', e.name, ')');\n\t\t\t\t\t\tcb(SERVER_ABORT);\n\t\t\t\t\t\tif (timeoutHandle)\n\t\t\t\t\t\t\tclearTimeout(timeoutHandle);\n\t\t\t\t\t\ttimeoutHandle = undefined;\n\t\t\t\t\t}\n\t\t\t\t}", "title": "" }, { "docid": "5ca0220bd9a47580603a2a04b1b425e6", "score": "0.5364464", "text": "function getStatus () // string\n{\n if (typeof (plhandler) === 'undefined' || plhandler === null)\n return \"STATUS,-1,Initializing\";\n else\n return plhandler.GetStatus();\n}", "title": "" }, { "docid": "198fece71184ceb752c5ea641a2c571b", "score": "0.535505", "text": "getState() {\n return this._platformLocation.getState();\n }", "title": "" }, { "docid": "198fece71184ceb752c5ea641a2c571b", "score": "0.535505", "text": "getState() {\n return this._platformLocation.getState();\n }", "title": "" }, { "docid": "198fece71184ceb752c5ea641a2c571b", "score": "0.535505", "text": "getState() {\n return this._platformLocation.getState();\n }", "title": "" }, { "docid": "198fece71184ceb752c5ea641a2c571b", "score": "0.535505", "text": "getState() {\n return this._platformLocation.getState();\n }", "title": "" }, { "docid": "dc7d41f99dd461f6f431eaee4fe25671", "score": "0.534809", "text": "get ok() {\n\t\treturn this[INTERNALS$2].status >= 200 && this[INTERNALS$2].status < 300;\n\t}", "title": "" }, { "docid": "a5034812118651690725f537839290b0", "score": "0.5346892", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "654d0ddbb676ae2c885ee5b6a350d69c", "score": "0.5345624", "text": "function getProgress() {\n /* continue only if request is finished and response is ready (state 4) */\n var done = 4, ok = 200;\n if ((http.readyState == done) && (http.status == ok)) {\n\t/* server response (return value from function)\n\t is returned as a JSON string */\n\tresponse = parseInt(http.responseText);\n\n\t/* check on status (could be used to update progress checklist) */\n\tif (response == 0) {\n\t setTimeout(function(){sendRequest()},5000);\n\t} else {\n\t /* redirect to homepage, as backend was reachable */\n\t location.replace( fullHomeLocation );\n\t}\n }\n}", "title": "" }, { "docid": "c1b654ac5cda00f4efb37260d673183b", "score": "0.53419167", "text": "function checkState() {\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tvar state = getDoc(io).readyState;\r\n\t\t\t\t\t\tlog('state = ' + state);\r\n\t\t\t\t\t\tif (state && state.toLowerCase() == 'uninitialized') {\r\n\t\t\t\t\t\t\tsetTimeout(checkState, 50);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} catch(e) {\r\n\t\t\t\t\t\tlog('Server abort: ', e, ' (', e.name, ')');\r\n\t\t\t\t\t\tcb(SERVER_ABORT);\r\n\t\t\t\t\t\tif (timeoutHandle) {\r\n\t\t\t\t\t\t\tclearTimeout(timeoutHandle);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimeoutHandle = undefined;\r\n\t\t\t\t\t}\r\n\t\t\t\t}", "title": "" }, { "docid": "a414a679efd225339d4236ab75c518f8", "score": "0.53390086", "text": "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "34dfc04e50884940dd4623d64e1ddb3a", "score": "0.5333562", "text": "get ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}", "title": "" }, { "docid": "b4a767042f4e55b294c61ecb2eb10386", "score": "0.5309591", "text": "function getState(state) {\n switch(state) {\n case 1: return 'unknown';\n case 2: return 'ok';\n case 3: return 'warning';\n case 4: return 'critical';\n }\n }", "title": "" } ]
379f8bfec0c27fb4e4f14d3efdab2ec6
since the % signs will always start at the beginning
[ { "docid": "d06169dae812b81fec2394134e1699ba", "score": "0.0", "text": "function processParagraph2(paragraph) {\n\tvar count = 0;\n\twhile (paragraph.charAt(0) === '%') {\n\t\tparagraph = paragraph.slice(1);\n\t\tcount++;\n\t}\n\tvar tag = (count === 0) ? \"p\" : \"h\"+count;\n\treturn {\n\t\ttype: tag,\n\t\tcontent: paragraph\n\t};\n}", "title": "" } ]
[ { "docid": "7cafcb6c4b703ed3eb7d537f58eb95be", "score": "0.75932324", "text": "function z(e){return e+\"%\"}", "title": "" }, { "docid": "fcfd0357d9472238b4f2b2b935bb2d0e", "score": "0.7258092", "text": "function ht(t){return t+\"%\"}", "title": "" }, { "docid": "fcfd0357d9472238b4f2b2b935bb2d0e", "score": "0.7258092", "text": "function ht(t){return t+\"%\"}", "title": "" }, { "docid": "fcfd0357d9472238b4f2b2b935bb2d0e", "score": "0.7258092", "text": "function ht(t){return t+\"%\"}", "title": "" }, { "docid": "b9877e0a6a5d85c1b3d44c21bb4e3220", "score": "0.71538305", "text": "function G(A){return A+\"%\"}", "title": "" }, { "docid": "71f39397de20014012ea931b2bd6d261", "score": "0.7029765", "text": "function B(e){return e+\"%\"}", "title": "" }, { "docid": "abecf2c75ae796f7d77ae8de3e7c49f5", "score": "0.6975414", "text": "function percent(val) {\n\t return val + \"%\";\n\t}", "title": "" }, { "docid": "895a50b92b89b565a83c47d97c1d4365", "score": "0.67742884", "text": "function perc(v) {\r\n return v + '%';\r\n }", "title": "" }, { "docid": "b2024a6b81881cf5210954705d21acae", "score": "0.67322373", "text": "function reempBlanco(original){\r\n var retorno=\"\";\r\n for (var i = 0; i < original.length; i ++){\r\n retorno += (original.charAt(i) == \" \") ? \"%\" : original.charAt(i);\r\n }\r\n return retorno;\r\n}", "title": "" }, { "docid": "7291164547c4346fd764d7b7a49048c1", "score": "0.66841567", "text": "function uu220844() { return 'EMP%\"'; }", "title": "" }, { "docid": "a325829ed4695078db5ecf72b5e098fe", "score": "0.6579017", "text": "function percentOf() {\n if (strInput !== \"\") {\n current = Number(strInput);\n strInput = \"\";\n }\n if (operation === \"%\") current = percentage * current / 100;\n percentage = current;\n $(\"#outputScr\").html(fixOut(printed + fix(percentage) + \"%\"));\n $(\"#inputScr\").html(fix(current));\n operation = \"%\";\n }", "title": "" }, { "docid": "ed0ed02a8d9facd30c50bbfd5230bb58", "score": "0.6483243", "text": "function u(t,e,i){var n=t.indexOf(\" \"),r,s;return s=-1===n?(r=void 0!==i?i+\"\":t,t):(r=t.substr(0,n),t.substr(n+1)),r=-1!==r.indexOf(\"%\")?parseFloat(r)/100*e:parseFloat(r),(s=-1!==s.indexOf(\"%\")?parseFloat(s)/100*e:parseFloat(s))<r?[s,r]:[r,s]}", "title": "" }, { "docid": "0248f112391ac86c2fbadab52ba7de70", "score": "0.6482253", "text": "function K(t){return t+\"%\"}", "title": "" }, { "docid": "547ec3ba7b40932884a77974b45c4e62", "score": "0.63883364", "text": "function formatPercent(s) {\n return (s * 100).toFixed(0) + '%';\n }", "title": "" }, { "docid": "e775ac6d45ac929dbee5064231675374", "score": "0.63479537", "text": "function N(e){return\"string\"==typeof e&&-1!=e.indexOf(\"%\")}", "title": "" }, { "docid": "52d4b50b8566fe7d4c9d079290b49e97", "score": "0.63428026", "text": "function Q(t) {\n return t + \"%\"\n }", "title": "" }, { "docid": "d727b281ec37e6d45e4731253232284c", "score": "0.633076", "text": "function percentEncode(str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {\n return `%${c.charCodeAt(0).toString(16).toUpperCase()}`\n })\n}", "title": "" }, { "docid": "04f5c9b255f60c5daed78446a9749a81", "score": "0.6206009", "text": "function dt(t){return t+\"%\"}", "title": "" }, { "docid": "3c8ccd29be795b2f0b40d37c43ae6602", "score": "0.6186434", "text": "function ValueApplyPercent( str, percent ) {\r\n str=String(str);\r\n if( str === '0' || percent == 1 ) { return str; }\r\n var n = Number(str.replace(/[a-zA-Z]/g, ''));\r\n var ar = str.match(/([^\\-0-9\\.]+)/g);\r\n var a = '';\r\n if( ar != null && ar.length > 0 ) {\r\n a = ar.join();\r\n }\r\n \r\n if( isNaN(n) || n == 0 ) {\r\n return str;\r\n }\r\n\r\n n = n * percent;\r\n return n + a;\r\n }", "title": "" }, { "docid": "e75b827871017119af1b574d3d898028", "score": "0.6096121", "text": "function printf(S, L) {\n\t\tif (!L) return S;\n\n\t\tvar nS = \"\";\n\t\tvar tS = S.split(\"%s\");\n\n\t\tfor(var i=0; i<L.length; i++) {\n\t\t\tif (tS[i].lastIndexOf('%') == tS[i].length-1 && i != L.length-1)\n\t\t\t\ttS[i] += \"s\"+tS.splice(i+1,1)[0];\n\t\t\tnS += tS[i] + L[i];\n\t\t}\n\t\treturn nS + tS[tS.length-1];\n}", "title": "" }, { "docid": "37c068fa8b313a32d73338a77d8495ee", "score": "0.6042484", "text": "function isPercentage(n) {\n\t return typeof n === \"string\" && n.indexOf('%') != -1;\n\t }", "title": "" }, { "docid": "f86115fa45df88332e165ac1f08a8524", "score": "0.6014034", "text": "function L(e){return e<=1&&(e=100*e+\"%\"),e}", "title": "" }, { "docid": "a329b3e3198d20a01aea642d68f1a2aa", "score": "0.59996486", "text": "function fixPercent(percent) {\n if (percent > 100) percent = 100;\n if (percent < 0) percent = 0;\n return percent;\n}", "title": "" }, { "docid": "5eb6cc6357142c5d08b4f73bf6e8aa16", "score": "0.5997027", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf(\"%\") != -1;\n }", "title": "" }, { "docid": "71435e056689d08b168cabdf1df92320", "score": "0.5989109", "text": "function isPercentage(n) {\n\t return typeof n === \"string\" && n.indexOf('%') != -1;\n\t }", "title": "" }, { "docid": "c5e4115ab601a75db97839c6b995ec9a", "score": "0.59786654", "text": "function sprintf(strInput)\n\t{\n\t\tvar strOutput='';\n\t\tvar currentArg=1;\n\t\n\t\tfor (var i=0; i<strInput.length; i++) {\n\t\t\tif (strInput.charAt(i)== '%' && i != (strInput.length - 1) && typeof(arguments[currentArg]) != 'undefined') {\n\t\t\t\tswitch (strInput.charAt(++i)) {\n\t\t\t\t\tcase 's':\n\t\t\t\t\t\tstrOutput+= arguments[currentArg];\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase '%':\n\t\t\t\t\t\tstrOutput+= '%';\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcurrentArg++;\n\t\t\t} else {\n\t\t\t\tstrOutput+= strInput.charAt(i);\n\t\t\t}\n\t\t}\n\t\n\t\treturn strOutput;\n\t}", "title": "" }, { "docid": "5558ed431b3ce8251c4b1461e32b7960", "score": "0.5936358", "text": "function isPercentage(n) {\n\t return typeof n === \"string\" && n.indexOf('%') != -1;\n\t}", "title": "" }, { "docid": "6931876574e4d00285bd693c50614e8b", "score": "0.5893333", "text": "function percentFormat(num) {\n return (num * 100).toFixed(0) + '%'\n}", "title": "" }, { "docid": "b42ae3f0ccba2d67983525ba4014a637", "score": "0.5890071", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n }", "title": "" }, { "docid": "b42ae3f0ccba2d67983525ba4014a637", "score": "0.5890071", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n }", "title": "" }, { "docid": "b42ae3f0ccba2d67983525ba4014a637", "score": "0.5890071", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n }", "title": "" }, { "docid": "9c02f40274ceb669641fb11a4383e9e6", "score": "0.58819544", "text": "function giveScoringProgressBarPercentages() {\n\tjisQuery( 'div[class*=\"rogressBar\"]' ).each( function() {\n\t\tvalue = jisQuery( this ).attr( 'title' );\n\t\tvalue = value.substr( 0, value.indexOf( \"%\" ) );\n\t\tspan = '<span style=\" text-align: center; font-weight: 400; font-size: smaller;\">&nbsp;&nbsp;&nbsp;' + value + '%</span>';\n\t\tvalue = jisQuery( this ).children( \"div:first\" ).append( span );\n\t} );\n}", "title": "" }, { "docid": "cdaade7befc8c4fb23e83a24d5b87b1b", "score": "0.5879858", "text": "function percent_(fraction) {\n return (valueOrDefault_(fraction, 0) * 100).toFixed(2) + '%';\n }", "title": "" }, { "docid": "48d1192476f66feb38b37ddb511a87c8", "score": "0.5874594", "text": "function oneDividedBy() {\n if (strInput !== \"\") current = Number(strInput);\n if (current === 0) {\n clear();\n $(\"#inputScr\").html(\"Cannot divide by zero\");\n return;\n }\n if (operation === \"%\") {\n strOutput = \"rec(\" + fix(percentage) + \"%\" + fix(current) + \")\";\n current = percentage * current / 100;\n current = 1 / current;\n percentage = 0;\n } else {\n strOutput = \"rec(\" + fix(current) + \")\";\n current = 1 / current;\n }\n $(\"#outputScr\").html(fixOut(printed + strOutput));\n $(\"#inputScr\").html(fix(current));\n operation = \"1/\";\n strInput = \"\";\n }", "title": "" }, { "docid": "a113ed887f1f8f9e83ed85834287b200", "score": "0.5873814", "text": "function percentFormat(str, fn) {\n var num = 0;\n\n if (typeof str == \"string\") {\n //不是數字就傳回原來的\n if (isNaN(str)) {\n return str;\n }\n\n num = Number(str);\n }\n else if (typeof str == \"number\") {\n num = str;\n }\n else {\n return str;\n }\n\n if (fn == \"%\") {\n return (num * 100);\n }\n\n fn1 = fn.substring(1);\n if (isNaN(fn1)) {\n return (num * 100);\n }\n\n return Number((num * 100).toFixed(Number(fn1)));\n}", "title": "" }, { "docid": "7c6e3eba531cdb902f0481acb76689be", "score": "0.58237225", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(c < 0 || arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n return a;\n}", "title": "" }, { "docid": "7c6e3eba531cdb902f0481acb76689be", "score": "0.58237225", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(c < 0 || arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n return a;\n}", "title": "" }, { "docid": "7c6e3eba531cdb902f0481acb76689be", "score": "0.58237225", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(c < 0 || arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n return a;\n}", "title": "" }, { "docid": "7c6e3eba531cdb902f0481acb76689be", "score": "0.58237225", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(c < 0 || arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n return a;\n}", "title": "" }, { "docid": "71b776e77e03aca4b64a7ba8c0b444bf", "score": "0.5817705", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n return a;\n}", "title": "" }, { "docid": "71b776e77e03aca4b64a7ba8c0b444bf", "score": "0.5817705", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n return a;\n}", "title": "" }, { "docid": "71b776e77e03aca4b64a7ba8c0b444bf", "score": "0.5817705", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n return a;\n}", "title": "" }, { "docid": "04d9bd82e0d0ee45dbd109f28f2e3f48", "score": "0.58040434", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n\n return a;\n}", "title": "" }, { "docid": "04d9bd82e0d0ee45dbd109f28f2e3f48", "score": "0.58040434", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n\n return a;\n}", "title": "" }, { "docid": "04d9bd82e0d0ee45dbd109f28f2e3f48", "score": "0.58040434", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n\n return a;\n}", "title": "" }, { "docid": "04d9bd82e0d0ee45dbd109f28f2e3f48", "score": "0.58040434", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n\n return a;\n}", "title": "" }, { "docid": "04d9bd82e0d0ee45dbd109f28f2e3f48", "score": "0.58040434", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n\n return a;\n}", "title": "" }, { "docid": "04d9bd82e0d0ee45dbd109f28f2e3f48", "score": "0.58040434", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n\n return a;\n}", "title": "" }, { "docid": "04d9bd82e0d0ee45dbd109f28f2e3f48", "score": "0.58040434", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n\n return a;\n}", "title": "" }, { "docid": "04d9bd82e0d0ee45dbd109f28f2e3f48", "score": "0.58040434", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n\n return a;\n}", "title": "" }, { "docid": "04d9bd82e0d0ee45dbd109f28f2e3f48", "score": "0.58040434", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n\n return a;\n}", "title": "" }, { "docid": "04d9bd82e0d0ee45dbd109f28f2e3f48", "score": "0.58040434", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n\n return a;\n}", "title": "" }, { "docid": "04d9bd82e0d0ee45dbd109f28f2e3f48", "score": "0.58040434", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n\n return a;\n}", "title": "" }, { "docid": "04d9bd82e0d0ee45dbd109f28f2e3f48", "score": "0.58040434", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n\n return a;\n}", "title": "" }, { "docid": "04d9bd82e0d0ee45dbd109f28f2e3f48", "score": "0.58040434", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n\n return a;\n}", "title": "" }, { "docid": "04d9bd82e0d0ee45dbd109f28f2e3f48", "score": "0.58040434", "text": "function format() {\n var a = arguments.length <= 0 ? undefined : arguments[0];\n var b = [];\n\n for (var c = 1, len = arguments.length; c < len; c += 1) {\n b.push(arguments.length <= c ? undefined : arguments[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n\n return a;\n}", "title": "" }, { "docid": "30771b0d4285bbd866c7f41e26950a96", "score": "0.57879835", "text": "static interpolate(start, end, percent) {\n return (end - start) * percent + start;\n }", "title": "" }, { "docid": "86cb0dae25ad1fe024fc84bfc6536fcf", "score": "0.57789314", "text": "handlePercentage(count){\n var percentages = { 6: '16.66%', 7: '14.28%', 8: '12.49%'}\n return percentages[count];\n }", "title": "" }, { "docid": "4e80f0c2924f8c26d722849f052da383", "score": "0.57675", "text": "function isPercentage(n) {\r\n return typeof n === \"string\" && n.indexOf('%') != -1;\r\n }", "title": "" }, { "docid": "4e80f0c2924f8c26d722849f052da383", "score": "0.57675", "text": "function isPercentage(n) {\r\n return typeof n === \"string\" && n.indexOf('%') != -1;\r\n }", "title": "" }, { "docid": "9ae2e7ec19f91f3bcb1f15ea9c2869cf", "score": "0.5759801", "text": "turnToPercent(val) {\n if (val < 1) {\n return Math.trunc(val * 100) + '%';\n }\n return Math.trunc(val) + '%';\n }", "title": "" }, { "docid": "29137a3efbd119fd05aa657fe29e07ca", "score": "0.57424664", "text": "function isPercentage(n) {\n\t\treturn typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "ca3193a76090a38c8edb6eac72409713", "score": "0.5737419", "text": "function isPercentage(n) {\n return typeof n === 'string' && n.indexOf('%') != -1;\n }", "title": "" }, { "docid": "7491aeb1ae04c370d93ceb0333e6eb60", "score": "0.5716358", "text": "function checkIsPercentage(Str){\r\n Str=\"\"+Str;\r\n RegularExp=/^(\\d|[1-9]\\d|100)%$/;\r\n if (RegularExp.test(Str)) {\r\n \t return true;\r\n }\r\n else {\r\n return false;\r\n }\t\r\n}", "title": "" }, { "docid": "93c7dc7a0d9027e8853bfcd589a473bc", "score": "0.5707629", "text": "function format() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var a = args[0];\n var b = [];\n var c;\n\n for (c = 1; c < args.length; c += 1) {\n b.push(args[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n return a;\n }", "title": "" }, { "docid": "a2f53476d2a107c15329a2ab9a2f2e05", "score": "0.5707331", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n }", "title": "" }, { "docid": "a2f53476d2a107c15329a2ab9a2f2e05", "score": "0.5707331", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n }", "title": "" }, { "docid": "a2f53476d2a107c15329a2ab9a2f2e05", "score": "0.5707331", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n }", "title": "" }, { "docid": "a2f53476d2a107c15329a2ab9a2f2e05", "score": "0.5707331", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n }", "title": "" }, { "docid": "a2f53476d2a107c15329a2ab9a2f2e05", "score": "0.5707331", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n }", "title": "" }, { "docid": "a2f53476d2a107c15329a2ab9a2f2e05", "score": "0.5707331", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n }", "title": "" }, { "docid": "3e2d11db9abe1b3881d4ccc0562c73dc", "score": "0.5677335", "text": "function perc(n) {\n\t\treturn n * 100 + '%';\n\t}", "title": "" }, { "docid": "3e2d11db9abe1b3881d4ccc0562c73dc", "score": "0.5677335", "text": "function perc(n) {\n\t\treturn n * 100 + '%';\n\t}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" }, { "docid": "e5c5691cfb48f4b7c65a634f59b01fb2", "score": "0.5670818", "text": "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "title": "" } ]
1fd0e30aa5517fd89802fff81df408e6
Classes for table cells.
[ { "docid": "a991c0c8eb8c6e2345725cf4e733ad8f", "score": "0.6277164", "text": "cellClass(more = null) {\n return `p-2 border-t border-gray-100 dark:border-gray-700 whitespace-nowrap dark:bg-gray-800 ${more}`;\n }", "title": "" } ]
[ { "docid": "2ca0478953ffd97dade748254359b99d", "score": "0.6589606", "text": "function TableCell(props) {\n var active = props.active,\n children = props.children,\n className = props.className,\n collapsing = props.collapsing,\n content = props.content,\n disabled = props.disabled,\n error = props.error,\n icon = props.icon,\n negative = props.negative,\n positive = props.positive,\n selectable = props.selectable,\n singleLine = props.singleLine,\n textAlign = props.textAlign,\n verticalAlign = props.verticalAlign,\n warning = props.warning,\n width = props.width;\n var classes = Object(__WEBPACK_IMPORTED_MODULE_2_clsx__[\"default\"])(Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"x\" /* useKeyOnly */])(active, 'active'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"x\" /* useKeyOnly */])(collapsing, 'collapsing'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"x\" /* useKeyOnly */])(disabled, 'disabled'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"x\" /* useKeyOnly */])(error, 'error'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"x\" /* useKeyOnly */])(negative, 'negative'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"x\" /* useKeyOnly */])(positive, 'positive'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"x\" /* useKeyOnly */])(selectable, 'selectable'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"x\" /* useKeyOnly */])(singleLine, 'single line'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"x\" /* useKeyOnly */])(warning, 'warning'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"A\" /* useTextAlignProp */])(textAlign), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"C\" /* useVerticalAlignProp */])(verticalAlign), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"D\" /* useWidthProp */])(width, 'wide'), className);\n var rest = Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"p\" /* getUnhandledProps */])(TableCell, props);\n var ElementType = Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"o\" /* getElementType */])(TableCell, props);\n\n if (!__WEBPACK_IMPORTED_MODULE_5__lib__[\"c\" /* childrenUtils */].isNil(children)) {\n return /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement(ElementType, Object(__WEBPACK_IMPORTED_MODULE_0__babel_runtime_helpers_esm_extends__[\"a\" /* default */])({}, rest, {\n className: classes\n }), children);\n }\n\n return /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement(ElementType, Object(__WEBPACK_IMPORTED_MODULE_0__babel_runtime_helpers_esm_extends__[\"a\" /* default */])({}, rest, {\n className: classes\n }), __WEBPACK_IMPORTED_MODULE_6__elements_Icon__[\"a\" /* default */].create(icon), content);\n}", "title": "" }, { "docid": "9e3d32dfd70182b076d51dc588777110", "score": "0.65872085", "text": "function TableCell(props) {\n var active = props.active,\n children = props.children,\n className = props.className,\n collapsing = props.collapsing,\n content = props.content,\n disabled = props.disabled,\n error = props.error,\n icon = props.icon,\n negative = props.negative,\n positive = props.positive,\n selectable = props.selectable,\n singleLine = props.singleLine,\n textAlign = props.textAlign,\n verticalAlign = props.verticalAlign,\n warning = props.warning,\n width = props.width;\n\n\n var classes = __WEBPACK_IMPORTED_MODULE_2_classnames___default()(Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"z\" /* useKeyOnly */])(active, 'active'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"z\" /* useKeyOnly */])(collapsing, 'collapsing'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"z\" /* useKeyOnly */])(disabled, 'disabled'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"z\" /* useKeyOnly */])(error, 'error'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"z\" /* useKeyOnly */])(negative, 'negative'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"z\" /* useKeyOnly */])(positive, 'positive'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"z\" /* useKeyOnly */])(selectable, 'selectable'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"z\" /* useKeyOnly */])(singleLine, 'single line'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"z\" /* useKeyOnly */])(warning, 'warning'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"C\" /* useTextAlignProp */])(textAlign), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"E\" /* useVerticalAlignProp */])(verticalAlign), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"F\" /* useWidthProp */])(width, 'wide'), className);\n var rest = Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"q\" /* getUnhandledProps */])(TableCell, props);\n var ElementType = Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"p\" /* getElementType */])(TableCell, props);\n\n if (!__WEBPACK_IMPORTED_MODULE_5__lib__[\"d\" /* childrenUtils */].isNil(children)) {\n return __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement(\n ElementType,\n __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, rest, { className: classes }),\n children\n );\n }\n\n return __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement(\n ElementType,\n __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, rest, { className: classes }),\n __WEBPACK_IMPORTED_MODULE_6__elements_Icon__[\"a\" /* default */].create(icon),\n content\n );\n}", "title": "" }, { "docid": "fcb656ad57e71d2d3dee1772e97ffabf", "score": "0.6545192", "text": "function TableCell(props) {\n var active = props.active,\n children = props.children,\n className = props.className,\n collapsing = props.collapsing,\n content = props.content,\n disabled = props.disabled,\n error = props.error,\n icon = props.icon,\n negative = props.negative,\n positive = props.positive,\n selectable = props.selectable,\n singleLine = props.singleLine,\n textAlign = props.textAlign,\n verticalAlign = props.verticalAlign,\n warning = props.warning,\n width = props.width;\n var classes = __WEBPACK_IMPORTED_MODULE_2_classnames___default()(Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"A\" /* useKeyOnly */])(active, 'active'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"A\" /* useKeyOnly */])(collapsing, 'collapsing'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"A\" /* useKeyOnly */])(disabled, 'disabled'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"A\" /* useKeyOnly */])(error, 'error'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"A\" /* useKeyOnly */])(negative, 'negative'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"A\" /* useKeyOnly */])(positive, 'positive'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"A\" /* useKeyOnly */])(selectable, 'selectable'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"A\" /* useKeyOnly */])(singleLine, 'single line'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"A\" /* useKeyOnly */])(warning, 'warning'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"D\" /* useTextAlignProp */])(textAlign), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"F\" /* useVerticalAlignProp */])(verticalAlign), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"G\" /* useWidthProp */])(width, 'wide'), className);\n var rest = Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"r\" /* getUnhandledProps */])(TableCell, props);\n var ElementType = Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"q\" /* getElementType */])(TableCell, props);\n\n if (!__WEBPACK_IMPORTED_MODULE_5__lib__[\"c\" /* childrenUtils */].isNil(children)) {\n return __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement(ElementType, __WEBPACK_IMPORTED_MODULE_0__babel_runtime_helpers_extends___default()({}, rest, {\n className: classes\n }), children);\n }\n\n return __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement(ElementType, __WEBPACK_IMPORTED_MODULE_0__babel_runtime_helpers_extends___default()({}, rest, {\n className: classes\n }), __WEBPACK_IMPORTED_MODULE_6__elements_Icon__[\"a\" /* default */].create(icon), content);\n}", "title": "" }, { "docid": "ae11828873ea278f243a6c10afc5958c", "score": "0.65428597", "text": "function TableCell(props) {\n var active = props.active,\n children = props.children,\n className = props.className,\n collapsing = props.collapsing,\n content = props.content,\n disabled = props.disabled,\n error = props.error,\n icon = props.icon,\n negative = props.negative,\n positive = props.positive,\n selectable = props.selectable,\n singleLine = props.singleLine,\n textAlign = props.textAlign,\n verticalAlign = props.verticalAlign,\n warning = props.warning,\n width = props.width;\n\n\n var classes = __WEBPACK_IMPORTED_MODULE_2_classnames___default()(Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"y\" /* useKeyOnly */])(active, 'active'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"y\" /* useKeyOnly */])(collapsing, 'collapsing'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"y\" /* useKeyOnly */])(disabled, 'disabled'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"y\" /* useKeyOnly */])(error, 'error'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"y\" /* useKeyOnly */])(negative, 'negative'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"y\" /* useKeyOnly */])(positive, 'positive'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"y\" /* useKeyOnly */])(selectable, 'selectable'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"y\" /* useKeyOnly */])(singleLine, 'single line'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"y\" /* useKeyOnly */])(warning, 'warning'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"B\" /* useTextAlignProp */])(textAlign), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"D\" /* useVerticalAlignProp */])(verticalAlign), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"E\" /* useWidthProp */])(width, 'wide'), className);\n var rest = Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"p\" /* getUnhandledProps */])(TableCell, props);\n var ElementType = Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"o\" /* getElementType */])(TableCell, props);\n\n if (!__WEBPACK_IMPORTED_MODULE_5__lib__[\"d\" /* childrenUtils */].isNil(children)) {\n return __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement(\n ElementType,\n __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, rest, { className: classes }),\n children\n );\n }\n\n return __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement(\n ElementType,\n __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, rest, { className: classes }),\n __WEBPACK_IMPORTED_MODULE_6__elements_Icon__[\"a\" /* default */].create(icon),\n content\n );\n}", "title": "" }, { "docid": "edb7d4110d42f635bdae6d022f4a91ea", "score": "0.6518091", "text": "cellClasses(day) {\n function dateMatch(dateOne, dateTwo, multiple) {\n // if either date is null or undefined, return false\n // if using multiple flag, return false\n if (!dateOne || !dateTwo || multiple) {\n return false;\n }\n\n if (Array.isArray(dateTwo)) {\n return dateTwo.some(date => dateOne.getDate() === date.getDate() && dateOne.getFullYear() === date.getFullYear() && dateOne.getMonth() === date.getMonth());\n }\n\n return dateOne.getDate() === dateTwo.getDate() && dateOne.getFullYear() === dateTwo.getFullYear() && dateOne.getMonth() === dateTwo.getMonth();\n }\n\n function dateWithin(dateOne, dates, multiple) {\n if (!Array.isArray(dates) || multiple) {\n return false;\n }\n\n return dateOne > dates[0] && dateOne < dates[1];\n }\n\n return [...this.tableCellClasses, {\n [this.computedClass('tableCellSelectedClass', 'o-dpck__table__cell--selected')]: dateMatch(day, this.selectedDate) || dateWithin(day, this.selectedDate, this.multiple)\n }, {\n [this.computedClass('tableCellFirstSelectedClass', 'o-dpck__table__cell--first-selected')]: dateMatch(day, Array.isArray(this.selectedDate) && this.selectedDate[0], this.multiple)\n }, {\n [this.computedClass('tableCellWithinSelectedClass', 'o-dpck__table__cell--within-selected')]: dateWithin(day, this.selectedDate, this.multiple)\n }, {\n [this.computedClass('tableCellLastSelectedClass', 'o-dpck__table__cell--last-selected')]: dateMatch(day, Array.isArray(this.selectedDate) && this.selectedDate[1], this.multiple)\n }, {\n [this.computedClass('tableCellFirstHoveredClass', 'o-dpck__table__cell--first-hovered')]: dateMatch(day, Array.isArray(this.hoveredDateRange) && this.hoveredDateRange[0])\n }, {\n [this.computedClass('tableCellWithinHoveredClass', 'o-dpck__table__cell--within-hovered')]: dateWithin(day, this.hoveredDateRange)\n }, {\n [this.computedClass('tableCellLastHoveredClass', 'o-dpck__table__cell--last-hovered')]: dateMatch(day, Array.isArray(this.hoveredDateRange) && this.hoveredDateRange[1])\n }, {\n [this.computedClass('tableCellTodayClass', 'o-dpck__table__cell--today')]: dateMatch(day, this.dateCreator())\n }, {\n [this.computedClass('tableCellSelectableClass', 'o-dpck__table__cell--selectable')]: this.selectableDate(day) && !this.disabled\n }, {\n [this.computedClass('tableCellUnselectableClass', 'o-dpck__table__cell--unselectable')]: !this.selectableDate(day) || this.disabled\n }, {\n [this.computedClass('tableCellInvisibleClass', 'o-dpck__table__cell--invisible')]: !this.nearbyMonthDays && day.getMonth() !== this.month\n }, {\n [this.computedClass('tableCellNearbyClass', 'o-dpck__table__cell--nearby')]: this.nearbySelectableMonthDays && day.getMonth() !== this.month\n }, {\n [this.computedClass('tableCellEventsClass', 'o-dpck__table__cell--events')]: this.hasEvents\n }, {\n [this.computedClass('tableCellTodayClass', 'o-dpck__table__cell--today')]: dateMatch(day, this.dateCreator())\n }];\n }", "title": "" }, { "docid": "6a6240aee59c5aeabc51a321f5513e1a", "score": "0.64510757", "text": "function rowCellIndexClass(rowIndex) {\n return dimensionIndexClass(NS + \"-table-cell-row-\", rowIndex);\n}", "title": "" }, { "docid": "366e18c52b91bacd6ef021823634ad81", "score": "0.642186", "text": "tdClasses(field, item) {\n let cellVariant = ''\n if (item._cellVariants && item._cellVariants[field.key]) {\n cellVariant = `${this.dark ? 'bg' : 'table'}-${item._cellVariants[field.key]}`\n }\n return [\n field.variant && !cellVariant ? `${this.dark ? 'bg' : 'table'}-${field.variant}` : '',\n cellVariant,\n field.class ? field.class : '',\n this.getTdValues(item, field.key, field.tdClass, '')\n ]\n }", "title": "" }, { "docid": "2c81ff3fb6ad98230f850be3fa221259", "score": "0.62942445", "text": "function TableCell(props) {\n var active = props.active,\n children = props.children,\n className = props.className,\n collapsing = props.collapsing,\n content = props.content,\n disabled = props.disabled,\n error = props.error,\n icon = props.icon,\n negative = props.negative,\n positive = props.positive,\n selectable = props.selectable,\n singleLine = props.singleLine,\n textAlign = props.textAlign,\n verticalAlign = props.verticalAlign,\n warning = props.warning,\n width = props.width;\n var classes = classnames__WEBPACK_IMPORTED_MODULE_2___default()(Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(active, 'active'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(collapsing, 'collapsing'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(disabled, 'disabled'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(error, 'error'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(negative, 'negative'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(positive, 'positive'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(selectable, 'selectable'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(singleLine, 'single line'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(warning, 'warning'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useTextAlignProp\"])(textAlign), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useVerticalAlignProp\"])(verticalAlign), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useWidthProp\"])(width, 'wide'), className);\n var rest = Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"getUnhandledProps\"])(TableCell, props);\n var ElementType = Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"getElementType\"])(TableCell, props);\n\n if (!_lib__WEBPACK_IMPORTED_MODULE_5__[\"childrenUtils\"].isNil(children)) {\n return react__WEBPACK_IMPORTED_MODULE_4___default.a.createElement(ElementType, _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, {\n className: classes\n }), children);\n }\n\n return react__WEBPACK_IMPORTED_MODULE_4___default.a.createElement(ElementType, _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, {\n className: classes\n }), _elements_Icon__WEBPACK_IMPORTED_MODULE_6__[\"default\"].create(icon), content);\n}", "title": "" }, { "docid": "2c81ff3fb6ad98230f850be3fa221259", "score": "0.62942445", "text": "function TableCell(props) {\n var active = props.active,\n children = props.children,\n className = props.className,\n collapsing = props.collapsing,\n content = props.content,\n disabled = props.disabled,\n error = props.error,\n icon = props.icon,\n negative = props.negative,\n positive = props.positive,\n selectable = props.selectable,\n singleLine = props.singleLine,\n textAlign = props.textAlign,\n verticalAlign = props.verticalAlign,\n warning = props.warning,\n width = props.width;\n var classes = classnames__WEBPACK_IMPORTED_MODULE_2___default()(Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(active, 'active'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(collapsing, 'collapsing'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(disabled, 'disabled'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(error, 'error'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(negative, 'negative'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(positive, 'positive'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(selectable, 'selectable'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(singleLine, 'single line'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(warning, 'warning'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useTextAlignProp\"])(textAlign), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useVerticalAlignProp\"])(verticalAlign), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useWidthProp\"])(width, 'wide'), className);\n var rest = Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"getUnhandledProps\"])(TableCell, props);\n var ElementType = Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"getElementType\"])(TableCell, props);\n\n if (!_lib__WEBPACK_IMPORTED_MODULE_5__[\"childrenUtils\"].isNil(children)) {\n return react__WEBPACK_IMPORTED_MODULE_4___default.a.createElement(ElementType, _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, {\n className: classes\n }), children);\n }\n\n return react__WEBPACK_IMPORTED_MODULE_4___default.a.createElement(ElementType, _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, {\n className: classes\n }), _elements_Icon__WEBPACK_IMPORTED_MODULE_6__[\"default\"].create(icon), content);\n}", "title": "" }, { "docid": "2c81ff3fb6ad98230f850be3fa221259", "score": "0.62942445", "text": "function TableCell(props) {\n var active = props.active,\n children = props.children,\n className = props.className,\n collapsing = props.collapsing,\n content = props.content,\n disabled = props.disabled,\n error = props.error,\n icon = props.icon,\n negative = props.negative,\n positive = props.positive,\n selectable = props.selectable,\n singleLine = props.singleLine,\n textAlign = props.textAlign,\n verticalAlign = props.verticalAlign,\n warning = props.warning,\n width = props.width;\n var classes = classnames__WEBPACK_IMPORTED_MODULE_2___default()(Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(active, 'active'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(collapsing, 'collapsing'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(disabled, 'disabled'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(error, 'error'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(negative, 'negative'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(positive, 'positive'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(selectable, 'selectable'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(singleLine, 'single line'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(warning, 'warning'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useTextAlignProp\"])(textAlign), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useVerticalAlignProp\"])(verticalAlign), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useWidthProp\"])(width, 'wide'), className);\n var rest = Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"getUnhandledProps\"])(TableCell, props);\n var ElementType = Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"getElementType\"])(TableCell, props);\n\n if (!_lib__WEBPACK_IMPORTED_MODULE_5__[\"childrenUtils\"].isNil(children)) {\n return react__WEBPACK_IMPORTED_MODULE_4___default.a.createElement(ElementType, _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, {\n className: classes\n }), children);\n }\n\n return react__WEBPACK_IMPORTED_MODULE_4___default.a.createElement(ElementType, _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, {\n className: classes\n }), _elements_Icon__WEBPACK_IMPORTED_MODULE_6__[\"default\"].create(icon), content);\n}", "title": "" }, { "docid": "cd4e4141d3231ebd9e3ee4fbb756ddbd", "score": "0.62759066", "text": "function TableCell(props) {\n var active = props.active,\n children = props.children,\n className = props.className,\n collapsing = props.collapsing,\n content = props.content,\n disabled = props.disabled,\n error = props.error,\n icon = props.icon,\n negative = props.negative,\n positive = props.positive,\n selectable = props.selectable,\n singleLine = props.singleLine,\n textAlign = props.textAlign,\n verticalAlign = props.verticalAlign,\n warning = props.warning,\n width = props.width;\n var classes = (0, _classnames.default)((0, _lib.useKeyOnly)(active, 'active'), (0, _lib.useKeyOnly)(collapsing, 'collapsing'), (0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(error, 'error'), (0, _lib.useKeyOnly)(negative, 'negative'), (0, _lib.useKeyOnly)(positive, 'positive'), (0, _lib.useKeyOnly)(selectable, 'selectable'), (0, _lib.useKeyOnly)(singleLine, 'single line'), (0, _lib.useKeyOnly)(warning, 'warning'), (0, _lib.useTextAlignProp)(textAlign), (0, _lib.useVerticalAlignProp)(verticalAlign), (0, _lib.useWidthProp)(width, 'wide'), className);\n var rest = (0, _lib.getUnhandledProps)(TableCell, props);\n var ElementType = (0, _lib.getElementType)(TableCell, props);\n\n if (!_lib.childrenUtils.isNil(children)) {\n return _react.default.createElement(ElementType, (0, _extends2.default)({}, rest, {\n className: classes\n }), children);\n }\n\n return _react.default.createElement(ElementType, (0, _extends2.default)({}, rest, {\n className: classes\n }), _Icon.default.create(icon), content);\n}", "title": "" }, { "docid": "ea47923a790296963d4a1f80c8a29823", "score": "0.6254235", "text": "function TableCell(props) {\n var active = props.active,\n children = props.children,\n className = props.className,\n collapsing = props.collapsing,\n content = props.content,\n disabled = props.disabled,\n error = props.error,\n icon = props.icon,\n negative = props.negative,\n positive = props.positive,\n selectable = props.selectable,\n singleLine = props.singleLine,\n textAlign = props.textAlign,\n verticalAlign = props.verticalAlign,\n warning = props.warning,\n width = props.width;\n\n\n var classes = classnames__WEBPACK_IMPORTED_MODULE_2___default()(Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(active, 'active'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(collapsing, 'collapsing'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(disabled, 'disabled'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(error, 'error'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(negative, 'negative'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(positive, 'positive'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(selectable, 'selectable'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(singleLine, 'single line'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(warning, 'warning'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useTextAlignProp\"])(textAlign), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useVerticalAlignProp\"])(verticalAlign), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useWidthProp\"])(width, 'wide'), className);\n var rest = Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"getUnhandledProps\"])(TableCell, props);\n var ElementType = Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"getElementType\"])(TableCell, props);\n\n if (!_lib__WEBPACK_IMPORTED_MODULE_5__[\"childrenUtils\"].isNil(children)) {\n return react__WEBPACK_IMPORTED_MODULE_4___default.a.createElement(\n ElementType,\n babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, { className: classes }),\n children\n );\n }\n\n return react__WEBPACK_IMPORTED_MODULE_4___default.a.createElement(\n ElementType,\n babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, { className: classes }),\n _elements_Icon__WEBPACK_IMPORTED_MODULE_6__[\"default\"].create(icon),\n content\n );\n}", "title": "" }, { "docid": "1200338d077dc0fee79dd12dad1a9870", "score": "0.62419546", "text": "function changeCellClass ( data, type, full ) {\n\treturn ((data == 1)?\"<div class='icon-OK'></div>\":\"<div class='icon-NOK'></div>\");\n}", "title": "" }, { "docid": "fee946c05dce235e178ad8d52bccedee", "score": "0.6196133", "text": "getCellCSSClass(cell) {\n let cssClass = \"\";\n switch (cell.type) {\n case CellType.CLEAR:\n cssClass = \"clear\";\n break;\n case CellType.WALL:\n cssClass = \"wall\";\n break;\n case CellType.FOOD:\n cssClass = \"food\";\n break;\n case CellType.ANTHILL:\n cssClass = \"anthill\";\n break;\n }\n return cssClass;\n }", "title": "" }, { "docid": "73ae27dbbb63c07453043679f7fac3ba", "score": "0.6168749", "text": "function _CollectionEditorCellData() {\n this.className = null; // The class name for the table cell\n this.id = null; // The id of the table cell\n this.innerHTML = null; // The contents of the cell\n this.values = null; // Data for input elements in the cell\n}", "title": "" }, { "docid": "5fdb496b60befdd12da8a6e0f83ba6f7", "score": "0.6115866", "text": "getTable () {\n const el = super.getTable()\n el.classList.add('table', 'table-scroll')\n if (this.options.table_border) el.classList.add('je-table-border')\n if (this.options.table_zebrastyle) el.classList.add('table-striped')\n return el\n }", "title": "" }, { "docid": "7a17a1f440a792399807b7758bde15e8", "score": "0.60866433", "text": "function Td(a){Td.i.constructor.call(this,null);this.du=a}", "title": "" }, { "docid": "5045a00b200ee423b4b1818ba083402d", "score": "0.60807085", "text": "function columnCellIndexClass(columnIndex) {\n return dimensionIndexClass(NS + \"-table-cell-col-\", columnIndex);\n}", "title": "" }, { "docid": "67dbad6194be7e9d7c4e4b5539d1ec02", "score": "0.60258037", "text": "function TableElementRenderer() {\n\n}", "title": "" }, { "docid": "3dcb85ce984b98a4f64ed35e81eccb9b", "score": "0.59163594", "text": "function CellContent() {\r\n this.type = 0;\r\n this.content = null;\r\n this.subType = 0;\r\n this.redraw = false;\r\n}", "title": "" }, { "docid": "30cd9eb6e7f03b92c716b01ed93d9c88", "score": "0.5877994", "text": "function addTableClass(element){\n element.addClass('pp-table').wrapInner('<div class=\"pp-tableCell\" style=\"height:100%\" />');\n }", "title": "" }, { "docid": "b4767c36b969f2f24e456ae5549c22d1", "score": "0.5870302", "text": "function rowIndexClass(rowIndex) {\n return dimensionIndexClass(NS + \"-table-row-\", rowIndex);\n}", "title": "" }, { "docid": "db39ce7ad478fbc2ef47e46b9696a6cf", "score": "0.57897466", "text": "function TableHelper() {\n \n }", "title": "" }, { "docid": "742131126db5ced995ae4f1475884f8a", "score": "0.5759788", "text": "function getClassName(i, j) {\n var cellClass = '.cell-' + i + '-' + j;\n return cellClass;\n}", "title": "" }, { "docid": "1115e0d3520e1e0972251d3a72f97a0c", "score": "0.575857", "text": "function Cell(column, row) {\n this.column = column;\n this.row = row;\n}", "title": "" }, { "docid": "6c9cb8262ecb7ce1382510647b172cf3", "score": "0.574407", "text": "function cellClassNames(rowIndex, columnIndex) {\n return [_common_classes__WEBPACK_IMPORTED_MODULE_6__[\"rowCellIndexClass\"](rowIndex), _common_classes__WEBPACK_IMPORTED_MODULE_6__[\"columnCellIndexClass\"](columnIndex)];\n}", "title": "" }, { "docid": "fa1bd0216e92a9851a446a52b2cd99ec", "score": "0.5725034", "text": "getCells() {\n let cells = [];\n let duration = this.checkExitDate();\n if(this.props.fields) {\n for(let i = 0; i < this.props.fields.length; i++) {\n let field = this.props.fields[i];\n // Special case that needs a CSS class added\n if(field.field_path == \"estimated_exit_date\") {\n cells.push(\n <td key={field.field_name} className={duration + \" mdl-navigation__link\"}>\n {this.parseFieldPath(field.field_path)}\n </td>\n );\n } else {\n cells.push(\n <td key={field.field_name} className=\"mdl-navigation__link\">\n {this.parseFieldPath(field.field_path)}\n </td>\n );\n }\n }\n // Add the \"+ Add\" Exit Date button in not in presentation mode\n if(cells.length > 0) {\n cells.push(this.checkIfPresentationMode()); \n } else {\n cells.push(<td key={0} className=\"mdl-navigation__link\">No Fields to Display</td>);\n }\n }\n return cells;\n }", "title": "" }, { "docid": "835de960f39a30523225a8af3344db32", "score": "0.5712194", "text": "function Table(props) {\n var attached = props.attached,\n basic = props.basic,\n celled = props.celled,\n children = props.children,\n className = props.className,\n collapsing = props.collapsing,\n color = props.color,\n columns = props.columns,\n compact = props.compact,\n definition = props.definition,\n fixed = props.fixed,\n footerRow = props.footerRow,\n headerRow = props.headerRow,\n headerRows = props.headerRows,\n inverted = props.inverted,\n padded = props.padded,\n renderBodyRow = props.renderBodyRow,\n selectable = props.selectable,\n singleLine = props.singleLine,\n size = props.size,\n sortable = props.sortable,\n stackable = props.stackable,\n striped = props.striped,\n structured = props.structured,\n tableData = props.tableData,\n textAlign = props.textAlign,\n unstackable = props.unstackable,\n verticalAlign = props.verticalAlign;\n var classes = Object(__WEBPACK_IMPORTED_MODULE_3_clsx__[\"default\"])('ui', color, size, Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"x\" /* useKeyOnly */])(celled, 'celled'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"x\" /* useKeyOnly */])(collapsing, 'collapsing'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"x\" /* useKeyOnly */])(definition, 'definition'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"x\" /* useKeyOnly */])(fixed, 'fixed'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"x\" /* useKeyOnly */])(inverted, 'inverted'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"x\" /* useKeyOnly */])(selectable, 'selectable'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"x\" /* useKeyOnly */])(singleLine, 'single line'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"x\" /* useKeyOnly */])(sortable, 'sortable'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"x\" /* useKeyOnly */])(stackable, 'stackable'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"x\" /* useKeyOnly */])(striped, 'striped'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"x\" /* useKeyOnly */])(structured, 'structured'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"x\" /* useKeyOnly */])(unstackable, 'unstackable'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"y\" /* useKeyOrValueAndKey */])(attached, 'attached'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"y\" /* useKeyOrValueAndKey */])(basic, 'basic'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"y\" /* useKeyOrValueAndKey */])(compact, 'compact'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"y\" /* useKeyOrValueAndKey */])(padded, 'padded'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"A\" /* useTextAlignProp */])(textAlign), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"C\" /* useVerticalAlignProp */])(verticalAlign), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"D\" /* useWidthProp */])(columns, 'column'), 'table', className);\n var rest = Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"p\" /* getUnhandledProps */])(Table, props);\n var ElementType = Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"o\" /* getElementType */])(Table, props);\n\n if (!__WEBPACK_IMPORTED_MODULE_6__lib__[\"c\" /* childrenUtils */].isNil(children)) {\n return /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(ElementType, Object(__WEBPACK_IMPORTED_MODULE_0__babel_runtime_helpers_esm_extends__[\"a\" /* default */])({}, rest, {\n className: classes\n }), children);\n }\n\n var hasHeaderRows = headerRow || headerRows;\n var headerShorthandOptions = {\n defaultProps: {\n cellAs: 'th'\n }\n };\n var headerElement = hasHeaderRows && /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_10__TableHeader__[\"a\" /* default */], null, __WEBPACK_IMPORTED_MODULE_12__TableRow__[\"a\" /* default */].create(headerRow, headerShorthandOptions), Object(__WEBPACK_IMPORTED_MODULE_2_lodash_es_map__[\"a\" /* default */])(headerRows, function (data) {\n return __WEBPACK_IMPORTED_MODULE_12__TableRow__[\"a\" /* default */].create(data, headerShorthandOptions);\n }));\n return /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(ElementType, Object(__WEBPACK_IMPORTED_MODULE_0__babel_runtime_helpers_esm_extends__[\"a\" /* default */])({}, rest, {\n className: classes\n }), headerElement, /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_7__TableBody__[\"a\" /* default */], null, renderBodyRow && Object(__WEBPACK_IMPORTED_MODULE_2_lodash_es_map__[\"a\" /* default */])(tableData, function (data, index) {\n return __WEBPACK_IMPORTED_MODULE_12__TableRow__[\"a\" /* default */].create(renderBodyRow(data, index));\n })), footerRow && /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_9__TableFooter__[\"a\" /* default */], null, __WEBPACK_IMPORTED_MODULE_12__TableRow__[\"a\" /* default */].create(footerRow)));\n}", "title": "" }, { "docid": "81fa3c8d01c0f97d378a756b3ead7cbb", "score": "0.5708523", "text": "__cellStyle__() {\n return {\n width: this.props.width,\n height: this.props.height,\n margin: this.props.margin,\n fontSize: this.props.fontSize,\n cursor: 'pointer',\n position: 'absolute'\n };\n }", "title": "" }, { "docid": "724973b0bdce842169c5b8c7944466bf", "score": "0.5706633", "text": "function columnIndexClass(columnIndex) {\n return dimensionIndexClass(NS + \"-table-col-\", columnIndex);\n}", "title": "" }, { "docid": "a420c0f097431bca85ab35c74d813233", "score": "0.5701035", "text": "function Table(tel,tNum)\n{\n this._dom = tel\n this._tNum = tNum\n\n this._dom.style['z-Index'] = 999\n\n this.nRows = tel.rows.length\n //this.nCols = tel.rows[this.nRows-1].cells.length\n this.nCols = 0\n for(var i=0; i<this.nRows; i++) {\n if(tel.rows[i].cells.length > this.nCols) {\n this.nCols = tel.rows[i].cells.length\n }\n }\n\n //GM_log(tNum + \"\\t\" + this.nRows + \"\\t\" + this.nCols)\n\n this.findHeader()\n\n //Add an extra header for displaying menus\n if(this.nRows > 2) {\n var displayMenu = this._dom.insertRow(this.headerStart)\n for(var i=0; i<this.nCols; i++) {\n var cell = displayMenu.insertCell(i)\n cell.innerHTML = 'Add to Freebase'\n }\n this.headerStart += 1\n this.nRows += 1\n }\n\n this.nRows -= this.headerStart\n\n //GM_log(this.headerStart)\n\n this._nTypeCallbacks = new Array();\n this._nTypeFreqCallbacks = new Array();\n for(var i=0; i<this.nCols; i++)\n {\n \tthis._nTypeCallbacks[i] = 0;\n \tthis._nTypeFreqCallbacks[i] = 0;\n }\n this.numColsTypeFreqCallbacksDone = 0;\n\n this.colTypeCounts = new Array()\n this._RC_TypeTable = new Array()\n this.stringTypes = new Object() //Hash from strings to types\n this.topTypes = new Array()\n this.stringProps = new Object() //Types and property values for each string\n this.props = new Object() //Properties and property types for each type\n this.cosineDistance = new Array() //Stores cosine distance between numeric properties and numeric columns\n this.absDistance = new Array() //Stores absolute magnitude distance between numeric properties and numeric columns\n this.stringInstanceDistance = new Array() //Stores average string distance between attributes and column values\n this.propHeaderEditDistance = new Array() //Stores edit distance between each column and each property of each type\n this.columnTypes = new Array();\n this.propCounts = new Object() //Stores the frequency of each property's value\n\n\n //this.numberRe = new RegExp(/^[\\s\\n]*[\\d,\\.]+[\\s\\n]*$/)\n this.numberRe = new RegExp(/^[\\s\\n]*[\\d,\\.]+\\s*\\w{0,5}[\\s\\n]*$/)\n this.entityRe = new RegExp(/^(\\d\\.)?[\\s\\n]*[a-zA-z]/) //Entity should at least start w/ A-Z\n\n this.computeColumnTypes();\n}", "title": "" }, { "docid": "1a8378c23f17eb38b47a2d45264c129d", "score": "0.5686544", "text": "function cell(rows,cols,boxes,pos) {\n this.rows = rows\n this.cols = cols\n this.boxes = boxes\n this.pos = pos\n }", "title": "" }, { "docid": "c6329202e8564b40d7053619fcb7eda4", "score": "0.567196", "text": "function createBodyTd() {\r\n var rowValue = arguments[0];\r\n var column = arguments[1];\r\n var paramCount = arguments[2];\r\n var subRowIndex = arguments[3];\r\n\r\n if(paramCount === 0 && column.name.indexOf(\".\") === -1){\r\n // this is sub row , no draw for main columns > 0\r\n return null;\r\n }\r\n\r\n var rowspanNumber = 1;\r\n if(column.name.indexOf(\".\") === -1){\r\n rowspanNumber = paramCount;\r\n }\r\n\r\n var name = column.name || \"\";\r\n var value = getDataByKey(rowValue, name, subRowIndex);\r\n var cellFn = column.fn;\r\n var fnResult = null;\r\n var nameForClass = name.replace(\".\", \"\");\r\n var tdDom = $(\"<td class='nowrap wrapByCharacter'></td>\").addClass(\"col-\" + nameForClass);\r\n if(rowspanNumber > 1){\r\n tdDom.attr(\"rowspan\", rowspanNumber);\r\n }\r\n if (cellFn) {\r\n var fnArgs = [value, rowValue, tdDom, subRowIndex];\r\n fnResult = cellFn.apply(null, fnArgs);\r\n if (fnResult === false) {\r\n // nothing to do\r\n } else if (typeof fnResult === \"string\") {\r\n tdDom.text(fnResult);\r\n } else if (typeof fnResult === \"object\") {\r\n tdDom.append(fnResult);\r\n } else {\r\n // nothing to do\r\n }\r\n } else {\r\n tdDom.text(value);\r\n }\r\n return tdDom;\r\n }", "title": "" }, { "docid": "65cb148809b4bbad8a5dd1e769c08054", "score": "0.56692463", "text": "function addTableClass(elm){\n\t\telm.classList.add('stacks-table')\n\t}", "title": "" }, { "docid": "c84741f36b5733329b8bd59e5387c993", "score": "0.56455165", "text": "function tableData(html, cls, sty)\r\n{\r\n\tvar td = document.createElement(\"td\");\r\n\ttd.innerHTML = html;\r\n\tif (cls)\r\n\t\ttd.setAttribute(\"class\", cls);\r\n\tif (sty)\r\n\t\ttd.setAttribute(\"style\", sty);\r\n\treturn td;\r\n}", "title": "" }, { "docid": "963b0d63321d8f488f2a8df67c86c6f0", "score": "0.5633096", "text": "function Cell(div, cellId, offsetLeft, offsetTop) {\n this.element = $(div);\n this.offsetLeft = offsetLeft;\n this.offsetTop = offsetTop;\n this.id = cellId;\n this.checker = {};\n}", "title": "" }, { "docid": "6b70acd3761d737cf7acbd54e28049ab", "score": "0.5630166", "text": "function Cell(red, green, blue)\r\n{\r\n this.red = red;\r\n this.green = green;\r\n this.blue = blue;\r\n}", "title": "" }, { "docid": "fda90484089ca188adafa96237a99c1f", "score": "0.5624402", "text": "function table (P_args) // table object constructor function \n{ \n if (!P_args) return;\n args = P_args.split(\";\"); \n for (var i=0; i < args.length; i++) \n {\n var arg = args[i];\n if (!arg) break; \n parsevalues(arg,this,this.validargs);\n }\n this.columns = new Array();\n this.data = new Array();\n this.selectedrows = new Array();\n this.topHtml = this.calcTopHtml();\n this.bottomHtml = this.calcBottomHtml();\n}", "title": "" }, { "docid": "12c72cc9b5ec95251cee93ed25bf3925", "score": "0.561857", "text": "function TableStruct() {\n }", "title": "" }, { "docid": "70e444bb9525844115d10b6be40a9104", "score": "0.5594024", "text": "function TableHeaderCell(props) {\n var as = props.as,\n className = props.className,\n sorted = props.sorted;\n var classes = Object(__WEBPACK_IMPORTED_MODULE_1_clsx__[\"default\"])(Object(__WEBPACK_IMPORTED_MODULE_4__lib__[\"B\" /* useValueAndKey */])(sorted, 'sorted'), className);\n var rest = Object(__WEBPACK_IMPORTED_MODULE_4__lib__[\"p\" /* getUnhandledProps */])(TableHeaderCell, props);\n return /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_3_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_5__TableCell__[\"a\" /* default */], Object(__WEBPACK_IMPORTED_MODULE_0__babel_runtime_helpers_esm_extends__[\"a\" /* default */])({}, rest, {\n as: as,\n className: classes\n }));\n}", "title": "" }, { "docid": "918394d7a8638e3bbb27cd6c1559c5ce", "score": "0.55843455", "text": "function Table(props) {\n var attached = props.attached,\n basic = props.basic,\n celled = props.celled,\n children = props.children,\n className = props.className,\n collapsing = props.collapsing,\n color = props.color,\n columns = props.columns,\n compact = props.compact,\n definition = props.definition,\n fixed = props.fixed,\n footerRow = props.footerRow,\n headerRow = props.headerRow,\n inverted = props.inverted,\n padded = props.padded,\n renderBodyRow = props.renderBodyRow,\n selectable = props.selectable,\n singleLine = props.singleLine,\n size = props.size,\n sortable = props.sortable,\n stackable = props.stackable,\n striped = props.striped,\n structured = props.structured,\n tableData = props.tableData,\n textAlign = props.textAlign,\n unstackable = props.unstackable,\n verticalAlign = props.verticalAlign;\n\n\n var classes = __WEBPACK_IMPORTED_MODULE_3_classnames___default()('ui', color, size, Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"z\" /* useKeyOnly */])(celled, 'celled'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"z\" /* useKeyOnly */])(collapsing, 'collapsing'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"z\" /* useKeyOnly */])(definition, 'definition'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"z\" /* useKeyOnly */])(fixed, 'fixed'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"z\" /* useKeyOnly */])(inverted, 'inverted'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"z\" /* useKeyOnly */])(selectable, 'selectable'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"z\" /* useKeyOnly */])(singleLine, 'single line'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"z\" /* useKeyOnly */])(sortable, 'sortable'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"z\" /* useKeyOnly */])(stackable, 'stackable'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"z\" /* useKeyOnly */])(striped, 'striped'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"z\" /* useKeyOnly */])(structured, 'structured'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"z\" /* useKeyOnly */])(unstackable, 'unstackable'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"A\" /* useKeyOrValueAndKey */])(attached, 'attached'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"A\" /* useKeyOrValueAndKey */])(basic, 'basic'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"A\" /* useKeyOrValueAndKey */])(compact, 'compact'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"A\" /* useKeyOrValueAndKey */])(padded, 'padded'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"C\" /* useTextAlignProp */])(textAlign), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"E\" /* useVerticalAlignProp */])(verticalAlign), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"F\" /* useWidthProp */])(columns, 'column'), 'table', className);\n var rest = Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"q\" /* getUnhandledProps */])(Table, props);\n var ElementType = Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"p\" /* getElementType */])(Table, props);\n\n if (!__WEBPACK_IMPORTED_MODULE_6__lib__[\"d\" /* childrenUtils */].isNil(children)) {\n return __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(\n ElementType,\n __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, rest, { className: classes }),\n children\n );\n }\n\n return __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(\n ElementType,\n __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, rest, { className: classes }),\n headerRow && __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(\n __WEBPACK_IMPORTED_MODULE_10__TableHeader__[\"a\" /* default */],\n null,\n __WEBPACK_IMPORTED_MODULE_12__TableRow__[\"a\" /* default */].create(headerRow, { defaultProps: { cellAs: 'th' } })\n ),\n __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(\n __WEBPACK_IMPORTED_MODULE_7__TableBody__[\"a\" /* default */],\n null,\n renderBodyRow && __WEBPACK_IMPORTED_MODULE_2_lodash_map___default()(tableData, function (data, index) {\n return __WEBPACK_IMPORTED_MODULE_12__TableRow__[\"a\" /* default */].create(renderBodyRow(data, index));\n })\n ),\n footerRow && __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(\n __WEBPACK_IMPORTED_MODULE_9__TableFooter__[\"a\" /* default */],\n null,\n __WEBPACK_IMPORTED_MODULE_12__TableRow__[\"a\" /* default */].create(footerRow)\n )\n );\n}", "title": "" }, { "docid": "5ed80aa9403a2b599953db422aed2478", "score": "0.5577091", "text": "function SiteTableView(tableNode) {\n if (\n tableNode &&\n tableNode.nodeType &&\n tableNode.nodeType === 1 &&\n tableNode.nodeName === \"TABLE\"\n ) {\n this.tableNode = tableNode;\n this.statusIconClasses = {\n default: \"fa fa-fw fa-minus\",\n pending: \"fa fa-fw fa-exclamation-triangle\",\n fetching: \"fa fa-fw fa-spinner fa-pulse\",\n failed: \"fa fa-fw fa-times-circle\",\n complete: \"fa fa-fw fa-check-circle\"\n };\n } else {\n throw new Error(\n \"SiteTableView instantiated without a <table>\"\n );\n }\n}", "title": "" }, { "docid": "b9107f70420c5ed8c977d32b5d8a9ad9", "score": "0.5575921", "text": "function Table(props) {\n var attached = props.attached,\n basic = props.basic,\n celled = props.celled,\n children = props.children,\n className = props.className,\n collapsing = props.collapsing,\n color = props.color,\n columns = props.columns,\n compact = props.compact,\n definition = props.definition,\n fixed = props.fixed,\n footerRow = props.footerRow,\n headerRow = props.headerRow,\n inverted = props.inverted,\n padded = props.padded,\n renderBodyRow = props.renderBodyRow,\n selectable = props.selectable,\n singleLine = props.singleLine,\n size = props.size,\n sortable = props.sortable,\n stackable = props.stackable,\n striped = props.striped,\n structured = props.structured,\n tableData = props.tableData,\n textAlign = props.textAlign,\n unstackable = props.unstackable,\n verticalAlign = props.verticalAlign;\n\n\n var classes = classnames__WEBPACK_IMPORTED_MODULE_3___default()('ui', color, size, Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(celled, 'celled'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(collapsing, 'collapsing'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(definition, 'definition'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(fixed, 'fixed'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(inverted, 'inverted'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(selectable, 'selectable'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(singleLine, 'single line'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(sortable, 'sortable'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(stackable, 'stackable'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(striped, 'striped'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(structured, 'structured'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(unstackable, 'unstackable'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOrValueAndKey\"])(attached, 'attached'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOrValueAndKey\"])(basic, 'basic'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOrValueAndKey\"])(compact, 'compact'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOrValueAndKey\"])(padded, 'padded'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useTextAlignProp\"])(textAlign), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useVerticalAlignProp\"])(verticalAlign), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useWidthProp\"])(columns, 'column'), 'table', className);\n var rest = Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"getUnhandledProps\"])(Table, props);\n var ElementType = Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"getElementType\"])(Table, props);\n\n if (!_lib__WEBPACK_IMPORTED_MODULE_6__[\"childrenUtils\"].isNil(children)) {\n return react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(\n ElementType,\n babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, { className: classes }),\n children\n );\n }\n\n return react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(\n ElementType,\n babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, { className: classes }),\n headerRow && react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(\n _TableHeader__WEBPACK_IMPORTED_MODULE_10__[\"default\"],\n null,\n _TableRow__WEBPACK_IMPORTED_MODULE_12__[\"default\"].create(headerRow, { defaultProps: { cellAs: 'th' } })\n ),\n react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(\n _TableBody__WEBPACK_IMPORTED_MODULE_7__[\"default\"],\n null,\n renderBodyRow && lodash_map__WEBPACK_IMPORTED_MODULE_2___default()(tableData, function (data, index) {\n return _TableRow__WEBPACK_IMPORTED_MODULE_12__[\"default\"].create(renderBodyRow(data, index));\n })\n ),\n footerRow && react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(\n _TableFooter__WEBPACK_IMPORTED_MODULE_9__[\"default\"],\n null,\n _TableRow__WEBPACK_IMPORTED_MODULE_12__[\"default\"].create(footerRow)\n )\n );\n}", "title": "" }, { "docid": "4fac218b9a86b7ba8ef35ec780f201b2", "score": "0.55749077", "text": "function getClassName(location) {\r\n var cellClass = 'cell-' + location.i + '-' + location.j;\r\n return cellClass;\r\n}", "title": "" }, { "docid": "4fac218b9a86b7ba8ef35ec780f201b2", "score": "0.55749077", "text": "function getClassName(location) {\r\n var cellClass = 'cell-' + location.i + '-' + location.j;\r\n return cellClass;\r\n}", "title": "" }, { "docid": "4fac218b9a86b7ba8ef35ec780f201b2", "score": "0.55749077", "text": "function getClassName(location) {\r\n var cellClass = 'cell-' + location.i + '-' + location.j;\r\n return cellClass;\r\n}", "title": "" }, { "docid": "4fac218b9a86b7ba8ef35ec780f201b2", "score": "0.55749077", "text": "function getClassName(location) {\r\n var cellClass = 'cell-' + location.i + '-' + location.j;\r\n return cellClass;\r\n}", "title": "" }, { "docid": "b03659b252ff4210aa3806721d5fae13", "score": "0.55734587", "text": "function tntRCligneBlanche6Col() {\r\n\treturn(\"<tr height='\" + tntRCsize8 + \"'><td class='tntRCblanc' colspan='6'></td></td></tr>\");\r\n}", "title": "" }, { "docid": "d634cbe898ca53537623f54b8e2fe248", "score": "0.5567639", "text": "function Table(props) {\n var attached = props.attached,\n basic = props.basic,\n celled = props.celled,\n children = props.children,\n className = props.className,\n collapsing = props.collapsing,\n color = props.color,\n columns = props.columns,\n compact = props.compact,\n definition = props.definition,\n fixed = props.fixed,\n footerRow = props.footerRow,\n headerRow = props.headerRow,\n inverted = props.inverted,\n padded = props.padded,\n renderBodyRow = props.renderBodyRow,\n selectable = props.selectable,\n singleLine = props.singleLine,\n size = props.size,\n sortable = props.sortable,\n stackable = props.stackable,\n striped = props.striped,\n structured = props.structured,\n tableData = props.tableData,\n textAlign = props.textAlign,\n unstackable = props.unstackable,\n verticalAlign = props.verticalAlign;\n\n\n var classes = __WEBPACK_IMPORTED_MODULE_3_classnames___default()('ui', color, size, Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"y\" /* useKeyOnly */])(celled, 'celled'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"y\" /* useKeyOnly */])(collapsing, 'collapsing'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"y\" /* useKeyOnly */])(definition, 'definition'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"y\" /* useKeyOnly */])(fixed, 'fixed'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"y\" /* useKeyOnly */])(inverted, 'inverted'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"y\" /* useKeyOnly */])(selectable, 'selectable'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"y\" /* useKeyOnly */])(singleLine, 'single line'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"y\" /* useKeyOnly */])(sortable, 'sortable'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"y\" /* useKeyOnly */])(stackable, 'stackable'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"y\" /* useKeyOnly */])(striped, 'striped'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"y\" /* useKeyOnly */])(structured, 'structured'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"y\" /* useKeyOnly */])(unstackable, 'unstackable'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"z\" /* useKeyOrValueAndKey */])(attached, 'attached'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"z\" /* useKeyOrValueAndKey */])(basic, 'basic'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"z\" /* useKeyOrValueAndKey */])(compact, 'compact'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"z\" /* useKeyOrValueAndKey */])(padded, 'padded'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"B\" /* useTextAlignProp */])(textAlign), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"D\" /* useVerticalAlignProp */])(verticalAlign), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"E\" /* useWidthProp */])(columns, 'column'), 'table', className);\n var rest = Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"p\" /* getUnhandledProps */])(Table, props);\n var ElementType = Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"o\" /* getElementType */])(Table, props);\n\n if (!__WEBPACK_IMPORTED_MODULE_6__lib__[\"d\" /* childrenUtils */].isNil(children)) {\n return __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(\n ElementType,\n __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, rest, { className: classes }),\n children\n );\n }\n\n return __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(\n ElementType,\n __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, rest, { className: classes }),\n headerRow && __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(\n __WEBPACK_IMPORTED_MODULE_10__TableHeader__[\"a\" /* default */],\n null,\n __WEBPACK_IMPORTED_MODULE_12__TableRow__[\"a\" /* default */].create(headerRow, { defaultProps: { cellAs: 'th' } })\n ),\n __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(\n __WEBPACK_IMPORTED_MODULE_7__TableBody__[\"a\" /* default */],\n null,\n renderBodyRow && __WEBPACK_IMPORTED_MODULE_2_lodash_map___default()(tableData, function (data, index) {\n return __WEBPACK_IMPORTED_MODULE_12__TableRow__[\"a\" /* default */].create(renderBodyRow(data, index));\n })\n ),\n footerRow && __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(\n __WEBPACK_IMPORTED_MODULE_9__TableFooter__[\"a\" /* default */],\n null,\n __WEBPACK_IMPORTED_MODULE_12__TableRow__[\"a\" /* default */].create(footerRow)\n )\n );\n}", "title": "" }, { "docid": "d4628033c2a793ae45199d7f1e3737c3", "score": "0.55662215", "text": "function Table(props) {\n var attached = props.attached,\n basic = props.basic,\n celled = props.celled,\n children = props.children,\n className = props.className,\n collapsing = props.collapsing,\n color = props.color,\n columns = props.columns,\n compact = props.compact,\n definition = props.definition,\n fixed = props.fixed,\n footerRow = props.footerRow,\n headerRow = props.headerRow,\n headerRows = props.headerRows,\n inverted = props.inverted,\n padded = props.padded,\n renderBodyRow = props.renderBodyRow,\n selectable = props.selectable,\n singleLine = props.singleLine,\n size = props.size,\n sortable = props.sortable,\n stackable = props.stackable,\n striped = props.striped,\n structured = props.structured,\n tableData = props.tableData,\n textAlign = props.textAlign,\n unstackable = props.unstackable,\n verticalAlign = props.verticalAlign;\n var classes = classnames__WEBPACK_IMPORTED_MODULE_3___default()('ui', color, size, Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(celled, 'celled'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(collapsing, 'collapsing'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(definition, 'definition'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(fixed, 'fixed'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(inverted, 'inverted'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(selectable, 'selectable'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(singleLine, 'single line'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(sortable, 'sortable'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(stackable, 'stackable'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(striped, 'striped'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(structured, 'structured'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(unstackable, 'unstackable'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOrValueAndKey\"])(attached, 'attached'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOrValueAndKey\"])(basic, 'basic'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOrValueAndKey\"])(compact, 'compact'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOrValueAndKey\"])(padded, 'padded'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useTextAlignProp\"])(textAlign), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useVerticalAlignProp\"])(verticalAlign), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useWidthProp\"])(columns, 'column'), 'table', className);\n var rest = Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"getUnhandledProps\"])(Table, props);\n var ElementType = Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"getElementType\"])(Table, props);\n\n if (!_lib__WEBPACK_IMPORTED_MODULE_6__[\"childrenUtils\"].isNil(children)) {\n return react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(ElementType, _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, {\n className: classes\n }), children);\n }\n\n var hasHeaderRows = headerRow || headerRows;\n var headerShorthandOptions = {\n defaultProps: {\n cellAs: 'th'\n }\n };\n var headerElement = hasHeaderRows && react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(_TableHeader__WEBPACK_IMPORTED_MODULE_10__[\"default\"], null, _TableRow__WEBPACK_IMPORTED_MODULE_12__[\"default\"].create(headerRow, headerShorthandOptions), lodash_map__WEBPACK_IMPORTED_MODULE_2___default()(headerRows, function (data) {\n return _TableRow__WEBPACK_IMPORTED_MODULE_12__[\"default\"].create(data, headerShorthandOptions);\n }));\n return react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(ElementType, _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, {\n className: classes\n }), headerElement, react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(_TableBody__WEBPACK_IMPORTED_MODULE_7__[\"default\"], null, renderBodyRow && lodash_map__WEBPACK_IMPORTED_MODULE_2___default()(tableData, function (data, index) {\n return _TableRow__WEBPACK_IMPORTED_MODULE_12__[\"default\"].create(renderBodyRow(data, index));\n })), footerRow && react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(_TableFooter__WEBPACK_IMPORTED_MODULE_9__[\"default\"], null, _TableRow__WEBPACK_IMPORTED_MODULE_12__[\"default\"].create(footerRow)));\n}", "title": "" }, { "docid": "d4628033c2a793ae45199d7f1e3737c3", "score": "0.55662215", "text": "function Table(props) {\n var attached = props.attached,\n basic = props.basic,\n celled = props.celled,\n children = props.children,\n className = props.className,\n collapsing = props.collapsing,\n color = props.color,\n columns = props.columns,\n compact = props.compact,\n definition = props.definition,\n fixed = props.fixed,\n footerRow = props.footerRow,\n headerRow = props.headerRow,\n headerRows = props.headerRows,\n inverted = props.inverted,\n padded = props.padded,\n renderBodyRow = props.renderBodyRow,\n selectable = props.selectable,\n singleLine = props.singleLine,\n size = props.size,\n sortable = props.sortable,\n stackable = props.stackable,\n striped = props.striped,\n structured = props.structured,\n tableData = props.tableData,\n textAlign = props.textAlign,\n unstackable = props.unstackable,\n verticalAlign = props.verticalAlign;\n var classes = classnames__WEBPACK_IMPORTED_MODULE_3___default()('ui', color, size, Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(celled, 'celled'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(collapsing, 'collapsing'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(definition, 'definition'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(fixed, 'fixed'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(inverted, 'inverted'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(selectable, 'selectable'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(singleLine, 'single line'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(sortable, 'sortable'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(stackable, 'stackable'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(striped, 'striped'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(structured, 'structured'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(unstackable, 'unstackable'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOrValueAndKey\"])(attached, 'attached'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOrValueAndKey\"])(basic, 'basic'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOrValueAndKey\"])(compact, 'compact'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOrValueAndKey\"])(padded, 'padded'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useTextAlignProp\"])(textAlign), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useVerticalAlignProp\"])(verticalAlign), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useWidthProp\"])(columns, 'column'), 'table', className);\n var rest = Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"getUnhandledProps\"])(Table, props);\n var ElementType = Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"getElementType\"])(Table, props);\n\n if (!_lib__WEBPACK_IMPORTED_MODULE_6__[\"childrenUtils\"].isNil(children)) {\n return react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(ElementType, _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, {\n className: classes\n }), children);\n }\n\n var hasHeaderRows = headerRow || headerRows;\n var headerShorthandOptions = {\n defaultProps: {\n cellAs: 'th'\n }\n };\n var headerElement = hasHeaderRows && react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(_TableHeader__WEBPACK_IMPORTED_MODULE_10__[\"default\"], null, _TableRow__WEBPACK_IMPORTED_MODULE_12__[\"default\"].create(headerRow, headerShorthandOptions), lodash_map__WEBPACK_IMPORTED_MODULE_2___default()(headerRows, function (data) {\n return _TableRow__WEBPACK_IMPORTED_MODULE_12__[\"default\"].create(data, headerShorthandOptions);\n }));\n return react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(ElementType, _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, {\n className: classes\n }), headerElement, react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(_TableBody__WEBPACK_IMPORTED_MODULE_7__[\"default\"], null, renderBodyRow && lodash_map__WEBPACK_IMPORTED_MODULE_2___default()(tableData, function (data, index) {\n return _TableRow__WEBPACK_IMPORTED_MODULE_12__[\"default\"].create(renderBodyRow(data, index));\n })), footerRow && react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(_TableFooter__WEBPACK_IMPORTED_MODULE_9__[\"default\"], null, _TableRow__WEBPACK_IMPORTED_MODULE_12__[\"default\"].create(footerRow)));\n}", "title": "" }, { "docid": "d4628033c2a793ae45199d7f1e3737c3", "score": "0.55662215", "text": "function Table(props) {\n var attached = props.attached,\n basic = props.basic,\n celled = props.celled,\n children = props.children,\n className = props.className,\n collapsing = props.collapsing,\n color = props.color,\n columns = props.columns,\n compact = props.compact,\n definition = props.definition,\n fixed = props.fixed,\n footerRow = props.footerRow,\n headerRow = props.headerRow,\n headerRows = props.headerRows,\n inverted = props.inverted,\n padded = props.padded,\n renderBodyRow = props.renderBodyRow,\n selectable = props.selectable,\n singleLine = props.singleLine,\n size = props.size,\n sortable = props.sortable,\n stackable = props.stackable,\n striped = props.striped,\n structured = props.structured,\n tableData = props.tableData,\n textAlign = props.textAlign,\n unstackable = props.unstackable,\n verticalAlign = props.verticalAlign;\n var classes = classnames__WEBPACK_IMPORTED_MODULE_3___default()('ui', color, size, Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(celled, 'celled'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(collapsing, 'collapsing'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(definition, 'definition'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(fixed, 'fixed'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(inverted, 'inverted'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(selectable, 'selectable'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(singleLine, 'single line'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(sortable, 'sortable'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(stackable, 'stackable'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(striped, 'striped'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(structured, 'structured'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOnly\"])(unstackable, 'unstackable'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOrValueAndKey\"])(attached, 'attached'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOrValueAndKey\"])(basic, 'basic'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOrValueAndKey\"])(compact, 'compact'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useKeyOrValueAndKey\"])(padded, 'padded'), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useTextAlignProp\"])(textAlign), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useVerticalAlignProp\"])(verticalAlign), Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"useWidthProp\"])(columns, 'column'), 'table', className);\n var rest = Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"getUnhandledProps\"])(Table, props);\n var ElementType = Object(_lib__WEBPACK_IMPORTED_MODULE_6__[\"getElementType\"])(Table, props);\n\n if (!_lib__WEBPACK_IMPORTED_MODULE_6__[\"childrenUtils\"].isNil(children)) {\n return react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(ElementType, _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, {\n className: classes\n }), children);\n }\n\n var hasHeaderRows = headerRow || headerRows;\n var headerShorthandOptions = {\n defaultProps: {\n cellAs: 'th'\n }\n };\n var headerElement = hasHeaderRows && react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(_TableHeader__WEBPACK_IMPORTED_MODULE_10__[\"default\"], null, _TableRow__WEBPACK_IMPORTED_MODULE_12__[\"default\"].create(headerRow, headerShorthandOptions), lodash_map__WEBPACK_IMPORTED_MODULE_2___default()(headerRows, function (data) {\n return _TableRow__WEBPACK_IMPORTED_MODULE_12__[\"default\"].create(data, headerShorthandOptions);\n }));\n return react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(ElementType, _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, {\n className: classes\n }), headerElement, react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(_TableBody__WEBPACK_IMPORTED_MODULE_7__[\"default\"], null, renderBodyRow && lodash_map__WEBPACK_IMPORTED_MODULE_2___default()(tableData, function (data, index) {\n return _TableRow__WEBPACK_IMPORTED_MODULE_12__[\"default\"].create(renderBodyRow(data, index));\n })), footerRow && react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(_TableFooter__WEBPACK_IMPORTED_MODULE_9__[\"default\"], null, _TableRow__WEBPACK_IMPORTED_MODULE_12__[\"default\"].create(footerRow)));\n}", "title": "" }, { "docid": "4a0a4d2e15b97e1015b821193ff2bb53", "score": "0.55631274", "text": "function getClassName(location) {\r\n var cellClass = 'cell-' + location.i + '-' + location.j;\r\n return cellClass;\r\n}", "title": "" }, { "docid": "0fc1b917b3f8d44a80e5800eb5e08002", "score": "0.5560366", "text": "_getRowClass({rowIndex, data}) {\n const operation = data[rowIndex].operation;\n if (!operation) {\n return null;\n }\n if (operation === 'ADD') {\n return 'bg-success';\n }\n if (operation === 'REMOVE') {\n return 'bg-danger';\n }\n if (operation === 'UPDATE') {\n return 'bg-warning';\n }\n return null;\n }", "title": "" }, { "docid": "6372966817ad73291a1066345dd27dd8", "score": "0.5555535", "text": "function updateCell(cell,symbol){\r\n $(\"#cell-\"+cell+\" i\").addClass(symbol)\r\n}", "title": "" }, { "docid": "72149acbfec768cba1fea3197a31dfb1", "score": "0.555483", "text": "get style() {\n return this.cellStyle;\n }", "title": "" }, { "docid": "72149acbfec768cba1fea3197a31dfb1", "score": "0.555483", "text": "get style() {\n return this.cellStyle;\n }", "title": "" }, { "docid": "9b66132600e3d4aca8b422574e477ce8", "score": "0.554543", "text": "function Table(props) {\n var attached = props.attached,\n basic = props.basic,\n celled = props.celled,\n children = props.children,\n className = props.className,\n collapsing = props.collapsing,\n color = props.color,\n columns = props.columns,\n compact = props.compact,\n definition = props.definition,\n fixed = props.fixed,\n footerRow = props.footerRow,\n headerRow = props.headerRow,\n inverted = props.inverted,\n padded = props.padded,\n renderBodyRow = props.renderBodyRow,\n selectable = props.selectable,\n singleLine = props.singleLine,\n size = props.size,\n sortable = props.sortable,\n stackable = props.stackable,\n striped = props.striped,\n structured = props.structured,\n tableData = props.tableData,\n textAlign = props.textAlign,\n unstackable = props.unstackable,\n verticalAlign = props.verticalAlign;\n var classes = __WEBPACK_IMPORTED_MODULE_3_classnames___default()('ui', color, size, Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"A\" /* useKeyOnly */])(celled, 'celled'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"A\" /* useKeyOnly */])(collapsing, 'collapsing'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"A\" /* useKeyOnly */])(definition, 'definition'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"A\" /* useKeyOnly */])(fixed, 'fixed'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"A\" /* useKeyOnly */])(inverted, 'inverted'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"A\" /* useKeyOnly */])(selectable, 'selectable'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"A\" /* useKeyOnly */])(singleLine, 'single line'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"A\" /* useKeyOnly */])(sortable, 'sortable'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"A\" /* useKeyOnly */])(stackable, 'stackable'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"A\" /* useKeyOnly */])(striped, 'striped'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"A\" /* useKeyOnly */])(structured, 'structured'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"A\" /* useKeyOnly */])(unstackable, 'unstackable'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"B\" /* useKeyOrValueAndKey */])(attached, 'attached'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"B\" /* useKeyOrValueAndKey */])(basic, 'basic'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"B\" /* useKeyOrValueAndKey */])(compact, 'compact'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"B\" /* useKeyOrValueAndKey */])(padded, 'padded'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"D\" /* useTextAlignProp */])(textAlign), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"F\" /* useVerticalAlignProp */])(verticalAlign), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"G\" /* useWidthProp */])(columns, 'column'), 'table', className);\n var rest = Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"r\" /* getUnhandledProps */])(Table, props);\n var ElementType = Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"q\" /* getElementType */])(Table, props);\n\n if (!__WEBPACK_IMPORTED_MODULE_6__lib__[\"c\" /* childrenUtils */].isNil(children)) {\n return __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(ElementType, __WEBPACK_IMPORTED_MODULE_0__babel_runtime_helpers_extends___default()({}, rest, {\n className: classes\n }), children);\n }\n\n return __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(ElementType, __WEBPACK_IMPORTED_MODULE_0__babel_runtime_helpers_extends___default()({}, rest, {\n className: classes\n }), headerRow && __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_10__TableHeader__[\"a\" /* default */], null, __WEBPACK_IMPORTED_MODULE_12__TableRow__[\"a\" /* default */].create(headerRow, {\n defaultProps: {\n cellAs: 'th'\n }\n })), __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_7__TableBody__[\"a\" /* default */], null, renderBodyRow && __WEBPACK_IMPORTED_MODULE_2_lodash_map___default()(tableData, function (data, index) {\n return __WEBPACK_IMPORTED_MODULE_12__TableRow__[\"a\" /* default */].create(renderBodyRow(data, index));\n })), footerRow && __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_9__TableFooter__[\"a\" /* default */], null, __WEBPACK_IMPORTED_MODULE_12__TableRow__[\"a\" /* default */].create(footerRow)));\n}", "title": "" }, { "docid": "ac23e5b383862af5f41f0ec5e60d0d86", "score": "0.55404156", "text": "function Table(config) {\n var t = this;\n\n /**\n * The Table will be appended to this element\n * @type {HTMLElement}\n */\n t.el = config.el;\n\n\n /**\n * The name to display for the table\n * @type {Array}\n */\n var _name = config.name;\n\n\n /**\n * The field names to display for the columns\n * @type {Array}\n */\n var _fields = config.fields;\n\n\n /**\n * Create a rows for the table\n * @param values {Array} The cell values\n * @param header {boolean} true if header <th>\n * @returns {*HTMLElement} the <tr>\n * @private\n */\n function _makeRow(values, header) {\n var html = '<tr>';\n var tag = header ? 'th' : 'td';\n for (var i = 0; i < values.length; i++) {\n html += '<' + tag + '>' + (values[i] || '') + '</' + tag + '>';\n }\n html += '</tr>';\n return html;\n }\n\n\n /**\n * Adds a row to the bottom of the table\n * @param values {Array}\n */\n t.pushRow = function (values) {\n t._bodyEl.innerHTML += _makeRow(values);\n return t;\n };\n\n\n /**\n * Pops the row out of the table\n * @param processRowFunction {function} called after\n * row is removed with the row passed as argument\n */\n t.popRow = function (processRowFunction) {\n var row = [];\n var trEls = t.el.querySelectorAll('tbody tr');\n if (trEls.length === 0) {\n processRowFunction(null);\n } else {\n var tds = trEls[0].querySelectorAll('td');\n for (var i = 0; i < tds.length; i++) {\n row.push(tds[i].innerText);\n }\n t._bodyEl.removeChild(trEls[0]);\n processRowFunction(row);\n }\n return this;\n };\n\n\n /**\n * Are there rows in the table\n * @returns {boolean}\n */\n t.hasRows = function () {\n return t.el.querySelectorAll('tbody tr').length !== 0;\n };\n\n\n /**\n * Render the table\n * @returns {Table}\n */\n t.create = function () {\n var html = '<table><caption>' + (_name || '') + '</caption>' +\n '<thead>' + _makeRow(_fields, true) + '</thead>' +\n '<tbody></tbody></table>';\n t.el.innerHTML = html;\n t._bodyEl = t.el.querySelector('tbody');\n return t;\n };\n}", "title": "" }, { "docid": "0da5db8d10c5a07506def4f66e8419de", "score": "0.55309916", "text": "function getClassName(location) {\r\n var cellClass = '.cell-' + location.i + '-' + location.j;\r\n return cellClass;\r\n}", "title": "" }, { "docid": "0be137f7a267393daec89d47d574b2ed", "score": "0.55166584", "text": "function cellRenderer(val,cell){\n\n\t\tif(cellROW==1)\n\t\t\tcell.css = \"utilisateur\";\n\t\t/*else if(cellROW==2)\n\t\t\tcell.css = \"modérateur\";*/\n\t\telse if(cellROW==3)\n\t\t\tcell.css = \"administrateur\";\n\n return val;\n }", "title": "" }, { "docid": "d11c4afe4f03127bcfc09f3c5198e90f", "score": "0.5515748", "text": "viewUpdate() {\n for (const cell of this.gameBody) {\n //first we will remove all additional classes in all cells\n cell.element.classList.remove(\n \"error\",\n \"important-cell\",\n \"supported-cell\",\n \"selected-cell\"\n );\n cell.element.value = cell.number ? cell.number : \"\";\n //hang only on supported cells\n if (cell.supported) {\n cell.element.classList.add(\"supported-cell\");\n }\n // hang only on selected cells\n if (cell.selected) {\n cell.element.classList.add(\"selected-cell\");\n }\n // hang only on cells with identical elements\n if (cell.important) {\n cell.element.classList.add(\"important-cell\");\n }\n // hang on errors (coincidence of elements in the table, in a row, in a segment)\n // css class אם לא המהלך הנכון הוסף\n if (cell.error) {\n cell.element.classList.add(\"error\");\n }\n }\n }", "title": "" }, { "docid": "41ebc242f371ad6c7407dda4b73280e6", "score": "0.55135", "text": "function Table(){}", "title": "" }, { "docid": "6167f111afb6c977326ad779895eb468", "score": "0.55117804", "text": "constructor(config = {}) {\n this.cells = {};\n this.config = {\n debug: false,\n /** @type HTMLElement */\n table: null,\n /** @type HTMLElement */\n itemContainer: null,\n items: {},\n cellSize: [100, 100],\n rows: 10,\n columns: 10,\n gridClass: 'iso-dom',\n rowClass: 'iso-dom__row',\n columnClass: 'iso-dom__column',\n itemContainerClass: 'iso-dom-items',\n cellCreated(node, cell, iso) {\n // Do nothing\n },\n cellPosition(cell) {\n // TODO using jQuery\n return $(cell.el).position();\n },\n };\n\n Object.assign(this.config, config);\n\n // Validate table\n if (!this.config.table || this.config.table.nodeName !== 'TABLE') {\n throw new Error('`table` config property must be set and must be table element.');\n }\n\n // Validate item container\n if (!this.config.itemContainer || !this.config.itemContainer.nodeName) {\n throw new Error('`itemContainer` config property must be set and must be an element.');\n }\n\n // Set grid size and add classes\n this.config.table.style.width = (this.config.columns * this.config.cellSize[0]) + 'px';\n this.config.table.style.height = (this.config.rows * this.config.cellSize[1]) + 'px';\n this.config.table.classList.add(this.config.gridClass);\n this.config.itemContainer.classList.add(this.config.itemContainerClass);\n\n if (this.config.debug) {\n this.config.table.classList.add('iso-dom--debug');\n }\n\n this._createGrid();\n }", "title": "" }, { "docid": "5e12f2802e4ec61d5f3da8d19f242513", "score": "0.5499552", "text": "function TableHeaderCell(props) {\n var as = props.as,\n className = props.className,\n sorted = props.sorted;\n\n var classes = __WEBPACK_IMPORTED_MODULE_1_classnames___default()(Object(__WEBPACK_IMPORTED_MODULE_4__lib__[\"D\" /* useValueAndKey */])(sorted, 'sorted'), className);\n var rest = Object(__WEBPACK_IMPORTED_MODULE_4__lib__[\"q\" /* getUnhandledProps */])(TableHeaderCell, props);\n\n return __WEBPACK_IMPORTED_MODULE_3_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_5__TableCell__[\"a\" /* default */], __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, rest, { as: as, className: classes }));\n}", "title": "" }, { "docid": "10ff316b0c3b519ac7935e588119e1ec", "score": "0.54915667", "text": "function TableHeaderCell(props) {\n var as = props.as,\n className = props.className,\n sorted = props.sorted;\n var classes = __WEBPACK_IMPORTED_MODULE_1_classnames___default()(Object(__WEBPACK_IMPORTED_MODULE_4__lib__[\"E\" /* useValueAndKey */])(sorted, 'sorted'), className);\n var rest = Object(__WEBPACK_IMPORTED_MODULE_4__lib__[\"r\" /* getUnhandledProps */])(TableHeaderCell, props);\n return __WEBPACK_IMPORTED_MODULE_3_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_5__TableCell__[\"a\" /* default */], __WEBPACK_IMPORTED_MODULE_0__babel_runtime_helpers_extends___default()({}, rest, {\n as: as,\n className: classes\n }));\n}", "title": "" }, { "docid": "ca6c3623774e34430c2743bc7817425a", "score": "0.5487412", "text": "function setCell( row, col, on )\n{\n document.getElementById( \"cell\" + row + col ).className = on ? \"cellOn\" : \"cellOff\";\n}", "title": "" }, { "docid": "99f7e87f762a992b85da2cf19e20586b", "score": "0.54862946", "text": "function generateColumnClasses() {\n return [\n \"reimbId\",\n \"reimbAmount\",\n \"reimbAuthor\",\n \"reimbSubmitted\",\n \"reimbDescription\",\n \"reimbType\",\n \"reimbStatus\",\n \"reimbResolver\",\n \"reimbResolved\"\n ]\n}", "title": "" }, { "docid": "20b5958433022ea6aa5ad130256593f7", "score": "0.54774755", "text": "function getClassName(location) {\r\n\tvar cellClass = 'cell-' + location.i + '-' + location.j;\r\n\treturn cellClass;\r\n}", "title": "" }, { "docid": "7250d9c4e06b090205e090b1a946000f", "score": "0.5475831", "text": "function UnderlinedCell(inner) {\n this.inner = inner;\n}", "title": "" }, { "docid": "057b3ec7b1b50d30b3c7189bbb425a02", "score": "0.54741293", "text": "function TableHeaderCell(props) {\n var as = props.as,\n className = props.className,\n sorted = props.sorted;\n\n var classes = __WEBPACK_IMPORTED_MODULE_1_classnames___default()(Object(__WEBPACK_IMPORTED_MODULE_4__lib__[\"C\" /* useValueAndKey */])(sorted, 'sorted'), className);\n var rest = Object(__WEBPACK_IMPORTED_MODULE_4__lib__[\"p\" /* getUnhandledProps */])(TableHeaderCell, props);\n\n return __WEBPACK_IMPORTED_MODULE_3_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_5__TableCell__[\"a\" /* default */], __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, rest, { as: as, className: classes }));\n}", "title": "" }, { "docid": "6665e67edbc36232ceb711a6c588c7be", "score": "0.5472107", "text": "function Table(props) {\n var attached = props.attached,\n basic = props.basic,\n celled = props.celled,\n children = props.children,\n className = props.className,\n collapsing = props.collapsing,\n color = props.color,\n columns = props.columns,\n compact = props.compact,\n definition = props.definition,\n fixed = props.fixed,\n footerRow = props.footerRow,\n headerRow = props.headerRow,\n headerRows = props.headerRows,\n inverted = props.inverted,\n padded = props.padded,\n renderBodyRow = props.renderBodyRow,\n selectable = props.selectable,\n singleLine = props.singleLine,\n size = props.size,\n sortable = props.sortable,\n stackable = props.stackable,\n striped = props.striped,\n structured = props.structured,\n tableData = props.tableData,\n textAlign = props.textAlign,\n unstackable = props.unstackable,\n verticalAlign = props.verticalAlign;\n var classes = (0, _classnames.default)('ui', color, size, (0, _lib.useKeyOnly)(celled, 'celled'), (0, _lib.useKeyOnly)(collapsing, 'collapsing'), (0, _lib.useKeyOnly)(definition, 'definition'), (0, _lib.useKeyOnly)(fixed, 'fixed'), (0, _lib.useKeyOnly)(inverted, 'inverted'), (0, _lib.useKeyOnly)(selectable, 'selectable'), (0, _lib.useKeyOnly)(singleLine, 'single line'), (0, _lib.useKeyOnly)(sortable, 'sortable'), (0, _lib.useKeyOnly)(stackable, 'stackable'), (0, _lib.useKeyOnly)(striped, 'striped'), (0, _lib.useKeyOnly)(structured, 'structured'), (0, _lib.useKeyOnly)(unstackable, 'unstackable'), (0, _lib.useKeyOrValueAndKey)(attached, 'attached'), (0, _lib.useKeyOrValueAndKey)(basic, 'basic'), (0, _lib.useKeyOrValueAndKey)(compact, 'compact'), (0, _lib.useKeyOrValueAndKey)(padded, 'padded'), (0, _lib.useTextAlignProp)(textAlign), (0, _lib.useVerticalAlignProp)(verticalAlign), (0, _lib.useWidthProp)(columns, 'column'), 'table', className);\n var rest = (0, _lib.getUnhandledProps)(Table, props);\n var ElementType = (0, _lib.getElementType)(Table, props);\n\n if (!_lib.childrenUtils.isNil(children)) {\n return _react.default.createElement(ElementType, (0, _extends2.default)({}, rest, {\n className: classes\n }), children);\n }\n\n var hasHeaderRows = headerRow || headerRows;\n var headerShorthandOptions = {\n defaultProps: {\n cellAs: 'th'\n }\n };\n\n var headerElement = hasHeaderRows && _react.default.createElement(_TableHeader.default, null, _TableRow.default.create(headerRow, headerShorthandOptions), (0, _map2.default)(headerRows, function (data) {\n return _TableRow.default.create(data, headerShorthandOptions);\n }));\n\n return _react.default.createElement(ElementType, (0, _extends2.default)({}, rest, {\n className: classes\n }), headerElement, _react.default.createElement(_TableBody.default, null, renderBodyRow && (0, _map2.default)(tableData, function (data, index) {\n return _TableRow.default.create(renderBodyRow(data, index));\n })), footerRow && _react.default.createElement(_TableFooter.default, null, _TableRow.default.create(footerRow)));\n}", "title": "" }, { "docid": "610a6b9113ccf803a35aa642ee686c4f", "score": "0.5469146", "text": "function getClassName(location) {\n var cellClass = 'cell-' + location.i + '-' + location.j;\n return cellClass;\n}", "title": "" }, { "docid": "bcbe76123278a80632c107499f7f63ed", "score": "0.5461731", "text": "constructor() {\n super();\n this.addClass(CELL_HEADER_CLASS);\n }", "title": "" }, { "docid": "0e1798ebd7563ab08930688a03e48876", "score": "0.54574084", "text": "function buildTableRowCells(record) {\n\t\n\t// Loop through columns\n\tvar cellsHtml = tableColumns.map(column => {\n\t\t\n\t\t// Get field\n\t\tvar field = dataFields[column.name];\n\t\tvar set = column.set >= 0 ? column.set : record.minIndex;\n\t\t\n\t\t// Build cell content\n\t\t// TODO: add popups for has: values\n\t\tvar content = '', title = '';\n\t\tif (record[set] && record[set][column.name] !== null && record[set][column.name] !== false && record[set][column.name] !== '') {\n\t\t\tvar value = column.has ? (field.abbr ? field.abbr : 'Y') : field.dp ? record[set][column.name].toFixed(field.dp) : escapeHtml(record[set][column.name]);\n\t\t\tcontent = field.link ? `<a href=\"${getLinkAddress(field, record[set])}\">${value}</a>` : value;\n\t\t\ttitle = column.has ? escapeHtml(record[set][column.name]) : '';\n\t\t}\n\t\t\n\t\t// Set classes\n\t\tvar classes = [`sjo-api-cell-${column.has ? '__has_' : ''}${column.name}`];\n\t\tif (field.icon) classes.push('sjo-api-cell-icon');\n\t\tif (content && field.validate && !field.validate.call(this, record[set][column.name], record[set])) classes.push('sjo-api-invalid');\n\t\t\n\t\t// Return cell HTML\n\t\treturn `<td class=\"${classes.join(' ')}\" title=\"${title}\">${content}</td>`;\n\t\t\n\t});\n\t\n\treturn cellsHtml;\n\t\n}", "title": "" }, { "docid": "c55d9157f38f4756e81535ad5906c9e3", "score": "0.5437058", "text": "function renderTable() {\n var row = $('<tr />');\n $('#cider-table-body').append(row);\n row.append($('<td class=\"brand\">' + this.Brand + '</td>'));\n row.append($('<td class=\"cider\">' + this.Cider + '</td>'));\n row.append($('<td class=\"rating\">' + this.Rating + '</td>'));\n row.append($('<td class=\"notes\">' + this.Notes + '</td>'));\n}", "title": "" }, { "docid": "714770364e874f9cba0bee136dc7fe02", "score": "0.54332596", "text": "isCell(cell) {\n return cell.tagName == \"TD\" || cell.tagName == \"TH\";\n }", "title": "" }, { "docid": "eca61342ed42a009cc074ad0b3b3236e", "score": "0.54320663", "text": "function Cells() {\n\n /** Current drag element */\n this.dragChecker = null;\n this.turn = \"white\";\n\n for (let prop in this){\n Object.defineProperty(this, prop, {enumerable:false});\n }\n\n\n /** Sets current checker to the top of all checkers */\n Cells.prototype.setCheckerToTop = function () {\n this.element.parent().append(this.element);\n };\n\n /** Updates the difference between mouse and element */\n Cells.prototype.updateDiff = function (event) {\n this.diffTop = event.clientY - this.offsetTop;\n this.diffLeft = event.clientX - this.offsetLeft;\n };\n\n /**\n * Updates offset in object after successful drop.\n * When the next time clicks on this element,\n * the difference between mouse and element will count from last position\n */\n Cells.prototype.updateCheckerOffset = function (event) {\n this.offsetTop = event.clientY - this.diffTop;\n this.offsetLeft = event.clientX - this.diffLeft;\n }\n}", "title": "" }, { "docid": "5b895eb9b727f72b47c88b5de693100c", "score": "0.5421888", "text": "function makeTableClass(x,y,id){\n\tvar sqID=0;\n\tvar info=\"\";\n\tinfo+=\"<table id='tableCrossSpot' border='1'>\";\n\tfor(var ix=0;ix<x;ix++){\n\t\tinfo+=\"<tr>\";\n\t\tfor(var iy=0;iy<y;iy++){\n\t\t\tinfo+=\"<td title='\"+sqID+\"' onclick='addCrossAns(this);' id='\"+id+sqID+\"'>\"+\"</td>\";\n\t\t\tsqID++;\n\t\t}\n\t\tinfo+=\"</tr>\";\n\t}\n\tinfo+=\"</table>\";\n\treturn info;\n}", "title": "" }, { "docid": "5208a5930ac5dd34fab4338e28eaedf2", "score": "0.54198843", "text": "function cell(clr, pos) {\n this.clr = clr;\n this.pos = pos;\n //this.notation = getnotation.pos; //get notaion from another json object\n}", "title": "" }, { "docid": "2474df275a1da07dae14503f1ae51399", "score": "0.5419318", "text": "createCells() {\n let cellDiv = document.createElement('div')\n cellDiv.classList.add(\"old-cell\")\n return cellDiv\n }", "title": "" }, { "docid": "02c71d7075fa4a1bb738f122e7dfa759", "score": "0.5409445", "text": "function getClassName(location) {\n\tvar cellClass = 'cell-' + location.i + '-' + location.j;\n\treturn cellClass;\n}", "title": "" }, { "docid": "02c71d7075fa4a1bb738f122e7dfa759", "score": "0.5409445", "text": "function getClassName(location) {\n\tvar cellClass = 'cell-' + location.i + '-' + location.j;\n\treturn cellClass;\n}", "title": "" }, { "docid": "02c71d7075fa4a1bb738f122e7dfa759", "score": "0.5409445", "text": "function getClassName(location) {\n\tvar cellClass = 'cell-' + location.i + '-' + location.j;\n\treturn cellClass;\n}", "title": "" }, { "docid": "02c71d7075fa4a1bb738f122e7dfa759", "score": "0.5409445", "text": "function getClassName(location) {\n\tvar cellClass = 'cell-' + location.i + '-' + location.j;\n\treturn cellClass;\n}", "title": "" }, { "docid": "02c71d7075fa4a1bb738f122e7dfa759", "score": "0.5409445", "text": "function getClassName(location) {\n\tvar cellClass = 'cell-' + location.i + '-' + location.j;\n\treturn cellClass;\n}", "title": "" }, { "docid": "23b0f80e16a1de8425383fe71a4a67ec", "score": "0.5400778", "text": "function TableHeaderCell(props) {\n var as = props.as,\n className = props.className,\n sorted = props.sorted;\n var classes = classnames__WEBPACK_IMPORTED_MODULE_1___default()(Object(_lib__WEBPACK_IMPORTED_MODULE_4__[\"useValueAndKey\"])(sorted, 'sorted'), className);\n var rest = Object(_lib__WEBPACK_IMPORTED_MODULE_4__[\"getUnhandledProps\"])(TableHeaderCell, props);\n return react__WEBPACK_IMPORTED_MODULE_3___default.a.createElement(_TableCell__WEBPACK_IMPORTED_MODULE_5__[\"default\"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, {\n as: as,\n className: classes\n }));\n}", "title": "" }, { "docid": "23b0f80e16a1de8425383fe71a4a67ec", "score": "0.5400778", "text": "function TableHeaderCell(props) {\n var as = props.as,\n className = props.className,\n sorted = props.sorted;\n var classes = classnames__WEBPACK_IMPORTED_MODULE_1___default()(Object(_lib__WEBPACK_IMPORTED_MODULE_4__[\"useValueAndKey\"])(sorted, 'sorted'), className);\n var rest = Object(_lib__WEBPACK_IMPORTED_MODULE_4__[\"getUnhandledProps\"])(TableHeaderCell, props);\n return react__WEBPACK_IMPORTED_MODULE_3___default.a.createElement(_TableCell__WEBPACK_IMPORTED_MODULE_5__[\"default\"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, {\n as: as,\n className: classes\n }));\n}", "title": "" }, { "docid": "23b0f80e16a1de8425383fe71a4a67ec", "score": "0.5400778", "text": "function TableHeaderCell(props) {\n var as = props.as,\n className = props.className,\n sorted = props.sorted;\n var classes = classnames__WEBPACK_IMPORTED_MODULE_1___default()(Object(_lib__WEBPACK_IMPORTED_MODULE_4__[\"useValueAndKey\"])(sorted, 'sorted'), className);\n var rest = Object(_lib__WEBPACK_IMPORTED_MODULE_4__[\"getUnhandledProps\"])(TableHeaderCell, props);\n return react__WEBPACK_IMPORTED_MODULE_3___default.a.createElement(_TableCell__WEBPACK_IMPORTED_MODULE_5__[\"default\"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, {\n as: as,\n className: classes\n }));\n}", "title": "" }, { "docid": "e32f0677368600bf7dc3d010dba5038c", "score": "0.54007447", "text": "function getTableData(_row_var_array,_num,_class_offset){\n\t\tvar html=\"\";\n\t\tvar row_array=_row_var_array[_num]//for easy access \n\t\tvar row_span_array=[];//to store the rowspans\t\n\t\t//look ahead to determine rowspan - setting all duplicates to \"\" \n\t\tfor(var i=0;i<row_array.length;i++){\n\t\t\tfor(var j=_num+1;j<_row_var_array.length;j++){\n\t\t\t\tif(_row_var_array[j][i]==row_array[i] && row_array[i]!=\"\"){\n\t\t\t\t\t_row_var_array[j][i]=\"\";\n\t\t\t\t\t//increment val\n\t\t\t\t\tif(isNaN(row_span_array[i])){\n\t\t\t\t\t\trow_span_array[i]=1;\n\t\t\t\t\t}\n\t\t\t\t\trow_span_array[i]++;\n\t\t\t\t}else{\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//\n\t\tfor(var i=0;i<row_array.length;i++){\n\t\t\tvar cell_val=row_array[i];\n\t\t\tvar td_class=getCurrentClass(i+_class_offset);\n\t\t\tif(cell_val!=\"\"){\n\t\t\t\thtml+=\"<td rowspan='\"+row_span_array[i]+\"' class='\"+td_class+\" td_center'>\"+cell_val+\"</td>\";\n\t\t\t}\n\t\t\t\n\t\t}\n\t\treturn html;\n\t}", "title": "" }, { "docid": "2c05b4f8ee87176afdb6b3f86d1cb577", "score": "0.54002124", "text": "function draw(x, y) {\n\tif(table.rows[x].cells[y].hasAttribute(\"class\")){\n table.rows[x].cells[y].setAttribute(\"class\", table.rows[x].cells[y].getAttribute(\"class\") + \" final\");\n console.log(\"hello\");\n }\n else{\n \ttable.rows[x].cells[y].setAttribute(\"class\", \"final\");\n }\n}", "title": "" }, { "docid": "38cb23a53715a6ce943dd3f4398cc0db", "score": "0.5394886", "text": "function genCellHit(cell) {\n document.getElementById(cell).classList.add(\"green-bg\");\n}", "title": "" }, { "docid": "62f4de8c4e5604e8d46691ab37547a41", "score": "0.53847015", "text": "function Table(node) {\n\tthis.node = node;\n\tthis.view = node.view;\n\tthis.content = node.getContent().getContentJSON();\n\t\n\tif(node.studentWork != null) {\n\t\tthis.states = node.studentWork; \n\t} else {\n\t\tthis.states = []; \n\t};\n\t\n\t//boolean values used to determine whether the student has made any changes\n\tthis.tableChanged = false;\n\tthis.responseChanged = false;\n\t\n\tif(this.states.length == 0) {\n\t\t//populate the work from a previous step if a populatePreviousWorkNodeId has been set\n\t\tthis.populatePreviousWork();\n\t}\n\t\n\t//get the default cell size from the authored content\n\tthis.globalCellSize = this.content.globalCellSize;\n\t\n\tif(this.globalCellSize == null || this.globalCellSize == '') {\n\t\t//the author has not specified a default cell size so we will just use 10\n\t\tthis.globalCellSize = 10;\n\t}\n\t\n\t//value used to remember whether the student has rendered the graph\n\tthis.graphRendered = false;\n}", "title": "" }, { "docid": "a5047281f0d9fe9324abc19305832221", "score": "0.5375486", "text": "function TableHeaderCell(props) {\n var as = props.as,\n className = props.className,\n sorted = props.sorted;\n\n var classes = classnames__WEBPACK_IMPORTED_MODULE_1___default()(Object(_lib__WEBPACK_IMPORTED_MODULE_4__[\"useValueAndKey\"])(sorted, 'sorted'), className);\n var rest = Object(_lib__WEBPACK_IMPORTED_MODULE_4__[\"getUnhandledProps\"])(TableHeaderCell, props);\n\n return react__WEBPACK_IMPORTED_MODULE_3___default.a.createElement(_TableCell__WEBPACK_IMPORTED_MODULE_5__[\"default\"], babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, { as: as, className: classes }));\n}", "title": "" }, { "docid": "846e20cb71d60eca5d05d443f5d66f46", "score": "0.5373162", "text": "function TableComponent(parent, selectable)\r\n{\r\n\tthis.callbacks = new Array();\r\n\t\r\n\tvar table = this.table = document.createElement( 'table' );\r\n\ttable.cellPadding = 0;\r\n\ttable.cellSpacing = 0;\r\n\t\t\r\n\tvar style = this.style = table.style;\r\n\tstyle.marginLeft = 0;\r\n\tstyle.marginRight = 0;\r\n\tstyle.marginTop = 0;\r\n\tstyle.marginBottom = 0;\r\n \r\n if( selectable == false )\r\n {\r\n style.cursor = 'pointer';\r\n table.unselectable = true;\r\n style.MozUserSelect = 'none';\r\n }\r\n\t\r\n\tthis.dimensions = new ObjectDimensions( this.table );\r\n\t\r\n\tstyle.position = 'absolute';\r\n\tstyle.left = '0px';\r\n\tstyle.top = '0px';\r\n\t\r\n\tvar tBody = this.tBody = document.createElement( 'tbody' );\r\n\ttable.appendChild( tBody );\r\n\t\r\n\tthis.tr = new Array();\r\n\tthis.addRow();\r\n\tthis.addColumn();\r\n\tthis.td = this.tr[0].td[0];\r\n\r\n if( parent )\r\n {\r\n parent.appendChild( this.table );\r\n }\r\n}", "title": "" }, { "docid": "98768f7126d7702f86564770ec1ada85", "score": "0.5368998", "text": "function createTableHTML() {\n $(\"table\").empty(); // empty the table when reload, otherwise everytime this function is call, it will add another 10*10 to the existing table\n for (var row = 0; row < grid.length; row++) {\n var tr = $(\"<tr>\"); // <> to create html elements, create rows first\n $(\"table\").append(tr);\n for (var column = 0; column < grid[row].length; column++) { // add in the columns to the rows\n var td = $(\"<td>\").data(\"row\", row).data(\"column\", column); // stock the info of each cell in the data jQuery to use in the click event\n $(tr).append(td);\n var cell = grid[row][column]; \n if (cell.accessible) { // for showing in html only !!\n if (cell.player === player1) {\n $(td).addClass(\"player1\");\n } else if (cell.player === player2) {\n $(td).addClass(\"player2\");\n } else if (cell.weapon === dagger) {\n $(td).addClass(\"dagger\").attr(\"title\", \"dagger, dégâts : \" + dagger.damage);\n } else if (cell.weapon === axe) {\n $(td).addClass(\"axe\").attr(\"title\", \"axe, dégâts : \" + axe.damage);\n } else if (cell.weapon === hammer) {\n $(td).addClass(\"hammer\").attr(\"title\", \"hammer, dégâts : \" + hammer.damage);\n } else if (cell.weapon === sword) {\n $(td).addClass(\"sword\").attr(\"title\", \"sword, dégâts : \" + sword.damage);\n } else if (cell.weapon === club) {\n $(td).addClass(\"club\").attr(\"title\", \"club, dégâts : \" + club.damage);\n } \n if (cell.availableMove === true) { // using if instead of else if, means a cell could be accessible, with a weapon or a player, and availableMove at the same time\n $(td).addClass(\"availableMove\");\n } else {\n $(td).addClass(\"emptyCell\"); \n }\n } else {\n $(td).addClass(\"inaccessibleCell\");\n } \n } \n }\n}", "title": "" }, { "docid": "bda4e2e8ebe63b8b4adb7580a0a4cc76", "score": "0.53689843", "text": "function RangeTableInterface(TableClass) {\n class RangeTable extends UI.Primitive(TableClass, \"div\") {\n constructor(options) {\n super(options);\n this.lowIndex = 0;\n this.highIndex = 0;\n }\n\n getRangePanelStyleSheet() {\n return RangePanelStyle.getInstance();\n }\n\n getRowHeight() {\n return this.options.rowHeight || this.getRangePanelStyleSheet().rowHeight;\n }\n\n getEntriesManager() {\n if (!this.entriesManager) {\n this.entriesManager = new EntriesManager(super.getEntries());\n }\n return this.entriesManager;\n }\n\n extraNodeAttributes(attr) {\n attr.addClass(this.getRangePanelStyleSheet().default);\n }\n\n render() {\n const rangePanelStyleSheet = this.getRangePanelStyleSheet();\n const fakePanelHeight = (this.getRowHeight() * this.getEntriesManager().getEntriesCount() + 1) + \"px\";\n const headHeight = this.thead?.getHeight() || 0;\n this.computeIndices();\n\n // Margin is added at redraw for the case when the scoreboard has horizontal scrolling during a redraw.\n const margin = (this.node && this.node.scrollLeft) || 0;\n\n return [\n <div ref=\"tableContainer\" className={rangePanelStyleSheet.tableContainer}\n style={{paddingTop: headHeight + \"px\", marginLeft: margin + \"px\"}}>\n <div ref=\"scrollablePanel\" className={rangePanelStyleSheet.scrollablePanel}>\n <div ref=\"fakePanel\" className={rangePanelStyleSheet.fakePanel} style={{height: fakePanelHeight}}/>\n <table ref=\"container\" className={`${this.styleSheet.table} ${rangePanelStyleSheet.table}`}\n style={{marginLeft: -margin + \"px\"}}>\n {this.renderTableHead()}\n <tbody ref=\"containerBody\">\n {this.renderContainerBody()}\n </tbody>\n </table>\n </div>\n </div>,\n <div ref=\"footer\" className={rangePanelStyleSheet.footer} style={{marginLeft: margin + \"px\"}}>\n <span ref=\"tableFooterText\">\n {this.getFooterContent()}\n </span>\n <NumberInput ref=\"jumpToInput\" placeholder=\"jump to...\" style={{textAlign: \"center\",}}/>\n <Button ref=\"jumpToButton\" size={Size.SMALL} className={rangePanelStyleSheet.jumpToButton}>Go</Button>\n </div>\n ];\n }\n\n applyScrollState() {\n this.scrollablePanel.node.scrollTop = this.scrollState;\n }\n\n saveScrollState() {\n if (this.scrollablePanel && this.scrollablePanel.node) {\n this.scrollState = this.scrollablePanel.node.scrollTop;\n }\n }\n\n renderContainerBody() {\n // TODO: this method should not be here, and tables should have a method \"getEntriesToRender\" which will be overwritten in this class.\n this.rows = [];\n\n const entries = this.getEntriesManager().getEntriesRange(this.lowIndex, this.highIndex);\n\n for (let i = 0; i < entries.length; i += 1) {\n const entry = entries[i];\n const RowClass = this.getRowClass(entry);\n this.rows.push(<RowClass {...this.getRowOptions(entry, i + this.lowIndex)} />);\n }\n return this.rows;\n }\n\n getFooterContent() {\n if (this.lowIndex + 1 > this.highIndex) {\n return `No results. Jump to `;\n }\n return `${this.lowIndex + 1} ➞ ${this.highIndex} of ${this.getEntriesManager().getEntriesCount()}. `;\n }\n\n jumpToIndex(index) {\n // Set the scroll so that the requested position is in the center.\n const lowIndex = parseInt(index - (this.highIndex - this.lowIndex) / 2 + 1);\n const scrollRatio = lowIndex / (this.getEntriesManager().getEntriesCount() + 0.5);\n this.scrollablePanel.node.scrollTop = scrollRatio * this.scrollablePanel.node.scrollHeight;\n }\n\n computeIndices() {\n if (!this.tableContainer || !this.thead || !this.footer) {\n return;\n }\n const scrollRatio = this.scrollablePanel.node.scrollTop / this.scrollablePanel.node.scrollHeight;\n const entriesCount = this.getEntriesManager().getEntriesCount();\n // Computing of entries range is made using the physical scroll on the fake panel.\n this.lowIndex = parseInt(scrollRatio * (entriesCount + 0.5));\n if (isNaN(this.lowIndex)) {\n this.lowIndex = 0;\n }\n this.highIndex = Math.min(this.lowIndex + parseInt((this.getHeight() - this.thead.getHeight()\n - this.footer.getHeight()) / this.getRowHeight()), entriesCount);\n }\n\n setScroll() {\n // This is the main logic for rendering the right entries. Right now, it best works with a fixed row height,\n // for other cases no good results are guaranteed. For now, that row height is hardcoded in the class'\n // stylesheet.\n\n if (this.inSetScroll) {\n return;\n }\n if (!document.body.contains(this.node)) {\n this.tableFooterText.setChildren(this.getFooterContent());\n this.containerBody.setChildren(this.renderContainerBody());\n return;\n }\n this.inSetScroll = true;\n this.computeIndices();\n // Ugly hack for chrome stabilization.\n // This padding top makes the scrollbar appear only on the tbody side\n this.tableContainer.setStyle(\"paddingTop\", this.thead.getHeight() + \"px\");\n this.fakePanel.setHeight(this.getRowHeight() * this.getEntriesManager().getEntriesCount() + \"px\");\n // The scrollable panel must have the exact height of the tbody so that there is consistency between entries\n // rendering and scroll position.\n this.scrollablePanel.setHeight(this.getRowHeight() * (this.highIndex - this.lowIndex) + \"px\");\n // Update the entries and the footer info.\n this.tableFooterText.setChildren(this.getFooterContent());\n this.containerBody.setChildren(this.renderContainerBody());\n // This is for setting the scrollbar outside of the table area, otherwise the scrollbar wouldn't be clickable\n // because of the logic in \"addCompatibilityListeners\".\n this.container.setWidth(this.fakePanel.getWidth() + \"px\");\n this.inSetScroll = false;\n }\n\n addCompatibilityListeners() {\n // The physical table has z-index -1 so it does not respond to mouse events, as it is \"behind\" fake panel.\n // The following listeners repair that.\n this.addNodeListener(\"mousedown\", () => {\n this.container.setStyle(\"pointerEvents\", \"all\");\n });\n this.container.addNodeListener(\"mouseup\", (event) => {\n const mouseDownEvent = new MouseEvent(\"click\", event);\n const domElement = document.elementFromPoint(parseFloat(event.clientX), parseFloat(event.clientY));\n setTimeout(() => {\n this.container.setStyle(\"pointerEvents\", \"none\");\n domElement.dispatchEvent(mouseDownEvent);\n }, 100);\n });\n\n // Adding listeners that force resizing\n this.addListener(\"setActive\", () => {\n this.setScroll();\n });\n this.addListener(\"resize\", () => {\n this.setScroll();\n });\n window.addEventListener(\"resize\", () => {\n this.setScroll();\n });\n }\n\n addTableAPIListeners() {\n // This event isn't used anywhere but this is how range updates should be made.\n this.addListener(\"entriesChange\", (event) => {\n if (!(event.leftIndex >= this.highIndex || event.rightIndex < this.lowIndex)) {\n this.setScroll();\n }\n });\n this.addListener(\"showCurrentUser\", () => {\n const index = this.getEntriesManager().getEntries().map(entry => entry.userId).indexOf(USER.id) + 1;\n this.jumpToIndex(index);\n });\n // Delay is added for smoother experience of scrolling.\n this.attachChangeListener(this.getEntriesManager(), () => {\n this.setScroll();\n });\n }\n\n addSelfListeners() {\n this.scrollablePanel.addNodeListener(\"scroll\", () => {\n this.setScroll();\n });\n this.addNodeListener(\"scroll\", () => {\n this.tableContainer.setStyle(\"marginLeft\", this.node.scrollLeft);\n this.footer.setStyle(\"marginLeft\", this.node.scrollLeft);\n this.container.setStyle(\"marginLeft\", -this.node.scrollLeft);\n });\n window.addEventListener(\"resize\", () => {\n this.tableContainer.setStyle(\"marginLeft\", 0);\n this.footer.setStyle(\"marginLeft\", 0);\n this.container.setStyle(\"marginLeft\", 0);\n });\n this.jumpToInput.addNodeListener(\"keyup\", (event) => {\n if (event.code === \"Enter\") {\n this.jumpToIndex(parseInt(this.jumpToInput.getValue()));\n }\n });\n this.jumpToButton.addClickListener(() => {\n this.jumpToIndex(parseInt(this.jumpToInput.getValue()));\n });\n }\n\n onMount() {\n super.onMount();\n\n this.addCompatibilityListeners();\n\n this.addTableAPIListeners();\n\n this.addSelfListeners();\n\n setTimeout(() => {\n this.redraw();\n })\n }\n }\n return RangeTable;\n}", "title": "" }, { "docid": "3f1ced56b1a21a30283b975b0afac2f0", "score": "0.53606284", "text": "function TableRow(props) {\n var active = props.active,\n cellAs = props.cellAs,\n cells = props.cells,\n children = props.children,\n className = props.className,\n disabled = props.disabled,\n error = props.error,\n negative = props.negative,\n positive = props.positive,\n textAlign = props.textAlign,\n verticalAlign = props.verticalAlign,\n warning = props.warning;\n var classes = Object(__WEBPACK_IMPORTED_MODULE_3_clsx__[\"default\"])(Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"x\" /* useKeyOnly */])(active, 'active'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"x\" /* useKeyOnly */])(disabled, 'disabled'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"x\" /* useKeyOnly */])(error, 'error'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"x\" /* useKeyOnly */])(negative, 'negative'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"x\" /* useKeyOnly */])(positive, 'positive'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"x\" /* useKeyOnly */])(warning, 'warning'), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"A\" /* useTextAlignProp */])(textAlign), Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"C\" /* useVerticalAlignProp */])(verticalAlign), className);\n var rest = Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"p\" /* getUnhandledProps */])(TableRow, props);\n var ElementType = Object(__WEBPACK_IMPORTED_MODULE_6__lib__[\"o\" /* getElementType */])(TableRow, props);\n\n if (!__WEBPACK_IMPORTED_MODULE_6__lib__[\"c\" /* childrenUtils */].isNil(children)) {\n return /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(ElementType, Object(__WEBPACK_IMPORTED_MODULE_0__babel_runtime_helpers_esm_extends__[\"a\" /* default */])({}, rest, {\n className: classes\n }), children);\n }\n\n return /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(ElementType, Object(__WEBPACK_IMPORTED_MODULE_0__babel_runtime_helpers_esm_extends__[\"a\" /* default */])({}, rest, {\n className: classes\n }), Object(__WEBPACK_IMPORTED_MODULE_2_lodash_es_map__[\"a\" /* default */])(cells, function (cell) {\n return __WEBPACK_IMPORTED_MODULE_7__TableCell__[\"a\" /* default */].create(cell, {\n defaultProps: {\n as: cellAs\n }\n });\n }));\n}", "title": "" }, { "docid": "bbe8172c3887f79ce7ba0d5d652aabb0", "score": "0.5356529", "text": "createCell(type, opts) {\n switch (type) {\n case 'code':\n return this.createCodeCell(opts);\n break;\n case 'markdown':\n return this.createMarkdownCell(opts);\n break;\n case 'raw':\n default:\n return this.createRawCell(opts);\n }\n }", "title": "" }, { "docid": "1f19a8c90dc1233619a36ec8f68bb228", "score": "0.53540385", "text": "generateTable () {\n let rows = this.getIndices().map(rowIndex => {\n let cols = this.props.datas[rowIndex].map((value, colIndex) => {\n if (this.props.columns[colIndex].callback) {\n value = this.props.columns[colIndex].callback(rowIndex, colIndex, value)\n }\n if (value === undefined) {\n value = '-'\n }\n return <td align={_align(this.props.columns[colIndex])} /* className={ clazz } */>{ value }</td>\n })\n return <tr data-index={rowIndex} onClick={(e) => this.onClick(e)}>{ cols }</tr>\n })\n return (<tbody>{ rows }</tbody>)\n }", "title": "" } ]
5ebec009a0a46763c0b77d4947dec535
this function updates chrissystats
[ { "docid": "808070322657d9d6272adc000a981787", "score": "0.0", "text": "function update(index) {\n let template = ''\n template = `\n <img src=\"${chrissy.moods[index].img}\" style=\"max-width: 13rem; height: auto; border: 1px solid gray\" class=\"shadow-lg\"/>\n <h2 class=\"my-2\"><strong>Chrissy</strong></h1>\n <h5>Health: ${chrissy.healthIndex}</h5>\n <h5>Snacks: ${chrissy.foodCount}</h5>\n `\n document.getElementById('chrissy-stats').innerHTML = template\n}", "title": "" } ]
[ { "docid": "04e76ca05af02e212a1b3add23a341ac", "score": "0.6794132", "text": "function updateChatter() {\n // find our player\n const ourPlayer = findPlayer(playerRanks, 'Luka Doncic');\n\n // update the score in the chatter text based on metric/mode\n d3.select('#rank__total-score').text(() => {\n if (thisMode === 'traditional') {\n return ourPlayer.tradScore.toFixed(2);\n } return ourPlayer.advScore.toFixed(2);\n });\n\n // update the rank in the chatter text\n d3.select('#rank__rank').text(apOrdinal(journalize.ordinal(ourPlayer.rank + 1)));\n }", "title": "" }, { "docid": "03733b2440b803d2850d06dd7491e191", "score": "0.62297565", "text": "function updateCur(){\n updateCurCommon();\n //#################### send the stuff ###############################\n //sends the updated item to the student\n socket.emit('updateFromTeacher', h[curPos]);\n}", "title": "" }, { "docid": "dae3a354c52c2fc81e9c02dddba649fe", "score": "0.60742575", "text": "setChats(chats) {\n this._chats = chats;\n this.chatsWrapper.innerHTML = '';\n this.render();\n }", "title": "" }, { "docid": "ac501c227a57e91bc4b7cf4263c76426", "score": "0.60730267", "text": "componentWillReceiveProps(nextProps) {\n const newChats = nextProps.chats;\n\n // Configure chats to be displayed properly\n const chats = newChats.map(chat => {\n if (chat.isSentFromPrimary) {\n return { text: chat.text, isRight: false };\n }\n return { text: chat.text, isRight: true };\n });\n\n // Update state\n this.setState({ chats });\n }", "title": "" }, { "docid": "7efc58b1225c5f89b1b472dbc4189a3d", "score": "0.57275677", "text": "function updateChat(state, action) {\n if (!ddp.userId) return {};\n const convo = mongo.db.conversations.findOne({ _id: state.conversationId });\n if (!convo) return {};\n const participants = (convo.participants || []).map(p => ({ ...p, ...mongo.db.users.findOne({ _id: p.id }, { fields: { username:1, 'status.online':1 } }) }));\n const messages = mongo.db.messages.find({ conversationId: convo._id }, { sort: { createdAt: -1 } }).map(m => ({ ...m, _type: 'message', date: (m.createdAt || new Date(0))}));\n const typeToDb = { article: mongo.db.articles, posyt: mongo.db.posyts };\n const cards = _.compact((convo.likes || []).map(l => {\n const card = typeToDb[l.type].findOne({ _id: l.id });\n return card && { ...card, _type: l.type, date: (l.matchedAt || new Date(0))};\n }));\n const first5Messages = messages.slice(0, 5);\n const cachedMessages = _.filter(state.cachedMessages, m => {\n // compare cachedMessages to recent messages and remove dupes from cached messages\n return !(m.state === 'sending' && first5Messages.map(mm => mm.content).includes(m.content))\n });\n const lookingFor = { lastDelivered: true, lastRead: true, lastReadAndIsMine: true };\n const me = _.find(participants, { id: ddp.userId }) || {};\n const otherUser = _.find(participants, { id: _.without(convo.participantIds, ddp.userId)[0] }) || {};\n const typingBubbles = otherUser.isTyping ? [{ _type: 'message', content: '· · ·', ownerId: otherUser._id, date: new Date, isTypingIndicator: true }] : [];\n // TODO: bubbles don't change so cache them instead of recomputing all of them on every update\n const bubbles = _.sortBy([...typingBubbles, ...cachedMessages, ...messages, ...cards], 'date').reverse().slice(0, state.limit).map((b, i, a) => {\n const isMine = b.ownerId === ddp.userId;\n const previousDate = i + 1 < a.length && a[i + 1].date;\n const nextDate = i > 0 && a[i - 1].date;\n const nextIsSameOwner = i > 0 && a[i - 1].ownerId === b.ownerId;\n const previousIsSameOwner = i + 1 < a.length && a[i + 1].ownerId === b.ownerId;\n const isParticipants = (convo.participantIds || []).includes(b.ownerId);\n const nextIsParticipants = i > 0 && (convo.participantIds || []).includes(a[i - 1].ownerId);\n const previousIsParticipants = i + 1 < a.length && (convo.participantIds || []).includes(a[i + 1].ownerId);\n const isLast = i === 0;\n const isFirst = i + 1 === a.length;\n const isLastDelivered = lookingFor.lastDelivered && b._type === 'message' && b._id && isMine;\n if (isLastDelivered) lookingFor.lastDelivered = false;\n if (lookingFor.lastRead && b._type === 'message' && b._id && otherUser.lastReadMessageId === b._id) lookingFor.lastRead = false;\n const isLastRead = !lookingFor.lastRead && lookingFor.lastReadAndIsMine && b._type === 'message' && b._id && isMine;\n if (isLastRead) lookingFor.lastReadAndIsMine = false;\n return { ...b, isMine, previousDate, nextDate, nextIsSameOwner, previousIsSameOwner, isParticipants, nextIsParticipants, previousIsParticipants, isLast, isFirst, isLastDelivered, isLastRead };\n });\n if (messages && messages[0] && me.lastReadMessageId !== messages[0]._id) ddp.call('conversations/setLastRead', [messages[0]._id, convo._id]);\n return {\n cachedMessages,\n participants,\n bubbles,\n numMessagesOnClient: messages.length,\n };\n}", "title": "" }, { "docid": "c4299a6f9e5cc011c6f7957031b862ec", "score": "0.569955", "text": "function update() {\n let data = '{\"users\":' + JSON.stringify(users, filter) + ',' +\n '\"conversations\":' + JSON.stringify(conversations) + '}';\n broadcast(data);\n}", "title": "" }, { "docid": "2a293120b9d3c11a21546560970b612e", "score": "0.5684899", "text": "function updateOther() {\r\n\tvar c = character;\r\n\tif (c.statpoints == 0) {\r\n\t\tdocument.getElementById(\"remainingstats\").innerHTML = \"\"\r\n\t\tdocument.getElementById(\"hide_statpoints\").style.visibility = \"visible\"\r\n\t} else {\r\n\t\tdocument.getElementById(\"hide_statpoints\").style.visibility = \"hidden\"\r\n\t}\r\n\tif (c.skillpoints == 0) {\r\n\t\tdocument.getElementById(\"remainingskills\").innerHTML = \"\"\r\n\t\tdocument.getElementById(\"hide_skillpoints\").style.visibility = \"visible\"\r\n\t} else {\r\n\t\tdocument.getElementById(\"hide_skillpoints\").style.visibility = \"hidden\"\r\n\t}\r\n\tif (c.level == 1 && c.statpoints == 0 && c.quests_completed < 0) {\r\n\t\tdocument.getElementById(\"hide_stats\").style.visibility = \"visible\"\r\n\t} else {\r\n\t\tdocument.getElementById(\"hide_stats\").style.visibility = \"hidden\"\r\n\t}\r\n\tupdateSkillIcons()\r\n\tcheckRequirements()\r\n\t\r\n\t// update available sockets - TODO: move this to a more suitable 'update' function\r\n\tfor (group in socketed) {\r\n\t\tsocketed[group].sockets = (~~equipped[group].sockets + ~~corruptsEquipped[group].sockets)\r\n\t\tremoveInvalidSockets(group)\r\n\t}\r\n}", "title": "" }, { "docid": "6227890e3761b50186f09d19fefb936d", "score": "0.5595046", "text": "function streakerUpdate(msg) {\n update(expandData(msg));\n }", "title": "" }, { "docid": "d656d95d75cea1d3c5a5e8abbc2a8d99", "score": "0.5593459", "text": "updateFromRoomState(roomState) {\n this.clearPlayerCards();\n for (var pName in roomState.players) {\n // get player and make fresh player cards\n var curPlayer = roomState.getPlayerFromName(pName);\n this.playerCards[pName] = new PlayerCard(pName);\n var curCard = this.playerCards[pName];\n curCard.clearAppearance();\n curCard.setBackgroundColorForPlayer(curPlayer, this.playerRoleVisible(curPlayer));\n curCard.setAliveAppearance(curPlayer.alive);\n curCard.setVoteHover(pName, roomState.playerVoteLegal(this.clientPlayer, curPlayer));\n curCard.setVoted(this.clientPlayer, curPlayer, roomState);\n curCard.setCopResult(this.clientPlayer, curPlayer);\n curCard.setClientPlayerAppearance(this.clientPlayer, curPlayer);\n curCard.setHostAppearance(curPlayer, roomState);\n curCard.setVoteCounter(this.clientPlayer, curPlayer, roomState);\n // TODO: check for host or people who are disconnected, also cop stuff\n }\n // set message and overwrite for special cases\n this.message = roomState.gameState === this.clientPlayer.role ||\n !this.clientPlayer.alive ||\n roomState.gameState >= 4 ?\n STATE_MESSAGES[roomState.gameState] : NIGHT_MESSAGE;\n }", "title": "" }, { "docid": "0ef55bdefb37e1bab03b3c6bfcbe99c5", "score": "0.55227154", "text": "updateViaSocket(updatedCard) {\n angular.forEach(this.displayData.cards, card => {\n // Update card\n if (card._id === updatedCard._id) {\n // Update card, set balance display width\n card.balance = updatedCard.balance;\n card.inventory = updatedCard.inventory;\n // Update unless the displayed card is manual\n if (card.balanceStatus !== 'manual') {\n card.balanceStatus = updatedCard.balanceStatus;\n }\n card.balanceDisplayWidth = this.setBalanceWidth(card.balanceStatus, card.valid);\n }\n // Set buy amount if we have\n this.setBuyAmount(card);\n });\n // Update totals\n this.displayTotals(this.displayData.totals, this.displayData.cards);\n }", "title": "" }, { "docid": "5b75ad64b0ab35e94890f3d170b36cc1", "score": "0.5508032", "text": "function updateFeedbackPlayer() {\n currentStatsMatch = matches[currentMatchID]\n $('#feedback_player').text(matches[currentMatchID].player1);\n }", "title": "" }, { "docid": "65fa383120567d0cdef08e3a91b469e3", "score": "0.54897463", "text": "function sendCatMissionary() {\n if (gameData.cats > 0) {\n gameData.cats--\n catActions.missionaries++\n update();\n }\n}", "title": "" }, { "docid": "913a5dba65d9367750c7a120ca673b4f", "score": "0.54602903", "text": "function sendCatFishing() {\n if (gameData.cats > 0) {\n gameData.cats--\n catActions.fishers++\n update();\n }\n }", "title": "" }, { "docid": "42477a89fd3f6237a60e04d6905bf44a", "score": "0.54532635", "text": "function updateChatroom() {\n\t\tvar chatroom_number = $(\"input#chatroom_number\").val();\n\t\t\n\t\t$.getJSON(\"/chatrooms/\"+chatroom_number+\"/ajax_update\", function(data) {\n\t\t\tif (data.count > count) {\n\t\t\t\t$(\"#chat-area\").append(\"<p><span>\"+data.username+\"</span>: \"+data.message+\"</p>\");\n\t\t\t\tconsole.log(data.message);\n\t\t\t}\n\t\t\tcount = data.count\n\t\t\tsetTimeout(updateChatroom, 1000);\n\t\t});\t\t\n\t}", "title": "" }, { "docid": "492fa300aa1df7ac6ba0855d490cfb3d", "score": "0.54498076", "text": "function updateWinsOnBoard() {\n $(\"span#x-score\").text(wins_count_x.toString());\n $(\"span#o-score\").text(wins_count_o.toString());\n }", "title": "" }, { "docid": "6632cb143e623d07db0f02d1663ca7e0", "score": "0.544552", "text": "updateAllChannels(category) {\n const allChannels = { ...this.state.allChannels }; // gets current allChannels state to modify\n\n if (this.isGroupMsg(category)) {\n // updating Groups category\n allChannels['Groups'] = Object.keys(this.allChannelData['Groups']);\n } else {\n // updating PMs category\n allChannels['PMs'] = Object.keys(this.allChannelData['PMs']);\n }\n\n this.setState({ allChannels });\n }", "title": "" }, { "docid": "0c036f03ed1a27d0db554d90fae795ac", "score": "0.54264545", "text": "function updateChat(msg) {\n insert(\"chat\", msg.data);\n}", "title": "" }, { "docid": "aea91b695bda4460c5075c6753d2ad3e", "score": "0.54201543", "text": "updateSelectedChannelMessages(channel) {\n if (channel === this.state.selectedChannel.name) {\n // new msg from selected channel\n const selectedChannel = this.state.selectedChannel;\n const { category, name } = this.state.selectedChannel;\n selectedChannel.messages = this.allChannelData[category][name]; // use new msg list\n\n this.setState({ selectedChannel });\n }\n }", "title": "" }, { "docid": "0ba756089c9a7fa9d0c57f151769291f", "score": "0.54159087", "text": "function update(){\n communication();\n update_numbers();\n update_chart();\n threshold_alarm();\n}", "title": "" }, { "docid": "c5892eace1d69c271a80f80dbbbf46d8", "score": "0.54024756", "text": "tick() {\n //Check if chat has changed\n if (this.state.chat_log.length !== 0) {\n this.chatChange();\n }\n for (var i = 0; i < this.state.users.length; i++) {\n let user = this.state.users[i];\n user.timer -= 1;\n if (user.timer <= 0) { //Randomize a bot message after given interval.\n this.statusChange(user);\n let bot_phrase_index = Math.round(Math.random()*(user.messages.phrases.length -1));\n this.addMessage(user.messages.phrases[bot_phrase_index], user.name);\n user.timer = user.interval;\n }\n }\n }", "title": "" }, { "docid": "4b227fc9e0b36d12fc59914216aa40d6", "score": "0.5387221", "text": "updateScoreBoard() {\n\t\tdocument.getElementById(\"s1\").innerHTML = this.playerInfo[0].won;\n\t\tdocument.getElementById(\"s2\").innerHTML = this.playerInfo[1].won;\n\t}", "title": "" }, { "docid": "c13b2b0d52504888aa13bf9a270367c0", "score": "0.538613", "text": "function updatechat(){\n\t$.getJSON(dataurl + 'updatechat=1&maxtime=' + maxtime + '&token=' + token,function(data){\n\t\tmaxtime = parseInt( data[0] );\n\t\tif( data[1][0] != 0 ){\n\t\t\twritechat(data[1]);\t\n\t\t}\n\t});\n}", "title": "" }, { "docid": "522925bb4d2b4e9bbf45b9b4585c257c", "score": "0.5357933", "text": "function alterChallenge(challenged, socket)\n{\n var found = 0;\n for (var i = 0; i < outstandingChallenges.length; i++) \n {\n \n if (outstandingChallenges[i].challengee == challenged)\n {\n //we still want to remove the challenge even if it's an accept\n //send out the challenges\n if (challengeChangeType == 1)\n {\n var data = {\n name: serverName,\n text: outstandingChallenges[i].challengee + \" accepts the challenge from \" + outstandingChallenges[i].challenger + \"! Prepare to fight!\"\n };\n broadcast('message', data);\n messages.push(data);\n \n socket.join(challengeRooms[i]);\n //broadcast that the two are now fighting\n \n\n }\n //remove the challenge from the list\n outstandingChallenges.splice(i, 1);\n //may remove from the list here, or not\n if(challengeChangeType == 0)\n {\n challengeRooms.splice(i, 1);\n challengeRoomNames.splice(i, 1);\n }\n \n found = 1;\n updateChallenges();\n return successfulUpdate = i;\n //break;\n }\n }\n //This line only runs if no challenges meeting our criteria are found\n if(found == 0)\n {\n var data = {\n name: serverName,\n text: \"But there was no challenge! Maybe someone should send one!\"\n };\n broadcast('message', data);\n messages.push(data);\n }\n return successfulUpdate = -1;\n}", "title": "" }, { "docid": "736e78347294d4db1b5ec726d54c1beb", "score": "0.53574973", "text": "function updateChat() {\n\t$.ajax({\n\t url: \"getChat.php\",\n\t type: \"POST\",\n\t data: {\n\t\t\tsentinel: $(\"#c\").val(),\n\t\t\tpId: $(\"#p\").val(),\n\t\t\tid: $(\"#sId\").val(),\n\t },\n\t success: function(data) {\n\t \t// if old is shorter than new (new was content added)\n\t \tif (convoLen != data.length + getAdminMessage().length) {\n\t \t\t// update chat\n\t\t\t\t//setTimeout($(\"#messages\").html(data+getAdminMessage()), 2000);\n\t\t\t\t$(\"#messages\").html(data+getAdminMessage());\n\n\t \t\t// scroll to bottom of chat\n\t\t\t\t$('#convo').scrollTop(1E10);\n\n\t \t\t// update local store of convo length\n\t\t\t\tconvoLen = data.length + getAdminMessage().length;\n\n\t \t\tsetAdminMessage(\"\");\n\t\t\t}\n\t },\n\t error: function() {\n\t console.log(\"Error updating chat\");\n\t }\n\t});\n}", "title": "" }, { "docid": "f4b34541f19ef1e5ab3bf3fb2c83efdf", "score": "0.53527683", "text": "sendCurrentTrackTextWithSocket(currentTrackTextLine) {\n\n // Set canvas\n var canvas = md5(this.state.currentTrackTextLine);\n\n const ws = new WebSocket(`ws://${location.host}/`);\n\n this.setState({currentTrackTextLine: currentTrackTextLine});\n\n ws.onopen = () => {\n ws.send(JSON.stringify(\n {\n category: this.props._ui.category.name,\n data: {\n canvas: canvas,\n text: this.state.currentTrackTextLine\n }\n }\n ));\n\n const data = JSON.stringify(\n {\n category: this.props._ui.category.name,\n data: {\n text: this.state.currentTrackTextLine // Что бы не было ошибки на сервере!\n }\n }\n );\n\n // Update in the Db\n axios.put(`http://${location.host}/current`, {data: data})\n .then(function (reply) {\n // console.log(reply.data);\n // if (reply.data.success) {\n // this.setState({currentTrackText: newtext});\n // }\n\n // Устанавлеваем канвас после всего\n this.setState({canvas: canvas});\n\n }.bind(this))\n .catch(function (error) {\n console.log(error);\n });\n };\n }", "title": "" }, { "docid": "f609fd6ec091505a45f643b9d5bdcf10", "score": "0.53457665", "text": "function updateChat(mode) {\r\n\t// This function has four 'modes':\r\n\t\t// Mode 0 -- UPDATE ONLY. Retrieve the most up-to-date chat log from the server and display it.\r\n\t\t// Mode 1 -- JOIN CHAT. Send a \" .. has joined the chat\" message to the server.\t\r\n\t\t// Mode 2 -- NEW MESSAGE. Send the input value to the server as a new message.\r\n\t\t// Mode 3 -- LEAVE CHAT. Send a \" .. has left the chat\" message to the server.\t\r\n\tif (mode == 0){\taddText = \"\";}\r\n\tif (mode == 1){\taddText = \"{{{*** Player joined ***}}}\";}\r\n\tif (mode == 2){\taddText = encodeURIComponent(inputField.value);\tinputField.value = \"\" ;}\r\n\tif (mode == 3){addText = \"{{{*** Player left ***}}}\";}\r\n\t\r\n\t// Make HTTP request\r\n\trequest.url = serverURL + \"/chat.php\" +\r\n\t\"?researcherID=\" \t+ Qualtrics.SurveyEngine.getEmbeddedData(\"researcherID\") + \r\n\t\"&studyID=\" \t\t+ Qualtrics.SurveyEngine.getEmbeddedData(\"studyID\") + \r\n\t\"&groupID=\" \t\t+ Qualtrics.SurveyEngine.getEmbeddedData(\"groupID\") +\r\n\t\"&timeZone=\" \t\t+ Qualtrics.SurveyEngine.getEmbeddedData(\"timeZone\") +\r\n\t\"&participantRole=\"\t+ Qualtrics.SurveyEngine.getEmbeddedData(\"participantRole\") +\r\n\t\"&chatName=\" \t\t+ Qualtrics.SurveyEngine.getEmbeddedData(\"chatName\") +\r\n\t\"&chatTimeFormat=\"\t+ chatTimeFormat +\r\n\t\"&addText=\"\t\t\t+ addText;\r\n\t\r\n\t\r\n\tconsole.log(\"CHAT in progress...\");\r\n\t// Create callback for success containing the response\r\n\trequest.success = function(response)\r\n\t{\r\n\t\tvar resp = response;\r\n\t\tvar parser = new DOMParser()\r\n\t\tvar parsed = parser.parseFromString(resp,\"text/html\");\r\n\t\told_chatLog = chatLog;\r\n\t\tchatLog = parsed.getElementsByTagName(\"chatLog\")[0].innerHTML;\r\n\t\tif (mode != 3) {\r\n\t\t\tchatDisplay.innerHTML = chatLog;\r\n\t\t\tif (chatLog != old_chatLog) {scrollToBottom();}\r\n\t\t}\r\n\t\t// Save / update the chat log in Qualtrics\r\n\t\tQualtrics.SurveyEngine.setEmbeddedData( Qualtrics.SurveyEngine.getEmbeddedData(\"chatName\"), chatLog );\r\n\t};\r\n\r\n\t// Create a fail callback containing the error\r\n\trequest.fail = function(error){console.log(error);};\r\n\r\n\t// Send requrest\r\n\trequest.send();\r\n}", "title": "" }, { "docid": "379ec222d63a44b8a6d49b353b4fdd62", "score": "0.53399616", "text": "function refresh(){\r\n setInterval(loadChat, 5000);\r\n }", "title": "" }, { "docid": "83f6c21f897f250eeed9f3f16f54d8a7", "score": "0.53363794", "text": "function updateStatistics(state) {\n\tlet seconds = Math.round(Number(state.totalWatchDuration));\n\tlet timeDisplay = moment.utc(seconds*1000).format('HH:mm:ss')\n\ttimeWatchedEl.forEach(el => el.innerText = timeDisplay)\n\tvideosWatchedEl.forEach(el => el.innerText = state.videosWatched)\n\tcalculateCredits(state)\n}", "title": "" }, { "docid": "c263604c225cfcb949c30d14c8fd621f", "score": "0.53311557", "text": "function updateRockets() {\n rockets.forEach(function(rkt, index, array) {\n rkt.move();\n });\n\n rockets = rockets.filter(function(rkt) {\n return !rkt.isExpired();\n });\n\n rockets.forEach(function(rkt, index, array) {\n rkt.draw(ctx);\n });\n }", "title": "" }, { "docid": "f5328aefcfc09f3e31ae74672d34b943", "score": "0.5325246", "text": "function pressChat(userName, auth, chatId) {\n chats.forEach(chat => {\n if (chat.chatId.id == chatId) {\n chat.lastFetch = firebase.firestore.Timestamp.fromDate(new Date());\n chat.unread=0;\n }\n });\n firestore().collection('users').doc(auth).update({chats}).then(()=> {\n navigation.navigate('ChatBox', {userName, auth, chatId});\n });\n }", "title": "" }, { "docid": "fc1aa2a569ebb7dada3ad4c7ecaa6ddc", "score": "0.53185725", "text": "function changeChannelState(channelKey,status){\t\r\n //alert(\"changeChannelState(\"+channelKey+\" \"+status+\" \"+changeType+\")\"); \r\n\tvar channelObj = channelMaps.get(channelKey);\r\n\t\r\n\tif(channelObj == null || channelObj == undefined){\r\n\t alert(\"no this channel:\"+channelKey);\r\n\t return;\t \r\n\t}\r\n\t\r\n\tif(status==0){ \r\n\t\tchannelObj.choosedState=0;\r\n\t\tchannelMaps.put(channelKey,channelObj);\r\n\t}else if(status==1){\r\n\t\tchannelObj.choosedState=1;\r\n\t\tchannelMaps.put(channelKey,channelObj);\r\n\t}else if(status==2){\r\n\t\tchannelObj.choosedState=2;\r\n\t\tchannelObj.workingNumber=0;\r\n\t\tchannelMaps.put(channelKey,channelObj);\r\n\t}else if(status==3){\r\n\t\tchannelObj.workingNumber = channelObj.workingNumber+1;\r\n\t\tchannelMaps.put(channelKey,channelObj);\r\n\t}else if(status==4 ){\t\t\r\n\t\tif(channelObj.workingNumber >0){\t\t\t\t\r\n\t\t\t\tchannelObj.workingNumber = channelObj.workingNumber-1;\r\n\t\t\t\tchannelMaps.put(channelKey,channelObj);\r\n\t\t}\t\t\r\n\t}\r\n\t\r\n\t//to decide agent status\r\n\tvar a = new Array(0,0,0,0);//:busy,ready,notready,logout\t\r\n for(var i=0;i<channelArray.length;i++){ \t\r\n \tchannelObj = channelMaps.get(channelArray[i]);\r\n\t\tif(channelObj.workingNumber>0){//???????????????????????????\r\n\t\t\tif(channelArray[i]==channelKey && channelKey != 'Voice' && channelKey == 'Email'){\r\n\t\t\t\tonChangeAgentChannelStateInCache('emailBusy');\r\n\t\t\t}\r\n\t\t\tif(channelArray[i]==channelKey && channelKey != 'Voice' && channelKey == 'Chat'){\r\n\t\t\t\tonChangeAgentChannelStateInCache('chatBusy');\r\n\t\t\t}\r\n \t\ta[0]=a[0]+1;\r\n\t\t}else if(channelObj.choosedState==0){//???????????????ready,??????busy\r\n\t\t\tif(channelArray[i]==channelKey && channelKey == 'Email'){\r\n\t\t\t\tonChangeAgentChannelStateInCache('emailReady');\r\n\t\t\t}\r\n\t\t\tif(channelArray[i]==channelKey && channelKey == 'Chat'){\r\n\t\t\t\tonChangeAgentChannelStateInCache('chatReady');\r\n\t\t\t}\r\n\t\t\tif(channelArray[i]==channelKey && channelKey == 'Voice'){\r\n\t\t\t\tonChangeAgentChannelStateInCache('voiceReady');\r\n\t\t\t}\r\n a[1]=a[1]+1;\r\n\t\t}else if(channelObj.choosedState==1){//???????????????notready,??????busy\r\n\t\t\tif(channelArray[i]==channelKey && channelKey == 'Email'){\r\n\t\t\t\tonChangeAgentChannelStateInCache('emailNotReady');\r\n\t\t\t}\r\n\t\t\tif(channelArray[i]==channelKey && channelKey == 'Chat'){\r\n\t\t\t\tonChangeAgentChannelStateInCache('chatNotReady');\r\n\t\t\t}\r\n\t\t\tif(channelArray[i]==channelKey && channelKey == 'Voice'){\r\n\t\t\t\tvar status = getMainContactStatus();\r\n\t\t\t\tvar state = agentState.getAgentState();\r\n\t\t\t\tif(status!=STATUS_TALKING && state!='ACW')\r\n\t\t\t\t\tonChangeAgentChannelStateInCache('voiceNotReady');\r\n\t\t\t}\r\n a[2]=a[2]+1;\r\n\t\t}else if(channelObj.choosedState==2){//???????????????logout\r\n\t\t\tif(channelArray[i]==channelKey && channelKey == 'Email'){\r\n\t\t\t\tonChangeAgentChannelStateInCache('emailLoginOut');\r\n\t\t\t}\r\n\t\t\tif(channelArray[i]==channelKey && channelKey == 'Chat'){\r\n\t\t\t\tonChangeAgentChannelStateInCache('chatLoginOut');\r\n\t\t\t}\r\n\t\t\tif(channelArray[i]==channelKey && channelKey == 'Voice'){\r\n\t\t\t\tonChangeAgentChannelStateInCache('voiceLoginOut');\r\n\t\t\t}\r\n a[3]=a[3]+1;\r\n\t\t}\r\n\t} \r\n\t\r\n\tif(a[0]>0){\r\n \tchangeAgentState(busyState,-1);\r\n\t}else if(a[1]==channelArray.length){\r\n changeAgentState(readyAllState,-1);\r\n\t}else if(a[3]==channelArray.length){\t\t\t\r\n\t\tchangeAgentState(offLine,-1);\t\t\t \r\n\t}else if(a[2]==channelArray.length){\r\n\t\tchangeAgentState(offSeat,-1);\r\n\t}else if(a[2]>0 && a[3]>0 && a[1]==0){\r\n\t\tchangeAgentState(offSeat,-1);\r\n\t}else if(a[1]>0){\r\n\t\tchangeAgentState(readyPartState,-1);\r\n\t}\r\n}", "title": "" }, { "docid": "b5d12c156e7552a4b90798750f743fdd", "score": "0.5317804", "text": "function voicechannelupdate(){\n //Server status query\n handleGamedigQuery().then((state) => {\n var status = state.players.length + \" in \" + state.map;\n let statuschannel = bot.channels.get(VOICE_CHANNEL);\n statuschannel.setName(status);\n console.log(\"Status updated!\");\n Promise.resolve();\n }).catch(console.error);\n}", "title": "" }, { "docid": "6455458ecac44c8a0edaed6807d7fdd6", "score": "0.53175384", "text": "function updateCreepCount() {\n\tvar alive_cnt = 0;\n\tfor (var role in stg.ROLES) {\n\t\tsaveByRoleInRooms(Game.rooms, role, true);\n\t\talive_cnt += Memory.counters[role];\n\t}\n\tMemory.counters.ALIVE = alive_cnt;\n}", "title": "" }, { "docid": "862be961de59b65a0aef87d1a3d838f9", "score": "0.53161377", "text": "function sendUpdate(){\n io.sockets.emit('update', getGameData());\n updateAllPlayersHandData();\n}", "title": "" }, { "docid": "9a84af86a9bc97487ea787e0bea1e48d", "score": "0.53070456", "text": "updateMessageStatus() {\n console.log(\"update message status\");\n const { signalRNewServiceMessage, signalRServiceMessages } = this.props;\n if(!signalRNewServiceMessage || !signalRServiceMessages.length){\n return;\n }\n\n const chatMessages = this.state.messagesDisplayed;\n let newChatMessages = chatMessages;\n\n\n\n const message = signalRServiceMessages[signalRServiceMessages.length-1];\n\n const status = message.Status;\n const messageId = message.RoomMessageId;\n const room = message.RoomId;\n\n const thisRoom = this.props.roomId;\n\n if(room === thisRoom) {\n if(status !== -1){\n newChatMessages[0].received = true;\n this.setState({\n messagesDisplayed: newChatMessages\n }, () =>{\n this.updateLastSeen(messageId);\n });\n }\n }\n\n this.props.seenNewServiceMessage();\n }", "title": "" }, { "docid": "e5091e064c5c365ea89df5f54b8ced24", "score": "0.5297075", "text": "function updatePossession(json){\n json.forEach(function(value, i){\n if(value.possession == true) messaging(main,'possession',i)\n });\n }", "title": "" }, { "docid": "c9fef87301a4341e3dc411e0fba6ebef", "score": "0.5291784", "text": "function refreshChat(info) {\n $.post('http://tiny-pizza-server.herokuapp.com/collections/chat-messages', info);\n}", "title": "" }, { "docid": "ae03bd74bde78e397a94703481787b9d", "score": "0.52907217", "text": "_registerChEventHandlers() {\n // Handle new message\n window.channelize.chsocket.on('user.message_created', (data) => {\n\n // Update last message of respected conversation\n if(this.props.openConversation && this.props.openConversation.id === data.message.conversationId) {\n this.props.openConversation.lastMessage = data.message;\n }\n\n // Update last message and messages of respective conversation\n const conversationObject = this.props.recentConversations.find(conv => conv.id === data.message.conversationId);\n\n if(conversationObject) {\n conversationObject.lastMessage = data.message;\n conversationObject.messages = conversationObject.messages ? conversationObject.messages : [];\n conversationObject.messages.push(data.message);\n\n // Update conversation list sequence\n let updatedConversations = [conversationObject];\n let conversations = this.props.recentConversations.filter(conv => conv.id !== conversationObject.id);\n updatedConversations = updatedConversations.concat(conversations);\n\n this.props.handleNewMessage(updatedConversations, this.props.openConversation, data.message);\n }\n else {\n window.chAdapter.getConversation(data.message.conversationId, (err, conversation) => {\n if(err) return console.error(err);\n\n // Update conversation list sequence\n let updatedConversations = [conversation];\n let conversations = this.props.recentConversations.filter(conv => conv.id !== conversation.id);\n updatedConversations = updatedConversations.concat(conversations);\n\n this.props.handleNewMessage(updatedConversations, this.props.openConversation, data.message);\n });\n }\n });\n\n // Handle mark as read\n window.channelize.chsocket.on('conversation.mark_as_read', (data) => {\n this.props.updateConversationStatus(data);\n });\n\n // Handle user online/ofline status\n window.channelize.chsocket.on('user.status_updated', (data) => {\n this.props.updateStatus(data.user);\n });\n\n // Handle user block\n window.channelize.chsocket.on('user.blocked', (data) => {\n this.props.updateBlockStatus(data, \"block\");\n });\n\n // Handle user unblock\n window.channelize.chsocket.on('user.unblocked', (data) => {\n this.props.updateBlockStatus(data, \"unblock\");\n });\n }", "title": "" }, { "docid": "6a0b30707725508329eec799ebd94156", "score": "0.5287149", "text": "function updateHockeyList(room_number, updateAll){\n //gets us a list of all active users and their user pics, we passed this info to the socket when the \n //join room event was triggered\n var getNhlUsers = io.of('/nhlmessages').clients(room_number);\n\n var nhlUsersList = [];\n\n for(var i in getNhlUsers){\n //our username and pic are coming from the variables we created when the joinnhlroom event triggered\n nhlUsersList.push({user: getNhlUsers[i].userName, userPic: getNhlUsers[i].userPic});\n }\n\n //emit the nhlusersList array back to the user who requested it, the user joining the chat\n socket.to(room_number).emit('updateNHLUsersList', JSON.stringify(nhlUsersList));\n\n //if updateAll is true, meaning a user has just joined and we are forcefully updating the list of users\n //for all users connected to a particular room.\n if(updateAll){\n socket.broadcast.to(room_number).emit('updateNHLUsersList', JSON.stringify(nhlUsersList));\n }\n }", "title": "" }, { "docid": "04546b35f4082f61139bf5cedd86979f", "score": "0.5280859", "text": "function adjustShuttleSeats()\n{\n\tconsole.log(\"adjustShuttleSeats\");\n\n\t// going to make another array in which to correctly arrange the seats\n\t// then attribute the elements of this new array to shuttle.seats\n\n\tvar holderArray = [];\n\thaIndex = 0;\n\t\n\tfor (var i = 0; i < SEATS; i++)\n\t{\n\t\tif (shuttle.seats[i] != null)\n\t\t{\n\t\t\tholderArray[haIndex] = shuttle.seats[i];\n\t\t\thaIndex++;\n\t\t}\n\n\t\tshuttle.seats[i] = null;\n\t}\n\n\toccupiedSeats = 0;\n\tfor (var i = 0; i < SEATS; i++)\n\t{\n\t\tif (holderArray[i] != null)\n\t\t{\n\t\t\tseatPassenger(holderArray[i]);\n\t\t}\n\t}\n}", "title": "" }, { "docid": "140925d5cca731c6b376ac50a566f1ed", "score": "0.5279627", "text": "updateOpenSeats() {\n const wasFull = this.seatsOpen === 0;\n const gameId = this.id;\n this.seatsOpen = settings.maxPlayers - this.players.byId.length;\n this.trigger('playerChange', 'playerChange', this);\n if (this.seatsOpen === 0) {\n return this.trigger('full', gameId);\n }\n if (this.seatsOpen === settings.maxPlayers) {\n return this.trigger('empty', gameId);\n }\n if (wasFull && this.seatsOpen > 0) {\n return this.trigger('nowAvailable', gameId, this.seatsOpen);\n }\n return this;\n }", "title": "" }, { "docid": "2530503d942edcdda38d019acafcccbe", "score": "0.52608275", "text": "function updateRooms() {\n indexHub.server.updateRooms();\n }", "title": "" }, { "docid": "2646e382e7ab97128e41a53463e28802", "score": "0.52438605", "text": "function updatePocket(newCards) {\n // Cover cards and show them\n coverCards();\n unhidePocket();\n // Reset current pocket\n pocketCards = [];\n // Determine cards and insert them into array\n var i;\n for (i = 0; i < 2; i++) {\n var card = '';\n switch (newCards.cards[0][i]) {\n case 11:\n // card.concat('J');\n card+='J';\n break;\n case 12:\n // card.concat('Q');\n card+='Q';\n break;\n case 13:\n // card.concat('K');\n card+='K';\n break;\n case 14:\n // card.concat('A');\n card+='A';\n break;\n default:\n // card.concat(newCards.cards[i][0]);\n card+=newCards.cards[0][i];\n break;\n }\n switch (newCards.cards[1][i]) {\n case 1:\n // card.concat('D');\n card+='D';\n break;\n case 2:\n // card.concat('C');\n card+='C';\n break;\n case 3:\n // card.concat('H');\n card+='H';\n break;\n case 4:\n // card.concat('S');\n card+='S';\n break;\n }\n pocketCards.push(card);\n }\n // Change their pictures\n pocketCard1.getElementsByTagName('img')[1].src='../img/pokerGame/' + pocketCards[0]+\".png\";\n pocketCard2.getElementsByTagName('img')[1].src='../img/pokerGame/' + pocketCards[1]+\".png\";\n\n ShowCards();\n}", "title": "" }, { "docid": "37459a2076aadf8d49ccc73036d4b5d8", "score": "0.5241791", "text": "function updateUserList(crName) {\n //users.sort();\n //io.emit('get users', users);\n chatroom[crName].users.sort();\n io.emit('get users', chatroom[crName].users, crName);\n }", "title": "" }, { "docid": "4a3617c0cd5000700c9c957428ab8055", "score": "0.5233143", "text": "function updateMechStatus() {\n\t\n\tlet currentTile = map[mech.position.x][mech.position.y];\n\t\n\t//update temperature\n\tlet targetTemp = currentTile.temp;\n\tlet amount = Math.floor((targetTemp-mech.status.temp) / 4);\n\tif (mech.status.temp != targetTemp) {\n\t\tchangeTemp(amount);\n\t}\n\t\n\t//Print warning messages\n\tif (mech.status.alive) {\n\t\tif (mech.status.temp > v_tempMax) {\n\t\t\tprintToConsole(\"REACTOR OVERHEATING\", true, true);\n\t\t}\n\t}\n\t\n\t//handle collision\n\tif (mech.position.x === enemy.position.x && mech.position.y === enemy.position.y) {\n\t\tmech.damage(10);\n\t\tprintToConsole(\"PROXIMITY ALERT: REACTOR STRESS\", true, true);\n\t}\n}", "title": "" }, { "docid": "75ff454d760ac7d3f655a8a17f32091c", "score": "0.5229968", "text": "updateAllClients() {\n let playerData = [];\n for (let player in this.players) {\n playerData.push(player.data);\n }\n\n for (let player in this.players) {\n player.gameSocket.send(playerData);\n }\n }", "title": "" }, { "docid": "3356ef46d6bceda3ffffef0ac714e44c", "score": "0.5225724", "text": "function updateChat(msg) {\n var data = JSON.parse(msg.data);\n insert(\"chat\", data.userMessage);\n id(\"userlist\").innerHTML = \"\";\n data.userlist.forEach(function (user) {\n insert(\"userlist\", \"<li>\" + user + \"</li>\");\n });\n}", "title": "" }, { "docid": "e38de4c3543be20dfe0679839fd96676", "score": "0.5220643", "text": "onMusclePainUpdated(event) {\n\n // Update the pain of the muscle\n let muscle = event.context.muscle;\n let level = event.context.level;\n let muscles = this.state.session.muscles;\n\n if (muscles == null) muscles = [{muscle: muscle, painLevel: level}];\n else {\n for (var i = 0; i < muscles.length; i++) {\n if (muscles[i].muscle == muscle) muscles[i].painLevel = level;\n }\n }\n\n this.setState({session: {...this.state.session, muscles: muscles}});\n\n }", "title": "" }, { "docid": "c68ba61aa05cb792aba13ec3b68c90ad", "score": "0.521672", "text": "clientsUpdate(){\n\t\tlet data = {\n\t\t\tworld: {\n\t\t\t\tgrid: this.worldController.world.grid\n\t\t\t},\n\t\t\tunits: this.unitManager.units\n\t\t};\n\t\t\n\t\t// Send data to all players\n\t\tthis.io.emit('change', data);\n\t}", "title": "" }, { "docid": "76fdc9da71715289398957ab79241a86", "score": "0.52156854", "text": "updateCount() {\n const unreads = this.$popup.querySelector( '.lcx-count' );\n if( !unreads )\n return;\n\n let unreadChats = 0;\n\n const totalNewMsgs = Object.keys( this._unreads ).length;\n if( totalNewMsgs > 0 ) {\n \n for( var chatid in this._unreads ) {\n if( chatid != this._chatid )\n unreadChats++;\n }\n\n if( unreadChats > 0 ) {\n unreads.innerText = totalNewMsgs;\n unreads.classList.remove( '__lcx-hide' );\n } else\n unreads.classList.add( '__lcx-hide' );\n \n } else {\n unreads.classList.add( '__lcx-hide' );\n }\n }", "title": "" }, { "docid": "f685de88dd75f4bf806c915e8c82ce37", "score": "0.52155894", "text": "sendCurrentChapterTextWithSocket(verseId, currentVerseText) {\n\n const ws = new WebSocket(`ws://${location.host}/`);\n\n this.setState({currentVerseText: currentVerseText});\n\n ws.onopen = () => {\n ws.send(JSON.stringify(\n {\n category: this.props._ui.category.name,\n data: {\n book: this.state.currentBookName,\n chapter: this.state.currentChapterId,\n id: verseId,\n text: this.state.currentVerseText\n }\n }\n ));\n\n const data = JSON.stringify(\n {\n category: this.props._ui.category.name,\n data: {\n book: this.state.currentBookName,\n chapter: this.state.currentChapterId,\n id: verseId,\n text: this.state.currentVerseText\n }\n }\n );\n\n // Update in the Db\n axios.put(`http://${location.host}/current`, {data: data})\n .then(function (reply) {\n // console.log(reply.data);\n // if (reply.data.success) {\n // this.setState({currentTrackText: newtext});\n // }\n })\n .catch(function (error) {\n console.log(error);\n });\n\n };\n }", "title": "" }, { "docid": "07d1ad407b55a788e88d0e4e0883db49", "score": "0.521394", "text": "function refresh(){ if(lhnJsSdk.chatSession == null){ firstOpen = {chat: true, ticket: true, callback: true, knowledge: true}; lhnJsSdk.closeHOC(); } }", "title": "" }, { "docid": "060df1b7ebbb21744d881ae34a4fc3c8", "score": "0.521252", "text": "function updateScore(playerChoice)\n{\n \n if(playerChoice === computerChoice){\n resultText.textContent=\"its a tie .\";\n }\n else {\n const choice=choices[playerChoice];\n console.log(choice.defeats.indexOf(computerChoice));\n if(choice.defeats.indexOf(computerChoice)>-1){\n startConfetti();\n resultText.textContent=\"You Won\";\n playerScoreNumber++;\n playerScoreEl.textContent=playerScoreNumber;\n }\n else {\n resultText.textContent=\"you Lost\";\n // stopConfetti();\n computerScoreNumber++;\n computerScoreEl.textContent=computerScoreNumber;\n }\n }\n}", "title": "" }, { "docid": "46b52313b081b9531633a174e8c4ae49", "score": "0.5212508", "text": "function updateChairArray() {\n chairArr.length = 0; // clear the Array\n myDiagram.nodes.each(function (node) {\n if (node.data === null)\n return;\n if (node.data.item === \"chair\" || node.data.item === \"arm chair\" || node.data.item === \"couch\"\n || node.data.item === \"queen bed\" || node.data.item === \"twin bed\") {\n chairArr.push(node);\n }\n });\n }", "title": "" }, { "docid": "a63dc4ec40e53c1bd70ebb839bf577e7", "score": "0.52092206", "text": "function updateDockBadge() {\r\n\tvar unreadCount = new Array(0,0,0,0,0); \r\n\t//[contact, chatroom, public account, filehelper, friend request message](*, @chatroom, gh_, filehelper, fmessage)\r\n\tvar username = \"\"; // or \"un\" as the key attribute indicator\r\n\tvar j = 0; // for categorisation of different message types\r\n\tvar chatList = document.getElementsByClassName(\"chatListColumn\"); // the array contains all the chat partners\r\n\tfor(var i=0;i < chatList.length; i++){\r\n\t\tusername = chatList[i].getAttribute(\"username\");\r\n\t\tif (username!= null){\r\n\t\t\tif (username.indexOf(\"fmessage\") == 0){\r\n\t\t\t\tj = 4;\r\n\t\t\t}else if (username.indexOf(\"filehelper\") == 0){\r\n\t\t\t\tj = 3;\r\n\t\t\t}else if (username.indexOf(\"gh_\") == 0){\r\n\t\t\t\tj = 2;\r\n\t\t\t}else if (username.indexOf(\"chatroom\") > 1){\r\n\t\t\t\tj = 1;\r\n\t\t\t}else{\r\n\t\t\t\tj = 0;\r\n\t\t\t}\r\n\t\t\tunreadCount[j] = unreadCount[j] + parseInt(chatList[i].getElementsByClassName(\"unreadDot\")[0].innerHTML) ; // update the unread count for each category\r\n\t\t}\r\n\t}\r\n\tvar totalUnreadCount = unreadCount[0] + unreadCount[1] + unreadCount[2] + unreadCount[3] + unreadCount[4];\r\n\r\n\tif (totalUnreadCount == 0){\r\n\t\twindow.fluid.dockBadge = '';\r\n\t}else{\r\n\t\tif (totalUnreadCount != badgeCount){\r\n\t\t\tif (unreadCount[0] > lastCount){\r\n\t\t\t\twindow.fluid.playSound(\"Tink\");\r\n\t\t\t}\r\n\t\t\tbadgeCount = totalUnreadCount;\r\n\t\t\twindow.fluid.dockBadge = badgeCount + ''; // turn integer to an string and update the badge\r\n\t\t}\r\n\t}\r\n\tlastCount = unreadCount[0];\r\n}", "title": "" }, { "docid": "4c60a5510f39ded93e3782f2671cf6f9", "score": "0.52065957", "text": "function UpdateUserEvent(event){\r\n if (_websocket_enabled){ //no need to poll\r\n return;\r\n }\r\n\r\n event.channels.map(function(channel){\r\n var promise = NotifistaHttp.GetMessages(event.name, channel.name, _data.User.email);\r\n promise.success(function(messages){\r\n channel.messages = messages.map(function(msg){\r\n msg.time = moment(msg.createdAt).fromNow();\r\n return msg;\r\n });\r\n });\r\n promise.error(function(error){\r\n channel.messages = [\r\n {\r\n time: 'N/A',\r\n message: 'Error in getting data'\r\n }\r\n ]\r\n })\r\n });\r\n }", "title": "" }, { "docid": "bc2c20e575ca64feac5df818c4b42f61", "score": "0.5205005", "text": "function init(server) {\n\tvar io = socket_io.listen(server);\n\n\tvar chats = {};\t// username : socket\n\n\tio.on('connection', function(socket) {\n\t\tconsole.log('someone connected');\n\n\t\tsocket.on('new sexpert', function(data) {\n\t\t\tsocket.sexpert_id = data.sexpert_id;\n\t\t\tconsole.log('sexpert join room');\n\t\t\tsocket.join('sexperts');\n\t\t});\n\n\t\tsocket.on('user join', function(data) {\n\t\t\tvar chat_id = data;\n\t\t\tif (!chat_id) {\n\t\t\t\tconsole.log('user join with an invalid chat_id');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconsole.log('user join, chat: ' + chat_id);\n\t\t\tsocket.chat_id = chat_id;\n\t\t\tsocket.type = 'user';\n\t\t\t// sexpert has already joined chat\n\t\t\tif (chats[chat_id] && chats[chat_id].sexpert) {\n\t\t\t\tchats[chat_id].user = socket;\n\t\t\t\tconsole.log('user connected');\n\t\t\t\tchats[chat_id].sexpert.emit('user connected', chat_id);\n\t\t\t\tsocket.emit('connected to sexpert', data.sexpert_id);\n\t\t\t} else {\n\t\t\t\tchats[chat_id] = {};\n\t\t\t\tchats[chat_id].user = socket;\n\t\t\t\tfor (var key in chats) {\n\t\t\t\t\tfor (var i in chats[key]) {\n\t\t\t\t\t\tconsole.log('chat: ' + key + ' , ' + i);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tio.to('sexperts').emit('update waiting');\n\t\t\t}\n\t//\t\tconsole.log(\"chats: %j\", chats);\n\t\t});\n\n\t\tsocket.on('sexpert join', function(data) {\n\t\t\tvar chat_id = data.chat_id;\n\t\t\tif (!chat_id) {\n\t\t\t\tconsole.log('sexpert join with an invalid chat_id');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconsole.log('sexpert join: ' + data.sexpert_id + ', chat: ' + chat_id);\n\t\t\tsocket.chat_id = chat_id;\n\t\t\tsocket.type = 'sexpert';\n\t\t\t// user already joined socket\n\t\t\tif (chats[chat_id] && chats[chat_id].user) {\n\t\t\t\tchats[chat_id].sexpert = socket;\n\t\t\t\tsocket.emit('user connected', chat_id);\n\t\t\t\tchats[chat_id].user.emit('connected to sexpert', data.sexpert_id);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tchats[chat_id] = {};\n\t\t\tchats[chat_id].sexpert = socket;\n\n\t\t\t// for (var key_2 in chats) {\n\t\t\t// \tfor (var i_2 in chats[key_2]) {\n\t\t\t// \t\tconsole.log(\"chat: \" + key_2 + \" , \" + i_2);\n\t\t\t// \t}\n\t\t\t// }\n\n\t//\t\tsocket.emit('user status', { online: false, chat_id : chat_id });\n\t//\t\tchats[chat_id].user.emit('connected to sexpert', data.sexpert_id);\n\t//\t\tio.to('sexperts').emit('update waiting');\n\t\t});\n\n\t\tsocket.on('user message', function(data) {\n\t\t\tif (!socket.chat_id) {\n\t\t\t\tconsole.log('user tried to send message with undefined chat_id on socket');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!data) {\n\t\t\t\tconsole.log('user message with undefined data (messasge)');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar chat_id = socket.chat_id;\n\n\t\t\tif (!chats[chat_id]) {\n\t\t\t\tconsole.log('users message has undefined chats object');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconsole.log('user message: ' + chat_id + ', ' + data);\n\t\t\t// if sexpert is in chat\n\t\t\tif (chats[chat_id].sexpert) {\n\t\t\t\tchats[chat_id].sexpert.emit('new message', { message : data, chat_id : chat_id });\n\t\t\t} else {\n\t\t\t\tio.to('sexperts').emit('update waiting');\n\t\t\t}\n\n\t\t\tchats_api.new_message(chat_id, 0, data, false, function(err, result) {\n\t\t\t\tif (err && err.closed) {\n\t\t\t\t\tsocket.emit('closed chat', chat_id);\n\t\t\t\t}\n\n\t\t\t\tif (err) {\n\t\t\t\t\tconsole.log(err);\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log('new user message: ' + result);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tsocket.on('sexpert message', function(data) {\n\t\t\tif (!data || !data.chat_id || !data.message) {\n\t\t\t\tconsole.log('sexpert message data must contain valid chat_id and message');\n\t\t\t\tif (data) { console.log('chat_id: ' + data.chat_id + ', message: ' + data.message); }\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar chat_id = data.chat_id;\n\n\t\t\tconsole.log('sexpert message: ' + chat_id + ', ' + data.message);\n\t\t\tif (!chats[chat_id]) {\n\t\t\t\tconsole.log('sexpert message has undefined chats object');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// user is connected\n\t\t\tif (chats[chat_id].user) {\n\t\t\t\tchats[chat_id].user.emit('new message', data.message);\n\t\t\t}\n\n\t\t\tchats_api.new_message(chat_id, 1, data.message, chats[chat_id].user, function(err, result) {\n\t\t\t\tif (err && err.closed) {\n\t\t\t\t\tsocket.emit('closed chat', chat_id);\n\t\t\t\t}\n\n\t\t\t\tif (err) {\n\t\t\t\t\tconsole.log(err);\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log('new sexpert message: ' + result);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tsocket.on('user end chat', function() {\n\t\t\tvar chat_id = socket.chat_id;\n\t\t\tif (!chat_id) {\n\t\t\t\tconsole.log('user tried to end chat with undefined chat_id on socket');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tchats_api.disconnect(chat_id, function(err) {\n\t\t\t\tif (err) {\n\t\t\t\t\tconsole.log(err);\n\t\t\t\t}\n\n\t\t\t\tif (chats[chat_id] && chats[chat_id].sexpert) {\n\t\t\t\t\tchats[chat_id].sexpert.emit('user end chat', chat_id);\n\t\t\t\t}\n\n\t\t\t\tconsole.log('user end chat ' + chat_id);\n\t\t\t\tchats[chat_id] = null;\n\t\t\t\tsocket.disconnect();\n\t\t\t});\n\t\t});\n\n\t\tsocket.on('sexpert end chat', function(chat_id) {\n\t\t\tif (!chat_id) {\n\t\t\t\tconsole.log('sexpert tried to end chat with undefined chat_id');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tchats_api.disconnect(chat_id, function(err) {\n\t\t\t\tif (err) {\n\t\t\t\t\tconsole.log(err);\n\t\t\t\t}\n\n\t\t\t\tif (chats[chat_id] && chats[chat_id].user) {\n\t\t\t\t\tchats[chat_id].user.emit('sexpert end chat');\n\t\t\t\t}\n\n\t\t\t\tconsole.log('sexpert end chat ' + chat_id);\n\t\t\t\tchats[chat_id] = null;\n\t\t\t});\n\t\t});\n\n\t\tsocket.on('disconnect', function() {\n\t\t\tconsole.log('someone disconnected');\n\t\t\t// console.log(socket);\n\n\t\t\tif (socket.sexpert_id) {\n\t\t\t\tsexperts.change_active_status_internal(socket.sexpert_id, false, function(err, data) {\n\t\t\t\t\tif (err) {\n\t\t\t\t\t\tconsole.log(err);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (!socket.chat_id || !chats[socket.chat_id]) {\n\t\t\t\tconsole.log('no socket chat_id to disconnect');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar chat_id = socket.chat_id;\n\n\t\t\tif (socket.type === 'sexpert') {\n\t\t\t\tif (!chats[chat_id].user) {\n\t\t\t\t\tconsole.log('sexpert disconnected without attached user');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tchats[chat_id].user.emit('sexpert disconnected');\n\t\t\t\tchats[chat_id].sexpert = null;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!chats[chat_id].sexpert) {\n\t\t\t\tconsole.log('user disconnected without attached sexpert');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tchats[chat_id].sexpert.emit('user disconnected', chat_id);\n\t\t\tchats[chat_id].user = null;\n\t\t});\n\n\t\tsocket.on('error', function(err) {\n\t\t\tif (err) {\n\t\t\t\tconsole.log(err);\n\t\t\t} else {\n\t\t\t\tconsole.log('socket server error');\n\t\t\t}\n\t\t});\n\t});\n}", "title": "" }, { "docid": "99d28ee7c592d7a394367b245357b353", "score": "0.5203475", "text": "function updateChannel(gameName) {\n channel = socket.channel(\"game:\" + gameName, {})\n channel.join()\n .receive(\"ok\", state_update)\n .receive(\"error\", resp => {\n console.log(\"Unable to join to channel\", resp)\n });\n channel.on(\"view\", state_update);\n}", "title": "" }, { "docid": "5edf8911984f4d602e7d0107a7ce7338", "score": "0.51984495", "text": "function updateScore(playerChoice){\n\n if (playerChoice===computerChoice){\n resultText.textContent=\"its a tie\";\n }else{\n const choice =choices[playerChoice];\n \n if(choice.defeats.indexOf(computerChoice)>-1){\n startConfetti();\n resultText.textContent=\"You Won!\";\n playerScoreNumber++;\n playerScoreEl.textContent= playerScoreNumber;\n }else{\n resultText.textContent=\"You Lost!\";\n computerScoreNumber++;\n computerScoreEl.textContent=computerScoreNumber;\n }\n }\n}", "title": "" }, { "docid": "c15d65db3dc0e9a68ef536db113f2cc6", "score": "0.5195919", "text": "function updateThmbnails(myData){ \n removeAllThumbs(); \n getThumbnailData(); \n getParticipants(myData); \n insertMeetingThumb();\n insertAvatars();\n}", "title": "" }, { "docid": "363c2efe67231548988625ece5f38155", "score": "0.51959085", "text": "function updateValues() {\n console.log('Updating content...');\n socket.emit('update', {'msg': 'Content Updated!'});\n}", "title": "" }, { "docid": "feb984ad66e35070e5d1881b45de8054", "score": "0.51926035", "text": "function update_clients(data) {\n\tfor( var clientid in data ) {\n\t\t//Attempt to update snake\n\t\tupdate_snake(clientid, data[clientid]);\n\t};\n}", "title": "" }, { "docid": "203d67281d402b68737de54b2dd5efb4", "score": "0.519123", "text": "updatePlayerInformation(tileSituation, currentDiscard) {\n var players = this.state.players;\n players.forEach(player => {\n var situation = tileSituation[player.name];\n player.handSize = situation.handSize;\n player.bonus = situation.bonus;\n player.revealed = situation.revealed;\n });\n var us = tileSituation[this.state.settings.name];\n this.setState({\n players,\n tiles: us.tiles,\n bonus: us.bonus,\n revealed: us.revealed,\n discarding: !currentDiscard,\n currentDiscard,\n discardsSeen: []\n });\n }", "title": "" }, { "docid": "f2ab4c8fec2451bf9892006b25fdbb03", "score": "0.51886237", "text": "function grabChats(){\n Chats.all().then(function(data){\n $scope.chats = data;\n });\n }", "title": "" }, { "docid": "31f06d5822b9544a9d7266912b6d3f3c", "score": "0.51882166", "text": "function appendToHTML(chats, userID) {\n for (let chat in chats) {\n let html = buildHTML(chats[chat], userID);\n $(\"#chats\").prepend(html);\n }\n}", "title": "" }, { "docid": "0e9e59af072bdd40f54486bbfd6889d0", "score": "0.51832116", "text": "update(authoritative_state) {\n this.logger.debug('Updating Client.', socket.id);\n const players = authoritative_state.players;\n for (let [player_uuid, player_state] of Object.entries(players)) {\n if (!(player_uuid in this.players)) {\n //this.players[player_uuid] = new ServerArtifact(player_state);\n //this.players[player_uuid] = new Vagile(CanLog(Thing));\n this.players[player_uuid] = new Player();\n }\n this.players[player_uuid].update(player_state);\n }\n }", "title": "" }, { "docid": "4096207a24cf0d601ac2b95df638e48e", "score": "0.518084", "text": "function update() {\n document.getElementById(\"kibbleAcquired\").innerHTML = gameData.kibble + \" Kibble Acquired\";\n document.getElementById(\"catsAcquired\").innerHTML = gameData.cats + \" Cats Available\";\n document.getElementById(\"catCost\").innerHTML = \"Cat cost: \" + costs.catCost + \" kibble\";\n document.getElementById(\"fishers\").innerHTML = catActions.fishers + \" cats fishing\";\n document.getElementById(\"missionaries\").innerHTML = catActions.missionaries + \" missionary cats\";\n document.getElementById(\"gold\").innerHTML = gameData.gold + \" Gold\";\n document.getElementById(\"toys\").innerHTML = gameData.toys + \" Toys\";\n document.getElementById(\"fishAcquired\").innerHTML = gameData.fish + \" Fish\";\n}", "title": "" }, { "docid": "884ce6ec4cbb5da568bcd2b1b89c1f4d", "score": "0.5177444", "text": "scheduleUpdatesForActiveSockets() {\n sails.io.sockets.in('activeSockets').clients((err, members) => {\n members.map((socketId) => {\n let characterId = pool[socketId];\n\n sails.log.debug(`Scheduling update for ${characterId}...`);\n\n Scheduler.updateCharacter(characterId);\n });\n });\n }", "title": "" }, { "docid": "27ef196e28d7d1aded716a19ded3d1ae", "score": "0.5175581", "text": "function updateChatBadge() {\n if(!isTabActive('chat')) {\n $.ajax({\n url: $('body').data('opt-base-uri') + '?/chat',\n data: { action: 'getLineCount' },\n method: 'POST',\n \n }).done(function(data) {\n var count = data - $('#chatlog').data('count');\n $('#menu .badge').text(count);\n \n setTimeout(function() {\n updateChatBadge();\n }, 5000);\n });\n\n } else {\n setTimeout(function() {\n updateChatBadge();\n }, 5000);\n }\n}", "title": "" }, { "docid": "9bd290877b79602bdbddbc2691fe1fb5", "score": "0.5173053", "text": "function updateChat(data) {\n insert(\"chat\", data.userMessage);\n id(\"userlist\").innerHTML = \"\";\n data.userlist.forEach(function (user) {\n insert(\"userlist\", \"<li>\" + user + \"</li>\");\n });\n}", "title": "" }, { "docid": "cb9311f5529c47a2a346710cdfcac9c0", "score": "0.5172213", "text": "function updateSession(){ \n\t\t\t// save the tutor broadcast settings \n\t\t\tcurrentUser.updateTutorSession(data.startTime, data.period, data.courses, meetingSpots, data.price, data.lat, data.lon, function(tutor){\n\n\t\t\t\t// check if future broadcast \n\t\t\t\tif(new Date().getTime() < tutor.tutorSession.startTime){\n\t\t\t\t\tconsole.log(\"Adding future broadcaster..\");\n\t\t\t\t\tfutureBroadcasters.push(tutor);\n\t\t\t\t\ttimeSortTutors(futureBroadcasters);\n\t\t\t\t\tif(futureBroadcasters.length == 1){\n\t\t\t\t\t\t// if it's the only tutor, kickstart the interval checking \n\t\t\t\t\t\tavailabilityInterval(0);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tsocket.emit('sessionUpdated', {session: currentUser.getSessionData()});\n\t\t\t\tcurrentUser = tutor; // update our version of currUser so it's same as DB \n\n\t\t\t\t// add the user to the currently broadcasting pool\t\n\t\t\t\taddToPool();\n\n\t\t\t});\t\t \n\t\t}", "title": "" }, { "docid": "bab6edd6ddcd72e6ac27de013300f8e6", "score": "0.51713216", "text": "function update(str1,str2){\n\t\tchatter[chatpoint] = \" \\n> \" + str1;\n\t\tchatter[chatpoint] += \"\\n> \" + str2;\n\t\tchatpoint ++ ; \n\t\tif( chatpoint >= chatmax ){ chatpoint = 0; }\n\t\treturn write();\n\t}", "title": "" }, { "docid": "b861198858002fe90c80ddfcf8faa158", "score": "0.5167451", "text": "function update() {\n frames++;\n if (trial_time > 700 && coin_count > -1) {\n trial_time = 0;\n coin_count = 0;\n stage++;\n if (stage < 7) {\n currentstate = states.Junction;\n junction_before_choice = true;\n console.log(\"Time to get a new feedback data\");\n //Calling json to get new data\n get_shuttle_stats();\n }\n else {\n report_score(score);\n reset_game_vars();\n stage = 1;\n hideGameCanvas();\n }\n }\n\n if (currentstate !== states.Score) {\n fgpos = (fgpos - 2) % 14;\n } else {\n // set best score to maximum score\n best = Math.max(best, score);\n try {\n localStorage.setItem(\"best\", best);\n } catch (err) {\n //needed for safari private browsing mode\n }\n scrollTextPos = width * 1.5;\n }\n\n if (currentstate === states.Game) {\n coins.update();\n }\n\n bird.update();\n backgroundFx.update();\n}", "title": "" }, { "docid": "b694fef13df771e6bd22b89348732dc0", "score": "0.5158164", "text": "update() {\n //Update the starship position\n this.starship.move(this.canvas);\n this.starship.draw(this.context);\n\n this.updateActionForShootAndSaucer()\n\n //Filter all the active saucers\n this.saucers = this.saucers.filter(element => element.active === LifeState.ACTIVE);\n\n //For each active saucer, update the status\n this.saucers.forEach((element) => {\n element.update(this.context);\n });\n\n //Filter all the active shoots\n this.shoots = this.shoots.filter(element => element.active === LifeState.ACTIVE);\n\n //For each active shoot, update the status\n this.shoots.forEach((element) => {\n element.update(this.context);\n });\n\n //Filter all the active shoots\n this.explosions = this.explosions.filter(element => element.active === LifeState.ACTIVE);\n\n //For each active shoot, update the status\n this.explosions.forEach((element) => {\n element.update(this.context);\n });\n }", "title": "" }, { "docid": "ad4d43f14291c48504909bda37c1b378", "score": "0.5149129", "text": "function updateClientList() {\n const message = {\n type: 'userCount',\n content: wss.clients.size,\n };\n\n wss.broadcast(JSON.stringify(message));\n}", "title": "" }, { "docid": "726c1d9a0bbe757ef579257716fd52ff", "score": "0.51486987", "text": "function updateSeatIO(data) {\n socket.emit('update seats db', data);\n}", "title": "" }, { "docid": "38cc29b77aa081fed2ad61216b841f04", "score": "0.51483256", "text": "function resetGlobalChats() {\n\t// Clear all global chats..\n\t// document.getElementById('globalChatMessagesDisplay').innerHTML = \"<strong>SkudPaiSho: </strong> Hi everybody! To chat with everyone, ask questions, or get help, join The Garden Gate <a href='https://discord.gg/thegardengate' target='_blank'>Discord server</a>.<hr />\";\n}", "title": "" }, { "docid": "32fce622c65a9a50b712ce4537b7dad7", "score": "0.5140975", "text": "function watchChaters() {\n\t\tif (usersDisplay.style.display === 'block')\n\t\t{\n\t\t\tif (chatWindow.length > 0)\n\t\t\t\tsetChatWindow([]);\n\t\t\tusersDisplay.style.display = 'none';\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsocket.emit('getSocketUsers');\n\t\t\tusersDisplay.style.display = 'block';\n\t\t}\n\t\tif (messCounter.length > 0)\n\t\t\tsetMessCounter([]);\n\t}", "title": "" }, { "docid": "a9ca1ba516de177ea25f03b199aa529b", "score": "0.51404154", "text": "componentWillReceiveProps(nextProps) {\n if (nextProps.seats.SeatsUsed !== this.props.seats.SeatsUsed) {\n nextProps.getSeatUsage();\n }\n }", "title": "" }, { "docid": "3db62b1bd1f8a5f1efc39fc131224fa5", "score": "0.51381654", "text": "function sendMessage(){\r\n\tupdateChat(2);\r\n}", "title": "" }, { "docid": "01624a6322e6ac58282e638c7ca4fa1d", "score": "0.51349306", "text": "function updateCounter() { }", "title": "" }, { "docid": "d3615308a1364e00ceda0dd4438ade25", "score": "0.51345015", "text": "updateVictoryScore() {\n document.getElementById(\"victory-score\").innerHTML = Number(g_game._player._kill_nb * 10 + g_game._player._coins * 10);\n }", "title": "" }, { "docid": "f7b0c7ab8301c05d5aaa4761da57a7b4", "score": "0.5132729", "text": "updateWatchlist() {\n this.fb.dataNode = this.dataNode;\n this.fb\n .getFirebaseRef()\n .child(this.user.uid)\n .on('child_changed', snapshot=>{\n document.querySelector(`#${snapshot.key} a`).innerHTML = snapshot.val().symbol;\n this.watchlistCurrencies[snapshot.key] = { symbol: snapshot.val().symbol };\n });\n }", "title": "" }, { "docid": "d09c71a6b3026e733f909ccaed9642b9", "score": "0.5131952", "text": "function updateBadge() {\n if (currently_snoozed) {\n\n } else {\n var texto = String(trees_planted);\n if(trees_planted>1000)\n {\n texto = String(Math.floor(trees_planted/1000) + \"K\")\n }\n chrome.browserAction.setBadgeText({text:texto});\n chrome.browserAction.setBadgeBackgroundColor({color:[0,151,151,151]});\n }\n }", "title": "" }, { "docid": "c8f4bc4a8b97b25d99a2ce04beab9ade", "score": "0.5131455", "text": "function updateChips() {\n for (let key in dangerLevel) {\n document.getElementById(key).innerText = dataSetOriginalLabels[Number(key - 1)]\n if (dangerLevel[key] == true) {\n document.getElementById(key).classList.add('chip-selected');\n }\n document.getElementById(key).onclick = function (event) {\n event.target.classList.toggle('chip-selected');\n dangerLevel[event.target.id] = !dangerLevel[event.target.id];\n updatePlot()\n }\n }\n}", "title": "" }, { "docid": "c3d0e2d962e9b9aac483b3174e48f5aa", "score": "0.5126638", "text": "function updateClock() {\n tenSecCountDown--;\n let today = new Date();\n let hours = today.getHours() % 12;\n let mins = today.getMinutes();\n let secs = today.getSeconds();\n\n hourHand.groupTransform.rotate.angle = hoursToAngle(hours, mins);\n minHand.groupTransform.rotate.angle = minutesToAngle(mins);\n secHand.groupTransform.rotate.angle = secondsToAngle(secs);\n \n updateStepsIconPos();\n \n if (randomChangeActive == 1)\n randomChange();\n \n //Save every 60 seconds\n if (tenSecCountDown <= 0)\n saveStatus();\n \n if (tenSecCountDown <= 0)\n tenSecCountDown = 10;\n}", "title": "" }, { "docid": "cae6a96b5b7132ac520704da2491725d", "score": "0.512325", "text": "updateChatMessages() {\n\t\tif (this.refresh_timeout)\n\t\t\tclearTimeout(this.refresh_timeout);\n\t\tthis.refresh_timeout = setTimeout(this.updateChatMessagesDelayed.bind(this), 500);\n\t}", "title": "" }, { "docid": "8391dea7ed14f0f8a636555e2c03e4f1", "score": "0.51224905", "text": "function updateBoard(){\r\n \r\n var winner = checkForWin();\r\n \r\n if(winner == 3) turn.innerHTML = \"Cat's Game (No Winners)\";\r\n else turn.innerHTML = \"Player \"+winner+\"\"\r\n \r\n \r\n turn.innerHTML = \"It is player \" + playerTurn + \"'s turn.\";\r\n \r\n // loop through rows:\r\n for(var y = 0; y < bttns.length; y++){\r\n for (var x = 0; x < bttns[y].length; x++){\r\n \r\n let value = spaces[y][x];\r\n \r\n if(value == 0) value=\"\";\r\n if(value == 1) value=\"X\";\r\n if(value == 2) value=\"O\";\r\n \r\n bttns[y][x].innterHHTML = value;\r\n }\r\n }\r\n}", "title": "" }, { "docid": "8beb11ee1d01f768b0087bd3cd493b80", "score": "0.51196563", "text": "function updateRatings(matches) {\n // see comments in deriveMatches\n matches.forEach(function (match) {\n updateRating(match.player, match.opponents, match.outcomes);\n });\n }", "title": "" }, { "docid": "d5f90ec6eab7f495c0a976937424f438", "score": "0.51180065", "text": "function broadcastInfo() {\r\n //check for winner\r\n var winnerId;\r\n let surviviorCount = 0;\r\n for(var i = 0; i < clients.length; i++) {\r\n if(clients[i].isZomb == false) {\r\n winnerId = clients[i].id;\r\n surviviorCount++;\r\n }\r\n }\r\n\r\n\r\n if(surviviorCount == 1 && clients.length > 1) {\r\n io.sockets.emit('winner', winnerId);\r\n }else {\r\n io.sockets.emit(\"gameInfo\", clients);\r\n }\r\n\r\n\r\n \r\n}", "title": "" }, { "docid": "3beb6376247df8ba4e9355964d55904b", "score": "0.5116892", "text": "changeChat(contact, index) {\n this.currentChat = index;\n contact.toRead = false;\n }", "title": "" }, { "docid": "6c3aa0eb440217af119fd58a44b6686a", "score": "0.5116467", "text": "function updateWins () {\n\t\tdocument.getElementById(\"wins\").innerHTML = \"Wins: \" + wincounter;\n\t}", "title": "" }, { "docid": "6a8ef26da826c5a329c1d6d2a06cf0af", "score": "0.5115093", "text": "function updateChatWindow()\r\n{\r\n\t//alert('updateChatWindow called');\r\n\t/* \r\n\t* do NOT do an update if an update is already in progress.\r\n\t*/\r\n\tif (updateInProgress == 0 )\r\n\t{\r\n\t\tupdateInProgress = 1;\r\n\t\tskippedUpdates = 0;\r\n\t\tDWREngine._execute(_ajaxConfig._cfscriptLocation, null, 'getUpdates', sessionid, lastRead, updateChatWindowResult);\r\n\t} else if (skippedUpdates > 1) {\r\n\t\tskippedUpdates++;\r\n\t\tdebugOutput('Skipped ' + skippedUpdates + ' updates! Something might be wrong.');\r\n\t} else {\r\n\t\tskippedUpdates++;\r\n\t}\r\n\treturn false;\r\n}", "title": "" }, { "docid": "7459ed37b0cbb5d4a6bf323b67af5c85", "score": "0.5114633", "text": "function updateChannelUsers(server, oldChannel, newChannel, user){\n /*\n channels format is \n [ \n [channel name, [list of users]]\n ]\n */\n\n //console.log (\"in updateChannelUsers, server channels BEFORE = \");\n //console.log(servers[server].channels);\n //console.log (\" ---------------------------------------\");\n let oChannel = []\n let nChannel = []\n \n let channels = servers[server].channels;\n for(let i = 0; i < channels.length; i++){\n\tif(oldChannel == channels[i][0]){\n\t oChannel = channels[i][1];\n\t}else if (newChannel == channels[i][0]){\n\t nChannel = channels[i][1];\n\t}\n }\n\n for(let i = 0; i < oChannel.length; i++){\n\tif(oChannel[i] == user){\n\t oChannel.splice(i, 1);\n\t if(newChannel != null)\n\t\tnChannel.push(user);\n\t break;\n\t}\n }\n\n //console.log (\"in updateChannelUsers, server channels = \");\n //console.log(servers[server].channels);\n //console.log (\" ---------------------------------------\");\n}", "title": "" }, { "docid": "7129d6ea42c6160d38ddeb2f404731b9", "score": "0.51145154", "text": "function main() {\n\tliveChat();\n\n\t// refresh chat\n\tupdateChat();\n}", "title": "" }, { "docid": "7197abccc90fda897ad844749a6b8475", "score": "0.5113401", "text": "function updateChannels() {\n channelClearer = new lurker();\n channelClearer.start('#channels','exist').whenReady(function(){\n $('#known-channels ul').empty();\n $('#invited-channels ul').empty();\n $('#my-channels ul').empty();\n });\n\n client.getUserChannels()\n .then(page => {\n channels = page.items.sort(function(a, b) {\n return a.friendlyName > b.friendlyName;\n });\n \n channelLoader = new lurker();\n channelLoader.start('#channels','exist').whenReady(function(){\n channels.forEach(function(channel) {\n switch (channel.status) {\n case 'joined':\n addJoinedChannel(channel);\n break;\n case 'invited':\n addInvitedChannel(channel);\n break;\n default:\n addKnownChannel(channel);\n break;\n }\n });\n });\n })\n}", "title": "" }, { "docid": "d0ac2fabae8471f781aa4d049f29c033", "score": "0.5109002", "text": "function sendCurrentUsers(socket) { \n var info = clientInfo[socket.id];\n var users = [];\n if (typeof info === 'undefined') {\n return;\n }\n \n Object.keys(clientInfo).forEach(function(socketId) {\n var userinfo = clientInfo[socketId];\n \n if (info.room == userinfo.room) {\n users.push(userinfo.name);\n }\n\n });\n \n\n socket.emit(\"message\", {\n name: \"Natasha\",\n text: \"Current Users : \" + users.join(', '),\n timestamp: moment().valueOf()\n });\n\n}", "title": "" }, { "docid": "194de47ced6b2d09bae36c30551a8d21", "score": "0.5104894", "text": "function updateUsers(view) {\n // There are arrays for online, offline and old user. When I click on 'All'. I refresh the info on the arrays or maps. When I click on Online, Offline I display only the interesting user. \n removeElementsByClass('row');\n\n initUsers(view);\n if (view == 'All') {\n // Clear Online, Offline arrays\n arrOnlineUsers = [];\n arrOfflineUsers = [];\n for (var i = 0; i < usersElem.length; ++i) {\n var reqUrl = \"https://api.twitch.tv/kraken/streams/\" + usersElem[i].textContent;\n sendReq(reqUrl, i);\n }\n //removeElementsByClass(\"user\");\n //initUsers();\n\n } else if (view == 'Online') {\n removeElementsByClass(\"offline\");\n removeElementsByClass(\"closed\");\n } else if (view == 'Offline') {\n removeElementsByClass(\"online\");\n removeElementsByClass(\"closed\");\n }\n}", "title": "" }, { "docid": "2ab67e270b97dddeccbe5fe66fa3daa3", "score": "0.5102434", "text": "function updateGame() {\n\t//console.log(\"------\");\n\tTopicGen.updateTopics();\n\t//At this point officers are moving at random, but they are MOVING!\n\t/*var sataRandom = Math.floor((Math.random()*100)); //0-99\n\tif(sataRandom < 4){\n\t\tvar randomOfficerIndex = Math.floor((Math.random()*3)); //0-2\n\t\tvar movingOfficer = Officers[randomOfficerIndex];\n\t\tvar randomPlaceIndex = Math.floor((Math.random()*AllPlaces.length)); //0-length\n\t\tvar randomPlace = AllPlaces[randomPlaceIndex];\n\t\tmovingOfficer.moveToPlace(randomPlace);\n\t}*/\n\t//checking if officer is dealing with topic\n\tid = Officers.length;\n\tfor (var i =0; i<id; i++){\n\t\tvar officer = Officers[i];\n\t\tvar position = officer.returnPosition();\n\t\t//if (position.returnTopic() != undefined){\n\t\t\t//console.log(position.returnTopic());\n\t\t\tif (position.returnTopic() != null){\n\t\t\t\tposition.addTopic(null);\n\t\t\t\t//position.addTopic(null);\n\t\t\t\t\n\t\t\t\t//TopicGenerator need update too, so this indicates him to make new topics\n\t\t\t\tvar newNumber = TopicGen.returnActiveTopics() -1;\n\t\t\t\tTopicGen.setActiveTopics(newNumber);\n\t\t\t\t\n\t\t\t\tconsole.log(\"aihe keskusteltu!!!\" + TopicGen.returnActiveTopics());\n\t\t\t}\n\t\t//}\n\t}\n}", "title": "" }, { "docid": "1576c2cae6c644073b6304f12e9abce2", "score": "0.5102331", "text": "function sendLatestChanges() {\n log(' ',t);\n log('Checking for updated stats...',t);\n //here is where we parse the lua to json\n lua2json.getVariable(CONFIG.getStatsPath(), CONFIG.getStatsVar(), function(err, json) {\n if (err) {\n\t log('ERROR parsing LUA to JSON! Be sure your config setting for statsDir is correct.',e);\n\t\t log(err,e);\n return false;\n } else {\n log(' LUA parsed to JSON',i);\n //hash the new info, to compare with old hash\n var newHash = crypto.createHash('md5').update(JSON.stringify(json)).digest(\"hex\");\n //offload the rest of the work like comparing and sending to this function\n compareAndSend(newHash, json);\n }\n });\n }", "title": "" }, { "docid": "fc2ab178354bf90bf1bac25fe296d1f2", "score": "0.51014745", "text": "updateConnectionInfo(roomData) {\n console.log('Room Updated!', roomData);\n if (roomData) {\n this.setState({ connections: roomData.sockets });\n }\n imperio.emitData(null, { currentVisibilityState: this.state.isVisible });\n }", "title": "" } ]
99215fe68d7ec74c84550d649e4e9aa6
Adding :firstchild and :hover pseudoclass functionality to ie6
[ { "docid": "02b35c0d87fe50d12493efe2d96163b4", "score": "0.60210454", "text": "function ieSixEnhance() {\t\n\t\t$( \"#nav .dd\").hover(\n\t\t function () {\n\t\t $(this).addClass(\"hovered\");\n\t\t }, \n\t\t function () {\n\t\t $(this).removeClass(\"hovered\");\n\t\t }\n\t\t);\n\t\t$( \"#nav li:first-child\").addClass(\"first-child\");\n\t\t$( \"#nav .dd ul li:first-child\").addClass(\"first-child\");\n\t\t$( \"#EPI-info li:first-child\").addClass(\"first-child\");\n\t\t$( \".chart-list li li:first-child\").addClass(\"first-child\");\n\t\t$( \".callout-nav li:first-child\").addClass(\"first-child\");\n\t\t$( \"#utility-nav li:first-child\").addClass(\"first-child\");\n\t\t$( \".download-share li:first-child\").addClass(\"first-child\");\n\t\t$( \".pagination a:first-child\").addClass(\"first-child\");\n\t}", "title": "" } ]
[ { "docid": "6240b80c2b101eeffbe453143813c488", "score": "0.59290695", "text": "function firstChildren() {\r\n\t\t$('#ang-popNotificationIconContent > a:first-child').addClass('ang-first-child');\r\n\t\t$('#ang-popModuleIconContent > a:first-child').addClass('ang-first-child');\r\n\t\t$('.ang-employer > h1:first-child').addClass('ang-first-child');\r\n\t\t$('#ang-mainContent > .ang-panelWide:first-child').addClass('ang-first-child');\r\n\t\t$('.ang-locationsCol:first-child').addClass('ang-first-child');\r\n\t\t$('#ang-pInbox table tr:first-child').addClass('ang-first-child');\r\n\t\t$('#ang-pInbox table tr td:first-child').addClass('ang-first-child');\r\n\t\t$('#ang-sysMessages > div:first-child').addClass('ang-first-child');\r\n\t\t$('.ang-sbActionBar ul li:first-child').addClass('ang-first-child');\r\n\t\t$('#ang-lbMentor .ang-mentorTypes label:first-child').addClass('ang-first-child');\r\n\t\t$('.ang-statNotifications a:first-child').addClass('ang-first-child');\r\n\t\t$('#ang-profileTabs ul li:first-child').addClass('ang-first-child');\r\n\t\t$('#ang-sbFilterAccord li:first-child').addClass('ang-first-child');\r\n\t\t$('#ang-topBar > ul li:first-child').addClass('ang-first-child');\r\n\t}", "title": "" }, { "docid": "589b73496944ec0511b48b6fa0293531", "score": "0.55343086", "text": "function xFirstChild(e,t)\r\n{\r\n e = xGetElementById(e);\r\n var c = e ? e.firstChild : null;\r\n while (c) {\r\n if (c.nodeType == 1 && (!t || c.nodeName.toLowerCase() == t.toLowerCase())){break;}\r\n c = c.nextSibling;\r\n }\r\n return c;\r\n}", "title": "" }, { "docid": "282c698eb0b295f36ef634ce76b77749", "score": "0.54181415", "text": "get _firstChild() {\n return this._ordered.length ?\n this._node(this._ordered[0]) :\n null;\n }", "title": "" }, { "docid": "00c74abfc67255ad41cc6a6c8b672ea6", "score": "0.53403324", "text": "function _nodefindfirst(node, last, child) {\r\n var ctx = child ? node : node.parentNode,\r\n rv = last ? ctx.lastElementChild : ctx.firstElementChild,\r\n iter = last ? \"previousSibling\" : \"nextSibling\";\r\n\r\n if (!rv) {\r\n for (rv = last ? ctx.lastChild : ctx.firstChild; rv; rv = rv[iter]) {\r\n if (rv.nodeType === 1) { break; } // 1: ELEMENT_NODE only\r\n }\r\n }\r\n return rv;\r\n}", "title": "" }, { "docid": "fe87ca2f84d3754dc9a6b6a68bfbf41f", "score": "0.52805626", "text": "firstChild() {\n return this.enterChild(\n 1,\n 0,\n 4\n /* Side.DontCare */\n );\n }", "title": "" }, { "docid": "406c9690cd195748d4b2c7ba2a387fac", "score": "0.5247801", "text": "setFirstH1Class() {\n const document = this.spec.doc;\n const walker = document.createTreeWalker(document.body, 1 | 4 /* elements and text nodes */);\n let node = walker.currentNode;\n while (node) {\n if (node.nodeType === 3 && node.textContent.trim().length > 0) {\n return;\n }\n if (walker.currentNode.nodeType === 1 && walker.currentNode.nodeName === 'H1') {\n node.classList.add('first');\n return;\n }\n node = walker.nextNode();\n }\n }", "title": "" }, { "docid": "96f919411e98d0ddf9cae5d87ded3fc6", "score": "0.52381885", "text": "function Menu_HoverRoot(item) {\n// document.all.debug.value += \"Menu_HoverRoot \" + item.outerHTML + \"\\r\\n\";\n // Get to the TD\n var node = (item.tagName.toLowerCase() == \"td\") ?\n item:\n item.cells[0];\n\n // Find the data structure:\n var data = Menu_GetData(item);\n if (!data) {\n return null;\n }\n\n var nodeTable = WebForm_GetElementByTagName(node, \"table\");\n if (data.staticHoverClass) {\n // Merge the hover style class onto the TD\n nodeTable.hoverClass = data.staticHoverClass;\n WebForm_AppendToClassName(nodeTable, data.staticHoverClass);\n }\n\n node = nodeTable.rows[0].cells[0].childNodes[0];\n if (data.staticHoverHyperLinkClass) {\n // Merge the hyperlink hover style class\n node.hoverHyperLinkClass = data.staticHoverHyperLinkClass;\n WebForm_AppendToClassName(node, data.staticHoverHyperLinkClass);\n }\n\n return node;\n}", "title": "" }, { "docid": "aa632bdd2c77c1ce621bc756fd8e58f7", "score": "0.52221906", "text": "function firstChildElement(element) {\r\n\telement = element.firstChild;\r\n\treturn (isElement(element)) ? element : nextElement(element);\r\n}", "title": "" }, { "docid": "66797da380f2a4ee40aa00d59b424101", "score": "0.5131054", "text": "function getFirstchild(n) {\n x = n.firstChild;\n while (x.nodeType != 1) {\n x = x.nextSibling;\n }\n return x;\n}", "title": "" }, { "docid": "3929c645012ae52b12f2075d14d155dd", "score": "0.51291835", "text": "function Tab_MouseOver()\n{\n\tif(!this.Selected) this.className = \"hover\";\n\treturn false;\n}", "title": "" }, { "docid": "940577b39f36b2e752457173f73d4450", "score": "0.51261514", "text": "function first_child(par) {\n var res = par.firstChild;\n while (res) {\n if (!is_ignorable(res)) return res;\n res = res.nextSibling;\n }\n return null;\n }", "title": "" }, { "docid": "1ab98525db620d9d4672cc3821601bea", "score": "0.50722396", "text": "get first(){\r\n return Sulf.Sulfy(this.element.firstElementChild)\r\n }", "title": "" }, { "docid": "ed9d49695c961f1fe3f768ef1632ded5", "score": "0.5042444", "text": "function selectFirstNode(selectedColor) {\nvar length = searchInfo.length;\nif(length > 0) {\n searchInfo.highlightedNodes[0].className = SELECTED_CLASS;\n searchInfo.highlightedNodes[0].style.backgroundColor = selectedColor;\n parentNode = searchInfo.highlightedNodes[0].parentNode;\n if (parentNode.nodeType === 1) {\n parentNode.focus();\n } else if (parentNode.parentNode.nodeType == 1) {\n parentNode.parentNode.focus();\n }\n returnSearchInfo('selectNode');\n //scrollToElement(searchInfo.highlightedNodes[0]);\n}\n}", "title": "" }, { "docid": "ca3652954481628a5b76598200efea28", "score": "0.5030387", "text": "function hc_nodegetfirstchild() {\n var success;\n var doc;\n var elementList;\n var employeeNode;\n var fchildNode;\n var childName;\n var nodeType;\n doc = load(\"hc_staff\");\n elementList = doc.getElementsByTagName(\"p\");\n employeeNode = elementList.item(1);\n fchildNode = employeeNode.firstChild;\n\n childName = fchildNode.nodeName;\n\n \n\tif(\n\t(\"#text\" == childName)\n\t) {\n\tassertEquals(\"firstChild_w_whitespace\",\"#text\",childName);\n \n\t}\n\t\n\t\telse {\n\t\t\tassertEqualsAutoCase(\"element\", \"firstChild_wo_whitespace\",\"em\",childName);\n \n\t\t}\n\t\n}", "title": "" }, { "docid": "c8b773cb379aad555b91f00520134221", "score": "0.5015183", "text": "function initHexHover() {\r\n\t$(\".harmonic-table .hex\").hover(function() {\r\n\t\t$(this).addClass(\"hover\");\r\n\t}, function() {\r\n\t\t$(this).removeClass(\"hover\");\r\n\t});\r\n}", "title": "" }, { "docid": "119b39ccb9b984bc0b34e2809146975f", "score": "0.5002133", "text": "function mouseOver() {\r\n\t\tif(emptyNeighbor(this)){\r\n\t\t\tthis.classList.add(\"moveable\");\r\n\t\t}\r\n\t}", "title": "" }, { "docid": "ea2f3526a36566c85b3792aa2fb7b1d0", "score": "0.4999236", "text": "function onRealHover() {\n\t\tTweenLite.set($(this).children(), {css: {rotationY: 90, transformOrigin: \"left center\"}});\n\t\tTweenLite.to($(this).children(), .5, {rotationY: 0});\n\t}", "title": "" }, { "docid": "0c699c2f0382e4df3b897e4b87798812", "score": "0.49579743", "text": "function rewriteHover() {\n var gbh = document.getElementById(\"hover-global\");\n if (gbh === null) return;\n var nodes = getElementsByClass(\"hoverable\", gbh);\n \n for (var i = 0; i < nodes.length; i++) {\n nodes[i].onmouseover = function() {\n this.className += \" over\";\n };\n \n nodes[i].onmouseout = function() {\n this.className = this.className.replace(RegExp(\" over\\\\b\"), \"\");\n };\n }\n}", "title": "" }, { "docid": "1d66152e5e42664d5ddf6fbed93b99c0", "score": "0.4896397", "text": "insetFirst(value) {\n const newNode = new Node(value, this.head);\n this.head = newNode;\n }", "title": "" }, { "docid": "6d04df44dd2f8d186b37454e0998842d", "score": "0.48736122", "text": "function getPseudoClass() {\n\t\t\t var info = getInfo();\n\t\t\t var ident = eat(TokenType.Colon) && getIdentifier(false);\n\n\t\t\t if (scanner.token !== null && scanner.token.type === TokenType.LeftParenthesis) {\n\t\t\t return getFunction(SCOPE_SELECTOR, ident);\n\t\t\t }\n\n\t\t\t return {\n\t\t\t type: 'PseudoClass',\n\t\t\t info: info,\n\t\t\t name: ident.name\n\t\t\t };\n\t\t\t}", "title": "" }, { "docid": "3d3ea74d4cbc0f093afe33846207101e", "score": "0.48702848", "text": "function pseudoclass(type, tag, parentId) {\n\tif (window.attachEvent) {\n\t\twindow.attachEvent(\"onload\", function() {\n\t\t\tvar pcEls = (parentId==null)?document.getElementsByTagName(tag):document.getElementById(parentId).getElementsByTagName(tag);\n\t\t\ttype(pcEls);\n\t\t});\n\t}\n}", "title": "" }, { "docid": "fa5e1ecb0cfd94614e1d4c79e2308b8f", "score": "0.48502016", "text": "static create_event_hovered(){}", "title": "" }, { "docid": "d7192accaf55074a7cf761d1aaf2037a", "score": "0.48377153", "text": "function insertFirstLastChild(selection) {\n\tvar $tgts = $(selection);//cache selection\n\t$.each($tgts,function(idx,ele){//go through all selected items\n\t\tvar $ele = $(ele),//cache current item\n\t\t\t$fstChild = $ele.find('> :first-child'),//find and cache first-child\n\t\t\t$lstChild = $ele.find('> :last-child');//find and cache last-child\n\t\t//add class if not already\n\t\tif (!$fstChild.hasClass('first-child')) { $fstChild.addClass('first-child'); }\n\t\tif (!$lstChild.hasClass('last-child')) { $lstChild.addClass('last-child'); }\n\t});\t\n}", "title": "" }, { "docid": "dfe23e05fc08b0b0e67e3641b2cede10", "score": "0.48297253", "text": "function rewriteHover() {\n\tvar gbl = document.getElementById(\"hover-global\");\n\n\tif(gbl == null)\n\t\treturn;\n\n\tvar nodes = getElementsByClass(\"hoverable\", gbl);\n\n\tfor (var i = 0; i < nodes.length; i++) {\n\t\tnodes[i].onmouseover = function() {\n\t\t\tthis.className += \" over\";\n\t\t}\n\t\tnodes[i].onmouseout = function() {\n\t\t\tthis.className = this.className.replace(new RegExp(\" over\\\\b\"), \"\");\n\t\t}\n\t}\n}", "title": "" }, { "docid": "36ba1da7506498cd50c097460b20e1d8", "score": "0.48254803", "text": "function generalForward(activElement, firstElement) {\r\n\r\n if (!activElement.hasClass(\"last\")) {\r\n\r\n activElement.removeClass(\"active\");\r\n activElement.next().addClass(\"active\");\r\n\r\n } else {\r\n\r\n activElement.removeClass(\"active\");\r\n firstElement.addClass(\"active\");\r\n }\r\n\r\n}", "title": "" }, { "docid": "e35962748a5ea4bad877d57199226def", "score": "0.48070714", "text": "initHovers(){\n var allElements = document.getElementsByTagName('*');\n\n var checkHoverChanges = (e) => {\n var hoveredParent = e.target,\n childs = hoveredParent.getElementsByTagName('*'),\n elementsToMove = [];\n\n //Add parent element if does have pencil\n if ( hoveredParent._CAPencil ) {\n elementsToMove.push(hoveredParent);\n }\n\n //Add all childs with pencil into potentionaly moved elements\n for ( var i = 0; i < childs.length; i++ ) {\n //If child has pencil\n if ( childs[i]._CAPencil ) {\n elementsToMove.push(childs[i]);\n }\n }\n\n //See for position changed of every element till position wont changes.\n for ( var i = 0; i < elementsToMove.length; i++ ) {\n this.observePencilMovement(elementsToMove[i]);\n }\n };\n\n for ( var i = 0; i < allElements.length; i++ ) {\n allElements[i].addEventListener('mouseenter', checkHoverChanges);\n allElements[i].addEventListener('mouseleave', checkHoverChanges);\n }\n }", "title": "" }, { "docid": "689a96224529e6c9b1a17a818e2ad467", "score": "0.47797197", "text": "function select_first() {\n\t\tmove_to_row(0);\n\t}", "title": "" }, { "docid": "147cf86e52060789138659c146cf1158", "score": "0.4773127", "text": "_hovered() {\n // Coerce the `changes` property because Angular types it as `Observable<any>`\n const itemChanges = this._directDescendantItems.changes;\n return itemChanges.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_5__[\"startWith\"])(this._directDescendantItems), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_5__[\"switchMap\"])(items => Object(rxjs__WEBPACK_IMPORTED_MODULE_4__[\"merge\"])(...items.map((item) => item._hovered))));\n }", "title": "" }, { "docid": "147cf86e52060789138659c146cf1158", "score": "0.4773127", "text": "_hovered() {\n // Coerce the `changes` property because Angular types it as `Observable<any>`\n const itemChanges = this._directDescendantItems.changes;\n return itemChanges.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_5__[\"startWith\"])(this._directDescendantItems), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_5__[\"switchMap\"])(items => Object(rxjs__WEBPACK_IMPORTED_MODULE_4__[\"merge\"])(...items.map((item) => item._hovered))));\n }", "title": "" }, { "docid": "ba900a56a93f96fa699365128fdcefd4", "score": "0.47683656", "text": "function document.onmouseover()\n{\n var eSrc = window.event.srcElement;\n\tif (\"SPAN\" == eSrc.tagName && \"clsHasKids\" == eSrc.parentElement.className)\n\t{\n\t\teSrc.style.color = \"maroon\";\n }\n}", "title": "" }, { "docid": "c5c2453115bfe892a849cb8488ffd157", "score": "0.47578517", "text": "function FirstChild(props) {\n const childrenArray = React.Children.toArray(props.children);\n return childrenArray[0] || null;\n}", "title": "" }, { "docid": "cc22708d61d6f4adb9548880420d24d5", "score": "0.47529662", "text": "function getFirstTile(){\n\t\t\t\t\n\t\treturn g_objInner.children(\".ug-thumb-wrapper\").first();\n\t}", "title": "" }, { "docid": "cc22708d61d6f4adb9548880420d24d5", "score": "0.47529662", "text": "function getFirstTile(){\n\t\t\t\t\n\t\treturn g_objInner.children(\".ug-thumb-wrapper\").first();\n\t}", "title": "" }, { "docid": "73b35bac6edd96e113b5e1c9b9e1b13d", "score": "0.47500813", "text": "function getFirstChild(n)\r\n{\r\n\tvar x=n.firstChild;\r\n\twhile (x.nodeType!=1)\r\n\t{\r\n\t\tx=x.nextSibling;\r\n\t}\r\n\treturn x;\r\n}", "title": "" }, { "docid": "f89ada5a9af569d85665c1d2295febe2", "score": "0.47435534", "text": "function getFirstLeaf(node) {\n\t while (node.firstChild && getSelectionOffsetKeyForNode(node.firstChild)) {\n\t node = node.firstChild;\n\t }\n\t return node;\n\t}", "title": "" }, { "docid": "f89ada5a9af569d85665c1d2295febe2", "score": "0.47435534", "text": "function getFirstLeaf(node) {\n\t while (node.firstChild && getSelectionOffsetKeyForNode(node.firstChild)) {\n\t node = node.firstChild;\n\t }\n\t return node;\n\t}", "title": "" }, { "docid": "f89ada5a9af569d85665c1d2295febe2", "score": "0.47435534", "text": "function getFirstLeaf(node) {\n\t while (node.firstChild && getSelectionOffsetKeyForNode(node.firstChild)) {\n\t node = node.firstChild;\n\t }\n\t return node;\n\t}", "title": "" }, { "docid": "f89ada5a9af569d85665c1d2295febe2", "score": "0.47435534", "text": "function getFirstLeaf(node) {\n\t while (node.firstChild && getSelectionOffsetKeyForNode(node.firstChild)) {\n\t node = node.firstChild;\n\t }\n\t return node;\n\t}", "title": "" }, { "docid": "e563176bf377053f92cb036644fd45ed", "score": "0.47413185", "text": "getFirst () {\n\t\treturn this.head;\n\t}", "title": "" }, { "docid": "5bd19d54e511dffd691fb242ebd6dffc", "score": "0.47368804", "text": "selectTooltipClassMouseOver(p) {\n if (this.activeTooltip == p)\n return true;\n return false;\n }", "title": "" }, { "docid": "258faa512f597cabed3f65ab5f793d5d", "score": "0.47288805", "text": "function first() {}", "title": "" }, { "docid": "0fa07da7ab93da30bb58e3cc2cb79bbb", "score": "0.472766", "text": "function hover(id, newClass)\n{\n\tidentity=document.getElementById(id);\n\tidentity.className=newClass;\n}", "title": "" }, { "docid": "d0542f59d0b1848a859a45034ff782a7", "score": "0.47258672", "text": "function first() {\n if (current_color === \"red\") {\n color = \"yellow\";\n } else {\n color = \"red\";\n }\n td.addClass(\"destination\");\n td.removeClass(\"stone\");\n td.removeClass(\"yellow_hover\");\n td.removeClass(\"red_hover\");\n }", "title": "" }, { "docid": "b0e0f7f57efd683326af2720d43de250", "score": "0.47175878", "text": "selectFirst() {\n if (super.selectFirst) { super.selectFirst(); }\n return selectIndex(this, 0);\n }", "title": "" }, { "docid": "76ec6e8d9b523be80add73e0eefd890b", "score": "0.47064185", "text": "focusFirst() {\n this.element.find('a:first').attr('tabindex', '0');\n }", "title": "" }, { "docid": "665a697895a38723b8db310c663ea5b1", "score": "0.47044122", "text": "_handleMouseEnter() {\n this._hovered.next(this);\n }", "title": "" }, { "docid": "665a697895a38723b8db310c663ea5b1", "score": "0.47044122", "text": "_handleMouseEnter() {\n this._hovered.next(this);\n }", "title": "" }, { "docid": "66950a9a7455456be719f9f78153db81", "score": "0.4685548", "text": "function btnHoverStart(e) {\n event.target.classList.add('pl-4');\n event.target.classList.add('pr-4');\n if(event.target.classList.contains('f-tr-edit-btn')) {\n event.target.innerHTML = 'Edit ' + event.target.parentElement.parentElement.previousElementSibling.firstElementChild.type;\n } else if(event.target.classList.contains('f-tr-del-btn')) {\n event.target.innerHTML = 'Delet ' + event.target.parentElement.parentElement.previousElementSibling.firstElementChild.type;\n } else if(event.target.classList.contains('f-tr-clone-btn')) {\n event.target.innerHTML = 'Clone ' + event.target.parentElement.parentElement.previousElementSibling.firstElementChild.type;\n }\n}", "title": "" }, { "docid": "8d08d46288c75ac55023a35e93ba4a94", "score": "0.468553", "text": "function createNativePseudoclasses(style, nativePseudoclassSelectorMap, jsRenderedPseudoclassIndex, defaultStyle) {\n if(nativePseudoclassSelectorMap === undefined) nativePseudoclassSelectorMap = {}\n\n var nativePseudoclassSelectors = []\n //var nativePseudoclassPropertiesToOverride = {} // stores what style properties for what pseudoclasses needs to be overridden by an emulated style\n var newNativePseudoclassMap = {} // a mapping from a Block name to a nativePseudoclassSelectorMap\n var index = 0\n style.pseudoclasses.classes.forEach(function(pseudoclassStyle, pseudoclassKey) {\n var fullSelector = '.'+style.className+':'+pseudoclassKey.join(':')\n if(pseudoclassStyle.pureNative) {\n // create css styles for top-level css properties of the native psuedoclass\n createPseudoClassRules(fullSelector, pseudoclassStyle.basicProperties, style, false)\n nativePseudoclassSelectors.push(pseudoclassKey.join(':'))\n\n for(var blockSelector in pseudoclassStyle.componentStyleMap) {\n addNativePseudoclassMapItem(blockSelector, fullSelector, pseudoclassStyle.componentStyleMap[blockSelector])\n }\n } else if(index === jsRenderedPseudoclassIndex) {\n // create overriding css styles for top-level css properties of the emulated psuedoclass (so that emulated and native pseudoclasses mix properly)\n for(var n=0; n<nativePseudoclassSelectors.length; n++) {\n var selector = nativePseudoclassSelectors[n]\n createPseudoClassRules(fullSelector+\":\"+selector, style.basicProperties, style, true)\n }\n }\n\n index++\n })\n\n for(var selector in nativePseudoclassSelectorMap) {\n var pseudoclassStyle = nativePseudoclassSelectorMap[selector]\n var fullSelector = selector+' '+'.'+style.className\n\n // create css styles for the top-level style when inside a pure native pseudoclass style of its parent\n createPseudoClassRules(fullSelector, pseudoclassStyle.basicProperties, style, true)\n\n for(var blockSelector in pseudoclassStyle.componentStyleMap) {\n addNativePseudoclassMapItem(blockSelector, fullSelector, pseudoclassStyle.componentStyleMap[blockSelector])\n }\n\n // create css styles for pseudoclass styles when inside a pure native pseudoclass style of its parent\n pseudoclassStyle.pseudoclasses.classes.forEach(function(pseudoclassStyle, pseudoclassKey) {\n if(pseudoclassStyle.pureNative) {\n createPseudoClassRules(fullSelector+':'+pseudoclassKey.join(':'), pseudoclassStyle.basicProperties, style, true)\n }\n })\n }\n\n return newNativePseudoclassMap\n\n\n function addNativePseudoclassMapItem(blockSelector, cssSelector, styleValue) {\n if(newNativePseudoclassMap[blockSelector] === undefined)\n newNativePseudoclassMap[blockSelector] = {}\n newNativePseudoclassMap[blockSelector][cssSelector] = styleValue\n }\n\n // cssProperties - The css rules to apply (should only contain native css properties). CamelCase and certain integer values will be converted.\n // overwriteBloodyStyles - if true, styles from styleMapStyle are overridden with the default (either a block's default or the base default)\n function createPseudoClassRules(selector, cssProperties, /*temporary*/ styleMapStyle, overwriteBloodyStyles) {\n if(!style.nativePseudoclassesWritten[selector]) {\n var pseudoClassCss = {}\n\n if(overwriteBloodyStyles) {\n // overwrite styles that would bleed over from the styleMapStyle\n\n var propertiesToOverride = Object.keys(styleMapStyle.basicProperties)\n styleMapStyle.pseudoclasses.classes.forEach(function(style) {\n propertiesToOverride = propertiesToOverride.concat(Object.keys(style.basicProperties))\n })\n\n for(var n=0; n<propertiesToOverride.length; n++) {\n var key = propertiesToOverride[n]\n if(defaultStyle) {\n var defaultStyleProperty = defaultStyle.basicProperties[key]\n }\n\n var initialStyle = defaultStyleProperty || defaultStyleValues[key] || 'initial' // todo: write a function to calculate the inital value, since 'initial' isn't supported in IE (of course) - tho it will be eventually since its becoming apart of css3\n pseudoClassCss[key] = initialStyle\n }\n }\n\n for(var key in cssProperties) {\n var value = cssProperties[key]\n\n var cssStyle = key\n var cssStyleName = mapCamelCase(cssStyle)\n pseudoClassCss[cssStyleName] = cssValue(cssStyleName, value)\n }\n\n // create immediate pseudo class style\n setCss(selector, pseudoClassCss) // create the css class with the pseudoClass\n if(this.nativePseudoclassStyles !== undefined) {\n styleMapStyle.nativePseudoclassStyles[selector] = pseudoClassCss\n }\n\n style.nativePseudoclassesWritten[selector] = true\n }\n }\n }", "title": "" }, { "docid": "c8fc7582511a5f15f54be21663640206", "score": "0.46768555", "text": "function getFirstLeaf(node) {\n\t for (;node.firstChild && getSelectionOffsetKeyForNode(node.firstChild); ) node = node.firstChild;\n\t return node;\n\t }", "title": "" }, { "docid": "f0dcc8f9a083fcbf818dccce5a7a61b8", "score": "0.46558046", "text": "function findPseudoElements(el) {\n\t var els = document.querySelectorAll(classes.join(','));\n\t for(var i = 0, j = els.length; i < j; i++) {\n\t createPseudoElements(els[i]);\n\t }\n\t }", "title": "" }, { "docid": "54b4d921b74df3e6ee78d05020e44fd8", "score": "0.46525806", "text": "function addHoverClass() {\n if ( Modernizr.classlist ) {\n document.body.classList.add('hover');\n }\n }", "title": "" }, { "docid": "a9c7ff3f9eebc161298506eb01b51069", "score": "0.46453327", "text": "function getFirstSelector(selector) {\n return document.querySelector(selector);\n}", "title": "" }, { "docid": "03fbec15adad73fbe1f9761125495607", "score": "0.46373317", "text": "get firstChild() {\n return this._routerState.firstChild(this);\n }", "title": "" }, { "docid": "03fbec15adad73fbe1f9761125495607", "score": "0.46373317", "text": "get firstChild() {\n return this._routerState.firstChild(this);\n }", "title": "" }, { "docid": "5ae9b5c6d42f7ebbae871048cf5df3e3", "score": "0.4603622", "text": "function getFirstCompCell(compCell) {\r\n var children = compCell.childNodes;\r\n for (var i = 0; i < children.length; i++) {\r\n\tif (CSSClass.is(children[i],'compCell')) return children[i];\r\n }\r\n return null;\r\n}", "title": "" }, { "docid": "d8a140dc4138df56a9ad4a246b0cdaa2", "score": "0.46034613", "text": "first () { return this.at(0); }", "title": "" }, { "docid": "9cb3d35f5aeae01368dd0c8bb3443cad", "score": "0.46030775", "text": "function getFirstSelector(selector) {\n return document.querySelector(selector);\n}", "title": "" }, { "docid": "9cb3d35f5aeae01368dd0c8bb3443cad", "score": "0.46030775", "text": "function getFirstSelector(selector) {\n return document.querySelector(selector);\n}", "title": "" }, { "docid": "1349da99b127ee80f00aa8064f7d9e34", "score": "0.46023795", "text": "peek(){\n if(!this.first){\n return null;\n } \n return this.first.value;\n }", "title": "" }, { "docid": "362048d41c6b789b40bd90119328883a", "score": "0.45950088", "text": "function getFirstSelector(selector){\n return document.querySelector(selector);\n}", "title": "" }, { "docid": "0bd0416429135275c3dd2eee4ff57a6a", "score": "0.45817333", "text": "function patchPseudoClass( pseudo ) {\r\n\r\n\t\tvar applyClass = true;\r\n\t\tvar className = createClassName(pseudo.slice(1));\r\n\t\tvar isNegated = pseudo.substring(0, 5) == \":not(\";\r\n\t\tvar activateEventName;\r\n\t\tvar deactivateEventName;\r\n\r\n\t\t// if negated, remove :not() \r\n\t\tif (isNegated) {\r\n\t\t\tpseudo = pseudo.slice(5, -1);\r\n\t\t}\r\n\t\t\r\n\t\t// bracket contents are irrelevant - remove them\r\n\t\tvar bracketIndex = pseudo.indexOf(\"(\")\r\n\t\tif (bracketIndex > -1) {\r\n\t\t\tpseudo = pseudo.substring(0, bracketIndex);\r\n\t\t}\t\t\r\n\t\t\r\n\t\t// check we're still dealing with a pseudo-class\r\n\t\tif (pseudo.charAt(0) == \":\") {\r\n\t\t\tswitch (pseudo.slice(1)) {\r\n\r\n\t\t\t\tcase \"root\":\r\n\t\t\t\t\tapplyClass = function(e) {\r\n\t\t\t\t\t\treturn isNegated ? e != root : e == root;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"target\":\r\n\t\t\t\t\t// :target is only supported in IE8\r\n\t\t\t\t\tif (ieVersion == 8) {\r\n\t\t\t\t\t\tapplyClass = function(e) {\r\n\t\t\t\t\t\t\tvar handler = function() { \r\n\t\t\t\t\t\t\t\tvar hash = location.hash;\r\n\t\t\t\t\t\t\t\tvar hashID = hash.slice(1);\r\n\t\t\t\t\t\t\t\treturn isNegated ? (hash == EMPTY_STRING || e.id != hashID) : (hash != EMPTY_STRING && e.id == hashID);\r\n\t\t\t\t\t\t\t};\r\n\t\t\t\t\t\t\taddEvent( win, \"hashchange\", function() {\r\n\t\t\t\t\t\t\t\ttoggleElementClass(e, className, handler());\r\n\t\t\t\t\t\t\t})\r\n\t\t\t\t\t\t\treturn handler();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t\r\n\t\t\t\tcase \"checked\":\r\n\t\t\t\t\tapplyClass = function(e) { \r\n\t\t\t\t\t\tif (RE_INPUT_CHECKABLE_TYPES.test(e.type)) {\r\n\t\t\t\t\t\t\taddEvent( e, \"propertychange\", function() {\r\n\t\t\t\t\t\t\t\tif (event.propertyName == \"checked\") {\r\n\t\t\t\t\t\t\t\t\ttoggleElementClass( e, className, e.checked !== isNegated );\r\n\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t})\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn e.checked !== isNegated;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase \"disabled\":\r\n\t\t\t\t\tisNegated = !isNegated;\r\n\r\n\t\t\t\tcase \"enabled\":\r\n\t\t\t\t\tapplyClass = function(e) { \r\n\t\t\t\t\t\tif (RE_INPUT_ELEMENTS.test(e.tagName)) {\r\n\t\t\t\t\t\t\taddEvent( e, \"propertychange\", function() {\r\n\t\t\t\t\t\t\t\tif (event.propertyName == \"$disabled\") {\r\n\t\t\t\t\t\t\t\t\ttoggleElementClass( e, className, e.$disabled === isNegated );\r\n\t\t\t\t\t\t\t\t} \r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\tenabledWatchers.push(e);\r\n\t\t\t\t\t\t\te.$disabled = e.disabled;\r\n\t\t\t\t\t\t\treturn e.disabled === isNegated;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn pseudo == \":enabled\" ? isNegated : !isNegated;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase \"focus\":\r\n\t\t\t\t\tactivateEventName = \"focus\";\r\n\t\t\t\t\tdeactivateEventName = \"blur\";\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\tcase \"hover\":\r\n\t\t\t\t\tif (!activateEventName) {\r\n\t\t\t\t\t\tactivateEventName = \"mouseenter\";\r\n\t\t\t\t\t\tdeactivateEventName = \"mouseleave\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\tapplyClass = function(e) {\r\n\t\t\t\t\t\taddEvent( e, isNegated ? deactivateEventName : activateEventName, function() {\r\n\t\t\t\t\t\t\ttoggleElementClass( e, className, true );\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t\taddEvent( e, isNegated ? activateEventName : deactivateEventName, function() {\r\n\t\t\t\t\t\t\ttoggleElementClass( e, className, false );\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t\treturn isNegated;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\t// everything else\r\n\t\t\t\tdefault:\r\n\t\t\t\t\t// If we don't support this pseudo-class don't create \r\n\t\t\t\t\t// a patch for it\r\n\t\t\t\t\tif (!RE_PSEUDO_STRUCTURAL.test(pseudo)) {\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn { className: className, applyClass: applyClass };\r\n\t}", "title": "" }, { "docid": "b5381468867fbe70a8384fb64d68ed8c", "score": "0.4581533", "text": "function firstNode(){\n selectedNodeObj.setX(window.innerWidth/2)\n selectedNodeObj.setY(window.innerHeight/2)\n setNodes([{id:createId(),text:\"\",x:window.innerWidth/2,y:window.innerHeight/2}])\n }", "title": "" }, { "docid": "1bccd97313b6d15ddb6873e1d68fd854", "score": "0.45799795", "text": "function hoverfix(target, parent, pane) {\n\tvar hfix_target = target;\n\tvar hfix_parent = parent;\n\tvar hfix_pane = pane;\n\tvar hfix_last = pane.find('a').last();\n\n\thfix_target.on('mouseover focus', function() {hfix_parent.addClass('show');});\n\n\thfix_parent.on('mouseleave', function() {hfix_parent.removeClass('show');});\n\n\thfix_last.on('blur', function() {hfix_parent.removeClass('show');});\n}", "title": "" }, { "docid": "8640fd4ce91150c2a162ab813b6f7559", "score": "0.45745245", "text": "function firstVisibleChild() {\n\t for (var i = 0; i < openMenuNode.children.length; ++i) {\n\t if ($window.getComputedStyle(openMenuNode.children[i]).display != 'none') {\n\t return openMenuNode.children[i];\n\t }\n\t }\n\t }", "title": "" }, { "docid": "3401c0368bf932e916db34fa232a6f79", "score": "0.45673752", "text": "function pointOldFirstAtFirst() {\n _pointRefsAtNode(_first.target, _oldfirst);\n }", "title": "" }, { "docid": "c03da580e7017b470a3effab0e463cdf", "score": "0.4557519", "text": "function next(elem) { \r\n\tdo { \r\n\t\telem = elem.previousSibling; \r\n\t} while (elem && elem.nodeType != 1);\r\n\t\r\n\treturn elem; \r\n}", "title": "" }, { "docid": "786b002302f4e10eb94321c63b4b4a4c", "score": "0.45514202", "text": "function firstVisibleChild() {\r\n for (var i = 0; i < openMenuNode.children.length; ++i) {\r\n if ($window.getComputedStyle(openMenuNode.children[i]).display != 'none') {\r\n return openMenuNode.children[i];\r\n }\r\n }\r\n }", "title": "" }, { "docid": "73d906593a47875e321cda5c90397e85", "score": "0.45507342", "text": "first() { this.goto(0); }", "title": "" }, { "docid": "26fe299aea61409c314cc6d1d335aa5b", "score": "0.455027", "text": "function setInitial() {\n\t\tparentLinks.forEach(function (parent, index) {\n\t\t\tlet target = '[data-hook~=\"' + parent.getAttribute('data-children') + '\"]';\n\t\t\tlet targetChild = document.querySelector(target);\n\n\t\t\tcurrentItem = false;\n\t\t\tif (index === 0 && targetChild !== null) {\n\t\t\t\tparent.dispatchEvent(new Event('mouseenter'));\n\t\t\t}\n\t\t});\n\t}", "title": "" }, { "docid": "ce83690fbaf81db2fd9b7e49fe842ad9", "score": "0.45467076", "text": "get firstChild() {\n return this._routerState.firstChild(this);\n }", "title": "" }, { "docid": "ce83690fbaf81db2fd9b7e49fe842ad9", "score": "0.45467076", "text": "get firstChild() {\n return this._routerState.firstChild(this);\n }", "title": "" }, { "docid": "ce83690fbaf81db2fd9b7e49fe842ad9", "score": "0.45467076", "text": "get firstChild() {\n return this._routerState.firstChild(this);\n }", "title": "" }, { "docid": "ce83690fbaf81db2fd9b7e49fe842ad9", "score": "0.45467076", "text": "get firstChild() {\n return this._routerState.firstChild(this);\n }", "title": "" }, { "docid": "e39762644f502cf6bf090aec1f45f177", "score": "0.45429367", "text": "function patchPseudoClass( pseudo ) {\n\n\t\tvar applyClass = true;\n\t\tvar className = createClassName(pseudo.slice(1));\n\t\tvar isNegated = pseudo.substring(0, 5) == \":not(\";\n\t\tvar activateEventName;\n\t\tvar deactivateEventName;\n\n\t\t// if negated, remove :not() \n\t\tif (isNegated) {\n\t\t\tpseudo = pseudo.slice(5, -1);\n\t\t}\n\t\t\n\t\t// bracket contents are irrelevant - remove them\n\t\tvar bracketIndex = pseudo.indexOf(\"(\")\n\t\tif (bracketIndex > -1) {\n\t\t\tpseudo = pseudo.substring(0, bracketIndex);\n\t\t}\t\t\n\t\t\n\t\t// check we're still dealing with a pseudo-class\n\t\tif (pseudo.charAt(0) == \":\") {\n\t\t\tswitch (pseudo.slice(1)) {\n\n\t\t\t\tcase \"root\":\n\t\t\t\t\tapplyClass = function(e) {\n\t\t\t\t\t\treturn isNegated ? e != root : e == root;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"target\":\n\t\t\t\t\t// :target is only supported in IE8\n\t\t\t\t\tif (ieVersion == 8) {\n\t\t\t\t\t\tapplyClass = function(e) {\n\t\t\t\t\t\t\tvar handler = function() { \n\t\t\t\t\t\t\t\tvar hash = location.hash;\n\t\t\t\t\t\t\t\tvar hashID = hash.slice(1);\n\t\t\t\t\t\t\t\treturn isNegated ? (hash == EMPTY_STRING || e.id != hashID) : (hash != EMPTY_STRING && e.id == hashID);\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\taddEvent( win, \"hashchange\", function() {\n\t\t\t\t\t\t\t\ttoggleElementClass(e, className, handler());\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\treturn handler();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t\n\t\t\t\tcase \"checked\":\n\t\t\t\t\tapplyClass = function(e) { \n\t\t\t\t\t\tif (RE_INPUT_CHECKABLE_TYPES.test(e.type)) {\n\t\t\t\t\t\t\taddEvent( e, \"propertychange\", function() {\n\t\t\t\t\t\t\t\tif (event.propertyName == \"checked\") {\n\t\t\t\t\t\t\t\t\ttoggleElementClass( e, className, e.checked !== isNegated );\n\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn e.checked !== isNegated;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase \"disabled\":\n\t\t\t\t\tisNegated = !isNegated;\n\n\t\t\t\tcase \"enabled\":\n\t\t\t\t\tapplyClass = function(e) { \n\t\t\t\t\t\tif (RE_INPUT_ELEMENTS.test(e.tagName)) {\n\t\t\t\t\t\t\taddEvent( e, \"propertychange\", function() {\n\t\t\t\t\t\t\t\tif (event.propertyName == \"$disabled\") {\n\t\t\t\t\t\t\t\t\ttoggleElementClass( e, className, e.$disabled === isNegated );\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tenabledWatchers.push(e);\n\t\t\t\t\t\t\te.$disabled = e.disabled;\n\t\t\t\t\t\t\treturn e.disabled === isNegated;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn pseudo == \":enabled\" ? isNegated : !isNegated;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase \"focus\":\n\t\t\t\t\tactivateEventName = \"focus\";\n\t\t\t\t\tdeactivateEventName = \"blur\";\n\t\t\t\t\t\t\t\t\n\t\t\t\tcase \"hover\":\n\t\t\t\t\tif (!activateEventName) {\n\t\t\t\t\t\tactivateEventName = \"mouseenter\";\n\t\t\t\t\t\tdeactivateEventName = \"mouseleave\";\n\t\t\t\t\t}\n\t\t\t\t\tapplyClass = function(e) {\n\t\t\t\t\t\taddEvent( e, isNegated ? deactivateEventName : activateEventName, function() {\n\t\t\t\t\t\t\ttoggleElementClass( e, className, true );\n\t\t\t\t\t\t})\n\t\t\t\t\t\taddEvent( e, isNegated ? activateEventName : deactivateEventName, function() {\n\t\t\t\t\t\t\ttoggleElementClass( e, className, false );\n\t\t\t\t\t\t})\n\t\t\t\t\t\treturn isNegated;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\t// everything else\n\t\t\t\tdefault:\n\t\t\t\t\t// If we don't support this pseudo-class don't create \n\t\t\t\t\t// a patch for it\n\t\t\t\t\tif (!RE_PSEUDO_STRUCTURAL.test(pseudo)) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn { className: className, applyClass: applyClass };\n\t}", "title": "" }, { "docid": "e39762644f502cf6bf090aec1f45f177", "score": "0.45429367", "text": "function patchPseudoClass( pseudo ) {\n\n\t\tvar applyClass = true;\n\t\tvar className = createClassName(pseudo.slice(1));\n\t\tvar isNegated = pseudo.substring(0, 5) == \":not(\";\n\t\tvar activateEventName;\n\t\tvar deactivateEventName;\n\n\t\t// if negated, remove :not() \n\t\tif (isNegated) {\n\t\t\tpseudo = pseudo.slice(5, -1);\n\t\t}\n\t\t\n\t\t// bracket contents are irrelevant - remove them\n\t\tvar bracketIndex = pseudo.indexOf(\"(\")\n\t\tif (bracketIndex > -1) {\n\t\t\tpseudo = pseudo.substring(0, bracketIndex);\n\t\t}\t\t\n\t\t\n\t\t// check we're still dealing with a pseudo-class\n\t\tif (pseudo.charAt(0) == \":\") {\n\t\t\tswitch (pseudo.slice(1)) {\n\n\t\t\t\tcase \"root\":\n\t\t\t\t\tapplyClass = function(e) {\n\t\t\t\t\t\treturn isNegated ? e != root : e == root;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"target\":\n\t\t\t\t\t// :target is only supported in IE8\n\t\t\t\t\tif (ieVersion == 8) {\n\t\t\t\t\t\tapplyClass = function(e) {\n\t\t\t\t\t\t\tvar handler = function() { \n\t\t\t\t\t\t\t\tvar hash = location.hash;\n\t\t\t\t\t\t\t\tvar hashID = hash.slice(1);\n\t\t\t\t\t\t\t\treturn isNegated ? (hash == EMPTY_STRING || e.id != hashID) : (hash != EMPTY_STRING && e.id == hashID);\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\taddEvent( win, \"hashchange\", function() {\n\t\t\t\t\t\t\t\ttoggleElementClass(e, className, handler());\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\treturn handler();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t\n\t\t\t\tcase \"checked\":\n\t\t\t\t\tapplyClass = function(e) { \n\t\t\t\t\t\tif (RE_INPUT_CHECKABLE_TYPES.test(e.type)) {\n\t\t\t\t\t\t\taddEvent( e, \"propertychange\", function() {\n\t\t\t\t\t\t\t\tif (event.propertyName == \"checked\") {\n\t\t\t\t\t\t\t\t\ttoggleElementClass( e, className, e.checked !== isNegated );\n\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn e.checked !== isNegated;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase \"disabled\":\n\t\t\t\t\tisNegated = !isNegated;\n\n\t\t\t\tcase \"enabled\":\n\t\t\t\t\tapplyClass = function(e) { \n\t\t\t\t\t\tif (RE_INPUT_ELEMENTS.test(e.tagName)) {\n\t\t\t\t\t\t\taddEvent( e, \"propertychange\", function() {\n\t\t\t\t\t\t\t\tif (event.propertyName == \"$disabled\") {\n\t\t\t\t\t\t\t\t\ttoggleElementClass( e, className, e.$disabled === isNegated );\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tenabledWatchers.push(e);\n\t\t\t\t\t\t\te.$disabled = e.disabled;\n\t\t\t\t\t\t\treturn e.disabled === isNegated;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn pseudo == \":enabled\" ? isNegated : !isNegated;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase \"focus\":\n\t\t\t\t\tactivateEventName = \"focus\";\n\t\t\t\t\tdeactivateEventName = \"blur\";\n\t\t\t\t\t\t\t\t\n\t\t\t\tcase \"hover\":\n\t\t\t\t\tif (!activateEventName) {\n\t\t\t\t\t\tactivateEventName = \"mouseenter\";\n\t\t\t\t\t\tdeactivateEventName = \"mouseleave\";\n\t\t\t\t\t}\n\t\t\t\t\tapplyClass = function(e) {\n\t\t\t\t\t\taddEvent( e, isNegated ? deactivateEventName : activateEventName, function() {\n\t\t\t\t\t\t\ttoggleElementClass( e, className, true );\n\t\t\t\t\t\t})\n\t\t\t\t\t\taddEvent( e, isNegated ? activateEventName : deactivateEventName, function() {\n\t\t\t\t\t\t\ttoggleElementClass( e, className, false );\n\t\t\t\t\t\t})\n\t\t\t\t\t\treturn isNegated;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\t// everything else\n\t\t\t\tdefault:\n\t\t\t\t\t// If we don't support this pseudo-class don't create \n\t\t\t\t\t// a patch for it\n\t\t\t\t\tif (!RE_PSEUDO_STRUCTURAL.test(pseudo)) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn { className: className, applyClass: applyClass };\n\t}", "title": "" }, { "docid": "6a79705fd8b6e3ebc9934205a0c959a5", "score": "0.4540957", "text": "function initCustomHover() {\n\tjQuery('.bubble').touchHover();\n\tjQuery('.bubble-leader').touchHover();\n}", "title": "" }, { "docid": "1467ab7e8e5d1b70df1bf25a7817e6c3", "score": "0.45359543", "text": "function eatPrimaryExpression() {\n var nodes = [];\n var start = eatStartNode(); // always a start node\n nodes.push(start);\n while (maybeEatNode()) {\n nodes.push(pop());\n }\n if (nodes.length === 1) {\n return nodes[0];\n }\n return CompoundExpression.create(toPosBounds(start.getStartPosition(), nodes[nodes.length - 1].getEndPosition()), nodes);\n }", "title": "" }, { "docid": "0f21639f044deee4a82d0606e67d7e6b", "score": "0.45357284", "text": "function getFirstLeaf(node) {\n while (node.firstChild && getSelectionOffsetKeyForNode(node.firstChild)) {\n node = node.firstChild;\n }\n return node;\n}", "title": "" }, { "docid": "0f21639f044deee4a82d0606e67d7e6b", "score": "0.45357284", "text": "function getFirstLeaf(node) {\n while (node.firstChild && getSelectionOffsetKeyForNode(node.firstChild)) {\n node = node.firstChild;\n }\n return node;\n}", "title": "" }, { "docid": "0f21639f044deee4a82d0606e67d7e6b", "score": "0.45357284", "text": "function getFirstLeaf(node) {\n while (node.firstChild && getSelectionOffsetKeyForNode(node.firstChild)) {\n node = node.firstChild;\n }\n return node;\n}", "title": "" }, { "docid": "f610c8b91774fe3fc23d7c62f5bef0f4", "score": "0.45303604", "text": "function hoverOver(e){\n\te.stopPropagation();\n\tif(e.currentTarget != e.target){\n\t\tif(e.type == \"mouseover\"){\n\t\t\te.target.classList.add(\"hover\");\t\t\n\t\t}\n\t\telse if(e.type == \"mouseout\"){\n\t\t\te.target.classList.remove(\"hover\");\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4bbcfb7542aa6b4ad521ba1927c6b9bc", "score": "0.45261365", "text": "function onMouseOver( e ) { e.srcElement.style.cursor = \"Pointer\"; }", "title": "" }, { "docid": "3cb1a4c79305113de858b723ee12ad0e", "score": "0.45241362", "text": "function firstVisibleChild() {\n for (var i = 0; i < openMenuNode.children.length; ++i) {\n if ($window.getComputedStyle(openMenuNode.children[i]).display != 'none') {\n return openMenuNode.children[i];\n }\n }\n }", "title": "" }, { "docid": "3cb1a4c79305113de858b723ee12ad0e", "score": "0.45241362", "text": "function firstVisibleChild() {\n for (var i = 0; i < openMenuNode.children.length; ++i) {\n if ($window.getComputedStyle(openMenuNode.children[i]).display != 'none') {\n return openMenuNode.children[i];\n }\n }\n }", "title": "" }, { "docid": "3cb1a4c79305113de858b723ee12ad0e", "score": "0.45241362", "text": "function firstVisibleChild() {\n for (var i = 0; i < openMenuNode.children.length; ++i) {\n if ($window.getComputedStyle(openMenuNode.children[i]).display != 'none') {\n return openMenuNode.children[i];\n }\n }\n }", "title": "" }, { "docid": "3cb1a4c79305113de858b723ee12ad0e", "score": "0.45241362", "text": "function firstVisibleChild() {\n for (var i = 0; i < openMenuNode.children.length; ++i) {\n if ($window.getComputedStyle(openMenuNode.children[i]).display != 'none') {\n return openMenuNode.children[i];\n }\n }\n }", "title": "" }, { "docid": "3cb1a4c79305113de858b723ee12ad0e", "score": "0.45241362", "text": "function firstVisibleChild() {\n for (var i = 0; i < openMenuNode.children.length; ++i) {\n if ($window.getComputedStyle(openMenuNode.children[i]).display != 'none') {\n return openMenuNode.children[i];\n }\n }\n }", "title": "" }, { "docid": "3678e0081c6831fce7d6350a9d86a178", "score": "0.45218083", "text": "function addCssToFirst(css, clss, word){\n\tvar $t = $(word).text();\n\tvar $frst = equal($t, clss).first();\n\t$frst.addClass(css);\n\t$focusedWord = $frst;\n\t// return the span, so it can be saved and worked with later.\n}", "title": "" }, { "docid": "ef5b82dc802b55b6bea707d553e9982a", "score": "0.4507152", "text": "function SlotMouseOver(event)\n{\n var src = SlotTarget(event, \"slot\");\n if(src)\n src.className = \"slotHover\";\n}", "title": "" }, { "docid": "a76048c62b552b735848145f5f9b4397", "score": "0.44970506", "text": "function mouseovered(d) {\n\n if(d.size != 4000) foodDes(d);\n else userDes(d);\n\n\n link\n .classed(\"link--target\", false)\n .classed(\"link--source\", false);\n\n node\n .classed(\"node--target\", false)\n .classed(\"node--source\", false);\n\n\n node\n .each(function(n) { n.target = n.source = false; });\n\n link\n .classed(\"link--target\", function(l) { if (l.target === d) return l.source.source = true; })\n .classed(\"link--source\", function(l) { if (l.source === d) return l.target.target = true; })\n .filter(function(l) { return l.target === d || l.source === d; })\n .each(function() { this.parentNode.appendChild(this); });\n\n node\n .classed(\"node--target\", function(n) { return n.target; })\n .classed(\"node--source\", function(n) { return n.source; });\n}", "title": "" }, { "docid": "4a828f7fc6a6df9ae78baff206f2b036", "score": "0.44968152", "text": "function featuredTabHover (link,userActivated,nextNum) {\n if (link) {\n if (userActivated == 1) {\n noRotate = 1;\n if (typeof rotateID != 'undefined' && rotateID) clearTimeout(rotateID);\n }\n\n var prevNum = '';\n if (!nextNum) var nextNum = link.id.replace(/featured-(\\d)_tab/, '$1');\n\n var lis = link.parentNode.parentNode.childNodes;\n for (var i = 0; i < lis.length; i++) {\n if (lis[i].tagName == 'LI') {\n if (lis[i].className != '') prevNum = i+1;\n lis[i].className = '';\n }\n }\n\n link.parentNode.className = 'current';\n var prevDiv = ge('featured-'+prevNum+'_t');\n var nextDiv = ge('featured-'+nextNum+'_t');\n if (prevNum != nextNum) {\n nextDiv.style.display = 'block';\n if (prevNum < nextNum) {\n prevDiv.style.zIndex = '1';\n $(prevDiv).animate({top:'-402px'},'fast','swing',function(){resetDivs(nextDiv)});\n } else {\n nextDiv.style.zIndex = '1';\n nextDiv.style.top = '-402px';\n $(nextDiv).animate({top:0},'fast','swing',function(){resetDivs(nextDiv)});\n }\n } else {\n prevDiv.style.display = 'none';\n nextDiv.style.display = '';\n }\n }\n}", "title": "" }, { "docid": "b0ece169a415788782023a3b006c4779", "score": "0.44960007", "text": "function selectFirstNode(triggerOnClick, scrollIntoView) {\r\n\t\t\tif (nodes != undefined && nodes.length > 0) {\r\n\t\t\t\tsetSelectedNode(nodes[0], triggerOnClick, scrollIntoView);\r\n\t\t\t\treturn selectedNode;\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t}", "title": "" }, { "docid": "7f76aa411aa1602ce5561f0b1d931537", "score": "0.44931325", "text": "function pointNodeAtOldfirst(nodeID) {\n _pointNodeAtRef(nodeID, _oldfirst);\n }", "title": "" }, { "docid": "a1bf6834686b207947913b93f48d921a", "score": "0.44921568", "text": "function createShit() {\n\tif($(\"title\").firstChild) {\n\t\t$(\"title\").replaceChild(document.createTextNode(dataSet), $(\"title\").firstChild);\n\t}\n\tif(fuckIE8ForFuckingUpOpacityWhatTheFuckMS) {\n\t\tvar shit=document.querySelectorAll(\".shit\");\n\t} else {\n\t\tvar shit=document.getElementsByClassName(\"shit\");\n\t}\n\tfor(var i=0; i<shit.length; i++) {\n\t\tif(shit[i].firstChild) {\n\t\t\tshit[i].removeChild(shit[i].firstChild);\n\t\t}\n\t\tvar tex = document.createTextNode(initial);\n\t\tshit[i].appendChild(tex);\n\t}\n}", "title": "" }, { "docid": "a2ea8f336aad06761a654d7d41316e98", "score": "0.44870764", "text": "function getFirstSelector(selector){\n var answer = document.querySelector(selector);\n return answer;\n\n}", "title": "" }, { "docid": "d52ce6e214ac7dc8006e580c9a5d443b", "score": "0.44821504", "text": "function focusFirstChild(rootElement) {\n\t var element = getNextElement(rootElement, rootElement, true, false, false, true);\n\t if (element) {\n\t element.focus();\n\t return true;\n\t }\n\t return false;\n\t}", "title": "" }, { "docid": "d52ce6e214ac7dc8006e580c9a5d443b", "score": "0.44821504", "text": "function focusFirstChild(rootElement) {\n\t var element = getNextElement(rootElement, rootElement, true, false, false, true);\n\t if (element) {\n\t element.focus();\n\t return true;\n\t }\n\t return false;\n\t}", "title": "" }, { "docid": "eeea09a4b40678dcbedbca65d2ed2c79", "score": "0.4477877", "text": "function findPseudoElements(el) {\n var els = document.querySelectorAll(classes.join(','));\n for(var i = 0, j = els.length; i < j; i++) {\n createPseudoElements(els[i]);\n }\n }", "title": "" }, { "docid": "57258f8b74d19885b5ec2a38d2c4c1af", "score": "0.44773126", "text": "function patchPseudoClass( pseudo ) {\r\n\r\n\t\tvar applyClass = true;\r\n\t\tvar className = createClassName(pseudo.slice(1));\r\n\t\tvar isNegated = pseudo.substring(0, 5) == \":not(\";\r\n\t\tvar activateEventName;\r\n\t\tvar deactivateEventName;\r\n\r\n\t\t// if negated, remove :not()\r\n\t\tif (isNegated) {\r\n\t\t\tpseudo = pseudo.slice(5, -1);\r\n\t\t}\r\n\r\n\t\t// bracket contents are irrelevant - remove them\r\n\t\tvar bracketIndex = pseudo.indexOf(\"(\");\r\n\t\tif (bracketIndex > -1) {\r\n\t\t\tpseudo = pseudo.substring(0, bracketIndex);\r\n\t\t}\r\n\r\n\t\t// check we're still dealing with a pseudo-class\r\n\t\tif (pseudo.charAt(0) == \":\") {\r\n\t\t\tswitch (pseudo.slice(1)) {\r\n\r\n\t\t\t\tcase \"root\":\r\n\t\t\t\t\tapplyClass = function(e) {\r\n\t\t\t\t\t\treturn isNegated ? e != root : e == root;\r\n\t\t\t\t\t};\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"target\":\r\n\t\t\t\t\t// :target is only supported in IE8\r\n\t\t\t\t\tif (ieVersion == 8) {\r\n\t\t\t\t\t\tapplyClass = function(e) {\r\n\t\t\t\t\t\t\tvar handler = function() {\r\n\t\t\t\t\t\t\t\tvar hash = location.hash;\r\n\t\t\t\t\t\t\t\tvar hashID = hash.slice(1);\r\n\t\t\t\t\t\t\t\treturn isNegated ? (hash == EMPTY_STRING || e.id != hashID) : (hash != EMPTY_STRING && e.id == hashID);\r\n\t\t\t\t\t\t\t};\r\n\t\t\t\t\t\t\taddEvent( win, \"hashchange\", function() {\r\n\t\t\t\t\t\t\t\ttoggleElementClass(e, className, handler());\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\treturn handler();\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\tcase \"checked\":\r\n\t\t\t\t\tapplyClass = function(e) {\r\n\t\t\t\t\t\tif (RE_INPUT_CHECKABLE_TYPES.test(e.type)) {\r\n\t\t\t\t\t\t\taddEvent( e, \"propertychange\", function() {\r\n\t\t\t\t\t\t\t\tif (event.propertyName == \"checked\") {\r\n\t\t\t\t\t\t\t\t\ttoggleElementClass( e, className, e.checked !== isNegated );\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn e.checked !== isNegated;\r\n\t\t\t\t\t};\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"disabled\":\r\n\t\t\t\t\tisNegated = !isNegated;\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"enabled\":\r\n\t\t\t\t\tapplyClass = function(e) {\r\n\t\t\t\t\t\tif (RE_INPUT_ELEMENTS.test(e.tagName)) {\r\n\t\t\t\t\t\t\taddEvent( e, \"propertychange\", function() {\r\n\t\t\t\t\t\t\t\tif (event.propertyName == \"$disabled\") {\r\n\t\t\t\t\t\t\t\t\ttoggleElementClass( e, className, e.$disabled === isNegated );\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\tenabledWatchers.push(e);\r\n\t\t\t\t\t\t\te.$disabled = e.disabled;\r\n\t\t\t\t\t\t\treturn e.disabled === isNegated;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn pseudo == \":enabled\" ? isNegated : !isNegated;\r\n\t\t\t\t\t};\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"focus\":\r\n\t\t\t\t\tactivateEventName = \"focus\";\r\n\t\t\t\t\tdeactivateEventName = \"blur\";\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"hover\":\r\n\t\t\t\t\tif (!activateEventName) {\r\n\t\t\t\t\t\tactivateEventName = \"mouseenter\";\r\n\t\t\t\t\t\tdeactivateEventName = \"mouseleave\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\tapplyClass = function(e) {\r\n\t\t\t\t\t\taddEvent( e, isNegated ? deactivateEventName : activateEventName, function() {\r\n\t\t\t\t\t\t\ttoggleElementClass( e, className, true );\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\taddEvent( e, isNegated ? activateEventName : deactivateEventName, function() {\r\n\t\t\t\t\t\t\ttoggleElementClass( e, className, false );\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\treturn isNegated;\r\n\t\t\t\t\t};\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t// everything else\r\n\t\t\t\tdefault:\r\n\t\t\t\t\t// If we don't support this pseudo-class don't create\r\n\t\t\t\t\t// a patch for it\r\n\t\t\t\t\tif (!RE_PSEUDO_STRUCTURAL.test(pseudo)) {\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn { className: className, applyClass: applyClass };\r\n\t}", "title": "" } ]
6136d554295e5b903e2ca1b9d8fd8a98
The Definition component renders a definition provided by the wordnik API. It displays via CSS when game status is "won" or "lost"
[ { "docid": "c5cb7e8a80ddab171576456099485107", "score": "0.6658018", "text": "function Definition(props) {\n return <h4 className=\"definition\">{props.definition}</h4>\n}", "title": "" } ]
[ { "docid": "28b2f60989bb575343c5d916f6acd484", "score": "0.65484065", "text": "function renderDefinition(def) {\n document.getElementById(\"def\").innerHTML = \"Definition: \" + def;\n}", "title": "" }, { "docid": "99e811d59cb5e73d05a455d0b2ccebcf", "score": "0.6342236", "text": "function renderWord(word){\n gameDisplay.innerHTML = `\n <div class = \"displayed-word\" hidden>\n ${word.word}\n </div>\n <div class = \"pronunciation\">\n PRONUNCIATION: \"${word.pronunciation}\"\n </div>\n <div class = \"definition\">\n DEFINITION: ${word.definition}\n </div>\n \n <div class = \"sentence\" hidden>\n Example: ${word.example_sentence}\n </div>\n \n <div class = \"part-of-speech\">\n ${word.part_of_speech}\n </div>\n \n `\n}", "title": "" }, { "docid": "b8ebc3f748179394df5517c4d910f011", "score": "0.6037148", "text": "function defineWord(data) {\n $(\"#definition\").text(data.word + \": \" + data.def);\n $(\"#definition\").removeClass(\"hidden\");\n}", "title": "" }, { "docid": "a15df87ee911a0b8ff3cdc9ebf01222d", "score": "0.6011409", "text": "function displayDefinition(searchResult) {\n // console.log(searchResult);\n searchedWordEl.innerText = searchResult.response.toUpperCase();\n let defintion = searchResult.meaning;\n var defVal = \"\";\n const myDefinition = (input) =>\n Object.entries(input).forEach(([key, value]) => {\n if (value.length > 0) {\n defVal =\n defVal +\n \"<strong>\" +\n key +\n \"</strong>\" +\n \":<br>\" +\n value.replaceAll(\"\\n\", \".<br>\") +\n \".\" +\n \"<br>\";\n } else {\n definitionEl.innerText = \"Nothing to Display\";\n }\n });\n myDefinition(defintion);\n definitionEl.innerHTML = defVal;\n phoneticsEl.innerText = ` ${searchResult.ipa}`;\n}", "title": "" }, { "docid": "485f45547a94f5011cd0c48af2a487ed", "score": "0.5961594", "text": "function generateDefinitionDisplay(data, word, wordFullyGuessed, requestFromWhere) { //displays the dictionary definition\n console.log(data);\n if (data[0] || data[0].shortdef[0]) { //checks to make sure a valid definition came through and not suggestions \n if (wordFullyGuessed == true) {\n definitionApiWord.innerHTML = `Your word is <b>${word}</b>:`\n } else if (requestFromWhere === \"userInitiated\") {\n definitionApiWord.innerHTML = `You wish to know the the definition of the word <b>${word}</b>:`\n\n } else if (data[0] == \"Couldn't retrieve the word from Merriam Webster\") {\n definitionApiWord.innerHTML = data[0];\n definitionApiDefinitions.innerHTML = \"I'll do better next time!\"\n\n } else {\n definitionApiWord.innerHTML = \"I'm not saying this is your word, but it could be: \" + \"<b>\" + word + \"</b>\"; //data[0].hwi.hw; // + \" \" + data[0].shortdef[0]; //word\n }\n let listOfDefinitions = \"\";\n\n try{\n for (let i = 0; i < data[0].shortdef.length; i++) { listOfDefinitions += \"<p>\" + (i + 1) + \".) \" + data[0].shortdef[i] + \" \" + \"</p>\" }\n definitionApiDefinitions.innerHTML = \"<b>Definition</b>: \" + listOfDefinitions;\n definitionApiDefinitions.innerHTML += `<p><a href=\"http://www.google.com/search?q=${word}\" target=\"_blank\">Google the word: ${word}</a></p>`\n\n }\n catch (err) {\n definitionApiDefinitions.innerHTML = \"I couldn't come through with a definition via Merriam Webster's Dictionary. Here's a link to look it up on Google.\";\n definitionApiDefinitions.innerHTML += `<p><a href=\"http://www.google.com/search?q=${word}\" target=\"_blank\">${word}</a></p>`\n console.log(err.message);\n }\n } else {\n console.log(\"A minor error: A single definition didn't come through\")\n definitionApiWord.innerHTML = \"The dictionary is not pleased\"\n }\n\n // fetchData(`https://en.wikipedia.org/w/api.php?action=query&titles=${word}&prop=pageimages&format=json&pithumbsize=100`)\n // .then(console.log(res.json))\n}", "title": "" }, { "docid": "af9d1b15cf2623e7b934de69bdcd9211", "score": "0.59510654", "text": "render() {\r\n return (\r\n <div className=\"container main-def\">\r\n <h2 className=\"Montserrat\">{this.state.text}</h2>\r\n {this.state.definition !== null && (\r\n <div>\r\n {this.state.definition.pronunciation !== undefined && \r\n <h3 className=\"Montserrat\">\r\n {this.state.definition.pronunciation.all !== null\r\n ? this.state.definition.pronunciation.all\r\n : this.state.definition.pronunciation}\r\n </h3>\r\n \r\n }\r\n <h3 className=\"Montserrat\">Definitions</h3>\r\n {this.isEmpty(this.state.definition.results)===true ? <h4 className=\"Montserrat\">There are no definition suggestions for this text</h4>:<div>\r\n\r\n {this.state.definition.results.map(info => (\r\n <div>\r\n <hr />\r\n <p className=\"Montserrat\">{info.partOfSpeech}</p>\r\n <p className=\"Montserrat\">{info.definition}</p>\r\n </div>\r\n ))}\r\n \r\n </div>\r\n}\r\n</div>\r\n )}\r\n </div>\r\n \r\n );\r\n \r\n}", "title": "" }, { "docid": "3b835c1d176ffaaef60723e3595b66b9", "score": "0.5604897", "text": "function winningDisplay (winningWord) {\n var winText = document.getElementById(\"winText\");\n winText.textContent = zelda.wordDefinition[winningWord];\n\n}", "title": "" }, { "docid": "267eb308f7c88b9d6153dfa2ea603e62", "score": "0.5581839", "text": "get definition () {\n\t\treturn this._definition;\n\t}", "title": "" }, { "docid": "267eb308f7c88b9d6153dfa2ea603e62", "score": "0.5581839", "text": "get definition () {\n\t\treturn this._definition;\n\t}", "title": "" }, { "docid": "d39ef6d4020c1d0426bafc9fdeeafd92", "score": "0.5539095", "text": "function displayDefinitions() {\n let usageIndex = Number($(\"#word-usage\").val());\n \n $(\"#definition\").html(\"\");\n for(let i = 0; i < data[usageIndex].shortdef.length; i++) {\n $(\"#definition\").append(`<option value=\"${i}\"> ${data[usageIndex].shortdef[i]} </option>`);\n }\n }", "title": "" }, { "docid": "d8b4de89f137a54c5b689b5745027a49", "score": "0.552631", "text": "function getDefinition(arg){\n\n\tvar endpoint = \"entries\";\n\tvar language_code = \"en-us\";\n\tvar wordId = getWordIdFromId(arg.target.getAttribute('id'));\n\tvar word = document.getElementById(wordId + \" word\").innerText;\n\n\tvar wordP = document.getElementById(wordId + \" wordp\");\n\n\tif (wordP.innerText != \"\"){\n\t\twordP.innerText = \"\";\n\t\treturn;\n\t}\n\t\t\n\tvar url = \"https://od-api.oxforddictionaries.com/api/v2/\";\n\turl += endpoint + \"/\" + language_code + \"/\" + word.toLowerCase();\n\turl += \"?fields=definitions\";\n\tvar app_id = '0816eb35';\n\tvar app_key = 'ae7760177c7934912644b8ce257ba83c';\n\n\tvar http = new XMLHttpRequest();\n\thttp.open(\"GET\", url);\n\thttp.setRequestHeader('app_id', app_id);\n\thttp.setRequestHeader('app_key', app_key);\n\thttp.send(null);\n\n\tvar wordP = document.getElementById(wordId + \" wordp\");\n\twordP.innerText = \"\";\n\n\thttp.onload = function(){\n\t\tvar data = JSON.parse(http.responseText);\n\t\tdata['results'][0]['lexicalEntries'].forEach((item, index) => {\n\t\t\tvar cate = item['lexicalCategory']['text'];\n\t\t\tvar defi = item['entries'][0]['senses'][0]['definitions'][0];\n\t\t\twordP.innerText += cate + \": \" + defi + '\\n';\n\t\t});\n\t}\n}", "title": "" }, { "docid": "ccc660ffc103329658f59e28ea5b3687", "score": "0.5522082", "text": "function renderWord() {\n // If there are still more words, render the next one.\n if (wordIndex <= (words.length - 1)) {\n document.querySelector(\"#word\").innerHTML = words[wordIndex];\n }\n // If there aren't, render the end game screen.\n else {\n document.querySelector(\"#word\").innerHTML = \"Game Over!\";\n document.querySelector(\"#score\").innerHTML = \"Final Score: \" + score + \" out of \" + words.length;\n }\n}", "title": "" }, { "docid": "65ccb61a1b93ff2faf0fe235ca0b3aa5", "score": "0.5473595", "text": "render() {\n\t\treturn (\n\t\t\t<Card body className=\"asset\">\n\t\t\t\t{this.props.word}\n\t\t\t</Card>\n\t\t);\n\t}", "title": "" }, { "docid": "2a1b0fc10bd02cc2c56c930861c08e12", "score": "0.5399057", "text": "render() {\n return (\n <div className=\"game\">\n <div className=\"game-board\">\n <Board />\n </div>\n <div className=\"game-info\">\n <div>{/* status */}</div>\n <ol>{/* TODO */}</ol>\n </div>\n </div>\n );\n }", "title": "" }, { "docid": "e963840f58ca453c2dd95755ab579f19", "score": "0.5339654", "text": "function getWordDefinition(word) {\n\tword = encodeURI(word.toLowerCase().replace(' ', '_'));\n\tfetch(`${preUrl}https://od-api.oxforddictionaries.com/api/v1/entries/en/${word}`, {\n\t\theaders: {\n\t\t\t'app_id': '763c3e51',\n\t\t\t'app_key': '511ea021798a93d039ada325ef807ecf'\n\t\t}\n\t})\n\t.then(response => {\n\t\tif (response.status !== 200) {\n\t\t\tthrow 'error';\n\t\t}\n\t\tlet stream = response.body;\n\t\tlet reader = stream.getReader();\n\t\treturn collectStream(reader);\n\t})\n\t.then(stream => new Response(stream))\n\t.then(response => response.blob())\n\t.then(blob => {\n\t\t// Update the word definition\n\t\toxfordReader.readAsText(blob);\n\t})\n\t.catch(err => {\n\t\tdocument.getElementById('word-definition-item').innerText = 'No dictionary entry located';\n\t\tdocument.getElementById('word-definition').style.display = 'flex';\n\t})\n}", "title": "" }, { "docid": "7e02b6aeb68e41791c3bb6dbf95ae69d", "score": "0.53111714", "text": "renderWordCard() {\n // Return an empty card indicating to select a word if no\n // word has been selected\n if (this.state.selectedWord === \"none\") {\n return (\n <Paper elevation={3} style={{width: \"700px\", height: \"500px\", borderRadius: \"10px\", position: \"absolute\", display: \"relative\"}}>\n <div style={{position: \"absolute\", top: \"65%\", left: \"50%\", width: \"300px\", height: \"300px\", marginTop: \"-150px\", marginLeft: \"-150px\"}}>\n <h1 style={{textAlign: \"center\"}} className=\"wordTitle\">No Word Selected</h1>\n <p style={{textAlign: \"center\"}} className=\"wordDefinition\">Please select a word to view from the panel to the left</p>\n </div>\n </Paper> \n )\n } else {\n // Return a styled word card with the appropriate information and image\n return (\n <Paper elevation={3} style={{width: \"700px\", height: \"500px\", borderRadius: \"10px\", position: \"absolute\"}}>\n <h2 style={{paddingLeft: \"5%\", paddingTop: \"5%\", textAlign: \"left\"}} className=\"wordTitle\">{this.state.selectedWord.word}</h2>\n <h3 style={{paddingLeft: \"5%\", textAlign: \"left\", color: \"grey\", fontWeight: \"400\"}} className=\"translatedWord\">{this.state.selectedWord.translated_word}</h3>\n <div style={{textAlign: \"center\"}}>\n <img src={this.state.selectedWord.img} style={{position: \"relative\", maxWidth: \"300px\", maxHeight: \"200px\"}}></img>\n </div>\n <br></br>\n <p style={{paddingLeft: \"5%\", paddingTop: \"1%\", textAlign: \"left\"}}>{this.state.selectedWord.definition}</p>\n <p style={{paddingLeft: \"5%\", paddingTop: \"1%\", textAlign: \"left\", color: \"grey\"}}>{this.state.selectedWord.translated_definition}</p>\n </Paper> \n )\n }\n }", "title": "" }, { "docid": "adb5e33dd9b477f5063070c17215f788", "score": "0.5293987", "text": "get definition() {\n\t\treturn this.__definition;\n\t}", "title": "" }, { "docid": "adb5e33dd9b477f5063070c17215f788", "score": "0.5293987", "text": "get definition() {\n\t\treturn this.__definition;\n\t}", "title": "" }, { "docid": "adb5e33dd9b477f5063070c17215f788", "score": "0.5293987", "text": "get definition() {\n\t\treturn this.__definition;\n\t}", "title": "" }, { "docid": "6061909dfdd363731bfa02a380132b45", "score": "0.5293395", "text": "function fetchDefinitionAPI(searchWord) {\n fetch(\n `https://twinword-word-graph-dictionary.p.rapidapi.com/definition/?entry=${searchWord}`,\n {\n method: \"GET\",\n headers: {\n \"x-rapidapi-key\": myKi,\n \"x-rapidapi-host\": \"twinword-word-graph-dictionary.p.rapidapi.com\",\n },\n }\n )\n // fetch request using sample json response\n // fetch(\"./assets/scripts/response-twinword-definition.json\")\n .then((res) => {\n if (res.status != 200) {\n throw Error(res.status + \" \" + res.statusText);\n } else {\n return res.json();\n }\n })\n .then((data) => {\n // call back function to display dictionary data\n displayDefinition(data);\n })\n .catch((error) => {\n definitionEl.innerText = error;\n });\n}", "title": "" }, { "docid": "a7c7e5611e976cdaf99a563e9a149231", "score": "0.52916664", "text": "function displayDef(userInput, response) {\n if (response.length > 0) {\n if (typeof (response[0].shortdef) !== 'undefined') {\n var defLength = response[0].shortdef.length\n var def = response[0].shortdef\n var wordClass = response[0].fl\n //creates div to display user input\n var defEntry = $(\"<div>\");\n var h5 = $(\"<h5>\");\n $(h5).attr(\"id\", \"icon\");\n //creates h5 to display user input word\n $(h5).addClass(\"dictH5\");\n h5.text(userInput + \"; \" + wordClass + \" \");\n $(defEntry).append(h5);\n //creates paragraph to display user input definition\n var newP = $(\"<p>\");\n var hw = response[0].hwi.hw;\n var mw = response[0].hwi.prs[0].mw;\n $(newP).text(hw + \"|\" + mw);\n $(defEntry).append(newP);\n $(\"#dictionary\").append(defEntry);\n for (var i = 0; i < defLength; i++) {\n var para = $(\"<p>\")\n $(para).addClass(\"dictPara\");\n para.text((i + 1) + \": \" + def[i])\n $(defEntry).append(para);\n };\n } else {\n userInput = \"NOTHING FOUND!\";\n var defEntry = $(\"<div>\");\n var h5 = $(\"<h5>\");\n $(h5).attr(\"id\", \"icon\");\n //creates h5 to display user input word\n $(h5).addClass(\"dictH5\");\n h5.text(userInput);\n $(defEntry).append(h5);\n $(\"#dictionary\").append(defEntry);\n }\n } else {\n userInput = \"NOTHING FOUND!\";\n var defEntry = $(\"<div>\");\n var h5 = $(\"<h5>\");\n $(h5).attr(\"id\", \"icon\");\n //creates h5 to display user input word\n $(h5).addClass(\"dictH5\");\n h5.text(userInput);\n $(defEntry).append(h5);\n //creates paragraph to display user input definition\n $(\"#dictionary\").append(defEntry);\n };\n}", "title": "" }, { "docid": "2e6f7ca56b05b24614ae1ff1261d21c7", "score": "0.5286977", "text": "tryDisplayWord(ctx, x, y) {\n if (this.state.wordObjectMap == null) {\n //Draw the word\n ctx.font = \"30px Comic Sans MS\";\n ctx.fillStyle = \"red\";\n ctx.globalAlpha = 1.0;\n ctx.textAlign = \"center\";\n ctx.fillText(\"Choose Struct\", x, y);\n return;\n }\n let currentWIDCount = this.state.currentWIDCount;\n let nextWidCount = this.state.currentWIDCount + 1;\n\n if (this.state.wordObjectMap.hasOwnProperty('wid_' + nextWidCount)) {\n if (this.state.wordObjectMap['wid_' + nextWidCount].word == ' ') {\n nextWidCount++;\n }\n //Check if next object time is passed, if it has, update current displayed word to that word.\n if (this.state.wordObjectMap['wid_' + nextWidCount].timeStamp < this.state.wavePlayer.getCurrentTime()) {\n currentWIDCount++;\n }\n }\n\n let currentWordObject = this.state.wordObjectMap['wid_' + currentWIDCount];\n\n //If currentWordObject doesn't exist or their timestamp isn't reached yet, don't display word\n if (!currentWordObject || currentWordObject.timeStamp > this.state.wavePlayer.getCurrentTime()) {\n return;\n }\n let timeDiff = this.state.wavePlayer.getCurrentTime() - currentWordObject.timeStamp;\n let sizeIncrease = ((Math.log(timeDiff + 1)) * 10);\n ctx.font = (sizeIncrease + this.state.centerWordSize) + \"px Comic Sans MS\";\n ctx.fillStyle = this.state.centerWordColor;\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n\n ctx.globalAlpha = (1 - timeDiff / 4) < 0 ? 0 : (1 - timeDiff / 4);\n ctx.fillText(currentWordObject.word, x, y);\n\n this.setState({\n currentWIDCount: currentWIDCount\n });\n ctx.globalAlpha = 1.0;\n }", "title": "" }, { "docid": "718efd3085546990d95cdc2622cc3f5d", "score": "0.52477825", "text": "function startGame(){\n const word = getRandomWord(); \n //const word = 'nope'; \n wd.getDef(word, \"en\", null, function(definition){\n //console.log(`HINT: ${definition.definition}`)\n if(run(definition.definition, word)){\n startGame()\n }\n \n });\n}", "title": "" }, { "docid": "b5f01593b9e6d0cb88311274b4f6323d", "score": "0.5228986", "text": "toggleDefinitionDisplayOff (e) {\n let searchInput = document.getElementById('searchedWord');\n let definitionTextbox = document.getElementById('add-def');\n let addButton = document.getElementById('add-to-dic')\n e.preventDefault();\n this.setState({\n word: null,\n definition: null,\n definitionDisplay:false\n });\n searchInput.value = '';\n searchInput.readOnly = false;\n addButton.disabled = false;\n }", "title": "" }, { "docid": "c9ae87a5f81cde06eb9360254324b5a4", "score": "0.5176053", "text": "run() {\n this.renderMood();\n }", "title": "" }, { "docid": "ac3265d56e7436db9afad73434fc68d3", "score": "0.5170724", "text": "function displayWord() {\n loadAndDisplayWord.style.gridTemplateAreas = 'word-to-be-typed';\n loadingWord.style.display = 'none';\n wordToBeTyped.style.display = 'block';\n}", "title": "" }, { "docid": "bbfd01265d6c8f5e271ea8a4e8168008", "score": "0.51231974", "text": "static setDefinitionText() {\n const selectedIndicator = getSelectedItem('select-indicator-group');\n const selectedCharacteristicGroup = getSelectedItem('select-characteristic-group');\n\n $(\".help-definition.indicator-group\").html(this.getDefinition(selectedIndicator));\n $(\".help-definition.characteristic-group\").html(this.getDefinition(selectedCharacteristicGroup));\n }", "title": "" }, { "docid": "dbf1364e581215804fda04ca7e61589a", "score": "0.51054156", "text": "render() {\n const winner = calculateWinner(this.state.squares);\n let status;\n if (winner) {\n status = 'Winner: ' + winner;\n } else {\n status = 'Next player: ' + (this.state.xIsNext ? 'X' : 'O');\n }\n return (\n <div className=\"game\">\n <div className=\"game-board\">\n <div className=\"status\">{status}</div>\n {this.renderBoard(0)}\n {this.renderBoard(1)}\n {this.renderBoard(2)}\n </div>\n <div className=\"game-info\">\n <div>{/* status */}</div>\n <ol>{/* TODO */}</ol>\n </div>\n </div>\n );\n }", "title": "" }, { "docid": "8b4831f3b7be828fdfa7ae1703799daf", "score": "0.5054926", "text": "graphicVisibility(definitionName, projectData) {\n\n\t\tif (definitionName === '_redRect') {\n\t\t\tvar hasEthos = projectData.defineEthos\n\t\t\t\t&& projectData.defineEthos.definedBy\n\t\t\t\t&& projectData.defineEthos.evidenceUrl\n\t\t\t// return (hasEthos ? true : false);\n\t\t\treturn true;\n\t\t}\n\n\t\tif (definitionName === '_governLabel') {\n\t\t\tvar hasGovern = projectData.govern.actions\n\t\t\t\t&& projectData.govern.actors.length > 0\n\t\t\t\t&& projectData.govern.outcomes\n\t\t\t\t&& projectData.govern.evolution\n\t\t\t\t&& projectData.govern.improvements;\n\t\t\treturn (hasGovern ? true : false);\n\t\t}\n\n\t\tif (definitionName === '_deliverLabel') {\n\t\t\tvar hasDeliver = projectData.deliver.method\n\t\t\t\t&& projectData.deliver.actors.length > 0\n\t\t\t\t&& projectData.deliver.evidenceUrl\n\t\t\treturn (hasDeliver ? true : false);\n\t\t}\n\n\t\tif (definitionName === '_ethosSection') {\n\t\t\tvar hasEthos = projectData.defineEthos.values\n\t\t\t\t&& projectData.defineEthos.definedBy\n\t\t\t\t&& projectData.defineEthos.evidenceUrl\n\t\t\treturn (hasEthos ? true : false);\n\t\t}\n\n\t\tif (definitionName === '_planManageSection') {\n\t\t\tvar hasPlanManagePrior = projectData.planManagePrior.actions\n\t\t\t\t&& projectData.planManagePrior.actors.length > 0\n\t\t\t\t&& projectData.planManagePrior.evidenceUrl;\n\t\t\tvar hasPlanManageCurrent = projectData.planManageCurrent.actions\n\t\t\t\t&& projectData.planManageCurrent.actors.length > 0\n\t\t\t\t&& projectData.planManageCurrent.evidenceUrl;\n\t\t\treturn (hasPlanManagePrior && hasPlanManageCurrent ? true : false);\n\t\t}\n\n\t\treturn false;\n\t}", "title": "" }, { "docid": "2066b6c78cfb445639366b591fc566dd", "score": "0.5045886", "text": "description() {\n return `${this.name}'s special ability is \"Dark Vision\" : for ${this.cost} mana, ${this.name}'s defensive move exploits his target open guard to inflicts ${this.specialdmg} damages to his target and ends up in a defensive stands, protecting himself for ${this.protectionAmount} damage for each attacks he recieves until next turn.`;\n }", "title": "" }, { "docid": "bfe2c42776443c59613cc27829c47761", "score": "0.50410426", "text": "function renderGame(result){\n\treturn `\n\t<div class=\"box\"> \n\t<div> <img src= \"${result.image.medium_url}\"> <div>\n\t\t<div> <p class=\"gameTitle\"> ${result.name} </p> </div>\n\t\t<div> <p class=\"deckER\">${result.deck}<p> </div>\n\t\t<div class=\"siteLink\"> <a href=\"${result.site_detail_url}\"target=\"_blank\">Check It Out</a> </div>\n \t\t</div>\n\t`\n}", "title": "" }, { "docid": "0b0b95475a60462e3cd38ecffb9874c0", "score": "0.5009441", "text": "function updateDisplay(game)\n{\n\twinsEl.textContent = game.wins;\n\tremainingGuessCountEl.textContent = game.remainingGuesses;\n\tlettersGuessedEl.textContent = game.lettersGuessed;\n\twordDisplayEl.textContent = game.wordDisplay;\n\thelpEl.textContent = game.helpText;\n}", "title": "" }, { "docid": "7fdc3145c88de97b88648a7925849b2f", "score": "0.49864292", "text": "function displayDefinition(){\n var word = enteredWord().toUpperCase();\n if (word.endsWith(\".\")){\n word = word.substring(0,word.length-1);//removes \".\"\n }\n word = allDefinitions[word];\n if (word == undefined) {\n document.getElementById('definition').value = \"undefined\";\n }else{\n document.getElementById('definition').value = word;\n }\n}", "title": "" }, { "docid": "a300f6a9a6dac28774f1d7ddd582918e", "score": "0.49848342", "text": "build() {\n return this.definition\n }", "title": "" }, { "docid": "5f35fe1de2a6a65497cb38ce3da9f3a3", "score": "0.49845642", "text": "function SanityVision() {\n return <Vision styles={styles} components={components} client={client} schema={schema} />\n}", "title": "" }, { "docid": "ceb9630818cff97104b87fe08a8ee9b3", "score": "0.4981872", "text": "displayGame(response) {\n const divGame = document.createElement('div');\n divGame.innerHTML = `\n <h1>${response.title}</h1>\n <img class='imageUrl' src='${response.imageUrl}'>\n <p>${response.description}</p> \n <button class=\"delete-btn\">Delete Game</button>\n <button class=\"update-btn\">Edit Game</button> \n `;\n return divGame;\n }", "title": "" }, { "docid": "2fcf27360a313f86f0547688d38865b4", "score": "0.49806195", "text": "function showWord() {\n console.log(currentWord.displayWord());\n}", "title": "" }, { "docid": "6eaf32fe50f75905efb431912c8403d9", "score": "0.49632058", "text": "render() {\n let location = \"no state selected\"\n return(\n <div>\n <h1>What Up Rep?</h1>\n <Description/>\n </div>\n )\n }", "title": "" }, { "docid": "f2dcf8c54f54bf3a73b4a03a6ff6f0b1", "score": "0.4954402", "text": "function createWordObject(word, freq) {\n\n var wordContainer = document.createElement(\"div\");\n wordContainer.style.position = \"absolute\";\n \n if (freq >= 40) {\n console.log(\"Frequency >= 40\");\n console.log(freq);\n wordContainer.style.fontSize = \"37px\";\n }\n else if (freq < 40 && freq >= 30) {\n wordContainer.style.fontSize = \"30px\";\n }\n else if (freq < 30 && freq >= 20) {\n wordContainer.style.fontSize = \"22px\";\n }\n else if (freq < 20 && freq >= 10){\n wordContainer.style.fontSize = \"18px\";\n }\n else {\n wordContainer.style.fontSize = \"15px\";\n }\n \n wordContainer.style.lineHeight = config.lineHeight;\n // wordContainer.style.transform = \"translateX(-50%) translateY(-50%);\"\n \n switch (word){\n case \"Cognition\": wordContainer.style.color = \"#4286f4\";\n break;\n case \"Performance\": wordContainer.style.color = \"#ff9966\";\n break;\n case \"Coordination\": wordContainer.style.color = \"#cca610\";\n break;\n case \"Management\": wordContainer.style.color = \"#08b20e\";\n break;\n case \"Control\": wordContainer.style.color = \"#ed76b3\";\n break;\n case \"Procedural&Team\": wordContainer.style.color = \"#ed2d43\";\n break;\n case \"Communication\": wordContainer.style.color = \"#e0682c\";\n break;\n case \"Information\": wordContainer.style.color = \"#d0d831\";\n break;\n case \"Planning\": wordContainer.style.color = \"#12914f\";\n break;\n case \"Resources\": wordContainer.style.color = \"#34d3e5\";\n break;\n case \"Team&Organization\": wordContainer.style.color = \"#5c6de0\";\n break;\n case \"Org-Coordination\": wordContainer.style.color = \"#b047e5\";\n break;\n default: wordContainer.style.color = \"#fc5dc7\";\n\n }\n \n wordContainer.appendChild(document.createTextNode(word));\n\n return wordContainer;\n}", "title": "" }, { "docid": "35d76d52cf3785dc0c59439ac324eafb", "score": "0.49355975", "text": "onRender() {\r\n const gameWidth = this.scene.game.config.width;\r\n const gameHeight = this.scene.game.config.height;\r\n\r\n // x, y, width, height, color, alpha\r\n this.setDialogBackground(\r\n 2,\r\n 48,\r\n gameWidth - 4,\r\n gameHeight / 2.5,\r\n 0x000,\r\n 0.5\r\n );\r\n\r\n // x, y, width, text\r\n this.setDialogText(\r\n gameWidth / 2,\r\n gameHeight - gameHeight / 2.5,\r\n gameWidth - 6,\r\n this.text\r\n );\r\n\r\n try {\r\n if (this.title) this.createNametag(2, 48, 120, 7, this.title);\r\n } catch (e) {\r\n console.error(e);\r\n }\r\n }", "title": "" }, { "docid": "ac4b6086f2c59795077a9902b887cb6c", "score": "0.49296537", "text": "function render() {\r\n LAYER_LIST.rect = new deck.GeoJsonLayer({\r\n id: \"rect-layer\",\r\n data: DATA.rect,\r\n getPolygon: x => x.geometry,\r\n stroked: true,\r\n getLineColor: [0, 0, 0, 102],\r\n getLineWidth: 1,\r\n lineWidthUnits: \"pixels\",\r\n getFillColor: [0, 0, 0, 0],\r\n pickable: true,\r\n onClick: info => setTooltip(info.object, info.x, info.y, info.coordinate),\r\n visible: LAYER_VISIBILITY.rect,\r\n });\r\n\r\n MY_DECKGL.setProps({\r\n layers: Object.values(LAYER_LIST),\r\n });\r\n}", "title": "" }, { "docid": "9d49eb71fd390acf01336de184fe3311", "score": "0.491194", "text": "function WordChoice(_ref) {\n var children = _ref.children;\n\n return children[1] ? _react2.default.createElement('span', { 'data-before': children[1], 'data-after': children[2], 'data-jsx': 3066242086\n }, children[0], _react2.default.createElement(_style2.default, {\n styleId: 3066242086,\n css: 'span[data-jsx=\"3066242086\"] {display: inline-block;}span[data-jsx=\"3066242086\"]::before,span[data-jsx=\"3066242086\"]::after {opacity: 0.05;display: block;position: absolute;font-size: 0.8rem;line-height: 0.8rem;z-index: -1;}span[data-jsx=\"3066242086\"]:hover::before,span[data-jsx=\"3066242086\"]:hover::after {opacity: 1;background: rgba(255, 255, 255, 0.5);z-index: 1;}span[data-jsx=\"3066242086\"]::before {content: attr(data-before);-webkit-transform: translateY(-0.6rem);-moz-transform: translateY(-0.6rem);-ms-transform: translateY(-0.6rem);transform: translateY(-0.6rem);}span[data-jsx=\"3066242086\"]::after {content: attr(data-after);-webkit-transform: translateY(-0.3rem);-moz-transform: translateY(-0.3rem);-ms-transform: translateY(-0.3rem);transform: translateY(-0.3rem);}'\n })) : _react2.default.createElement('span', {\n 'data-jsx': 3793446558\n }, children[0], _react2.default.createElement(_style2.default, {\n styleId: 3793446558,\n css: 'span[data-jsx=\"3793446558\"]::before {position: absolute;content: \\'WC\\';z-index: -1;opacity: 0.2;color: lightblue;font-size: 2rem;}span[data-jsx=\"3793446558\"]:hover::after {' + _Popup.popupStyle + ' content: \\'\\uD83D\\uDC48 word choice\\';line-height: 1;background: firebrick;}'\n }));\n}", "title": "" }, { "docid": "64f764b490ef0cd11e2d75068c52cc71", "score": "0.48811463", "text": "render() {\n return (\n <div className=\"Board\">\n {this.state.hasWon ? (\n <h1>\n <span className=\"Board-title Board-red\">You</span> <span className=\"Board-title Board-blue\">Win!</span>\n </h1>\n ) : (\n <div>\n <h1>\n <span className=\"Board-title Board-red\">Lights</span> <span className=\"Board-title Board-blue\">Out</span>\n </h1>\n <table className=\"Board-table\">\n <tbody>\n {this.state.board.map((row, y) => (\n <tr key={'row' + y}>\n {row.map((cell, x) => (\n <Cell key={y + '-' + x} coords={y + '-' + x} flipCellsAroundMe={this.flipCellsAround} isLit={cell} />\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )}\n </div>\n );\n\n // if the game is won, just show a winning msg & render nothing else\n }", "title": "" }, { "docid": "82af9d64e3f61210add4ad7b26568d49", "score": "0.48645496", "text": "function myStatus()\n {\n addLineToStory(\"\");\n addLineToStory(\"In je backpack:\");\n addLineToStory(\"\");\n addLineToStory(myGold + \" gold.\");\n addLineToStory(myNumberOfPotions + \" potion(s).\");\n addLineToStory(myHealth + \" van de \" + myMaxHealt + \" health over.\");\n addLineToStory(\"\");\n addLineToStory(\"Je equipment:\");\n addLineToStory(\"\");\n addLineToStory(\"Armor: \" + myArmor.itemName + \".\");\n addLineToStory(\"Wapen: \" + myWeapon.itemName + \".\");\n addLineToStory(\"Schild: \" + myShield.itemName + \".\");\n }", "title": "" }, { "docid": "440eaeadd720decc84b9d5aca8556347", "score": "0.4860159", "text": "function winDisplay() {\n\t\tvar nameMap = {\n\t\t\tAccordion: \"Accordion\",\n\t\t\tAcesUp: \"Aces Up\",\n\t\t\tAgnes: \"Agnes\",\n\t\t\tAlternations: \"Alternations\",\n\t\t\tBakersDozen: \"Baker's Dozen\",\n\t\t\tBakersGame: \"Baker's Game\",\n\t\t\tBaroness: \"Baroness\",\n\t\t\tCalculation: \"Calculation\",\n\t\t\tCanfield: \"Canfield\",\n\t\t\tDoubleKlondike: \"Double Klondike\",\n\t\t\tEightoff: \"Eight Off\",\n\t\t\tKlondike: \"Klondike\",\n\t\t\tKlondike1T: \"Klondike (Vegas style)\",\n\t\t\tTheFan: \"The Fan\",\n\t\t\tFlowerGarden: \"Flower Garden\",\n\t\t\tFortyThieves: \"Forty Thieves\",\n\t\t\tFreecell: \"Freecell\",\n Golf: \"Golf\",\n\t\t\tGClock: \"Grandfather's Clock\",\n\t\t\tLaBelleLucie: \"La Belle Lucie\",\n\t\t\tMonteCarlo: \"Monte Carlo\",\n\t\t\tPyramid: \"Pyramid\",\n\t\t\tRussianSolitaire: \"Russian Solitaire\",\n\t\t\tScorpion: \"Scorpion\",\n\t\t\tSimpleSimon: \"Simple Simon\",\n\t\t\tSpider: \"Spider\",\n\t\t\tSpider1S: \"Spider (1 Suit)\",\n\t\t\tSpider2S: \"Spider (2 Suit)\",\n Spiderette: \"Spiderette\",\n WillOTheWisp: \"Will O' The Wisp\",\n\t\t\tTriTowers: \"Tri Towers\",\n\t\t\tYukon: \"Yukon\"},\n\t\t \n\t\t stats = Record(localStorage[Solitaire.game.name() + \"record\"]),\n\n\t\t streakCount, winCount, loseCount,\n\n\t\t output = \"<div id='win_display'>\";\n\n\t\tstreakCount = stats.streaks().last().length;\n\t\twinCount = stats.wins().length;\n\t\tloseCount = stats.loses().length;\n\n\n\t\toutput += \"<p>You win! You're awesome.</p>\";\n\t\toutput += \"<h2>\" + nameMap[Solitaire.game.name()] + \" stats:</h2>\";\n\t\toutput += \"<ul>\";\n\t\toutput += \"<li>Current win streak: <span class='streak'>\" + streakCount + \"</li>\";\n\t\toutput += \"<li>Total wins: <span class='wins'>\" + winCount + \"</li>\";\n\t\toutput += \"<li>Total loses: <span class='loses'>\" + loseCount + \"</li>\";\n\t\toutput += \"<div class=replay_options><button class=new_deal>New Deal</button><button class=choose_game>Choose Game</button></div>\";\n\n\t\toutput += \"</ul></div>\";\n\n\t\treturn output;\n\t}", "title": "" }, { "docid": "7dbcac68aae97639f2814d857944e686", "score": "0.48588517", "text": "static displayRules() {\r\n console.log(\"-= Welcome to HANGMAN =-\\n\");\r\n let showRules = Utilities.formatString(input.question(\"Show Rules [y/n]?\\n>> \"));\r\n if (showRules === \"y\" || showRules === \"yes\") {\r\n console.log(colours.brightBlue(\"\\n\\nOVERVIEW\"));\r\n console.log(colours.rainbow(\"-----------------------\"));\r\n console.log(\"Hangman is a traditional guessing game, where one player attempts to guess all the letters of a pre-defined mystery word.\");\r\n console.log(\"Each time a wrong guess is made, one segment of a stick-figure hangman setup (stage or man) will be drawn.\");\r\n console.log(\"The game ends when the hangman is fully drawn or if the player rightly guesses the word before that happens.\");\r\n console.log(\"If the player managed to guess the word in time, they win the game. Otherwise, they lose.\");\r\n // this variant\r\n console.log(colours.brightBlue(\"\\n\\nTHIS VARIANT\"));\r\n console.log(colours.rainbow(\"-----------------------\"));\r\n console.log(\"This variation of Hangman is mostly similar to the original game, with the following exceptions...\");\r\n console.log(\"\\n1) The word to guess may be a word or short phrase\");\r\n console.log(\"\\n2) The words/phrases may contain other symbols (like \\') [these would be revealed to you]\");\r\n console.log(\"\\n3) There are lifelines to aid you along the way\");\r\n console.log(\"\\n4) You may decide on the difficulty of your games\");\r\n // lifelines\r\n console.log(colours.brightBlue(\"\\n\\nLIFELINES\"));\r\n console.log(colours.rainbow(\"-----------------------\"));\r\n console.log(\"> Enter \\\"0\\\" to access the lifelines\");\r\n console.log(\"\\n> Each lifeline may only be used once in an entire game\");\r\n console.log(\"\\n> Lifeline 1: Reveal all vowels in the current word\");\r\n console.log(\"\\t\\t\\b\\b(This lifeline will not be expended if all vowels are already revealed)\");\r\n console.log(\"\\n> Lifeline 2: Show the word's description\");\r\n console.log(\"\\n> Lifeline 3: Skip and score the current word\");\r\n console.log(\"\\t\\t\\b\\b(Your score will be incremented; instant success)\");\r\n console.log(\"\\n> Lifeline 4: Add lives (the number of lives added are as follows...)\\n\");\r\n console.log(\"\\t\\t\\b\\bEasy, Intermediate:\\t4\");\r\n console.log(\"\\t\\t\\b\\bAdvanced, Expert:\\t\\t3\");\r\n console.log(\"\\t\\t\\b\\bMaster, Legendary:\\t2\");\r\n console.log(\"\\t\\t\\b\\bPerfect\\t\\t\\t1\");\r\n // input\r\n console.log(colours.brightBlue(\"\\n\\nACCEPTED INPUT\"));\r\n console.log(colours.rainbow(\"-----------------------\"));\r\n console.log(\"You may enter:\");\r\n console.log(\"\\t> \\\"0\\\" to use a lifeline\");\r\n console.log(\"\\t> \\\"1\\\" to pass (give up)\");\r\n console.log(\"\\t> \\\"9\\\" to quit the game\");\r\n console.log(\"\\t> Any letter to guess\");\r\n console.log(\"\\t> A word or phrase to guess\");\r\n // penalties\r\n console.log(colours.brightBlue(\"\\n\\nPENALTIES\"));\r\n console.log(colours.rainbow(\"-----------------------\"));\r\n console.log(\"One life will be deducted each time you:\");\r\n console.log(\"\\t1) Enter non-alphabetical characters\");\r\n console.log(\"\\t2) Enter a number excluding 0, 1 and 9\");\r\n console.log(\"\\t3) Make a wrong guess (letter/word/phrase)\");\r\n console.log(\"\\t4) Repeat a guess you have already made\");\r\n // records\r\n console.log(colours.brightBlue(\"\\n\\nRECORDS\"));\r\n console.log(colours.rainbow(\"-----------------------\"));\r\n console.log(\"Only full games may be recorded\");\r\n console.log(\"\\nIf you so choose to record your score:\")\r\n console.log(\"\\t* You will be requested to provide a username\");\r\n console.log(\"\\t (it's case- and whitespace-sensitive)\");\r\n console.log(\"\\n\\t* Your timing will be noted down\\n\");\r\n }\r\n console.log();\r\n }", "title": "" }, { "docid": "10e6732a16c9686c3be5841330117f13", "score": "0.48569155", "text": "function displayData(word) {\n //Display word.\n $(\"#word-title\").html(`<u>${data[0].meta.id.toUpperCase()}</u>`);\n \n //Display dropdown menu of usages.\n $(\"#word-usage\").html(\"\");\n for(let i = 0; i < data.length; i++){\n if(data[i].meta.id === word) {\n $(\"#word-usage\").append(`<option value=\"${i}\"> ${data[i].fl} </option>`);\n }\n }\n \n displayDefinitions();\n displaySynonyms(); \n displayAntonyms();\n }", "title": "" }, { "docid": "c9ad6b9eface7ae86e5118bdf64a54ec", "score": "0.48562425", "text": "function drawDefinitionItem (label, value, dlLeft, dlTop, index, doc, options) {\n doc\n .fillColor(options.secondaryFontColor, 1)\n .font(boldFont)\n .text(label, dlLeft, dlTop + index * 44);\n\n doc\n .fontSize(8)\n .font(baseFont)\n .fillColor(options.baseFontColor);\n\n doc.text(value, dlLeft, dlTop + 14 + index * 44, {\n width: options.colWidthTwoCol,\n align: 'left'\n });\n}", "title": "" }, { "docid": "68c31dfbd0d4d138002739ffe59a0017", "score": "0.48495775", "text": "function Word(props) {\n // if they have guessed the letter print it on the page\n // otherwise just show an empty slot\n const { word, guessedLetters} = props\n const wordDivs = []\n let counter = 1;\n for (const letter of word) {\n wordDivs.push(\n <div key={counter} className=\"letter-box\">\n { guessedLetters.includes(letter) && letter }\n </div>\n )\n counter++;\n }\n return (\n <section>\n { wordDivs}\n </section>\n )\n}", "title": "" }, { "docid": "6749c8d8da82f914e4253674dce2e1d5", "score": "0.48483777", "text": "render () {\n return (\n <div className='app-concept'>\n Concept\n </div>\n )\n }", "title": "" }, { "docid": "534e1ddcfe9392443b02366b7b3d9f1a", "score": "0.483819", "text": "renderSaveGameStatus() {\n let className = this.state.gameSaveSuccessful ? \"successful\" : \"errors\";\n return (\n <article className={`randomizer-save-game-${className}`}>\n { this.state.gameSaveSuccessful ? \"Game Saved\" :\n this.state.gameSaveErrors }\n </article>\n );\n }", "title": "" }, { "docid": "99abd0d4d26dbbb3877c21f8c1e07160", "score": "0.48291433", "text": "description() {\n return `${this.name}'s special ability is \"Shadow hit\" : for ${this.cost} mana, ${this.name} strikes viciously for ${this.specialdmg} damages and takes the opportunity from her target's screaming giving her a distraction to hide into the shadows, making her ennemis unable to find her next turn.`;\n }", "title": "" }, { "docid": "d22b171016bde4cec143ff0f8c755dd1", "score": "0.48238063", "text": "getInputSearchWordDefinition() {\n if (this.moveDuplicateToTheTop()) {\n return;\n }\n\n // Reset to defaults and wordSearched to the word being search (regardless of whether the word is valid)\n this.setState({\n searchedAndWordNotFound: false,\n wordSearched: this.state.inputSearchWord,\n });\n\n // Toast message to indicate search is in progress\n RTM.setMessage(`Searching for word '${this.state.inputSearchWord}'...`);\n\n const url = `https://api.ivan-lim.com/?a=dictionary&word=${this.state.inputSearchWord}`;\n fetch(url)\n .then(response => response.json())\n .then(json => {\n const wordDefinitions = json.reduce((wordDefinitions, {shortdef}) => {\n // shortdef has content, word is found\n if (shortdef) return wordDefinitions.concat(shortdef);\n\n return wordDefinitions;\n }, []);\n\n const wordFound = (wordDefinitions.length > 0);\n\n if (wordFound) {\n // Only add to wordsHistory array if word is found (i.e. valid)\n const wordsHistory = [\n ...this.state.wordsHistory,\n {\n definitions: wordDefinitions,\n word: this.state.inputSearchWord,\n },\n ];\n\n // Set array to blank first to force React to rerender the accordion to ensure the word is expanded\n this.setState({\n wordsHistory: [],\n });\n\n this.setState({\n wordsHistory,\n });\n }\n\n // Definitions found\n this.setState({\n searchedAndWordNotFound: !wordFound,\n });\n })\n .catch(error => {\n console.error (error);\n })\n .finally(() => {\n // Remove toast message\n RTM.setMessage();\n });\n }", "title": "" }, { "docid": "0485bd90c6fd47cbd6508bcd07f637ff", "score": "0.48223805", "text": "async function render() {\n guilds = await getGuilds()\n Object.keys(guildTerritories).forEach(territory => {\n let guild = guildTerritories[territory][\"guild\"];\n // console.log(guild)\n if (!(Object.keys(colors).includes(guild))) {\n colors[guild] = stringToColor(guild)\n }\n if (territoryToggle) {\n try {\n\n rectangles[territory].setStyle({\n color: colors[guild],\n dashArray: guildTerritories[territory]['hq'] ? 7 : 0,\n weight: guildTerritories[territory]['hq'] ? 5 : 2\n })\n } catch (e) {\n console.log(territory)\n }\n } else {\n rectangles[territory].setStyle({\n color: 'rgba(0,0,0,0)'\n })\n setContent(guild, territory);\n }\n });\n // updateLeaderboard();\n }", "title": "" }, { "docid": "0b0009cceae31e444c69d4dd15ad962e", "score": "0.48195824", "text": "function gameRules() {\n gameContent = \"<h1 class='display-4'>About the Game</h1><p class='lead'><hr class='my-4'/><a class='btn btn-primary btn-lg' href='#' role='button'>Start</a></p>\";\n $(\".gameOn\").append(gameContent);\n }", "title": "" }, { "docid": "d43a86d2f63c761fa98409ae95b0207c", "score": "0.48182017", "text": "setElements() {\n this.element.children[1].textContent = 'Word: ' + wordToSearch;\n this.element.children[2].textContent = ' is defined as : ' + wordDefinition;\n }", "title": "" }, { "docid": "affbd98dbd560b4f674c70a64502ceb7", "score": "0.4818097", "text": "renderWordMaker(){\n if(this.state.currentUser === this.state.thinker){\n return(\n <div className = \"centralItem wordSubmit\" style = {{display: this.state.wordEntryDisplay}}>\n <input placeholder = \"Enter the word you're thinking\" onFocus = {this.onFocus.bind(this)} onBlur = {this.onBlur.bind(this)} className = \"wordEntryText\" onChange = {this.handleAddWord} type = \"text\"></input>\n <button onMouseDown = {this.addWord.bind(this)} onMouseDown = {this.onMouseDown.bind(this)} className = \"submitWord\">Submit Word</button>\n </div>\n )\n }\n }", "title": "" }, { "docid": "7c3a744854f7d42f04285d6ace7a0d05", "score": "0.48177966", "text": "function createWordCard(word, wordObj) {\n let synsStr = 'no synonyms';\n if (typeof wordObj.syns === 'object') {\n synsStr = (wordObj.syns).join(', ');\n } \n\n let cardDiv = document.createElement('div');\n cardDiv.classList.add('card-div');\n contentDiv.appendChild(cardDiv);\n\n const cardWord = document.createElement(\"div\");\n cardWord.classList.add('card-word', `word${word}`);\n cardWord.innerHTML = `<h3>${word}</h3>`;\n\n const cardDef = document.createElement(\"div\");\n cardDef.classList.add('card-def',`${word}`);\n cardDef.innerHTML =`<p>${wordObj.pos}-- ${wordObj.def}</p><p>synonyms: ${synsStr}</p>`;\n \n const myWordsBtn = document.createElement('img');\n myWordsBtn.src = './images/star1.svg';\n myWordsBtn.alt = 'empty star icon';\n myWordsBtn.setAttribute('id', `${word}`)\n myWordsBtn.classList.add('star1');\n myWordsBtn.addEventListener('click', saveWord);\n\n cardDiv.appendChild(cardWord);\n cardWord.appendChild(cardDef);\n cardDiv.appendChild(myWordsBtn);\n}", "title": "" }, { "docid": "5e338d62583dd4447487070d0b50c1ab", "score": "0.481762", "text": "renderTurn() {\n let turn = this.state.turn;\n let entityX = document.getElementById(\"entryX\");\n let entityO = document.getElementById(\"entryO\");\n\n if (turn === \"X\") {\n entityX.style.background = \"lightpink\";\n entityO.style.background = \"purple\";\n } else {\n entityO.style.background = \"lightpink\";\n entityX.style.background = \"purple\";\n }\n }", "title": "" }, { "docid": "75a52c56ade34604878ef55f23e164de", "score": "0.48126727", "text": "function buildDisplay(responseObj)\n {\n console.log('lymbix responseObj', responseObj);\n\n $('#moodeeLoading').hide();\n $('#emotionColor').show();\n\n // handle the dominant emotion\n switch (responseObj.dominant_emotion)\n {\n case 'affection_friendliness':\n $('#dominantEmotion').addClass('affection');\n $('#dominantEmotionExtraText').html('Affection / Friendliness');\n break;\n case 'anger_loathing':\n $('#dominantEmotion').addClass('anger');\n $('#dominantEmotionText').html('Anger / Loathing');\n break;\n case 'contentment_gratitude':\n $('#dominantEmotion').addClass('contentment');\n $('#dominantEmotionExtraText').html('Contentment / Gratitude');\n break;\n case 'enjoyment_elation':\n $('#dominantEmotion').addClass('enjoyment');\n $('#dominantEmotionExtraText').html('Enjoyment / Elation');\n break;\n case 'fear_uneasiness':\n $('#dominantEmotion').addClass('fear');\n $('#dominantEmotionExtraText').html('Fear / Uneasiness');\n break;\n case 'humiliation_shame':\n $('#dominantEmotion').addClass('humiliation');\n $('#dominantEmotionExtraText').html('Humiliation / Shame');\n break;\n case 'sadness_grief':\n $('#dominantEmotion').addClass('sadness');\n $('#dominantEmotionExtraText').html('Sadness / Grief');\n break;\n case 'amusement_excitement':\n $('#dominantEmotion').addClass('amusement');\n $('#dominantEmotionExtraText').html('Amusement / Excitement');\n break;\n case 'Neutral':\n $('#dominantEmotion').addClass('neutral');\n $('#dominantEmotionExtraText').html('Neutral');\n break;\n }\n\n // handle the sentiment color\n switch (responseObj.article_sentiment.sentiment)\n {\n case \"Negative\":\n $('#emotionColor').css('background-color', 'red');\n break;\n case \"Positive\":\n $('#emotionColor').css('background-color', 'green');\n break;\n case \"Neutral\":\n $('#emotionColor').css('background-color', 'blue');\n break;\n }\n\n // sentiment\n $('#sentiment').html(responseObj.article_sentiment.sentiment);\n\n // clarity\n $('#clarity').html(responseObj.clarity);\n\n // intense sentence\n $('#dominantEmotionText').html(responseObj.intense_sentence.sentence);\n\n // average_intensity\n $('#average_intensity').html(responseObj.average_intensity);\n\n // breakdown\n $('#affection_friendliness').html(responseObj.affection_friendliness);\n $('#amusement_excitement').html(responseObj.amusement_excitement);\n $('#anger_loathing').html(responseObj.anger_loathing);\n $('#contentment_gratitude').html(responseObj.contentment_gratitude);\n $('#enjoyment_elation').html(responseObj.enjoyment_elation);\n $('#fear_uneasiness').html(responseObj.fear_uneasiness);\n $('#humiliation_shame').html(responseObj.humiliation_shame);\n $('#sadness_grief').html(responseObj.sadness_grief);\n }", "title": "" }, { "docid": "af6688bc24092cad8b52876c55995e61", "score": "0.48026404", "text": "render () {\n\t\tvar woundBoxes = this.generateWoundBoxes();\n\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t<p>\n\t\t\t\t\t<span className='labelTag'>Wound Boxes:</span> \n\t\t\t\t\t<span className='labelValue'>\n\t\t\t\t\t\t{this.props.health} / {this.props.maxHealth}\n\t\t\t\t\t</span><br/>\n\t\t\t\t\t{woundBoxes}\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t);\n\t}", "title": "" }, { "docid": "a80ad732a01539af8269fd39655b821f", "score": "0.47978562", "text": "function addWord(word,definition){\n let exists = false;\n for(let i = 0;i<Object.values(defins).length;i++){\n if(definition===Object.values(defins)[i]){\n exists=true;\n }\n }\n if(!exists){\n defins[word] = definition;\n saveData();\n }\n}", "title": "" }, { "docid": "43a46007bad9f476e563a7f9d22dd967", "score": "0.47977272", "text": "function displayOfficeTypes() {\n\n // create the query on the officeLayer so that it respects its definitionExpression\n var query = officeLayer.createQuery();\n query.outFields = [\"SPACETYPE\"];\n\n // query the officeLayer to calculate how many offices are from each type\n officeLayer.queryFeatures(query)\n .then(function(results) {\n\n var typesCounter = {}; // counter for the office types defined in the officeTypes array\n var othersCounter = 0; // counter for all the other office types\n\n // count the types of all the features returned from the query\n results.features.forEach(function(feature) {\n var spaceType = feature.attributes.SPACETYPE;\n\n if (typesCounter[spaceType]) {\n typesCounter[spaceType]++;\n } else {\n typesCounter[spaceType] = 1;\n }\n\n if (officeTypes.indexOf(spaceType) === -1) {\n othersCounter++;\n }\n\n });\n\n // to set the results in the legend, we need to modify the labels in the renderer\n var newRenderer = officeLayer.renderer.clone();\n\n officeTypes.forEach(function(value, i) {\n newRenderer.uniqueValueInfos[i].label = value +\n \": \" + (typesCounter[value] || 0) + \" rooms\";\n });\n\n newRenderer.defaultLabel = \"Other types: \" +\n othersCounter + \" rooms\";\n\n officeLayer.renderer = newRenderer;\n });\n }", "title": "" }, { "docid": "3ca10d9d9df1577b21b701375f28366d", "score": "0.4797103", "text": "render() {\n let {sprite, option, text, property, item} = this.props\n let display = true\n if (property) {\n display = item.record.properties?.indexOf(property) > -1\n }\n\n if (display) {\n return <span>\n <span \n data-instance={item.instance_id} \n className={`format-link lab-action fas fa-${sprite} ${option}`}>\n {text === \"Run Test\" ? \" \" + text : \"\"} <span>{text}</span>\n </span>\n </span>\n } else {\n return \"\"\n }\n\n }", "title": "" }, { "docid": "3eb131b6c86197766612b14cd2257060", "score": "0.4790806", "text": "gameOver () {\n const hTag = document.createElement('h4')\n hTag.innerText = 'You won after ' + this.tries + ' tries!'\n this.shadowRoot.appendChild(hTag)\n }", "title": "" }, { "docid": "35d2cf63e3d52e0d664efb74b97257af", "score": "0.4785746", "text": "function displayDefinition(defs){\n var defString = \"\";\n var forms = new Map();\n var count = 0;\n var currForm = \"\";\n \n for(def of defs){\n var split = def.split('\\t');\n var form = getDefForm(split[0]);\n if (count < 2){\n if(forms.has(form)){\n \n sen = forms.get(form);\n sen = sen + \"<li>\" +split[1].charAt(0).toUpperCase() + split[1].slice(1)+\"</li>\";\n forms.set(form, sen);\n\n }else{\n sen = \"<li>\" +split[1].charAt(0).toUpperCase() + split[1].slice(1)+\"</li>\";\n forms.set(form,sen);\n }\n \n }\n \n //Control number of definitions under each form\n \n if(currForm == form){\n count++;\n }else{\n currForm = form;\n count = 1;\n }\n \n }\n \n var keys = forms.keys();\n for(key of keys){\n defString = defString +'<h5 class=\"text-muted\">'+key+'</h5>' + '<ol>'+forms.get(key)+'</ol>';\n }\n \n return defString;\n \n \n \n}", "title": "" }, { "docid": "674b0d94c39d68e06ae5d349cf9b52c8", "score": "0.47815943", "text": "display() {\n push();\n rectMode(CENTER);\n textAlign(CENTER, CENTER);\n // outer\n fill(255);\n rect(this.x, this.y, this.width, this.height);\n // color\n if (this.colorId === 0) {\n fill(GREEN);\n } else if (this.colorId === 1) {\n fill(ORANGE);\n } else if (this.colorId === 2) {\n fill(RED);\n } else if (this.colorId === 3) {\n fill(PURPLE);\n }\n // inner\n rect(this.x, this.y, this.width * 0.9, this.height * 0.9);\n // description\n fill(255);\n textSize(18);\n text(this.word, this.x, this.y - this.height / 2 + 24);\n textSize(16);\n text(this.des, this.x, this.y);\n pop();\n // if focused, raise up\n if (this.focus) {\n this.y = lerp(this.y, this.yFocused, 0.2);\n } else {\n // if being swapped, go to the top of the screen\n if (this.swaped) {\n this.y = lerp(this.y, -this.height, 0.1);\n // if being accepted, go to the bottom of the screen\n } else if (this.accepted) {\n this.y = lerp(this.y, height + this.height, 0.1);\n // if not being swapped, reset\n } else {\n this.y = lerp(this.y, this.yNotFocused, 0.2);\n }\n }\n }", "title": "" }, { "docid": "3284c7b33cf94f0ff12acc1df91237ea", "score": "0.47765553", "text": "function displayGame() {\n \n //Display _\n for (var i = 0; i < wordLength; i++) {\n display[i] = \" _ \";\n word.textContent = ([display.join(\"\")]);\n }\n // Display how many guesses left\n guessCount.textContent = attemptsLeft;\n\n // Display initial wins\n winCount.textContent = win;\n}", "title": "" }, { "docid": "00934eb3ce2651724425253b45362564", "score": "0.47622424", "text": "function createDesc(game, idx) {\n var desc_div = document.createElement('div');\n desc_div.id = 'desc_div' + idx;\n desc_div.className = 'desc_box';\n desc_div.innerHTML = game[idx].venue + '<br>' +\n game[idx].away_name_abbrev + \": \" + game[idx].linescore.h.away + \"<br>\" +\n game[idx].home_name_abbrev + \": \" + game[idx].linescore.h.home;\n\n // Attach descriptor to game div\n document.getElementById('game_div'+idx).appendChild(desc_div);\n}", "title": "" }, { "docid": "fc1ba0612e72c7b840f95b8099baa490", "score": "0.47500923", "text": "function displaySpellName() {\n push();\n if (currentSpell === `Voldemort`) {\n fill(217, 254, 177);\n }\n displayText(currentSpell, 40, width / 2, height / 8);\n pop();\n}", "title": "" }, { "docid": "0ab67959f5588dc345748da4078f591c", "score": "0.47497216", "text": "function handleLeaderboard(\n type, // string: The type of characters.\n title = 'Leaderboard' // string: What the header should say.\n) {\n const { game } = this;\n document.querySelector('#game-overlay > .leaderboard').innerHTML = _render([\n `<h3>${title}</h3>`,\n ...Object.entries(game[type]).map(\n ([id, data]) => `<div class=\"player\" id=\"${id}\">\n ${\n typeof data.lives === 'number'\n ? _render(['<div class=\"lives\">', _renderLives(data), '</div>'])\n : ''\n }\n <div class=\"text\">\n ${\n typeof data.name === 'string'\n ? _render([\n '<p class=\"name\"' +\n (this.myId() === id ? ' style=\"color: #8BE1FF;\"' : '') +\n '>',\n data.name,\n '</p>',\n ])\n : ''\n }\n ${\n typeof data.score === 'number'\n ? _render([\n '<p class=\"score\"' +\n (this.myId() === id ? ' style=\"color: #8BE1FF;\"' : '') +\n '>',\n data.score,\n '</p>',\n ])\n : ''\n }\n </div>\n </div>`\n ),\n ]);\n}", "title": "" }, { "docid": "ec90cf830b98e052afccbaaf258fe821", "score": "0.47477737", "text": "render() {\n\t\treturn (\n\t\t\t<div className=\"pageWrapper\">\n\t\t\t\t<Header\n\t\t\t\t\theader={this.state.header}/>\n\t\t\t\t<div className=\"gameWrapper\">\n\t\t\t\t\t<SideBar\n\t\t\t\t\t\tsound={this.state.sound}\n\t\t\t\t\t\thandleSound={this.handleSound}\n\t\t\t\t\t\tlevel={this.state.level}\n\t\t\t\t\t\tlife={this.state.life}\n\t\t\t\t\t\tattack={this.state.attackPower}\n\t\t\t\t\t\tskillItems={this.state.skillItems}\n\t\t\t\t\t\texperience={this.state.experience}\n\t\t\t\t\t\tcertifications={this.state.certifications}\n speed={this.state.speed}\n paused={this.state.paused} />\n\t\t\t\t\t<Game\n\t\t\t\t\t\tgameMap={this.state.renderMap} \n clickMove={this.handleKeyPress} />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}", "title": "" }, { "docid": "d2affc4cf91cd39cc10297f3e4784563", "score": "0.4744708", "text": "function displayWord() {\n word.innerHTML = `\n ${selectedWord.split(\"\").map(letter =>\n `<span class=\"letter\">${correctLetters.includes(letter) ? letter : ''}</span>`\n ).join('')}\n\n `\n // remove the line break\n const innerWord = word.innerText.replace(/\\n/g, '')\n // * win condition\n if (innerWord === selectedWord) {\n finalMessage.innerText = 'Congratulations, You have won! 😃'\n popUP.style.display = 'flex'\n }\n }", "title": "" }, { "docid": "70eba6e34a31516ba92bf1b9e6180cff", "score": "0.47425872", "text": "function processDefinition(def, name, config) {\n if (!isWritable(name))\n return;\n name = common_1.normalizeDef(name);\n const nameModel = name;\n let output = '';\n const properties = _.map(def.properties, (v, k) => common_1.processProperty(v, k, name, def.required, true, nameModel));\n // conditional import of global types\n if (properties.some(p => !p.native)) {\n output += `import * as __${conf.modelFile} from \\'../${conf.modelFile}\\';\\n\\n`;\n }\n if (def.description)\n output += `/** ${def.description} */\\n`;\n output += `export interface ${name} {\\n`;\n output += utils_1.indent(_.map(properties, 'property').join('\\n'));\n output += `\\n}\\n`;\n // concat non-empty enum lines\n const enumLines = _.map(properties, 'enumDeclaration').filter(Boolean).join('\\n\\n');\n if (enumLines)\n output += `\\n${enumLines}\\n`;\n const filename = path.join(config.dest, conf.defsDir, `${name}.ts`);\n utils_1.writeFile(filename, output, config.header);\n return { name, def };\n}", "title": "" }, { "docid": "c5100b2705b771450375a8f3799f1920", "score": "0.4740819", "text": "function buildGameScreen() {\n var game = new Game(mainContent);\n game.build();\n \n game.onEnded(function(isWin, score) {\n endGame(isWin, score);\n });\n }", "title": "" }, { "docid": "a8bf133a3b2539c116f2448457e2a3c4", "score": "0.47273266", "text": "function renderGameWon() {\r\n Frogger.drawingSurface.font = _font;\r\n Frogger.drawingSurface.textAlign = \"center\";\r\n Frogger.drawingSurface.fillStyle = \"#FF0\";\r\n\r\n // Write the text center aligned within the <canvas> and at the 9th row position\r\n // from the top of the game board\r\n Frogger.drawingSurface.fillText(\"YOU WIN!\", Frogger.drawingSurfaceWidth / 2, _gameBoard.rows[9]);\r\n }", "title": "" }, { "docid": "e29235674c06759259b2b5c141848d89", "score": "0.47186825", "text": "function construct_overview(e) {\r\n\tvar ex_count = e.elements.filter(ele => [\"MULTIPLE_CHOICE\", \"SELECT_PHRASE\", \"MATCH\", \"TYPE_TEXT\", \"ARRANGE\", \"POINT_TO_PHRASE\"].includes(ele.type)).length;\r\n\tvar s = {\r\n\t\ttitle: e.elements.filter(a => a.line && a.line.type == \"TITLE\")[0].line.content.text,\r\n\t\tid: e.trackingProperties.story_id,\r\n\t\tparts: (a => a ? \" \" + a.part + \"/\" + a.totalParts : \"\")(e.multiPartInfo)\r\n\t}\r\n\tstory_collector[s.id] = {\r\n\t\tid: s.id,\r\n\t\tset: e.trackingProperties.story_set_number,\r\n\t\t// image from hardcoded list\r\n\t\timg: \"![](https://i.imgur.com/\" +\r\n\t\t\ticons[e.illustrations.active.substr(39,40)] + \".png)\",\r\n\t\t// title with part number and forum link\r\n\t\ttitle: s.id in p[course] ?\r\n\t\t\t\"[\" + e.fromLanguageName + s.parts + \"](https://forum.duolingo.com/comment/\" +\r\n\t\t\t\tp[course][s.id] + \")\"\r\n\t\t\t:\r\n\t\t\t\te.fromLanguageName + s.parts,\r\n\t\t// target language story title with story ID if no forum link is hardcoded\r\n\t\tname: s.title + (s.id in p[course] ? \"\" : \"[br]\" + s.id),\r\n\t\tcefr: (a => \"**[color=\" + cefr[a] + \"]\" + a + \"[/color]**\")\r\n\t\t\t(e.trackingProperties.cefr_level),\r\n\t\trev: e.revision,\r\n\t\tlen: (a => \"**[color=\" + calc_color((a - 20) / 0.3) + \"]\" + a + \"[/color]**\")\r\n\t\t\t(e.elements.filter(ele => ele.line).length),\r\n\t\tex: \"**[color=\" + calc_color((ex_count - 6) / 0.1) +\r\n\t\t\"]\" + ex_count + \"[/color]**\",\r\n\t\taudio: \"[\" + narrator_marking.forum +\r\n\t\"](https://stories-cdn.duolingo.com/audio/\" + story_audio[course][s.id] + \".mp3)\"\r\n\t};\r\n\tif (Object.keys(story_collector).length == gcl(\"story\").length) {\r\n\t\toutput_overview();\r\n\t}\r\n}", "title": "" }, { "docid": "cdf7f1f154afb26dd02d6198925db0df", "score": "0.47107127", "text": "function onMessage(e) {\n try {\n var word_id = e.message.text\n var idx = word_id.indexOf(\" \")+1\n word_id = word_id.substr(idx).toLowerCase()\n \n var url = 'https://od-api.oxforddictionaries.com:443/api/v1/entries/' + language + '/' + word_id\n var response = UrlFetchApp.fetch(url, { 'headers': {'app_id': app_id, 'app_key': app_key}, 'muteHttpExceptions': true })\n Logger.log(response)\n\n response = JSON.parse(response)\n var senses = response.results[0].lexicalEntries[0].entries[0].senses[0] \n var answer = senses.definitions[0]\n \n if (senses.subsenses) {\n answer = '1. ' + senses.definitions[0]\n var i\n for (i = 0; i < senses.subsenses.length; i++) {\n Logger.log(senses.subsenses[i])\n answer = answer + '\\n' + (i+2) + '. ' + senses.subsenses[i].definitions[0]\n }\n }\n \n return { 'text': '```' + answer + '```' };\n } catch(err) {\n Logger.log(err)\n return { 'text': \"Sorry. I couldn't look that up. The word doesn't exist or something went wrong.\" }\n }\n}", "title": "" }, { "docid": "1d3ceb713ac1f7cfa783a891b9d7fa0b", "score": "0.4709313", "text": "function updateGameDisplay() {\n let wordCompletionState = document.getElementById(\"wordCompletionStateParagraph\");\n let gameStateText = document.getElementById(\"gameStateParagraph\");\n let lettersGuessedText = document.getElementById(\"lettersGuessedParagraph\");\n let hangmanImg = document.getElementById(\"hangmanPicture\");\n hangmanImg.src = 'imgs/hms' + guessesRemaining + '.png' // Draw hangman using guessesRemaining\n lettersGuessedText.innerHTML = 'So far you have used: ' + lettersGuessed.join(' ');\n if(wordState.join('') === word.toString()) { //Check for win\n wordCompletionState.innerHTML = 'Your word is now ' + wordState.join(' ');\n gameStateText.innerHTML = 'You are the big winner have a sandwich';\n restartGame();\n } else if(guessesRemaining <= 0) { //Check for loss\n gameStateText.innerHTML = 'You LOSE!';\n restartGame();\n } else { //Otherwise continue\n wordCompletionState.innerHTML = 'Your word is now ' + wordState.join(' ');\n gameStateText.innerHTML = 'You have ' + guessesRemaining + ' guesses remaining';\n }\n}", "title": "" }, { "docid": "f0dfa4f2ddadb9114b368129b2490850", "score": "0.47061646", "text": "function WordChoice({ children }) {\n return children[1]\n ? <span data-before={children[1]} data-after={children[2]}>\n {children[0]}\n <style jsx>{`\n span {\n display: inline-block;\n }\n span::before, span::after {\n opacity: 0.05;\n display: block;\n position: absolute;\n font-size: 0.8rem;\n line-height: 0.8rem;\n z-index: -1;\n }\n span:hover::before, span:hover::after {\n opacity: 1;\n background: rgba(255, 255, 255, 0.5);\n z-index: 1;\n }\n span::before {\n content: attr(data-before);\n transform: translateY(-0.6rem);\n }\n span::after {\n content: attr(data-after);\n transform: translateY(-0.3rem);\n }\n `}</style>\n </span>\n : <span>\n {children[0]}\n <style jsx>{`\n span::before {\n position: absolute;\n content: 'WC';\n z-index: -1;\n opacity: 0.2;\n color: lightblue;\n font-size: 2rem;\n }\n span:hover::after {\n ${popupStyle}\n content: '👈 word choice';\n line-height: 1;\n background: firebrick;\n }\n `}</style>\n </span>;\n}", "title": "" }, { "docid": "9e0e57676d6ffe8526f5a31efac47f6a", "score": "0.47058368", "text": "function showDefinition( id ){\n\tconsole.log(\"showDefinition\",id);\n\t$(\".main-col-search\").animate({ opacity:0.3 }, 400 );\n\t$(\".hover-info\").css(\"display\" , \"inline\");\n\ttoggle( \".\"+id , \".explain\" );\n\t$(\".\"+id+\" .explainDesc\").removeClass(\"hide\");\n\treturn false;\n}", "title": "" }, { "docid": "a4ac95937c8a4f73fd676fa4447e9d8d", "score": "0.4703535", "text": "function draw() {\n background(0);\n\n// Intro\nif (state === `intro`){\n textIntro();\n}\n//\n\n// Level\nelse if (state === `level`){\n\n // Mic Input Lifts Creatures\n let level = mic.getLevel();\n let liftAmount = map(level, 0, 1, - 1, -15);\n\n // Winged Creatures\n for(let i = 0; i < creatures.length; i ++){\n let creature = creatures[i];\n if (creature.active){\n creature.move();\n creature.lift(liftAmount);\n creature.constraining();\n creature.gravity(gravityForce);\n creature.display();\n creature.checkImpact();\n }\n }\n\n orangeLine();\n\n delimitingWalls(); // white\n\n // Flickering White and Black Buttons\n crypticButtons();\n\n // Display Tips Table - User can open/close table containing cues, if necessary\n tips();\n\n // Check which Keys User is typing\n checkInputProgress();\n\n // Check if any of the Creatures fall below Orange Line\n checkFail();\n\n }\n//\n\n// Pass - User fails to guess the word in time\nelse if (state === `pass`){\n textPass();\n}\n//\n\n// Success - User guesses Word and Achives Item\nelse if (state === `success`){\n textSuccess();\n}\n//\n\n}", "title": "" }, { "docid": "8aa0c1ee358cad1008e31800c7370f2f", "score": "0.47020978", "text": "function GameStats({isGameStarted, isDealerTheWinner, isPlayerTheWinner}) {\n /**\n * Determines if this is the first time the game has been opened.\n */\n const isStartOfTheGame = !isGameStarted && !isDealerTheWinner && !isPlayerTheWinner;\n\n return (\n <div className={styles.gameStats}>\n\n {isPlayerTheWinner &&\n <div className={styles.winMessage}>You won!!!</div>\n }\n\n {isDealerTheWinner &&\n <div className={styles.looseMessage}>Sorry you lost.</div>\n }\n\n {isStartOfTheGame &&\n <div className={styles.gameInfo}>To start a\n new game, press the DEAL button</div>\n }\n\n {isGameStarted &&\n <div className={styles.gameInfo}>Get to 21. All face cards, including Aces, have a value of 10.</div>\n }\n </div>\n );\n}", "title": "" }, { "docid": "fe92c945dad5152212abf92b591bc3e5", "score": "0.47015637", "text": "render() {\r\n switch (window.parent.widget_settings.dialogEntryPoint) {\r\n case 'KC' :\r\n return (\r\n <KnowledgeCheck sendState={window.parent.widget_settings}></KnowledgeCheck>\r\n )\r\n break;\r\n case 'JIT' :\r\n return (\r\n <JustInTime sendState={window.parent.widget_settings}></JustInTime>\r\n )\r\n break;\r\n default :\r\n break;\r\n }\r\n }", "title": "" }, { "docid": "59f1b1ebbbb8c182029c459e285ccd58", "score": "0.46898457", "text": "showAreaDescription() {\n if (!this.isMonsterInArea()) {\n this.monster.move();\n }\n this.currArea.printDescription();\n }", "title": "" }, { "docid": "21ddc395cac2fcabcc6729b658521eba", "score": "0.46821812", "text": "function draw() {\n background(12, 164, 255);\n\n if (state === `title`) {\n title();\n } else if (state === `simulation`) {\n simulation();\n } else if (state === `bad`) {\n badEnding();\n } else if (state === `good`) {\n goodEnding();\n }\n\n console.log(schoolSize)\n\n}", "title": "" }, { "docid": "11031ed0d5a4395c16a72d68edfad187", "score": "0.46804395", "text": "function Display(props){\n\treturn <h1 className=\"display\">{props.value}</h1>\n}", "title": "" }, { "docid": "abaa3f0e01fd567de6d82d77627a0139", "score": "0.4668096", "text": "renderStatistics() {\n\t\tcontext.save();\n\t\tcontext.textBaseline = 'top';\n\t\tcontext.fillStyle = Colour.Black;\n\t\tcontext.font = `${UserInterfaceElement.FONT_SIZE}px ${UserInterfaceElement.FONT_FAMILY}`;\n\t\tcontext.fillText(\n\t\t\tthis.pokemon.name.toUpperCase(),\n\t\t\tthis.position.x + 15,\n\t\t\tthis.position.y + 12\n\t\t);\n\t\tcontext.textAlign = 'right';\n\t\tcontext.fillText(\n\t\t\t`Lv${this.pokemon.level}`,\n\t\t\tthis.position.x + this.dimensions.x - 10,\n\t\t\tthis.position.y + 12\n\t\t);\n\t\tcontext.fillText(\n\t\t\t`HP: ${this.pokemon.getHealthMeter()}`,\n\t\t\tthis.position.x + this.dimensions.x - 30,\n\t\t\tthis.position.y + this.dimensions.y - 50\n\t\t);\n\t\tcontext.fillText(\n\t\t\t`EXP: ${this.pokemon.getExperienceMeter()}`,\n\t\t\tthis.position.x + this.dimensions.x - 30,\n\t\t\tthis.position.y + this.dimensions.y - 25\n\t\t);\n\t\tcontext.restore();\n\t}", "title": "" }, { "docid": "610df3176698ff5bc4ae0e1cbca65ce4", "score": "0.46673664", "text": "function Status(props) {\n let {guess, score, isFinished} = props;\n if (isFinished) {\n return (\n <p className=\"status\">You win!!! Guess: {guess}, Score: {score}</p>\n )\n } else {\n return (\n <p className=\"status\">Guess: {guess} </p>\n )\n }\n}", "title": "" }, { "docid": "e7de65566eae1d78326acb402c7b5d3f", "score": "0.4662593", "text": "function _render() {\n if (Object.getOwnPropertyNames(playerOne).length !== 0) {\n playerOneTag.innerHTML = `<h2> ${playerOne.name}</h2>`;\n playerTwoTag.innerHTML = `<h2> ${playerTwo.name}</h2>`;\n playerOneTag.classList.add('turn');\n\n } else {\n playerOneTag.innerHTML = `<h2>Player One</h2>`;\n playerTwoTag.innerHTML = `<h2>Player Two</h2>`;\n }\n\n }", "title": "" }, { "docid": "17a459a5350469e7a3aad572d8ff33da", "score": "0.4661699", "text": "printDescription() {\n console.log(`I am a rectangle of area ${this.getArea()}`);\n }", "title": "" }, { "docid": "b52a1b69f57e493165a93cfce0a06fff", "score": "0.46615183", "text": "function showDefinition (sid, folder, name, def, dontGet) {\n\t\tvar info = getCurrentServer(sid);\n\t\tif ( dontGet !== true && (!def || def === undefined || def === 'undefined' || def === '') ) {\n\t\t\t_nodeDomain.exec('get_definition', sid, info.database, folder, name).done(function(response) {\n var obj = response[1][0];\n\t\t\t\tshowDefinition(sid, folder, name, (obj.Definition||obj.definition), true);\n\t\t\t}).fail(function(err) {\n\t\t\t\tResultSets.log('get_definition error', err);\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif ( typeof def === 'string' ) {\n def = SQLTemplates.format(def);\n\t\t\t\n showSQLOnFile(def);\n\t\t}\n\t}", "title": "" }, { "docid": "82e220589aef3f7bd8243a5201a3a588", "score": "0.46606687", "text": "render() {\n return (\n // if the game is won, just show a winning msg & render nothing else\n // make table board\n <div>\n <h1 className=\"title\"> Lights Out </h1>\n <p className=\"direction\"> The goal of the game is to turn all the lights off. </p>\n <p className=\"direction\"> Clicking any of the lights will toggle it and any adjacent lights.</p>\n <table>\n <tbody>\n {(this.state.hasWon === true) ? <p>You Won</p> :\n this.state.board.map(\n (row, rIdx) => <tr key={rIdx}>{row.map(\n (col, cIdx) => <Cell isLit={col} key={cIdx} \n coords={rIdx + \"-\" + cIdx}\n flipCellsAroundMe={this.flipCellsAround} />\n )}</tr>)}\n </tbody>\n </table>\n </div>\n )\n }", "title": "" }, { "docid": "bc8d66db6f425ec72ef889ef0c0e102b", "score": "0.4657706", "text": "renderList() {\n for (let i = 0; i < this.games.length; i++) {\n this.renderSingleGame(i);\n }\n const summaryHouse = document.createElement('div');\n summaryHouse.setAttribute('id', 'summaryHouse');\n summaryHouse.innerHTML = `\n <div id=\"earnings-text\">Earnings:</div> <span id=\"earnings\"></span>\n `;\n const gameListNode = document.querySelector('#gameList');\n gameListNode.appendChild(summaryHouse);\n }", "title": "" }, { "docid": "527574d72580d76719d9ee0d73fc1729", "score": "0.4653453", "text": "function About() {\n return (\n <Container >\n <React.Fragment>\n <div style={aboutStyle} >\n <h3>About</h3>\n <p>This is version of the classic letter guessing game called Hangman. \n You are shown a set of blank letters that match a word or phrase and \n you have to guess what these letters are to reveal the hidden word. \n You guess by picking letters from those displayed on the sides. ... \n This is why the game is called 'Hangman'.\n </p>\n <br/>\n <p>To play the Game, you need to select letters of a hidden word. In this case an Animal. Tip is to start with the vowels.\n You are allowed 7 wrong guesses before you loose. Off course if you get the word right before the seven guesses are up, You Win!\n\n </p> \n </div>\n </React.Fragment>\n </Container>\n )\n}", "title": "" }, { "docid": "dae47ddee0fd8283e094066630e40f93", "score": "0.46526122", "text": "function draw() {\n background(0);\n\n if (state === `title`) {\n title();\n }\n else if (state === `simulation`) {\n simulation();\n }\n else if (state === `love`) {\n love();\n }\n else if (state === `sadness`) {\n sadness();\n }\n\n\n\n}", "title": "" }, { "docid": "6b69dba3eafd203e33f567eefd1511b3", "score": "0.46499467", "text": "getStatus() {\n switch (this.state.GameOver) {\n case -1:\n return \"Ready to Begin\";\n case 0:\n return \"In Game\";\n case 1:\n return \"You Lost\";\n case 2:\n return \"You win\";\n default:\n return \"UNKNOWN\"\n }\n }", "title": "" }, { "docid": "d4d405bc0b17a441ba12800a6c2aff0d", "score": "0.4648879", "text": "function chanceDefend(teamName, player) {\n apito.play()\n eventsArea.appendChild(oppDefTitle)\n colorGame(teamName, oppDefTitle)\n oppDefTitle.classList.add(\"h2EventTitle\")\n oppDefTitle.innerHTML = player + \" tem uma oportunidade de gol\";\n eventsArea.appendChild(oppDef)\n eventsArea.appendChild(explicationDef)\n explicationDef.classList.add(\"explication\")\n explicationDef.innerHTML = \"Escolha o lado para defender (clique <= / =>)\";\n}", "title": "" }, { "docid": "a9a586a2d13ee6fe9871ab0ea619fe67", "score": "0.46443975", "text": "setWordDefinitions (state, payload) {\n state.definitions.data = payload;\n }", "title": "" }, { "docid": "052cfe10b1234e890f21ce84acab079d", "score": "0.46413594", "text": "function scoreWord() {\n document.getElementById(CHOSEN_WORD).classList.add('marked-green');\n\n }", "title": "" } ]
1ae14a3b6548319a3abd4756c840a620
Hide all in visualisation_devis
[ { "docid": "30855470d50bd49830bbad57f7b0b8a2", "score": "0.0", "text": "function hide_all(){\n\t$(\"#info_travaux > \").hide();\n}", "title": "" } ]
[ { "docid": "2507aa56a26adc84c9046cc7ebe25286", "score": "0.7107572", "text": "function vizHide() {\n console.log(\"viz hiding\");\n viz.hide();\n}", "title": "" }, { "docid": "c007c927fb93d85e71a7c0ddcb36e230", "score": "0.6786134", "text": "function _unhideAll()\r\n{\r\n\t// remove all filters\r\n\t_vis.removeFilter(null);\r\n\t\r\n\t// reset array of already filtered elements\r\n\t_alreadyFiltered = new Array();\r\n\t\r\n\t// reset slider UI\r\n\t$(\"#weight_slider_field\").val(0.0);\r\n\t$(\"#weight_slider_bar\").slider(\"option\",\r\n\t\t\"value\", 0);\r\n\t\r\n\t// re-apply filtering based on edge types\r\n\tupdateEdges();\r\n\t\r\n\t// refresh & update genes tab \r\n\t_refreshGenesTab();\r\n\tupdateGenesTab();\r\n\r\n\t// no need to call _visChanged(), since it is already called by updateEdges\r\n\t//_visChanged();\r\n}", "title": "" }, { "docid": "5bc2365b6ba14c4117b0bef6ea32a143", "score": "0.67565036", "text": "function hideVideoElements() {\n webgazer.showPredictionPoints(false);\n webgazer.showVideo(false);\n webgazer.showFaceOverlay(false);\n webgazer.showFaceFeedbackBox(false);\n //webgazer.showGazeDot(false);\n }", "title": "" }, { "docid": "2b3731c929ec47d88d2cef8db85e7007", "score": "0.6728376", "text": "function hideFilter() {\n svg.selectAll('.teachersoverview_split').remove();\n }", "title": "" }, { "docid": "4777cd030ea8e188123c0f474d6a1d8a", "score": "0.6707233", "text": "hide_all() {\n this.isVisibleSpotify = false;\n this.isVisibleLyrics = false;\n this.isVisibleInfos = false;\n this.isVisibleConcert = false;\n this.isVisibleContact = false;\n this.isVisibleAPropos = false;\n }", "title": "" }, { "docid": "869e09a52ed4328e5b7ffc310b498add", "score": "0.670365", "text": "hideVectorsChartDiffContent() {\n this.vectorsChartDiffContents.shown = false;\n this.vectorsChartDiffContents.diffChartData = null;\n this.vectorsChartDiffContents.togetherChartData = null;\n }", "title": "" }, { "docid": "7f1252c3b467ec3bf1ce6a4aaddf42d7", "score": "0.6701702", "text": "function hideAll() {\n var listMols = biovizWidget.bioviz(\"getMoleculesFromStructure\", identifier).forEach(function(elem) {\n hideElem(elem);\n });\n }", "title": "" }, { "docid": "cc12f6d31b2cc17da81b755921c289a1", "score": "0.6525999", "text": "function hide(){ ctrl.debug.toggle(false), el.addClass('hidden'); }", "title": "" }, { "docid": "604abfb0d2a7ec2c94e785c41846c4f7", "score": "0.6501782", "text": "function actualHideCompactElements(){\n\t\t\n\t\tif(g_objButtonClose)\n\t\t\tg_objButtonClose.hide();\n\t\t\n\t\tif(g_objArrowLeft && g_temp.isArrowsInside == true){\n\t\t\tg_objArrowLeft.hide();\n\t\t\tg_objArrowRight.hide();\n\t\t}\n\t\t\n\t\tif(g_objNumbers)\n\t\t\tg_objNumbers.hide();\n\t\t\n\t\tif(g_objTextPanel)\n\t\t\tg_objTextPanel.hide();\n\t\t\n\t}", "title": "" }, { "docid": "df0b0ba253f7b6cbc808d61a31ea289f", "score": "0.64989376", "text": "function hideDisplayAllForSegOne()\n{\n changeDisplay(\"training_img_1\", \"none\");\n changeDisplay(\"training_img_4\", \"none\");\n changeDisplay(\"training_img_3\", \"none\");\n changeDisplay(\"seg_one_img_2\", \"none\");\n changeDisplay(\"seg_two_img_1\", \"none\");\n changeDisplay(\"seg_three_img_1\", \"none\");\n changeDisplay(\"seg_four_img_1\", \"none\");\n changeDisplay(\"segOneTitle\", \"none\");\n\n changeDisplay(\"seg_one_img_1\", \"block\");\n changeDisplay(\"segOne\", \"block\");\n changeDisplay(\"segTwo\", \"block\");\n changeDisplay(\"segThree\", \"block\");\n\n\n}", "title": "" }, { "docid": "ad9e7be85309b5e0f21adcca0da19348", "score": "0.64628094", "text": "function hideTemperatureOptions() {\n\t\tvar tempLowerBoundSliderF = clayConfig.getItemById('tempLowerBoundSliderF');\t\t\n\t\tvar tempUpperBoundSliderF = clayConfig.getItemById('tempUpperBoundSliderF');\t\t\n\t\tvar tempLowerBoundSliderC = clayConfig.getItemById('tempLowerBoundSliderC');\t\t\n\t\tvar tempUpperBoundSliderC = clayConfig.getItemById('tempUpperBoundSliderC');\t\t\n\n\t\tvar tempScaleRadio = clayConfig.getItemById('tempScaleRadio');\t\n\t\t\n\t\ttempLowerBoundSliderF.hide();\n\t\ttempUpperBoundSliderF.hide();\n\t\ttempLowerBoundSliderC.hide();\n\t\ttempUpperBoundSliderC.hide();\n\t\ttempScaleRadio.hide();\t\n\t}", "title": "" }, { "docid": "bd60c68c9b91771b25aedef730a2e3fd", "score": "0.6455711", "text": "function refreshVisibleVisualisations() {\n var viz = dcc.viz;\n if (viz.container.isVisible)\n viz.refresh();\n }", "title": "" }, { "docid": "3cd45ce40842e80888c3efe1cc04d315", "score": "0.6415341", "text": "function hideCheat(){\n\t\t\t$('.hidden').hide();\n\t\t}", "title": "" }, { "docid": "703e5afa2cdcaa7e2fbe791b3c62c4cc", "score": "0.6407034", "text": "function hideEle()\n{\n myIncidentRay1.visible=false;\n myIncidentRay1Arrow11.visible=false;\n myIncidentRay1Arrow12.visible=false;\n myIncidentRay2.visible=false;\n myIncidentRay2Arrow11.visible=false;\n myIncidentRay2Arrow12.visible=false;\n myIncidentRay3.visible=false;\n myIncidentRay3Arrow11.visible=false;\n myIncidentRay3Arrow12.visible=false;\n\n myRIncidentRay1.visible=false;\n myRIncidentRay2.visible=false;\n\n myReflectedRay1.visible=false;\n myReflectedRay1Arrow11.visible=false;\n myReflectedRay1Arrow12.visible=false;\n myReflectedRay2.visible=false;\n myReflectedRay2Arrow11.visible=false;\n myReflectedRay2Arrow12.visible=false;\n myReflectedRay3.visible=false;\n myReflectedRay3Arrow11.visible=false;\n myReflectedRay3Arrow12.visible=false;\n\n con=1;\n}", "title": "" }, { "docid": "c97b605fe751888b36b1a51b6df75c6d", "score": "0.64014214", "text": "setVisibility() {\n let notMarkedOpacity = 0.3;\n // set node visibility\n this.graph.nodes.forEach(node => {\n let opacity = (node.marked) ? 1.0 : notMarkedOpacity;\n let visibility = node.visible ? \"inherit\" : \"hidden\";\n let domNodeFrame = this.elementInfo.domNodeFrame(node);\n domNodeFrame.style.opacity = opacity;\n domNodeFrame.style.visibility = visibility;\n });\n\n // set relation visibility\n this.graph.relations.forEach((relation, i) => {\n let domPath = this.elementInfo.domPath(relation);\n domPath.style.visibility = relation.visible ? \"inherit\" : \"hidden\";\n domPath.style.opacity = (relation.source.marked === true && relation.target.marked === true) ? 1.0 : notMarkedOpacity;\n });\n }", "title": "" }, { "docid": "e7755de501c7b6003155ebe511fb660a", "score": "0.6380304", "text": "function hideCalculateOnlyFields() {\n\tvar s = document.getElementsByClassName('calc-only');\n for(var i=0;i<s.length;i++) {\n s[i].setAttribute('hidden',true);\n }\n}", "title": "" }, { "docid": "7a0f6f61cb7813bfb9cc7ffa4053fa4c", "score": "0.63761216", "text": "function hideVisuals() {\n for (var i = 0; i < meshArrs.length; i++) {\n if (i !== keypress - 1) {\n for (var j = 0; j < meshArrs[i].length; j++) {\n meshArrs[i][j].visible = false;\n }\n }\n }\n}", "title": "" }, { "docid": "993b8a7efc1ad0da3466ad7a3124bbab", "score": "0.6364807", "text": "function hideElements() {\n hideButtons();\n hideCanvas();\n hideSlider();\n hideText();\n}", "title": "" }, { "docid": "88e3e47bfa7d8312308c25e2d5f0db9a", "score": "0.63637275", "text": "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $filteredArticles,\n $ownStories,\n $loginForm,\n $createAccountForm\n ];\n elementsArr.forEach(val => val.hide());\n }", "title": "" }, { "docid": "5e4daac1533d5c29c03c708f1fd665a8", "score": "0.63385135", "text": "function rockthemes_display_not_visible_elements(){\n\tif(typeof rockthemes.visibility_hidden_elements\t== 'undefined' || !rockthemes.visibility_hidden_elements) return;\n\t\n\tvar els = rockthemes.visibility_hidden_elements;\n\tfor(var i=0;i<els.length;i++){\n\t\tels[i].css({'visibility':'visible'});\n\t\tif(els[i].hasClass('not-visible')){\n\t\t\tels[i].removeClass('not-visible');\t\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e9b5b0669a23c2eb6920a6ba900b7342", "score": "0.6336469", "text": "showhidemeshes() {\n\n for (var st=0;st<this.internal.mesh.length;st++) {\n\n var doshow=this.internal.meshcustomvisible[st];\n if (this.internal.data.showmode === \"All\" ) {\n doshow=true;\n } else if (this.internal.data.showmode === \"None\" ) {\n doshow=false;\n } else if (this.internal.data.showmode === \"Current\") {\n if (st===this.internal.currentsetindex)\n doshow=true;\n else\n doshow=false;\n }\n \n this.internal.meshvisible[st]=doshow;\n \n if (this.internal.mesh[st]!==null) {\n for (var si=0;si<this.internal.mesh[st].length;si++) {\n if (this.internal.mesh[st][si]!==null) {\n this.internal.mesh[st][si].visible=doshow;\n }\n }\n }\n }\n \n if (this.internal.meshvisible[this.internal.currentsetindex]===false) {\n this.enablemouse(false);\n }\n \n }", "title": "" }, { "docid": "c89e0982bb2791c95f17e1351d8f1cc4", "score": "0.6296769", "text": "function hide() {\n\t\tthis.classList.remove(\"show\");\n\t\tlet cards = document.querySelectorAll(\".development > div\");\n\t\tfor (let i = 0; i < cards.length; i++) {\n\t\t\tcards[i].style.display = \"block\";\n\t\t}\n\t}", "title": "" }, { "docid": "031a3a4e2b0b3f685c570a71fcfe71d5", "score": "0.62732226", "text": "exclude() {\n this.setVisibility(\"excluded\");\n }", "title": "" }, { "docid": "cd845c7cc8e35a2141c93db767425163", "score": "0.62681764", "text": "function hideAllDescriptions() {\n\n for (var i = 0; i < totalDesc; i++) {\n // Prepare single description\n var description = descriptions[i];\n // Hide each description\n description.setAttribute('data-state', 'hidden');\n }\n}", "title": "" }, { "docid": "d56b767ab4a99e6aab782cd3d6429f43", "score": "0.6252225", "text": "function hideAllPoints(){\n for(var i =0; i < earthquakes.length; i++){\n earthquakes[i].primitivePoint.show = false;\n }\n}", "title": "" }, { "docid": "74132db91eb55a0002aab64e95261023", "score": "0.6248291", "text": "function hideAll() {\n $subcategoryPnls.each(function () {\n $(this).hide();\n });\n }", "title": "" }, { "docid": "30d55c82b938d8469e638473759580eb", "score": "0.6216882", "text": "function _hideSelected()\r\n{\r\n\t// update selected elements map\r\n\t_selectedElements = _selectedElementsMap(\"all\");\r\n\t\r\n\t// filter out selected elements\r\n _vis.filter('all', selectionVisibility);\r\n \r\n // also, filter disconnected nodes if necessary\r\n _filterDisconnected();\r\n \r\n // refresh genes tab\r\n _refreshGenesTab();\r\n \r\n // visualization changed, perform layout if necessary\r\n\t_visChanged();\r\n}", "title": "" }, { "docid": "a2a918aa3116c84c8ea8944ff68f837f", "score": "0.6213612", "text": "function hidePrevMode() {\n if (currentMode == mode.ANALYTICS) {\n for (var i=0; i<expenseSummaryContainers.length; i++) {\n expenseSummaryContainers[i].style.display = 'none';\n }\n for (var i=0; i<chartSummaryContainers.length; i++) {\n chartSummaryContainers[i].style.display = 'block';\n }\n }\n else {\n for (var i=0; i<expenseSummaryContainers.length; i++) {\n expenseSummaryContainers[i].style.display = 'block';\n }\n for (var i=0; i<chartSummaryContainers.length; i++) {\n chartSummaryContainers[i].style.display = 'none';\n }\n }\n}", "title": "" }, { "docid": "9b5a11ea8e93731ad90f7b31a78be6e1", "score": "0.61987096", "text": "hide () {\n const calendar = this,\n container = calendar.graphic.container;\n container.style.visibility = 'hidden';\n container.style.opacity = '0';\n }", "title": "" }, { "docid": "3a39fef4c9f7fd50dd80d7daaff06da3", "score": "0.6176926", "text": "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $filteredArticles,\n $ownStories,\n $loginForm,\n $createAccountForm,\n $userProfile,\n $favoritedArticles\n ];\n elementsArr.forEach($elem => $elem.hide());\n }", "title": "" }, { "docid": "4171f1d5890441e381e84d574e9ee65d", "score": "0.6176185", "text": "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $filteredArticles,\n $favoriteStories,\n $ownStories,\n $loginForm,\n $createAccountForm,\n $userProfile\n ];\n elementsArr.forEach($elem => $elem.hide());\n }", "title": "" }, { "docid": "5aab4b3b50dedb2e063ee0a4a69431a3", "score": "0.6169633", "text": "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $filteredArticles,\n $ownStories,\n $favoritedStories,\n $loginForm,\n $createAccountForm,\n $userProfile,\n ];\n elementsArr.forEach($elem => $elem.hide());\n }", "title": "" }, { "docid": "3b506a11adb7e534ffca67f54ffc4f20", "score": "0.6157491", "text": "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $filteredArticles,\n $ownStories,\n $loginForm,\n $createAccountForm\n ];\n elementsArr.forEach($elem => $elem.hide());\n }", "title": "" }, { "docid": "9e62ad5c513126339558aea59923e75c", "score": "0.6156187", "text": "hide() {\n this.toolbarContainer.style('left', '-65px');\n this.hideToolbarIcon.style('transform', 'rotate(-180deg)');\n d3.select('#d3_content_div').style('margin-left', '-65px');\n this.hidden = true;\n }", "title": "" }, { "docid": "3bc919d4b9559df47226143d3d06bf38", "score": "0.61519575", "text": "function makeHide() {\n $(\".cen\").val(\"\");\n // hideChart();\n // $(\".animation\").css(\"visibility\",\"hidden\");\n }", "title": "" }, { "docid": "7d3f9f7d64077a0c868941516a33d77a", "score": "0.61491376", "text": "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $filteredArticles,\n $ownStories,\n $loginForm,\n $createAccountForm,\n $userProfile,\n $favoritedStories,\n $userProfile,\n ];\n elementsArr.forEach(($elem) => $elem.hide());\n }", "title": "" }, { "docid": "f3b90d8e2ef73e58f25cfe3796443c48", "score": "0.6142504", "text": "function hideAllGameViews() {\n hideBlock(\"sideStatus\");\n hideBlock(boardView.wrapper.id);\n}", "title": "" }, { "docid": "e6666381343a3ca77308ac8738e94a21", "score": "0.614083", "text": "function tShirtDesignNarrowed() {\n if(tShirtDesign.selectedIndex !== 0){\n document.getElementById('colors-js-puns').removeAttribute('hidden');\n if(tShirtDesign.selectedIndex === 1){\n resetAndHide(3,5,tShirtColor,0);\n } else if(tShirtDesign.selectedIndex === 2){\n resetAndHide(0,2,tShirtColor,3);\n }\n }else{\n resetAndHide(0,5,tShirtColor,6);\n document.getElementById('colors-js-puns').setAttribute('hidden','hidden');\n }\n}", "title": "" }, { "docid": "39ae36425d56191bf1b4dee5e02d5571", "score": "0.6136204", "text": "function ShowValuesToFalse(){\n SetShowValues(false);\n }", "title": "" }, { "docid": "0a358625f0d9d5742bbf36cb300053f7", "score": "0.6135343", "text": "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $filteredArticles,\n $ownStories,\n $loginForm,\n $createAccountForm,\n ];\n elementsArr.forEach(($elem) => $elem.hide());\n }", "title": "" }, { "docid": "cfb04d595cdf0219a84bfa9e4e80b3d4", "score": "0.613481", "text": "hide() {\n toggleHiddenAttribute(\n Services.vsyncFor(this.win_),\n dev().assertElement(this.root_),\n /* isHidden */ true\n );\n }", "title": "" }, { "docid": "68b9edf6eaaebe84e22e3664c28b172b", "score": "0.6125858", "text": "function hideAllElt() {\n $(\"#header_info\").hide();\n var elems = selectAll('.aside');\n for(let el of elems){\n el.hide();\n }\n for(let el of html_elements) {\n el.hide();\n }\n for(let act of preparation_editor.actors_timeline) {\n act.elem.hide();\n }\n preparation_editor.hideElts();\n cadrage_editor.hideElts();\n montage_editor.hideElts();\n annotation_editor.hideElts();\n export_editor.hideElts();\n for(let el of selectAll('.tabs')) {\n el.hide();\n }\n}", "title": "" }, { "docid": "452333df28110840e344b2effc3ff3a3", "score": "0.61228454", "text": "hide(flag) {\n if ( this.canMinimize ) {\n this.group.getChildMeshes().forEach( h => {\n if ( h !== this.box && !this.dontMinimize.includes(h)) {\n h.setEnabled(!flag);\n }\n });\n this.minimized = flag;\n if ( this.minimized ) {\n this.box.material.diffuseTexture = new BABYLON.Texture(\"/content/icons/maximize.png\", this.scene);\n } else {\n this.box.material.diffuseTexture = new BABYLON.Texture(\"/content/icons/minimize.png\", this.scene);\n }\n }\n }", "title": "" }, { "docid": "bfd2a87cbbf6dcb4153eb64779ad8ffd", "score": "0.611997", "text": "function hide() {\n this.visible = !this.visible;\n }", "title": "" }, { "docid": "e32a8a5e380e8f25c237b1ae4077bf83", "score": "0.61096364", "text": "clearShow() {\n const dimension = this.getDimension();\n const show = utils.deepClone(this.show);\n delete show[dimension];\n this.show = show;\n }", "title": "" }, { "docid": "738af6ac12ab36f285dbea29d6aa94b2", "score": "0.61028904", "text": "function hideAll() {\n $phasePnls.each(function () {\n $(this).hide();\n });\n }", "title": "" }, { "docid": "9af6d2dc6333b14d86f2eb799a8f6d5d", "score": "0.6086533", "text": "function hideAllFields()\n{\n\tvisibilityOff( document.getElementById( 'appTagAddition' ) );\n\tvisibilityOff( document.getElementById( 'projTagAddition' ) );\n\tvisibilityOff( document.getElementById( 'appTagRemoval' ) );\n\tvisibilityOff( document.getElementById( 'projTagRemoval' ) );\n}", "title": "" }, { "docid": "1b9fb593113eaef57f20408e8b8c8692", "score": "0.6057029", "text": "function hideUndisplayPipes() {\n s = displayPipes.length;\n pipes = displayPipes.filter(function (item) {\n return item.x + item.w >= 0;\n });\n}", "title": "" }, { "docid": "6d4a34cc7fbd885c1904821b3edd8c1f", "score": "0.6056453", "text": "function hideSettings() {\n\t\t \tvm.showSettings = false;\n\t\t }", "title": "" }, { "docid": "078d4ec39c21293861a7daf3fe974739", "score": "0.60540134", "text": "get Hidden() {}", "title": "" }, { "docid": "9389d3a6e21b76c827230ad4cf420a16", "score": "0.60522467", "text": "function showHidden() {\n var disabled = $(\".disabled\");\n\n for(var i = 0; i < disabled.length; i++) {\n localStorage.removeItem(disabled[i].id);\n }\n $(\".disabled\").toggleClass(\"disabled\");\n $('#show-hidden').html('Unhide All Removed Legends (' + $('.disabled').length + ')');\n}", "title": "" }, { "docid": "6db27c6ab7792bf30321d59e9f6b8fba", "score": "0.6049321", "text": "function hide_arr_of_canvas(arr) {\n arr.map(arr => {return arr.vis='hidden', arr.update_style()})\n}", "title": "" }, { "docid": "e91eab07900f1beca0be106db190f263", "score": "0.6048091", "text": "function setShowNoStats() {\n setStatsShown(false);\n}", "title": "" }, { "docid": "111406cbd01c471bf3abf744e833f3ae", "score": "0.60462296", "text": "function hideAll() {\n $('#built-in-content').hide();\n $('#create-form-panel').hide();\n $('#log-in-panel').hide();\n $('#recommendation').hide();\n $('#change-profile-form').hide();\n $('#admin-panel').hide();\n }", "title": "" }, { "docid": "e5a06775bdc58e5f726d7047690ba5f3", "score": "0.60416365", "text": "discardFilter() {\n let selection = document.querySelectorAll(this.node.dataset.filterTarget);\n [...selection].forEach(node => {\n if(!BEM.hasModifier(this.node, MODIFIER_CLASS_ONLY)) {\n node.style.removeProperty('display');\n }\n BEM.removeModifier(node, MODIFIER_NO_MATCH);\n BEM.addModifier(node, MODIFIER_MATCH);\n });\n }", "title": "" }, { "docid": "efa1789689313e52edbbf31a4b3da0da", "score": "0.6039886", "text": "function privateStopVisualization(){\n\t\tif( config.visualization_started && Object.keys(config.visualizations).length > 0){\n\t\t\tconfig.current_visualization.stopVisualization();\n\t\t\tconfig.visualization_started = false;\n\t\t}\n\t}", "title": "" }, { "docid": "b936c2a514631a3e7fa236f23047ac9f", "score": "0.6039361", "text": "function hideAll() {\r\n var hideDivs = document.getElementById(\"explainCode\");\r\n hideDivs.style.visibility = \"hidden\";\r\n\r\n var showDefault = document.getElementById(\"explainDefault\");\r\n showDefault.style.visibility = \"visible\";\r\n}", "title": "" }, { "docid": "7179d3744b8b3b732cbfb660d6cc0fea", "score": "0.60293615", "text": "function di_setHideShowUI(uid)\n{\n\tvar chartObj = di_getChartObject(uid);\n\tdi_setChartBorderChkbox(uid,chartObj);\n//\tdi_setGridlineChkbox(uid,chartObj);\t\n\tdi_setLegendChkbox(uid,chartObj);\n\tdi_setLegendBorderChkbox(uid,chartObj);\n}", "title": "" }, { "docid": "252cc03757f00c1e36c1a3b73fd2e29d", "score": "0.60181594", "text": "function hideAll() {\n $rewardPnls.each(function () {\n $(this).hide();\n });\n }", "title": "" }, { "docid": "444e3c8c1abdf9bac05ada3e86bcf92d", "score": "0.60164845", "text": "function setEarthAxesVisibility(value) {\n earth_axes_helper.visible = value;\n}", "title": "" }, { "docid": "33f97e9cecaf68dbc6502fec067ccbc0", "score": "0.6015411", "text": "hideInsufficientData() {\n for (var t of this.hsTimes) {\n let btn = document.querySelector('#tableWindow .content-header #timeFolder #'+t)\n if (this.data[this.f][t]['ranks_all'].totGames < this.minGames) { btn.style.display = 'none' }\n else { btn.style.display = 'block' }\n }\n }", "title": "" }, { "docid": "c34116d8b25eaf304a8693b814e3a12b", "score": "0.60123855", "text": "hide() {\n if (this.displayed) {\n const dom = this.dom;\n\n if (dom.box.remove) dom.box.remove();\n else if (dom.box.parentNode) dom.box.parentNode.removeChild(dom.box); // IE11\n\n if (dom.line.remove) dom.line.remove();\n else if (dom.line.parentNode) dom.line.parentNode.removeChild(dom.line); // IE11\n \n if (dom.dot.remove) dom.dot.remove();\n else if (dom.dot.parentNode) dom.dot.parentNode.removeChild(dom.dot); // IE11\n\n this.displayed = false;\n }\n }", "title": "" }, { "docid": "88ad4c90f1c1987f9f9e564156ef8d4c", "score": "0.6011011", "text": "hideFilterBar() {\n const\n me = this,\n columns = me.grid.columns;\n\n // we don't want to hear back store \"filter\" event while we're resetting store filters\n me.clearStoreFiltersOnHide && me.suspendStoreTracking();\n\n // hide the fields, each silently - no updating of the store's filtered state until the end\n columns && columns.forEach(col => me.hideColumnFilterField(col, true));\n\n // Now update the filtered state\n me.grid.store.filter();\n\n me.clearStoreFiltersOnHide && me.resumeStoreTracking();\n\n me.hidden = true;\n }", "title": "" }, { "docid": "9cfc0117bc1d27f4cdba2062c077114d", "score": "0.6010705", "text": "function hideALL() {\n sunrise.style.display = \"none\";\n noon.style.display = \"none\";\n sunset.style.display = \"none\";\n night.style.display = \"none\";\n}", "title": "" }, { "docid": "19a9373009d5221deacbd578675e47f2", "score": "0.600189", "text": "hideVectorsCopyableContents() {\n this.vectorsCopyableContents.shown = false;\n this.vectorsCopyableContents.firstContents = null;\n this.vectorsCopyableContents.secondContents = null;\n }", "title": "" }, { "docid": "97bbbbd2a5e5bb7051ea5322694b44eb", "score": "0.59985393", "text": "function hideAllInfoPanel() {\n // Chiudo tutti i pannelli utente aperti\n $('#userinfopanel, #userlicensepanel, #uservehiclepanel, #userwantedpanel').hide().attr('hidden', true);\n}", "title": "" }, { "docid": "5518c8f6cd294bce2216e7072f8e7dec", "score": "0.5990076", "text": "_unmarkInvisibleEls() {\n let all = Array.from(this.el.getElementsByTagName(\"[style-pirate-hidden=1]\"));\n all.forEach(el => el.removeAttribute('style-pirate-hidden'));\n }", "title": "" }, { "docid": "5db3a7c98f3dee39067dc7d9c77e22f9", "score": "0.59836686", "text": "function hiddenNotGoodTraining(arrayAllTraining, trainingToDisplay) {\n let arrayAllTrainingLength = arrayAllTraining.length;\n for (let i = 0; i < arrayAllTrainingLength; i++) {\n if (arrayAllTraining[i].classList.contains(trainingToDisplay)) {\n arrayAllTraining[i].classList.remove(\"hidden\");\n } else {\n arrayAllTraining[i].classList.add(\"hidden\");\n }\n }\n }", "title": "" }, { "docid": "a5eb745cd1b8b3238b97a48baf5aed21", "score": "0.59719425", "text": "hideWorkspaceFilter() {\n this.displayWorkspaceFilter = false;\n }", "title": "" }, { "docid": "715f608dc790fc6cd9124c366d9ab8b7", "score": "0.5971767", "text": "function hideAll() {\n $(\"#form-group-rhetoric\").hide();\n $(\"#form-group-comment\").hide();\n $(\"#form-group-year\").hide();\n $(\"#form-group-author\").hide();\n $(\"#form-group-title\").hide();\n $(\"#form-group-url\").hide();\n $(\"#form-group-cites\").hide();\n $(\"#form-group-doi\").hide();\n }", "title": "" }, { "docid": "715f608dc790fc6cd9124c366d9ab8b7", "score": "0.5971767", "text": "function hideAll() {\n $(\"#form-group-rhetoric\").hide();\n $(\"#form-group-comment\").hide();\n $(\"#form-group-year\").hide();\n $(\"#form-group-author\").hide();\n $(\"#form-group-title\").hide();\n $(\"#form-group-url\").hide();\n $(\"#form-group-cites\").hide();\n $(\"#form-group-doi\").hide();\n }", "title": "" }, { "docid": "745187b1d98ae76ed077d5c180991a96", "score": "0.59716713", "text": "static hide(obj) {\n obj.setAttribute('visibility','hidden');\n }", "title": "" }, { "docid": "f9ce7bd2dc1d6756c2bb41f3cb696d9e", "score": "0.5971147", "text": "hide() {\n this.list.forEach((t) => {\n t.style.visibility = \"hidden\";\n });\n }", "title": "" }, { "docid": "5951861d0451a0477a0608e744477831", "score": "0.5968991", "text": "hideAll(elements) {\n elements.hide();\n }", "title": "" }, { "docid": "d30a2c9e83124496c3b858b2d28421a8", "score": "0.59659433", "text": "hideScreens_() {\n for (let id of this.screens_) {\n var screen = this.$[id];\n assert(screen);\n screen.hidden = true;\n }\n }", "title": "" }, { "docid": "95da8a0f279e1211f01b2453d8036b84", "score": "0.5962034", "text": "function movingGraphHidden(x){\n\t\tx.style.display = \"none\";\n}", "title": "" }, { "docid": "aa3ae4ca8fe16e49f9ed1da3549088c1", "score": "0.5958405", "text": "function hideShowSerie(idSerie, state, viewObject) {\n viewObject.disableid(idSerie, state);\n }", "title": "" }, { "docid": "8550137d6e12d514ed8bbc61f0125920", "score": "0.59538746", "text": "function hide_specified_facets(){\n $j(\".specified_facets\").hide();\n}", "title": "" }, { "docid": "f854744c6518406e170dbb5ba11de4bd", "score": "0.59523463", "text": "hide() {\n this.shadowRoot.getElementById(calculateSpecatorModeIconId()).classList.add('hidden');\n }", "title": "" }, { "docid": "f0ea1cd3d92e84889c16b22041a0b353", "score": "0.59465843", "text": "function hideAllColours(){\n for(let i=0; i<colorsAvailable.length;i++){\n colorsAvailable.item(i).style.display = \"none\";\n } \n}", "title": "" }, { "docid": "2a8f5d21667a02aeebc9207dad3cbf9a", "score": "0.59437644", "text": "function hideGraph(scope){\n\tdocument.getElementById(\"graphDiv\").style.display = scope.hide_graph ? \"none\" : \"block\";\n}", "title": "" }, { "docid": "b2ee523acdbc1984d7dc57b142c75a29", "score": "0.5937723", "text": "function hide() {\n let x = document.getElementById(\"drop-area\");\n x.style.visibility === \"hidden\";\n}", "title": "" }, { "docid": "af18e95d477d8ff46bea5de269b87cd8", "score": "0.59373957", "text": "get hideDisplay() {\n return (\n this.hideBordered &&\n this.hideCondensed &&\n this.hideStriped &&\n this.hideNumericStyles &&\n this.hideResponsive\n );\n }", "title": "" }, { "docid": "ce92e5c8b9f6c2564ff40435833421e3", "score": "0.5933521", "text": "function hideAllGameSections() {\n gameElements.forEach((item) => {\n item.par.style.display = \"none\";\n })\n}", "title": "" }, { "docid": "168114fd8dcae19a3796313c448dfef8", "score": "0.59303486", "text": "function hideAll() {\n $teamMemberPnls.each(function () {\n $(this).hide();\n });\n }", "title": "" }, { "docid": "85c9a096846f134b75b87d1d91ef5413", "score": "0.5930322", "text": "function visible(dimension) {return !('visible' in dimension) || dimension.visible;}", "title": "" }, { "docid": "23fc740b5899eaf015d78addf53811e7", "score": "0.59293485", "text": "function removeHiddenEdges() {\n removedEdges = cy.edges(':hidden').remove()\n}", "title": "" }, { "docid": "7c2883326694500f88fe74dc837804af", "score": "0.5923802", "text": "function closet(){\n document.getElementById(\"principle\").hidden = true;\n document.getElementById(\"office\").hidden = true;\n document.getElementById(\"dow\").hidden = true;\n document.getElementById(\"closet\").hidden = true;\n document.getElementById(\"windowText\").hidden = true;\n document.getElementById(\"closetText\").hidden = false;\n document.getElementById(\"closetText2\").hidden = false;\n document.getElementById(\"n\").hidden = false;\n document.getElementById(\"y\").hidden = false;\n}", "title": "" }, { "docid": "cb4035ff3a430df52642a860de100466", "score": "0.5911383", "text": "hideHeaderFilterElements(){\n\t\tthis.headerFilterColumns.forEach(function(column){\n\t\t\tif(column.modules.filter && column.modules.filter.headerElement){\n\t\t\t\tcolumn.modules.filter.headerElement.style.display = 'none';\n\t\t\t}\n\t\t});\n\t}", "title": "" }, { "docid": "4fc2c44648cf4a24347be93aa1790c22", "score": "0.5910174", "text": "function hideAxis() {\n g.select('.x.axis')\n .transition().duration(500)\n .style('opacity', 0);\n }", "title": "" }, { "docid": "c990a1fdbb6236febe906c0e4498bc45", "score": "0.5907048", "text": "hide() {\n\t\tthis.is_show = false;\n\t}", "title": "" }, { "docid": "6c9e29ac06ebd7cfd8e666596664468c", "score": "0.59009254", "text": "function hideAllClasses() {\n $('.grid-filters').hide();\n}", "title": "" }, { "docid": "7554f3c802d5f41f582d9aae9fcb3dd9", "score": "0.58847886", "text": "function filterNonSelected()\r\n{\r\n\t// update selected elements map\r\n\t_selectedElements = _selectedElementsMap(\"nodes\");\r\n\r\n\t// filter out non-selected elements\r\n _vis.filter('nodes', geneVisibility);\r\n \r\n // also, filter disconnected nodes if necessary\r\n _filterDisconnected();\r\n \r\n // refresh Genes tab\r\n _refreshGenesTab();\r\n updateGenesTab();\r\n \r\n // visualization changed, perform layout if necessary\r\n\t_visChanged();\r\n}", "title": "" }, { "docid": "05095008e17ff17d0e9ed35a245afd36", "score": "0.58733153", "text": "function hideCrossView() {\n black_body_stage.getChildByName(\"crossSectional\").visible = false; /** Cross sectional view visibility false */\n black_body_stage.getChildByName(\"waterAnimation\").visible = false; /** Water animation visibility false */\n createjs.Ticker.removeEventListener(\"tick\", startAnimation); /** Remove the animation event */\n}", "title": "" }, { "docid": "a1e97009a8c68ae240c9fc22ed170889", "score": "0.58700776", "text": "function hideAll(){\n\t\t\t//text\n\t\t\t$(\"#warning\").hide();\t\t\n\t\t\t$(\"#tsk1\").hide();\t\t\n\t\t\t$(\"#tsk2\").hide();\n\t\t\t$(\"#tsk3\").hide();\n\t\t\t$(\"#indicator\").hide();\t\n\t\t\t$(\"#miniBkInstruction\").hide();\n\t\t\t$(\"#stimulus\").hide();\t\n\t\t\t$(\"#runFeedback\").hide();\n\t\t\t\n\t\t\t\n\t\t\t//action buttons\n\t\t\t$(\"#endTaskButton\").hide();\n\t\t\t$(\"#nextBlockButton\").hide();\n\t\t\t$(\"#startExpButton\").hide();\n\t\t\t$(\"#demographicDone\").hide();\n\t\t\t\n\t\t\t// other form stuff\t\t\t\n\t\t\t$(\"EgnerServer_form\").hide();\n\t\t\t$(\"#submitButton\").hide();\t\t\n\t\t\t// demographic information\n\t\t\t$(\"#age\").hide();\t\n\t\t\t$(\"#gender\").hide();\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t$(\"#ethnicity\").hide();\t\t\t\n\t\t\t$(\"#race\").hide();\t\t\t\n\t\t\t$(\"#demo1\").hide();\t\n\t\t\t$(\"#demo2\").hide();\t\n\t\t\t$(\"#demo3\").hide();\t\n\t\t\t$(\"#demo4\").hide();\t\t\t\t\n\n\t\t}", "title": "" }, { "docid": "75c61f7db3c2338886f64f0aa3778882", "score": "0.58683985", "text": "hide() {\n this.dataLangElems.forEach(el => {\n el.style = '';\n });\n }", "title": "" }, { "docid": "7f62fa826aeb010c52ba086dbdace766", "score": "0.5860031", "text": "function hideAllWS() {\n \n $(\".hiddenWS\").hide();\n \n}", "title": "" }, { "docid": "627d3d89aea3a0bfe432eea0312b5765", "score": "0.5854776", "text": "function hideMorphology() {\n\t\tmorphDisplay.style.display = 'none';\n\t}", "title": "" }, { "docid": "3c00e488f39dc85769bf7e874082c61b", "score": "0.5845974", "text": "_hideElements(){\n //jQuery('.product-name').css(\"visibility\", \"hidden\");\n //jQuery('.price-info').css(\"visibility\", \"hidden\");\n //jQuery('span.price').first\n //jQuery('.extra-info').css(\"visibility\", \"hidden\");\n \n //jQuery('.product-options.last').css(\"visibility\",\"hidden\");\n jQuery('#aitoption_wrapper_1050').css('visibility','hidden');\n jQuery('#aitoption_wrapper_1051').css('visibility','hidden');\n jQuery('.add-to-cart-buttons button').css('visibility','hidden');\n jQuery('dl.last').css('visibility','hidden');\n\n //jQuery('.product-options-bottom').css(\"visibility\", \"hidden\");\n //jQuery('.product-collateral').css(\"visibility\", \"hidden\");\n //jQuery('.footer').prop(\"display\", \"inline-block\");\n //jQuery('.product-options').css('visibility','hidden');\n \n }", "title": "" }, { "docid": "ac1bb18b48317f8e10ef89e90d60e5c2", "score": "0.58433855", "text": "disableCoordinates() {\n let lines = document.getElementsByClassName('graph-dot-coordinates');\n for (let i = 0; i < lines.length; i++) {\n lines[i].style.display = 'none';\n }\n }", "title": "" }, { "docid": "bf3ecf60d77dece529545f32ea3427b5", "score": "0.58331066", "text": "function hideFilters(){\r\n\t\tMenuBar1.clearMenus($('bp_categories'));\r\n\t}", "title": "" } ]
1dfaaaf9c173f1e05ba0ad33202447c7
This function extracts the fixation from all the users that remained after the filtering from the selected csv(from the dropdown menu) and puts them in a new array, which shall then be given to the clustering or visualizationmethod.
[ { "docid": "8c10cddf206cef9c4a776d756cc4cf5b", "score": "0.0", "text": "function createGazeArray(data, timeInterval) {\n gazeArray = [];\n //This array also has a duration column.\n xyDurationArray = [];\n var dataLength = data.length;\n for (i = 0; i < dataLength; i++) {\n currentGazeEntry = data[i];\n if (parseInt(currentGazeEntry.timestamp) >= timeInterval.start &&\n parseInt(currentGazeEntry.timestamp) <= timeInterval.end &&\n parseInt(currentGazeEntry.duration) > 0) {\n gazeArray.push([parseInt(currentGazeEntry.x), parseInt(currentGazeEntry.y)]);\n xyDurationArray.push([parseInt(currentGazeEntry.x), parseInt(currentGazeEntry.y), parseInt(currentGazeEntry.duration), parseInt(currentGazeEntry.user_id), parseInt(currentGazeEntry.timestamp)]);\n }\n }\n}", "title": "" } ]
[ { "docid": "0001f16011be51631bfa46d969509b14", "score": "0.5948592", "text": "filerData(val) {\n if (val) {\n val = val.toLowerCase();\n }\n else {\n console.log(\"xxxxxxx\", this.filteredUser);\n return this.filteredUser = [...this.userData];\n }\n const columns = Object.keys(this.userData[0]);\n if (!columns.length) {\n return;\n }\n const rows = this.userData.filter(function (d) {\n for (let i = 0; i <= columns.length; i++) {\n const column = columns[i];\n // console.log(d[column]);\n if (d[column] && d[column].toString().toLowerCase().indexOf(val) > -1) {\n return true;\n }\n }\n });\n this.filteredUser = rows;\n }", "title": "" }, { "docid": "0001f16011be51631bfa46d969509b14", "score": "0.5948592", "text": "filerData(val) {\n if (val) {\n val = val.toLowerCase();\n }\n else {\n console.log(\"xxxxxxx\", this.filteredUser);\n return this.filteredUser = [...this.userData];\n }\n const columns = Object.keys(this.userData[0]);\n if (!columns.length) {\n return;\n }\n const rows = this.userData.filter(function (d) {\n for (let i = 0; i <= columns.length; i++) {\n const column = columns[i];\n // console.log(d[column]);\n if (d[column] && d[column].toString().toLowerCase().indexOf(val) > -1) {\n return true;\n }\n }\n });\n this.filteredUser = rows;\n }", "title": "" }, { "docid": "42e33a2d7697b5a5ce647f2fe860d9be", "score": "0.56809616", "text": "function filterUsers(usersToFilter) {\n\n var selectedValue = employeeTypeDropdown.val();\n var filteredUsers = []\n\n usersToFilter.forEach(function (user) {\n\n // TODO: Question 8 - You will need to use the value retrieved from the\n // the dropdown and compare its value to determine if it matches the\n // the user's job.\n\n // Here we only push users that meet our criteria\n if (selectedValue === \"All\"){\n filteredUsers.push(user)\n }else if (selectedValue === \"Interns\"){\n filteredUsers.push(user)\n\n }\n\n })\n\n return filteredUsers;\n }", "title": "" }, { "docid": "11a3f751e8e698ed4a5366cb57df2310", "score": "0.5658082", "text": "function arrID(){\n if(filteredArr[i][1]=== userName){ //checks if the object in the array of arrays is the user name.\n userIDArray.push(filteredArr[i][0]); //if it is it pushes it to a new array\n }\n i++;\n\n }", "title": "" }, { "docid": "5db0a3ffbead1a1691e8978b2cff71e7", "score": "0.55110115", "text": "function filterMembers(members) {\n console.log(\"filterMembers\")\n\n let array = [];\n //console.log(democratParty);\n for (let i = 0; i < members.length; i++) {\n if (membersSeniority.value == members[i].seniority || membersSeniority.value == 'all') {\n if (membersState.value == members[i].state || membersState.value == 'all') {\n if (members[i].party === \"D\" && democratParty.checked) {\n array.push(members[i]);\n } else if (members[i].party === \"R\" && republicanParty.checked) {\n array.push(members[i]);\n } else if (members[i].party === \"I\" && independentParty.checked) {\n array.push(members[i]);\n } else if (democratParty.checked === false && republicanParty.checked === false && independentParty.checked === false) {\n document.getElementById(\"filterOut\").style.display = \"block\";\n document.getElementById(\"filterOut\").style.color = \"green\";\n document.getElementById(\"filterOut\").style.textAlign = \"center\";\n document.getElementById(\"filterOut\").style.fontSize = \"20px\";\n }\n }\n }\n }\n\n //console.log(array);\n return array;\n}", "title": "" }, { "docid": "e42972d4891b6ee2c84b412f86e5b749", "score": "0.5508665", "text": "function getSemester(fullinfo, userData){\n var newfiltered = [\"\"]; //This is to ensure that each semester is divided, not sure how it works but it does\n var semList = []; //This array is to get all the values of semesters\n var termAve = []; //This array is to get all the average per semester\n var cumulativeAve = []; //This is to get the cumulativeAve Progress as each semester is finished (example Sem1: 75% -> Sem2: 90% etc..)\n \n for(var i=0; i<fullinfo.length; ++i){\n var line = fullinfo[i].toString();\n newfiltered.push(line);\n /**\n * We start with the raw file and filter all the lines that include the following keywords\n * We should just be left with the semesters and courses\n * use console.log() to execute the filtered values\n */\n if( fullinfo[i].includes(\"OEN\") || fullinfo[i].includes(\"Bachelor\") \n || fullinfo[i]==\"\" || fullinfo[i].includes(\"Repeated\") || fullinfo[i].includes(\"Co-op\")\n || fullinfo[i].includes(\"Minor\")){\n newfiltered.pop();\n }\n }\n\n for(var j=0; j < newfiltered.length; j++){\n\n /**\n * After filteration, we now must divided each one and add them into their respective array\n * All the cumulative progress ave to one, and so on\n */\n if(newfiltered[j].includes(\"Term\")){\n var semesterAve = newfiltered[j].split(\"Average\");\n termAve.push(parseInt(semesterAve[1]));\n newfiltered[j] = \"\";\n }\n if(newfiltered[j].includes(\"Cumulative\")){\n var cumulativeTemp = newfiltered[j].split(\"Average\");\n cumulativeAve.push(parseInt(cumulativeTemp[1]));\n newfiltered[j] = \"\";\n }\n if(newfiltered[j].includes(\"Major\") ||newfiltered[j].includes(\"Cumulative\")){\n newfiltered[j] = \"\";\n }\n }\n \n var filtered = [];\n\n //Since we dont want any empty lines and the trim() function wont work so a hard-coded it so it pops all the empty lines\n for(var j=0; j < newfiltered.length; j++){\n var line = newfiltered[j].toString();\n filtered.push(line);\n if(newfiltered[j]==\"\" && newfiltered[j-1]==\"\"){\n filtered.pop();\n }\n \n }\n\n for(var j=0; j < filtered.length; j++){\n if(filtered[j-1]==(\"\") && filtered[j]!=null){\n semList.push(filtered[j]);\n }\n }\n getCourses(filtered, semList, userData, termAve, cumulativeAve);\n}", "title": "" }, { "docid": "3200fda8f2706709f20d032022d5b628", "score": "0.55085194", "text": "function filterFinalDataByType() {\n\n filterString = \"\";\n filteredFinalData = [];\n for(i = 0; i < localFinalData.length; i++) {\n\n let t = localFinalData[i];\n\n if (filterType == \"users\" && t.is_user == false)\n continue;\n\n if (filterType == \"groups\" && t.is_user == true)\n continue;\n\n filteredFinalData.push(t);\n\n }\n\n }", "title": "" }, { "docid": "36b98cc5a070fe84bd08cbb79e9e26d5", "score": "0.5441944", "text": "processUsers(userArray){\n\t\tlet newUsers = {};\n\t\tfor(let i=0;i<userArray.length;i++){\n\t\t\tlet parts = userArray[i].substr(1).split(\"@\");\n\t\t\tlet rank = userArray[i][0];\n\t\t\tlet name = parts[0];\n\t\t\tlet id = toId(name);\n\t\t\tlet status = parts[1];\n\t\t\tlet oldUser = this.getUserData(id) || (this.firstGarbage[id] || this.secondGarbage[id]);\n\t\t\tnewUsers[id] = oldUser ? oldUser.updateData(name, rank, status) : new User(name, rank, status);\n\t\t}\n\t\tthis.users = newUsers;\n\t\tthis.numUsers = userArray.length;\n\t}", "title": "" }, { "docid": "09240d425129026e3fa1009f5485ae66", "score": "0.54046863", "text": "function buscarUsuario_(Usuario){\n \n var sheetx = SpreadsheetApp.openById(SPSHT_Temp).getSheetByName(SHEET_TEMP);\n var lastRowx = sheetx.getLastRow();\n var rangex = sheetx.getRange(\"A3:D\"+lastRowx)\n var valuesx = rangex.getValues();\n var cadenax;\n var Filax;\n \n //Buscar el usuario\n for(var iix= valuesx.length - 1; iix>-1 ; iix--){\n \n //Agregamos todos los campos en los que se va buscar\n cadenax = valuesx[iix][0];\n \n //Si se cumple la funcion\n if (cadenax.indexOf(Usuario) != -1) {\n\n Filax = valuesx[iix][3].toString();\n iix=-1;\n }\n }\n \n //Cargar Catalogos\n var Articulo = \"\";\n var Marca = \"\";\n var Movimiento = \"\";\n var Condicion = \"\";\n var Cat_Articulos = SpreadsheetApp.openById(CATALOGO).getSheetByName(\"Articulos\");\n var Cat_Marcas = SpreadsheetApp.openById(CATALOGO).getSheetByName(\"Marcas\");\n var Cat_Mov = SpreadsheetApp.openById(CATALOGO).getSheetByName(\"Movimientos\");\n var Cat_Condicion = SpreadsheetApp.openById(CATALOGO).getSheetByName(\"Condiciones\");\n var UF_Articulos = Cat_Articulos.getLastRow();\n var UF_Marcas = Cat_Marcas.getLastRow();\n var UF_Mov = Cat_Mov.getLastRow();\n var UF_Condiciones = Cat_Condicion.getLastRow();\n var r_Articulos = Cat_Articulos.getRange(\"A2:B\" + UF_Articulos);\n var r_Marcas = Cat_Marcas.getRange(\"A2:B\" + UF_Marcas);\n var r_Mov = Cat_Mov.getRange(\"A2:B\" + UF_Mov);\n var r_Condiciones = Cat_Condicion.getRange(\"A2:B\" + UF_Condiciones);\n var v_Articulos = r_Articulos.getValues();\n var v_Marcas = r_Marcas.getValues();\n var v_Mov = r_Mov.getValues();\n var v_Condiciones = r_Condiciones.getValues();\n var i1 = 0;\n \n //datos de Busqueda\n var sheet = SpreadsheetApp.openById(SPSHT_Base).getSheetByName(SHEET_NAME);\n var range = sheet.getRange(\"A\"+ Filax +\":W\"+ Filax);\n //var range = sheet.getRange(\"A3128:W3128\");\n var values = range.getValues();\n \n \n //Agregamos una nueva matriz\n tTemporal = new Array (22);\n \n //Articulo\n for(var i1= 0; i1 < v_Articulos.length ; i1++){\n if (v_Articulos[i1][0].toString() == values[0][2].toString()){\n Articulo = v_Articulos[i1][1].toString();\n }\n }\n \n //Marcas\n for(var i1= 0; i1 < v_Marcas.length ; i1++){\n if (v_Marcas[i1][0].toString() == values[0][3].toString()){\n Marca = v_Marcas[i1][1].toString();\n }\n }\n \n //Movimientos\n for(var i1= 0; i1 < v_Mov.length ; i1++){\n if (v_Mov[i1][0].toString() == values[0][8].toString()){\n Mov = v_Mov[i1][1].toString();\n }\n }\n \n //Condicion\n for(var i1= 0; i1 < v_Condiciones.length ; i1++){\n if (v_Condiciones[i1][0].toString() == values[0][7].toString()){\n Condicion = v_Condiciones[i1][1].toString();\n }\n }\n \n //Arreglar Fecha\n \n var Fecha = Utilities.formatDate(values[0][0],Session.getScriptTimeZone(), \"dd/MM/yyyy' 'HH:mm:ss\");\n \n tTemporal[0] = Fecha;\n tTemporal[1] = values[0][1].toString();\n tTemporal[2] = Articulo;\n tTemporal[3] = Marca;\n tTemporal[4] = values[0][4].toString();\n tTemporal[5] = values[0][5].toString();\n tTemporal[6] = values[0][6].toString();\n tTemporal[7] = Condicion;\n tTemporal[8] = Mov;\n tTemporal[9] = values[0][9].toString();\n tTemporal[10] = values[0][10].toString();\n tTemporal[11] = values[0][11].toString();\n tTemporal[12] = values[0][12].toString();\n tTemporal[13] = values[0][13].toString();\n tTemporal[14] = values[0][14].toString();\n tTemporal[15] = values[0][15].toString();\n tTemporal[16] = values[0][16].toString();\n tTemporal[17] = values[0][17].toString();\n tTemporal[18] = values[0][18].toString();\n tTemporal[19] = values[0][19].toString();\n tTemporal[20] = values[0][20].toString();\n tTemporal[21] = values[0][21].toString();\n tTemporal[22] = values[0][22].toString();\n \n tResultado = tTemporal;\n}", "title": "" }, { "docid": "e8daba8c77350d08daaec594fc05d5b5", "score": "0.54029053", "text": "function listUsers(sheet){\n var ss;\n if(sheet == undefined){\n var ss = SpreadsheetApp.getActiveSpreadsheet();\n try {sheet = ss.getSheetByName(vrSheetName);}\n catch(e){ insertVacationResponderSheet_(ss);\n sheet = ss.getSheetByName(vrSheetName);}\n }\n else ss = sheet.getParent();\n ss.toast(\"Fetching user list\");\n //Get the new list of users\n var users = getUsers_(); //returned data is a 2D array\n \n var newUserList = [];\n //get the users from spreadsheet if any\n var oldUserList;\n try{\n oldUserList = sheet.getRange(2, 1, sheet.getLastRow()-1, 6).getValues();\n } catch(e){oldUserList = []};\n \n if (oldUserList.length > 0){\n //Compare users and push them in new userList with user data\n for(var i in users){\n var userFound = false;\n for(var j in oldUserList){\n if(users[i][0] == oldUserList[j][0]){\n newUserList.push(oldUserList[j]);\n userFound = true;\n break;\n }\n }\n if(!userFound){\n newUserList.push([users[i][0], users[i][1], '', '', '', '']);\n }\n }\n sheet.deleteRows(2, sheet.getLastRow()-1);\n sheet.getRange(2, 1, newUserList.length, 6).setValues(newUserList);\n }\n else {\n sheet.getRange(2, 1, users.length, users[0].length).setValues(users);\n }\n SpreadsheetApp.flush();\n ss.toast(\"Fetching user list complete\");\n}", "title": "" }, { "docid": "af3b438f45e6556d520c6c4acaadec11", "score": "0.5299235", "text": "function getAllStudents(convertadv) {\n\n var UserData = retrieveUserData();\n if (UserData[STUDENT_DATA.ACCESS - 1] >= ACCESS_LEVELS.ADMIN && UserData[STUDENT_DATA.ACCESS - 1] <= ACCESS_LEVELS.CAPTAIN) {\n var classlists = SpreadsheetApp.openByUrl(PropertiesService.getScriptProperties().getProperty('classlistURL')).getActiveSheet();\n var maxclass = classlists.getLastRow();\n var classdata = classlists.getSheetValues(2, 1, maxclass, STUDENT_DATA[\"LENGTH\"]);\n\n var advisorlists = SpreadsheetApp.openByUrl(PropertiesService.getScriptProperties().getProperty('faclistURL')).getActiveSheet();\n var maxadvisor = advisorlists.getLastRow();\n var advisordata = advisorlists.getSheetValues(2, 1, maxadvisor, STUDENT_DATA[\"FIRST\"]);\n\n var alladv = {}; //associative object\n var num = 0;\n for (var setadv = 0; setadv < advisordata.length; setadv++) {\n if (advisordata[setadv][STUDENT_DATA[\"FIRST\"] - 1] !== \"\" || advisordata[setadv][STUDENT_DATA[\"LAST\"] - 1] !== \"\") {\n alladv[advisordata[setadv][STUDENT_DATA.UUID - 1]] = advisordata[setadv][STUDENT_DATA[\"FIRST\"] - 1] + \" \" + advisordata[setadv][STUDENT_DATA[\"LAST\"] - 1];\n num++;\n }\n }\n\n //Note that multidemensional arrays in javascript are just arrays of arrays.\n var userdata = [\n []\n ];\n num = 0;\n\n for (var set = 0; set < classdata.length; set++) {\n //ensure that this is actually a person\n if (classdata[set][STUDENT_DATA[\"FIRST\"] - 1] !== \"\" || classdata[set][STUDENT_DATA[\"LAST\"] - 1] !== \"\") {\n //because the row is returned as a multidimensional array, it must be taken at the 0 index (for only the row)...\n userdata[num] = classdata[set];\n\n //load corresponding advisor name\n if (convertadv === true && alladv[userdata[num][STUDENT_DATA[\"ADVISOR\"] - 1]] !== null) {\n userdata[num][STUDENT_DATA[\"ADVISOR\"] - 1] = alladv[userdata[num][STUDENT_DATA[\"ADVISOR\"] - 1]];\n }\n\n num++;\n }\n }\n\n userdata.sort(function (x, y) { return sortStudents_(x, y); });\n\n return userdata;\n } else {\n writeLog(\"User lacks privilege: Get All Students\");\n throw new Error(\"User lacks privilege\");\n }\n}", "title": "" }, { "docid": "d15ca693a547e8a057a931b2d6c6bfc0", "score": "0.5288651", "text": "function filterUFO(){\n let filtered = tableData\n var inputUser = d3.select(\"#datetime\").property(\"value\");\n if (inputUser) {\n filtered = tableData.filter(ufoInfo => ufoInfo.datetime === inputUser)};\n console.log(filtered)\n initialTable(filtered)\n}", "title": "" }, { "docid": "75876e756deae35a273f2e01a1617925", "score": "0.5278892", "text": "function candidateGroup(data) {\n // Fetch user names\n var candidatesAllNames = data.map(d => d[\"user_name\"]);\n // Filter for only distinct names\n var candidatesUniqueNames = [...new Set(candidatesAllNames)]; \n\n var lineList = [];\n // loop through candidates and create data\n for (let i = 0; i < candidatesUniqueNames.length; i++) {\n\n var candidateName = candidatesUniqueNames[i];\n\n var candidateData = data.filter(d => d[\"user_name\"] == candidateName);\n // Creates Object which contains candidate name and a list of objects which contain retweet/favorite moving averages\n var candidateObject = {\n userName: candidateName,\n candidateData: candidateData\n };\n\n lineList.push(candidateObject);\n }\n\n // console.log(lineList);\n\n return(lineList);\n}", "title": "" }, { "docid": "418e37c55f2d7526fb0dc6330afc3dd1", "score": "0.52753097", "text": "function getFilteredUsersArr(users, filterString) {\n const usersArr = Object.values(users);\n\n if (filterString.length === 0) {\n return usersArr;\n } else if (filterString.length > 0) {\n const filteredUserArr = usersArr.filter((user) =>\n user.userName.toLowerCase().includes(filterString)\n );\n return filteredUserArr;\n }\n}", "title": "" }, { "docid": "bc03680b5a7ae857451f75c6db82a8ed", "score": "0.5267061", "text": "function update_data() {\n var current_filters = {\n level: $.map( $(\"#buttonset-level :checked\"), function(val){\n return val.name;\n }),\n country: $.map( $(\"#buttonset-country :checked\"), function(val){\n return val.name;\n }),\n weight: $.map( $(\"#buttonset-weight :checked\"), function(val){\n return val.name;\n })\n };\n data = csv.filter( function(d) {\n if (current_filters.level.indexOf(d.level) >= 0 &&\n current_filters.country.indexOf(d.country) >= 0 &&\n current_filters.weight.indexOf(d.weight) >=0) {\n return true;\n }\n return false;\n });\n }", "title": "" }, { "docid": "0e794f871704a6d2b76dc06bd5e361cb", "score": "0.5262222", "text": "function processThresholdsCSV(data, deletion_id) {\n let data_arr = csvToArray(data);\n\n data_arr_filtered = data_arr.filter(function(item) {\n\t\treturn item.Deletion == deletion_id\n\t})\n\n\tif (data_arr_filtered.length == 0) {\n\t\tdata_arr_filtered = data_arr.filter(function(item) {\n\t\t\treturn item.Deletion == '*'\n\t\t})\n\t}\n\n return data_arr_filtered;\n}", "title": "" }, { "docid": "d410ac084779220a581419573052e8e1", "score": "0.5251847", "text": "function fetchWildLifeDataSample() {\n d3.csv('data/wildlife.csv', function(data) {\n wlSample = data.map(function(d) {\n return d;\n });\n function editAirportID(data, index, array, fieldname, replace, value, mode) {\n var newObj = data;\n if (newObj[fieldname] === replace) {\n newObj[fieldname] = value;\n if(mode != 0) {\n console.log(\"fixed index : \", index);\n }\n }\n return newObj;\n }\n\n // where is this edited being used? .... [N]\n var edited = data.map(function(d, index, array) {\n s1 = d.AIRPORT_ID;\n s2 = s1.substring(1, 4); // USA ones have first letter K\n t2= editAirportID(d, index, array, \"AIRPORT_ID\", s1, s2, 0);\n // replace KFLL with FLL, KSLC with SLC, ...\n return t2;\n });\n\n getUniqueAirportsFromWildLifeData(wlSample);\n });\n }", "title": "" }, { "docid": "3726411c152b51520e77e77a9578c77d", "score": "0.52443826", "text": "function submitAndFilter(){\n const allTrs1 = document.querySelectorAll(\"#csv_table_id tbody tr\");\n allTrs1.forEach( (therow)=> {\n if (therow.classList.contains(\"show_row\")){\n therow.classList.remove(\"show_row\");\n }\n if (therow.classList.contains(\"hide_row\")){\n therow.classList.remove(\"hide_row\");\n }\n });\n\n\n let andDataList = [];\n addedToFilterList_and.forEach( (condItem)=> {\n let condItemList = condItem.split(':');\n if (condItemList.length == 3){\n andDataList.push( { column: condItemList[0], value: condItemList[1], row: condItemList[2] } );\n }\n });\n\n /* 2 */\n let projectData = [];\n\n for (let row=0; row<allTrs1.length; row++) {\n let target_row_list = [];\n andDataList.forEach( (conditionObj)=> {\n let miniTargetTd = allTrs1[row].querySelector(`td[data-column-title='${conditionObj.column}']`);\n target_row_list.push({value: miniTargetTd.innerText, rowid: miniTargetTd.getAttribute(\"data-row-htmlid\"), targetValue: conditionObj.value});\n\n });\n projectData.push(target_row_list);\n }\n /* now we have the douple array loop and check if value = target 1 point if points = array.length hf and bye bye */\n //console.log(projectData);\n let validRows = [];\n projectData.forEach( (arrayRow, index)=>{\n let equalPoint = 0;\n let arrayLength = arrayRow.length;\n let rowId = '';\n arrayRow.forEach( (tdObj)=>{\n if (tdObj.value == tdObj.targetValue){\n equalPoint += 1;\n rowId = tdObj.rowid;\n }\n });\n\n if (equalPoint == arrayLength){\n validRows.push(rowId);\n }\n });\n /* hide and show step */\n allTrs1.forEach( (trRow)=>{\n let trId = trRow.getAttribute(\"id\");\n if (validRows.includes(trId)){\n if (!trRow.classList.contains(\"show_row\")){\n trRow.classList.add(\"show_row\");\n }\n } else {\n if (!trRow.classList.contains(\"hide_row\")){\n trRow.classList.add(\"hide_row\");\n }\n }\n });\n\n }", "title": "" }, { "docid": "f7fb0d0a264966623be12aa7c6811b6d", "score": "0.52409005", "text": "function updateInsults(){\n\t//zeroing out insult array\n\tinsults.length = 0;\n\t//reading the insult file\n\tfs.createReadStream('insults.csv')\n\t.pipe(csv())\n\t.on('data', (data) => insults.push(data))\n}", "title": "" }, { "docid": "5b9d8a7a8f91a59ba7be9a301f5408ee", "score": "0.52376044", "text": "function getFacultyData(column, value) {\n\n var advisorlists = SpreadsheetApp.openByUrl(PropertiesService.getScriptProperties().getProperty('faclistURL')).getActiveSheet();\n var maxadvisor = advisorlists.getLastRow() - 1;\n var advisordata = advisorlists.getSheetValues(2, 1, maxadvisor, STUDENT_DATA[\"FIRST\"]);\n\n var userdata = [\n []\n ];\n\n var num = 0;\n for (var check = 0; check < advisordata.length; check++) {\n\n if (advisordata[check][column - 1] === value) { //if the cell has the sought value\n userdata[num] = advisordata[check];\n num++;\n }\n }\n if (num > 0)\n return userdata;\n else\n return -1;\n}", "title": "" }, { "docid": "63b32cea7e556469dc92868d37d39947", "score": "0.52333", "text": "filterPrenotazioni(inputText) {\n //al keyup filtra e mostra solo un sottinsieme delle prenotazioni\n let prenotazioniFiltrateSala = [];\n let prenotazioniFiltrateUsername = [];\n let inputReg = new RegExp(inputText, \"i\"); //i = ignorecase\n prenotazioniFiltrateSala = this.prenotazioni.filter(p => inputReg.test(p.NomeSala));\n prenotazioniFiltrateUsername = this.prenotazioni.filter(p => inputReg.test(p.UsernameRisorsa));\n this.populatePrenotazioni([...new Set([...prenotazioniFiltrateSala, ...prenotazioniFiltrateUsername])]);\n }", "title": "" }, { "docid": "54334c47b727e21ff4f8623ef19ec03d", "score": "0.52089095", "text": "function filterData() {\n let activeFilters = filters.filter(d => d.selected);\n\n let visibleAccessions = [];\n selectAll(\".cell\").attr(\"opacity\", d => {\n const source = getNodeByAccession(d.source);\n const target = getNodeByAccession(d.id);\n const visible = hasFilterMatch(source, target, activeFilters);\n if (visible) {\n visibleAccessions.push(source.accession);\n visibleAccessions.push(target.accession);\n }\n return visible ? 1 : 0.1;\n });\n selectAll(\".interaction-viewer text\").attr(\"fill-opacity\", d => {\n return visibleAccessions.includes(d.accession) ? 1 : 0.1;\n });\n}", "title": "" }, { "docid": "1187a37fbf7cebba3352601c1cf9adf3", "score": "0.5188346", "text": "function filterUsers(event) {\n //get event and table to filter\n var filter = event.target.value.toUpperCase();\n var rows = document.querySelector(\"#projectRoles tbody\").rows;\n //iterate over the rows in the table\n for (var i = 0; i < rows.length; i++) {\n //get text content of first row to get the usernames\n var secondCol = rows[i].cells[1].textContent.toUpperCase();\n //show/hide row based on input \n if (secondCol.indexOf(filter) > -1) {\n rows[i].style.display = \"\";\n } else {\n rows[i].style.display = \"none\";\n } \n }\n //make sure the header row is always shown\n //document.getElementsByClassName('group-row')[1].style.display = \"table-row\"\n var elements = document.getElementsByClassName('group-row');\n for(var i=0; i<elements.length; i++) { \n elements[i].style.display='';\n }\n }", "title": "" }, { "docid": "acf6eac1b9550b850e608b77ce61c24d", "score": "0.5183096", "text": "function myPartyFilter() {\n var selectedValues = [];\n var valuesChecked = [];\n var selectorCb = document.querySelectorAll(\"input:checked\");\n\n\n for (var i = 0; i < selectorCb.length; i++) {\n valuesChecked.push(selectorCb[i].value)\n }\n\n //createMyTable(valuesChecked); _//esto no va pk el parametro que pasamos no contiene la información de los miembros\n console.log(valuesChecked);\n var newInfo = data.results[0].members\n\n for (var i = 0; i < newInfo.length; i++) {\n\n if (valuesChecked.includes(newInfo[i].party) || valuesChecked.length == 0) {\n selectedValues.push(newInfo[i])\n }\n\n /*if (document.getElementById(\"myCheckboxD\").checked && dataThatIWant[i].party == \"D\") {\n selectedValues.push(dataThatIWant[i])\n console.log(dataThatIWant[i]);\n }\n\n if (document.getElementById(\"myCheckboxR\").checked && dataThatIWant[i].party == \"R\") {\n selectedValues.push(dataThatIWant[i])\n console.log(dataThatIWant[i]);\n }\n\n if (document.getElementById(\"myCheckboxI\").checked && dataThatIWant[i].party == \"I\") {\n selectedValues.push(dataThatIWant[i])\n console.log(dataThatIWant[i]);\n }\n\n if (document.getElementById(\"myCheckboxD\").checked == false && document.getElementById(\"myCheckboxR\").checked == false &&\n document.getElementById(\"myCheckboxI\").checked == false) {\n selectedValues.push(dataThatIWant[i])\n console.log(dataThatIWant[i]);\n }*/\n }\n\n myStateFilter(selectedValues)\n}", "title": "" }, { "docid": "5542b4318183ca720351fefa907378ac", "score": "0.517089", "text": "function getUsers(spreadsheet) {\n var sheet = spreadsheet.getSheetByName('manage');\n var users = [];\n \n i=1\n do {\n i += 1;\n var mail = sheet.getRange(i, 2).getValue();\n if (mail != \"\") {\n users.push(mail);\n Logger.log(\"add Target user:\" + mail ); \n }\n } while (sheet.getRange(i, 2).getValue() != \"\" ); \n return users;\n}", "title": "" }, { "docid": "ec00a7a48158ca697ff021a7e903d45b", "score": "0.5168498", "text": "function fillUsers()\n {\n document.querySelector('#user-log').innerHTML = '';\n userslist = users.filter((item, i, ar) => ar.indexOf(item) === i);\n userslist.forEach(element => {\n document.querySelector('#user-log').innerHTML += element+'<br>';\n });\n }", "title": "" }, { "docid": "566f6690431fa07b1cb3f9bee6c83de8", "score": "0.51644945", "text": "async function filterCountry() {\n const data = await fs.readFileSync('input/main.csv');\n\n const records = parser(data, { columns: true });\n const results = [];\n const headers = ['SKU',\n 'DESCRIPTION',\n 'YEAR',\n 'CAPACITY',\n 'URL',\n 'PRICE',\n 'SELLER_INFORMATION',\n 'OFFER_DESCRIPTION',\n 'COUNTRY'];\n\n //Filter data that have country as USA and add it to a temporary array\n records.forEach(element => {\n if (element['COUNTRY'].includes('USA')) {\n results.push(element);\n }\n });\n //console.log(results[0]);\n\n //Convert Js Objects to string and write to a csv file\n stringifier(results, { header: true, columns: headers }, (err, data) => {\n fs.writeFile('output/filteredCountry.csv', data, () => {\n console.log('Written to filteredCountry.csv'); \n lowestPrice(); \n });\n });\n}", "title": "" }, { "docid": "e158504d5583469ee5bd4c55c7b9dce0", "score": "0.5164264", "text": "function searchData( userId ) {\n // Obtiene la hoja de calculos\n var sheet = SpreadsheetApp.openById( bookID ).getSheetByName( sheetName );\n // Recorre todas las filas buscando la coincidencia del userID con el valor de la columna 0\n var rowsResult = sheet.getRange( 2, 1, sheet.getLastRow(), sheet.getLastColumn() )\n .getValues()\n .filter(function ( row ) { return row[ 0 ] == userId; } ); \n var result = ''; \n var tpl_row = HtmlService.createHtmlOutputFromFile( 'row.html' ).getContent();\n \n for (var index=0; index<rowsResult.length; index++) {\n // Obtiene el resultado\n var row = rowsResult[ index ];\n // Genera un objeto con los datos de cada registro\n var user = {\n id: row[ 0 ],\n numero: row[ 1 ],\n jugador: row[ 2 ],\n email: row[ 3 ],\n equipo: row[ 4 ] }; \n\n // Serializa el OBJ para enviar la respuesta al frontend\n //var parcial = JSON.stringify( user );\n var linea = tpl_row;\n linea = linea.replace( '##ID##', user.id );\n linea = linea.replace( '##NUMERO##', user.numero );\n linea = linea.replace( '##JUGADOR##', user.jugador );\n linea = linea.replace( '##EMAIL##', user.email );\n linea = linea.replace( '##EQUIPO##', user.equipo );\n result += linea;\n };//for\n \n var tpl_row = HtmlService.createHtmlOutputFromFile( 'result.html' ).getContent();\n tpl_row = tpl_row.replace( '##LIST##', result ); \n return tpl_row;\n}", "title": "" }, { "docid": "521b851f044187798c5db4340c1cbf64", "score": "0.51422405", "text": "function filterGlobalUsers(event) {\n var filter = event.target.value.toUpperCase();\n var rows = document.querySelector(\"#globalRoles tbody\").rows;\n \n for (var i = 0; i < rows.length; i++) {\n var secondCol = rows[i].cells[1].textContent.toUpperCase();\n if (secondCol.indexOf(filter) > -1) {\n rows[i].style.display = \"\";\n } else {\n rows[i].style.display = \"none\";\n } \n }\n document.getElementsByClassName('group-row')[0].style.display = \"\"\n }", "title": "" }, { "docid": "a25bd218d28190b71f1533b8ba1790d5", "score": "0.5110173", "text": "function filterPreRequestedData(checkbox_array, sensorID) {\n\tvar str = \"\";\n\tfor (var i = 0; i < checkbox_array.length; i++) {\n\t\tvar checkbox = checkbox_array[i];\n\t\tif (checkbox.checked) {\n\t\t\tif (validatesCorrectCheckboxes(checkbox, sensorID) === 1) { //Discrete data.\n\n\t\t\t\tvar name = checkbox.name.split(\" \")[0];//Facet name.\n\t\t\t\tstr += \"&\" + name + \"=[\";\n\t\t\t\tvar parentElem = checkbox.parentElement.parentElement; //Parent Div.\n\t\t\t\tvar values = getStringDiscreteValues(parentElem, str);\n\t\t\t\tif (values === null) // no options selected\n\t\t\t\t\treturn \"\";\n\t\t\t\tstr += values;\n\t\t\t\tstr += \"]\";\n\n\t\t\t} else if (validatesCorrectCheckboxes(checkbox, sensorID) === 2) { //Continuos Data.\n\n\t\t\t\t//API NOT PREPARED TO RETRIEVE CONTINUOS VALUES.\n\n\t\t\t}\n\t\t}\n\t}\n\treturn str;\n}", "title": "" }, { "docid": "b73cf80729e6b70cd19a176c15b2b9b3", "score": "0.5105745", "text": "function filterUFOData(){\n \n //collect and store user input of Date\n\n var dateInput = d3.select(\"#datetime\");\n var dateSelected = dateInput.property(\"value\");\n\n console.log(dateSelected);\n\n\n //Filter Data by Date input by user\n\n var filtered_data = tableData.filter(sightData => sightData.datetime === dateSelected);\n\n console.log(filtered_data);\n\n // reset the table initially displayed\n\n tbody.html(\"\");\n\n //repopulate table with filtered \n\n filtered_data.forEach((UFOFinding) => {\n\n // //Use d3 to append one table row `tr` for each UFO data object\n var row = tbody.append(\"tr\");\n \n // //Use `Object.entries` to console.log each UFO data report value\n Object.entries(UFOFinding).forEach(([key, value]) => {\n \n // Append a cell to the row for each value\n // // in the UFO data report object\n var cell = row.append(\"td\");\n \n //Use d3 to update each cell's text with\n // UFO report values (datetime, city, state, country, shape, durationMinutes, comments)\n cell.text(value);\n });\n });\n \n\n\n}", "title": "" }, { "docid": "a8429d3f1b3affccb958297709f1f184", "score": "0.50972795", "text": "function update(array){\n var filtrados = [];\n filtrados = array.filter(members => partySelected().includes(members.party) && (stateSelected() == members.state ||stateSelected() ==\"\"))\n return filtrados;\n}", "title": "" }, { "docid": "a352e1dab6e01c6397a024ae45b68659", "score": "0.50838107", "text": "function getUsersIds(str) {\n let newArr = str.toLowerCase().split(\", \");\n for (let i = 0; i < newArr.length; i++) {\n for (let j = 0; j < newArr[i].length; j++) {\n if (newArr[i][j] === \"#\") {\n newArr[i].splice(j, 1);\n }\n }\n newArr[i].shift().shift();\n }\n return newArr;\n}", "title": "" }, { "docid": "c926230da8df4cf132d3a2e056b199d1", "score": "0.5070699", "text": "function peopleWhoBelongToTheIlluminati(arr){\n return arr.filter(e => e.member === true)\n }", "title": "" }, { "docid": "0afe6ef9bc744e3821985e6b8b974927", "score": "0.50635165", "text": "function limitToSomeNew(arrayCSV, limitations){\n temp_array = [];\n // console.log(\"!! arrayCSV in limitToSomeNew() is\",arrayCSV)\n var limitationsKeysArray = Object.keys(limitations)\n for (each in arrayCSV){\n row = arrayCSV[each]\n //// limitations is a variable that is an object of objects consisting of \n //// key:value pairs of diemension name:dimension value\n var foundMatchHelper = \"no\"\n var foundMatch = [];\n for (each2 in limitationsKeysArray){\n for (eachValue in limitations[limitationsKeysArray[each2]]){\n if (row[limitationsKeysArray[each2]] === limitations[limitationsKeysArray[each2]][eachValue]){\n foundMatch.push(\"yes\")\n }\n }\n }\n // console.log(\"foundMatch array = \",foundMatch, \"and length = \",foundMatch.length);\n for (tester in foundMatch){\n if (foundMatch[tester] === \"yes\"){\n foundMatchHelper = \"yes\";\n }\n }\n if (foundMatch.length === limitationsKeysArray.length){\n temp_array.push(row)\n // console.log(\"temp_array\",temp_array)\n }\n }\n // console.log(\"!! * * temp_array\",temp_array)\n arrayCSV = [];\n arrayCSV = temp_array;\n // console.log(\"!! * * result returned is \",arrayCSV);\n // console.log(\"!! * * * result returned is \",arrayCSV);\n return arrayCSV\n}", "title": "" }, { "docid": "b1e9cfce9c79e867439bb8fdb76588b9", "score": "0.5055032", "text": "function transformData(dataArr) {\n const leanData = dataArr.map(item => {\n return {\n kleur: item.eerste_kleur.toLowerCase(),\n merk: item.merk.toLowerCase()\n }\n })\n //data filteren naar kleur en merk\n console.log(\"data transformeren part 1\", leanData)\n return leanData\n}", "title": "" }, { "docid": "ba21f2b453d57d01e4b68333e46654a9", "score": "0.5050268", "text": "function filterUsersForCreatingGroup (filter){\n\tvar elements = document.getElementById(\"challenge-visible-dom\").getElementsByClassName(\"friend-item\");\n\t// show all\n\tfor(element in elements){\n\t\tif(elements[element].innerHTML !== undefined){\n\t\t\tif(filter.length==0 || elements[element].getAttribute('data-user-name').indexOf(filter)!=-1 || elements[element].getAttribute('data-user-nick').indexOf(filter)!=-1){\n\t\t\t\telements[element].style.display=\"flex\";\n\t\t\t}else{\n\t\t\t\t// Podemos analizar que pasa si el mail es exacto lo que se busca o algo asi...\n\t\t\t\telements[element].style.display=\"none\";\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a8ee88b38ed72fa91553e5fec0ff1006", "score": "0.5042032", "text": "function getUsersData(){\n var col = new Array();\n /*only for update*/\n var userId = $(\"#userIdStr\").text();\n /*end only for update*/\n var surName = $(\"#surName\").val();\n var firstName = $(\"#firstName\").val();\n var surNameYomi = $(\"#surNameYomi\").val();\n var firstNameYomi = $(\"#firstNameYomi\").val();\n var email = $(\"#email\").val();\n var zipFirst = $(\"#zipFirst\").val();\n var zipLast = $(\"#zipLast\").val();\n var prefId = $(\"select[id='prefSelection']\").val();\n var prefName = $(\"option:selected\").text();\n var city = $(\"#city\").val();\n var town = $(\"#town\").val();\n var building = $(\"#building\").val();\n var phoneFirst = $(\"#phoneFirst\").val();\n var phoneSecond = $(\"#phoneSecond\").val();\n var phoneThird = $(\"#phoneThird\").val();\n var forumId = $(\"#forumId\").val();\n col[\"userId\"] = userId; \n col[\"surName\"] = surName; \n col[\"firstName\"] = firstName; \n col[\"surNameYomi\"] = surNameYomi; \n col[\"firstNameYomi\"] = firstNameYomi; \n col[\"email\"] = email; \n col[\"zipFirst\"] = zipFirst; \n col[\"zipLast\"] = zipLast; \n col[\"prefId\"] = prefId; \n col[\"prefName\"] = prefName; \n col[\"city\"] = city; \n col[\"town\"] = town; \n col[\"building\"] = building; \n col[\"phoneFirst\"] = phoneFirst; \n col[\"phoneSecond\"] = phoneSecond; \n col[\"phoneThird\"] = phoneThird; \n col[\"forumId\"] = forumId; \n return col;\n }", "title": "" }, { "docid": "7bf3d2209bd8665c1abf2e2a4796fae6", "score": "0.50226045", "text": "function filterFinalDataBySearch() {\n\n $(\"#tbl-main tbody\").hide();\n\n if (filterString == \"\") {\n /* for(i = 0; i < filteredFinalData.length; i++) {\n let name = filteredFinalData[i].name;\n $(\".tr-main:nth-child(\"+(i+1)+\")\").children().fadeIn(100);\n $(\".tr-main:nth-child(\"+(i+1)+\") .td-content-texts-name\").html(name);\n } */\n return;\n\n }\n\n let filterStringL = filterString.toLowerCase();\n\n for(i = 0; i < filteredFinalData.length; i++) {\n\n let is_user = filteredFinalData[i].is_user;\n let name = filteredFinalData[i].name;\n let name_tag = filteredFinalData[i].name_tag;\n let matchIndexNameTag = name_tag.indexOf(filterStringL);\n let matchIndexName = name.toLowerCase().indexOf(filterStringL);\n let filterStringLen = filterString.length;\n let tableRows = $(\"#tbl-main tbody\").children();\n\n if (matchIndexName != -1 || (!is_user && matchIndexNameTag != -1)) {\n\n let html;\n html = name.slice(0, matchIndexName);\n html += \"<span class='mark'>\";\n html += name.slice(matchIndexName, matchIndexName+filterStringLen);\n html += \"</span>\";\n html += name.slice(matchIndexName+filterStringLen);\n\n /* if (matchIndexName != -1)\n $(\".tr-main:nth-child(\"+(i+1)+\") .td-content-texts-name\").html(html);\n else \n $(\".tr-main:nth-child(\"+(i+1)+\") .td-content-texts-name\").html(name);\n\n $(\".tr-main:nth-child(\"+(i+1)+\")\").children().fadeIn(100); */\n\n $(tableRows[i]).show();\n }\n else {\n\n $(tableRows[i]).hide();\n\n }\n\n }\n\n $(\"#tbl-main tbody\").show();\n\n }", "title": "" }, { "docid": "d88b500de4fec0b1eede59aa2dee99c8", "score": "0.502014", "text": "function processData(csv) {\n\t//se sacan todas las filas (registros) que estan en el csv\n var allTextLines = csv.split(/\\r\\n|\\n/);\n /*se saca el aumento que va a tener la barra cada segundo\n * \n * La formula sale en base a un aproximacion. Aproximadamente el programa tarda\n * 150 segundos entre borrar los registro viejos, insertar registros y realizar la consulta \n * del nuevo presupuesto comercial (esto fue probado con un archivo que contenia 49000 registros\n * dentro del archivo csv)\n * \n * El numero de la formula indica el porcentaje que va a aumentar la barra cada segundo\n */\n var cantidad = (100/((150*allTextLines.length)/49000));\n //se castea a solo 2 decimales\n cantidad = cantidad.toFixed(2);\n //y se llama al metodo para aumentar la barra de cargando\n aumentar (cantidad,0);\n}", "title": "" }, { "docid": "df8a6415b5b0448ff2f15bb471a3fdd9", "score": "0.50106823", "text": "function createFilters() {\n\n //Add information to filters\n\n let nationalityArray = [];\n let hobbyArray = [];\n let professionalInterestsArray = [];\n let languageArray = [];\n\n //Extract filter values from people\n allConnections.forEach((person, numPerson) => {\n //Nationalities\n let nationalityArrayPerson = person.origin.nationality;\n\n nationalityArrayPerson.forEach((nationality, numNationality) => {\n if (!exists(nationality, nationalityArray)) {\n nationalityArray.push(nationality);\n }\n });\n\n //Hobbies\n let hobbyArrayPerson = person.hobbies;\n\n hobbyArrayPerson.forEach((hobby, numHobby) => {\n if (!exists(hobby, hobbyArray)) {\n hobbyArray.push(hobby);\n }\n });\n\n //Professional Interests\n let professionalIntsArrayPerson = person.professionalInterests;\n\n professionalIntsArrayPerson.forEach((profInt, numProfInt) => {\n if (!exists(profInt, professionalInterestsArray)) {\n professionalInterestsArray.push(profInt);\n }\n });\n\n //Languages\n let languagesArrayPerson = person.languages;\n\n languagesArrayPerson.forEach((language, numLanguage) => {\n if (!exists(language, languageArray)) {\n languageArray.push(language);\n }\n });\n\n });\n\n\n //Extract filter values from groups\n allGroups.forEach((group, numGroup) => {\n //Nationalities\n let nationalityArrayGroup = group.nationalities;\n\n nationalityArrayGroup.forEach((nationality, numNationality) => {\n if (!exists(nationality, nationalityArray)) {\n nationalityArray.push(nationality);\n }\n });\n\n //Hobbies\n let hobbyArrayGroup = group.hobbies;\n\n hobbyArrayGroup.forEach((hobby, numHobby) => {\n if (!exists(hobby, hobbyArray)) {\n hobbyArray.push(hobby);\n }\n });\n\n //Professional Interests\n let professionalIntsArrayGroup = group.professionalInterests;\n\n professionalIntsArrayGroup.forEach((profInt, numProfInt) => {\n if (!exists(profInt, professionalInterestsArray)) {\n professionalInterestsArray.push(profInt);\n }\n });\n\n //Languages\n let languagesGroup = group.language;\n\n if (!exists(languagesGroup, languageArray)) {\n languageArray.push(languagesGroup);\n }\n });\n\n //Sort\n nationalityArray.sort();\n languageArray.sort();\n hobbyArray.sort();\n professionalInterestsArray.sort();\n\n //Add filters\n filters.push(\n {\n title: \"Nationality\",\n values: nationalityArray\n }\n );\n\n filters.push(\n {\n title: \"Language\",\n values: languageArray\n }\n );\n\n filters.push(\n {\n title: \"Hobby\",\n values: hobbyArray\n }\n );\n\n filters.push(\n {\n title: \"Professional interests\",\n values: professionalInterestsArray\n }\n );\n\n //Create html elements for filters\n let filtersList = get(\"#filters-list\");\n\n //Create all filters\n for (let numFilter = 0; numFilter < filters.length; numFilter++) {\n let filter = filters[numFilter];\n //Filter div\n let filterDiv = document.createElement(\"div\");\n filterDiv.classList.add(\"filter\");\n //Filter title\n let titleSpan = document.createElement(\"span\");\n titleSpan.classList.add(\"internal-header-filter\");\n titleSpan.innerHTML = filter.title;\n //Filter options\n let filterOptionsDiv = document.createElement(\"div\");\n filterOptionsDiv.classList.add(\"options\");\n\n //Create and add options to filter\n for (let numOption = 0; numOption < filter.values.length; numOption++) {\n let optionLabel = document.createElement(\"label\");\n optionLabel.innerHTML = filter.values[numOption];\n let optionInput = document.createElement(\"input\");\n optionInput.setAttribute(\"type\", \"checkbox\");\n optionInput.setAttribute(\"name\", filter.title);\n optionInput.setAttribute(\"value\", filter.values[numOption]);\n //Add listener to option input\n optionInput.addEventListener(\"change\", (e) => {\n let isChecked = e.target.checked;\n let filterName = e.target.name;\n let optionValue = e.target.value;\n\n switch (filterName) {\n case \"Nationality\":\n updateArray(isChecked, optionValue, nationalityFilter);\n break;\n case \"Language\":\n updateArray(isChecked, optionValue, languageFilter);\n break;\n case \"Hobby\":\n updateArray(isChecked, optionValue, hobbyFilter);\n break;\n case \"Professional interests\":\n updateArray(isChecked, optionValue, professionalIntsFilter);\n break;\n case \"Look for\":\n switch (optionValue) {\n case \"People\":\n lookForPersons = isChecked;\n if (!isChecked) {\n let chkGroups = get(\"input[value='Groups']\");\n chkGroups.checked = true;\n lookForGroups = true;\n //Remove people\n let listPeople = getAll(\"div[id^='person']\");\n let listPeopleGroupsDiv = get(\".people-groups-list\");\n\n removeElementsFrom(listPeople, listPeopleGroupsDiv);\n }\n\n break;\n case \"Groups\":\n lookForGroups = isChecked;\n if (!isChecked) {\n let chkPersons = get(\"input[value='People']\");\n chkPersons.checked = true;\n lookForPersons = true;\n //Remove groups\n let listGroups = getAll(\"div[id^='group']\");\n let listPeopleGroupsDiv = get(\".people-groups-list\");\n\n removeElementsFrom(listGroups, listPeopleGroupsDiv);\n }\n\n break;\n default:\n console.error(\"Option value (\" + optionValue + \") doesn't exist!\");\n break;\n }\n break;\n default:\n console.error(\"Filter (\" + filterName + \") doesn't exist!\");\n break;\n }\n\n let numFilteredPeople = filterPeople();\n let numFilteredGroups = filterGroups();\n\n if (areFiltersEmpty()) {\n showInitialNumberOfPersonsToConnectWith();\n } else {\n updateNumPeople(numFilteredPeople, numFilteredGroups);\n }\n\n });\n\n\n //Add input to its corresponding label\n optionLabel.insertBefore(optionInput, optionLabel.firstChild);\n //Add label to filter options div\n filterOptionsDiv.appendChild(optionLabel);\n }\n\n //Add title and options to filter\n filterDiv.appendChild(titleSpan);\n filterDiv.appendChild(filterOptionsDiv);\n\n //Add filter to filters list \n filtersList.appendChild(filterDiv);\n\n let horizontalBar = document.createElement(\"div\");\n horizontalBar.classList.add(\"horizontal-bar\");\n\n filtersList.appendChild(horizontalBar);\n }\n}", "title": "" }, { "docid": "0f84f5ed782729abc5fd4266519f63ba", "score": "0.50075865", "text": "function getOrganism(uniprotIDs){\n //Checks each protein id for review\n var organism = new Array();\n uniprotIDs.map(function(e){\n //Filters out based on uniprot id from prior\n var organism_array = rows.filter(function(d){return d.UniprotID == e})\n .map(function(d){return d.Organism})\n\n //Create new array and set to take in the evidence\n var single_organism = new Set();\n organism_array.map(function(d){single_organism.add(d)});\n single_organism.forEach(function(v){organism.push(v)}); \n });\n\n return(organism);\n }", "title": "" }, { "docid": "a7448c1eee70a3967f7c6686d1675b99", "score": "0.49868056", "text": "function arrayUsers() {\n $.getJSON('/app/feeds/users.json', function(data) {\n var users = data.slice(0, array.settings.totalUsers);\n for (i = 0; i < users.length; i++) {\n if(i > array.settings.knownCount){delete users[i].id};\n if(i < array.heroes.length){\n users[i].id = array.heroes[i].id; \n users[i].type = 'hero'; \n array.heroes[i].anonId = users[i].anonId; \n users[i].products = assignProducts(array.catalog.products, array.heroes[i].productId)\n } else {\n users[i].products = assignProducts(array.catalog.products);\n if(i < array.settings.cartCount){users[i].type = 'abandoner'};\n if(i < array.settings.purchaseCount && i < array.settings.knownCount){users[i].type = 'purchaser'};\n };\n users[i].sessions = arraySessions(users[i]);\n users[i].events = arrayEvents(users[i]);\n }\n array.users = users;\n }).done(function () {\n results[1] = true;\n results[2] = true;\n console.log(array);\n displayResults();\n uploadEvents();\n });\n}", "title": "" }, { "docid": "73b4effcab0bb0dcc16e5677a874cb80", "score": "0.49851057", "text": "getFilters() {\n let cats = _.uniq(_.map(users, function(item){\n return item[filterBy];\n }));\n\n userFilterTitle = `PICK A ${filterBy.toUpperCase()}`;\n userFilters = [{ label: 'ALL', value: 'all', checked: true}];\n cats.forEach(function(cat){\n userFilters.push({\n value: cat,\n label: cat.toUpperCase()\n })\n });\n }", "title": "" }, { "docid": "5fda29aca3289cff18db2a6c022e0ab0", "score": "0.49828234", "text": "function main(){\n\n /**\n * Filter table by Users\n */ \n\n function filterUsers(event) {\n //get event and table to filter\n var filter = event.target.value.toUpperCase();\n var rows = document.querySelector(\"#projectRoles tbody\").rows;\n //iterate over the rows in the table\n for (var i = 0; i < rows.length; i++) {\n //get text content of first row to get the usernames\n var secondCol = rows[i].cells[1].textContent.toUpperCase();\n //show/hide row based on input \n if (secondCol.indexOf(filter) > -1) {\n rows[i].style.display = \"\";\n } else {\n rows[i].style.display = \"none\";\n } \n }\n //make sure the header row is always shown\n //document.getElementsByClassName('group-row')[1].style.display = \"table-row\"\n var elements = document.getElementsByClassName('group-row');\n for(var i=0; i<elements.length; i++) { \n elements[i].style.display='';\n }\n }\n\n /**\n * Filter table by projects\n */ \n\n function filterProjects(event) {\n //get event and table to filter\n var filter = event.target.value.toUpperCase();\n var table = document.getElementById('projectRoles');\n //iterate over the rows in the table\n for (var r = 0, n = table.rows.length; r < n; r++) {\n //iterate over the columns in the table\n for (var c = 0, m = table.rows[r].cells.length; c < m; c++) {\n //set regex to get inner html names of the cells\n var regex = /\\[(.*?)\\]/gm;\n //show hide cells based on their appearence in the html\n if(table.rows[r].cells[c].innerHTML.match(regex) !== null) {\n var substring = table.rows[r].cells[c].innerHTML.match(regex)\n console.log(substring[0])\n if (substring[0].toUpperCase().indexOf(filter) > -1) {\n table.rows[r].cells[c].style.display = \"\"; \n } else {\n table.rows[r].cells[c].style.display = \"none\"; \n //make sure username and delete button are always shown\n table.rows[r].cells[1].style.display = \"\"; \n table.rows[r].cells[0].style.display = \"\"; \n } \n } else {\n //make sure header of columns is always shown\n if (table.rows[r].cells[c].textContent.toUpperCase().indexOf(filter) > -1 && table.rows[r].cells[c].classList.contains('pane-header')) {\n table.rows[r].cells[c].style.display = \"\"; \n } else {\n table.rows[r].cells[c].style.display = \"none\"; \n table.rows[r].cells[1].style.display = \"\"; \n table.rows[r].cells[0].style.display = \"\"; \n }\n }\n }\n }\n //make sure table header is always shown\n document.getElementsByClassName('group-row')[1].cells[1].style.display = \"\"\n }\n\n /**\n * Filter global role table by users\n */ \n\n function filterGlobalUsers(event) {\n var filter = event.target.value.toUpperCase();\n var rows = document.querySelector(\"#globalRoles tbody\").rows;\n \n for (var i = 0; i < rows.length; i++) {\n var secondCol = rows[i].cells[1].textContent.toUpperCase();\n if (secondCol.indexOf(filter) > -1) {\n rows[i].style.display = \"\";\n } else {\n rows[i].style.display = \"none\";\n } \n }\n document.getElementsByClassName('group-row')[0].style.display = \"\"\n }\n\n /**\n * Filter global role table by projects\n */ \n\n function filterGlobalProjects(event) {\n var filter = event.target.value.toUpperCase();\n var table = document.getElementById('globalRoles');\n for (var r = 0, n = table.rows.length; r < n; r++) {\n for (var c = 0, m = table.rows[r].cells.length; c < m; c++) {\n var regex = /\\[(.*?)\\]/gm;\n if(table.rows[r].cells[c].innerHTML.match(regex) !== null) {\n var substring = table.rows[r].cells[c].innerHTML.match(regex)\n console.log(substring[0])\n if (substring[0].toUpperCase().indexOf(filter) > -1) {\n table.rows[r].cells[c].style.display = \"\"; \n } else {\n table.rows[r].cells[c].style.display = \"none\"; \n table.rows[r].cells[1].style.display = \"\"; \n table.rows[r].cells[0].style.display = \"\"; \n } \n } else {\n if (table.rows[r].cells[c].textContent.toUpperCase().indexOf(filter) > -1 && table.rows[r].cells[c].classList.contains('pane-header')) {\n table.rows[r].cells[c].style.display = \"\"; \n } else {\n table.rows[r].cells[c].style.display = \"none\"; \n table.rows[r].cells[1].style.display = \"\"; \n table.rows[r].cells[0].style.display = \"\"; \n }\n }\n }\n }\n document.getElementsByClassName('group-row')[1].cells[1].style.display = \"\"\n }\n\n //generate the global role user filter input and append it to the DOM\n document.getElementsByClassName('section-header')[0].innerHTML += '<p style=\"border-top: 1px solid #c7c7c7; padding-top: 15px;\">Filter by User: </p>&nbsp;<input type=\"text\" id=\"userInputGlob\">';\n\n //generate the global role project filter input and append it to the DOM\n document.getElementsByClassName('section-header')[0].innerHTML += '<p>Filter by Group: </p>&nbsp;<input style=\"margin-bottom: 15px;\" type=\"text\" id=\"projectInputGlob\">';\n\n //listen to events in the global role user input field to call the filter function\n document.querySelector('#userInputGlob').addEventListener('keyup', filterGlobalUsers, false);\n\n //listen to events in the global role project input field to call the filter function\n document.querySelector('#projectInputGlob').addEventListener('keyup', filterGlobalProjects, false);\n\n\n //generate the user filter input and append it to the DOM\n document.getElementsByClassName('section-header')[1].innerHTML += '<p style=\"border-top: 1px solid #c7c7c7; padding-top: 15px;\">Filter by User: </p>&nbsp;<input type=\"text\" id=\"userInput\">';\n\n //generate the project filter input and append it to the DOM\n document.getElementsByClassName('section-header')[1].innerHTML += '<p>Filter by Group: </p>&nbsp;<input style=\"margin-bottom: 15px;\" type=\"text\" id=\"projectInput\">';\n\n //listen to events in the user input field to call the filter function\n document.querySelector('#userInput').addEventListener('keyup', filterUsers, false);\n\n //listen to events in the project input field to call the filter function\n document.querySelector('#projectInput').addEventListener('keyup', filterProjects, false);\n}", "title": "" }, { "docid": "52e8e079f1c2c1da38117abe55c612a3", "score": "0.49812755", "text": "usersForFuzzyName(fuzzyName) {\n let matchedUsers = this.usersForRawFuzzyName(fuzzyName);\n let lowerFuzzyName = fuzzyName.toLowerCase();\n for (let user of matchedUsers) {\n if (user.name.toLowerCase() === lowerFuzzyName) {\n return [user];\n }\n }\n return matchedUsers;\n }", "title": "" }, { "docid": "ca9eb9ff96ef6f1a1571e6b5216e7783", "score": "0.4973361", "text": "function runFilter() {\n\n // Select the input element and get the raw HTML node \n var inputDateElement = d3.select(\"#date\");\n var inputCityElement = d3.select(\"#city\");\n var inputStateElement = d3.select(\"#state\");\n var inputCountryElement = d3.select(\"#country\");\n var inputShapeElement = d3.select(\"#shape\");\n\n // Get the value property of the input element\n var inputDateValue = inputDateElement.property(\"value\");\n var inputCityValue = inputCityElement.property(\"value\").toLowerCase();\n var inputStateValue = inputStateElement.property(\"value\").toLowerCase();\n var inputCountryValue = inputCountryElement.property(\"value\").toLowerCase();\n var inputShapeValue = inputShapeElement.property(\"value\").toLowerCase();\n \n console.log(inputDateValue);\n console.log(inputCityValue);\n console.log(inputStateValue);\n console.log(inputCountryValue);\n console.log(inputShapeValue);\n \n var filteredData = UFOData;\n \n if (inputDateValue.length > 0) {\n filteredData = UFOData.filter(UFO => UFO.datetime == inputDateValue);\n }\n console.log(filteredData);\n if (inputCityValue.length > 0) {\n filteredData = filteredData.filter(UFO => UFO.city == inputCityValue);\n }\n console.log(filteredData);\n if (inputStateValue.length > 0) {\n filteredData = filteredData.filter(UFO => UFO.state == inputStateValue);\n }\n console.log(filteredData);\n if (inputCountryValue.length > 0) {\n filteredData = filteredData.filter(UFO => UFO.country == inputCountryValue);\n }\n console.log(filteredData);\n if (inputShapeValue.length > 0) {\n filteredData = filteredData.filter(UFO => UFO.shape == inputShapeValue);\n }\n\n console.log(filteredData);\n \n // Generate a table\n \n // Get a reference to the table body\n var tbody = d3.select(\"#ufo-table\").select(\"tbody\");\n tbody.html(\"\");\n \n // BONUS: Refactor to use Arrow Functions!\n filteredData.forEach((UFO) => {\n var row = tbody.append(\"tr\");\n Object.entries(UFO).forEach(([key, value]) => {\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n\n }", "title": "" }, { "docid": "69e020785809f2640c27f664725a3eb9", "score": "0.49701998", "text": "function build_uniqueValueForDimension(arrayCSV){\n var initialDimensionsObject = arrayCSV[0][0][\"__data__\"][0];\n // var dimensions_names_array = Object.keys(initialDimensionsObject)\n var dimensions_names_array = userFilt[\"dimension_options\"]\n ///// creates an object of dimensions as keys, with an empty array as values\n var DimensionsArray = []\n for (eachDim in dimensions_names_array){\n var dim_obj_temp = {};\n dim_obj_temp[dimensions_names_array[eachDim]] = []\n DimensionsArray.push(dim_obj_temp);\n }\n // console.log(\"DimensionsArray =\", DimensionsArray);\n ///// goes through each row of data & adds the value to the array value for each dimension key\n for (eachRow in arrayCSV[0][0][\"__data__\"]){\n for(eachDimension in dimensions_names_array){\n // console.log(\"DimensionsArray = \",DimensionsArray);\n // console.log(\"$ DimensionsArray[eachDimension][dimensions_names_array[eachDimension]] = \",DimensionsArray[eachDimension][dimensions_names_array[eachDimension]]);\n DimensionsArray[eachDimension][dimensions_names_array[eachDimension]].push(arrayCSV[0][0][\"__data__\"][eachRow][dimensions_names_array[eachDimension]])\n }\n }\n for (eachDimensionObject in dimensions_names_array){\n var array_of_a_dimension = DimensionsArray[dimensions_names_array[eachDimensionObject]]\n // console.log(\"% DimensionsArray =\",DimensionsArray)\n // console.log(\"% dimensions_names_array[eachDimensionObject] =\",dimensions_names_array[eachDimensionObject])\n // console.log(\"% DimensionsArray[eachDimensionObject][dimensions_names_array[eachDimensionObject]] =\",DimensionsArray[eachDimensionObject][dimensions_names_array[eachDimensionObject]])\n DimensionsArray[eachDimensionObject][dimensions_names_array[eachDimensionObject]] = uniq(DimensionsArray[eachDimensionObject][dimensions_names_array[eachDimensionObject]])\n // DimensionsArray[eachDimensionObject][dimensions_names_array[eachDimensionObject]] = uniq(array_of_a_dimension)\n }\n userFilt[\"uniqueValuesForEachDimensionArrayOfObj\"] = DimensionsArray\n // console.log(\"X userFilt[\"uniqueValuesForEachDimensionArrayOfObj\"] = \",userFilt[\"uniqueValuesForEachDimensionArrayOfObj\"])\n return build_dd_list(userFilt[\"dimension_options\"],userFilt[\"selected_options\"])\n}", "title": "" }, { "docid": "b53e835ee3447b720a0a4d4bdeab4d96", "score": "0.49627277", "text": "function processCsvData(munsellCsvData) {\n const lines = munsellCsvData.split('\\n');\n lines.forEach(line => {\n const lineArray = line.split(',');\n if (lineArray.length == 6) {\n processCsvDataLine(lineArray);\n }\n });\n}", "title": "" }, { "docid": "909596a169dcc2e403cb03430bab833d", "score": "0.49624544", "text": "function processCSV(data, deletion_id = null) {\n let data_arr = csvToArray(data);\n\n\tif (deletion_id) {\n\t\tdata_arr = data_arr.filter(function(item) {\n\t\t\treturn item.Deletion == deletion_id\n\t\t})\n\t}\n\n data_arr.forEach(function(d) {\n\t\td.Count = +d.Count\n\t\td.ScaledProportion = +d.ScaledProportion\n\t});\n\n return data_arr;\n}", "title": "" }, { "docid": "bdf90cd93f7bdb050e93d6ab1206eeb9", "score": "0.49610117", "text": "function showDataCallback(){\n\tif(rawData !== null){\n\t\t// clear the interval\n\t\tclearInterval(showData);\n\t\t// do stuff to data ....\n\t\tsubResult = csvToArray(rawData);\n\t\t// go through the names of the columns\n\t\tfor (var x=0; x<subResult[0].length; x++){\n\t\t\tcolNames.splice(x, 0, subResult[0][x]);\n\t\t\t// makes names of columns camelCase, removes '?' marks and populates colNames[]\n\t\t\tcamelColNames.splice(x, 0, subResult[0][x].replace(/(?:^\\w|[A-Z]|\\b\\w|\\s+|[?])/g, function(match, index) {\n\t\t\t\tif (/\\s+/.test(match)) {return \"\";}\n\t\t\t\tif (/[?]+/.test(match)) {return '';}\n\t\t\t\treturn index === 0 ? match.toLowerCase() : match.toUpperCase();\n\t\t\t}));\n\t\t}\n\t\t// remove ids from camelColNames\n\t\tcamelColNames.splice(0,1);\n\t\t//remove id from colNames, leaving it with all visible names\n\t\tcolNames.splice(0,1);\n\t\t// remove first row with names of columns\n\t\tsubResult.splice(0,1);\n\t\t// #testing: normalize the input ('' and \"n/a\" should become 'unknown')\n\t\tx = 0;\n\t\tfor (x = 0; x<subResult.length; x++){\n\t\t\tfor (var v in subResult[x]){\n\t\t\t\tif(!/[^\\s]/.test(subResult[x][v])){subResult[x].splice(v, 1 , 'unknown');}\n\t\t\t\tif(/n\\/a/.test(subResult[x][v])){subResult[x].splice(v, 1 , 'unknown');}\n\t\t\t}\n\t\t}\n\t\tx=0;\n\n\t\tvar counter = null;\n\n\t\t// ----- creating final results{{}} and searching for entries ----- //\n\n\n\t\tfor (var a in subResult){\n\t\t\tresults[subResult[a][0]] = {};\n\t\t\tfor (var b in camelColNames) {\n\t\t\t\tb = parseInt(b, 10);\n\t\t\t\tresults[subResult[a][0]][camelColNames[b]] = subResult[a][b+1];\n\t\t\t}\n\t\t\t// searching for every entry that meets ALL the conditions\n\t\t\tsearchResults[a] = [];\n\t\t\tfor (var i in conditions){\n\n\t\t\t\tif (results[subResult[a][0]][Object.keys(conditions[i])] === conditions[i][Object.keys(conditions[i])]) {\n\t\t\t\tsearchResults[a].splice(i,1,true);\n\t\t\t\t}\n\t\t\t\tif(searchResults[a].length === conditions.length){ counter++; }\n\t\t\t}\n\t\t\t//remove id numbers, leaving an array with all possible answers\n\t\t\tsubResult[a].splice(0,1);\n\t\t}\n\t\t// --------- end of results and searching -------- //\n\n\t\t// ============== #figure out how to move this section into the camelCasing part\n\t\tfor(var y in camelColNames){ // this is almost like for (var x=0; x<subResult[0].length; x++) only there should be an adjustmen of x\n\t\t\tpossibleAnswers[camelColNames[y]] = {};\n\t\t\tfor(var z in subResult){\n\t\t\t\tpossibleAnswers[camelColNames[y]][subResult[z][y]] = 0;\n\t\t\t}\n\t\t\tfor (var w in Object.keys(possibleAnswers[camelColNames[y]])){\n\t\t\t\tfor (var r in subResult){\n\t\t\t\t\tif(subResult[r][y] === Object.keys(possibleAnswers[camelColNames[y]])[w]){\n\t\t\t\t\t\tpossibleAnswers[camelColNames[y]][subResult[r][y]] += 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// =====================\n\t\t console.log(results);\n\t\t// console.log(subResult);\n\t\tconsole.log(possibleAnswers);\n\t\t// console.log(colNames);\n\t\t// console.log(searchResults);\n\t\tcounter = null;\n\t\tsearchResults = {};\n\n\t\t// ===================== #graph ========================= //\n\n\t\t// !important: you have to work with the results{{}} for creation of individual cells\n\n\t\t// create a 2d object with all conditions\n\t\t// cross-reference that with the results{{}} i pull from a file\n\n\t\t// start small (one subsection with all genders, whose answers qualify x/y conditions)\n\t\t// build it as many times as needed\n\n\n\n\t\tx = 0;\n\t\tvar k = 0;\n\t\tvar div = null;\n\t\tvar tNode = null;\n\t\tfor(k; k<Object.keys(possibleAnswers.ageGroup).length; k++){\n\t\t\tdiv = document.createElement('div');\n\t\t\ttNode = document.createTextNode(Object.keys(possibleAnswers.ageGroup)[k]);\n\t\t\tdiv.appendChild(tNode);\n\t\t\tdocument.getElementById('x-axis').appendChild(div);\n\t\t}\n\t\tvar lengthOfX = k;\n\n\t\tk=0;\n\t\tvar h = 0;\n\t\tvar subsection = null;\n\t\tvar sections = document.getElementsByClassName('section');\n\t\tvar genderCol = null;\n\n\t\tfor (h=0; h<sections.length; h++){\n\t\t\tfor (k=0; k<lengthOfX; k++){\n\t\t\t\tsubsection = document.createElement('div');\n\t\t\t\tsubsection.className = 'subsection';\n\t\t\t\tsections[h].appendChild(subsection);\n\t\t\t}\n\t\t}\n\t\th=0;\n\t\tk=0;\n\t\ttNode = null;\n\n\t\tvar allSubsections = document.getElementsByClassName('subsection');\n\t\tfor (h=0; h<allSubsections.length;h++){\n\t\t\tfor (x = 0; x<Object.keys(possibleAnswers.gender).length; x++){\n\t\t\t\tgenderCol = document.createElement('div');\n\t\t\t\tgenderCol.className = 'gender-col';\n\t\t\t\tgenderCol.className += ' '+Object.keys(possibleAnswers.gender)[x];\n\t\t\t\tallSubsections[h].appendChild(genderCol);\n\t\t\t}\n\t\t}\n\n\n\n\t\tdiv = null;\n\t\ttNode = null;\n\t\th=0;\n\t\tk=0;\n\t\tvar putAfter = null;\n\t\tfor (k; k< Object.keys(possibleAnswers.vote).length; k++){\n\t\t\tdiv = document.createElement('div');\n\t\t\ttNode = Object.keys(possibleAnswers.vote)[k];\n\t\t\tswitch(tNode){\n\t\t\t\tcase 'yes':\n\t\t\t\t\tdiv.className += ' sec0';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'no':\n\t\t\t\t\tdiv.className += ' sec2';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'maybe':\n\t\t\t\t\tdiv.className += ' sec1';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'not sure':\n\t\t\t\t\tdiv.className += ' sec1';\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tdiv.className += ' sec'+k;\n\t\t\t}\n\t\t\ttNode = document.createTextNode(tNode);\n\t\t\tdiv.appendChild(tNode);\n\t\t\tputAfter = document.getElementById('subtitles');\n\t\t\tputAfter.appendChild(div);\n\n\t\t}\n\t\tk=null;\n\t\th=null;\n\t\tx=null;\n\t\tcounter = null;\n\t\tvar id = null;\n\n\n\t\tfor (k in results){\n\n\t\t\tsearchResults[k] = [];\n\t\t\tfor (h =0; h<graphConditions.length; h++){\n\t\t\t\tfor (x in graphConditions[h]){\n\t\t\t\t\t// console.log(x);\n\t\t\t\t\t// console.log(graphConditions[h][x]);\n\t\t\t\t\t// console.log(results[k][x] +' + '+graphConditions[h][x]);\n\t\t\t\t\t// if (results[k][x] === graphConditions[h][x]){\n\t\t\t\t\t// searchResults[k].splice(h,1,true);\n\t\t\t\t\t// }\n\t\t\t\t\t// if (searchResults[k].length === Object.keys(graphConditions[h]).length){\n\t\t\t\t\t// \tcounter++;\n\t\t\t\t\t// \t// id = searchResults.indexOf(searchResults[k]).toString() + \n\t\t\t\t\t// \t// document.getElementById(id).innerHTML = counter;\n\t\t\t\t\t// }\n\t\t\t\t}\n\t\t\t}\n\t\t\tcounter = null;\n\t\t\t// console.log(searchResults[k]);\n\t\t}\n\n\n\t// ===================== ------ ========================= //\n\t}\n}", "title": "" }, { "docid": "10901bcfa63d791792490f23c397b5d6", "score": "0.4960076", "text": "function getUserIdsByPossibleGoodFilter(cbFun){\n if (limitType=='normal'){\n getUserIdsByRegionAndGender(cbFun);\n return;\n }else{\n self.client.get('user',function(err,userMaxId){\n if (err) return cbFun(err);\n if (!userMaxId) userMaxId = 0;\n else userMaxId = Number(userMaxId);\n var userIds = null;\n if (userMaxId > 0){\n userIds = new Array(userMaxId);\n for(var i=1; i<=userMaxId; i++){\n userIds[i-1] = i;\n }//for\n }\n return cbFun(null,userIds);\n });//client.get\n return;\n }\n return;\n }", "title": "" }, { "docid": "361be586ffb44ab568cbfe24e23bcf1a", "score": "0.4958771", "text": "function continue_visualization(country_totals) {\n\n //Getting CSV-file about Corona virus (change to local CSV if offline)\n $.get(\"https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv\", function(csv_in) {\n\n //Parsing John Hopkins' CSV to array\n var arrayData = $.csv.toArrays(csv_in, {\n onParseValue: $.csv.hooks.castToScalar\n });\n\n\n //Setup empty help-array (transforming raw data)\n var all = [];\n var fr = new Array(arrayData[0].length-3).fill(0);\n var fr_n = [];\n var se = [];\n var it = [];\n\tvar be = [];\n\tvar sa = [];\n\t\tvar sk = [];\n\t\tvar jp = [];\n\t\tvar us = new Array(arrayData[0].length-3).fill(0);\n\t\tvar us_n = [];\n\t\tvar dk = new Array(arrayData[0].length-3).fill(0);\n\t\tvar dk_n = [];\n\t\tvar cn = new Array(arrayData[0].length-3).fill(0);\n\t\tvar cn_n = [];\n\t\tvar ch = [];\n\t\tvar no = [];\n\t\tvar fi = [];\n\t\tvar de = [];\n\t\tvar es = [];\n\t \tvar uk = new Array(arrayData[0].length-3).fill(0);\n\t\tvar uk_n = [];\n\t\tvar totalInfected = 0.00;\n\t\tvar totalInfectedYesterday = 0.00;\n\n\n //Loop through data in order to clean the data and creating different data sets\n for (var i = 0; i < arrayData.length; i++) {\n\n //Get the country column from CSV file\n country = arrayData[i].slice(1, 2)\n\n //Populating subsets\n if (country[0] == \"Sweden\") {\n days = arrayData[i].slice(4, arrayData[i].length); //Taking number of infected for that day\n all.push(country.concat(days)); //Adding data to data set\n se.push(country.concat(days));\n } else if (i == 0) {\n days = arrayData[i].slice(4, arrayData[i].length); //first row, taken for its headers\n all.push(country.concat(days));\n se.push(country.concat(days));\n it.push(country.concat(days));\n fr_n.push(country.concat(days));\n\t\tbe.push(country.concat(days));\n\t\tsa.push(country.concat(days));\n\t\t uk_n.push(country.concat(days));\n\t\t\t\tcn_n.push(country.concat(days));\n\t\t\t\tus_n.push(country.concat(days));\n\t\t\t\tsk.push(country.concat(days));\n\t\t\t\tjp.push(country.concat(days));\n\t\t\t\tdk_n.push(country.concat(days));\n\t\t\t\tch.push(country.concat(days));\n\t\t\t\tno.push(country.concat(days));\n\t\t\t\tfi.push(country.concat(days));\n\t\t\t\tde.push(country.concat(days));\n\t\t\t\tes.push(country.concat(days));\n } else if (country[0] == \"France\") {\n days = arrayData[i].slice(4, arrayData[i].length);\n\t\t\t\tfor (var j = 0; j < fr.length; j++) {\n\t\t\t\t\tfr[j] = fr[j] + days[j];\n\t\t\t\t}\n } else if (country[0] == \"Italy\") {\n days = arrayData[i].slice(4, arrayData[i].length);\n it.push(country.concat(days));\n\t } else if (country[0] == \"South Africa\") {\n days = arrayData[i].slice(4, arrayData[i].length);\n sa.push(country.concat(days));\n } else if (country[0] == \"China\") {\n days = arrayData[i].slice(4, arrayData[i].length);\n\t\t\t\tfor (var j = 0; j < cn.length; j++) {\n\t\t\t\t\tcn[j] = cn[j] + days[j];\n\t\t\t\t}\n } else if (country[0] == \"US\") {\n days = arrayData[i].slice(4, arrayData[i].length);\n\t\t\t\tfor (var j = 0; j < us.length; j++) {\n\t\t\t\t\tus[j] = us[j] + days[j];\n\t\t\t\t}\n } else if (country[0] == \"Korea, South\") {\n days = arrayData[i].slice(4, arrayData[i].length);\n sk.push(country.concat(days));\n } else if (country[0] == \"Japan\") {\n days = arrayData[i].slice(4, arrayData[i].length);\n jp.push(country.concat(days));\n } else if (country[0] == \"Denmark\") {\n days = arrayData[i].slice(4, arrayData[i].length);\n\t\t\t\tfor (var j = 0; j < dk.length; j++) {\n\t\t\t\t\tdk[j] = dk[j] + days[j];\n\t\t\t\t}\n }else if (country[0] == \"Belgium\") {\n days = arrayData[i].slice(4, arrayData[i].length);\n be.push(country.concat(days));\n\t } else if (country[0] == \"Switzerland\") {\n days = arrayData[i].slice(4, arrayData[i].length);\n ch.push(country.concat(days));\n } else if (country[0] == \"Norway\") {\n days = arrayData[i].slice(4, arrayData[i].length);\n no.push(country.concat(days));\n } else if (country[0] == \"Finland\") {\n days = arrayData[i].slice(4, arrayData[i].length);\n fi.push(country.concat(days));\n } else if (country[0] == \"Germany\") {\n days = arrayData[i].slice(4, arrayData[i].length);\n de.push(country.concat(days));\n } else if (country[0] == \"Spain\") {\n days = arrayData[i].slice(4, arrayData[i].length);\n es.push(country.concat(days));\n } else if (country[0] == \"United Kingdom\") {\n days = arrayData[i].slice(4, arrayData[i].length);\n\t\t\t\tfor (var j = 0; j < uk.length; j++) {\n\t\t\t\t\tuk[j] = uk[j] + days[j];\n\t\t\t\t}\n }\n\t\t\t\n\n //Creating the \"total infected\" per country. Some countries have multiple entries, so I had to add them up.\n if (i != 0) {\n if (country_totals[country[0]] == undefined) {\n country_totals[country[0]] = {\n casesToday: parseInt(arrayData[i].slice(arrayData[i].length - 1, arrayData[i].length))\n };\n } else {\n country_totals[country[0]][\"casesToday\"] += parseInt(arrayData[i].slice(arrayData[i].length - 1, arrayData[i].length));\n }\n\t\t\t\ttotalInfected += parseInt(arrayData[i].slice(arrayData[i].length - 1, arrayData[i].length))\n\t\t\t\ttotalInfectedYesterday += parseInt(arrayData[i].slice(arrayData[i].length - 2, arrayData[i].length-1))\n }\n }\n\t\t\n\t\tconsole.log(us_n)\n\t\t\n\t\tdocument.getElementById(\"totalNumbers\").innerHTML = '<b>Total infected in the world: </b>' + '<p style=\"color: red; display: inline;\"> ' + numberWithSpaces(totalInfected).toString() + ' </p> <b>&nbsp&nbsp Percentage increase from yesterday: </b>' + ((totalInfected/totalInfectedYesterday-1)*100).toFixed(1).toString() + \"%\";;\n\t\t\n\t\t//document.getElementById('totalNumbers').innerHTML = \n\t\t//document.getElementById('changeYesterday').innerHTML = ((totalInfected/totalInfectedYesterday-1)*100).toFixed(1) + \"%\";\n\t\t\n\n //The data needs to be transposed in order to be plotted on a line graph\n\t\tcn_n.push([\"China\"].concat(cn));\n\t\tus_n.push([\"US\"].concat(us));\n\t\tfr_n.push([\"France\"].concat(fr));\n\t\tdk_n.push([\"Denmark\"].concat(dk));\n\t \tuk_n.push([\"United Kingdom\"].concat(uk));\n\t\t\n\t\tall.push([\"France\"].concat(fr));\n \n //The data needs to be transposed in order to be plotted on a line graph\n all = all[0].map((col, i) => all.map(row => row[i]));\n se = se[0].map((col, i) => se.map(row => row[i]));\n fr_n = fr_n[0].map((col, i) => fr_n.map(row => row[i]));\n it = it[0].map((col, i) => it.map(row => row[i]));\n\t\tcn_n = cn_n[0].map((col, i) => cn_n.map(row => row[i]));\n\t\tus_n = us_n[0].map((col, i) => us_n.map(row => row[i]));\n\t\tsk = sk[0].map((col, i) => sk.map(row => row[i]));\n\t\tjp = jp[0].map((col, i) => jp.map(row => row[i]));\n\t\tdk_n = dk_n[0].map((col, i) => dk_n.map(row => row[i]));\n\t\tch = ch[0].map((col, i) => ch.map(row => row[i]));\n\t\tno = no[0].map((col, i) => no.map(row => row[i]));\n\t\tfi = fi[0].map((col, i) => fi.map(row => row[i]));\n\t\tde = de[0].map((col, i) => de.map(row => row[i]));\n\t\tes = es[0].map((col, i) => es.map(row => row[i]));\n\t be = be[0].map((col, i) => be.map(row => row[i]));\n\t sa = sa[0].map((col, i) => sa.map(row => row[i]));\n\t \tuk_n = uk_n[0].map((col, i) => uk_n.map(row => row[i]));\n\t\t\n\t\t\n\t\t//document.getElementById(\"container\").innerHTML = fr_n;\n\t\t\n country_totals['China']['casesToday'] = country_totals['China']['casesToday']\n country_totals['United Kingdom']['casesToday'] = country_totals['United Kingdom']['casesToday']\n\t\tcountry_totals['South Korea']['casesToday'] = country_totals['Korea, South']['casesToday']\n\t\tcountry_totals['Czech Republic']['casesToday'] = country_totals['Czechia']['casesToday']\n\t\tcountry_totals['Taiwan']['casesToday'] = country_totals['Taiwan*']['casesToday']\n\n //Prepare data for world map (some data have wrong country name)\n geoArray = [\n ['Country', 'Deaths per 100 000', 'Deaths']\n ] // Headers \n for (const [key, value] of Object.entries(country_totals)) {\n\t\t\ttry {\n\t\t\t geoArray.push([key, 100000*(parseInt(value[\"casesToday\"])/value[\"population\"]), value[\"casesToday\"]])\n\t\t\t}\n\t\t\tcatch(err) {\n\t\t\t geoArray.push([key, 0])\n\t\t\t}\n }\n\t\t\n\t\tfor (var i = 0; i < geoArray.length; i++) {\n\t\t\tgeoArray[i][0] = geoArray[i][0] || 0\n\t\t\tgeoArray[i][1] = geoArray[i][1] || 0\n\t\t\tif (geoArray[i][0] == \"Others\") {\n\t\t\t\tgeoArray[i][1] = geoArray[i][1] = 0\n\t\t\t} else if (geoArray[i][0] == \"San Marino\") {\n\t\t\t\tgeoArray[i][1] = geoArray[i][1] = 0\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t //document.getElementById(\"container\").innerHTML = geoArray;\n\t\t\n var geodata = google.visualization.arrayToDataTable(geoArray); //Now the data has been loaded for map.\n\n //Draw line chart\n var options_line = {\n lineWidth: 2,\n pointSize: 5,\n animation: {\n startup: true,\n duration: 1200,\n easing: 'in'\n }\n };\n var data = new google.visualization.arrayToDataTable(all);\n var chart = new google.visualization.LineChart(document.getElementById('canvas'));\n chart.draw(data, options_line);\n\t\t\n\t\tvar mySelect = document.getElementById('mySelect');\n\n\t\tmySelect.onchange = function() {\n\t\t var x = document.getElementById(\"mySelect\").value;\n switch (x) {\n case 'all':\n var data = new google.visualization.arrayToDataTable(all);\n var chart = new google.visualization.LineChart(document.getElementById('canvas'));\n chart.draw(data, options_line);\n\t\t \t\t document.getElementById(\"learn-more\").innerHTML = '';\n\t\t\t\t document.getElementById(\"growth-factor\").innerHTML = '';\n\t\t\t\t \n break;\n case 'it':\n\t\t\t\t drawCanvas(it, options_line);\t\t\t\t \n break;\n case 'fr':\n\t\t\t\t drawCanvas(fr_n, options_line);\t\t\t\t \n break;\n case 'se':\n\t\t\t\t drawCanvas(se, options_line);\t\t\t\t \n break;\n case 'sk':\n\t\t\t\t drawCanvas(sk, options_line);\t\t\t\t \n break;\n case 'cn_n':\n\t\t\t\t drawCanvas(cn_n, options_line);\t\t\t\t \n break;\n case 'us_n':\n\t\t\t\t drawCanvas(us_n, options_line);\t\t\t\t \n break;\n case 'jp':\n\t\t\t\t drawCanvas(jp, options_line);\t\t\t\t \n break;\n case 'dk':\n\t\t\t\t drawCanvas(dk_n, options_line);\t\t\t\t \n break;\n case 'ch':\n\t\t\t\t drawCanvas(ch, options_line);\t\t\t\t \n break;\n case 'no':\n\t\t\t\t drawCanvas(no, options_line);\t\t\t\t \n break;\n case 'fi':\n\t\t\t\t drawCanvas(fi, options_line);\t\t\t\t \n break;\n\t case 'uk':\n\t\t\t\t drawCanvas(uk_n, options_line);\t\t\t\t \n break;\n case 'de':\n\t\t\t\t drawCanvas(de, options_line);\t\t\t\t \n break;\n\t case 'sa':\n\t\t\t\t drawCanvas(sa, options_line);\t\t\t\t \n break;\n\t case 'be':\n\t\t drawCanvas(be, options_line);\t\t\t\t \n break;\n case 'es':\n\t\t\t\t drawCanvas(es, options_line);\t\t\t\t \n break;\n\t\t\t }\n\t\t\t \n\t\t }\n\n //Draw geograph\n var options_geograph = {\n colorAxis: {\n colors: ['orange', 'red']\n },\n\t\t\tsizeAxis: {minValue: 2, maxValue: 20}\n }\n var chart = new google.visualization.GeoChart(document.getElementById('regions_div'));\n chart.draw(geodata, options_geograph);\n\n //Populate table, but first delete wierd countries\n delete country_totals['Mainland China'];\n delete country_totals['UK'];\n delete country_totals['Others'];\n delete country_totals['Vatican City'];\n delete country_totals['Macau'];\n delete country_totals['Monaco'];\n delete country_totals['San Marino'];\n delete country_totals['Saint Barthelemy'];\n\n\n for (const [key, value] of Object.entries(country_totals)) {\n addRow(key, value[\"population\"], value[\"casesToday\"])\n }\n\n });\n}", "title": "" }, { "docid": "a4f0e5ebb1e91be4ac6c852142530c99", "score": "0.4957509", "text": "function readFile() {\n let input = document.getElementById(\"csvfile\").files[0];\n let config = {\n delimiter: \",\",\n quoteChar: '\"',\n header: true,\n\t\ttrimHeaders: true,\n\t\tcomplete: function(results) {\n countClass(results.data);\n console.log(results.data)\n // countPrefPerClass(results.data);\n // countExperiencedMentors(results.data);\n data1 = results.data;\n bruteForce(results.data);\n },\n error: errorFn,\n transform: function(value, header) {\n switch (header){\n case \"Do you have a Working With Children Check?\":\n case \"Have you had experience mentoring with Ignite?\":\n case \"Do you have both a license and a car to drive to classes?\":\n value = (value == \"Yes\") ? true : false;\n break;\n }\n return value;\n }\n };\n\n\tlet results = Papa.parse(input, config);\t\n}", "title": "" }, { "docid": "02bb24cc5204e5714b866e759cf83052", "score": "0.49543092", "text": "function getCuisineFromFilter(filterParams, data) {\n\tlet cuisines = [];\n\tlet restaurantData = [];\n\tfor (let key in filterParams) {\n\t\tlet split = key.split(\"-\");\n\t\tif (split[0] == \"cuisine\") cuisines.push(split[1]);\n\t}\n\n\tif (cuisines.length == 0) {\n\t\treturn data;\n\t} else {\n\t\tfor (let cuisine in cuisines) {\n\t\t\tfor (let key in data) {\n\t\t\t\tif (data[key].typeOfCuisine.indexOf(cuisines[cuisine]) > -1) {\n\t\t\t\t\trestaurantData.push(data[key]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn restaurantData;\n\t}\n}", "title": "" }, { "docid": "ad684272b12e3ab9a34f4ac33f48bee1", "score": "0.49530718", "text": "function dataUpdate() {\n if(filterData.length > 0) {\n data = [];\n filterData.map(row => {\n data.push({\n brand: row.Brand,\n values: [\n parseInt(row[\"BF_1 - Aided brand awareness\"].slice(0, -1)),\n parseInt(row[\"BF_2 - Brand consideration\"].slice(0, -1)),\n parseInt(row[\"BF_3 - Brand usage\"].slice(0, -1)),\n parseInt(row[\"BF_4 - Brand preference\"].slice(0, -1))\n ],\n variations: [\n row[\"AidedAwarenessVariation\"],\n row[\"ConsiderationVariation\"],\n row[\"UsageVariation\"],\n row[\"PreferenceVariation\"]\n ]\n });\n });\n\n rows = filterData.length;\n console.log(data);\n }\n }", "title": "" }, { "docid": "59a5ac66ca9bcb15e448e362607455d8", "score": "0.49461138", "text": "function extractCustomInfluencers() {\n const allInfluencersList = $scope.ui.influencers;\n $scope.ui.customInfluencers = _.difference($scope.job.analysis_config.influencers, allInfluencersList);\n console.log('extractCustomInfluencers: ', $scope.ui.customInfluencers);\n }", "title": "" }, { "docid": "81f5b68dbe907a5a9a0e482658916cc1", "score": "0.49379432", "text": "function genFilteredData(){\n /*Filtering the system data */\n var filterDataArr = [];\n var filterControllerObj;\n for (var keyController in mainData.controllers) {\n var controllerObj = mainData.controllers[keyController];\n filterControllerObj = window[keyController][controllerObj.filter](data,domainData);\n filterDataArr.push(filterControllerObj.data);\n console.log(\"Done filtering: \"+keyController);\n }\n delete data['filteredData'];\n for (var i = 0; i < filterDataArr.length; i++) {\n updateData(filterDataArr[i],\"update\");\n }\n}", "title": "" }, { "docid": "47176f0618c08c50cf7bdd94e0d33c02", "score": "0.49356282", "text": "function createTable(){\n var p=document.createElement(\"p\");\n p.setAttribute(\"class\",\"enterpruner-table-title\");\n p.appendChild(document.createTextNode(\"Enterpreuner Details: \"));\n document.getElementById(\"enterpreuner-table-container\").appendChild(p);\n var table = document.createElement(\"table\");\n table.setAttribute(\"id\",\"enterpreunerTable\");\n var tr=document.createElement(\"tr\");\n table.appendChild(tr);\n\n var csvtxt = (document.getElementById('enterpreuner').value).split(\",\");\n for (var i = 0; i < 4; i++) {\n var th = document.createElement('th');\n th.appendChild(document.createTextNode(csvtxt[i]));\n tr.appendChild(th);\n }\n var th = document.createElement('th');\n th.appendChild(document.createTextNode(\"Remove Marker\"));\n tr.appendChild(th);\n\n // var th=document.createElement(\"th\");\n // th.appendChild(document.createTextNode(enterpreunerArray[0].Id));\n // tr.appendChild(th);\n // var th=document.createElement(\"th\");\n // th.appendChild(document.createTextNode(enterpreunerArray[0].Company));\n // tr.appendChild(th);\n // var th=document.createElement(\"th\");\n // th.appendChild(document.createTextNode(enterpreunerArray[0].Name));\n // tr.appendChild(th);\n // var th=document.createElement(\"th\");\n // th.appendChild(document.createTextNode(enterpreunerArray[0].City));\n // tr.appendChild(th);\n\n for (var i = 1; i < enterpreunerArray.length; i++) {\n var tr=document.createElement(\"tr\");\n table.appendChild(tr);\n var td=document.createElement(\"td\");\n td.appendChild(document.createTextNode(enterpreunerArray[i].Id));\n tr.appendChild(td);\n var td=document.createElement(\"td\");\n td.appendChild(document.createTextNode(enterpreunerArray[i].Company));\n tr.appendChild(td);\n var td=document.createElement(\"td\");\n td.appendChild(document.createTextNode(enterpreunerArray[i].Name));\n tr.appendChild(td);\n var td=document.createElement(\"td\");\n td.appendChild(document.createTextNode(enterpreunerArray[i].City));\n tr.appendChild(td);\n var td=document.createElement(\"td\");\n var a=document.createElement(\"a\");\n a.href=\"#\";\n a.id=enterpreunerArray[i].Id;\n a.setAttribute(\"onclick\",\"deleteMarkers(\"+enterpreunerArray[i].Id+\")\");\n a.appendChild(document.createTextNode(\"Remove\"));\n td.appendChild(a);\n tr.appendChild(td);\n }\n document.getElementById(\"enterpreuner-table-container\").appendChild(table);\n}", "title": "" }, { "docid": "34707132c76b12ea953544636d6519b2", "score": "0.49257272", "text": "function showUsersFiles(user) {\r\n FileManagerTool.lastShowUserFiles = user\r\n\r\n FileManagerTool.fileCont.selectAll('*').remove()\r\n var subsetUserfiles = userfiles\r\n\r\n if (user !== true) {\r\n if (userfiles.hasOwnProperty(user)) {\r\n subsetUserfiles = [subsetUserfiles[user]]\r\n } else {\r\n subsetUserfiles = []\r\n console.warn('User ' + user + ' not found!')\r\n }\r\n }\r\n\r\n for (var u in subsetUserfiles) {\r\n for (var f in subsetUserfiles[u]) {\r\n if (\r\n FileManagerTool.filterString.length == 0 ||\r\n subsetUserfiles[u][f].match(\r\n new RegExp(FileManagerTool.filterString, 'i')\r\n )\r\n ) {\r\n var safeId = 'fmFile_' + (u + f).replace(/\\w\\s/gi, '_')\r\n var c = FileManagerTool.fileCont\r\n .append('li')\r\n .attr('id', safeId)\r\n .attr('class', 'item customColor1')\r\n .style('display', 'flex')\r\n .style('border-bottom', '1px solid #333')\r\n .style('background-color', 'rgba(0,0,0,0.25)')\r\n .style('border-radius', '0px')\r\n .style('height', '24px')\r\n .style('line-height', '24px')\r\n .style('cursor', 'pointer')\r\n\r\n c.append('div')\r\n .attr('class', 'content')\r\n .style('float', 'left')\r\n .style('flex', '1')\r\n .append('div')\r\n .attr('class', 'header')\r\n .style('max-width', '181px')\r\n .attr('title', u)\r\n .style('color', '#CCC')\r\n .html(subsetUserfiles[u][f])\r\n .on(\r\n 'click',\r\n (function (u, f, safeId) {\r\n return function () {\r\n $('#fmcfList .item').css({\r\n 'background-color': 'rgba(0,0,0,0.25)',\r\n })\r\n if (FileManagerTool.activeFileId != safeId) {\r\n $('#fmcfList #' + safeId).css({\r\n 'background-color':\r\n 'rgba(7,144,173,0.55)',\r\n })\r\n\r\n getFileOptions(u, f)\r\n FileManagerTool.activeFileId = safeId\r\n } else {\r\n FileManagerTool.T_.setToolWidth(\r\n FileManagerTool.widths[0]\r\n )\r\n hideFilesOptions()\r\n FileManagerTool.activeFileId = null\r\n }\r\n }\r\n })(user !== true ? user : u, f, safeId)\r\n )\r\n\r\n //Mark\r\n $('#' + safeId).unmark({\r\n done: function () {\r\n if (FileManagerTool.filterString.length > 0)\r\n $('#' + safeId).markRegExp(\r\n new RegExp(FileManagerTool.filterString, 'i'),\r\n {}\r\n )\r\n },\r\n })\r\n\r\n var b = c\r\n .append('div')\r\n .attr('class', 'mmgisRadioBar')\r\n .style('height', '16px')\r\n .style('float', 'right')\r\n b.append('div')\r\n .attr('id', 'fmFileAdd_' + f.replace(/\\w\\s/gi, '_'))\r\n .style('margin', '0')\r\n .style('margin-top', '3px')\r\n .style('height', '16px')\r\n .style('line-height', '16px')\r\n .style(\r\n 'background-color',\r\n L_.addedfiles.hasOwnProperty(f) &&\r\n L_.addedfiles[f]['layer'] != null\r\n ? '#dfebef'\r\n : '#111'\r\n )\r\n .html(\r\n L_.addedfiles.hasOwnProperty(f) &&\r\n L_.addedfiles[f]['layer'] != null\r\n ? 'on'\r\n : 'off'\r\n )\r\n .on(\r\n 'click',\r\n (function (u, f) {\r\n return function () {\r\n if (\r\n L_.addedfiles.hasOwnProperty(f) &&\r\n L_.addedfiles[f]['layer'] != null\r\n ) {\r\n removeFile(u, f)\r\n } else {\r\n addFile(u, f)\r\n }\r\n }\r\n })(user !== true ? user : u, f)\r\n )\r\n }\r\n }\r\n }\r\n}", "title": "" }, { "docid": "8f6e208a2534304f00751cd5c934f6ad", "score": "0.49196362", "text": "initDataFromCSV() {\n this.setState({\n data: dataTable.map((prop, key) => {\n return this.produceUser(prop[0], prop[1], prop[2]);\n })\n });\n }", "title": "" }, { "docid": "b91a828fa79ca4a4aac746daf1d465c6", "score": "0.4916049", "text": "function buildAnalysis(){\n var li=d3.select(\"#analysis\")\n // append\n var dropdownMenuValue=d3.selectAll(\"#selDataset\").node().value;\n d3.csv(\"../static/js/data.csv\").then(test=>{\n console.log(test)\n var filteredData=test.filter(row=>row.cityID==dropdownMenuValue)[0]\n console.log(filteredData.intro)\n\n intro=filteredData.intro\n var p=d3.select(\"#fun-facts\")\n p.text(intro)\n\n analysis=filteredData.analysis\n li.text(analysis)\n \n })\n}", "title": "" }, { "docid": "c2d840814c997aa0b64785b247823762", "score": "0.49155164", "text": "function filterPostRequestedData(txtDocument, checkbox_array, sensorID) {\n\tvar resultsDiv = document.getElementById(\"results\");\n\t//\tstartDisplaySetting(resultsDiv, false); //start div as hidden.\n\tvar resultObj = JSON.parse(txtDocument);\n\tbuildFullTable(resultObj, resultsDiv, sensorID);\n\n\n\tfor (var i = 0; i < checkbox_array.length; i++) {\n\t\tcheckbox = checkbox_array[i];\n\t\tcolumn = 0;\n\t\tif (checkbox.checked) {\n\t\t\tif (validatesCorrectCheckboxes(checkbox, sensorID) === 2) {\n\t\t\t\tvar div = checkbox.parentElement.nextElementSibling;\n\t\t\t\tfilterResults(div, resultsDiv);\n\t\t\t}\n\t\t}\n\t}\n\ttoggleFacetsMenu();\n\tshowDiv(resultsDiv);\n}", "title": "" }, { "docid": "fee04507bf897623795678900573172a", "score": "0.49088347", "text": "function filterUserCommunitData() {\n const newUserCommunitData = communityData.filter((item) => {\n if (item.city.toLowerCase() == property.city.toLowerCase()) {\n return item;\n }\n });\n setCommunities(newUserCommunitData);\n }", "title": "" }, { "docid": "f431761ad180251dc4ff192962a2078f", "score": "0.49086875", "text": "function traerAvisosFiltro(){\n $rootScope.chatUsers = [];\n var id_usuario = $rootScope.loggedUser.id_usuario;\n $http.get('/api/avisos/' + id_usuario).success(function(response){\n if (response[0] === undefined) {\n }else {\n for (var i = 0; i < response[0].chatUsers.length; i++) {\n $rootScope.chatUsers.splice(0, 0, response[0].chatUsers[i]);\n }\n }\n })\n }", "title": "" }, { "docid": "5dd4c40aa55506963afc5cee5b13d1df", "score": "0.49056283", "text": "prepareCSVData() {\n\n let csvRows = [];\n let csvHeader = [];\n\n // Set the header of CSV\n for (var key in this.dataSet[0]) {\n csvHeader.push(key);\n }\n csvRows.push(csvHeader);\n\n // Set the row data of CSV\n this.dataSet.forEach((item) => {\n let csvRowTmp = [];\n for (key in item) {\n // TBD: special handle scopeOfWork property since it includes a rich text\n if (key === 'scopeOfWork' && item[key] != null ) {\n let tmpStr = item[key].replaceAll(',', Comma_Replacement).replaceAll('\\n', Enter_Replacement);\n csvRowTmp.push( tmpStr );\n }else{\n csvRowTmp.push( item[key] );\n }\n }\n csvRows.push(csvRowTmp);\n })\n return csvRows;\n }", "title": "" }, { "docid": "d83abdae0d64b5cf0c2bacad5fcd7833", "score": "0.49007905", "text": "function compromised_users_html_data(data, revision)\n{\n var users = get_unique_users(data);\n var results = [];\n\n for(var user in users) {\n results.push(get_user_data(users[user], revision));\n }\n\n results.sort(sort_by_inicidents);\n return results;\n}", "title": "" }, { "docid": "5a577cf30d98ec20fd7e2c5769b15d66", "score": "0.48947915", "text": "processData(phil, lang, spec) {\n let result = [];\n csv.parse(phil, (error, data) => {\n result = result.concat(data.splice(1, data.length)).map((d) => {\n d.push(\"phil\");\n return d;\n });\n csv.parse(lang, (error, data) => {\n result = result.concat(data.splice(1, data.length)).map((d) => {\n d.push(\"lang\");\n return d;\n });\n csv.parse(spec, (error, data) => {\n result = result.concat(data.splice(1, data.length)).map((d) => {\n d.push(\"spec\");\n return d;\n });\n this.processResult(this.filterResult(result));\n });\n });\n });\n }", "title": "" }, { "docid": "a66d245033f46f01af71c39f94c6b061", "score": "0.48921382", "text": "function dataFilter() {\n \n //make a safe copy\n let filteredArray = myData.slice();\n \n // getting the word typed in the input elementt\n let filterWord = document.getElementById('filter').value;\n \n // use a filter tool\n filteredArray = filterArray(filteredArray, filterWord);\n \n // re-using the sort by type tool\n let sortedArray = sortByType(filteredArray);\n\n // re-using the show data tool\n showData(sortedArray, filteredDisplay);\n\n}", "title": "" }, { "docid": "26ba4d66bdb0fc4fd5b47c9ecabab85e", "score": "0.4891318", "text": "function convert_to_csv (user_selection)\r\n{\r\n\t// if nothing selected, then output entire table\r\n\tvar rows_to_output = [];\r\n\tif (user_selection.length == 0) {\r\n\r\n\t\t// get indices of every row in the table\r\n\t\tfor (var i = 0; i < num_rows; i++) {\r\n\t\t\trows_to_output.push(i);\r\n\t\t}\r\n\t} \r\n\telse {\r\n\t\trows_to_output = user_selection;\r\n\t}\r\n \r\n\t// look for extra commas and warn user\r\n\tvar extra_commas_found = false;\r\n\r\n\t// output data in data_view (sorted as desired by user) order\r\n\tvar csv_output = \"\";\r\n\r\n\t// output headers\r\n\tfor (var i = 0; i < (num_cols + num_editable_cols); i++) {\r\n\t\tvar header_name = grid_columns[i].name;\r\n\r\n\t\t// check for commas in column header\r\n\t\tif (header_name.indexOf(\",\") != -1) {\r\n\t\t\textra_commas_found = true;\r\n\t\t}\r\n\r\n\t\t// strip any commas and add to csv header\r\n\t\tcsv_output += header_name.replace(/,/g,\"\") + \",\";\r\n\t }\r\n\r\n\t// remove last comma, end line\r\n\tcsv_output = csv_output.slice(0,-1) + \"\\n\";\r\n\r\n\t// output data\r\n\tfor (var i = 0; i < num_rows; i++) {\r\n\r\n\t\t// get slick grid table data\r\n\t\tvar item = grid_view.getDataItem(i);\r\n\r\n\t\t// get selection index\r\n\t\tvar sel_i = item[item.length-2];\r\n\r\n\t\t// check if data is in the selection\r\n\t\tif (rows_to_output.indexOf(sel_i) != -1) {\r\n\r\n\t\t\t// sanitize row (remove commas)\r\n\t\t\tvar csv_row = [];\r\n\t\t\tfor (var j = 0; j < (num_cols + num_editable_cols); j ++) {\r\n\r\n\t\t\t\t// check for commas for later warning\r\n\t\t\t\tif (String(item[j]).indexOf(\",\") != -1) {\r\n\t\t\t\t\textra_commas_found = true;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// strip commas\r\n\t\t\t\tcsv_row.push(String(item[j]).replace(/,/g, \"\"));\r\n\t\t\t}\r\n\r\n\t\t\t// add row to csv output\r\n\t\t\tcsv_output += csv_row + \"\\n\";\r\n\t\t}\r\n\t}\r\n\r\n\t// produce warning if extra commas were detected\r\n\tif (extra_commas_found) {\r\n\t\t dialog.ajax_error(\"Warning. Commas were detected in the table data text and will be removed in the .csv output file.\")\r\n\t\t\t(\"\",\"\",\"\");\r\n\t}\r\n\treturn csv_output;\r\n}", "title": "" }, { "docid": "c5adb5c1bbe05c29d1bac9ed489fd1b2", "score": "0.48861203", "text": "function addFriendsToArray() {\r\n\r\n // Selects the friends items\r\n grabFriends = select('#read_result');\r\n\r\n // Selects the Friends Themselves\r\n friendsList = grabFriends.elt;\r\n\r\n // When additional users login (after the first)\r\n // Splits the friends into a new array and adds them to the already established 'friendsArray'\r\n if (isFriendsArrayEstablished == true) {\r\n //Splits Elements, Establishes Array\r\n additionalFriendsArray = split(friendsList.innerHTML, '<br>');\r\n //Pushes this array to our master array.\r\n Array.prototype.push.apply(friendsArray, additionalFriendsArray);\r\n };\r\n\r\n // On the first run, splits the 'friendsList' into usable strings and puts it into an array\r\n // Then changes the isFriendsArrayEstablished to 'true' so we don't overwrite our array \r\n // This is the master array that is used for display purposes\r\n if (isFriendsArrayEstablished == false) {\r\n\r\n //Splits Elements, Establishes Array\r\n friendsArray = split(friendsList.innerHTML, '<br>');\r\n //Turns off this function from being able to run again\r\n isFriendsArrayEstablished = true;\r\n };\r\n\r\n}", "title": "" }, { "docid": "a196006ab52445ada5a4418060a474b3", "score": "0.4882991", "text": "function setupCsvData() {\n d3.csv(\"./data/flying-etiquette.csv\", function(data) {\n processDotsData(data);\n //this loop saves all answers form the dataset into a temporary array that can then be sorted and provides the output we need, the first column of the data is an id, which is irrelevant at this point, so the loop starts at 1\n for(let i = 1; i < data.columns.length; i++){\n //this saves the data needed for the outer ring in a seperate array\n columnsData.push(data.columns[i]);\n \n //creates a list of all the answers from every participant for a single question\n for(let j = 0; j < data.length; j++){\n tempData.push(data[j][data.columns[i]]);\n }\n \n countArrayElements(tempData, data.columns[i]);\n //reset the temporary list of answers for the next loop\n tempData = [];\n }\n });\n }", "title": "" }, { "docid": "39d52a510ef49bffe852b4ce9762483f", "score": "0.48793417", "text": "getContactUsers(userArr) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tlet resArr = new Array;\n\n\t\t\tuserArr.forEach(element => {\n\n\t\t\t\tlet sql = \"SELECT username, bio, main_image, email, userID FROM users WHERE username = ?\";\n\t\t\t\tlet inserts = [element.contact];\n\t\t\t\tsql = mysql.format(sql, inserts);\n\t\t\t\tlet usr = this.query(sql);\n\n\t\t\t\tusr.then(function (ret) {\n\t\t\t\t\tresArr.push(ret[0]);\n\t\t\t\t}, function (err) {\n\t\t\t\t\tconsole.log('Unable To Obtain User');\n\t\t\t\t\treject(\"Failed to validate query.\");\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tsleep(1000).then(() => {\n\t\t\t\tresolve(resArr);\n\t\t\t});\n\t\t\t\n\t\t});\n\t}", "title": "" }, { "docid": "9f70f7675b56c3c92b57fd56035ccd85", "score": "0.48655757", "text": "function dataClean(newVal, continentOrCountry) {\r\n var data = [];\r\n var temp = {funded:{}, ps:{}, unfunded:{}};\r\n\r\n newVal.forEach(function (crs) {\r\n\r\n var region = crs[continentOrCountry].trim();\r\n var key = crs.isFunded;\r\n //first, create network: {region:0} for each network\r\n Object.keys(temp).forEach (function (category) {\r\n if (temp[category][region] == undefined) {\r\n temp[category][region] = 0;\r\n }\r\n })\r\n // for the matched category and region, plus 1\r\n temp[key][region] ++;\r\n\r\n })\r\n\r\n //from temp create wanted data format\r\n Object.keys(temp).forEach (function (category) {\r\n \r\n var obj =[];\r\n var Locations=Object.keys(temp[category]).sort();\r\n \r\n for (var i in Locations){\r\n var location = Locations[i];\r\n\r\n var element = {x:location, y:temp[category][location]}\r\n obj.push(element);\r\n }\r\n data.push(obj);\r\n\r\n })\r\n \r\n return data; \r\n\r\n }", "title": "" }, { "docid": "e9d43ac49f28c8dba67ca924e64b22f4", "score": "0.48643285", "text": "async function main(userInput) {\n /* If you don't want to fix the links, but want to only search the courses with the old url, then set discoverOnly to true */\n /* Set discoverOnly and the file path to the user input */\n var discoverOnly = userInput.discoverOnly;\n var filePath = userInput.path;\n\n /* Get an array of each courses' id and name from the CSV */\n const courses = await getCourses(filePath);\n\n var csvData = [];\n\n /* Make the fix, one course at a time */\n for (var i = 0; i < courses.length; i++) {\n var logItems = await courseLogic(courses[i], discoverOnly);\n console.log('logItems', logItems);\n csvData.push(logItems);\n }\n\n /* Log it all */\n logger.consoleReport();\n logger.htmlReport('./reports/html-reports');\n logger.jsonReport('./reports/json-reports');\n\n var csvReport = d3.csvFormat(csvData, [\"Course Name\", \"Course ID\", \"Module ID\", \"Module Item ID\", \"URL Before Change\", \"Verified New URL\", \"Link to Module Item\"]);\n fs.writeFile('canvasLinkReplacementReport.csv', csvReport, (err) => {\n if (err) {\n console.error(err);\n logger.error(err);\n }\n });\n}", "title": "" }, { "docid": "3128b9b4ac187873500b0908ae2b52e3", "score": "0.48634326", "text": "function filterResult() {\r\n //show the gender block\r\n document.getElementById('gender-block').style.display = 'block';\r\n\r\n // Select radio button as both\r\n if(genderValue === 'both') {\r\n document.getElementById('both-val').checked = true;\r\n }\r\n\r\n var filteredArray = []; //Filtered Data\r\n\r\n // Get Selected start year value\r\n var start_year_value = document.getElementById(\"year-list-start\");\r\n var start_year = start_year_value.options[start_year_value.selectedIndex].value; // get the user entered value for start year\r\n\r\n // Get Selected end year value\r\n var end_year_value = document.getElementById(\"year-list-end\");\r\n var end_year = end_year_value.options[end_year_value.selectedIndex].value; // get the user entered value for end of year\r\n\r\n // Get Selected Category value\r\n var categories = document.getElementById(\"category-value\");\r\n var category = categories.options[categories.selectedIndex].value; // get the category entered value\r\n\r\n\r\n // check if start year value and end year value is present and start year value is less than or equal to end year\r\n if(start_year && end_year) {\r\n if(start_year <= end_year) {\r\n\r\n // Get table attributes\r\n var elmtTable = document.getElementById('table-value');\r\n var tableRows = elmtTable.getElementsByTagName('tr');\r\n var rowCount = tableRows.length;\r\n\r\n // clear all the previous data from table\r\n for (var x=rowCount-1; x>0; x--) {\r\n document.getElementById(\"table-value\").deleteRow(x);\r\n }\r\n\r\n for (var i = 0; i < prizesData.length; i++) {\r\n // If category value is not entered\r\n if (prizesData[i].year >= start_year && prizesData[i].year <= end_year && category === '') {\r\n filteredArray.push(prizesData[i]) //Store the result in filtered array\r\n }else if (prizesData[i].year >= start_year && prizesData[i].year <= end_year && category === prizesData[i].category) {\r\n filteredArray.push(prizesData[i]) //Store the result in filtered array\r\n }\r\n }\r\n\r\n // Call the genderFunction\r\n var dataFromGenderCall = genderFilter(filteredArray);\r\n\r\n\r\n // check if array contains any object or not\r\n if(dataFromGenderCall.length > 0) {\r\n // Display the table\r\n document.getElementById(\"table-value\").style.display = 'table';\r\n var table = document.getElementsByTagName('table')[0];\r\n var nameValue= '';\r\n\r\n // Append new row with data\r\n dataFromGenderCall.forEach(function(data, outerindex) {\r\n var filtered_table = table.insertRow(outerindex + 1);\r\n var cel1 = filtered_table.insertCell(0);\r\n var cel2 = filtered_table.insertCell(1);\r\n var cel3 = filtered_table.insertCell(2);\r\n var cel4 = filtered_table.insertCell(3);\r\n nameValue = '';\r\n data.laureates.forEach(function(innerdata) {\r\n if(genderValue !== \"both\" && genderValue === innerdata.gender){\r\n cel1.innerHTML = data.year;\r\n cel2.innerHTML = data.category;\r\n nameValue += '<br>' + `<a id=\"${innerdata.id}\"\r\n onclick=\"openModal(document.getElementById(${innerdata.id}))\" class=\"name\"> Name: </a>`\r\n + innerdata.firstname+ ' ' + innerdata.surname+ '\\n'+ '<br><b style=\"color: #662200\"> Motivation:</b>'+ innerdata.motivation + '<br>';\r\n cel3.innerHTML = nameValue;\r\n cel4.innerHTML = innerdata.id;\r\n cel4.style.display = 'none';\r\n }\r\n\r\n if(genderValue === 'both') {\r\n cel1.innerHTML = data.year;\r\n cel2.innerHTML = data.category;\r\n nameValue += '<br>' + `<a id=\"${innerdata.id}\" \r\n onclick=\"openModal(document.getElementById(${innerdata.id}))\" class=\"name\"> Name: </a>`\r\n + innerdata.firstname+ ' ' + innerdata.surname+ '\\n'+ '<br><b style=\"color: #662200\">Motivation: </b>'+ innerdata.motivation+ '<br>';\r\n cel3.innerHTML = nameValue;\r\n cel4.innerHTML = innerdata.id;\r\n cel4.style.display = 'none';\r\n }\r\n\r\n });\r\n // If cell vale is empty remove it\r\n if(!cel1.innerHTML) {\r\n cel1.remove();\r\n cel2.remove();\r\n cel3.remove();\r\n cel4.remove();\r\n }\r\n });\r\n\r\n var row =table.getElementsByTagName(\"tr\")[1];\r\n if(row.getElementsByTagName(\"td\")[0] === undefined){\r\n document.getElementById(\"table-value\").style.display = 'none';\r\n alert('Sorry No result found')\r\n }\r\n } else {\r\n // If filtered result not found\r\n document.getElementById(\"table-value\").style.display = 'none';\r\n alert('Sorry No result found')\r\n }\r\n\r\n } else {\r\n // If starting year is greater than end year value\r\n document.getElementById(\"table-value\").style.display = 'none';\r\n document.getElementById('gender-block').style.display = 'none';\r\n alert('Please check your year range');\r\n }\r\n }else{\r\n // If starting year or End year value is not present\r\n document.getElementById(\"table-value\").style.display = 'none';\r\n document.getElementById('gender-block').style.display = 'none';\r\n alert('Please select starting and ending year');\r\n }\r\n\r\n\r\n}", "title": "" }, { "docid": "eb9eafed68a460990d9951db8dbea4f6", "score": "0.48623008", "text": "getRemovedUsers () {\n\t\treturn this.users.slice(1).map(data => data.user);\n\t}", "title": "" }, { "docid": "f382b567be4f58d9d98086fd5cb39f9a", "score": "0.4861767", "text": "function buildUsers() {\n var arr = [];\n while(arr.length < array.settings.numberUsers){\n var r = array.personas.user[Math.floor(Math.random() * array.personas.user.length)];\n if(arr.indexOf(r) === -1) arr.push(r);\n }\n for (i = 0; i < arr.length; i++) {\n var seenDate = new Date(new Date() - (arr[i].daysFirstSeen*24*60*60*1000));\n var joinDate = new Date(new Date() - (arr[i].daysJoined*24*60*60*1000));\n var lastDate = new Date(new Date() - (Math.random()*24*60*60*1000));\n if(i < array.settings.numberKnown) {\n var row = {\n \"user\": {\n \"id\": arr[i].name,\n \"attributes\":{\"emailAddress\": arr[i].emailAddress,\"sfmcContactKey\": arr[i].contactKey,\"dateFirstSeen\": seenDate,\"dateJoined\": joinDate,\"dateLastSeen\": lastDate,\"autoGenerate\": true}\n }\n }\n } else {\n var row = {\n \"user\": {\n \"anonId\": createID(),\n \"attributes\":{ \"dateFirstSeen\": seenDate, \"dateLastSeen\": lastDate, \"autoGenerate\": true}\n }\n }\n }\n // pick a random Product\n var pickedItems = pickItems();\n row.user.attributes.items = pickedItems;\n row.user.attributes.category = pickedItems[0].category;\n array.users.push(row);\n }\n}", "title": "" }, { "docid": "965ba7777c6b7e5cab2da0ba84a62524", "score": "0.48606077", "text": "function ScanUsers() {\n let namesArr = [];\n\n for (i = 0; i < UsersArr.length; i++) {\n namesArr.push(UsersArr[i].user)\n }\n\n return namesArr;\n}", "title": "" }, { "docid": "6373e98a0b75113f57539e5eb8cd51f4", "score": "0.4858018", "text": "function processData(filter) {\n\t// Apply range filter\n\tvar min = filter.min > 0 ? filter.min - 1 : 1;\n\tvar max = filter.max;\n\n\tvar tmp = [];\n\tvar c = 0;\n\tData = tmp;\n\tvar dIndex = null;\n\n\tfor (var i = min; i < max; i++) {\n\t\tdIndex = g_data_type == 'zr' ? 0 : 1;\n\t\t\n\t\t// Einzelplan\n\t\tif (filter.einzelplan && filter.epAll == false) {\n\t\t\tif (!isValidEP(origData[i][dIndex], filter.einzelplan)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\t\n\t\tdIndex++;\n\t\t\n\t\t// Kapitel\n\t\tif (filter.kapitel) {\n\t\t\tif (!isValid(origData[i][dIndex], filter.kapitel)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\t\n\t\tdIndex++;\n\n\t\t// Gruppe\n\t\tif (filter.gruppe) {\n\t\t\tif (!isValid(origData[i][dIndex], filter.gruppe)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\t\n\t\tdIndex++;\n\n\t\t// Zaehlnr\n\t\tif (filter.zaehlnr) {\n\t\t\tif (!isValid(origData[i][dIndex], filter.zaehlnr)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tdIndex++;\n\t\t\n\t\t// Funktion\n\t\tif (filter.funktion) {\n\t\t\tif (!isValid(origData[i][dIndex], filter.funktion)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (filter.limit) {\n\t\t\tif ((filter.limit[1] == 0 || filter.limit[1]) && parseInt(origData[i][filter.limit[0]], 10) < parseInt(filter.limit[1], 10)) {\n\t\t\t\tif ((filter.limit[0] == 9 || filter.limit[0] == 11) && parseInt(origData[i][filter.limit[0]], 10) > parseInt(filter.limit[1], 10) * -1) {\n\t\t\t\t\tcontinue;\n\t\t\t\t} else if (filter.limit[0] != 9 && filter.limit[0] != 11) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\t\n\t\tif (filter.type && filter.type == 'VE') {\n\t\t\tif (parseInt(origData[i][12], 10) == 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\ttmp[c++] = origData[i];\n\t}\n\n\tData = tmp;\n}", "title": "" }, { "docid": "9260c6d565ba81d4387daabf8d659ab4", "score": "0.48521915", "text": "function GetCheckedUserIdsToArray() {\n checked_user_ids = $('.check-all').filter(\":checked\").map(function () {\n return $(this).attr('user_id');\n }).get();\n}", "title": "" }, { "docid": "2b73fa4c2c73630763be951279244389", "score": "0.4840225", "text": "function filterTable() {\n \n // missing is the header of the alert box that will be displayed if any\n // of the search text fields are enabled but no value has been specified.\n let missing = \"Missing Values:\";\n\n // values is the new-line delimited list of empty fields\n let values = \"\";\n\n // Initialize filterData to the original data set\n let filteredData = tableData;\n\n // Retrieve the Search checkboxes\n chkboxes = getCheckboxes();\n\n // For each of the checkboxes, do the following\n chkboxes.forEach((cb) => { \n\n // Initialise the value of the checkbox to \"\"\n let val = \"\";\n\n // If the checkbox is checked\n if (d3.select(`#${cb.id}`).property(\"checked\")) {\n\n // Retrieve the name of the field from the checkbox id\n let field = cb.id.substring(3,cb.id.length);\n\n // Compose the filterId\n filterId = `#filter${field}`;\n \n // Retrieve the filter and obtain its value property\n val = d3.select(filterId).property(\"value\");\n \n // If the filter value is \"\"\n if ( val === \"\") {\n // Add it to the list of missing filter values\n values = `${values}\\nEnter ${field}`;\n }\n else {\n // Otherwise, filter the table data accordingly\n filteredData = filteredData.filter((row) => row[field] === val);\n }\n }\n });\n\n // If empty search text fields were found\n if (values != \"\") {\n // display alert box showing the user the list of empty fields\n alert(`${missing}\\n${values}`);\n }\n else {\n // Rebuild the table using the filtered data\n buildTable(filteredData);\n }\n}", "title": "" }, { "docid": "d26288fa42a8c5d2e2bfa2c192ca6352", "score": "0.48303634", "text": "function readFile() {\n var stream = fs.createReadStream(\"./scripts/data/whitelist.csv\");\n\n let index = 0;\n let batch = 0;\n console.log(`\n --------------------------------------------\n ----------- Parsing the csv file -----------\n --------------------------------------------\n `);\n\n var csvStream = csv()\n .on(\"data\", function (data) {\n let isAddress = web3.utils.isAddress(data[0]);\n let isValidNo = isValidToken(data[1]);\n if (isAddress && isValidNo) {\n let userArray = new Array()\n let checksummedAddress = web3.utils.toChecksumAddress(data[0]);\n let tokenAmount = new BigNumber(data[1].toString()).times(new BigNumber(10).pow(DECIMALS));\n userArray.push(checksummedAddress);\n userArray.push(tokenAmount);\n // console.log(userArray)\n allocData.push(userArray);\n fullFileData.push(userArray);\n index++;\n if (index >= BATCH_SIZE) {\n distribData.push(allocData);\n // console.log(\"DIS\", distribData);\n allocData = [];\n // console.log(\"ALLOC\", allocData);\n index = 0;\n }\n\n } else {\n let userArray = new Array()\n userArray.push(data[0])\n userArray.push(new BigNumber(data[1].toString()).times(new BigNumber(10).pow(DECIMALS)))\n badData.push(userArray);\n fullFileData.push(userArray)\n }\n })\n .on(\"end\", function () {\n //Add last remainder batch\n distribData.push(allocData);\n allocData = [];\n\n setInvestors();\n });\n\n stream.pipe(csvStream);\n}", "title": "" }, { "docid": "75f5b75e12c1b94a55a663a9527f536f", "score": "0.48270568", "text": "function Upload() {\t\t\t\t\t\t\t\t\t\t\t\t//MAIN FUNCTION: for uploading csv to arrays\r\n\tvar fileUpload = document.getElementById(\"fileUpload\");\r\n\tvar regex = /^([a-zA-Z0-9\\s_\\\\.\\-:])+(.csv|.txt)$/;\r\n\tif (regex.test(fileUpload.value.toLowerCase())) {\t\t\t//check if csv file\r\n\t\tif (typeof (FileReader) != \"undefined\") {\t\t\t\t//check if browser supports HTML5\r\n\t\t\tvar reader = new FileReader();\r\n\t\t\treader.onload = function (e) {\r\n\t\t\t\tvar lines = e.target.result.split(\"\\n\");\t\t//split lines from each other line-by-line\r\n\t\t\t\tvar resul = [];\t\t\t\t\t\t\t\r\n\t\t\t\t//var x_arr = [];\r\n\t\t\t\t//var y_arr = [];\r\n\t\t\t\tvar headers = lines[0].split(\",\");\r\n\t\t\t\tfor (var i = 1; i < lines.length-1; i++) {\t\t//set i=1 to remove headers\r\n\t\t\t\t\tvar currentline = lines[i].split(\",\");\t\t//separate values via comma (do NOT write numbers separated in 1000's like 12,567 or 100,000,000)\r\n\t\t\t\t\tresul.push(currentline);\r\n\t\t\t\t}\r\n\t\t\t\taddTable(headers, resul);\r\n\t\t\t\tresulMain = resul;\t\t\t\t\t\t\t\t//place to global table variable\r\n\t\t\t\t//printArray2(resulMain);\t\t\t\t\t\t\t//TEST FUNCTION: print out all values of main table\r\n\t\t\t\t//x_arrMain = getX_values(resul);\t\t\t\t\t//place to global x values\r\n\t\t\t\t//printArray2(x_arrMain);\t\t\t\t\t\t\t//TEST FUNCTION: print out all x values\r\n\t\t\t\t//y_arrMain = getY_values(resul);\t\t\t\t\t//place to global y values\r\n\t\t\t\t//printArray(y_arrMain);\t\t\t\t\t\t\t//TEST FUNCTION: print out all y values\r\n\t\t\t\t//return resul;\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\treader.readAsText(fileUpload.files[0]);\r\n\t\t} else {\r\n\t\t\talert(\"This browser does not support HTML5.\");\r\n\t\t}\r\n\t} else {\r\n\t\talert(\"Please upload a valid CSV file.\");\r\n\t}\r\n}", "title": "" }, { "docid": "b0e01a629e64624360433dfe937f6eb1", "score": "0.48267618", "text": "function processData(values) {\n console.assert(values.length === 2);\n \n let aids = values[0];\n let flights = values[1];\n \n console.log(\"aids: \" + aids.length);\n console.log(\"flights: \" + purpose.length);\n \n // convert aids array (pre filter) into map for fast lookup\n let iata = new Map(aids.map(node => [node.iata, node]));\n \n // calculate incoming and outgoing degree based on flights\n // flights are given by aid iata code (not index)\n purpose.forEach(function(link) {\n link.source = iata.get(link.donor);\n link.target = iata.get(link.recipient);\n \n link.source.outgoing += link.count;\n link.target.incoming += link.count;\n });\n \n // remove aids out of bounds\n let old = aids.length;\n aids = aids.filter(aid => aid.x >= 0 && aid.y >= 0);\n console.log(\" removed: \" + (old - aids.length) + \" aids out of bounds\");\n \n // remove aids with NA state\n old = aids.length;\n aids = aids.filter(aid => aid.state !== \"NA\");\n console.log(\" removed: \" + (old - aids.length) + \" aids with NA state\");\n \n // remove aids without any flights\n old = aids.length;\n aids = aids.filter(aid => aid.outgoing > 0 && aid.incoming > 0);\n console.log(\" removed: \" + (old - aids.length) + \" aids without flights\");\n \n // sort aids by outgoing degree\n aids.sort((a, b) => d3.descending(a.outgoing, b.outgoing));\n \n // keep only the top aids\n old = aids.length;\n aids = aids.slice(0, 50);\n console.log(\" removed: \" + (old - aids.length) + \" aids with low outgoing degree\");\n \n // done filtering aids can draw\n drawaids(aids);\n drawPolygons(aids);\n \n // reset map to only include aids post-filter\n iata = new Map(aids.map(node => [node.iata, node]));\n \n // filter out flights that are not between aids we have leftover\n old = purpose.length;\n flights = purpose.filter(link => iata.has(link.source.iata) && iata.has(link.target.iata));\n console.log(\" removed: \" + (old - purpose.length) + \" flights\");\n \n // done filtering flights can draw\n drawFlights(aids, flights);\n \n console.log({aids: aids});\n console.log({flights: flights});\n }", "title": "" }, { "docid": "4aa2ea18fcc9e5a4b919082b1b103dff", "score": "0.48265207", "text": "function getUniqueIcons(users) {\n var existingFeatureKeys = {};\n\n var uniqueFeatures = users.filter(function (el) {\n if (existingFeatureKeys[el.properties.user_id]) {\n return false;\n } else {\n existingFeatureKeys[el.properties.user_id] = true;\n return true;\n }\n });\n\n return uniqueFeatures;\n }", "title": "" }, { "docid": "a56d822cbc6bef1ecba1e58c9360a71d", "score": "0.4824554", "text": "function formatDataToArray (data) {\n var newdata = [];\n data.forEach(function (item) {\n // create rows:\n var row = [];\n\n try {\n var db = item.sourceID;\n\n // col 0: data origin: public / private\n row.push((item.access_level === otConsts.ACCESS_LEVEL_PUBLIC) ? otConsts.ACCESS_LEVEL_PUBLIC_DIR : otConsts.ACCESS_LEVEL_PRIVATE_DIR);\n\n // disease name\n row.push(item.disease.efo_info.label);\n\n // Variant\n var mut = '<a class=\\'ot-external-link\\' href=\\'http://www.ensembl.org/Homo_sapiens/Variation/Explore?v=' + item.variant.id.split('/').pop() + '\\' target=\\'_blank\\'>' + item.variant.id.split('/').pop() + '</a>';\n row.push(mut);\n\n // variant type\n var t = otClearUnderscoresFilter(otUtils.getEcoLabel(item.evidence.evidence_codes_info, item.evidence.gene2variant.functional_consequence.split('/').pop()));\n row.push(t);\n\n // evidence source\n if (item.sourceID === otConsts.datasources.PHEWAS_23andme.id) {\n row.push('<a class=\\'ot-external-link\\' href=\\'https://test-rvizapps.biogen.com/23andmeDev/\\' target=\\'_blank\\'>'\n + otClearUnderscoresFilter(item.sourceID)\n + '</a>');\n } else if (item.sourceID === otConsts.datasources.PHEWAS.id) {\n row.push('<a class=\\'ot-external-link\\' href=\\'https://phewascatalog.org/phewas\\' target=\\'_blank\\'>'\n + otClearUnderscoresFilter(item.sourceID)\n + '</a>');\n } else {\n row.push('<a class=\\'ot-external-link\\' href=\\'https://www.ebi.ac.uk/gwas/search?query=' + item.variant.id.split('/').pop() + '\\' target=\\'_blank\\'>'\n + otClearUnderscoresFilter(item.sourceID)\n + '</a>');\n }\n\n // p-value\n var msg = item.evidence.variant2disease.resource_score.value.toPrecision(1);\n\n if (item.sourceID === otConsts.datasources.PHEWAS.id) {\n msg += '<div style=\"margin-top:5px;\">Cases: ' + item.unique_association_fields.cases + '<br />Odds ratio: ' + parseFloat(item.unique_association_fields.odds_ratio).toPrecision(2) + '</div>';\n } else if (item.sourceID === otConsts.datasources.PHEWAS_23andme.id) {\n msg += '<br/>Cases: ' + item.unique_association_fields.cases + '<br />Odds ratio: ' + parseFloat(item.unique_association_fields.odds_ratio).toPrecision(2) + '<br />Phenotype: ' + item.unique_association_fields.phenotype;\n }\n row.push(msg);\n\n // publications\n var refs = [];\n if (checkPath(item, 'evidence.variant2disease.provenance_type.literature.references')) {\n refs = item.evidence.variant2disease.provenance_type.literature.references;\n }\n\n var pmidsList = otUtils.getPmidsList(refs);\n row.push(pmidsList.length ? otUtils.getPublicationsString(pmidsList) : 'N/A');\n // row.push(refs.length ? otUtils.getPublicationsField(refs) : 'N/A');\n\n // Publication ids (hidden)\n row.push(pmidsList.join(', '));\n\n // hidden columns for filtering\n row.push(item.variant.id.split('/').pop()); // variant\n row.push(otClearUnderscoresFilter(item.sourceID)); // evidence source\n\n newdata.push(row); // push, so we don't end up with empty rows\n } catch (e) {\n scope.ext.hasError = true;\n $log.error('Error parsing common disease data:');\n $log.error(e);\n }\n });\n return newdata;\n }", "title": "" }, { "docid": "671a17e9003d1903fca5c68e82cfaeae", "score": "0.48230076", "text": "function processData(data){\n //empty array to hold attributes\n var years_array = [];\n \n //properties of the first feature in the dataset\n var properties = data.features[0].properties;\n \n //push each attribute name into years_array\n for (var attribute in properties){\n //only take attributes with population values\n if (attribute.indexOf(\"Perc\") > -1){\n years_array.push(attribute); \n } \n }\n \n //check result\n //console.log(years_array);\n \n return years_array;\n}//End processData();", "title": "" }, { "docid": "4f60e3c4e4e0f97b97383c751ff32763", "score": "0.4822266", "text": "function import_data(){\n var import_input = document.getElementById(\"import_input\");\n var import_array = import_input.value.split(\",\");\n var mode = 2;\n var venue_select = document.getElementById(\"venue_select\");\n var venue_options = venue_select.options;\n for(var i = 0, import_venue = import_array[0], len = venue_options.length; i<len; i++){\n if(venue_options[i].value == import_venue){venue_select.selectedIndex = i;}\n }\n var mode_select = document.getElementById(\"mode_select\");\n var mode_options = mode_select.options;\n for(var i = 0, import_mode = import_array[1], len = mode_options.length; i<len; i++){\n if(mode_options[i].value == import_mode){\n mode_select.selectedIndex = i;\n if(i<2){mode=i;}\n }\n }\n load_venue();\n //Update rares\n for (var i = 0, len = rare_list.length; i < len; i++){trait_ref[i].value=import_array[i+3];}\n\n //Update everything else\n var enemies_complete = 0; //Because trait_ref tracks names and raw data doesn't, we need to correct for length\n for (var i = rare_list.length, out_len = trait_ref.length, in_len = mode_stats[mode].length+1; i < out_len; i+=in_len){\n for (var j = 1; j < in_len; j++){\n trait_ref[i+j].value=+import_array[i+j+2-enemies_complete]; //The +2 is because we don't want our venue/mode data\n }\n enemies_complete ++;\n }\n import_input.value = \"\";\n toggle_import();\n }", "title": "" }, { "docid": "eea17e90240d0e0f6a544f6042d64c1f", "score": "0.48197687", "text": "function applyJobFilter(){\n\tcontextFil=[];statusFil=[];userFil=[];cnodeFil=[];\n\tvar context=document.getElementsByName('context');\n\tvar status=document.getElementsByName('status');\n\tvar users=document.getElementsByName('user');\n\tvar cnodes=document.getElementsByName('cnodes');\n\tvar j=0;\n\tfor(var i=0;i<context.length;i++)\n\t{\n\t\tif (context[i].checked) {\n\t\t\tcontextFil[j]=context[i].value;\n\t\t\tj++;\n\t\t}\n\t}\n\tfilters[1]=contextFil;\n\tj=0;\n\tfor(var i=0;i<status.length;i++)\n\t{\n\t\tif (status[i].checked) {\n\t\t\tstatusFil[j]=status[i].value;\n\t\t\tj++;\n\t\t}\n\t}\n\tfilters[2]=statusFil;\n\tj=0;\n\tfor(var i=0;i<users.length;i++)\n\t{\n\t\tif (users[i].checked) {\n\t\t\tuserFil[j]=users[i].value;\n\t\t\tj++;\n\t\t}\n\t}\n\tj=0;\n\tfilters[3]=userFil;\n\tfor(var i=0;i<cnodes.length;i++)\n\t{\n\t\tif (cnodes[i].checked) {\n\t\t\tcnodeFil[j]=cnodes[i].value;\n\t\t\tj++;\n\t\t}\n\t}\n\tfilters[4]=cnodeFil;\n}", "title": "" }, { "docid": "cc8f53b0f13f24a24375eec475e9e90a", "score": "0.48178732", "text": "function getUserIdsByUniqueFilter(cbFun){\n if (emails && emails.length>0){\n var multi = self.client.multi();\n var emailToUserKey = 'emailToUser';\n var getFields = [emailToUserKey].concat(emails);\n multi.hmget(getFields);\n multi.exec(function(err,multiRetData){\n if (err){\n var err2 = self.newError({errorKey:'libraryError',messageParams:['redis'],messagePrefix:messagePrefix,req:req,innerError:err});\n return cbFun(err2);\n }\n var userIds = multiRetData[0];\n var validUserIds = [];\n for(var i=0; i<userIds.length; i++){\n var userId = userIds[i];\n if (userId) validUserIds.push(userId);\n }//for\n return cbFun(null,{needNextGet:false, userIds:validUserIds});\n });//multi.exec\n return;\n }//if (emails && emails.length>0)\n return cbFun(null,{needNextGet:true});\n }", "title": "" }, { "docid": "cc8f53b0f13f24a24375eec475e9e90a", "score": "0.48178732", "text": "function getUserIdsByUniqueFilter(cbFun){\n if (emails && emails.length>0){\n var multi = self.client.multi();\n var emailToUserKey = 'emailToUser';\n var getFields = [emailToUserKey].concat(emails);\n multi.hmget(getFields);\n multi.exec(function(err,multiRetData){\n if (err){\n var err2 = self.newError({errorKey:'libraryError',messageParams:['redis'],messagePrefix:messagePrefix,req:req,innerError:err});\n return cbFun(err2);\n }\n var userIds = multiRetData[0];\n var validUserIds = [];\n for(var i=0; i<userIds.length; i++){\n var userId = userIds[i];\n if (userId) validUserIds.push(userId);\n }//for\n return cbFun(null,{needNextGet:false, userIds:validUserIds});\n });//multi.exec\n return;\n }//if (emails && emails.length>0)\n return cbFun(null,{needNextGet:true});\n }", "title": "" }, { "docid": "9ca31d047e770aff4519a4b31b7f50ab", "score": "0.48104715", "text": "function filterUser(data, userName){\r\nreturn data.filter(item => item.user == userName);\r\n}", "title": "" }, { "docid": "ba239acf028b10065284d1552f106212", "score": "0.48070624", "text": "function formatUserArray() {\n users = users.map((user, index) => {\n return {\n 'Rank': index + 1,\n 'Player': user.username,\n 'W': user.wins,\n 'Pts': user.points,\n 'GJ': user.goldJackets\n };\n });\n }", "title": "" }, { "docid": "8b3b17736e0b9a71092378b45671136c", "score": "0.4804242", "text": "static parseInfluence(influence) {\n let array = influence.split(\",\");\n\n //Remove prolog list characters\n for (let i = 0; i < array.length; i++) {\n array[i] = array[i].replace(\"[\",\"\");\n array[i] = array[i].replace(\"]]\",\"\");\n array[i] = array[i].replace(\"]\",\"\");\n }\n\n return array;\n }", "title": "" }, { "docid": "be01bba0f8958f2251de75f55277f500", "score": "0.4803543", "text": "function removeChosenUser(arr) {\r\n for(var k = 0; k < arr.length; k++) {\r\n if(arr.includes(chosenUser)){\r\n var index = arr.indexOf(chosenUser);\r\n arr.splice(index, 1)\r\n }}\r\n }", "title": "" }, { "docid": "37c4f016df643b0c81611beef07bbf4c", "score": "0.48018363", "text": "function cleanData(data) {\n\t\t// Columns to parse to Float\n\t\tcolumns = ['Amount per FU', 'EF', 'GHG [gram CO2e]'];\n\n\t\t_.each(data, function(row, i) {\n\t\t\t// Convert Strings to Floats\n\t\t\t_.each(columns, function(col) {\n\t\t\t\tdata[i][col] = parseFloat(data[i][col])\n\t\t\t});\n\t\t\t// Parse the Stage value (first 2 chars)\n\t\t\tdata[i]['stage'] = data[i]['LCA stage'].substr(0, 2).toLowerCase();\n\t\t\t// Calc carbon cost\n\t\t\tdata[i]['cost'] = parseFloat(data[i]['Expense'].substr(1));\n\t\t});\n\t\treturn CC.cleanData = data\n\t}", "title": "" }, { "docid": "8cff887c42ee65d930db2735e21a5663", "score": "0.48014122", "text": "async make_array_of_usable_users(Graph, old_indexes, old_users){\n var Users = [[[[]]]];\n await Promise.mapSeries(Graph, async(workflow, w_idx) =>{ // make array of usable users that can be used\n await Promise.mapSeries(workflow, async(activity, a_idx) => {\n if(a_idx === 0){return;} // skip first index\n if(!Array.isArray(Users[a_idx])){\n Users[a_idx]=[];\n }\n await Promise.mapSeries(activity, async(task, t_idx) => {\n if (!Array.isArray(Users[a_idx][t_idx])){\n Users[a_idx][t_idx] = [];\n }\n if (!task.viewed && !task.is_extra_credit ){ // only add users that have not yet viewed\n Users[a_idx][t_idx].push([task.userID, task.is_extra_credit]); \n }else if(!task.completed && task.is_extra_credit){ // if task is extra credit and viewed can be repaced\n Users[a_idx][t_idx].push([task.userID, task.is_extra_credit]);\n }\n });\n });\n });\n await Promise.mapSeries(old_indexes, async(pivot, old_idx)=>{ // shift the array according to how it would be made\n await Promise.mapSeries(Users, async(activity_users, act_idx) =>{\n if(act_idx === 0){return;}\n await Promise.mapSeries(activity_users, async(task_users, t_idx)=>{\n await Promise.mapSeries(task_users, async(user, w_idx)=>{\n if(w_idx <= pivot){ // if this workflow is ablove the canceled one, just replace user with -1\n if(user[0] === old_users[old_idx]){\n Users[act_idx][t_idx][w_idx][0] = -1;\n }\n }else{ // if this workflow is under the workflow being cancelled, shift users up untill we reach old user\n if(user[0] === old_users[old_idx]){\n Users[act_idx][t_idx][w_idx][0] = -1;\n var temp = Users[act_idx][t_idx].shift();\n Users[act_idx][t_idx].push(temp);\n }\n }\n });\n });\n if(old_idx >= old_indexes.length-1){ // once we are processing last workflow being cancelled, remove -1 from user array\n await Promise.mapSeries(activity_users, async(task_users, t_idx)=>{\n Users[act_idx][t_idx] = Users[act_idx][t_idx].filter(function(user) {\n return user[0] !== -1;\n });\n });\n }\n });\n });\n return Users;\n }", "title": "" }, { "docid": "0a89acba49f034e23026dbca79d64c7b", "score": "0.47965878", "text": "function filterUsers(profileInfo) {\n\n\treturn profileInfo\n\n}", "title": "" }, { "docid": "973affbb0ed38ddc306e3b1224b01568", "score": "0.47810912", "text": "function processData(data) {\n var lines = data.split(/\\r\\n|\\n/);\n\n for (var j=0; j<lines.length-1; j++) {\n var values = lines[j].split(','); // Split up the comma seperated values\n hosp.push(parseFloat(values[0])); \n mortal.push(parseFloat(values[1]));\n }\n }", "title": "" }, { "docid": "1b9e321aee2b25cf70562a376e99e44a", "score": "0.47798997", "text": "usersForRawFuzzyName(fuzzyName) {\n let lowerFuzzyName = fuzzyName.toLowerCase();\n let ref = this.data.users || {};\n let results = [];\n let user;\n for (let key of Object.keys(ref)) {\n user = ref[key];\n if (user.name.toLowerCase().lastIndexOf(lowerFuzzyName, 0) === 0) {\n results.push(user);\n }\n }\n return results;\n }", "title": "" } ]
0b3386040da5e40bf73476a7f4b28304
Creates a wrapper for the Feedback component
[ { "docid": "bc2d0c67339ee68c65992a4cbf7e6135", "score": "0.6518134", "text": "renderWrapper({ children, title, helpful }) {\n const { sentFeedback } = this.state;\n // show \"Contact support\" only when the user hasn't submitted feedback\n // and the chosen category infers not helpful feedbak\n const showContactSupport = !sentFeedback && !helpful;\n return (\n <div className=\"dr-ui--feedback wmax300\">\n <div className=\"bg-gray-faint round py12 px12\">\n <div className=\"flex flex--column\">\n <div className=\"flex flex--space-between-main w-full mb12\">\n <div className=\"txt-bold\">{title}</div>\n <div>\n <Tooltip content=\"Close\">\n <button\n id=\"feedback-close-button\"\n aria-label=\"Close feedback\"\n onClick={this.closeFeedback}\n className=\"link--gray\"\n >\n <Icon name=\"close\" />\n </button>\n </Tooltip>\n </div>\n </div>\n <div className=\"mb6 prose\">{children}</div>\n {showContactSupport && (\n <div className=\"color-text\">\n Need help?{' '}\n <button\n className=\"link\"\n value=\"Contact support\"\n onClick={this.selectSupport}\n >\n Contact support\n </button>\n </div>\n )}\n </div>\n </div>\n </div>\n );\n }", "title": "" } ]
[ { "docid": "547da7c46b1818fd8291416f18b8895c", "score": "0.7346787", "text": "function FeedbackManager() {}", "title": "" }, { "docid": "0cf26e714d9895188652b0152963d8a4", "score": "0.73072225", "text": "function Feedback() {}", "title": "" }, { "docid": "ece3ac8dcf9684f90cf298039b3dac3f", "score": "0.72931564", "text": "_initFeedback() {\n return new Feedback(this, this.#client);\n }", "title": "" }, { "docid": "68e10dc06ea4b5bd4377e3d5d61366cf", "score": "0.6966038", "text": "static createInValidationFeedbackActionUnderFeedbackTemplate(container) {\n return internal.instancehelpers.createElement(container, TextTemplate, \"feedbackTemplate\", false);\n }", "title": "" }, { "docid": "cf23158990f2bb2a15495edb6331ac8b", "score": "0.63988817", "text": "renderFeedbackWindow() {\n switch (this.collectionState) {\n case CollectionStates.RECORDING:\n return html` <vox-sound-wave\n ?isRecording=${this.collectionState ===\n CollectionStates.RECORDING}\n .audioStream=${this.audioStream}\n .context=${this.context}\n >\n </vox-sound-wave>`;\n case CollectionStates.BEFORE_UPLOAD:\n return html`<vox-playback-button\n .audioUrl=${this.audioUrl}\n @playback-start=${this.startPlayback}\n @playback-stop=${this.stopPlayback}\n ></vox-playback-button>`;\n case CollectionStates.QC_ERROR:\n return html`<p>${this.qcError}</p>`;\n case CollectionStates.TRANSITIONING:\n return html`<mwc-circular-progress\n indeterminate\n ></mwc-circular-progress>`;\n default:\n return html``;\n }\n }", "title": "" }, { "docid": "e02feac20b56c3bf43d6bb379ae37d09", "score": "0.6108996", "text": "function FeedbacksView(){ \n }", "title": "" }, { "docid": "9995c16283225efd5e04de7022a1441f", "score": "0.60137653", "text": "static createIn(container) {\n return internal.instancehelpers.createElement(container, ValidationFeedbackAction, \"action\", false);\n }", "title": "" }, { "docid": "7bf1c9535453e22e44be053f2b8b1369", "score": "0.5913619", "text": "function feedback(event) {\n\n}", "title": "" }, { "docid": "8885d3d83d1d9460c577f316ff8a0ae4", "score": "0.5789854", "text": "function getCorrectFeedbackContainer() {\n return component.correctFeedbackContainer;\n }", "title": "" }, { "docid": "6dec4432d1e27c44d4eb3573b2ecb8b8", "score": "0.5759497", "text": "function create(app, options) {\n return new FeedbackModal(app, options);\n}", "title": "" }, { "docid": "676114a36817b4bcff3c824273644dbd", "score": "0.56834537", "text": "function data_feedback()\n\t{ return { op: \"feedback\" }; }", "title": "" }, { "docid": "e2f0d3c0f828f2a49ad6b70170e20ca8", "score": "0.5665821", "text": "static create(model) {\n return internal.instancehelpers.createElement(model, ValidationFeedbackAction);\n }", "title": "" }, { "docid": "3985ae78f956c5cf0e48682e67d6c2bd", "score": "0.5613134", "text": "_setupTransformFeedback() {\n if (isObjectEmpty(this.feedbackBuffers[0])) {\n return;\n }\n this.transformFeedbacks[0] = new TransformFeedback(this.gl, {\n program: this.model.program,\n buffers: this.feedbackBuffers[0]\n });\n\n // If buffers are swappable setup second transform feedback object.\n if (this.feedbackMap) {\n this.transformFeedbacks[1] = new TransformFeedback(this.gl, {\n program: this.model.program,\n buffers: this.feedbackBuffers[1]\n });\n }\n }", "title": "" }, { "docid": "0c20ea1bf5f438c5136d002cf3cce06c", "score": "0.54896736", "text": "function desktopFeedback(message) {\n\tfeedback.innerHTML = message;\n}", "title": "" }, { "docid": "713be1d023ef7f501d67f63b02a0eb7c", "score": "0.5403448", "text": "sendFeedback(){\n const data = this.get('data');\n\n this.sendAction('sendFeedback', data);\n this.set('data', {});\n }", "title": "" }, { "docid": "324cd2e5f81f12867191d66a6164c3d0", "score": "0.53609556", "text": "function bindFeedbackEvent(feedbacks) {\n // bind to id \"test\" onclick event, to handle the feedback lightbox popup.\n $('#test').unbind('click').bind('click', function() {\n var target = $(arguments[0].target);\n\n // if target node has sprite class, show the lightbox.\n if (target.hasClass('clickable')) {\n // Get the index from the id of the target node.\n // ex. index 0 for id \"feedback_0\". \n var index = parseInt(target.attr('id').split('_')[1]),\n // Get the TR by index, and then get it's sencond TD child whose innerHTML will be the quesiton value pass to lightbox.\n // Because first TR is from header, using get(index + 1).\n td = $('td', $('tr').get(index + 1)).get(1),\n correctness = 'incorrect';\n\n if (target.hasClass('correct')) {\n correctness = 'correct';\n }\n // Show the lightbox for feedback.\n ale.lightbox.render({\n global: ale,\n id: app.lightbox.getFreshLightboxId(),\n data: {\n type: 'vidNotesFillinFeedback',\n content: {\n question: $(td).html(),\n yourAnswer: $('span', td).html(),\n correctness: correctness,\n feedback: feedbacks[index]\n }\n }\n });\n }\n });\n }", "title": "" }, { "docid": "64c4b8bfabc2c3ab0a1fbd89d9a0e969", "score": "0.53068316", "text": "function noFeedbackError() {\n\treturn {\n\t\ttype: \"\",\n\t};\n}", "title": "" }, { "docid": "b1f9d9cccf56149a417ada14883e05c3", "score": "0.5283385", "text": "render() {\n\t\treturn (\n\t\t\t<textarea style={styles.feedbackTextArea} value={this.state.text} onChange={this.handleChange}>\n\t\t\t</textarea>\n\t\t);\n\t}", "title": "" }, { "docid": "ea3db6f7ec34253e2701cf8d1094c23d", "score": "0.527681", "text": "function FeedbackModal(app, options) {\n var _this = _super.call(this, app, types_1.Group.FeedbackModal, types_1.Group.FeedbackModal) || this;\n _this.options = options;\n _this.set(options);\n return _this;\n }", "title": "" }, { "docid": "10f5cca75abce59f9534d92e7bf333ab", "score": "0.52439916", "text": "flagFeedbackForUpdate () {\n this._state.update.optionsManifest.feedback = true;\n return this;\n }", "title": "" }, { "docid": "d1042a2fb5c29c3638fe91ba1d3c056a", "score": "0.52042955", "text": "sendFeedback(templateId, senderEmail, receiverEmail, feedback, user) {\n window.emailjs\n .send('default_service', templateId, {\n senderEmail,\n receiverEmail,\n feedback\n },\n user\n )\n .then(res => {\n this.setState({\n formEmailSent: true\n });\n })\n // Handle errors here however you like\n .catch(err => console.error('Failed to send feedback. Error: ', err));\n }", "title": "" }, { "docid": "62b6d1fd07433ebc90caa382b7e1ecd9", "score": "0.5191391", "text": "function getFeedback() {\r\n $('main').on('click', '.feedback', event => {\r\n event.preventDefault();\r\n let slide = store.slides[getIndex()];\r\n let selection = $('input[name=\"answers\"]:checked').val();\r\n checkIfAnswered(slide, selection);\r\n editSubmitButtonClass(slide);\r\n toggleHasAnswered();\r\n });\r\n}", "title": "" }, { "docid": "94f4be71c004b5b0f5324341e66fecc0", "score": "0.5167264", "text": "function feedback(i) {\r\n var h = open(i, 'feedback', \r\n \"width=500,height=500,status=yes,toolbar=no,menubar=no,scrollbars=yes,resizable=yes\");\r\n}", "title": "" }, { "docid": "2c0d1b37dd6c7cd00382157bcf66fdfc", "score": "0.5154175", "text": "generateFeedback() {\n var text = \"\";\n switch(this.paneType) {\n case InfoPaneType.FAIL:\n text = TXT_FAIL;\n break;\n case InfoPaneType.PROCEED:\n if (this.urlMode) {\n text = TXT_PASS + '\\n' + TXT_REPEAT_CUSTOM;\n } else {\n text = TXT_PASS + '\\n' + TXT_NEXT_LEVEL;\n }\n break;\n case InfoPaneType.BEFORE_LEVEL:\n if (this.urlMode) {\n text = TXT_WELCOME_TO_CUSTOM + '\\n';\n } else {\n text = TXT_WELCOME_TO_LEVEL + ' ' + this.level.levelNumber + '!\\n';\n }\n text += TXT_IN_THIS_LEVEL + '\\n'\n + (this.level.message.length > 1 ? TXT_MULTIPACKET + '\\n' : '')\n + (this.level.packetsHaveShields ? TXT_SHIELDED + '\\n' : '')\n + (this.level.packetsHaveNumbers ? TXT_NUMBERED + '\\n' : '')\n + (this.level.acksNacksEnabled ? TXT_ACKSNACKS + '\\n' : '')\n + (this.level.canAttackAcksNacks ? TXT_ATTACK_ACKSNACKS + '\\n' : '')\n + (this.level.timeoutsEnabled ? TXT_TIMEOUTS + '\\n' : '')\n + (this.level.levelNumber == 1 ? TXT_NO_DEFENCE : '');\n break;\n case InfoPaneType.START:\n text = TXT_INTRODUCTION;\n break;\n case InfoPaneType.END:\n text = TXT_IMPOSSIBLE;\n break;\n }\n return text;\n }", "title": "" }, { "docid": "8ea5b3552bd18d7d47278b87119dec00", "score": "0.5120163", "text": "function ParticipantFeedbackController(name)\n{\n\tthis.name = name;\n}", "title": "" }, { "docid": "fd748e5d198558b588f95d75d93d4971", "score": "0.5109084", "text": "function callFeedback() {\n\t\t\tfor (var i = 0; i < optionBox.length; i++) {\n\t\t\t\toptionBox[i].addEventListener(\"click\",\n\t\t\t\t\tgiveFeedback);\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "c3964be7a09bf518d1c39cb974afe7fc", "score": "0.5079145", "text": "function provideFeedback(){ \n var inputText = $(\":focus\").val();\n speakMsg(inputText);\n }", "title": "" }, { "docid": "cb18a430272a4562f3ca9a9ec34aeef7", "score": "0.5077932", "text": "render() {\n return (\n <div>\n <h1>Submission Successful!</h1>\n <h1>Thank you for your feedback!</h1>\n <button onClick={this.buttonClick}>Add New Feedback</button>\n </div>\n )\n }", "title": "" }, { "docid": "64c94683370cb3d83f4f6ffc50fe2e3d", "score": "0.50760996", "text": "function feedbackRender(text) {\n $('.feedback-text').text(`${text}`).fadeIn(500);\n }", "title": "" }, { "docid": "f5db25d4ad0d8c22c808d8d8d0b53b09", "score": "0.50448996", "text": "function Review({ feedbackRef, presets, value, handleShareFeedback }) {\n return (\n <div className='review-container'>\n <h3>\n What can we do better? (optional):\n </h3>\n <textarea ref={feedbackRef}>\n {presets[parseInt(Math.ceil(value - 1))]}\n </textarea>\n <div className='center-div'>\n <button onClick={handleShareFeedback}>\n Share feedback\n </button>\n </div>\n </div>\n );\n}", "title": "" }, { "docid": "c59fcc8bf3c71228d8ffbc10f029a7bd", "score": "0.503755", "text": "function submit(){\n postFeedback(feedback);\n }", "title": "" }, { "docid": "5a397e4d1b44c1226792586afdc7feaf", "score": "0.5029817", "text": "enableFeedbackButton() {\n this.setState({\n hasCallEnded: true\n })\n this.feedbackButton.current.enableFeedbackButton()\n }", "title": "" }, { "docid": "c8cef5b157f50c0e0d9a501dd943294b", "score": "0.50246114", "text": "function onUpdateFeedback(eventName, feedbackObj) {\n var supportedReactions = feedbackObj.feedbacktarget.supportedreactions;\n // to prevent an infinite callback loop, only send an update if the Reactions haven't been modified yet\n if(supportedReactions.length === DEFAULT_SUPPORTED_REACTIONS_COUNT) {\n supportedReactions.push(REACTION_TYPE_ID_FIRE); // inject the Thankful Reaction\n supportedReactions.push(REACTION_TYPE_ID_PLANE); // inject the Thankful Reaction\n feedbackObj.feedbacktarget.supportedreactions = supportedReactions; // reassign the supportedreactions\n UFICentralUpdates.inform(UPDATE_FEEDBACK_EVENT, feedbackObj); // update the 'FeedbackTarget' ???? PROFIT!!\n }\n }", "title": "" }, { "docid": "80a16578733b80be67a4bc6bcc679696", "score": "0.50147414", "text": "_createFeedbackBuffers({feedbackBuffers}) {\n if (!this.feedbackMap) {\n // feedbackMap required to auto create buffers.\n return;\n }\n const current = this.currentIndex;\n for (const sourceBufferName in this.feedbackMap) {\n const feedbackBufferName = this.feedbackMap[sourceBufferName];\n if (\n feedbackBufferName !== this.targetTextureVarying &&\n (!feedbackBuffers || !feedbackBuffers[feedbackBufferName])\n ) {\n // Create new buffer with same layout and settings as source buffer\n const sourceBuffer = this.sourceBuffers[current][sourceBufferName];\n const {byteLength, usage, accessor} = sourceBuffer;\n const buffer = new Buffer(this.gl, {byteLength, usage, accessor});\n\n if (this._createdBuffers[feedbackBufferName]) {\n this._createdBuffers[feedbackBufferName].delete();\n }\n this._createdBuffers[feedbackBufferName] = buffer;\n this.feedbackBuffers[current][feedbackBufferName] = buffer;\n }\n }\n }", "title": "" }, { "docid": "0ade0cf54d80b32255189da2f2714535", "score": "0.501311", "text": "function submitToFeedback() {\n\t\tif (textArea.value !== '') {\n\t\t\tvar param = getFeedback();\n\t\t\tvar API_Call = require('ui/apiCalling/call_without_indicator');\n\t\t\tnew API_Call('PUT', system_url.getEdit_View_feedback_url(_id), param, function(json) {\n\t\t\t\trenderFeedback(json);\n\t\t\t});\n\t\t} else {\n\t\t\talert('Text field should not empty.');\n\t\t}\n\t}", "title": "" }, { "docid": "a385f32a679ac275beac17dc4d0bc914", "score": "0.49893194", "text": "componentDidMount() {\n this.getFeedback();\n }", "title": "" }, { "docid": "abdf5ddc26a56aae5724d3df6553317a", "score": "0.49768612", "text": "_init() {\n // Attach message value to scope for message override\n this.message = this.$scope.message;\n \n this.$element[0].api = this;\n\n this._mergeDefaults(this.$attrs.type, this.feedbackProvider.configuredDefaults);\n\n this._setType(this.$attrs.type);\n this._setHeader(this.$attrs.header);\n this._setFlash(this.$attrs.flash);\n }", "title": "" }, { "docid": "86d6dae85e5b50fec9049f2b8e84f20c", "score": "0.49737945", "text": "function createNode() {\n const node = document.createElement('div');\n const label = document.createElement('label');\n const input = document.createElement('input');\n const text = document.createElement('span');\n const warning = document.createElement('div');\n node.className = 'jp-RedirectForm';\n warning.className = 'jp-RedirectForm-warning';\n label.appendChild(text);\n label.appendChild(input);\n node.appendChild(label);\n node.appendChild(warning);\n return node;\n }", "title": "" }, { "docid": "ce4b2fda952f08f50f40f0a5723716a8", "score": "0.49736643", "text": "function DelayTapLFOFeedback(){\n\n\tthis.input = audioCtx.createGain();\n\tthis.output = audioCtx.createGain();\n\n}", "title": "" }, { "docid": "665be3ddb3c5cd86ba577937fc74a0cc", "score": "0.49716538", "text": "function assessmentFeedback(){\n\n\n}", "title": "" }, { "docid": "53d99a1af3a7559b713d6926e4df5c21", "score": "0.4963022", "text": "function feedBack(feedback){\n$('#feedback').text(feedback);\n}", "title": "" }, { "docid": "c53646f0cee7e1dd4c24ae1fe023dea5", "score": "0.49144828", "text": "updateText() {\n this.information.setText(this.generateFeedback());\n }", "title": "" }, { "docid": "9c9ea5b806df2e08c407bb4dd2d4e032", "score": "0.491031", "text": "function SetContentText(strFeedback)\n{\n if (strFeedback)\n {\n\t txtGadget.innerText = strFeedback;\n\t}\n\telse\n\t{\n\t txtGadget.innerText = defaultText;\n\t}\n}", "title": "" }, { "docid": "adc6061cc1d8a56e82b218d540768e6d", "score": "0.48841506", "text": "function postFeedback(payload){\n Axios.post('/feedback', payload).then(response=>{\n dispatch({type: 'CLEAR_FEEDBACK'})\n history.push('/thanks')\n }).catch(err=>{\n console.log(err);\n });\n }", "title": "" }, { "docid": "808d780979dba114b0c2a258e130b2d8", "score": "0.4882668", "text": "constructor(props) {\n super(props);\n\n this.state = {\n feedback: \"\",\n redirect: false,\n errorFeedback: \"\"\n };\n\n this.handleChange = this.handleChange.bind(this);\n this.inputDefinition = this.inputDefinition.bind(this);\n this.setRedirect = this.setRedirect.bind(this);\n this.handleSubmit = this.handleSubmit.bind(this);\n this.submitButton = this.submitButton.bind(this);\n }", "title": "" }, { "docid": "b3408af0795eff79fadbeeb1043db4e1", "score": "0.48488596", "text": "wrap(component) {\n const { channel } = this;\n return class WrappedComponent extends React.Component {\n componentWillMount() {\n channel.subscribe(() => {\n this.forceUpdate();\n });\n }\n render() {\n return React.createElement(component, {});\n }\n };\n }", "title": "" }, { "docid": "92bdd789ce01daa2eb0e455e2a89a448", "score": "0.48214447", "text": "render() {\n\t\tconst { getFieldDecorator } = this.props.form;\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t<Form.Item\n\t\t\t\t\tlabel=\"text\"\n\t\t\t\t>\n\t\t\t\t\t{getFieldDecorator('text', {\n\t\t\t\t\t\trules: [{required: true, message: 'Please write your application for the position'}],\n\t\t\t\t\t})(\n\t\t\t\t\t\t<Input.TextArea row={16}/>\n\t\t\t\t\t)}\n\t\t\t\t</Form.Item>\n\t\t\t\t<Form.Item>\n\t\t\t\t\t<Button type=\"primary\"\n\t\t\t\t\t\t\tonClick={this.handleApply.bind(this)}>Send</Button>\n\t\t\t\t</Form.Item>\n\t\t\t</div>\n\t\t);\n\t}", "title": "" }, { "docid": "18d3794b5b234b132bd74e7604754dd8", "score": "0.48201382", "text": "function displayFeedback () {\n if (inputCategory.value === '') {\n categoryFeedback.style.display = 'block';\n } else {\n categoryFeedback.style.display = 'none';\n }\n\n if (inputName.value === '') {\n itemFeedback.style.display = 'block';\n } else {\n itemFeedback.style.display = 'none';\n }\n if (inputPrice.value === '') {\n priceFeedback.style.display = 'block';\n } else {\n priceFeedback.style.display = 'none';\n }\n}", "title": "" }, { "docid": "c6eeb138fd607959a4c5f009f9c2e335", "score": "0.48176393", "text": "function withFormWrapper(SourceComponent) {\n var propTypes = {\n type: _propTypes.default.string,\n onDialogSubmit: _propTypes.default.func,\n onDialogCancel: _propTypes.default.func,\n dialogElement: _propTypes.default.instanceOf(Object),\n renderDialog: _propTypes.default.func.isRequired,\n formConfig: _propTypes.default.shape({\n title: _propTypes.default.string,\n mapper: _propTypes.default.func,\n refsObj: _propTypes.default.instanceOf(Object),\n validationRequired: _propTypes.default.bool\n })\n };\n var defaultProps = {\n type: '',\n onDialogSubmit: function onDialogSubmit() {\n return null;\n },\n onDialogCancel: function onDialogCancel() {\n return null;\n },\n dialogElement: {},\n formConfig: _propTypes.default.shape({\n mapper: function mapper() {\n return null;\n },\n title: '',\n refsObj: {},\n validationRequired: _propTypes.default.bool\n })\n };\n\n var FormWrapper =\n /*#__PURE__*/\n function (_Component) {\n _inherits(FormWrapper, _Component);\n\n function FormWrapper(props) {\n var _this;\n\n _classCallCheck(this, FormWrapper);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(FormWrapper).call(this, props));\n\n _defineProperty(_assertThisInitialized(_this), \"getFormValidationStatus\", function () {\n var refsObj = _this.props.formConfig.refsObj;\n return !Object.values(refsObj).find(function (item) {\n if (typeof item !== 'string') return item.getValidState() === false;\n });\n });\n\n _defineProperty(_assertThisInitialized(_this), \"handleFormSubmit\", function () {\n var _this$props = _this.props,\n onDialogSubmit = _this$props.onDialogSubmit,\n type = _this$props.type,\n onDialogCancel = _this$props.onDialogCancel;\n var details = _this.state.details;\n\n var valid = _this.getFormValidationStatus();\n\n if (valid) {\n onDialogSubmit(type, details);\n onDialogCancel();\n } else {\n _this.setState({\n enableErrorDisplay: true\n });\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"handleInputChange\", function (event) {\n var firstParam = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var paramList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];\n var details = _this.state.details;\n var updatedDetails = (0, _formHandlers.inputChange)(details, event, firstParam, paramList);\n\n _this.setState({\n details: updatedDetails\n });\n });\n\n _defineProperty(_assertThisInitialized(_this), \"handleDropDownChange\", function (value) {\n var parameterRef = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n var callBack = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {\n return null;\n };\n var details = _this.state.details;\n var updatedDetails = (0, _formHandlers.dropdownChange)(details, parameterRef, value);\n\n _this.setState({\n details: updatedDetails\n }, function () {\n callBack(parameterRef[parameterRef.length - 1], value, (0, _arrayProcessor.clone)(_this.state.details), _this.updateState);\n });\n });\n\n _defineProperty(_assertThisInitialized(_this), \"updateState\", function (details) {\n _this.setState({\n details: details\n });\n });\n\n _defineProperty(_assertThisInitialized(_this), \"getState\", function () {\n var details = _this.state.details;\n return (0, _arrayProcessor.clone)(details);\n });\n\n _defineProperty(_assertThisInitialized(_this), \"handleFileUpload\", function (e) {\n var details = _this.state.details;\n details.file = e.target.files[0];\n\n _this.setState({\n details: details\n });\n });\n\n _defineProperty(_assertThisInitialized(_this), \"handleMultipleUpload\", function (e, uploadCallBack) {\n var details = _this.state.details;\n uploadCallBack(e.target.files[0], (0, _arrayProcessor.clone)(details), _this.updateState);\n });\n\n var formConfig = props.formConfig,\n dialogElement = props.dialogElement;\n _this.state = {\n dialogElementBackup: props.dialogElement,\n details: _objectPrototypes.has.call(formConfig, _config.FORM_CONFIG.MAPPER) ? formConfig[_config.FORM_CONFIG.MAPPER](dialogElement) : {},\n enableErrorDisplay: false\n };\n return _this;\n }\n\n _createClass(FormWrapper, [{\n key: \"render\",\n value: function render() {\n var _this$state = this.state,\n details = _this$state.details,\n enableErrorDisplay = _this$state.enableErrorDisplay;\n var handleInputChange = this.handleInputChange,\n handleDropDownChange = this.handleDropDownChange,\n handleFileUpload = this.handleFileUpload,\n getFormValidationStatus = this.getFormValidationStatus,\n handleFormSubmit = this.handleFormSubmit,\n handleMultipleUpload = this.handleMultipleUpload,\n updateState = this.updateState,\n getState = this.getState;\n\n var newProps = _objectSpread({\n handleInputChange: handleInputChange,\n handleDropDownChange: handleDropDownChange,\n handleFileUpload: handleFileUpload,\n getFormValidationStatus: getFormValidationStatus,\n dialogData: details,\n enableErrorDisplay: enableErrorDisplay,\n handleFormSubmit: handleFormSubmit,\n handleMultipleUpload: handleMultipleUpload,\n updateState: updateState,\n getState: getState\n }, this.props);\n\n return _react.default.createElement(_react.Fragment, null, _react.default.createElement(SourceComponent, newProps));\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(nextProps, prevState) {\n var dialogElementBackup = prevState.dialogElementBackup;\n var dialogElement = nextProps.dialogElement,\n formConfig = nextProps.formConfig;\n\n if (!(0, _arrayProcessor.compareList)(dialogElement, dialogElementBackup)) {\n return {\n dialogElementBackup: dialogElement,\n details: _objectPrototypes.has.call(formConfig, _config.FORM_CONFIG.MAPPER) ? formConfig[_config.FORM_CONFIG.MAPPER](dialogElement) : {}\n };\n }\n\n return null;\n }\n }]);\n\n return FormWrapper;\n }(_react.Component);\n\n FormWrapper.displayName = \"withAlert(\".concat((0, _component.getDisplayName)(SourceComponent), \")\");\n FormWrapper.propTypes = propTypes;\n FormWrapper.defaultProps = defaultProps;\n return FormWrapper;\n}", "title": "" }, { "docid": "6ec8014c2bdc2ef699a9c46dde2e692d", "score": "0.48147342", "text": "function createWrapper(props) {\n return shallow(\n <IIIFAuthentication\n accessTokenServiceId=\"http://example.com/token\"\n authServiceId=\"http://example.com/auth\"\n failureDescription=\"... and this is why.\"\n failureHeader=\"Login failed\"\n handleAuthInteraction={() => {}}\n isInteractive\n logoutServiceId=\"http://example.com/logout\"\n resetAuthenticationState={() => {}}\n resolveAccessTokenRequest={() => {}}\n resolveAuthenticationRequest={() => {}}\n t={key => key}\n windowId=\"w\"\n {...props}\n />,\n );\n}", "title": "" }, { "docid": "01313f27eb9ee098f06ec74ff338ec75", "score": "0.48038456", "text": "open () {\n return super.open('/feedback.html');\n }", "title": "" }, { "docid": "12f8fe8cf882c58e657c265d4840e632", "score": "0.4802291", "text": "function wrongAnswerFeedback() {\n $(`.feedbackContainer`).show().html(wrongAnswerTemplate);\n}", "title": "" }, { "docid": "08e28de748cf573af7e2dad6850049ea", "score": "0.47955528", "text": "render() {\n return (\n <section className=\"Section Section--gray Section--bottomLeaves\">\n <div className=\"Section-content container\">\n\n <h2 className=\"Section-title\">Don’t Just Take Our Word for It…</h2>\n\n <div className=\"Section-topSpacing SignupPage-feedbackBox\">\n\n <div className=\"UserFeedback is-left\">\n <div className=\"UserFeedback-bubble\">Your crew is exceptional — polite, smart, and efficient.</div>\n <div className=\"UserFeedback-sign\">Kathleen, San Jose</div>\n </div>\n <div className=\"UserFeedback is-right\">\n <div className=\"UserFeedback-bubble\">We’re impressed. Our yard has not looked this good in a long time.</div>\n <div className=\"UserFeedback-sign\">Lisa, San Jose</div>\n </div>\n <div className=\"UserFeedback is-left\">\n <div className=\"UserFeedback-bubble\">These guys are disrupting the landscape universe and it’s a beautiful thing!!!!</div>\n <div className=\"UserFeedback-sign\">Joshua, Los Gatos</div>\n </div>\n <div className=\"UserFeedback is-right\">\n <div className=\"UserFeedback-bubble\">THE BEST DAMN GARDENER I HAVE EVER HAD!!!</div>\n <div className=\"UserFeedback-sign\">Kevin, Los Gatos</div>\n </div>\n </div>\n </div>\n </section>\n );\n }", "title": "" }, { "docid": "1293c4f20d0858794c52e82a306f0da9", "score": "0.4792738", "text": "render() {\n\t\tif (!this.props.question) {\n\t\t\treturn null;\n\t\t}\n\t\treturn (\n\t\t\t<div style={{width: '100%', margin: '0 auto', textAlign: 'center'}}>\n\t\t\t\t<h3>{this.props.question}</h3>\n\t\t\t\t{\n\t\t\t\t\tthis.props.disable ?\n\t\t\t\t\t\t<p>{this.props.answer}</p>\n\t\t\t\t\t:\n\t\t\t\t\tthis.props.subject ? \n\t\t\t\t\t\t<React.Fragment>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\tclassName=\"answer\"\n\t\t\t\t\t\t\t\treadOnly={this.props.disable}\n\t\t\t\t\t\t\t\tplaceholder={this.answerPlaceholder}\n\t\t\t\t\t\t\t\tonBlur={(e) => this.handleChange(e)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<button onClick={(e) => this.prepareForSubmit(e)}>Submit</button>\n\t\t\t\t\t\t</React.Fragment>\n\t\t\t\t\t:\n\t\t\t\t\t''\n\t\t\t\t}\n\t\t\t</div>\n\t\t);\n\t}", "title": "" }, { "docid": "8d29ce9bb8e51f1081f85611280443c9", "score": "0.4789333", "text": "function feedbackMod(){\n\t\t// When user clicks #feedbackBtn, the feedbackMod display toggles\n\t\t$(\"#feedbackBtn\").click(function(){\n\t\t\tif ($(\"#feedbackMod\").css(\"display\") == 'none'){\n\t\t\t\tvar yPos = $(window).scrollTop() + 50;\n\t\t\t\tvar xPos = ($(window).width() - $(\"#feedbackMod\").outerWidth())/2;\n\t\t\t\t$(\"#feedbackMod\").css({\"top\": yPos + \"px\", \"left\": xPos + 'px'}).show(); \n\t\t\t} else if ($(\"#feedbackMod\").css(\"display\") == 'block'){\n\t\t\t\t$(\"#feedbackMod\").hide();\n\t\t\t}\n\t\t});\n\t\t\n\t\t// When user focuses on name='feedback', the val empties and inactiveText is removed\n\t\t$(\".feedbackText\").focus(function(){\n\t\t\tif ($(this).hasClass(\"inactiveText\")){\n\t\t\t\t$(this).val(\"\").removeClass(\"inactiveText\");\n\t\t\t}\n\t\t});\n\t\t\n\t\t// When user clicks .mod .delete, it will hide its parent\n\t\t$(\".mod .delete\").live('click',function(){\n\t\t\t$(\"#feedBackForm\").show();\n\t\t\t$(\"#feedbackNoti\").hide();\n\t\t\t$(this).parent().hide();\n\t\t});\n\t\t// When user submits the feedback form, send the appropriate request\n\t\t$(\"#feedBackForm\").submit(function(){\n\t\t\tvar formInfo = $(this).serialize() + \"&feedBackForm=true\";\n\t\t\tvar textVal = $(this).find(\".feedbackText\").val();\n\t\t\tvar formText = \"Please tell us if you have any ideas, suggestions, or feedback. We love to hear from you!\";\n\t\t\t// Don't send the form if its the same as the formText\n\t\t\tif (textVal != \"\" && textVal != formText){\n\t\t\t\t$(\".feedbackText\").val(formText).addClass(\"inactiveText\");\n\t\t\t\t$(this).hide();\n\t\t\t\t$.post('ajax/ajax.mail.php',formInfo);\n\t\t\t\t$(\"#feedbackNoti\").show();\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n\t}", "title": "" }, { "docid": "4cfc346108df9849d70def430f4bcb2f", "score": "0.4776638", "text": "function Tooltip(wrapper, options) {\n var _this = this;\n\n _classCallCheck(this, Tooltip);\n\n this.wrapper = wrapper;\n this.options = typeof options == \"string\" ? { direction: options } : options;\n this.dir = this.options.direction || \"above\";\n this.pointer = wrapper.appendChild(elt(\"div\", { class: prefix + \"-pointer-\" + this.dir + \" \" + prefix + \"-pointer\" }));\n this.pointerWidth = this.pointerHeight = null;\n this.dom = wrapper.appendChild(elt(\"div\", { class: prefix }));\n this.dom.addEventListener(\"transitionend\", function () {\n if (_this.dom.style.opacity == \"0\") _this.dom.style.display = _this.pointer.style.display = \"\";\n });\n\n this.isOpen = false;\n this.lastLeft = this.lastTop = null;\n }", "title": "" }, { "docid": "4cfc346108df9849d70def430f4bcb2f", "score": "0.4776638", "text": "function Tooltip(wrapper, options) {\n var _this = this;\n\n _classCallCheck(this, Tooltip);\n\n this.wrapper = wrapper;\n this.options = typeof options == \"string\" ? { direction: options } : options;\n this.dir = this.options.direction || \"above\";\n this.pointer = wrapper.appendChild(elt(\"div\", { class: prefix + \"-pointer-\" + this.dir + \" \" + prefix + \"-pointer\" }));\n this.pointerWidth = this.pointerHeight = null;\n this.dom = wrapper.appendChild(elt(\"div\", { class: prefix }));\n this.dom.addEventListener(\"transitionend\", function () {\n if (_this.dom.style.opacity == \"0\") _this.dom.style.display = _this.pointer.style.display = \"\";\n });\n\n this.isOpen = false;\n this.lastLeft = this.lastTop = null;\n }", "title": "" }, { "docid": "19b1ba522878cde181b356dc63ce59b7", "score": "0.4773409", "text": "function createWrapper(customProps) {\n wrapper = render(\n <Fragment>\n <ExclusiveSelectboxesFormSectionView\n {...getWrapperProps()}\n card={{ message: null, field: null }}\n {...customProps}\n />\n </Fragment>\n );\n return wrapper;\n}", "title": "" }, { "docid": "3819e6acbfc25dcfd3345def70195d5b", "score": "0.4767883", "text": "function component() {\n let element = document.createElement('div');\n\n element.innerHTML = 'Brought to you by the Domain.com team.';\n\n return element;\n}", "title": "" }, { "docid": "87aaeb0a7e51c7f7135fe6c9213c7d70", "score": "0.4763931", "text": "helpPage() {\n if (this.state.page_showing != \"help\") {\n return null;\n }\n\n return React.createElement(\n 'div',\n null,\n React.createElement(\n Menu,\n { isOpen: this.state.menu_open_state, styles: menu_styles, right: true },\n React.createElement(\n 'button',\n { onClick: this.doSettings, className: 'col-6 abutton', href: '/contact' },\n 'Settings and Voice'\n ),\n React.createElement(\n 'button',\n { onClick: this.showHelp, className: 'col-6 abutton', href: '' },\n 'Help'\n )\n ),\n React.createElement(Header, { title: 'ScopeSpeaker', subtitle: '(Hear Periscope Chat Messages)', backToMessagePage: this.backToMessagePage }),\n React.createElement('hr', null),\n React.createElement(\n 'div',\n { className: 'row col-12' },\n help_msgs.map(function (msg) {\n return React.createElement(\n 'span',\n null,\n msg,\n React.createElement('br', null),\n React.createElement('br', null)\n );\n })\n )\n );\n }", "title": "" }, { "docid": "9d52970f044d45589e814edcefe6cc32", "score": "0.47551054", "text": "function exampleFeedback() {\n// these are docids that just happen to be in the database right now. this test should get \n// upgraded to tag images and use the returned docids.\nvar docids = [\n\t\"15512461224882630000\",\n\t\"9549283504682293000\"\n\t];\n\tvar addTags = [\n\t\"addTag1\",\n\t\"addTag2\"\n\t];\n\tClarifai.feedbackAddTagsToDocids( docids, addTags, null, function( err, res ) {\n\t\tif( opts[\"print-results\"] ) {\n\t\t\tconsole.log( res );\n\t\t};\n\t} );\n\n\tvar removeTags = [\n\t\"removeTag1\",\n\t\"removeTag2\"\n\t];\n\tClarifai.feedbackRemoveTagsFromDocids( docids, removeTags, null, function( err, res ) {\n\t\tif( opts[\"print-results\"] ) {\n\t\t\tconsole.log( res );\n\t\t};\n\t} );\n}", "title": "" }, { "docid": "d08e736504b4c641f01d89d617159807", "score": "0.4737093", "text": "render() {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t<div className=\"thankYou\">\n\t\t\t\t\t<h3 >Thank you, {this.props.thanks} for submitting your info!</h3>\n\t\t\t\t\t<p>We are currently <del>playing with</del> processing your data.</p>\n\t\t\t\t\t<img className=\"thankYouImg\" src=\"../../img/thankyou.gif\"/>\n\t\t\t\t\t<p className=\"counter\">(In {this.state.time} seconds you can give us some more)</p>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t)\n\t}", "title": "" }, { "docid": "66912e0813674fd2c66aa5441366d3f8", "score": "0.47300813", "text": "function generateFeedback(){\n // quit if no template or database stored\n if (localStorage.getItem('template') === null){\n alert(\"Error: no template found\");\n return;\n } \n if (localStorage.getItem('database') === null){\n alert(\"Error: no lesson database found\");\n return;\n } \n\n // set up basic objects\n template = JSON.parse(localStorage.getItem('template'));\n let generatedFeedbackBox = document.getElementById('generatedFeedbackBox');\n let inputs = getFeedbackInputs();\n let feedback = \"\";\n\n // check for valid input\n if (inputs.unit == \"\" || inputs.lesson == \"\" || inputs.studentName == \"\"){\n alert(\"Error: please enter a valid unit, lesson and name\");\n return;\n }\n\n // make sure there is a lessonData\n if (lessonData === null){\n alert(\"Error: no matching lesson found in database for unit \" + inputs.unit + \n \", lesson \" + inputs.lesson);\n return;\n }\n\n\n // -----------------------------\n // assemble the feedback \n // -----------------------------\n // --- opening sentence ---\n let openingSentence = \"\";\n if (inputs.newStudent == true){\n openingSentence = getSentence(\"opening_newStudent\");\n } else{\n openingSentence = getSentence(\"opening\");\n }\n feedback += openingSentence;\n\n // --- lesson-dependent topic sentences ---\n let topicSentence = \"\";\n if (inputs.lesson == 1){\n topicSentence = getSentence(\"lessonTopic_intro\");\n } else if (lesson == 4){\n topicSentence = getSentence(\"lessonTopic_checkpoint\");\n } else if (lesson == 8){\n topicSentence = getSentence(\"lessonTopic_assessment\");\n }\n feedback += topicSentence;\n\n // --- technical difficulties and other issues ---\n if (inputs.techProblems == true){\n let techProblems = [];\n if (inputs.problemAudio == true) techProblems.push(\"the audio\");\n if (inputs.problemVideo == true) techProblems.push(\"the video\");\n if (inputs.problemInternet == true) techProblems.push(\"the internet speed\");\n\n if (techProblems.length > 0){\n let techProbPhrase = \"\";\n if (techProblems.length == 1){\n techProbPhrase = techProblems[0];\n } else if (techProblems.length == 2){\n techProbPhrase = techProblems[0] + \" and \" + techProblems[1];\n } else{\n techProbPhrase = techProblems[0] + \". \" + techProblems[1] + \", and \" +\n techProblems[2];\n }\n feedback += getSentence(\"techProblems\")\n .replace(/~techProblems/g, techProbPhrase);\n }\n\n if (inputs.problemTime == true){\n if(techProblems.length > 0){\n feedback += getSentence(\"didNotFinishBecauseTechProblems\");\n } else{\n feedback += getSentence(\"didNotFinish\");\n }\n }\n\n if (inputs.problemOther == true && inputs.problemOther != \"\"){\n feedback += inputs.problemOtherText;\n }\n }\n\n\n // --- lesson description ---\n for (let i = 0; i < categories.length; i++){\n if (lessonData[categories[i]].length > 0 &&\n lessonData[categories[i]][0] != \"\"){\n feedback += getLessonDescription(categories[i]);\n }\n }\n \n // --- misc ---\n if (inputs.unitSong == \"success\"){\n feedback += getSentence(\"unitSongSuccess\");\n } else if (inputs.unitSong == \"failure\"){\n feedback += getSentence(\"unitSongFailure\");\n }\n if (inputs.otherComments != \"\") feedback += inputs.otherComments;\n\n // --- conclusion ---\n // thank parents\n if (inputs.parents != \"ignore\"){\n feedback += getSentence(\"thankParents\")\n .replace(/~parents/g, inputs.parents);\n }\n // seld promo\n feedback += getSentence(\"selfPromo\");\n\n // extra comments\n if (inputs.finalComments != \"\") feedback += inputs.finalComments;\n\n // conclusion\n feedback += getSentence(\"ending\");\n\n\n // --- do some final processing on the feedback ---\n // make sure feedback has the right words and cases\n feedback = replaceWords(feedback, inputs);\n feedback = makeUpperCase(feedback);\n\n // show the feedback\n generatedFeedbackBox.innerHTML = \"<p>\" + feedback + \"</p>\";\n}", "title": "" }, { "docid": "3b3af75ff8c89a99e434b729f9b5f86b", "score": "0.47187522", "text": "function showFeedback() {\n var showDiv = document.getElementById(\"prompt\");\n if (showDiv.style.display === \"none\") {\n showDiv.style.display = \"block\";\n } else {\n showDiv.style.display = \"none\";\n }\n }", "title": "" }, { "docid": "69d294e5483a5b090fb470e09298feb2", "score": "0.47078034", "text": "function correctAnswerTemplate() {\n return `\n <div id=\"correctFeedbackContainer\">\n <form id=\"correctFeedbackForm\">\n <span id=\"correctFeedbackText\">Correct!</span>\n <img id=\"correctFeedbackImage\" src=\"https://media.giphy.com/media/6m9oKO7A1k6Os/giphy.gif\" alt=\"dancing karate guy\">\n <button class=\"continueButton\">Continue</button>\n </form>\n </div>\n `\n}", "title": "" }, { "docid": "9bcbf27250a013433327134828863ae7", "score": "0.47038507", "text": "function generateFeedBackTemplate() {\n\treturn `\n\t\t<h3 class=\"answer-result\"></h3>\n\t\t\t<p>${questions[questionIndex].feedback}</p>\n\t\t<div class=\"answer-submit\">\n\t\t\t<button type=\"button\" class=\"next-btn js-next-btn\">Next</button>\n\t\t</div>`;\n}", "title": "" }, { "docid": "9e47d03d2ecfb1a0626e7d7817a87a4b", "score": "0.46953684", "text": "function correctAnswerFeedback() {\n $(`.feedbackContainer`).show().html(correctAnswerTemplate);\n}", "title": "" }, { "docid": "55523e2bf4307bcde59498dcc96a6844", "score": "0.46947926", "text": "function feedback(type, id, name, instruction, message) {\n\n fetch(baseURL+'api/dataStore/actionFeedback/' + id, fetchOptions)\n .then(res => res.json()) \n .then(data => { \n console.log(\"Feedback Full Response: \",data); \n console.log(\"Feedback create data.httpStatusCode: \",data.httpStatusCode); \n if(data.httpStatusCode!==404 || (data.negative>=0 && data.positive>=0) || data.httpStatusCode === 'undefined'){\n var positive = data.positive;\n var negative = data.negative;\n var positiveFeedbackMessages = data.positiveFeedbackMessages;\n var negativeFeedbackMessages = data.negativeFeedbackMessages;\n var feedbackInfo = data.feedbackInfo;\n \n if(!positive) {\n positive = 0;\n }\n\n if(!negative) {\n negative = 0;\n }\n\n /*if(!positiveFeedbackMessages && message || positiveFeedbackMessages && positiveFeedbackMessages.length === 0 && message) {\n positiveFeedbackMessages = [];\n if(type === 1) {\n positiveFeedbackMessages.push(message);\n }\n } else if(positiveFeedbackMessages && message || positiveFeedbackMessages && positiveFeedbackMessages.length > 0 && message){\n if(type === 1) {\n positiveFeedbackMessages.push(message);\n }\n } else if(!positiveFeedbackMessages && !message || positiveFeedbackMessages && positiveFeedbackMessages.length === 0 && !message){\n positiveFeedbackMessages = [];\n }\n if(!negativeFeedbackMessages && message || negativeFeedbackMessages && negativeFeedbackMessages.length === 0 && message) {\n negativeFeedbackMessages = [];\n if(type === 0) {\n negativeFeedbackMessages.push(message);\n }\n } else if(negativeFeedbackMessages && message || negativeFeedbackMessages && negativeFeedbackMessages.length > 0 && message){\n if(type === 0) {\n negativeFeedbackMessages.push(message);\n }\n } else if(!negativeFeedbackMessages && !message || negativeFeedbackMessages && negativeFeedbackMessages.length === 0 && !message){\n negativeFeedbackMessages = [];\n }*/\n\n positiveFeedbackMessages = JSON.stringify(positiveFeedbackMessages);\n negativeFeedbackMessages = JSON.stringify(negativeFeedbackMessages);\n\n if(!feedbackInfo) {\n feedbackInfo = {\"name\": name, \"instruction\": instruction};\n }\n\n feedbackInfo = JSON.stringify(feedbackInfo);\n console.log(\"Existing feedbackInfo: \", feedbackInfo);\n if(type === 1) {\n positive++;\n let jsonPayload = {positive:positive, negative: negative , positiveFeedbackMessages: positiveFeedbackMessages , negativeFeedbackMessages:negativeFeedbackMessages , feedbackInfo:feedbackInfo};\n \n fetch(baseURL+'api/dataStore/actionFeedback/' + id, Object.assign({}, fetchOptions, { method: \"PUT\", body: JSON.stringify(jsonPayload), dataType: 'application/json'})\n ).then(res => res.json()) \n .then(response => {\n console.log(\"response: \", response);\n if(response.httpStatusCode==409 || response.httpStatusCode==401){\n alert(\"Sorry! Conflict in data posting in update operation.\");\n } else if(response.httpStatusCode==500 || response.httpStatusCode==501){\n alert(\"Sorry! Internal server error in update operation.\");\n }else if(response.httpStatusCode==200 || response.httpStatusCode==201){\n alert(\"Congratulations! Your feedback has updated.\");\n }\n setInteracted(id);\n }).catch(error => console.error(error));\n } else if(type === 0) {\n console.log(\"Existing: jsonPayload in type-0-Negative \",jsonPayload)\n negative++;\n\n let jsonPayload = {positive:positive, negative: negative , positiveFeedbackMessages: positiveFeedbackMessages , negativeFeedbackMessages:negativeFeedbackMessages , feedbackInfo:feedbackInfo};\n fetch(baseURL+'api/dataStore/actionFeedback/' + id, Object.assign({}, fetchOptions, { method: \"PUT\", body: JSON.stringify(jsonPayload), dataType: 'application/json'})\n ).then(res => res.json()) \n .then(response => {\n console.log(\"response: \", response);\n if(response.httpStatusCode==409 || response.httpStatusCode==401){\n alert(\"Sorry! Conflict in data posting in update.\");\n } else if(response.httpStatusCode==500 || response.httpStatusCode==501){\n alert(\"Sorry! Internal server error in update operation.\");\n }else if(response.httpStatusCode==200 || response.httpStatusCode==201){\n alert(\"Congratulations! Your feedback has updated.\");\n }\n setInteracted(id);\n }).catch(error => console.error(error));\n }\n } else {\n var positive = 0;\n var negative = 0;\n var positiveFeedbackMessages = [];\n var negativeFeedbackMessages = [];\n var feedbackInfo = {\"name\": name, \"instruction\": instruction};\n console.log(\"New feedbck info: data \",feedbackInfo)\n if(message && type === 1) {\n positiveFeedbackMessages.push(message);\n } else if(message && type === 0) {\n negativeFeedbackMessages.push(message);\n }\n\n positiveFeedbackMessages = JSON.stringify(positiveFeedbackMessages);\n negativeFeedbackMessages = JSON.stringify(negativeFeedbackMessages);\n feedbackInfo = JSON.stringify(feedbackInfo);\n if(type === 1) {\n positive++;\n\n\n let jsonPayload = {positive:positive, negative: negative , positiveFeedbackMessages: positiveFeedbackMessages , negativeFeedbackMessages:negativeFeedbackMessages , feedbackInfo:feedbackInfo};\n\n fetch(baseURL+'api/dataStore/actionFeedback/' + id, Object.assign({}, fetchOptions, { method: \"POST\", body: JSON.stringify(jsonPayload), dataType: 'application/json'})\n ).then(res => res.json()) \n .then(response => {\n console.log(\"response: \", response);\n if(response.httpStatusCode==409 || response.httpStatusCode==401){\n alert(\"Sorry! Conflict in data posting.\");\n } else if(response.httpStatusCode==500 || response.httpStatusCode==501){\n alert(\"Sorry! Internal server error.\");\n }else if(response.httpStatusCode==200 || response.httpStatusCode==201){\n alert(\"Congratulations! Your feedback has added.\");\n }\n setInteracted(id);\n }).catch(error => console.error(error));\n } else if(type === 0) {\n negative++;\n let jsonPayload = {positive:positive, negative: negative , positiveFeedbackMessages: positiveFeedbackMessages , negativeFeedbackMessages:negativeFeedbackMessages , feedbackInfo:feedbackInfo};\n fetch(baseURL+'api/dataStore/actionFeedback/' + id, Object.assign({}, fetchOptions, { method: \"POST\", body: JSON.stringify(jsonPayload), dataType: 'application/json'})\n ).then(res => res.json()) \n .then(response => {\n console.log(\"response: \", response);\n if(response.httpStatusCode==409 || response.httpStatusCode==401){\n alert(\"Sorry! Conflict in data posting.\");\n } else if(response.httpStatusCode==500 || response.httpStatusCode==501){\n alert(\"Sorry! Internal server error.\");\n }else if(response.httpStatusCode==200 || response.httpStatusCode==201){\n alert(\"Congratulations! Your feedback has added.\");\n }\n setInteracted(id);\n }).catch(error => console.error(error));\n }\n } \n \n }).catch(error => console.log(error)); \n \n }", "title": "" }, { "docid": "6843bdc16a8ad9507cc065a8f2ca7228", "score": "0.46793416", "text": "function LabelWrapper(_ref) {var className = _ref.className,children = _ref.children,htmlFor = _ref.htmlFor,label = _ref.label;return _react2.default.createElement('div', { className: className }, _react2.default.createElement(_Label2.default, { htmlFor: htmlFor, label: label }), children);}", "title": "" }, { "docid": "49996e0dfd3b3685d85c7f0844a1caef", "score": "0.46793112", "text": "function provideFeedback(incomingErrors) {\n for (var i = 0; i < incomingErrors.length; i++) {\n $(\"#\" + incomingErrors[i]).addClass(\"errorClass\");\n $(\"#\" + incomingErrors[i] + \"Error\").removeClass(\"errorFeedback\");\n }\n $(\"#errorDiv\").html(\"Errors encountered\");\n }", "title": "" }, { "docid": "5dec8c51effe68a85a949ecb1ec845d3", "score": "0.46792892", "text": "function wrap_component(title, component)\n {\n function Component_wrapper(expanded, innerHTML, params)\n {\n /* SET EXTRA FUNCTIONALITY DEFAULTS */\n Object.defineProperties(this, {\n /* Whether the data in this component should be stored in session storage */\n sessionStorage: getDescriptor(false, true),\n\n /* Whether the data in this component should be stored in local storage */\n localStorage: getDescriptor(false, true),\n\n /* Whether the data in this component should be stored in the model */\n store: getDescriptor(false, true),\n\n /* Whether this component is allowed to have multiple copies of itself as child components (recursive) */\n multiple: getDescriptor(false, true),\n\n /* extends the filters */\n filters: getDescriptor(copy({}, __config.filters)),\n \n /* COMPONENT INNER CHILD NODES */\n innerHTML: getDescriptor((innerHTML || ''), true),\n \n /* THE ACTUAL EXPANDED COMPONENT NODES */\n component: getDescriptor(expanded, true),\n \n /* This method runs after the component has fully rendered */\n onfinish: getDescriptor(function(){}, true),\n \n /* Make a copy of the frytki extensions */\n __frytkiExtensions__: getDescriptor(frytki().__frytkiExtensions__, true)\n })\n \n /* CREATE OVERWRITE */\n component.apply(this, arguments);\n \n /* BIND FILTERS TO THIS */\n this.filters = bindMethods(this, this.filters);\n \n /* FETCH STORAGE VALUES */\n if(this.localStorage)\n {\n getStorage('local', this.name, this);\n /* listen for any update and update the storage */\n this.addEventListener('*update', (function(){\n setStorage('local', this.name, this);\n }).bind(this))\n }\n \n if(this.sessionStorage)\n {\n getStorage('session', this.name, this);\n /* listen for any update and update the storage */\n this.addEventListener('*update', (function(){\n setStorage('session', this.name, this);\n }).bind(this))\n }\n \n if(this.store)\n {\n getStorage('model', this.name, this);\n /* listen for any update and update the storage */\n this.addEventListener('*update', (function(){\n setStorage('model', this.name, this);\n }).bind(this))\n }\n \n /* If any params were passed we add them to the object */\n if(params) handleParams(this, params);\n \n /* BIND SUB METHODS TO THIS */\n bindMethods(this, this);\n \n /* OVERWRITE ALL ENUMERABLE PROPERTIES TO BE OBSERVABLE */\n return convertStaticsToObservables(this);\n }\n \n /* Inherit from frytki */\n Component_wrapper.prototype = frytki();\n \n /* COPY PROTOTYPES FROM COMPONENT */\n Component_wrapper.prototype = copy(Component_wrapper.prototype, component.prototype);\n \n /* SET EXTRA PROTOTYPE FUNCTIONALITY */\n Component_wrapper.prototype.name = title;\n Component_wrapper.prototype.listen = listen;\n Component_wrapper.prototype.unlisten = unlisten;\n Component_wrapper.prototype.alert = alert;\n \n return Component_wrapper;\n }", "title": "" }, { "docid": "fe2dc5e6f33560905ca9a3b42baaf083", "score": "0.4676035", "text": "function AnswerAlert(props) {\n var validateAnswer = props.ifCorrect;\n var quesNo = props.quesNo;\n if (validateAnswer) {\n return React.createElement(\"div\", { className: props.shouldHide ? 'hidden alert alert-success' : 'alert alert-success' }, \"Correct!\");\n }\n return React.createElement(\"div\", { className: props.shouldHide ? 'hidden alert alert-danger' : 'alert alert-danger' }, \"Wrong!\");\n}", "title": "" }, { "docid": "669b3726de44bfc893042165a9b096c4", "score": "0.46732885", "text": "function FunctionalComponent(props) {\n return (\n <div className=\"DemoComponent\">\n <h1>Functional component with msg: {props.msg}</h1>\n </div>\n );\n}", "title": "" }, { "docid": "32ccb653437c0c3d092d75a504e9fe5e", "score": "0.46650308", "text": "function wrongAnswerTemplate() {\n var answerIndex = questionsAnswers[questionIndex-1].answers[4];\n var correctAnswerText = questionsAnswers[questionIndex-1].answers[answerIndex-1];\n return `\n <div id=\"wrongFeedbackContainer\">\n <form id=\"wrongFeedbackForm\">\n <span id=\"wrongFeedbackText\">Wrong answer</span>\n <span id=\"showCorrectAnswerText\">The correct answer was ${correctAnswerText}</span>\n <img id=\"wrongFeedbackImage\" src=\"https://media.giphy.com/media/iZCd5DtKEiMq4/giphy.gif\" alt=\"tumbling Wario in defeat\">\n <button class=\"continueButton\">Continue</button>\n </form>\n </div>\n `\n}", "title": "" }, { "docid": "be74cbe416740051bab54e71ebf4fdb9", "score": "0.46649683", "text": "function displayTrialFeedback(trial_data) {\n if (typeof trial_data.correct !== \"undefined\") {\n var feedback_text = trial_data.correct ? \"Correct!\" : \"Incorrect\";\n var feedback_class = trial_data.correct ? \"correct\" : \"incorrect\";\n var feedback_html = '<h3 class=\"'+feedback_class+'\">'+feedback_text+'</h3>';\n\n // show feedback\n $('#jspsych-feedback').html(feedback_html);\n // hide feedback\n window.setTimeout(function() {\n $('#jspsych-feedback').empty();\n }, 800);\n }\n}", "title": "" }, { "docid": "c6cef6f5d86e6db243d2159ba727e08e", "score": "0.4658954", "text": "function wrapper(props) {\n /**\n * @params container (Element) - DOM element to add deck.gl canvas to\n * @params controller (Object) - Controller class. Leave empty for auto detection\n */\n class DeckGLInternal extends _base.base.deck.Deck {\n constructor(props) {\n if (typeof document === 'undefined') {\n // Not browser\n throw Error('Deck can only be used in the browser');\n }\n\n const {\n deckCanvas\n } = createCanvas(props);\n const viewState = props.initialViewState || props.viewState || {};\n super(Object.assign({}, props, {\n width: '100%',\n height: '100%',\n canvas: deckCanvas,\n controller: OrbitControllerClass,\n initialViewState: viewState\n })); // Callback for the controller\n\n this._updateViewState = params => {\n if (this.onViewStateChange) {\n this.onViewStateChange(params);\n }\n };\n }\n\n setProps(props) {\n // this._updateViewState must be bound to `this`\n // but we don't have access to the current instance before calling super().\n if ('onViewStateChange' in props && this._updateViewState) {\n // This is called at least once at _onRendererInitialized\n this.onViewStateChange = props.onViewStateChange;\n props.onViewStateChange = this._updateViewState;\n }\n\n super.setProps(props);\n }\n\n }\n\n const instance = new DeckGLInternal(props);\n return instance;\n }", "title": "" }, { "docid": "592a335277a2772ee4ded0fab61d8b3d", "score": "0.46526444", "text": "function _create (args) {\n wrapper = morfine(() => renderer(ctx, ...args), _handleBefore, _handleAfter)\n\n // attach event handlers\n onload(wrapper.el, _handleLoad, _handleUnload, ctx._bid)\n\n // shortcuts to wrapper\n Object.defineProperty(ctx, 'el', {\n get: function () {\n return wrapper.el\n }\n })\n ctx.r = ctx.rerender = function () {\n ctx._olID = wrapper.el.dataset[OL_KEY_ID]\n wrapper.r()\n }\n }", "title": "" }, { "docid": "58d44b48d07b48539f8960defa28f96e", "score": "0.4647158", "text": "buildLabel() {\n\n if (!this.label) { return null; }\n\n this.labelobj = document.createElement('label');\n this.labelobj.setAttribute('for', this.id);\n this.labelobj.setAttribute('id', `${this.id}-label`);\n this.labelobj.innerHTML = this.label;\n\n if (this.form) {\n this.labelobj.setAttribute('form', this.form.id);\n }\n\n if (this.help) {\n if (this.mute) {\n let s = document.createElement('span');\n s.classList.add('mutehelp');\n s.innerHTML = this.help;\n this.labelobj.appendChild(s);\n } else {\n this.helpbutton = new HelpButton({\n id: `${this.id}-help`,\n tooltip: this.help\n });\n this.labelobj.appendChild(this.helpbutton.button);\n }\n }\n\n }", "title": "" }, { "docid": "ba963f6faaf00f10a5de174f84057d44", "score": "0.46419072", "text": "render() {\n let display;\n if (this.state.showForm == true) {\n display = <Form callback={this.getInputFormFields} />;\n } else {\n display = (\n <div className={this.state.alertClass}>{this.state.alertMessage}</div>\n );\n }\n\n return <div className='p-5'>{display}</div>;\n }", "title": "" }, { "docid": "14ce01d23a5a0c0154271bdb21d9330e", "score": "0.46342677", "text": "createWrapper() {\n var element = document.createElement('div');\n element.className = 'l-flex-item';\n this.parent.appendChild(element);\n return element;\n }", "title": "" }, { "docid": "adde2ae96eaf51064385268f52e54060", "score": "0.46339786", "text": "function FeedbackForm(form) {\r\n \tthis.form=form;\r\n\tthis.data=form.serializeArray();\r\n this.errorContainer=form.find('#contact-error');\r\n this.successContainer=form.find('#contact-success');\r\n this.loadingContainer=form.find('#contact-loading');\r\n \r\n\tthis.fields=['name','phone','address','comment'];\r\n\tthis.errorStatus = {\r\n\t\tname:\"Не допускается ввод ссылок на сторонние ресурсы.\",\r\n\t\tphone:\"Введите номер телефона в корректном формате.\",\r\n\t\taddress:\"Не допускается ввод ссылок на сторонние ресурсы.\",\r\n\t\tcomment:\"Не допускается ввод ссылок на сторонние ресурсы.\"\r\n\t}; \r\n console.log(this.data);\r\n }", "title": "" }, { "docid": "879bfaa46efc0c72e7f16ffbc56c9a55", "score": "0.46299136", "text": "createFaustInterfaceElement() {\n if (this.faustInterfaceView && this.faustInterfaceView.type) {\n if (this.faustInterfaceView.type === \"vslider\" || this.faustInterfaceView.type === \"hslider\") {\n return this.faustInterfaceView.addFaustModuleSlider(this.itemParam, parseFloat(this.precision), this.unit);\n }\n else if (this.faustInterfaceView.type === \"button\") {\n return this.faustInterfaceView.addFaustButton(this.itemParam);\n }\n else if (this.faustInterfaceView.type === \"checkbox\") {\n return this.faustInterfaceView.addFaustCheckBox(this.itemParam.init);\n }\n }\n }", "title": "" }, { "docid": "95b70191bc05bb0097b59d3cc45bc98c", "score": "0.46281987", "text": "function Wrapper() {}", "title": "" }, { "docid": "95b70191bc05bb0097b59d3cc45bc98c", "score": "0.46281987", "text": "function Wrapper() {}", "title": "" }, { "docid": "931e3b1a3e2b747e1bcfb84849780382", "score": "0.46258673", "text": "function renderFeedbackPage() {\n let checkedAnswer = $('input[name=answer].active').val();\n let correctAnswer = QUESTIONDATA[USERDATA.currentQuestion - 1].answer;\n\n if (checkedAnswer === correctAnswer) {\n $('.feedback-section').append(\n `<div class=\"feedback-correct\">\n <h3>You were right!</h3>\n <button type=\"button\" class=\"nextQuestionButton\">Next Question</button>\n </div>`);\n USERDATA.answersCorrect += 1;\n } else {\n $('.feedback-section').append(\n `<div class=\"feedback-wrong\">\n <h3>Oh no!</h3>\n <p>The correct answer was \"${correctAnswer}\"</p>\n <button type=\"button\" class=\"nextQuestionButton\">Next Question</button>\n </div>`);\n USERDATA.answersIncorrect += 1;\n\n $('input[name=answer].active').addClass(\"incorrect\");\n }\n // Set correct and incorrect backgrounds\n $('input[type=\"button\"][value=\"' + correctAnswer + '\"]').addClass(\"correct\");\n $('input[type=\"button\"]').attr('disabled', true);\n}", "title": "" }, { "docid": "8e0ab6916ed3bdda1d3bc6c77261b0c1", "score": "0.46228123", "text": "_createWarning () {\n this.warning = this._addDiv(['warning', 'warning-hidden']);\n this.el.insertBefore(this.warning, this.list.el);\n }", "title": "" }, { "docid": "4bce33ca5d06862577e641afa4c0d730", "score": "0.4601037", "text": "componentDidMount() {\n console.log('App Mounted');\n this.getFeedback();\n }", "title": "" }, { "docid": "f04d49c49ba26b2dd8962ca6b03893f9", "score": "0.4588069", "text": "setHumanFeedback(feedback) {\n this.waiting_feedback = false;\n let user_status = EasyReadingReasoner.user_S.relaxed;\n if (feedback === \"help\") {\n user_status = EasyReadingReasoner.user_S.confused;\n }\n this.reward = this.humanFeedbackToReward(this.last_action, user_status);\n console.log(\"Got feedback \" + feedback + \". Setting reward to \" + this.reward);\n this.user_status = user_status;\n }", "title": "" }, { "docid": "7e2ac41f0b8f4b3fc6532ab180f81632", "score": "0.4583724", "text": "function displayFeedback(feedback, isCorrect)\n{\n // Hide the answer selection buttons while feedback is displayed.\n $(\"#answer-button-container :button\").hide();\n if (isCorrect)\n // If the answer was correct, then inform of that.\n $(\"#q-and-a-container\").append(\"<h3 class='response'>You selected the <span class='correct'>correct</span> answer.</h3>\");\n else if (currentQuestionAnswerSelected != \"-\")\n // If the answer was incorrect, then inform of that.\n $(\"#q-and-a-container\").append(\"<h3 class='response'>You selected an <span class='incorrect'>incorrect</span> answer.</h3>\");\n else\n // If an answer was not selected, then inform of that.\n $(\"#q-and-a-container\").append(\"<h3 class='response'>You did not select an answer.</h3>\");\n \n // In any case, display the available feedback.\n $(\"#q-and-a-container\").append(\"<h3 class='response'>\" + feedback + \"</h3>\");\n // Makes the answer notification centered with rest of content.\n $(\"#selected-answer-message\").removeClass(\"selected-answer-pre-feedback\");\n} // end-displayFeedback", "title": "" }, { "docid": "1715143de2b329bd3211c430a9403977", "score": "0.4581916", "text": "function setFeedbackFormContentF1(f){\n\t\t\t\n\t\t\twindow.feedback.host\t\t\t\t\t\t\t\t=\tlocation.host;\n\t\t\twindow.feedback.pathname\t\t\t\t\t\t\t=\tlocation.pathname;\n\t\t\t\n\t\t\twindow.feedback.form[f]\t\t\t\t\t\t\t\t=\t{};\n\t\t\twindow.feedback.form[f].email\t\t\t\t\t\t=\t[];\n\t\t\twindow.feedback.form[f].email[0]\t\t\t\t\t=\t{};\n\t\t\twindow.feedback.form[f].email[0].optPost\t\t\t=\t'emailTelegramFeedback';\n\t\t\twindow.feedback.form[f].email[0].chatId\t\t\t\t=\t'463530275';\t\t\t\n\t\t\twindow.feedback.form[f].email[0].toEmail\t\t\t=\t'';\n\t\t\twindow.feedback.form[f].email[0].fromEmail\t\t\t=\t'From: Roman Cheskidov <[email protected]>\\r\\n';\n\t\t\twindow.feedback.form[f].email[0].BCC\t\t\t\t=\t'[email protected]';\n\t\t\twindow.feedback.form[f].email[0].topic\t\t\t\t=\t'Thank you for the request';\n\t\t\twindow.feedback.form[f].email[0].message\t\t\t=\t''\t+\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t'Hi,' \t\t\t\t+\t'<br />' + '<br />'\t+\n\t\t\t\t'Thank you for your request message.'\t\t\t+ '<br />' +\n\t\t\t\t'I will contact you as soon as possible.' + '<br />' + '<br />' +\n\t\t\t\t'Sincerely yours,' \t\t\t\t\t\t+ '<br />' +\n\t\t\t\t'Roman Cheskidov' \t\t\t\t\t\t+ '<br />' +\n\t\t\t\t'+1 650 7410014' \t\t\t\t\t\t+ '<br />' +\n\t\t\t\t'Skype: rootstem'\t\t\t\t\t\t+ '<br />' +\n\t\t\t\t'http://r1.userto.com'\t\t\t\t\t+ '<br />' +\n\t\t\t\t\t\t\t\t\t\t\t\t\t'<br />' +\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t'<br />' +\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t'<br />' +\n\t\t\t\t\t\t\t\t\t'<p style=\"color: grey;\">'\t+\t\n\t\t\t\t\t\t\t\t\t'If you send this request with the media: ' + '[email protected]' + ' '+\n\t\t\t\t\t\t\t\t\t'by mistake, please, send reply letter with subject \"Cancel the request\".'\t+\n\t\t\t\t\t\t\t\t\t'</p>';\n\n\t\t\twindow.feedback.form[f].elem\t\t\t\t\t\t=\t[];\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t//Data for кнопка 'Отправить', [3] form element, button, type: submit-modal\t\n\t\t\twindow.feedback.form[f].elem[0]\t\t\t\t\t\t=\t{};\t\t\t\n\t\t\twindow.feedback.form[f].elem[0].tagName\t\t\t\t=\t'a';\n\t\t\twindow.feedback.form[f].elem[0].tagType\t\t\t\t=\t'modal';\n\t\t\twindow.feedback.form[f].elem[0].tagInnerHTML\t\t=\t'Ask for callback';\n\t\t\twindow.feedback.form[f].elem[0].tagClass\t\t\t=\t'c-p-Blue-Grey-500';\n\t\t\twindow.feedback.form[f].elem[0].modalNum\t\t\t=\t'0';\t\t\t\t\t\t\n\n\t\t\t//Data for 'Name:', [0] form element, input\t\t\t\t\t\t\n\t\t\twindow.feedback.form[f].elem[1]\t\t\t\t\t\t=\t{};\t\t\t\t\n\t\t\twindow.feedback.form[f].elem[1].labelInnerHTML\t\t=\t'Your name';\n\t\t\twindow.feedback.form[f].elem[1].labelClass\t\t\t=\t'control-label';\t\t\t\n\t\t\twindow.feedback.form[f].elem[1].tagName\t\t\t\t=\t'input';\n\t\t\twindow.feedback.form[f].elem[1].tagType\t\t\t\t=\t'text'; //'number';\n\t\t\twindow.feedback.form[f].elem[1].tagPlaceholder\t\t=\t'John Smith';\t\t\t\t\t\t\n\t\t\twindow.feedback.form[f].elem[1].tagClass\t\t\t=\t'form-control';\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\n\t\t\t//[0][1] Data for кнопка 'Type of the user:', form element, select, type: multiple\n\t\t\twindow.feedback.form[f].elem[2]\t\t\t\t\t\t=\t{};\t\t\t\t\n\t\t\twindow.feedback.form[f].elem[2].labelInnerHTML\t\t=\t'Telecom type';\n\t\t\twindow.feedback.form[f].elem[2].labelClass\t\t\t=\t'control-label';\t\t\t\n\t\t\twindow.feedback.form[f].elem[2].tagName\t\t\t\t=\t'select';\n\t\t\twindow.feedback.form[f].elem[2].tagType\t\t\t\t=\t'';\t\t\t\n\t\t\twindow.feedback.form[f].elem[2].tagClass\t\t\t=\t'form-control';\n\t\t\twindow.feedback.form[f].elem[2].tagRequired\t\t\t=\t'required';\t\t\t\n\t\t\twindow.feedback.form[f].elem[2].tagOption\t\t\t=\t[\n\t\t\t\t\t{'optInnerHTML': 'You like'},\n\t\t\t\t\t{'optInnerHTML': 'Skype'},\n\t\t\t\t\t{'optInnerHTML': 'WhatsApp'},\n\t\t\t\t\t{'optInnerHTML': 'Telegram'},\n\t\t\t\t\t{'optInnerHTML': 'WeChat'},\n\t\t\t\t\t{'optInnerHTML': 'Viber'},\n\t\t\t\t\t{'optInnerHTML': 'Email'},\n\t\t\t\t\t{'optInnerHTML': 'Phone'}\t\t\t\t\t\n\t\t\t\t];\n\n\t\t\t//Data for 'Skype, WhatsApp, Telegram, WeChat, Viber, Email or Phone', [1] form element, input\t\t\t\t\t\t\t\t\t\n\t\t\twindow.feedback.form[f].elem[3]\t\t\t\t\t\t=\t{};\t\t\t\t\n\t\t\twindow.feedback.form[f].elem[3].labelInnerHTML\t\t=\t'Number (login)';\n\t\t\twindow.feedback.form[f].elem[3].labelClass\t\t\t=\t'control-label';\t\t\t\n\t\t\twindow.feedback.form[f].elem[3].tagName\t\t\t\t=\t'input';\n\t\t\twindow.feedback.form[f].elem[3].tagRequired\t\t\t=\t'required';\n\t\t\twindow.feedback.form[f].elem[3].tagType\t\t\t\t=\t'text'; //'number';\t\t\t\n\t\t\twindow.feedback.form[f].elem[3].tagClass\t\t\t=\t'form-control';\n\t\t\twindow.feedback.form[f].elem[3].tagPlaceholder\t\t=\t'your contacts';\n\t\t\t\n\t\t\t//Data for кнопка 'Отправить', [3] form element, button, type: submit-modal\n\t\t\twindow.feedback.form[f].elem[4]\t\t\t\t\t\t=\t{};\t\t\t\n\t\t\twindow.feedback.form[f].elem[4].tagName\t\t\t\t=\t'button';\n\t\t\twindow.feedback.form[f].elem[4].tagType\t\t\t\t=\t'submit-modal';\n\t\t\twindow.feedback.form[f].elem[4].tagInnerHTML\t\t=\t'Send';\n\t\t\twindow.feedback.form[f].elem[4].tagClass\t\t\t=\t'btn btn-success w-8-em';\n\t\t\twindow.feedback.form[f].elem[4].modalNum\t\t\t=\t'1';\n\n\t\t\t//Data for кнопка 'Очистить', [4] form element, button, type: reset\n\t\t\twindow.feedback.form[f].elem[5]\t\t\t\t\t\t=\t{};\t\t\t\n\t\t\twindow.feedback.form[f].elem[5].tagName\t\t\t\t=\t'button';\n\t\t\twindow.feedback.form[f].elem[5].tagType\t\t\t\t=\t'reset';\n\t\t\twindow.feedback.form[f].elem[5].tagInnerHTML\t\t=\t'Reset';\n\t\t\twindow.feedback.form[f].elem[5].tagClass\t\t\t=\t'btn btn-light';\n\t\treturn;\n\t}", "title": "" }, { "docid": "555b1fa829a1fab545e8794049fd0ade", "score": "0.45817935", "text": "off() {\n this.xapi.feedback.off();\n }", "title": "" }, { "docid": "3510413b1629a05ac13dd05f77de05ff", "score": "0.45755008", "text": "function setMessage(message) {\n userFeedback_p.innerHTML = message;\n}", "title": "" }, { "docid": "086f23f869a31a31ded6ba98991ea4f2", "score": "0.457165", "text": "render() {\n return (\n <JeopardyDisplay\n question={this.state.data.question}\n category={this.state.data.category.title}\n value={this.state.data.value}\n score={this.state.score}\n userAnswer={this.state.userAnswer}\n handleClick={this.handleClick}\n handleSubmit={this.handleSubmit}\n handleInputChange={this.handleInputChange}\n />\n );\n }", "title": "" }, { "docid": "4f994c1ce64685c3e13982589d1817f8", "score": "0.45701465", "text": "sendFeedback(templateId, variables) {\r\n window.emailjs.send(\r\n 'gmail', templateId,\r\n variables\r\n ).then(res => {\r\n console.log('Email successfully sent!')\r\n })\r\n .catch(err => console.error('Oh well, you failed. Here some thoughts on the error that occured:', err))\r\n }", "title": "" }, { "docid": "7dc300934eec51a7a4a2451d8be0c97b", "score": "0.45663983", "text": "function provideFeedback() {\n\t\t\n\t\t//report they made it to final screen\n\t\tga('send', 'event', 'Navigation', 'Final Screen', 'Final Screen Loaded');\n\n\t\t\n if (currentScore > winningScore) {\n $('#finalCurrentScore').html(currentScore);\n $('#finalWinningScore').html(winningScore);\n $('#finalFeedback').html(\"That's great, you won.\");\n //$('#restartLink').html('Play again if you want.');\n } else if (currentScore == winningScore) {\n $('#finalCurrentScore').html(currentScore);\n $('#finalWinningScore').html(winningScore);\n $('#finalFeedback').html(\"It's a tie!\");\n //$('#restartLink').html('That was close! Improve your score!');\n\n } else if (currentScore < winningScore) {\n $('#finalCurrentScore').html(currentScore);\n $('#finalWinningScore').html(winningScore);\n $('#finalFeedback').html(\"Not the winning condition, unfortunately. You should keep trying.\");\n // $('#restartLink').html('Improve your score, take down this challenger.');\n\n }\n\n\n }", "title": "" }, { "docid": "b8ab387b4e7279a2a7757b28fbf3d53e", "score": "0.45661548", "text": "function ShowFeedback(data) {\n if (data == \"close_feedback\") {\n $(\".question_type .icon-report\").removeClass(\"active\");\n }\n }", "title": "" }, { "docid": "093cfb039dd68d05094512ca85d72501", "score": "0.45652938", "text": "render() {\n return (\n <div>\n <Stateless\n question={this.state.data.question}\n value={this.state.data.value}\n category={this.state.data.category}\n score={this.state.data.score}\n answer={this.state.data.answer}\n\n />\n <Submit handleAnswer={this.handleAnswer} handleChange={this.handleChange} />\n </div>\n );\n }", "title": "" }, { "docid": "7381d7efc3d31e59e822e255bca722a8", "score": "0.4565115", "text": "function checkFeedbackLength(feedbackTextarea, charCounter,\n submit, minLength, maxLength) {\n var length;\n\n length = feedbackTextarea.value.trim().length;\n\n if (length < minLength) {\n submit.disabled = true;\n\n charCounter.innerHTML = (minLength - length) + ' characters needed.';\n charCounter.style.backgroundColor = '#f2dede';\n }\n else if (length > maxLength) {\n submit.disabled = true;\n\n charCounter.innerHTML = (length - maxLength) + ' characters over.';\n charCounter.style.backgroundColor = '#f2dede';\n }\n else {\n submit.disabled = false;\n\n charCounter.innerHTML = (maxLength - length) + ' characters remaining.';\n charCounter.style.backgroundColor = '#dff0d8';\n }\n }", "title": "" }, { "docid": "5ccaf8543cec27158f08c6995bbffd55", "score": "0.456323", "text": "function Flanger(rate, amount, feedback, offset) {\n\tvar that = {\n\t\trate: (typeof rate !== \"undefined\") ? rate : .25,\n\t\tamount: (typeof amount !== \"undefined\") ? amount : 125,\n\t\tfeedback:\tisNaN(feedback) ? 0 : feedback,\n\t\toffset:\t\tisNaN(offset) ? 125 : offset,\n\t}\n\t\n\tthat = Gibberish.Flanger(that);\n\t\n\treturn that;\n}", "title": "" }, { "docid": "ee805185909aa3327ee166f59d523171", "score": "0.45629027", "text": "function displayUserFeedback() {\n\tvar action = \"Click\";\n\tif (is_touch_device())\n\t\taction = \"Tap\"; \n\tif (currentHeight <= 50)\n\t\tdocument.getElementById(\"message2\").innerHTML = \"<img src='img/1.png' width='30px' height='30px'> not FAST at all!!!\";\n\telse if (currentHeight <= 130)\n\t\tdocument.getElementById(\"message2\").innerHTML = \"<img src='img/2.jpg' width='30px' height='30px'> not FAST yettttt!\";\n\telse if (currentHeight <= 230)\n\t\tdocument.getElementById(\"message2\").innerHTML = \"<img src='img/3.jpg' width='30px' height='30px'> please FASTER!\";\n\telse if (currentHeight <= 325)\n\t\tdocument.getElementById(\"message2\").innerHTML = \"<img src='img/4.png' width='30px' height='30px'> Should be FASTER than this!\";\n\telse if (currentHeight <= 420)\n\t\tdocument.getElementById(\"message2\").innerHTML = \"<img src='img/5.png' width='30px' height='30px'> GOOOD. continue FAST!\";\n\n\tdocument.getElementById(\"message2\").innerHTML += `<BR> Current Height: ${currentHeight}`;\n\n\tif (currentHeight > 420)\n\t\tdocument.getElementById(\"message2\").innerHTML = \"Congratulations, you made it!! <img src='img/5.png' width='30px' height='30px'>\";\n}", "title": "" } ]
cfd2aaaecf4e0846648b2f4de46d3310
component doesn't render anything, just used to log out a user on '/signout' route
[ { "docid": "600fb9ac0a6a1e47052f7e27a8bd3c09", "score": "0.0", "text": "render(){\n return null\n }", "title": "" } ]
[ { "docid": "5e2492bdf396496fdcebd4004e2ed739", "score": "0.78179944", "text": "handleSignout() {\n this.props.signOutUser();\n }", "title": "" }, { "docid": "8cad371c26dac15915ad3463f1348053", "score": "0.7659039", "text": "handleLogout() {\n Auth.logout();\n this.props.history.replace(\"/users/login\");\n }", "title": "" }, { "docid": "00e297b1a2308c9a194b2afb2f4c05b8", "score": "0.7534913", "text": "function handleLogout() {\n dispatch(signOut());\n }", "title": "" }, { "docid": "948fb46d631150ff9fa72bdcd200cbc0", "score": "0.75115347", "text": "signOut() {}", "title": "" }, { "docid": "ecc425a2527524f2954d517c139a551e", "score": "0.75025237", "text": "onLogout(){ \n Accounts.logout();\n this.props.history.replace('/');\n Session.set('user', undefined); //borramos de la sesion los datos del usuario\n }", "title": "" }, { "docid": "dbd03713b45d1fd557fd8019fbd5ef49", "score": "0.7491574", "text": "renderSignout () {\n\t\tif (!this.props.signoutUrl) return null;\n\n\t\treturn (\n\t\t\t<PrimaryNavItem\n\t\t\t\tlabel=\"octicon-sign-out\"\n\t\t\t\thref={this.props.signoutUrl}\n\t\t\t\ttitle=\"Sign Out\"\n\t\t\t>\n\t\t\t\t<span className=\"octicon octicon-sign-out\" />\n\t\t\t</PrimaryNavItem>\n\t\t);\n\t}", "title": "" }, { "docid": "93b45b2258a40cda860a7fae6c75695a", "score": "0.7470009", "text": "function UserSignOut (props) {\n const {context} = props;\n\n useEffect(() => context.actions.signOut());\n return(\n <Redirect to='/' />\n )\n}", "title": "" }, { "docid": "4f2bb95c70f7fa2f73277ce16ec36fa0", "score": "0.74340236", "text": "signOut() {\n localStorage.removeItem(\"cookie_login\");\n // this._socioAuthServ.signOut();\n // this.user = null;\n // console.log(\"User signed out.\");\n }", "title": "" }, { "docid": "864916246bfa020e5a2df63914b9e082", "score": "0.7367418", "text": "handleLogout(e) {\n e.preventDefault();\n this.props.logout();\n }", "title": "" }, { "docid": "3df5c965fce3c31087e0a5cdd6e90b1a", "score": "0.73543483", "text": "logout(e) {\n e.preventDefault();\n window.location.reload();\n auth.signOut()\n .then(() => {\n this.setState({\n user: null\n });\n });\n }", "title": "" }, { "docid": "e3c0ff2f8f7140af2c2f2a4c25ca3522", "score": "0.73407835", "text": "function renderLoggedOutView() {\n return (\n <div className=\"flex items-center justify-center mt-10\">\n <Link to=\"/login\" className=\"mr-4 bg-blue-500 hover:bg-blue-700 text-white font-bold text-2xl py-4 px-6 rounded-full\" > Login </Link>\n <Link to=\"/signup\" className=\"ml-4 bg-blue-500 hover:bg-blue-700 text-white font-bold text-2xl py-4 px-6 rounded-full\" > Signup! </Link>\n </div>);\n }", "title": "" }, { "docid": "e7da9fdca10ef4f0a335a5d8cd327efd", "score": "0.73288774", "text": "handleLogout(event) {\n event.preventDefault();\n window.localStorage.clear();\n window.sessionStorage.clear();\n localStorage.setItem('isLogged', false);\n fetch(`/users/Logout`)\n .then(window.location.href = '/');\n }", "title": "" }, { "docid": "2e3cdfbb8bc7d81fb8d946aed64b4254", "score": "0.73199457", "text": "function loggedOutRender() {\n\treturn `\n\t\t<a href=\"/signup.html\" class=\"sign-up-link logo-style\" >Sign up</a>\n\t\t<a href=\"/login.html\" class=\"login logo-style\">login</a>\n\t`\n}", "title": "" }, { "docid": "088d97655bc7b7d209460f0a13520f98", "score": "0.7299902", "text": "renderSignout() {\n if (!this.props.signoutUrl)\n return null;\n return (React.createElement(PrimaryNavItem, { label: \"octicon-sign-out\", href: this.props.signoutUrl, title: \"Sign Out\" },\n React.createElement(\"span\", { className: \"octicon octicon-sign-out\" })));\n }", "title": "" }, { "docid": "122ac184eeffcca57f0ea3799918a97f", "score": "0.72967166", "text": "handleLogOut() {\n this.props.client.signOut();\n this.props.onSearch();\n }", "title": "" }, { "docid": "ce18ee7198462fb393b28add45525807", "score": "0.7274877", "text": "signOut() {\n // サインアウトボタンが押されたらログアウト\n this.auth.signOut();\n }", "title": "" }, { "docid": "e40c30d9a7a29bd0f097171c1ccd9633", "score": "0.72682405", "text": "signOut() {\n resetSession();\n isAuthenticated() === false;\n browserHistory.push('/');\n }", "title": "" }, { "docid": "196d0bd50b9e023463fea3c8323c299e", "score": "0.7242194", "text": "logout() {\n this.user.authenticated = false\n }", "title": "" }, { "docid": "8e4ef38ae47fc0f151ffb791c1b8de60", "score": "0.7240484", "text": "function handleLogout() {\n logout();\n }", "title": "" }, { "docid": "f3b1f0732b9d565d4f25e330b2ce9dc3", "score": "0.7230527", "text": "logUserOut() {\n this.props.logUserOut();\n }", "title": "" }, { "docid": "3f58f34b1a65a4e4bf000c36f810fd0c", "score": "0.7229863", "text": "logout (){\n \n axios.get('/logout');\n this.setState({\n isAuthenticated: false,\n })\n }", "title": "" }, { "docid": "c1792b353df3dca91fb5841c738d36b1", "score": "0.7205594", "text": "logOut() {\n\t\tthis.props.dispatch(clearAuth());\n\t\tclearAuthToken();\n\t}", "title": "" }, { "docid": "e75e8e10c00423f18a16f21b8d699cbd", "score": "0.71956617", "text": "logout() {\n this.authHelper.logout()\n .then(() => {\n this.setState({\n isAuthenticated: false,\n displayName: ''\n });\n });\n }", "title": "" }, { "docid": "6347de1360ae928d2ec610af77b794d3", "score": "0.7195569", "text": "function logout() {\n auth.logout();\n switchView('login');\n }", "title": "" }, { "docid": "01276a62e7fd51c9a2be7a5d5a53674d", "score": "0.7188217", "text": "signout(){\n this._dropAuth();\n }", "title": "" }, { "docid": "f9e9026ca9dadf3af19b14150ebc63cf", "score": "0.71662164", "text": "logout() {\n this._auth2Service.logout();\n this._scope.$broadcast('onLogoutSuccessful', true);\n this._state.go('/');\n }", "title": "" }, { "docid": "b306d2e8041ceadfdc9551d3903758f2", "score": "0.71569884", "text": "handleClick() {\n // headers are needed for devise_token_auth and are set at login time.\n let headers = {\n 'access-token': cookies.get('access-token'),\n 'client': cookies.get('client'),\n 'token-type': cookies.get('token-type'),\n 'uid': cookies.get('uid'),\n 'expiry': cookies.get('expiry')\n };\n let path = `/auth/sign_out`;\n\n // Set user_id to 0 when logging out.\n cookies.set('user_id', 0);\n axios\n .delete(path,\n { headers: headers })\n .then(() => {\n this.render();\n })\n .catch(err => console.log('Error: ',err,' logging out.'));\n }", "title": "" }, { "docid": "f90457e8720ee7d65cbf690d3b395794", "score": "0.71437347", "text": "logout() {\n authService.logout();\n }", "title": "" }, { "docid": "2c3399fe5451e8e207ae7cf1af654203", "score": "0.71437", "text": "logOut() {\n this.setState({loggedIn: false})\n this.props.postLogout();\n }", "title": "" }, { "docid": "602bea54c6811cf8e5cf8c73590a6db4", "score": "0.7138647", "text": "async function userLoggedOut() {\r\n const logoutResult = await fetch(\"/auth/logout\", {\r\n method: \"GET\",\r\n });\r\n const parsedLogoutResult = await logoutResult.json();\r\n if (parsedLogoutResult.loggedOut) {\r\n toast.success(\"Logged out\");\r\n props.logoutPressed();\r\n } else {\r\n toast.error(\"Couldn't logout. Please try again.\");\r\n }\r\n }", "title": "" }, { "docid": "c6177544eb094b0acfee51c8416defe3", "score": "0.7129559", "text": "function handleLogout() {\n userHasAuthenticated(false);\n setAuthenticatedUser(0);\n }", "title": "" }, { "docid": "d7b45ad06376137885b9c01aedbdf1fc", "score": "0.7108151", "text": "function logout() {\n // do any preprocessing needed\n\n // tell the server to log out\n serverRequest(\"logout\", {}).then(function (result) {\n if (result.response.ok) {\n showContent(\"login\");\n }\n serverStatus(result);\n });\n}", "title": "" }, { "docid": "af2b7da201f82665697fdd086cbefa2f", "score": "0.7107486", "text": "function logout() {\n // do any preprocessing needed\n\n // tell the server to log out\n serverRequest(\"logout\", {}).then(function(result) {\n if (result.response.ok) {\n showContent(\"login\");\n }\n serverStatus(result);\n });\n}", "title": "" }, { "docid": "de6e357cda7af79ea1ac3d496504fe2d", "score": "0.71051335", "text": "handleLogout(e){\n\t\te.preventDefault();\n\n\t\tthis.Auth.logout();\n\n\t\tthis.props.history.push('/');\n\t}", "title": "" }, { "docid": "81cf3a45dfa7e4e47958bfb624cc5560", "score": "0.7099657", "text": "logout() {\n this.http.get(_shared_values_strings__WEBPACK_IMPORTED_MODULE_2__[\"restEndpoint\"] + '/service/logout');\n this.clearUser();\n }", "title": "" }, { "docid": "0be8fc38d64fa893773606e1481e3ff9", "score": "0.70806074", "text": "function logout() {\n return auth.signOut();\n}", "title": "" }, { "docid": "9bff24fc9d86773330acb76c14f19cda", "score": "0.7080173", "text": "function handleLogout(event){\n event.preventDefault();\n setUserLogged(false);\n }", "title": "" }, { "docid": "362501c80d4b4442f3aa13f416593398", "score": "0.7076223", "text": "function signout(req, res, next) {\n req.logout();\n res.status(200).send({message:'Logout Successful'});\n}", "title": "" }, { "docid": "5577886ce8e114f3552993b8dc2a4951", "score": "0.70746195", "text": "logOut() {\n // sign out the user\n auth.signOut().then(function() {\n this.setState({user: null});\n }).catch(function(error) {\n console.log(error)\n });\n }", "title": "" }, { "docid": "226f94692f9c3541eeb2f13d53a84a1b", "score": "0.70691204", "text": "logout () {\r\n localStorage.removeItem('access_token')\r\n localStorage.removeItem('refresh_token')\r\n localStorage.removeItem('email')\r\n localStorage.removeItem('username')\r\n localStorage.removeItem('is_admin')\r\n this.user.authenticated = false\r\n router.push('/login')\r\n }", "title": "" }, { "docid": "ebf0eb01423bd24ef048250e0a6a5753", "score": "0.7068119", "text": "logout() {\n Pinterest.logout();\n Instagram.logout();\n this.context.router.transitionTo('login');\n }", "title": "" }, { "docid": "d8e6dda01c8c6171f9675a8bcb17f7cd", "score": "0.7059742", "text": "handleLogoutUser() {\r\n this.props.onLogoutUser();\r\n }", "title": "" }, { "docid": "f464b5fc743eeb3eecbe8e8077622713", "score": "0.705965", "text": "logout () {\n http.post('auth/logout')\n .then(() => this.unAuthenticate())\n .catch(() => this.unAuthenticate())\n }", "title": "" }, { "docid": "02738ae1708e70d3b717672412da16c2", "score": "0.7059383", "text": "signout(token, cb) {\n axios.get('http://localhost:8080/signout', {\n headers: {\n 'Content-Type' : 'application/x-www-form-urlencoded; charset=UTF-8',\n 'Authorization': token\n }\n \n }).then((response) => {\n console.log(response)\n //Reset the authentication properties and token to indicate\n //the user is not logged in. \n this.isAuthenticated = false\n this.token = null\n localStorage.removeItem('token')\n\n })\n }", "title": "" }, { "docid": "2b2039329d8a66818ee600298699c8a7", "score": "0.7048042", "text": "logout() {\n localStorage.removeItem('id_token')\n localStorage.setItem('isAuthenticated', false);\n this.user.authenticated = false\n router.push({name: \"Login\"});\n }", "title": "" }, { "docid": "9bcf9a67d2ffc79d248bee180411a30f", "score": "0.704778", "text": "function logout() {\n Virtru.Auth.logout({ email: getUser() });\n window.location.href = `${BASE_URL}index.html`;\n}", "title": "" }, { "docid": "d44e0474ae8915d677c6fb45ecfcb027", "score": "0.70438015", "text": "function handleLogOut() {\n\t\tEventEmitter.emit('AdminHome:unmount');\n\t\tCognito.signOut();\n\t\twindow.location.replace(\"./admin-login.html\",\"Admin Login\") \n\t}", "title": "" }, { "docid": "1aea28d7a72f2d96de2eaf9de4bafd6f", "score": "0.7042115", "text": "logout () {\n return this.ctx.$auth.logout()\n }", "title": "" }, { "docid": "57ad6988d547130061a643f221e3dfa2", "score": "0.70269674", "text": "logout() {\n\t\t\t$http.post(`${URL.auth}/logout`)\n\t\t\t\t.then(() => {\n\t\t\t\t\tbaseSvc.alert(null, 'logout success');\n\t\t\t\t\t$cookies.remove('csrftoken');\n\t\t\t\t\tcurrentUser = new _User();\n\t\t\t\t\tsyncUser = new _User();\n\t\t\t\t\t$state.go('landing');\n\t\t\t\t})\n\t\t\t\t.catch(() => {\n\t\t\t\t\tbaseSvc.alert(null, 'login fail');\n\t\t\t\t});\n\t\t}", "title": "" }, { "docid": "1f91530e3ad52673e2a1d01dc6cf9184", "score": "0.70258635", "text": "function logout() {\n return auth.signOut();\n }", "title": "" }, { "docid": "1f91530e3ad52673e2a1d01dc6cf9184", "score": "0.70258635", "text": "function logout() {\n return auth.signOut();\n }", "title": "" }, { "docid": "85f2293655c0b4e02edc244839bb0a5b", "score": "0.70210314", "text": "function logOut() {\n fetch('/logout', {\n method: 'POST',\n credentials: 'include'\n })\n .then(function (response) {\n if (response.redirected) {\n clearInterval(id);\n $(location).attr('href', '/authenticate.html');\n }\n });\n }", "title": "" }, { "docid": "4802d0f2dc929be7cacb22749e66a8fd", "score": "0.7020956", "text": "function signOut() {\n AuthService.signOut();\n }", "title": "" }, { "docid": "8c2d1fc4f65a7dad96d209925ed98b45", "score": "0.70069593", "text": "function logout () {\n // CALL SERVICE METHOD TO LOG OUT\n UserService.logOut().then(function (result) {\n window.open(KEYCLOAK_CONFIG.logoutUrl+'?redirect_uri='+window.location.href, '_self');\n // $state.go('login');\n });\n }", "title": "" }, { "docid": "0c1457b098605f98e5529a8814a36a17", "score": "0.69962543", "text": "logout_user() {\n store.dispatch({\n type:'LOGOUT',\n data: null,\n })\n }", "title": "" }, { "docid": "d8943dcd117b1b7c17367259a07e732f", "score": "0.69880897", "text": "function signOut() {\n authFactory.signOut();\n }", "title": "" }, { "docid": "2dde7a0875b767445c71032d88f051b4", "score": "0.69877785", "text": "logout(state) {\n state.LoggedIn = false;\n }", "title": "" }, { "docid": "06375f8142530b98e65cb37172960fbb", "score": "0.6978014", "text": "onLogout() {\n $.ajax({\n type: 'POST',\n url: url('scripts/logout.php'),\n }).done(() => {\n // Successfully logged in, change view.\n this.props.onLogout();\n }).fail(response => {\n console.error('Failed to logout', response);\n });\n }", "title": "" }, { "docid": "18c4a639cff0e37e2ec1eaeacd702101", "score": "0.6969388", "text": "function handleLogout() {\n setActiveUser(null);\n }", "title": "" }, { "docid": "4bfbb717ab5f35cba5a2e9b71d486dbd", "score": "0.6969351", "text": "handleSignoutClick(event) {\n gapi.auth2.getAuthInstance().signOut();\n }", "title": "" }, { "docid": "3ff11ac65b3cc1da1ead3c1481e539e8", "score": "0.69678104", "text": "logout(event) {\n event.preventDefault()\n // console.log('logging out')\n //makes Axios post to /logout route \n axios.post('/user/logout').then(response => {\n // console.log(\"this is the data\",response.data)\n if (response.status === 200) {\n this.props.updateUser({\n loggedIn: false,\n username: null,\n })\n }\n }).catch(error => {\n // console.log('Logout error')\n }).then( ()=> this.routeChange()\n )\n\n }", "title": "" }, { "docid": "2dd9b7a43fa9c76337184eb354cdbb47", "score": "0.6966479", "text": "signOut() {\n console.log(this.cookieService.getAll());\n this.cookieService.deleteAll();\n this.router.navigate(['/session/signin']);\n }", "title": "" }, { "docid": "a5e2ee0336c74d8323f28ab76b348085", "score": "0.69657254", "text": "function logout() {\n\t\t\t$auth.logout('/login');\n\t\t}", "title": "" }, { "docid": "0fed59b681ced6c26defaffc1d4e498e", "score": "0.6963621", "text": "function handleLogOut() {\r\n localStorage.removeItem('token');\r\n console.log('sign out');\r\n history.push('/login');\r\n }", "title": "" }, { "docid": "39163075f1acb607948863f99cca317a", "score": "0.6958934", "text": "function handleLogout() {\n firebase.auth().signOut()\n setIsSignedIn(false)\n setUserInfo('')\n }", "title": "" }, { "docid": "c1b5d34a208ecdeeac143374990118c8", "score": "0.6957449", "text": "function Logout() {\n\n const logout = async () => {\n await fetch('http://localhost:8000/api/logout', {\n method: 'POST',\n headers: {'Content-Type': 'application/json'},\n credentials: 'include',\n })}\n \n\n return (\n <div>\n \n\n <form onSubmit={logout}>\n <button type=\"submit\">Submit</button>\n </form>\n </div>\n )\n}", "title": "" }, { "docid": "c30ae0604f447c865d299909f1cbfd6b", "score": "0.6940122", "text": "async logout() {\n // console.log(\"logout()\");\n return await this._fetch({\n method: 'DELETE',\n url: '/auth/sign_out',\n body: {}\n })\n\n .then((response) => {\n if ((response.status === 200)\n || // user not found\n (response.status === 404)) {\n return response;\n } else {\n return response.json()\n\n .then((json) => {\n // console.log('parsed json', json);\n throw(json.errors[0]);\n })\n\n .catch((error) => {\n // console.log(\"ERROR: \", error);\n throw(error);\n })\n }\n })\n\n .catch((error) => {\n // console.log(\"ERROR: \", error);\n throw(error);\n });\n }", "title": "" }, { "docid": "c1197464632efd10148da39d112a2e1c", "score": "0.6931231", "text": "function Logout() {\n localStorage.clear();\n window.location.href = '/';\n return (\n <Logout/> \n );\n}", "title": "" }, { "docid": "87688ae86b5289247749e4d6cbc3dbff", "score": "0.6927111", "text": "function logout() {\n handleLogout();\n console.log(\"logging out\")\n reloadPage();\n }", "title": "" }, { "docid": "069f1ac3cd80416d1b3e3cc4ae97c415", "score": "0.69267684", "text": "function logOut() {\n _loggedIn = false;\n navbarData.loggedIn = _loggedIn;\n renderLogOutMsg();\n renderNavbar();\n if(_currPage == \"education\") {\n renderEducationCards();\n }\n if(_currPage == \"food\") {\n renderFoodCards();\n }\n if(_currPage == \"fun\") {\n renderFunCards();\n }\n if(_currPage == \"jobs\") {\n renderJobsCards();\n }\n if(_currPage == \"living\") {\n renderLivingCards();\n }\n if(_currPage == \"save\") {\n renderSaveCards();\n }\n if(_currPage == \"search\") {\n renderSearchCards();\n }\n if(_currPage == \"shop\") {\n renderShopCards();\n }\n if(_currPage == \"services\") {\n renderServicesCards();\n }\n if(_currPage == \"transportation\") {\n renderTransportationCards();\n }\n}", "title": "" }, { "docid": "b935660950df560b781afa5c4e5c1759", "score": "0.6925698", "text": "signOut() {\n // Clear credentials\n auth.saveCredentials(undefined);\n // Update state\n this.setState({credentials: undefined});\n }", "title": "" }, { "docid": "cf3442bf7d4484553fce07780cc6ef55", "score": "0.6925629", "text": "function logout(){\n auth.signOut().then(() =>{\n console.log(\"Usuário foi deslogado\")\n }).catch(error => {\n console.log(error);\n })\n}", "title": "" }, { "docid": "c7b5e9f13ecf8a2f005cd39bd0f03f67", "score": "0.6924605", "text": "function logout() {\n\tauthService.logout();\n}", "title": "" }, { "docid": "ceb4c3d5934382951118a835b907fd87", "score": "0.6915135", "text": "logout({ state, commit }) {\n firebase.auth()\n .signOut()\n .then(() => {\n commit(\"setUser\", null);\n router.push(\"/\");\n commit(\"setSnackbar\", {\n color: \"success\",\n timeout: 3000,\n text: \"Vous avez bien été déconnecté\"\n });\n })\n .catch(err => {\n console.log(err);\n });\n }", "title": "" }, { "docid": "e664b0c7213deee35d00bf16da1e733f", "score": "0.6912137", "text": "function signout()\n {\n auth.signOut();\n }", "title": "" }, { "docid": "b1fe9231e8826a2d4a93b8edd56b1ee4", "score": "0.691148", "text": "logout(){\n this.$parent.authenticated = false;\n this.$parent.profilepick = false;\n this.$parent.isadmin = false;\n this.$parent.permissions = false;\n this.$parent.users = [];\n this.$parent.user = {};\n this.$router.push('/login');\n }", "title": "" }, { "docid": "487a48b3ee0ab421aef9c4969b31ee74", "score": "0.6909442", "text": "function signout(req, res) {\n keystone.session.signout(req, res, function() {\n return res.redirect(\"/\");\n })}", "title": "" }, { "docid": "c5610fb7472f1b7645efd992b67ff413", "score": "0.6907044", "text": "logout () {\n localStorage.removeItem('jwt_token')\n this.user.authenticated = false\n }", "title": "" }, { "docid": "eb6f7cf6cdc5e88d40fd022009639981", "score": "0.69014627", "text": "logOut({ commit }) {\n commit('unsetUser')\n commit('unsetToken')\n \n // TODO redirect the user to the homepage.\n console.log('User Logged out!')\n }", "title": "" }, { "docid": "6b384ff6d8b30b3f0886e12a081a2cdd", "score": "0.6898679", "text": "logout() {\n return request.post('/logout');\n }", "title": "" }, { "docid": "c6873dc85f4804065b4dad0be6646435", "score": "0.68977535", "text": "logout() {\n sessionStorage.removeItem(\"user\");\n }", "title": "" }, { "docid": "43ef0f22bb5c26fc77c03814e61b6f0b", "score": "0.6897325", "text": "function Logout(){\n let history = useHistory();\n const onSuccess = (res) => {\n send_logout_to_server()\n .then(() => {\n history.push({\n pathname: '/landing' });\n });\n };\n return (\n <div>\n <GoogleLogout\n clientId={clientId}\n buttonText=\"Logout\"\n onLogoutSuccess={onSuccess}\n render={renderProps => (\n <Button onClick={renderProps.onClick} disabled={renderProps.disabled} variant=\"danger\" size=\"lg\">Log out</Button>\n )}\n />\n </div>\n );\n}", "title": "" }, { "docid": "8bb5d2fffba88369f54b98bc9d5cdf3e", "score": "0.68972266", "text": "handleLogout() {\n\t\tlocalStorage.removeItem(\"token\");\n\t\tthis.setState({ isAuthenticated: false, token: \"\", user: null });\n\t}", "title": "" }, { "docid": "b57b25775a03b4900dd9d03dbd9b97aa", "score": "0.6897077", "text": "handleLogout() {\n sessionManager.remove(\"id\");\n sessionManager.remove(\"role\");\n sessionManager.remove(\"email\");\n //go to login screen\n this.loadController(CONTROLLER_LOGIN);\n }", "title": "" }, { "docid": "75cdc2fad492dfa982650fe0069939bc", "score": "0.6891805", "text": "logOut() {\n\t\t\tvar self = this;\n\t\t\tEmber.$.ajax(\"https://liugues-api.herokuapp.com/p/logout\", {\n\t\t\t//Ember.$.ajax(\"http://localhost:5000/p/logout\", {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tdata: {token: self.get(\"token\")},\n\t\t\t\tsuccess: function(data) {\n\t\t\t\t\tconsole.log(data);\n\t\t\t\t\tif (data.error) {\n\t\t\t\t\t\talert(data.data);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tself.get(\"goToLogin\")();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}", "title": "" }, { "docid": "216c049082342fc62de5e12a67b913e3", "score": "0.6890157", "text": "signOut() {\n firebase.auth().signOut().then(() => {\n this.setState({\n user: null,\n displayNavAndFooter: false\n });\n });\n }", "title": "" }, { "docid": "719e45792a7295b03f2fb9d91cfb85d0", "score": "0.6887785", "text": "function logout() {\r\n firebase.auth().signOut();\r\n location.assign('../pages/logout.html')\r\n}", "title": "" }, { "docid": "7e8db5cf6f7935aac404d63d54c32b42", "score": "0.688172", "text": "logout() {\n // Clear credentials\n auth.saveCredentials(undefined);\n // Update state\n this.setState({credentials: undefined});\n }", "title": "" }, { "docid": "63e880c719bdb996a4e547659a3950cc", "score": "0.68757945", "text": "handleLogOut(){\n localStorage.setItem(\"username\",null)\n localStorage.setItem(\"instructorId\",0)\n localStorage.setItem(\"isLogin\",0)\n localStorage.setItem(\"data\", null)\n window.location = \"/login\"\n }", "title": "" }, { "docid": "bf5acf989e45e81d38a9d57b75d1567a", "score": "0.68635774", "text": "function Logout() {\n return (\n <div className=\"container\">\n <h5>Successfully logged out</h5>\n </div>\n );\n}", "title": "" }, { "docid": "6d5823ff6ff9f5113c30e5b637a18fb1", "score": "0.68634754", "text": "logOut(ctx) {\n sessionStorage.removeItem('loginSession')\n ctx.commit('removeActiveUser', {\n name: null,\n role: null\n })\n }", "title": "" }, { "docid": "d4fab7579d5349993f1e64f2bf54fb3a", "score": "0.6859078", "text": "logout(e) {\n e.preventDefault();\n fetch('/endSession')\n .then(response => {\n this.props.setLogin(false);\n }).catch(err => {\n this.props.setLogin(false);\n console.log(err);\n })\n }", "title": "" }, { "docid": "f6ead49cc24f0e0956b589a7c1dac8e8", "score": "0.68574107", "text": "logout (context) {\n\n let token = this.getToken(context);\n\n localStorage.removeItem('access_token')\n localStorage.removeItem('Person')\n localStorage.removeItem('user')\n\n axios.post(logout_url+'?access_token='+token).then(\n res => {\n context.$router.push('/')\n }).catch(err => {\n context.$router.push('/login')\n });\n }", "title": "" }, { "docid": "9c133ae5971d902c01a6b18b3f21ad35", "score": "0.6855382", "text": "onLoggedOut(){\n\n this.setState({\n user: null\n });\n\n // Remove token & user from localStorage\n localStorage.removeItem('token');\n localStorage.removeItem('user');\n\n window.open(\n '/',\n '_self'\n );\n }", "title": "" }, { "docid": "5cbabfdf339a43a1b34d8c1100d243ec", "score": "0.68549025", "text": "logout() {\n this.props.dispatch(logout())\n .then(res => {\n if (res.payload.error) {\n if (res.payload.error.response.status === 302) return this.props.historyFromContainer.push(`/`);\n }\n\n // using history passed from container to redirect user after successful logout\n if (res.payload.status === 200) return this.props.historyFromContainer.push(`/`);\n\n })\n .catch(error => console.log(error));\n }", "title": "" }, { "docid": "dc16684735ffa49a7174deaea934d4e1", "score": "0.68500715", "text": "logout(){\n // take away the cookie\n Cookies.set('token', '');\n // remove the user and set the mode to auth\n this.setState({user: false, mode: 'auth'});\n }", "title": "" }, { "docid": "c14e36202640a1f195b3c06a02ec4ecf", "score": "0.68465805", "text": "handleLogout() {\n this.handleCloseMenu();\n window.localStorage.removeItem(\"auth\")\n window.open('/', \"_self\")\n }", "title": "" }, { "docid": "d1caeedc444b010c95a22131437e8d5a", "score": "0.68457055", "text": "function logout() {\n setuserLoggedin(false);\n}", "title": "" }, { "docid": "4966702f2f93ce8fca6df21a26ce2f06", "score": "0.68437797", "text": "handleLogOut() {\n firebase.auth().signOut()\n .then(result => console.log(`${result.user.email} your are logout`))\n .catch(error => console.log(`Error ${error.code}: ${error.message}`))\n }", "title": "" }, { "docid": "0a2acf8c5cd25092417a76e816e9e2ba", "score": "0.6843244", "text": "async logout() {\n if (this._unifios === true) {\n return this._request('/api/auth/logout', null, 'POST');\n }\n\n return this._request('/logout');\n }", "title": "" }, { "docid": "5bc2a26510b0224a511943fd8787833f", "score": "0.6843097", "text": "logOut(){\r\n this.context.LogOut('') // we need to use context function inside the component function...\r\n this.props.history.push('/') //... because we can push info to the routers from components only\r\n }", "title": "" } ]
1564eedbc56499ba913f194843041211
Problem 3 Create a function that looks for id with two parameters
[ { "docid": "6ace2d2bc968aad0912985219d493917", "score": "0.0", "text": "function findById(obj, target){\n\n if (obj.id === target) {\n return obj.label;\n }\n\n // Create a loop for...of (ES6) through our object and arrays\n\n for (const nested of obj.nested) {\n const result = findById(nested, target);\n \n if (result) {\n return result;\n }\n }\n }", "title": "" } ]
[ { "docid": "3a9c7de1d229d58dcb4b539f283c5a89", "score": "0.71460694", "text": "function idFind(livre) {\n return livre.id == 873495\n}", "title": "" }, { "docid": "8f4a25268ba877a0646211228064aa3c", "score": "0.7004711", "text": "function id(){}", "title": "" }, { "docid": "8043263cb4679c52f60187c704caf7cf", "score": "0.6873694", "text": "function retornaId( id ){\r\n\tvar cont = id . split(\"-\");\t\r\n\treturn cont[1];\t\r\n}", "title": "" }, { "docid": "9706a07d6c32a32c51177dabc0e1363f", "score": "0.6808371", "text": "function id(arg) {\n return document.getElementById(arg);\n}", "title": "" }, { "docid": "9706a07d6c32a32c51177dabc0e1363f", "score": "0.6808371", "text": "function id(arg) {\n return document.getElementById(arg);\n}", "title": "" }, { "docid": "0e6ec81e3dbdabbb462574b17227833a", "score": "0.6767102", "text": "getID(idToFind) {\n return function (bodyObject) {\n return bodyObject.id === idToFind;\n };\n }", "title": "" }, { "docid": "b427e2ba44d860677d460b4722cabbe5", "score": "0.661731", "text": "static find2(theId) {\r\n return User.allUsers.find(({ id }) => theId === id);\r\n }", "title": "" }, { "docid": "7456f0e70f56f4e73949871b33e254b1", "score": "0.66158724", "text": "function badId(){}", "title": "" }, { "docid": "4fcb689ca84973a949929e99a73c8d50", "score": "0.6588655", "text": "function getPersonFromID(arbre, id) {\n for (let person of arbre) {\n if (person.id === id) {\n return person;\n } \n }\n return false;\n}", "title": "" }, { "docid": "5cb55d09692688e4534c49d0859f2f00", "score": "0.65768474", "text": "function findById(ids) {\n for (let prop in figs) {\n console.log(`now id is ${figs[prop].id}`);\n var abc = figs[prop].id.toString();\n if (figs[prop].id === ids) {\n //console.log('yes');\n return figs[prop];\n }\n //console.log(\" this is it - id=\" + figs[prop].id + \" and ids=\" + ids);\n\n }\n return \"nothing\";\n}", "title": "" }, { "docid": "af4713fa00e8adf8a9a10526c8df3cf5", "score": "0.65593225", "text": "function getID(arg)\r\n{\r\n var counter = 0;\r\n while( items[counter].name != arg)\r\n {\r\n counter++;\r\n }\r\n\r\n return items[counter].id;\r\n}", "title": "" }, { "docid": "65e90aaa73526d7cf698192c6beedf9e", "score": "0.6498516", "text": "function findID(id, coleccion) {\n for (let i = 0; i < coleccion.length; i++) {\n if (id == coleccion[i].id) {\n return coleccion[i];\n }\n }\n return 0;\n}", "title": "" }, { "docid": "38d5a3181f59435aab1b9df1b134871b", "score": "0.6474676", "text": "function findById(source, id) {\n try {\n var resultObj = undefined;\n for (var i = 0; i < source.length; i++) {\n if (source[i].id === id)\n resultObj = source[i];\n }\n return resultObj;\n } catch (e) {\n console.log(\"err findById : \" + e);\n }\n }", "title": "" }, { "docid": "22643820e0f360716c225580e2108818", "score": "0.64552873", "text": "async get(id) {\n if (!id) throw \"You must provide an id to search for\";\n if(id.constructor != objId){\n if(id.constructor == String){\n if(objId.isValid(id)){\n var obj = new objId(id)\n const userCollection = await users();\n const user = await userCollection.findOne({_id:obj})\n \n if (user.length === 0) throw \"No user with that id\";\n return user;\n }else{\n throw \"It is not a valid id\"\n }\n }else{\n throw \"Please input Id as object Id or string\"\n }\n }else{\n const userCollection = await users();\n const user = await userCollection.findOne({_id:id})\n \n if (user.length === 0) throw \"No user with that id\";\n return user;\n }\n }", "title": "" }, { "docid": "6e93efa168f27599ca5d35da60c61e26", "score": "0.6396246", "text": "function getUserById(id,thyArray,f){\n for(var i=0;i<thyArray.length;i++){\n if(thyArray[i].id === id){\n f(thyArray[i]);\n break;\n }\n }\n}", "title": "" }, { "docid": "5feaab49879558282f9b9f0b57dd6ac9", "score": "0.63934773", "text": "function forid_1(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "7bdf18e6149f6c11225f911afa54e548", "score": "0.6373388", "text": "function findUserById(id) {\n try {\n var user = _.find(users, { 'id': '4' }); // add appropriate code here\n console.log(user);\n var iFindUser = ('{firstName} + {lastName} + \"is + {age} + \",\" + {gender}');\n\n return iFindUser;\n console.log(user);\n // add appropriate text here\n\n\n } catch (error) {\n return \"Cannot read property 'id'\";\n console.log(\"Cannot read property 'id'\"); // Change this line\n\n }\n }", "title": "" }, { "docid": "2fe0b3f03a040fbc8ec8a96604320f39", "score": "0.63719505", "text": "function findAuthorById(authors, id1) {\n return authors.find(({id}) => id ===id1 )\n}", "title": "" }, { "docid": "1ca70d3dfaed22f972f7fd12a547c551", "score": "0.6365704", "text": "function findId(id) {\n for(let i = 0; i < nightlife.length; i++) {\n if(nightlife[i].id === id) return i;\n } \n return false;\n }", "title": "" }, { "docid": "53a069d0470a3175c882f7ed73d39d2d", "score": "0.63600206", "text": "function getId(id){\n document.getElementById(id)\n}", "title": "" }, { "docid": "cc70e687e58c64c3ab74bc7b06bde38a", "score": "0.6356522", "text": "function findById (items, idNum){\n return items.find( item => item.id === idNum);\n}", "title": "" }, { "docid": "22626eed9b9980b09fd8ed980a8c1137", "score": "0.63404274", "text": "function findById(id, fn) {\n var idx = id - 1;\n if (users[idx]) {\n fn(null, users[idx]);\n } else {\n fn(new Error('User ' + id + ' does not exist'));\n }\n }", "title": "" }, { "docid": "18b71c3a0577624c6c0d653bffc20f3f", "score": "0.6338871", "text": "function find_playerid(id) {\n for (var i = 0; i < player_lst.length; i++) {\n\t\tif (player_lst[i].id == id) {\n\t\t\treturn player_lst[i]; \n\t\t}\n\t}\n\treturn false; \n}", "title": "" }, { "docid": "be7c52a776a87c58f169e8b79917f166", "score": "0.6338578", "text": "function userId({id}) {\n return id;\n}", "title": "" }, { "docid": "dc4d642fd48f57f35ecfa3a04b17fca1", "score": "0.6333041", "text": "function getId(text) {\n return getIdText(text)\n}", "title": "" }, { "docid": "4c2fb82b7fcd4cdee54e528317a4c74a", "score": "0.62974364", "text": "function getId(id){return document.getElementById(id);}", "title": "" }, { "docid": "39a26e2c6731cbea479caa73064e6d34", "score": "0.6296428", "text": "function findById(id, fn) {\r\n var idx = id - 1;\r\n if (users[idx]) {\r\n fn(null, users[idx]);\r\n } else {\r\n fn(new Error('User ' + id + ' does not exist'));\r\n }\r\n}", "title": "" }, { "docid": "892c66a481827a5485ff738aeaa4f2c5", "score": "0.6291773", "text": "function findById(items, id) {\n for (var i = 0; i < items.length; i++) {\n if (items[i].id == id) {\n return items[i];\n }\n }\n }", "title": "" }, { "docid": "06108b0e8478e8ab855269ea8fc3fdcd", "score": "0.6269116", "text": "function getById(id) {\n //Korok\n if (id.startsWith(\"-\")) {\n id = id.substr(1).trim();\n if (id.length === 3 && id.search(/[a-zA-Z][0-9][0-9]/) !== -1) {\n var koroksArr = DATA[\"Korok Seeds\"].locations;\n for (var i = 0; i < koroksArr.length; i++) {\n if (koroksArr[i].id === id) {\n return koroksArr[i].coords;\n }\n }\n }\n }\n //Shrine or DLC Shrine Name\n else if (id.endsWith(\" Shrine\")) {\n var shrinesArr = DATA.Shrines.locations;\n for (var i = 0; i < shrinesArr.length; i++) {\n if (shrinesArr[i].id === id) {\n return shrinesArr[i].coords;\n }\n }\n var dlcShrinesArr = DATA[\"Champion`s Ballad Shrines\"].locations;\n for (var i = 0; i < dlcShrinesArr.length; i++) {\n if (dlcShrinesArr[i].id === id) {\n return dlcShrinesArr[i].coords;\n }\n }\n }\n //Tower Name\n else if (id.endsWith(\" Tower\")) {\n var towersArr = DATA.Towers.locations;\n for (var i = 0; i < towersArr.length; i++) {\n if (towersArr[i].id === id) {\n return towersArr[i].coords;\n }\n }\n }\n //Standard ID format, which will find its point in constant time.\n if (id.indexOf(\"@\") !== -1) {\n id = id.split(\"@\");\n var type = id[0];\n var num = parseInt(id[1]);\n var loc = DATA[type].locations[num];\n if (!Array.isArray(loc)) {\n loc = loc.coords;\n }\n return typeof loc !== \"undefined\" ? loc : [];\n }\n return [];\n}", "title": "" }, { "docid": "9d01f3ccd1f44afa20e176a788377795", "score": "0.62686414", "text": "function check(id) {\nvar x= str_id.search(id);\nif( x == -1 ){\nstr_id = str_id + id + ',' ;\n}else{\nstr_id = str_id.replace(id + ',' , '');\n}}", "title": "" }, { "docid": "7416d9d08ad70862108d0bdaf45bb537", "score": "0.6258606", "text": "id(arg1) {\n let element = null;\n \n const getItemByID = (parent, id) => {\n if ( typeof parent.id == 'function' && parent.id() == id ) \n element = parent;\n \n if ( typeof parent.content == 'function' && typeof parent.content() == 'object' && parent.content().constructor.name == 'Array' ) {\n parent.content().forEach((item) => {\n getItemByID(item, id);\n });\n }\n };\n\n this.content().forEach((item) => {\n getItemByID(item, arg1);\n });\n \n return element;\n }", "title": "" }, { "docid": "85b4ec4217736b8a5f861ee62f3da37b", "score": "0.6258141", "text": "getId (id) {\n let note = this.notes[id]\n let notebook = this.notebooks[id]\n let tag = this.tags[id]\n if (typeof note === 'object') {\n return note\n }\n if (typeof notebook === 'object') {\n return notebook\n }\n if (typeof tag === 'object') {\n return tag\n }\n return {}\n }", "title": "" }, { "docid": "9832aa8c96273b7ffb60728c46f84e44", "score": "0.6251502", "text": "function id (x) { return x }", "title": "" }, { "docid": "3200d38e2a50daf63bcaf6eff9906f8b", "score": "0.62513965", "text": "function id(id){\nreturn document.querySelector(id);\n}", "title": "" }, { "docid": "661ec0b9b6238d41e333532a5a5827f7", "score": "0.6227552", "text": "function getNoteFromId(id){\n if(typeof(id)== 'number'){\n for(let i=0; i<notes.length; i++){\n if(id === notes[i].id){\n outPut = notes[i].content;\n return outPut;\n }\n };\n outPut = id + ' is not in the notes array';\n return outPut;\n }\n outPut = id + ' is not a number';\n return outPut;\n}", "title": "" }, { "docid": "2c3b3e97d1891cbfa75183213c23415f", "score": "0.62183785", "text": "function id (arg, x, y) {\n arg(x, y);\n return arg;\n }", "title": "" }, { "docid": "b74b4112921671afb23e5217927938d2", "score": "0.6198603", "text": "function findById(source, id, returnType) {\n var i = 0;\n for (i = 0; i < source.length; i++) {\n if (source[i].id === id) {\n if (returnType === \"object\") {\n return source[i];\n } else {\n return i;\n }\n }\n }\n return;\n}", "title": "" }, { "docid": "0a1f744ade17369ac124ba8602aac689", "score": "0.61969393", "text": "function id(_id){\n return document.getElementById(_id);\n}", "title": "" }, { "docid": "893df9497fdd8f7d2e8e099a59bdddd7", "score": "0.61949384", "text": "function id(ele_id){\n return document.getElementById(ele_id);\n}", "title": "" }, { "docid": "f19c7c785f76624d807f9ccfd79b7845", "score": "0.6177946", "text": "function getUsernameId(id) {\n // L ogica de negocio, find the user\n return 'nblanco';\n}", "title": "" }, { "docid": "def2f50e991311ae560b40ec9458cce4", "score": "0.6160583", "text": "SearchId(id, row, column, op){\n for(let symbol of this.symbols){\n if(symbol.id == id){\n switch(op){ \n case 2:\n if(symbol.isType) return symbol;\n break;\n default:\n if(!symbol.isType) return symbol;\n }\n }\n }\n if(this.next != null){\n return this.next.SearchId(id, row, column, op);\n }\n switch(op){\n case 1:\n return new Error(literal.errorType.SEMANTIC, `La variable '${id}' no se ha declarado`, row, column);\n case 2:\n return new Error(literal.errorType.SEMANTIC, `El type '${id}' no se ha declarado`, row, column);\n case 3:\n return new Error(literal.errorType.SEMANTIC, `La funcion '${id}' no se ha declarado`, row, column);\n }\n }", "title": "" }, { "docid": "ad3bd758b5b4606fd7adf695cc8eb546", "score": "0.614352", "text": "function getID(id) { //function that fetches element of specific id for shorter code.\n \"use strict\"; // \"use strict\"; to return JSLint errors\n id = document.getElementById(id);\n return id;\n}", "title": "" }, { "docid": "4366dcbb9cb3466dd46d67606038b322", "score": "0.6139603", "text": "function getIndex(id) {\n for (let i = 0; i < members.length; i++){\n if (members[i].id == id)\n return i \n }\n return 'wrong id'\n}", "title": "" }, { "docid": "291a0f19c1dcf6dce1e234d6e13d5fbb", "score": "0.61339885", "text": "function getID(id){\n return document.getElementById(id);\n }", "title": "" }, { "docid": "eaad715ae8cecbc5929173f09a460be1", "score": "0.61223865", "text": "function id(elem){\n\treturn document.getElementById(elem);\n}", "title": "" }, { "docid": "0160ff68989ef2d232af353e4ac34361", "score": "0.6111325", "text": "function id(x) { return x; }", "title": "" }, { "docid": "4ad0cc93b7dcc25b93cc0bc85fa61483", "score": "0.6101657", "text": "function getRestaurantId(id) { // helpfunction\n rest = $scope.restaurants;\n return rest.filter(\n function(rest){return (rest.OBJID == id)}\n );\n }", "title": "" }, { "docid": "5d278638e974d24fd1e2c59b1de9fa01", "score": "0.609491", "text": "function filterId(d) {\n return parseInt(d.id)== number;\n }", "title": "" }, { "docid": "788cd566c9bbcb1817737409efeb55c0", "score": "0.6094072", "text": "function getNoteFormID(id){\r\n //checking if ID is number or not\r\n if(isNaN(id)){\r\n console.log(\"Entered value is not a Number !...\");\r\n return;\r\n }\r\n let i,s=0; \r\n\r\n //finding a specific node on ID\r\n for(i=0;i<notes.length;i++)\r\n if(id==notes[i][\"noteId\"])\r\n {s=1;\r\n break;} \r\n //displaying node if found or not \r\n if(s==1)\r\n console.log(notes[i][\"note\"]);\r\n else\r\n console.log(\"ID \"+id + \" not found\");\r\n \r\n}", "title": "" }, { "docid": "9be2a1e6e10e3b30e98b1daeab58b868", "score": "0.609164", "text": "static fixId({id, ...args}) {\n return {clue_id: id, ...args};\n }", "title": "" }, { "docid": "59678f6120c37d95b8cdc869328957bf", "score": "0.6091287", "text": "function findById(items, idNum) {\n return items.find(item => item.id === idNum);\n}", "title": "" }, { "docid": "5eedf07a0695bbc9dcbbf2684c6df92b", "score": "0.6086404", "text": "function id(str){\n\treturn document.getElementById(str)\n}", "title": "" }, { "docid": "ed289263486b4e32a72fc112d218c0d4", "score": "0.60839427", "text": "function returnMemberById(id) {\n const members = returnAllMemebers();\n for (let member of members) {\n if(id === member.id){\n return member\n }\n }\n }", "title": "" }, { "docid": "a9faf55c53a8f542b3dfd4b1145bb35f", "score": "0.60838825", "text": "function findPersonByID(owner){ //inside the main function run a second function\n return owner.id == pet.ownerId //if the person id matches the pet id return the person\n }", "title": "" }, { "docid": "6b4857dc7c78513b5b26691bbb550710", "score": "0.6082104", "text": "function getId(x) {\n if (typeof x.identifier === \"number\") {\n return Math.abs(x.identifier);\n } else {\n return x.identifier;\n }\n }", "title": "" }, { "docid": "c3aef5bd77e8ad5e18c893161fcebacd", "score": "0.6079421", "text": "function idSearch()\n {\n id = $('#id').val();\n\n var string = API;\n\n if(id != \"\")\n {\n string = string + \"i=\" + id;\n apiCall(string);\n }\n else\n {\n $(\"#results\").html(\"Results:\");\n $(\"#results\").append(\"<p>ERROR: ID Required</p>\");\n }\n\n }", "title": "" }, { "docid": "6a8e977e0e36bbd81edb7081623fc89f", "score": "0.60776466", "text": "function withId(args) {\n var response = args.response;\n var thisWord = args.thisWord;\n var token = \"\";\n var rt = \"\";\n \n token = \"$..*[?(@property==='id'&&@.match(/\"+thisWord+\"/i))]^\"\n \n try {\n rt = JSONPath({path:token, json:response})[0].href;\n } catch (err){\n // no-op\n // console.log(err);\n }\n return rt; \n}", "title": "" }, { "docid": "c82ab54b93ba1617d1ed4293e3d98bda", "score": "0.6070249", "text": "function id (elId){\n let id = document.getElementById(elId);\n return id;\n}", "title": "" }, { "docid": "47c333262d84c896f807ea0fdc424940", "score": "0.60691893", "text": "function GetID() : int {\n return id;\n}", "title": "" }, { "docid": "3e8b7fcecc2d3c6f226e865ac8c95f34", "score": "0.6068876", "text": "function id(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "3e8b7fcecc2d3c6f226e865ac8c95f34", "score": "0.6068876", "text": "function id(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "3e8b7fcecc2d3c6f226e865ac8c95f34", "score": "0.6068876", "text": "function id(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "3e8b7fcecc2d3c6f226e865ac8c95f34", "score": "0.6068876", "text": "function id(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "197c0df5b1c0236f36081a8dbe3ad1b3", "score": "0.6067995", "text": "function filterId(d) {\n return parseInt(d.id)== number;\n }", "title": "" }, { "docid": "cb08a976c1171b4321969044c8fa9751", "score": "0.606596", "text": "function getKeyFromID(id){return'.'+id;}", "title": "" }, { "docid": "036581503711b01255d8b5614bfe6329", "score": "0.6063902", "text": "findId(id) {\n\t\treturn this.items.find(request => request.id == id)\n\t}", "title": "" }, { "docid": "744fdeb8845a4b6831e93ddd87cab164", "score": "0.60619617", "text": "function getElemId(param) {\r\n return document.getElementById(param);\r\n}", "title": "" }, { "docid": "18387957f8c36b398280c72059ba880c", "score": "0.6046693", "text": "function get_id($id){\n //escape and return teh id\n $id = $id.replace('[','\\\\[');\n $id = $id.replace(']','\\\\]');\n return $id;\n }", "title": "" }, { "docid": "f54649d163f1358e48a77a1bdb2da33d", "score": "0.6038642", "text": "function byId(id) {\n for (let i = 0, len = range.length; i < len; ++i) {\n if (range[i].id === id) return range[i];\n }\n return null;\n}", "title": "" }, { "docid": "2f98037d74afd9acc9794f7d410546a5", "score": "0.6036861", "text": "function findById(id) {\n return db.query(\"select * from tags where id = $1;\", [id]);\n}", "title": "" }, { "docid": "14d1818fbb0cbdfb06cedaec734ccab5", "score": "0.6029128", "text": "function _findParticipante(id){\n for(let i = 0; i < products.length; i++){\n if(id == products[i].getId()){\n return true;\n }\n }\n return false;\n}", "title": "" }, { "docid": "a92f91e76fe0746ae362654ffcc514c5", "score": "0.6026751", "text": "function findById(a, id) {\n var i;\n for (i = 0; i < a.length; i += 1) {\n if (a[i]._id === id) {\n return a[i];\n }\n }\n return null;\n}", "title": "" }, { "docid": "6104f2ddd1949085417768709516fe65", "score": "0.6022041", "text": "function ID(x) {\n return x;\n}", "title": "" }, { "docid": "d798af9913fffcbe3a05c48d2a552aae", "score": "0.6018294", "text": "function getId(id)\r\n{\r\n\treturn document.getElementById(id);\r\n}", "title": "" }, { "docid": "3f8d7d0baf40c573eae470c12e61ed9a", "score": "0.60127956", "text": "function Id(){}", "title": "" }, { "docid": "6d0efafc548b36d4af9f779b542114fa", "score": "0.60052985", "text": "function findId(index) {\n if (index == 0) return 'first'\n else if (index == 1) return 'second'\n else if (index == 2) return 'third'\n else return 'fourth'\n}", "title": "" }, { "docid": "b655241393dc8d6b128b4bb809b1916d", "score": "0.6000166", "text": "function get_user(requestingid){\r\n for(let x of users){\r\n if(x != null){\r\n if(x.id == requestingid){\r\n return x;\r\n }\r\n }\r\n }\r\n}", "title": "" }, { "docid": "2cb68d7201d5377f0c7d830a216faf61", "score": "0.5999976", "text": "function posicao(posicoes, linha, id) {\n return posicoes[linha] && posicoes[linha].indexOf(id) != -1 ? id : -1;\n}", "title": "" }, { "docid": "daeb2ede789aa139ff14bc038ae96d97", "score": "0.59999543", "text": "function getIdNode(data, id){\n\t if(data){\n\t\t //alert(data);\n\t\t for(i=0, l=data.length; i<l; i++){\n\t\t\tvar nodeId = data[i].getAttribute(\"id\");\n\t\t\tif(parseInt(nodeId) == id){\n\t\t\t\treturn data[i];\n\t\t\t}\n\t\t }\n\t }\n\t return null;\n }", "title": "" }, { "docid": "739b41909105cc3534a22701679548b2", "score": "0.5994553", "text": "function getbyid (id) {\n if (exists(ids[id]))\n return ids[id][id];\n // else implicitly undefined\n}", "title": "" }, { "docid": "0569f21a897dfb77342116b5dd917353", "score": "0.59875846", "text": "getById(type, id) {\n type = normalizeType(type, this);\n var group = this._groupMap(type);\n if ( group ) {\n return group[id];\n }\n }", "title": "" }, { "docid": "ee0c02e05b2caa522d135fb43d51e47a", "score": "0.5981543", "text": "function findId(idToLookFor) {\n for (var i = 0; i < products.length; i++) {\n if (products[i].id == idToLookFor) {\n const item = {\n id: products[i].id,\n imageUrl: products[i].imageUrl,\n name: products[i].name,\n price: products[i].price,\n description: products[i].description,\n };\n return item;\n }\n }\n}", "title": "" }, { "docid": "3e562125e39e3a0ece53397d2a8de6cd", "score": "0.59787494", "text": "function findByParamValue(param, ids) {\n for (let prop in figs) {\n //console.log(`now id is ${(figs[prop])[param]}`);\n let valueToCompare = (figs[prop])[param];\n if (JSON.stringify(valueToCompare) === JSON.stringify(ids)) {\n //console.log('yes');\n return figs[prop];\n }\n //console.log(\" this is it - id=\" + (figs[prop])[param] + \" and ids=\" + ids);\n\n }\n return \"nothing\";\n}", "title": "" }, { "docid": "4aacf4b59860a8cf92fd9a94a040a059", "score": "0.5976616", "text": "indexOfId(id) {\n var Model = this.constructor.classes().model;\n var index = 0;\n id = String(id);\n\n while (index < this._data.length) {\n var entity = this._data[index];\n if (!(entity instanceof Model)) {\n throw new Error('Error, `indexOfId()` is only available on models.');\n }\n if (String(entity.id()) === id) {\n return index;\n }\n index++;\n }\n }", "title": "" }, { "docid": "50f8332e817e04c86f28a42daad5fff1", "score": "0.5975828", "text": "getObjectById (id,array) {\n for (let i=0;i<array.length;i++){\n if (array[i].id===id){\n return array[i];\n }\n }\n }", "title": "" }, { "docid": "00bfef0024b096d3b67463004c2df669", "score": "0.5975104", "text": "function getNoteFromId(id){\r\nfor (let i=0; i<notes.length; i++){\r\n if (id===notes[i].noteId) {\r\n let temp1 = notes[i];\r\n let check = true;\r\n if (check){ \r\n console.log(temp1);\r\n return temp1;\r\n }\r\n }\r\n }\r\n return console.log(\"There is no such ID in the notes\");\r\n}", "title": "" }, { "docid": "b29ff12a4ff9a7b789f18685d35ced9a", "score": "0.5972469", "text": "function getId(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "e893c4b6e15f4cd169937c12435fd5bf", "score": "0.5972156", "text": "function getID(id)\n{\n return document.getElementById(id);\n}", "title": "" }, { "docid": "861e65cff97ea9d60e51f40347462ab3", "score": "0.59672916", "text": "function findId(arr,e){\n for(let i =0; i<arr.length;i++){\n if(arr[i].id === e.id){\n return i;\n }\n }\n return -1;\n}", "title": "" }, { "docid": "ab0905dd879a2c35fd8e086ea406a39e", "score": "0.59567255", "text": "function findList (id) {\n for (let each of lists) {\n if (each.id === id) {\n console.log(each);\n return each;\n }\n }\n}", "title": "" }, { "docid": "58a629d0163276002a7829da1d2b3ec5", "score": "0.5956141", "text": "function checkIfIdValid(std_id, year){\n\tconsole.log(\"working\");\n\ttry{\n\t\t//id parameteres to be changed every year\n\t\tif (std_id.length == 8) {\n\t\t\tvar first3char = std_id.substring(0,3);\n\t\t\tconsole.log(first3char);\n\n\t\t\tswitch(year){\n\t\t\t\tcase 1:\n\t\t\t\t\tconsole.log(ifPart1(first3char));\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\tconsole.log(ifPart2(first3char));\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tconsole.log(ifPart3(first3char));\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\tconsole.log(ifPart4(first3char));\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tconsole.log(\"unexpected err\");\n\t\t\t}\n\n\t\t} else {\n\t\t\tconsole.log(\"Your ID is too big or too small , try again\");\n\n\t\t}\n\t} catch (error) {\n res.status(500).json({\n message: 'Yo, lets try that again, pane zvikuitika!'\n })\n }\n\t\n}", "title": "" }, { "docid": "2b3a8ac02da4b017b79fa09886f1dbfa", "score": "0.59559035", "text": "function getById(id){\n\tlet item;\n\tfor(let i = 0; i < tree.length; i++){\n\t\titem = tree[i];\n\t\tif(item.id === id) return wrap(item);\n\t}\n\treturn false;\n}", "title": "" }, { "docid": "5a0b2dff9331719d4eb9b072a6f68ea5", "score": "0.5951879", "text": "function geid(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "eacf537862c05fe1a9c7e723d844c460", "score": "0.5948001", "text": "function pp(id){\r\n return id.Id ? text(id[1]) : error();\r\n}", "title": "" }, { "docid": "3d688182b502ea664d1513b5516a8ce0", "score": "0.5943663", "text": "function findById(id, animalsArray) {\nconst result = animalsArray.filter(animal => animal.id === id)[0];\nreturn result;\n}", "title": "" }, { "docid": "a6e632dc969c831f78528e1ca9d710a9", "score": "0.59431034", "text": "function findObject(type, id) {\n var objects;\n\n if (type === \"films\")\n objects = films;\n else if (type === \"actors\")\n objects = actors;\n else {\n console.log(\"Wrong type!\");\n return;\n }\n\n for (var i = 0; i < objects.length; i++) {\n if (objects[i].id === id) {\n return i;\n }\n }\n return null;\n}", "title": "" }, { "docid": "c723712e7fcc097ddfcbaaf201e36f6b", "score": "0.5938769", "text": "static async getByID(_, {id}) {\r\n return await this.find(id)\r\n }", "title": "" }, { "docid": "92226057ae2c2c0a24df27030fbcf7a0", "score": "0.59359515", "text": "function getId(obj) {\n return obj && obj.getId && obj.getId();\n }", "title": "" }, { "docid": "b7a1acab7fd3da09f9dd0c367407a0a8", "score": "0.59310764", "text": "idSet(myId) {\n\n }", "title": "" }, { "docid": "70e4857f8c57feac2637d2095e6d0600", "score": "0.59297466", "text": "function findPatientById(id) {\n\n let patientList = getStoredPatients();\n let foundPatient = false;\n\n\n for (let i = 0; i < patientList.length; i++) {\n\n if (patientList[i].info.id === id) {\n\n foundPatient = patientList[i];\n\n } else { }\n }\n return foundPatient;\n}", "title": "" }, { "docid": "f8f42de23d36e009edba3c0d2dd6ba89", "score": "0.5928908", "text": "function getId(idTarjeta){\n return parseInt( $('#'+idTarjeta).attr(\"id\").replace(\"m\",\"\") );\n}", "title": "" } ]
29c888e224726e9518d35c5700b613af
Resets the color of the paragraph
[ { "docid": "4e571c850eb87f6ec2b892ea905b773c", "score": "0.5910887", "text": "function resetColor() {\n\n let buttonsDiv = document.getElementById('buttons');\n colorValue.value = '';\n firstLorem.style.color = 'black';\n resetColorButton.disabled = true;\n\n}", "title": "" } ]
[ { "docid": "b652b0c29d50ecf1dd06eb4cc222aca1", "score": "0.691671", "text": "function changeColor(){\n p.style.color=\"red\";\n}", "title": "" }, { "docid": "979c9d5376f013bd8d6fe9a6b243d3f3", "score": "0.6743837", "text": "function changerLaCouleurEnRouge() {\n p.style.color = \"red\";\n}", "title": "" }, { "docid": "979c9d5376f013bd8d6fe9a6b243d3f3", "score": "0.6743837", "text": "function changerLaCouleurEnRouge() {\n p.style.color = \"red\";\n}", "title": "" }, { "docid": "80f5d75745d39c199b6230a955e4ede9", "score": "0.67170763", "text": "function changeStyles() {\n\n let redParagraphs = document.querySelector('article > p');\n redParagraphs.style.color = \"white\";\n redParagraphs.style.backgroundColor = \"green\";\n }", "title": "" }, { "docid": "a20bbdd8a51a269d1ce0f1ff126f0872", "score": "0.6372189", "text": "function seeked() {\nfor (i = 0; i < p.length; i++) {\n p[i].style.color = \"\";\n }\n\n}", "title": "" }, { "docid": "9bd6b86950de2cf07c14d0f083241f37", "score": "0.6359453", "text": "function ColorearP(color,poner_color){\n if(color){\n var p = document.querySelectorAll(\"p\");\n if(poner_color){\n if(p){\n for (let index = 0; index < p.length; index++) {\n const element = p[index];\n element.setAttribute(\"style\",\"color:\"+color);\n \n }\n }\n }else{\n if(p){\n for (let index = 0; index < p.length; index++) {\n const element = p[index];\n element.removeAttribute(\"style\");\n }\n }\n }\n }\n }", "title": "" }, { "docid": "29c4a54169fe1060fc210a3e1422d21b", "score": "0.63440526", "text": "function clearColorSettings() {\n console.log(inputFontColor);\n execCmd(\"foreColor\", false, \"#000000\");\n execCmd(\"hiliteColor\", false, \"#ffffff\");\n richTextField.contentDocument.body.focus();\n}", "title": "" }, { "docid": "56baa06d1d5298c2963c1b3acff4445e", "score": "0.6327768", "text": "function resetColour() {\n // The current colour name the user is trying to guess.\n currentColour = ``;\n indexCurrentColour = null;\n\n // The colour of the word that is not necessarily the same.\n currentColourTrap = ``;\n indexTrap = null;\n\n scoreSayTheColourIncremented = false;\n}", "title": "" }, { "docid": "8d4b5608a896a9ee109425f884415ff3", "score": "0.62935793", "text": "function parBack() {\n $('p').css('background', 'red'); //funkcja koloruje tlo wszystkich p na czerwono;\n }", "title": "" }, { "docid": "f2c280f7eee7372c09c459d5a3e67976", "score": "0.62856567", "text": "function greentext () {\n\tvar paragraphs = document.querySelectorAll('.post p');\n\tfor (var p of paragraphs) {\n\t\tif (p.innerHTML && p.innerText.slice(0,1) == \">\")\n\t\t\tp.style = \"color: #97bb5e\";\n\t}\n}", "title": "" }, { "docid": "7c1661e57cb99be0f3393d1061614a14", "score": "0.6157464", "text": "function parBack() {\n $('p').css('background', 'red');\n }", "title": "" }, { "docid": "78cc29e9efd432297a6310023aebc125", "score": "0.6124247", "text": "function reset() {\n randomAnswer = pickedColor();\n rgbDisplay.textContent = randomAnswer;\n messageCenter.textContent = \"\";\n gameTitle.style.backgroundColor = \"steelblue\";\n resetButton.textContent = \"New Colors?\"\n}", "title": "" }, { "docid": "ae80ea967e60d396c34149563f1adb7a", "score": "0.60950726", "text": "function reset() {\n\t\t_colors = _generateRandomColors(_numSquares);\n\t\t_pickedColor = _pickColor();\n\n\t\t_colorDisplay.textContent = _pickedColor;\n\t\t_resetButton.textContent = \"New Colors\";\n\t\t_messageDisplay.textContent = \"\";\t\n\n\t\tfor(let i = 0; i < _squares.length; i++) {\n\t\t\tif (_colors[i]) {\n\t\t\t\t_squares[i].style.display = \"block\";\n\t\t\t\t_squares[i].style.backgroundColor = _colors[i];\n\t\t\t} else {\n\t\t\t\t_squares[i].style.display = \"none\";\n\t\t\t}\n\t\t}\n\t\t\n\t\t_h1.style.backgroundColor = \"steelblue\"; // original bg color\n\t}", "title": "" }, { "docid": "4131a56ec74515a7c14e58a733aeaa4e", "score": "0.6084802", "text": "function resetDraw() {\n\tfor (var i=0; i<=currentTournament.numberMatches*2;i++) { \n\t\t\t$(\"#p\" + i).css(\"color\", \"#000\");\n\t\t}\n\t}", "title": "" }, { "docid": "931d9813c5e71c787c70337dcfc04557", "score": "0.6065839", "text": "function PG_fset_text_color(dev, clr, mapped)\n {\n\n gs_text_color = clr;\n\n return;}", "title": "" }, { "docid": "534b258ebdb58af7a27335e014397e22", "score": "0.60491276", "text": "function changeColor() {\n\n let color = colorValue.value;\n firstLorem.style.color = color;\n colorValue.value = '';\n changeColorButton.disabled = true;\n\n}", "title": "" }, { "docid": "05e9cb661d65af45489b76c168a55ca5", "score": "0.60355127", "text": "function resetarGame() {\n suposicaoContar = 1;\n\n const resetparas = document.querySelectorAll('resulparas p');\n for (let i = 0; i < resetparas.length; i++) {\n resetparas[i].textContent = '';\n \n }\n \n resetarBotao.perentNode.removeChild(resetarBotao);\n\n suposicaoCampo.disabled = false\n suposicaoEnviar.disabled = false\n suposicaoCampo.nodeValue ='';\n suposicaoCampo.focus()\n\n ultimoResultado.style.backgroundcolor = 'white'\n randomNumber = Math.floor(Math.random() * 100) + 1;\n }", "title": "" }, { "docid": "85eabb98c6462354f21dc02623c216eb", "score": "0.6031066", "text": "function font () {\n document.getElementById('paragraph').style.fontFamily = 'Arial'\n document.getElementById('paragraph').style.fontSize = '110%'\n document.getElementById('paragraph').style.color = 'red'\n}", "title": "" }, { "docid": "c24b75844cdbb5d8c4549bd7e396ae65", "score": "0.59713155", "text": "function resetProperties(){\r\n\treset.textContent=\"NEW COLORS\";\r\n\theader1.style.background=\"lightblue\";\r\n\theader2.style.color=\"lightblue\";\r\n\treset.style.color=\"lightblue\";\r\n\teasy.style.color=\"lightblue\";\r\n\thard.style.color=\"lightblue\";\r\n\tdocument.getElementById(\"ans\").textContent=\"\";\r\n\r\n}", "title": "" }, { "docid": "6fd5c07c638d737980fbb4cf6dc675ca", "score": "0.5968174", "text": "reset() {\n this.currentColor = this.fillColor;\n }", "title": "" }, { "docid": "5043827d65a25bd6b7b0c64280e4c399", "score": "0.59655493", "text": "function restyle(){\n\n var typefaces = [\"fantasy\", \"monospace\", \"cursive\", \"serif\", \"sans-serif\"];\n var letterSpacing = Math.random() * 5;\n var color = [\"blue\", \"red\", \"orange\", \"purple\", \"yellow\", \"green\"];\n\n fortuneSentenceStyle.style.color = color[Math.floor(Math.random()*color.length)];\n fortuneSentenceStyle.style.letterSpacing = letterSpacing + \"px\"\n fortuneSentenceStyle.style.fontFamily = typefaces[Math.floor(Math.random()*typefaces.length)]\n}", "title": "" }, { "docid": "0e12d412e2bf609a53fe0056ecf1ae60", "score": "0.59366375", "text": "function setColor() {\n this.style.backgroundColor = pColor.value;\n }", "title": "" }, { "docid": "92efef59948dc55e78db60db2e25a944", "score": "0.59357643", "text": "function reset_text(){\n user.point =0;\n jarves.point=0;\n document.querySelector(user.span).textContent = user.point;\n document.querySelector(jarves.span).textContent = jarves.point;\n document.querySelector(user.span).style.color= 'green';\n document.querySelector(jarves.span).style.color ='red';\n document.querySelector('#game-result').textContent = \"Let's Play \";\n document.querySelector('#game-result').style.color = 'black';\n game.turnover = false;\n \n}", "title": "" }, { "docid": "404c37005076392d0e929014f7eeeaef", "score": "0.5919331", "text": "function changeColor(color) {\n gMeme.currText.color = color\n}", "title": "" }, { "docid": "4dbdf571d49150a134ceb1a042bdb1e8", "score": "0.59098756", "text": "function reset(){\n\tcolors = generateRandomColors(numCircles);\n\tpickedColor = pickColor();\n\tcolorDisplay.text(pickColor);\n\tresetButton.text(\"New Colors\");\n\tmessageDisplay.text(\"\");\n\tmessageDisplay.css({color:\"black\", fontSize:\"100%\", fontWeight:\"normal\"});\n\tfor(var i = 0; i < circles.length; i++){\n\t\tif(colors[i]){\n\t\t\tcircles[i].style.display = \"block\"\n\t\t\tcircles[i].style.background = colors[i];\n\t\t} else {\n\t\t\tcircles[i].style.display = \"none\";\n\t\t}\n\t}\n\th1.css({background: \"steelblue\"});\n}", "title": "" }, { "docid": "eb73b3decdb8ae2b410efe7a3ac196d7", "score": "0.5871665", "text": "function reset_game() {\r\n\t\t\tset_rgb_list();\r\n\t\t\tset_background_colors();\r\n\t\t\tset_random();\r\n\t\t\tnewButton.innerHTML = \"new colors\";\r\n\t\t\tmessage.innerHTML = \"\";\r\n\t\t\ttitle.style.backgroundColor = \"steelblue\";\r\n\t\t}", "title": "" }, { "docid": "c12aa4c555f8dccc8110c61681977ebf", "score": "0.58710754", "text": "function reset(){\n colors = generateRandomColors(numCircles);\n pickedColor = pickColor();\n colorDisplay.textContent = pickedColor;\n resetButton.textContent = 'New Colors';\n messageDisplay.textContent = '';\n //change colors of circles\n for(let i = 0; i < circles.length; i++){\n if(colors[i]){\n circles[i].style.display = 'block';\n circles[i].style.background = colors[i];\n } else {\n circles[i].style.display = 'none';\n }\n }\n h1.style.background = 'steelblue';\n}", "title": "" }, { "docid": "784af24f2263041213711b517f5adf85", "score": "0.5859218", "text": "function firstParagraphClicked(){\n \n if(firstParagraphIsClicked){\n firstParagraph.style.color = \"#000000\";\n firstParagraphIsClicked = false;\n }else {\n firstParagraph.style.color = \"red\";\n firstParagraphIsClicked = true;\n }\n}", "title": "" }, { "docid": "263ed472ff2dd4883b93799be1d6a041", "score": "0.5827923", "text": "function reset() {\n clear();\n randColor();\n createColorPicker();\n }", "title": "" }, { "docid": "930d15f6db8f4c5940c276c0a4627130", "score": "0.58161056", "text": "function cambiaColorP() {\n const p1 = document.getElementById('p1');\n p1.style.color = \"blue\"\n}", "title": "" }, { "docid": "488609c00bce0104a2a028f7f46e1439", "score": "0.580378", "text": "function resetPage(){\n\tvar elements = colorToggle, i, len;\n\tfor (i = 0, len = elements.length; i < len; i++){\n\t\telements[i].style.color = \"black\";\n\t};\n}", "title": "" }, { "docid": "619c4a26111a1776ae3f650de0d923ed", "score": "0.5795036", "text": "function changePara() {\n\tlet x = document.getElementsByTagName('P');\n\tfor (let i = 0; i < x.length; i++) {\n\t\tx[i].style.fontFamily = \"lato\";\n\t}\n}", "title": "" }, { "docid": "8d5038bc3f8a9a2f50da669ca7f64f64", "score": "0.5784389", "text": "function askColor() {\n const name = prompt('Enter your color');\n document.getElementById('paragraph').style.color = name;\n }", "title": "" }, { "docid": "562522c47af4d966888a0abcf252f439", "score": "0.5773481", "text": "function texteClignotant()\n{\n var element = document.getElementById('pp');\n var random = Math.round(Math.random()*5);\n \n switch (random)\n {\n case 0:\n element.style.color = \"red\";\n break;\n \n case 1:\n element.style.color = \"green\";\n break;\n \n case 2: \n element.style.color = \"blue\";\n break;\n \n case 3:\n element.style.color = \"yellow\";\n break;\n \n case 4:\n element.style.color = \"purple\";\n break;\n }\n}", "title": "" }, { "docid": "63efc002f4600bf9e888a9aa49b4b158", "score": "0.5764679", "text": "function changeTextColor(color) {\n gMeme.lines[gMeme.selectedLineIdx].color = color\n drawImgText(elImgText)\n}", "title": "" }, { "docid": "0a76e1dcfe42807c970e9fb728bfa2c7", "score": "0.5764591", "text": "function reset() {\n //generate new colors\n colors = pickColor(numSquares);\n\n //pick new random colors\n pickedColor = colors[randomColor()];\n\n //updating page\n changeSquares();\n messageDisplay.textContent = '';\n h1.style.background = 'steelblue';\n resetButton.textContent = 'New Colors';\n colorDisplay.textContent = pickedColor;\n}", "title": "" }, { "docid": "7c7021a6e4a37d65d08a1a4226dd9e86", "score": "0.5758048", "text": "function resetPage(){\n\tvar elements = colorToggle, i, len;\n\tfor (i = 0, len = elements.length; i < len; i++){\n\t\telements[i].style.color = \"black\";\n\t};\n\n}", "title": "" }, { "docid": "c2819062fb6348c1b3350a2806c00ade", "score": "0.57526225", "text": "setTextColor(color) { this.textColor = color }", "title": "" }, { "docid": "3194dfb44aefacb3f12987af27e02c5c", "score": "0.57495475", "text": "function reset() {\n colors = generateRandomColors(num);\n winningColor = pickRandomColor();\n rgbText.textContent = winningColor;\n for (i = 0; i < squares.length; i++) {\n if(colors[i]){\n squares[i].style.display = \"block\";\n squares[i].style.backgroundColor = colors[i]\n } else {\n squares[i].style.display = \"none\";\n }\n squares[i].style.backgroundColor = colors[i];\n }\n header.style.backgroundColor = \"steelblue\"; \n comment.textContent = '';\n}", "title": "" }, { "docid": "2045aa19ba7803064514929b7dc4fa7b", "score": "0.5742563", "text": "function resetColors () {\n\tprocess.stdout.write('\\x1b[0m');\n\n\treturn this;\n}", "title": "" }, { "docid": "30602dc5d1f33f32c691c466fdbe7c1f", "score": "0.5732936", "text": "function changeColor () {\n // Get a random RGB color value up to 200, so the white font is always visible.\n var randColor = function generator() {\n return Math.floor(Math.random() * 200);\n };\n var red = randColor();\n var green = randColor();\n var blue = randColor();\n var final_color = 'rgb(' + red + ', ' + green + ', ' + blue + ')';\n\n // Assing generated RGB color to body and load quote button.\n body.style.backgroundColor = final_color;\n load_quote_btn.style.backgroundColor = final_color;\n }", "title": "" }, { "docid": "1021743d5c6f299b190ed7f771b0f399", "score": "0.573232", "text": "function ClearContent(element)\r\n{\r\n StyleRemoveAttributes(element, \"color\");\r\n element.value = \"\";\r\n}", "title": "" }, { "docid": "e874293997a4c4fee9682998f30660b7", "score": "0.573052", "text": "function reset() {\n for (var i = 0; i < box.length; i++) {\n // put the content of display color span to random color from pickedColor array\n displayColor.textContent = pickedColor[Math.floor(Math.random() * numBox)];\n // filling all boxes with colors from array colors\n box[i].style.backgroundColor = pickedColor[i];\n //when clicking on one of the boxes\n box[i].addEventListener('click', clicking);\n // reinit the button background color\n // hardMode.style.backgroundColor = '#232323';\n // give the h1 origin background color\n h1.style.backgroundColor = 'steelblue';\n // reinint the message span\n msg.textContent = '';\n // reinit the message background color\n msg.style.color = '#232323';\n }\n}", "title": "" }, { "docid": "82ba76266f2fc4a639a63587b9c23cd3", "score": "0.5715845", "text": "function resetColor(boolean, color) {\r\n if (!boolean) {\r\n // do not change defined backgorund;\r\n document.getElementById('taskText').style.backgroundImage = color;\r\n } else {\r\n // change defined background to actual one;\r\n document.getElementById('taskText').style.backgroundImage = color;\r\n }\r\n}", "title": "" }, { "docid": "50518604adc8df0825183682443ca632", "score": "0.56994605", "text": "function restartGame() {\n messageDisplay.textContent = \"\"; // Reset field\n colorDisplay.textContent = pickedColor; // Reset to one of the new colors\n restartBtn.textContent = \"New Colors\" // Reset button text\n heading.style.background = \"#062563\"; // Reset heading background\n}", "title": "" }, { "docid": "d207ee0edb087dafa6965e8c4c000cee", "score": "0.5693227", "text": "function resetDrawColor() {\n ctx.fillStyle = default_color;\n ctx.strokeStyle = default_color;\n}", "title": "" }, { "docid": "35e57ccc201c80be4612eac2b320a0c9", "score": "0.56929684", "text": "function estourar(element) {\n document.body.removeChild(element);\n document.getElementById('placar').innerHTML++;\n let cor = Math.floor(Math.random()*999999);\n let cor1 = Math.floor(Math.random()*999999);\n document.getElementById('placar').setAttribute(\"style\", \"color:#\"+cor1+\";background-color:#\"+cor+\";\");\n\n}", "title": "" }, { "docid": "07013e7f6ddfddf7d2dc1e196d054a8c", "score": "0.5691601", "text": "function changeText(){\r\n document.getElementById(\"words\").style.color = \"darkgreen\";\r\n}", "title": "" }, { "docid": "edb7972d6ac60e17c336c1432dd6a028", "score": "0.56906915", "text": "function colorChanger(){\n var randomNumber = getRandomNumber();\n document.body.style.backgroundColor = colors[randomNumber];\n color.textContent = colors[randomNumber];\n}", "title": "" }, { "docid": "209c15aea463e678bda7a679bfdb1095", "score": "0.56883943", "text": "setTextColor(color) {\n bm.refs.container.style.color = color;\n }", "title": "" }, { "docid": "1f3ac08eb0d3031eaa3b12dce92bf250", "score": "0.56770086", "text": "function changeColor(){\n _('colorR').style.backgroundColor = ranColor();\n}", "title": "" }, { "docid": "b0f06dbbc8cec08a7b6c18f2efb47a42", "score": "0.567621", "text": "function colorText(text, color, isBg = false) {\n text = text.replace(exports.resetToken, \"\");\n return (isBg ? colorBGToken(color) : colorFGToken(color)) + text + exports.resetToken;\n}", "title": "" }, { "docid": "618d38fc1f5b34325edcb8748be687a5", "score": "0.56633955", "text": "function firstParagraphHover(){\n \n if(firstParagraphWasHovered){\n firstParagraph.style.color = \"#000000\";\n firstParagraphWasHovered = false;\n }else {\n firstParagraph.style.color = \"red\";\n firstParagraphWasHovered = true;\n }\n}", "title": "" }, { "docid": "27c832a89a85118759ecd6c8f75db4ef", "score": "0.5654205", "text": "function cambiosColores(){\r\n var colores = new Array('red', 'blue','yellow', 'orange', 'purple');\r\n var cambioColor_Id = false;\r\n var count = 0;\r\n var todasP = document.getElementsByTagName('p');\r\n var nTodasP;\r\n if (cambioColor_Id==false){\r\n cambioColor_Id = setInterval(function(){\r\n nTodasP = Math.floor(Math.random()*((todasP.length-1)-0+1))+0;\r\n todasP[nTodasP].style.color=colores[count];\r\n count++;\r\n if(count>colores.length-1){\r\n count=0;\r\n }\r\n },1000);\r\n }\r\n}", "title": "" }, { "docid": "279c99628da5698f9f1bced17eedd75b", "score": "0.5653507", "text": "function resetText()\n{\n oText.left = TXT_ANIMATION_LEFT * dpiScaleFactor;\n oText.top = TXT_ANIMATION_TOP * dpiScaleFactor;\n oText.align = 0;\n oText.blur = 0;\n oText.brightness = 0;\n oText.color = TXT_COLOR;\n oText.font = TXT_FONT;\n oText.fontSize = TXT_ANIMATION_SIZE * dpiScaleFactor;\n oText.opacity = 100;\n oText.rotation = 0;\n oText.addGlow('white', 0, 0);\n oText.addShadow('white', 0, 0, 0, 0);\n}", "title": "" }, { "docid": "c418f0e4d4b58ecee399f6344dcde425", "score": "0.56526935", "text": "function reset() {\n $('.letters span').removeClass(\"disabled\");\n $(\".hangman\").css(\"opacity\", 0);\n $(\"#hangman_1\").css(\"opacity\", 1);\n theWord = getWord();\n setup(theWord);\n }", "title": "" }, { "docid": "50fb258e2fe7bd91988f2d0c66282bbb", "score": "0.56471956", "text": "function setNormalColor(oElement)\n{\n oElement.style.background = BG_DEF_CLR;\n oElement.style.color = FG_DEF_CLR;\n}", "title": "" }, { "docid": "b36d6397c039dc177e31ab7b18661047", "score": "0.56429464", "text": "function titleChangeBlack(){\n this.style(\"color\", \"#000000\");\n this.style(\"background-color\", \"#ffffff\");\n\n}", "title": "" }, { "docid": "176b0b35c9a4e852c944cfe2ce32cf1f", "score": "0.56318706", "text": "function changeStyle(){\n //var para = document.getElementsByTagName(\"p\");\n\n var element = document.getElementsByClassName(\"mypara\");\n\n for(var x = 0; x< element.length; x++){\n element[x].style.fontSize = 28;\n element[x].style.color = \"blue\";\n element[x].style.fontWeight = \"bold\";\n\n }\n \n /*for(var i = 0; i<para.length; i++){\n para[i].style.fontSize = 22;\n para[i].style.color = \"red\";\n para[i].style.fontStyle = \"italic\";\n para[i].style.fontWeight = \"bold\";\n\n }*/\n \n\n \n}", "title": "" }, { "docid": "099ce3fd484b72f25c6c2aafe455b4f0", "score": "0.56198126", "text": "function answerWhite() {\n htmlAnswer.style.backgroundColor = \"azure\";\n}", "title": "" }, { "docid": "6259089f404e1ca5e2c73aaab2242819", "score": "0.5616509", "text": "function applyHighlight(para_num, para) {\n let highlight_color = calcHighlightColor(para_num);\n modified_paras[para_num] = {highlight_color: highlight_color};\n $(para).css(\"background-color\", highlight_color);\n }", "title": "" }, { "docid": "c8bd6174032d6a00fa83ecc322d20a1d", "score": "0.56145185", "text": "function reset(){\n\tresetPressed = true;\n\tcolors = generateRandomColors(numSquares);\n\t//pick a new random color from array\n\tpickedColor = pickColor();\n\t//change colorDisplay to match picked Color\n\tcolorDisplay.textContent = pickedColor;\n\tresetButton.textContent = \"New Colors\"\n\tmessageDisplay.textContent = \"\";\n\t//change colors of squares\n\tfor(var i = 0; i < squares.length; i++){\n\t\tif(colors[i]){\n\t\t\tsquares[i].style.display = \"block\"\n\t\t\tsquares[i].style.background = colors[i];\n\t\t} else {\n\t\t\tsquares[i].style.display = \"none\";\n\t\t}\n\t}\n\th1.style.background = \"steelblue\";\n}", "title": "" }, { "docid": "c8bd6174032d6a00fa83ecc322d20a1d", "score": "0.56145185", "text": "function reset(){\n\tresetPressed = true;\n\tcolors = generateRandomColors(numSquares);\n\t//pick a new random color from array\n\tpickedColor = pickColor();\n\t//change colorDisplay to match picked Color\n\tcolorDisplay.textContent = pickedColor;\n\tresetButton.textContent = \"New Colors\"\n\tmessageDisplay.textContent = \"\";\n\t//change colors of squares\n\tfor(var i = 0; i < squares.length; i++){\n\t\tif(colors[i]){\n\t\t\tsquares[i].style.display = \"block\"\n\t\t\tsquares[i].style.background = colors[i];\n\t\t} else {\n\t\t\tsquares[i].style.display = \"none\";\n\t\t}\n\t}\n\th1.style.background = \"steelblue\";\n}", "title": "" }, { "docid": "2322372501797b47d2dc9bd06412916f", "score": "0.5614464", "text": "function updateTextColor() {\n for (var i = 0; i < textColor.length; i++) {\n textColor[i] = Math.min(\n Math.max(\n Math.round(\n textColor[i]\n +Math.random()*8-4)\n , 0)\n , 255);\n }\n}", "title": "" }, { "docid": "9a8e50fb4bba116d78e8672c41006399", "score": "0.56028074", "text": "function changeTxtColor(val) {\n line = getLine();\n line.fillColor = val;\n drawCanvas();\n}", "title": "" }, { "docid": "e357a1e64f444e902fc336da7616969b", "score": "0.5599405", "text": "function reveal_para2_lyrics(){\n check_num_of_clicks();\n change_background_colour();\n var para2 = document.getElementsByClassName('second_paragraph');\n para2[0].style.display = \"inline\";\n setTimeout(change_to_default_background, 5000);\n}", "title": "" }, { "docid": "1e86688a81fe5311ac2e982d54ef7c35", "score": "0.55871964", "text": "function afterOpenModal() {\n // references are now sync'd and can be accessed.\n subtitle.style.color = \"#ff0000\";\n }", "title": "" }, { "docid": "0252ebe58e7904350935521fd9d9c825", "score": "0.55847865", "text": "function reText(el){\n\t//Change the form fields text color\n\tif (el.style) el.style.color = \"#ccc\";\n\tif (el.value== \"\") el.value = el.defaultValue;\n}", "title": "" }, { "docid": "a956298c5410a11bc7dcac46f8e9a161", "score": "0.55775404", "text": "function jsStyle() {\r\n // function to change style\r\n // Change the color and the size of the font\r\n // in the paragraph with id='text'\r\n \"use strict\";\r\n var paragraph = document.getElementsByTagName('p')[0].innerHTML;\r\n document.getElementById('text').removeChild(document.getElementsByTagName('p')[0]);\r\n var node = document.createElement(\"p\");\r\n node.innerHTML = paragraph;\r\n node.style.color = \"red\";\r\n node.style.fontSize = \"xx-large\";\r\n document.getElementById('text').appendChild(node);\r\n}", "title": "" }, { "docid": "663c8a04c7de81d308ab8ab675e629ed", "score": "0.5576539", "text": "resetStyle(ctx) {\n ctx.globalAlpha = 1;\n ctx.fillStyle = \"black\";\n ctx.font = \"15px sans-serif\";\n }", "title": "" }, { "docid": "c36c2d27629a9113141a1d2e0f69826c", "score": "0.5576482", "text": "function change_text_color(new_color,textarea_id)\r\n{\r\n\tdocument.getElementById(textarea_id).style.color = new_color;\r\n\treturn;\r\n} // end of change_text_color", "title": "" }, { "docid": "b1c465a79673411f4c6662ce862adcf1", "score": "0.5569359", "text": "function resetbtn(){\n\t//Getting colors from the array\n\tcolors = addingRandomColors(numBoxes);\n\t//Picking the right color\n\tcorrectColor = pickColor();\n\t//Displaying the correct color at header\n\tcolorDisplay.textContent = correctColor;\n\t//Getting new colors for boxes \n\tfor (var i = 0; i < colors.length; i++) {\n\t\tboxes[i].style.background = colors[i];\n\t}\n\th1Color.style.background = \"#4682B4\";\n\tresultMessage.textContent = \"\";\n\treset.textContent = \"New Colors\";\n}", "title": "" }, { "docid": "9c59c1ff44d7ade63fe007bd219eba62", "score": "0.5568684", "text": "function revertColor() {\n myElement.style.fill = staticColorValue;\n stepLable.style.fill = \"black\";\n kmLable.style.fill = \"black\";\n batLable.style.fill = \"black\";\n timeLable.style.fill = \"black\";\n}", "title": "" }, { "docid": "fd3167a286cf2ed2a3c332e1c4ca7e23", "score": "0.5567593", "text": "function change() {\n r = Math.floor(Math.random() * 16).toString(16);\n g = Math.floor(Math.random() * 16).toString(16);\n b = Math.floor(Math.random() * 16).toString(16);\n color = `#${r}${g}${b}`;\n h1.textContent = color;\n body.style.backgroundColor = color;\n}", "title": "" }, { "docid": "2dac7bde82694afdd07e52e416fb4c72", "score": "0.5563394", "text": "function reset(){\n\tp1Score = 0;\n p2Score = 0;\n p1display.textContent = 0;\n p2display.textContent = 0;\n // elmininar la clase de color verde para volver a comenzar\n p1display.classList.remove(\"winner\");\n p2display.classList.remove(\"winner\");\n // volver a comenzar con game over false.\n gameOver = false;\n\n}", "title": "" }, { "docid": "dccce41d87c4bd41d82023c05d3b6c67", "score": "0.5561421", "text": "function reset() {\n // Generate an array of new colors\n colors = generateRandomColors(numSquares);\n // Pick a new winning color\n pickedColor = pickColor();\n // Change colorDisplay to match clicked color\n colorDisplay.textContent = pickedColor;\n // Reset H1 Color\n h1.style.background = \"\";\n messageDisplay.textContent = \"\";\n // Change the color of squares on the screen\n configureSquares();\n}", "title": "" }, { "docid": "566d47ec08701b5f4345c5620183472b", "score": "0.5556375", "text": "function reset()\n{\n // generate all new colors\n colors = generateRandomColors(numSquares);\n // pick a new random color from array\n pickedColor = pickColor();\n // Change color display to match picked color\n guessDisplay.textContent = pickedColor;\n // reset contents of button to new colors\n resetButton.textContent = \"New Colors\";\n // empty out the span with \"correct!/try again\"\n msgDisplay.textContent = \"\";\n // change colors of squares\n for(var i=0;i<squares.length;i++)\n {\n if (colors[i])\n {\n squares[i].style.display = \"block\";\n squares[i].style.background = colors[i];\n }\n else\n squares[i].style.display = \"none\";\n }\n // reset the background color of h1\n h1.style.background = \"steelblue\"\n}", "title": "" }, { "docid": "933fc3b1fa22ba7fdd818af657170419", "score": "0.55520695", "text": "get reset() {\n let self = this;\n if (self._reset === null){\n self._reset = function() {\n self.p.background(self.colors.background);\n self.p.fill(self.colors.fill);\n self.p.stroke(self.colors.stroke);\n };\n }\n return self._reset;\n }", "title": "" }, { "docid": "0b5dba68bc22f90fbf7b13f9e1134d96", "score": "0.55490804", "text": "function colorize(){\n //randomly generate 2 colors and set them to the background and text color\n this.style.backgroundColor=makeRandColor();\n this.style.color=makeRandColor();\n}", "title": "" }, { "docid": "cc6aa7a974ffb99981a7f2b3fc31e951", "score": "0.5533942", "text": "function ChangeColor(){\n // get the style variables in root\n let r = document.querySelector(':root');\n // get the computed style of that element\n let rs = getComputedStyle(r);\n // get the index in the primaries array from the current style value\n let currentIndex = getCurrentPrimaryScheme(rs.getPropertyValue('--primary'));\n // increment\n let newIndex = currentIndex + 1;\n\n // make sure no overload\n if (newIndex === primaries.length){\n newIndex=0;\n }\n\n // set all the properties to the new index\n r.style.setProperty('--primary', primaries[newIndex]);\n r.style.setProperty('--secondary', secondaries[newIndex]);\n r.style.setProperty('--tertiary', tertiaries[newIndex]);\n r.style.setProperty('--quaternary', quaternaries[newIndex]);\n // r.style.setProperty('--quinary', quinaries[newIndex]);\n\n}", "title": "" }, { "docid": "d4646c2b4382be52bcd0b416803b0bfa", "score": "0.55295575", "text": "function setColor(){\n preColor = this.style.backgroundColor;\n currColor = preColor;\n console.log(currColor);\n }", "title": "" }, { "docid": "59232fae6a84e04919d6bc1cdb151f4d", "score": "0.55274826", "text": "function changeStrokeColor(color) {\n gMeme.currText.stroke = color\n}", "title": "" }, { "docid": "9c81aa5786993ef79ff4cc127ec55ec9", "score": "0.55265856", "text": "function answerRed() {\n htmlAnswer.style.backgroundColor = \"tomato\";\n}", "title": "" }, { "docid": "7c28845207a943ddb67acecf24cd201b", "score": "0.5522911", "text": "function playersReset() {\n p0heading.innerText = 'Player 1';\n p0heading.style.fontSize = '2.5rem';\n p0heading.style.color = 'white';\n\n p1heading.innerText = 'Player 2';\n p1heading.style.fontSize = '2.5rem';\n p1heading.style.color = 'white';\n}", "title": "" }, { "docid": "6db4d23bf96de83e58dae6dc53b0d00c", "score": "0.55197257", "text": "function reset(){\r\n\t//generate new colors\r\n\tcolors = genRC(numSquares);\r\n\r\n\t//pick new color\r\n\tpickedcolor = colors[pickColorfnc()];\r\n\r\n\t//change objective message\r\n\tobjcolor.textContent = pickedcolor;\r\n\r\n\t//changing header background color\r\n\th1.style.backgroundColor = \"steelblue\";\r\n\r\n\t//setting to \"New Colors\" when clicked \"Play again\"\r\n\tresetbtn.textContent = \"New Colors\";\r\n\r\n\t//hidding out report message\r\n\tdocument.querySelector(\"#reportmessage\").textContent = \"\";\r\n\r\n\t//change color of squares\r\n\tfor (var i = 0; i<squares.length; i++){\r\n\t\tif(colors[i]){ //checking if there is a color in colors array, it will add that color to squares array\r\n\t\t\tsquares[i].style.display = \"block\";\r\n\t\t\tsquares[i].style.backgroundColor = colors[i];\t\r\n\t\t}else {\r\n\t\t\tsquares[i].style.display = \"none\";\r\n\t\t}\r\n\t\t\r\n\t}\r\n}", "title": "" }, { "docid": "6ce1e7df7ad6b2f4915ef6de488b70b4", "score": "0.55175227", "text": "darken() {\n this._color = 0;\n this._launchpad.output.sendMessage([144, this._note, 0]);\n }", "title": "" }, { "docid": "355aec9e5ae001d0fc990d73a1b4d5ea", "score": "0.55116445", "text": "function cambioColor(){\n document.getElementById('titulo').style.color = '#2a9d8f'\n}", "title": "" }, { "docid": "1f248e70999cd2e4a1bee9bc2c7baf2b", "score": "0.5508543", "text": "function changeColor(newColor) {\n let btn = document.getElementById('text');\n btn.style.color = newColor;\n}", "title": "" }, { "docid": "a84a1535adcb65eb21fff4dff3e60dc1", "score": "0.5506141", "text": "function reactColour() {\r\n let colourText = document.createElement('p');\r\n colourText.textContent = `${capitalise(colour.value)}, you say? There you go.`;\r\n wordElement.before(colourText);\r\n colourElement.style.display = 'none';\r\n}", "title": "" }, { "docid": "3c37645e76e0fb2e56282edc3da278d6", "score": "0.5500966", "text": "setTextColor(color) {\n this.textColor = color;\n }", "title": "" }, { "docid": "d127e45533add1760f2bbec564cea7f7", "score": "0.5500142", "text": "function changeColor(elm) {\n if(elm.style.color == '')\n {\n elm.style.color = '#ff0000';\n }\n else {\n elm.style.color = '';\n }\n }", "title": "" }, { "docid": "e9db0dec5744cb3427bba4020ab7ab70", "score": "0.54977316", "text": "function reform() {\n ex1.classList.remove(\"chcolor\");\n}", "title": "" }, { "docid": "2ed24cdfc50d5842c2482f5431f77b58", "score": "0.54970473", "text": "function clearAnswer() {\n input.value = '';\n setAllColorsToDefault();\n}", "title": "" }, { "docid": "e758a61a583fe1114745ade52f08609f", "score": "0.54867816", "text": "function ResetButton()\r\n{\r\n\t//for generating the new color on click \r\n\tcolor = generateRandomColor(NumSquare);\r\n\t//pick any color random color from the color \r\n\tpickedColor = picked_Color();\r\n\t//To show the code of the color on the Heading \r\n\tcolorDisplay.textContent=pickedColor;\r\n\t//heading background color \r\n\th1.style.background=\"steelblue\";\r\n\t//Update the New color Button \r\n\tthis.textContent=\"New Color\";\r\n\r\n\tmessageDisplay.textContent = \" \";\r\n\r\n\tfor (var i=0;i<square.length;i++)\r\n\t{\r\n\r\n\t\tsquare[i].style.background=color[i];\r\n\r\n\t}\r\n\t//remove the color class \r\n\r\n\thardbtn.classList.remove(\"selected\");\r\n\t//remove the button color class \r\n\teasybtn.classList.remove(\"selected\");\r\n\t//add color class on reset button \r\n\tresetButton.classList.add(\"selected\");\r\n}", "title": "" }, { "docid": "177c2e8afbb16919d174f965464f770d", "score": "0.54851794", "text": "function reset() {\n // generate a random color for the number of squares\n colors = generateRandomColors(numSquares);\n // pick a new random color from array\n pickedColor = pickColor();\n // change colorDisplay to match picked color\n colorDisplay.textContent = pickedColor;\n // resets \"Play Again?\" to \"New Colors\"\n resetButton.textContent = \"New Colors\";\n // Clears \"Try Again?\" or \"Correct\" span to empty str\n messageDisplay.textContent = \"\";\n // change colors of squares\n for (let i = 0; i < squares.length; i++) {\n if(colors[i]) {\n squares[i].style.display = \"block\";\n squares[i].style.backgroundColor = colors[i];\n } else {\n squares[i].style.display = \"none\";\n }\n }\n h1.style.backgroundColor = \"steelBlue\";\n \n}", "title": "" }, { "docid": "9c39602f6133526320b3e08cbd424469", "score": "0.54839396", "text": "function changeColor(newColor){\n let btn = document.getElementById('text');\n btn.style.color = newColor;\n}", "title": "" }, { "docid": "64ab38fabd0466d15069b3249f1f06b6", "score": "0.54829717", "text": "function changeColor() {\n var randomColor = Math.floor(Math.random()*(colors.length));\n document.getElementById(\"randomColor\").innerHTML = colors[randomNumber];\n document.body.style.backgroundColor = changeColor;\n document.getElementById(\"randomColor\").style.backgroundColor = \"yellow\";\n }", "title": "" }, { "docid": "b6dea91ea5fd0ef02e31798cd6dc253e", "score": "0.5479899", "text": "function reset() {\n play = true;\n count = 0;\n score.innerText = 0;\n clicks.innerText = 0;\n ratio.innerText = 0\n newColors();\n}", "title": "" }, { "docid": "e9cd99659f767be202840b9074515c6e", "score": "0.5466633", "text": "resetChanges(streamWriter) {\n streamWriter.setColorAndSpace(new PdfColor(0, 0, 0), PdfColorSpace.Rgb, false);\n }", "title": "" }, { "docid": "ce4ee125b18a2e22af25c28595e749fc", "score": "0.54652685", "text": "function recolor(e) {\n this.style.backgroundColor = 'black';\n}", "title": "" } ]
c972a1ded4e0e7a157218b3e31e66407
Validates initial property values.
[ { "docid": "2a01d959b66e9cb3337fd8b98cc05968", "score": "0.52601194", "text": "_validateInitialPropertyValues() {\n const that = this,\n calendar = that.$.calendarDropDown;\n\n if (that.calendarButtonPosition === 'left') {\n that.$.content.insertBefore(that.$.calendarButton, that.$.input);\n }\n\n if (that.spinButtonsPosition === 'left') {\n that.$.content.insertBefore(that.$.spinButtonsContainer, that.$.input);\n }\n\n if (that.disabled) {\n that.$.upButton.disabled = true;\n that.$.downButton.disabled = true;\n }\n\n if (that.opened) {\n if (!that.disabled && !that.readonly) {\n calendar.disabled = false;\n that.$calendarButton.addClass('jqx-calendar-button-pressed');\n that.$.calendarButton.setAttribute('active', '');\n that.$calendarDropDown.removeClass('jqx-hidden');\n that.$dropDownContainer.removeClass('jqx-visibility-hidden');\n }\n else {\n that.opened = false;\n }\n }\n\n if (that.footerTemplate === null) {\n that._setDefaultFooterTemplate(true);\n }\n else {\n calendar.footerTemplate = that.footerTemplate;\n calendar._handleLayoutTemplate(calendar.$.footer, that.footerTemplate);\n }\n\n if (that.formatString === '') {\n that.formatString = 'dd-MMM-yy HH:mm:ss.fff';\n }\n\n const displayKind = that.displayKind;\n\n if (displayKind === 'UTC') {\n that._outputTimeZone = 'UTC';\n }\n else if (displayKind === 'local') {\n that._outputTimeZone = 'Local';\n }\n\n let parsedValue;\n\n if (that.value !== null) {\n parsedValue = JQX.Utilities.DateTime.validateDate(that.value, new JQX.Utilities.DateTime(), that.formatString);\n that._inputTimeZone = parsedValue.timeZone;\n\n if (displayKind !== 'unspecified' && that._inputTimeZone !== that._outputTimeZone) {\n parsedValue = parsedValue.toTimeZone(that._outputTimeZone);\n }\n else if (displayKind === 'unspecified') {\n that._outputTimeZone = that._inputTimeZone;\n }\n }\n else {\n parsedValue = null;\n that._inputTimeZone = 'Local';\n }\n\n that._validateRestrictedDates();\n that._validateMinMax('both');\n that._validateValue(parsedValue, that._now(), false, true);\n that._validateInterval(new JQX.Utilities.TimeSpan(0, 0, 1));\n\n that._getFormatStringRegExp();\n\n if (that._defaultFooterTemplateApplied && that._hourElement.value === '' && that.value !== null) {\n const value = that.value;\n\n that._hourElement.value = value.toString('hh');\n that._ampmElement.value = value.toString('tt');\n that._minuteElement.value = value.toString('mm');\n }\n\n that._detectDisplayMode();\n\n const dropDownDisplayMode = that._dropDownDisplayMode;\n\n if (dropDownDisplayMode === 'default' || dropDownDisplayMode === 'calendar') {\n calendar.viewSections = ['title', 'header'];\n\n if (calendar.$title.hasClass('jqx-hidden')) {\n calendar.propertyChangedHandler('viewSections', ['header', 'footer'], ['title', 'header']);\n }\n\n if (dropDownDisplayMode === 'default') {\n that.$dropDownHeader.removeClass('jqx-hidden');\n }\n }\n else if (dropDownDisplayMode === 'timePicker') {\n that.$calendarDropDown.addClass('jqx-hidden');\n that._initializeTimePicker();\n }\n }", "title": "" } ]
[ { "docid": "a255df92b2859dc91fa3d14afc1b8e61", "score": "0.7836651", "text": "_validateInitialPropertyValues() {\n const that = this,\n value = typeof (that.value) === String ? that.value.replace(/\\s/g, '') : that.value.toString().replace(/\\s/g, '');\n\n if (that.mode === 'numeric' && that._numericProcessor.regexScientificNotation.test(value)) {\n that.value = that._numericProcessor.scientificToDecimal(value);\n delete that._valueBeforeCoercion;\n }\n\n //Validates significantDigits\n that.significantDigits = (that.significantDigits !== null) ? Math.min(Math.max(that.significantDigits, 1), 21) : null;\n\n if (that.significantDigits === null && that.precisionDigits === null) {\n that.significantDigits = 8;\n }\n else if (that.significantDigits !== null && that.precisionDigits !== null) {\n that.error(that.localize('significantPrecisionDigits', { elementType: that.nodeName.toLowerCase() }));\n }\n\n //minMax validation\n that._validateMinMax('both', true);\n\n if (that.showTooltip && that.showThumbLabel) {\n that.showTooltip = false;\n }\n }", "title": "" }, { "docid": "931013d7ac30fb1e7cd86b6dcd269f17", "score": "0.75331384", "text": "_validateInitialPropertyValues() {\n const that = this;\n\n that._validateFooterTemplate();\n\n that.minuteInterval = Math.max(1, Math.min(that.minuteInterval, 60));\n\n that._validateValue();\n }", "title": "" }, { "docid": "0faf4d4b8220549f1194f73217b0afeb", "score": "0.64772373", "text": "initialize() {\n super.initialize();\n\n this.originalValue = null;\n this.maxLength = this.config.maxLength || null;\n this.required = this.config.required || false;\n this.requiredValidator = this.config.requiredValidator || null;\n }", "title": "" }, { "docid": "82cd2cafc6bc70ec89e5a52d2965b501", "score": "0.64756846", "text": "_validateInitialPropertyValues() {\n super._validateInitialPropertyValues();\n\n const that = this;\n\n if (that.sizeMode === 'circle') {\n if (that.offsetWidth < that.offsetHeight) {\n that.style.height = that.offsetWidth + 'px';\n }\n else if (that.offsetWidth > that.offsetHeight) {\n that.style.width = that.offsetHeight + 'px';\n }\n }\n else {\n if (that.offsetHeight !== that.offsetWidth) {\n that.style.height = that.offsetWidth + 'px';\n }\n\n that.$.container.style.height = that.offsetWidth + 'px';\n }\n\n that._validateAngles();\n\n if (that.significantDigits !== null) {\n that.$.digitalDisplay.significantDigits = that.significantDigits;\n }\n else if (that.precisionDigits !== null) {\n that.$.digitalDisplay.precisionDigits = that.precisionDigits;\n }\n }", "title": "" }, { "docid": "951e61a383159c438f743ba9f87bdd13", "score": "0.64086074", "text": "function checkInitialValue () {\n\t var initValue\n\t var options = this.el.options\n\t for (var i = 0, l = options.length; i < l; i++) {\n\t if (options[i].hasAttribute('selected')) {\n\t if (this.multiple) {\n\t (initValue || (initValue = []))\n\t .push(options[i].value)\n\t } else {\n\t initValue = options[i].value\n\t }\n\t }\n\t }\n\t if (typeof initValue !== 'undefined') {\n\t this._initValue = this.number\n\t ? _.toNumber(initValue)\n\t : initValue\n\t }\n\t}", "title": "" }, { "docid": "951e61a383159c438f743ba9f87bdd13", "score": "0.64086074", "text": "function checkInitialValue () {\n\t var initValue\n\t var options = this.el.options\n\t for (var i = 0, l = options.length; i < l; i++) {\n\t if (options[i].hasAttribute('selected')) {\n\t if (this.multiple) {\n\t (initValue || (initValue = []))\n\t .push(options[i].value)\n\t } else {\n\t initValue = options[i].value\n\t }\n\t }\n\t }\n\t if (typeof initValue !== 'undefined') {\n\t this._initValue = this.number\n\t ? _.toNumber(initValue)\n\t : initValue\n\t }\n\t}", "title": "" }, { "docid": "d682f272be01ba71f14e309f873890e4", "score": "0.63246715", "text": "function checkInitialValue () {\n var initValue\n var options = this.el.options\n for (var i = 0, l = options.length; i < l; i++) {\n if (options[i].hasAttribute('selected')) {\n if (this.multiple) {\n (initValue || (initValue = []))\n .push(options[i].value)\n } else {\n initValue = options[i].value\n }\n }\n }\n if (typeof initValue !== 'undefined') {\n this._initValue = this.number\n ? _.toNumber(initValue)\n : initValue\n }\n}", "title": "" }, { "docid": "d682f272be01ba71f14e309f873890e4", "score": "0.63246715", "text": "function checkInitialValue () {\n var initValue\n var options = this.el.options\n for (var i = 0, l = options.length; i < l; i++) {\n if (options[i].hasAttribute('selected')) {\n if (this.multiple) {\n (initValue || (initValue = []))\n .push(options[i].value)\n } else {\n initValue = options[i].value\n }\n }\n }\n if (typeof initValue !== 'undefined') {\n this._initValue = this.number\n ? _.toNumber(initValue)\n : initValue\n }\n}", "title": "" }, { "docid": "33e34a2c1f6a3420803e4eb377fe9e3a", "score": "0.63163334", "text": "function setInitialValues() {\n // you can decide on some initial values\n}", "title": "" }, { "docid": "a7421d60b850eb0ba2a304275929ba2a", "score": "0.63030505", "text": "function checkInitialValue () {\n var initValue\n var options = this.el.options\n for (var i = 0, l = options.length; i < l; i++) {\n if (options[i].hasAttribute('selected')) {\n if (this.multiple) {\n (initValue || (initValue = []))\n .push(options[i].value)\n } else {\n initValue = options[i].value\n }\n }\n }\n if (initValue) {\n this._initValue = this.number\n ? _.toNumber(initValue)\n : initValue\n }\n}", "title": "" }, { "docid": "eba2791b9bfb9303a1dab9b6e3c50ffc", "score": "0.62689507", "text": "validateInit() {\n this.runValidation(true);\n }", "title": "" }, { "docid": "bf74b57aa88fe50082ac30d0ad115631", "score": "0.617113", "text": "function CfnApplication_InitialCapacityConfigPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('workerConfiguration', cdk.requiredValidator)(properties.workerConfiguration));\n errors.collect(cdk.propertyValidator('workerConfiguration', CfnApplication_WorkerConfigurationPropertyValidator)(properties.workerConfiguration));\n errors.collect(cdk.propertyValidator('workerCount', cdk.requiredValidator)(properties.workerCount));\n errors.collect(cdk.propertyValidator('workerCount', cdk.validateNumber)(properties.workerCount));\n return errors.wrap('supplied properties not correct for \"InitialCapacityConfigProperty\"');\n}", "title": "" }, { "docid": "cd5d8d2763c6ebcbe7b8523bb49fbcad", "score": "0.61258894", "text": "function CfnAlarmModel_InitializationConfigurationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('disabledOnInitialization', cdk.requiredValidator)(properties.disabledOnInitialization));\n errors.collect(cdk.propertyValidator('disabledOnInitialization', cdk.validateBoolean)(properties.disabledOnInitialization));\n return errors.wrap('supplied properties not correct for \"InitializationConfigurationProperty\"');\n}", "title": "" }, { "docid": "5eddffaa57e471490ec81e9929f58e72", "score": "0.6105981", "text": "async checkProperties(data, fields) {\n this.fill(data, fields);\n return this.valid(false, false);\n }", "title": "" }, { "docid": "9397bb4b340f09773771b81600f816d0", "score": "0.59911346", "text": "function initPropertyValues() {\n var propertyNames = Object.keys(model.values);\n propertyNames.forEach(function (propertyName) {\n properties[propertyName] = 'unknown';\n });\n myself.addValue(properties);\n sendCommand(initialCommands);\n}", "title": "" }, { "docid": "7c0470f4692c36d524bdcb064c77f212", "score": "0.5989933", "text": "function CfnApplication_InitialCapacityConfigKeyValuePairPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('key', cdk.requiredValidator)(properties.key));\n errors.collect(cdk.propertyValidator('key', cdk.validateString)(properties.key));\n errors.collect(cdk.propertyValidator('value', cdk.requiredValidator)(properties.value));\n errors.collect(cdk.propertyValidator('value', CfnApplication_InitialCapacityConfigPropertyValidator)(properties.value));\n return errors.wrap('supplied properties not correct for \"InitialCapacityConfigKeyValuePairProperty\"');\n}", "title": "" }, { "docid": "3ae73467e015824b670451bcbc4ce8ab", "score": "0.5894108", "text": "setupInitialValues() {\n this.__xSpacingInput.value = \"1.0\";\n this.__ySpacingInput.value = \"1.0\";\n\n this.__xDimInput.value = 5;\n this.__yDimInput.value = 1;\n }", "title": "" }, { "docid": "1cf5a03cd5363157a5cfdde299ed78de", "score": "0.57902646", "text": "function initialValues() {\n return {\n name: \"\",\n };\n}", "title": "" }, { "docid": "e4021144a4ad4e0362c18821f001f1c4", "score": "0.57621527", "text": "function CfnFunction_EmptySAMPTPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n return errors.wrap('supplied properties not correct for \"EmptySAMPTProperty\"');\n}", "title": "" }, { "docid": "c0fd749766462e371000909d3c802eaa", "score": "0.5685695", "text": "_checkIfBasePropertyPresent() {\n if(this.input.length) {\n this.input.forEach(el => {\n console.log(el);\n if(!el[this.config.baseProperty]) {\n throw new ValidationError('Base property which has been specified' +\n ' in config should be present in all members of the data structure.' + ' Base property is '\n + this.config.baseProperty);\n }\n });\n }\n }", "title": "" }, { "docid": "259fc1df5c24f58603138faea80dec09", "score": "0.5677616", "text": "function validateMandatory() {\n return {\n isValid: !vm.validation.mandatory || (vm.viewModel != null && vm.viewModel.length > 0)|| (vm.value != null && vm.value.length > 0),\n errorMsg: \"Value cannot be empty\",\n errorKey: \"required\"\n };\n }", "title": "" }, { "docid": "b47637c45860492d080f9154a8c9b3f6", "score": "0.5606986", "text": "static validate(obj, props) {\n let isValid = true;\n const missingProps = [];\n const propsWithoutValue = [];\n props.forEach((prop) => {\n let propHasValue;\n const propFound = (Object.prototype.hasOwnProperty.call(obj, prop));\n if (propFound) {\n propHasValue = (obj[prop] !== '' && (obj[prop].trim().length !== 0));\n }\n if (!propFound) {\n missingProps.push(prop);\n isValid = false;\n }\n if (propFound && !propHasValue) {\n propsWithoutValue.push(prop);\n isValid = false;\n }\n });\n return { isValid, missingProps, propsWithoutValue };\n }", "title": "" }, { "docid": "425b619309527299c1e633a6a6845318", "score": "0.56041265", "text": "function CfnFunction_EmptySAMPTPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n return errors.wrap('supplied properties not correct for \"EmptySAMPTProperty\"');\n}", "title": "" }, { "docid": "0e73af6d86c74d41ea7be7ec6fcecad3", "score": "0.5590629", "text": "ValidateProperties(properties) {\n //All changed exists\n Object.keys(properties).forEach((key) => {\n if (!Object.keys(ExpirePageProperties).includes(key)) {\n throw Error(\"Key : \" + key + \" does not exist\");\n }\n });\n }", "title": "" }, { "docid": "e26909352a65e991f542642e31bc3c6e", "score": "0.5548789", "text": "if (!this.props.initialValues) {\n this.props.change('isPublic', true);\n this.props.change('allowSharing', true);\n this.props.change('cannabisConsumption', false);\n }", "title": "" }, { "docid": "f800ae69936f155e626496138d7ab8af", "score": "0.55338484", "text": "function validateRequired () {\n\t\tvar props, prop, i, j;\n\n\t\tfor (i = 0; i < arguments.length; i++) {\n\t\t\tprops = arguments[i].split('.');\n\t\t\tprop = _this;\n\n\t\t\tfor (j = 0; j < props.length; j++) {\n\t\t\t\tprop = prop[props[j]];\n\t\t\t}\n\n\t\t\tif (typeof prop === 'string' && prop.length === 0) {\n\t\t\t\tthrow new Error(arguments[i] + ' cannot be empty');\n\t\t\t}\n\t\t}\n\t}", "title": "" }, { "docid": "79496317ee00b005092423534ed7c828", "score": "0.55135393", "text": "function CfnTaskTemplate_DefaultFieldValuePropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('defaultValue', cdk.requiredValidator)(properties.defaultValue));\n errors.collect(cdk.propertyValidator('defaultValue', cdk.validateString)(properties.defaultValue));\n errors.collect(cdk.propertyValidator('id', cdk.requiredValidator)(properties.id));\n errors.collect(cdk.propertyValidator('id', CfnTaskTemplate_FieldIdentifierPropertyValidator)(properties.id));\n return errors.wrap('supplied properties not correct for \"DefaultFieldValueProperty\"');\n}", "title": "" }, { "docid": "6840676696c79d5b26160d9f27b82a5e", "score": "0.54917026", "text": "preValidate(key, value, errors, values) {}", "title": "" }, { "docid": "f857695419fba25f574f886f0be308b5", "score": "0.54856265", "text": "_validatePropertyCompatibility() {\n const that = this;\n\n if (that.inputFormat !== 'integer') {\n if (that._radixNumber !== 10) {\n that.error(that.localize('integerOnly', { property: 'radix' }));\n }\n\n if (that.radixDisplay) {\n that.error(that.localize('integerOnly', { property: 'radixDisplay' }));\n }\n\n if (that.dropDownEnabled) {\n that.error(that.localize('integerOnly', { property: 'dropDownEnabled' }));\n }\n\n if (that.wordLength !== 'int32') {\n that.error(that.localize('integerOnly', { property: 'wordLength' }));\n }\n }\n else if (that.precisionDigits !== null) {\n that.error(that.localize('noInteger', { property: 'precisionDigits' }));\n }\n\n if (that.significantDigits === null && that.precisionDigits === null) {\n that.significantDigits = 8;\n }\n else if (that.significantDigits !== null && that.precisionDigits !== null) {\n that.error(that.localize('significantPrecisionDigits'));\n }\n }", "title": "" }, { "docid": "c62939b748f042d1409b9343be590763", "score": "0.5459477", "text": "_validate(initialValidation, programmaticValue, coerced, programmaticValueIsSet) {\n this._valuesHandler.validate(initialValidation, programmaticValue, programmaticValueIsSet);\n }", "title": "" }, { "docid": "291068adc06a65f08751c144e9e7c7cf", "score": "0.54452175", "text": "getInitialValues(inputs) {\n const initialValues = {};\n inputs.forEach(field => {\n if (!initialValues[field['fieldName']]) {\n initialValues[field['fieldName']] = field.value;\n }\n });\n return initialValues;\n }", "title": "" }, { "docid": "affe9f7aa17ec416e4f1c4e8c0b25703", "score": "0.54119575", "text": "validate(state, setError) {\n let errmsg = null,\n minimum = state.minimum,\n maximum = state.maximum,\n start = state.start;\n\n errmsg = emptyValidator('Owner', state.seqowner);\n if (errmsg) {\n setError('seqowner', errmsg);\n return true;\n } else {\n setError('seqowner', errmsg);\n }\n\n errmsg = emptyValidator('Schema', state.schema);\n if (errmsg) {\n setError('schema', errmsg);\n return true;\n } else {\n setError('schema', errmsg);\n }\n\n if (!this.isNew(state)) {\n errmsg = emptyValidator('Current value', state.current_value);\n if (errmsg) {\n setError('current_value', errmsg);\n return true;\n } else {\n setError('current_value', errmsg);\n }\n\n errmsg = emptyValidator('Increment value', state.increment);\n if (errmsg) {\n setError('increment', errmsg);\n return true;\n } else {\n setError('increment', errmsg);\n }\n\n errmsg = emptyValidator('Minimum value', state.minimum);\n if (errmsg) {\n setError('minimum', errmsg);\n return true;\n } else {\n setError('minimum', errmsg);\n }\n\n errmsg = emptyValidator('Maximum value', state.maximum);\n if (errmsg) {\n setError('maximum', errmsg);\n return true;\n } else {\n setError('maximum', errmsg);\n }\n\n errmsg = emptyValidator('Cache value', state.cache);\n if (errmsg) {\n setError('cache', errmsg);\n return true;\n } else {\n setError('cache', errmsg);\n }\n }\n\n let min_lt = gettext('Minimum value must be less than maximum value.'),\n start_lt = gettext('Start value cannot be less than minimum value.'),\n start_gt = gettext('Start value cannot be greater than maximum value.');\n\n if (isEmptyString(minimum) || isEmptyString(maximum))\n return null;\n\n if ((minimum == 0 && maximum == 0) ||\n (parseInt(minimum, 10) >= parseInt(maximum, 10))) {\n setError('minimum', min_lt);\n return true;\n } else {\n setError('minimum', null);\n }\n\n if (start && minimum && parseInt(start) < parseInt(minimum)) {\n setError('start', start_lt);\n return true;\n } else {\n setError('start', null);\n }\n\n if (start && maximum && parseInt(start) > parseInt(maximum)) {\n setError('start', start_gt);\n return true;\n } else {\n setError('start', null);\n }\n return null;\n }", "title": "" }, { "docid": "30b49bab2dc742aec447fae766cc4342", "score": "0.53884685", "text": "function prepareStartValues() {\n\n // initial state of the start values\n my.start_values = my.start_values ? $.toDotNotation( my.start_values ) : {};\n\n // consideration of the default configuration of the target component for start values\n let config = $.clone( my.target.config );\n delete config.ccm; delete config.html; delete config.parent;\n config.css = $.encode( config.css );\n config = $.toDotNotation( config );\n config[ 'captions.finish' ] = 'Restart';\n for ( const key in config )\n if ( my.start_values[ key ] === undefined )\n my.start_values[ key ] = config[ key ];\n\n // prepare 'keywords' and 'manually' entry\n if ( Array.isArray( my.start_values.keywords ) )\n my.start_values.manually = my.start_values.keywords.join( ', ' );\n my.start_values.keywords = my.start_values.keywords ? ( my.start_values.keywords === true ? 'auto' : 'manually' ) : 'none';\n\n // prepare 'feedback' entry\n my.start_values.feedback = my.start_values.feedback ? ( my.start_values.solutions ? 'solutions' : 'correctness' ) : 'none';\n delete my.start_values.solutions;\n\n // security check for start values\n my.start_values = $.protect( my.start_values );\n\n }", "title": "" }, { "docid": "30b49bab2dc742aec447fae766cc4342", "score": "0.53884685", "text": "function prepareStartValues() {\n\n // initial state of the start values\n my.start_values = my.start_values ? $.toDotNotation( my.start_values ) : {};\n\n // consideration of the default configuration of the target component for start values\n let config = $.clone( my.target.config );\n delete config.ccm; delete config.html; delete config.parent;\n config.css = $.encode( config.css );\n config = $.toDotNotation( config );\n config[ 'captions.finish' ] = 'Restart';\n for ( const key in config )\n if ( my.start_values[ key ] === undefined )\n my.start_values[ key ] = config[ key ];\n\n // prepare 'keywords' and 'manually' entry\n if ( Array.isArray( my.start_values.keywords ) )\n my.start_values.manually = my.start_values.keywords.join( ', ' );\n my.start_values.keywords = my.start_values.keywords ? ( my.start_values.keywords === true ? 'auto' : 'manually' ) : 'none';\n\n // prepare 'feedback' entry\n my.start_values.feedback = my.start_values.feedback ? ( my.start_values.solutions ? 'solutions' : 'correctness' ) : 'none';\n delete my.start_values.solutions;\n\n // security check for start values\n my.start_values = $.protect( my.start_values );\n\n }", "title": "" }, { "docid": "85b51d2e4ccbd6734e014beba625bab0", "score": "0.53707856", "text": "_setInitialValues() {\n const that = this;\n\n that._autoScrollCoefficient = JQX.Utilities.Core.Browser.Firefox ? 4 : JQX.Utilities.Core.Browser.Edge ? 8 : 2;\n that._isMobile = JQX.Utilities.Core.isMobile;\n\n that._manuallyAddedFields = [];\n that._localizeInitialValues();\n that.$.conditionsMenu.dropDownAppendTo = that.$.container;\n that.$.conditionsMenu.dataSource = that._groupOperationDescriptions;\n\n that._valueFlat = [];\n that._lastProcessedItemInCurrentGroup = { parentId: null, id: null, position: null };\n }", "title": "" }, { "docid": "c77142b24e8c092ed7314a49d7d7d6e6", "score": "0.53687286", "text": "get is_initialised() {\n return this._initialised.getValue();\n }", "title": "" }, { "docid": "e7f3c64a09ee391b7ac39f9a3a50b832", "score": "0.5367642", "text": "_initializeProperties() {}", "title": "" }, { "docid": "a3cd13ef5bc5d2458167d10fce0957ad", "score": "0.5357828", "text": "reset() {\n this.fieldContainer.all().forEach((field) => {\n field.initialValue = field.value;\n this._validateField(field, field.value);\n });\n }", "title": "" }, { "docid": "89a51cdebaae3506c96f433c86e9b428", "score": "0.5331803", "text": "constructor(props) {\n super(props);\n this.state = {\n 'valid': true,\n 'value': props.initialValue,\n };\n\n this.onChange = this.onChange.bind(this);\n }", "title": "" }, { "docid": "6e3e0909de53b2485c15a678da951bc8", "score": "0.5325081", "text": "getInitialValues() {\n const { model } = this.props;\n\n if (!model) {\n return {};\n }\n\n let v = {};\n\n // convert Emails for redux-form\n v.emails =\n Array.isArray(model.emails) && model.emails.length > 0\n ? model.emails\n : [{}];\n\n return v;\n }", "title": "" }, { "docid": "380bfc2c455d95701187931f0ab80478", "score": "0.53012407", "text": "_setInitialValues() {\n const that = this;\n\n that._mapFieldsToMenu();\n that._localizeInitialValues();\n that.$.conditionsMenu.dropDownAppendTo = that.$.container;\n that.$.conditionsMenu.dataSource = that._groupOperationDescriptions;\n\n that._valueFlat = [];\n that._lastProcessedItemInCurrentGroup = { parentId: null, id: null, position: null };\n }", "title": "" }, { "docid": "7cf2bb695c0178ece268d206f02480ca", "score": "0.52708095", "text": "getInitialValues() {\n const { model } = this.props;\n\n if (!model) {\n return {};\n }\n\n let v = {};\n\n return v;\n }", "title": "" }, { "docid": "bb63340ae209895e1e6d77a721824282", "score": "0.5260476", "text": "function startUnitTestValidator()\n{\n var emptyObject = {};\n var obj =\n {\n badBoolOrNumber:'test',\n badString:emptyObject,\n badPointObject: { x:0, z:4 },\n badPointObjectX: { x:'test' },\n badNumberRange:15\n }\n // missing value tests\n processUnitTestFail('missing bool', validateBoolProperty, emptyObject, 'z');\n processUnitTestFail('missing number', validateNumberProperty, emptyObject, 'z');\n processUnitTestFail('missing string', validateStringProperty, emptyObject, 'z');\n processUnitTestFail('missing point', validatePointObject, emptyObject, 'z');\n processUnitTestFail('missing array', validateArrayProperty, emptyObject, 'z');\n processUnitTestFail('missing media', validateMediaFile, emptyObject, 'z');\n processUnitTestFail('missing font', validateFontFile, emptyObject, 'z');\n\n // bad values tests\n processUnitTestFail('bad bool', validateBoolProperty, obj, 'badBoolOrNumber');\n processUnitTestFail('bad number', validateNumberProperty, obj, 'badBoolOrNumber');\n processUnitTestFail('bad bool', validateStringProperty, obj, 'badString');\n processUnitTestFail('bad point', validatePointObject, obj, 'badPointObject');\n processUnitTestFail('bad pointX', validatePointObject, obj, 'badPointObjectX');\n processUnitTestFail('bad range (low)', validateNumberProperty, obj, 'badNumberRange', false, 0, 14);\n processUnitTestFail('bad range (high)', validateNumberProperty, obj, 'badNumberRange', false, 16, 20);\n}", "title": "" }, { "docid": "9aa5db778d66ef99babc10332cce4981", "score": "0.52463293", "text": "function initInputValues() {\n hideMsgErr();\n $timeout(function () {\n ctrl.minMaxModel.minModel = '' + lastValues.input.min;\n ctrl.minMaxModel.maxModel = '' + lastValues.input.max;\n });\n\n //filterToApply = [lastValues.input.min, lastValues.input.max];\n }", "title": "" }, { "docid": "2bde4247dc84f5b1c6c55ce2fe584a26", "score": "0.52430135", "text": "_invalidateProperties() {\n this.__isInvalid = true;\n super._invalidateProperties();\n }", "title": "" }, { "docid": "4f6dc1d9671972850fd51a36d2ae3606", "score": "0.5234881", "text": "forceValidate() {\n this.setValue(this.getValue());\n }", "title": "" }, { "docid": "e5fa386a5bc4bd76a4cb88666c023c97", "score": "0.52334297", "text": "get validity() {\n if (!this._validity) {\n const state = {\n valueMissing: () => {\n if (!this.hasAttributeNS(null, \"required\")) {\n return false;\n }\n const selectedOptionIndex = this.selectedIndex;\n return selectedOptionIndex < 0 || (selectedOptionIndex === 0 && this._hasPlaceholderOption);\n }\n };\n\n this._validity = ValidityState.createImpl(this._globalObject, [], {\n element: this,\n state\n });\n }\n return this._validity;\n }", "title": "" }, { "docid": "2cb0683e8db99311cccdbadc0faac89d", "score": "0.52226454", "text": "initializeInputs() {\n this.componentFactory.inputs.forEach(({ propName, transform }) => {\n if (this.initialInputValues.has(propName)) {\n // Call `setInputValue()` now that the component has been instantiated to update its\n // properties and fire `ngOnChanges()`.\n this.setInputValue(propName, this.initialInputValues.get(propName), transform);\n }\n });\n this.initialInputValues.clear();\n }", "title": "" }, { "docid": "64b24e0093a59ca24a8d56bef9bf1415", "score": "0.5189989", "text": "_minOrMaxChanged() {\n // var min, max;\n //check that min is less than max\n if(this.min === this.max) {\n this.set('_minMaxValid', 0);\n console.warn(\"Improper configuration: min and max are the same. Increasing max by step size.\");\n this.set('max', this.min + this.step);\n return;\n }\n\n if(this.min > this.max) {\n this.set('_minMaxValid', 0);\n console.warn(\"Improper configuration: min and max are reversed. Swapping them.\");\n var temp = this.min;\n this.set('min', this.max);\n this.set('max', temp);\n return;\n }\n this.setAttribute('aria-valuemin', this.min);\n this.setAttribute('aria-valuemax', this.max);\n\n // validation passes: trigger set domain\n // apparently, it is possible to run this before polymer property defaults can be applied, so check that _minMaxValid is defined\n this.set('_minMaxValid', (this._minMaxValid || 0) + 1);\n }", "title": "" }, { "docid": "7ccf1ae95ada64d441beb8862838f60a", "score": "0.51844484", "text": "validateProps() {\n validateProps(this.props);\n }", "title": "" }, { "docid": "f8a543c354448e979c7df04b6a24f01f", "score": "0.5183849", "text": "validateRequired(propValue, value) {\n return !(propValue && _isEmpty(value));\n }", "title": "" }, { "docid": "59cae7fc1aebb80528c8f8bcd2dcf162", "score": "0.51791376", "text": "function InitialiseValidationAttributes() {\n\n $.validator.setDefaults({\n ignore: []\n });\n\n Adddatemustbeequalorlessthancurrentdate();\n Adddatemustbeovertenyearsago();\n Addrequiredif();\n Addrequiredifdictionaryentry();\n}", "title": "" }, { "docid": "320492d46a4dac6131b465d33c66114b", "score": "0.517801", "text": "requiredFields(){\n // get all the keys in the state\n let keys = Object.keys(this.state);\n // intialize the variable as false\n let emptyFields = false;\n // loop through all the keys and check the value in state to see if any of them are empty strings, if empty then set variable to true\n keys.forEach((key) => {\n if(this.state[key] === ''){\n emptyFields = true;\n }\n })\n return emptyFields;\n }", "title": "" }, { "docid": "290e579bdf9413c40507f0ab60049e4e", "score": "0.5161423", "text": "validate(values) {\n let errors = {}\n if (!values.title) {\n errors.title = 'Enter title'\n } else if (values.title.length < 2) {\n errors.title = 'Title must be at least 2 characters in length'\n }\n\n if (!values.directions) {\n errors.directions = 'Enter directions'\n } else if (values.directions.length < 5) {\n errors.directions = 'Directions must be at least 5 characters in length'\n }\n\n if (!values.ingredients) {\n errors.ingredients = 'Enter ingredients'\n } else if (values.ingredients.length < 2) {\n errors.ingredients = 'Ingredients must be at least 2 characters in length'\n }\n\n if (values.mealType === \"selectOne\") {\n errors.mealType = 'Select a meal type'\n }\n\n return errors\n }", "title": "" }, { "docid": "b98216823a4a10e88514a63269db7aac", "score": "0.5159481", "text": "preValidate() { }", "title": "" }, { "docid": "f69be0218379e6d4cc14961ef67df003", "score": "0.51582247", "text": "function CfnApplication_AutoStartConfigurationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('enabled', cdk.validateBoolean)(properties.enabled));\n return errors.wrap('supplied properties not correct for \"AutoStartConfigurationProperty\"');\n}", "title": "" }, { "docid": "4e725a6ba91158c00cff2c4cbbd8c8ce", "score": "0.51541096", "text": "function _initFields(scope, obj, isFromDB) {\n\t\tvar i,\n\t\t\tfield,\n\t\t\tinitValue;\n\n\t\tfor (i = 0; i < _configData.length; i = i + 1) {\n\t\t\tfield = _configData[i];\n\t\t\tinitValue = undefined;\n\t\t\tif (obj) {\n\t\t\t\tif (typeof obj !== \"object\") {\n\t\t\t\t\tAssert.require(_isPrimitiveType, \"PropertyBase - Sanity check failed: argument passed is not an object and there is more than one field: \" +\n\t\t\t\t\t\t\"field name: \" + field.dbFieldName +\n\t\t\t\t\t\t\" OBJ: \" + JSON.stringify(obj) +\n\t\t\t\t\t\t\" isPrimitiveType: \" + _isPrimitiveType +\n\t\t\t\t\t\t\" config length: \" + _configData.length);\n\n\t\t\t\t\tinitValue = obj;\n\t\t\t\t} else if (undefined !== obj[field.dbFieldName]) {\n\t\t\t\t\tinitValue = obj[field.dbFieldName];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// only setting the default when no raw object has been passed\n\t\t\t// We should only do this on new objects. We don't want to start setting defaults\n\t\t\t// on an object that came down from a sync source because we will send that change back up\n\t\t\t//\n\t\t\t// Do not set a default value if this object is being constructed from a DB object\n\t\t\t//\n\t\t\t// The caller needs to have an undefined check\n\t\t\tif (!isFromDB && undefined === initValue && undefined !== field.defaultValue) {\n\t\t\t\tinitValue = field.defaultValue;\n\t\t\t}\n\n\t\t\tif (field.classObject) {\n\t\t\t\tinitValue = new field.classObject(initValue);\n\t\t\t}\n\n\t\t\tif (undefined !== initValue) {\n\t\t\t\tscope[field.setterName].apply(scope, [initValue, true]);\n\t\t\t}\n\t\t}\n\t}", "title": "" }, { "docid": "75d1a59053b324ee852665bd856cfc5e", "score": "0.5140961", "text": "function validateRequired() {\n fieldCouplesArray.forEach(function (inputCouple) {\n if (inputCouple[0].value === \"\" && inputCouple[1].value !== \"\") {\n inputCouple[0].required = true;\n } else if\n (inputCouple[0].value !== \"\" && inputCouple[1].value === \"\") {\n inputCouple[1].required = true;\n } else {\n inputCouple[0].required = false;\n inputCouple[1].required = false;\n }\n })\n }", "title": "" }, { "docid": "78e540de7f251fbdfb13b82e46eae693", "score": "0.5136957", "text": "function setInitialValues() {\n // you can decide on some initial values\n principle = 120;\n interest = .1;\n loanYears = 1;\n document.getElementById(\"loan-amount\").value = principle;\n document.getElementById(\"loan-rate\").value = interest;\n document.getElementById(\"loan-years\").value = loanYears;\n \n}", "title": "" }, { "docid": "3bbd2896c62309ad39e21952083cd79c", "score": "0.51321137", "text": "function CfnIPSetPropsValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('activate', cdk.requiredValidator)(properties.activate));\n errors.collect(cdk.propertyValidator('activate', cdk.validateBoolean)(properties.activate));\n errors.collect(cdk.propertyValidator('detectorId', cdk.requiredValidator)(properties.detectorId));\n errors.collect(cdk.propertyValidator('detectorId', cdk.validateString)(properties.detectorId));\n errors.collect(cdk.propertyValidator('format', cdk.requiredValidator)(properties.format));\n errors.collect(cdk.propertyValidator('format', cdk.validateString)(properties.format));\n errors.collect(cdk.propertyValidator('location', cdk.requiredValidator)(properties.location));\n errors.collect(cdk.propertyValidator('location', cdk.validateString)(properties.location));\n errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));\n return errors.wrap('supplied properties not correct for \"CfnIPSetProps\"');\n}", "title": "" }, { "docid": "e31aea2c8ed18cbe4be053754d5a986c", "score": "0.51188374", "text": "function checkInputLengths() {\n return (\n nameInput.value.length === 0 ||\n emailInput.value.length === 0 ||\n dobInput.value.length === 0 ||\n stateInput.value.length === 0\n );\n }", "title": "" }, { "docid": "aecaef0f80f7154a9040f7464f449781", "score": "0.5118804", "text": "_validateAttributes(values = {}) {\n const { attributes } = this.constructor;\n // check changed values\n const changes = this.changes();\n let changedValues = {};\n for (const key in changes) {\n if (changes[key].length === 2) {\n changedValues[key] = changes[key][1];\n }\n }\n\n // merge all changed values\n changedValues = Object.assign(changedValues, values);\n\n for (const valueKey in changedValues) {\n const attribute = attributes[valueKey];\n if (!attribute) continue;\n const { validate = {}, name, allowNull, defaultValue } = attribute;\n const value = changedValues[valueKey];\n if (value == null && defaultValue == null) {\n if (allowNull === false) throw new LeoricValidateError('notNull', name);\n if ((allowNull === true || allowNull === undefined) && validate.notNull === undefined ) return;\n }\n if (!validate) return;\n for (const key in validate) {\n if (validate.hasOwnProperty(key)) executeValidator(this, key, attribute, value);\n }\n }\n }", "title": "" }, { "docid": "e746558e288f18c71391ebaab788a0d8", "score": "0.5117165", "text": "function FunctionResource_EnvironmentPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n errors.collect(cdk.propertyValidator('variables', cdk.hashValidator(cdk.validateString))(properties.variables));\n return errors.wrap('supplied properties not correct for \"EnvironmentProperty\"');\n }", "title": "" }, { "docid": "5145d9bfb0d76d2eac3e471f25f1eb07", "score": "0.5116053", "text": "_validate(initialValidation, programmaticValue, keyCode) {\n const that = this,\n oldValue = that.value;\n\n that._validateValue(programmaticValue);\n\n if (keyCode && (keyCode === 35 || keyCode === 36)) {\n that._animate(oldValue);\n }\n else {\n that._updatePointer();\n }\n }", "title": "" }, { "docid": "6bb1069f5fb9e672ace2788a2654571d", "score": "0.51120216", "text": "function initialValues() {\n document.querySelector(\"#rangeRed\").value = 0;\n document.querySelector(\"#rangeGreen\").value = 0;\n document.querySelector(\"#rangeBlue\").value = 0;\n document.querySelector(\"#rangeHue\").value = 0;\n document.querySelector(\"#rangeSaturation\").value = 0;\n document.querySelector(\"#rangeLightness\").value = 0;\n}", "title": "" }, { "docid": "45274928463afd5c02c16e2c1dc75b34", "score": "0.5105946", "text": "function requiredValidator() {\n if (this.definition.optional) return;\n\n // We can skip the required check for keys that are ancestors\n // of those in $set or $setOnInsert because they will be created\n // by MongoDB while setting.\n const setKeys = Object.keys(this.obj.$set || {}).concat(Object.keys(this.obj.$setOnInsert || {}));\n const willBeCreatedAutomatically = _.some(setKeys, sk => (sk.slice(0, this.key.length + 1) === `${this.key}.`));\n if (willBeCreatedAutomatically) return;\n\n if (\n this.value === null ||\n this.operator === '$unset' ||\n this.operator === '$rename' ||\n (\n this.value === undefined &&\n (\n this.isInArrayItemObject ||\n this.isInSubObject ||\n !this.operator ||\n this.operator === '$set'\n )\n )\n ) {\n return SimpleSchema.ErrorTypes.REQUIRED;\n }\n}", "title": "" }, { "docid": "8afad2d710c89630abec601dfe320012", "score": "0.5096412", "text": "constructor() {\n this.allowFunctions = new ValidationRule();\n this.allowConstants = new ValidationRule();\n this.allowVariables = new ValidationRule();\n\n // this.acceptMathOperations = new ValidationRule();\n this.acceptEquations = new ValidationRule();\n this.acceptInequalities = new ValidationRule();\n this.acceptSequenceOfStatements = new ValidationRule();\n this.acceptEmpty = new ValidationRule();\n this.acceptOnlyNumber = new ValidationRule();\n\n this.valueOnlyFinite = new ValidationRule();\n this.valueOnlyInteger = new ValidationRule();\n this.valueRange = new ValidationRule();\n this.valueOnlyGreaterThan = new ValidationRule();\n this.valueOnlyLessThan = new ValidationRule();\n }", "title": "" }, { "docid": "7c349aa388b37491926535bc7f75bf78", "score": "0.5094367", "text": "shouldSetInputTextToDefaultValue (props) {\n let result = (this.previousDefaultValue != props.defaultValue) || (this.previousChangeIndicator != props.changeIndicator)\n return result\n }", "title": "" }, { "docid": "be8abb1c48f755cb3c2c955288523524", "score": "0.50883526", "text": "_emptyProp (propName) {\n return !this[propName] || (typeof this[propName] === 'object' && Object.keys(this[propName]).length === 0)\n }", "title": "" }, { "docid": "aadf9ec63fee357ce5317c5b4964a24a", "score": "0.5081051", "text": "allValid() {\n return (this.state.description.length > 0 &&\n this.state.title.length > 0 && this.state.time.length > 0)\n }", "title": "" }, { "docid": "7ee7e32da1e06c6c2d9348bfa2d663eb", "score": "0.5076824", "text": "function CfnCanaryPropsValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n errors.collect(cdk.propertyValidator('artifactS3Location', cdk.requiredValidator)(properties.artifactS3Location));\n errors.collect(cdk.propertyValidator('artifactS3Location', cdk.validateString)(properties.artifactS3Location));\n errors.collect(cdk.propertyValidator('code', cdk.requiredValidator)(properties.code));\n errors.collect(cdk.propertyValidator('code', CfnCanary_CodePropertyValidator)(properties.code));\n errors.collect(cdk.propertyValidator('executionRoleArn', cdk.requiredValidator)(properties.executionRoleArn));\n errors.collect(cdk.propertyValidator('executionRoleArn', cdk.validateString)(properties.executionRoleArn));\n errors.collect(cdk.propertyValidator('failureRetentionPeriod', cdk.validateNumber)(properties.failureRetentionPeriod));\n errors.collect(cdk.propertyValidator('name', cdk.requiredValidator)(properties.name));\n errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));\n errors.collect(cdk.propertyValidator('runConfig', CfnCanary_RunConfigPropertyValidator)(properties.runConfig));\n errors.collect(cdk.propertyValidator('runtimeVersion', cdk.requiredValidator)(properties.runtimeVersion));\n errors.collect(cdk.propertyValidator('runtimeVersion', cdk.validateString)(properties.runtimeVersion));\n errors.collect(cdk.propertyValidator('schedule', cdk.requiredValidator)(properties.schedule));\n errors.collect(cdk.propertyValidator('schedule', CfnCanary_SchedulePropertyValidator)(properties.schedule));\n errors.collect(cdk.propertyValidator('startCanaryAfterCreation', cdk.requiredValidator)(properties.startCanaryAfterCreation));\n errors.collect(cdk.propertyValidator('startCanaryAfterCreation', cdk.validateBoolean)(properties.startCanaryAfterCreation));\n errors.collect(cdk.propertyValidator('successRetentionPeriod', cdk.validateNumber)(properties.successRetentionPeriod));\n errors.collect(cdk.propertyValidator('tags', cdk.listValidator(cdk.validateCfnTag))(properties.tags));\n errors.collect(cdk.propertyValidator('vpcConfig', CfnCanary_VPCConfigPropertyValidator)(properties.vpcConfig));\n return errors.wrap('supplied properties not correct for \"CfnCanaryProps\"');\n}", "title": "" }, { "docid": "ca95ad33e6d42ac6ff029fac5cfbc3eb", "score": "0.5070947", "text": "validateInputs(){\r\n if(this.state.brand === \"\" || this.state.plates === \"\" || (this.state.year===\"\" || isNaN(this.state.year)) || this.state.currentState===\"\" || this.state.model===\"\" || this.state.type===\"\" || this.state.color===\"\" || this.state.niv===\"\" || this.state.gasoline===\"\" || this.state.circulation===\"\"){\r\n return false;\r\n\r\n }\r\n else{\r\n return true;\r\n }\r\n }", "title": "" }, { "docid": "7fdae78721e6ae97f73e9b2ca2f66423", "score": "0.50699127", "text": "function initFieldState(key, props) {\n let result = {\n value: \"\",\n name: key,\n helper_text: \"\",\n error: false,\n validator: {\n validate_on_change: false,\n validate_on_blur: true,\n required: true,\n pattern: null,\n type: undefined,\n oneOf: undefined,\n oneOfEqual: undefined,\n },\n };\n\n let pattern = _.get(props, \"validator.pattern\");\n\n if (pattern) {\n props.validator.pattern = JSON.stringify({ rgx: pattern.source });\n }\n\n return _.merge(result, props)\n}", "title": "" }, { "docid": "a38c5c0d6f2e71065f3bd35557d21452", "score": "0.50678617", "text": "function CfnWebACL_DefaultActionPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('allow', CfnWebACL_AllowActionPropertyValidator)(properties.allow));\n errors.collect(cdk.propertyValidator('block', CfnWebACL_BlockActionPropertyValidator)(properties.block));\n return errors.wrap('supplied properties not correct for \"DefaultActionProperty\"');\n}", "title": "" }, { "docid": "f836d88be18f0ab73e456602d5c7eb72", "score": "0.5057759", "text": "function startWatch() {\r\n //if there's not already a watch\r\n if (!watcher) {\r\n watcher = scope.$watch(\"property.value\", function (newValue, oldValue) {\r\n \r\n if (!newValue || angular.equals(newValue, oldValue)) {\r\n return;\r\n }\r\n\r\n var errCount = 0;\r\n for (var e in formCtrl.$error) {\r\n if (angular.isArray(formCtrl.$error[e])) {\r\n errCount++;\r\n }\r\n }\r\n\r\n //we are explicitly checking for valServer errors here, since we shouldn't auto clear\r\n // based on other errors. We'll also check if there's no other validation errors apart from valPropertyMsg, if valPropertyMsg\r\n // is the only one, then we'll clear.\r\n\r\n if ((errCount === 1 && angular.isArray(formCtrl.$error.valPropertyMsg)) || (formCtrl.$invalid && angular.isArray(formCtrl.$error.valServer))) {\r\n scope.errorMsg = \"\";\r\n formCtrl.$setValidity('valPropertyMsg', true);\r\n stopWatch();\r\n }\r\n }, true);\r\n }\r\n }", "title": "" }, { "docid": "24c776c6656f63b82aef8813867ce0e4", "score": "0.5031491", "text": "function CfnAlarmModel_AssetPropertyValuePropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('quality', cdk.validateString)(properties.quality));\n errors.collect(cdk.propertyValidator('timestamp', CfnAlarmModel_AssetPropertyTimestampPropertyValidator)(properties.timestamp));\n errors.collect(cdk.propertyValidator('value', cdk.requiredValidator)(properties.value));\n errors.collect(cdk.propertyValidator('value', CfnAlarmModel_AssetPropertyVariantPropertyValidator)(properties.value));\n return errors.wrap('supplied properties not correct for \"AssetPropertyValueProperty\"');\n}", "title": "" }, { "docid": "989cee8e98ff7119bb6738b639d577ef", "score": "0.50298655", "text": "function setupInitialValues() {\n calculateMonthlyPayment(UIValues);\n updateUI();\n}", "title": "" }, { "docid": "282c6e640c31987e694c18b96dd50944", "score": "0.5028252", "text": "function CfnAssetModel_AttributePropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('defaultValue', cdk.validateString)(properties.defaultValue));\n return errors.wrap('supplied properties not correct for \"AttributeProperty\"');\n}", "title": "" }, { "docid": "b5c31a9b821d3b37caa96dbf9907cd6e", "score": "0.50204134", "text": "function checkRequired(values, keys) {\n var i, undef = [];\n for (i = 0; i < keys.length; ++i) {\n if (!values[keys[i]]) {\n undef.push(keys[i]);\n }\n } \n if (undef.length > 0) {\n throw new Error('Please define these values in nuxeo.conf: ' + undef.join(', '));\n }\n}", "title": "" }, { "docid": "d10679366b8022eb49d112eab3911990", "score": "0.50181985", "text": "function GetInitialValue()\n{\n\treturn m_initialValue;\n}", "title": "" }, { "docid": "64177db99f653d90befdec24236f8deb", "score": "0.50176007", "text": "function validateProps(element,props){// TODO (yungsters): Remove support for `selected` in <option>.\n{if(props.selected!=null&&!didWarnSelectedSetOnOption){warning(false,'Use the `defaultValue` or `value` props on <select> instead of '+'setting `selected` on <option>.');didWarnSelectedSetOnOption=true;}}}", "title": "" }, { "docid": "64177db99f653d90befdec24236f8deb", "score": "0.50176007", "text": "function validateProps(element,props){// TODO (yungsters): Remove support for `selected` in <option>.\n{if(props.selected!=null&&!didWarnSelectedSetOnOption){warning(false,'Use the `defaultValue` or `value` props on <select> instead of '+'setting `selected` on <option>.');didWarnSelectedSetOnOption=true;}}}", "title": "" }, { "docid": "bf15f7881c4b78f5a668b1528680b066", "score": "0.5009704", "text": "function CfnScalingPolicy_StepAdjustmentPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('metricIntervalLowerBound', cdk.validateNumber)(properties.metricIntervalLowerBound));\n errors.collect(cdk.propertyValidator('metricIntervalUpperBound', cdk.validateNumber)(properties.metricIntervalUpperBound));\n errors.collect(cdk.propertyValidator('scalingAdjustment', cdk.requiredValidator)(properties.scalingAdjustment));\n errors.collect(cdk.propertyValidator('scalingAdjustment', cdk.validateNumber)(properties.scalingAdjustment));\n return errors.wrap('supplied properties not correct for \"StepAdjustmentProperty\"');\n}", "title": "" }, { "docid": "c1d145ae44e48a8946ebc081a1b884a4", "score": "0.500787", "text": "init() {\n super.init();\n if ((this.elementDesc.options || {}).type === 'number' && (this.elementDesc.options || {}).step) {\n this.$inputNode.attr('step', this.elementDesc.options.step);\n }\n const defaultValue = (this.elementDesc.options || {}).type === 'number' ? '0' : '';\n const defaultText = this.getStoredValue(defaultValue);\n this.previousValue = defaultText;\n this.$inputNode.property('value', defaultText);\n if (this.hasStoredValue()) {\n this.fire(FormInputText.EVENT_INITIAL_VALUE, defaultText, defaultValue);\n }\n this.handleDependent();\n // propagate change action with the data of the selected option\n this.$inputNode.on('change.propagate', () => {\n this.fire(FormInputText.EVENT_CHANGE, this.value, this.$inputNode);\n });\n }", "title": "" }, { "docid": "7e2732af28871764d7ac16fab1f436b8", "score": "0.50073224", "text": "function defaultCheckValidity() {\n\t\tvar el = this;\n\n\t\tcheckAttribute(el, 'required');\n\t\tcheckAttribute(el, 'pattern');\n\t\tcheckAttribute(el, 'maxlength');\n\n\t\treturn el.validity.valueMissing && el.validity.patternMismatch && el.validity.tooLong;\n\t}", "title": "" }, { "docid": "bdf208f82e11f0604d8ef06bbc5bee4a", "score": "0.4998764", "text": "function handleEmtpyValue(defaultMsg){\n if(oSetting.defaultIfEmpty && !currentElem.val()){\n currentElem.val(oSetting.defaultIfEmpty);\n return;\n }\n\n //set default value if it exist\n if(oSetting.defaultValue){\n currentElem.val(oSetting.defaultValue);\n return;\n }\n\n currentElem.addClass(oParams.errorInputCssClass);\n\n if(!oSetting.errorMsg){\n oSetting.errorMsg= defaultMsg;\n }\n oErrors=oErrors+(oSetting.errorMsg);\n allTrue=false;\n if(!firstErrorElem){\n firstErrorElem = oSetting.selector;\n }\n }", "title": "" }, { "docid": "1b55a744b30f5f28c712426fad95130d", "score": "0.49952105", "text": "function isEmptyProperties( props ) {\n for (var k in props) {\n if (!props.hasOwnProperty(k)) {\n continue;\n }\n return false;\n }\n return true;\n}", "title": "" }, { "docid": "fc06f5b3a7de0793fa35412837231a49", "score": "0.49929315", "text": "checkValidity() {\n this.validState = this.currentDataState.name && \n +this.currentDataState.amount && +this.currentDataState.maximumRides;\n }", "title": "" }, { "docid": "92e8fa53668358c839afc3fd6994f7a1", "score": "0.49915543", "text": "function validates() {\n if(this.isRoot()) {\n return true; \n }else if(this.value === undefined && !this.rule.required) {\n return false;\n }\n return this.rule.required\n || (!this.rule.required && this.source.hasOwnProperty(this.field));\n}", "title": "" }, { "docid": "b143db94a3ff845fd6c990ddba120f8e", "score": "0.4990948", "text": "function saveInitialValues() {\n\t//Iterate through all inputs, selects and textareas\n\t$$('#'+standardPrefix+'FormContents input,#'+standardPrefix+'FormContents select,#'+standardPrefix+'FormContents textarea').each(function(el) {\n\t\t//Check that change tracking is not disabled for this element\n\t\tif(!el.hasClass('noChangeTrack'))\n\t\t\tel.store('initialValue',el.value);\n\t});\t\n}", "title": "" }, { "docid": "97af7a1b67aa607094a9bb88c41d8ffa", "score": "0.49907005", "text": "function CfnDetectorModel_AssetPropertyValuePropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('quality', cdk.validateString)(properties.quality));\n errors.collect(cdk.propertyValidator('timestamp', CfnDetectorModel_AssetPropertyTimestampPropertyValidator)(properties.timestamp));\n errors.collect(cdk.propertyValidator('value', cdk.requiredValidator)(properties.value));\n errors.collect(cdk.propertyValidator('value', CfnDetectorModel_AssetPropertyVariantPropertyValidator)(properties.value));\n return errors.wrap('supplied properties not correct for \"AssetPropertyValueProperty\"');\n}", "title": "" }, { "docid": "b22ad9e3a531cb125a198992b6196702", "score": "0.49886566", "text": "function initValues(){\n}", "title": "" }, { "docid": "57390b2e07ad69588c2d3cccd886a995", "score": "0.49857464", "text": "handleEmptyValue() {\n if (!this.get('value') || this.get('value') === '') {\n this.set('value', 'Empty');\n }\n }", "title": "" }, { "docid": "a3d5de2c4ddbf2ca617eb42e689b7731", "score": "0.49836904", "text": "function PasswordValidator() {\n // Initialize a schema with no properties defined\n this.properties = [];\n}", "title": "" }, { "docid": "61ae99765829896fc173c834e8bd5304", "score": "0.49769795", "text": "validate() {\n if (this.maxLimit !== undefined && this.value > this.maxLimit)\n this._value = this.maxLimit;\n else if (this.minLimit !== undefined && this.value < this.minLimit)\n this._value = this.minLimit;\n }", "title": "" }, { "docid": "99a5b4dfe9ab07bfa2e55b139fb63f8e", "score": "0.49767706", "text": "function _validateDefaultSelectionValues(selected) {\n return _.filter(selected, function(elem) {\n return ( !_.isEmpty(elem.values) && !_.isUndefined(elem.values) );\n });\n }", "title": "" }, { "docid": "6f0f4632a6ec6aed780209c07288d2b4", "score": "0.49767354", "text": "function CfnAlarmModel_AssetPropertyVariantPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('booleanValue', cdk.validateString)(properties.booleanValue));\n errors.collect(cdk.propertyValidator('doubleValue', cdk.validateString)(properties.doubleValue));\n errors.collect(cdk.propertyValidator('integerValue', cdk.validateString)(properties.integerValue));\n errors.collect(cdk.propertyValidator('stringValue', cdk.validateString)(properties.stringValue));\n return errors.wrap('supplied properties not correct for \"AssetPropertyVariantProperty\"');\n}", "title": "" }, { "docid": "ee28f50648313b80564cac6ece5d3bd6", "score": "0.49681142", "text": "function validate(props, required) {\r\n var safeProps = {};\r\n\r\n for (var prop in User.VALIDATION_INFO) {\r\n var val = props[prop];\r\n validateProp(prop, val, required);\r\n safeProps[prop] = val;\r\n }\r\n\r\n return safeProps;\r\n}", "title": "" }, { "docid": "67a667ac18faba152ad7dd11e697331a", "score": "0.49664384", "text": "function validate() {\n if (!$scope.id.length || !$scope.pass.length || !$scope.name.length || !$scope.group.length ||\n !$scope.email.length || !$scope.phone.length || !$scope.workplace.length || !($scope.informed.email.length || \n $scope.informed.facebook.length || $scope.informed.webSite.length || $scope.informed.colleague.length || \n $scope.informed.other.length) || !($scope.population.elementary.length || \n $scope.population.highSchool.length || $scope.population.higherEducation.length || $scope.population.other.length)) {\n $scope.emptyData = true;\n } else { // Habilita\n $scope.emptyData = false;\n }\n }", "title": "" }, { "docid": "38c6fa92e603ce19c34975075123028c", "score": "0.4963217", "text": "function dirtyManualFields() {\n\tvar len = fieldsToCheck.length;\n\tvar element;\n\tfor (var i=0; i<len; ++i) {\n\t\tid = fieldsToCheck[i];\n\t\telement = '#' + id;\n\t\tif($(element).val() != $(element).data('initial_value')) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}", "title": "" } ]
67241218ebdce25d12628a4e431f78fa
Sketch action. Everytime a user makes a new selection this will be called.
[ { "docid": "a086d857c1ed6168c0db4339eecf32ba", "score": "0.6145345", "text": "function SelectionChanged(context) {\n threadDictionary.selectedLayers = context.actionContext.newSelection; // save the new selection in a global plugin variable\n}", "title": "" } ]
[ { "docid": "b4e34c4741ad5f28cb7d6c0b2fb6f603", "score": "0.67197746", "text": "function SelectionChange() { }", "title": "" }, { "docid": "d28e51df4b143a038b96682c78adc622", "score": "0.6610137", "text": "_onSelect() {\n this.handler.selectPoints(this._currentSelectionPoints);\n }", "title": "" }, { "docid": "f5051d8098c6efc38f872c20254cd2e0", "score": "0.6589503", "text": "function handleSelection() {\n\n}", "title": "" }, { "docid": "1c6f055e10eadc4b294b613c5ea09f61", "score": "0.6556427", "text": "_setSelection(figure){\n selected = figure;\n this.emit(constants.SELECTION_CHANGED);\n this._setHints();\n }", "title": "" }, { "docid": "35358805fc272207a4ac8b310ed63b4a", "score": "0.6489483", "text": "function drawSelectionChanged() {\n drawType = drawSelector.value();\n setImage();\n}", "title": "" }, { "docid": "3cbb481ed47909fd4b87449344524a23", "score": "0.6344031", "text": "selectionChanged() {}", "title": "" }, { "docid": "471830c1293a5ca739a37865ada9dadc", "score": "0.6293863", "text": "function selection() {}", "title": "" }, { "docid": "6cc1656f7f5ef36e426574d1754d6a8f", "score": "0.6267159", "text": "function on_piece_select()\n{\n\tupdate_editor();\n}", "title": "" }, { "docid": "31d8bd2e345a53bc28ca495b1ff45a8f", "score": "0.6184656", "text": "function initSelection() {\n canvas.on({\n \"selection:created\": function __listenersSelectionCreated() {\n global.console.log(\"**** selection:created\");\n setActiveObject();\n toolbar.showActiveTools();\n },\n \"before:selection:cleared\": function __listenersBeforeSelectionCleared() {\n global.console.log(\"**** before:selection:cleared\");\n },\n \"selection:cleared\": function __listenersSelectionCleared() {\n global.console.log(\"**** selection:cleared\");\n toolbar.hideActiveTools();\n },\n \"selection:updated\": function __listenersSelectionUpdated() {\n global.console.log(\"**** selection:updated\");\n setActiveObject();\n toolbar.showActiveTools();\n },\n });\n}", "title": "" }, { "docid": "c4baa9a7192ac895298230792433e434", "score": "0.613787", "text": "function onSelect() {\n if (this.inspector.locked) {\n this.cssLogic.highlight(this.inspector.selection);\n this.undim();\n this.update();\n // We make sure we never add 2 listeners.\n if (!this.trackingPaint) {\n this.browser.addEventListener(\"MozAfterPaint\", this.update, true);\n this.trackingPaint = true;\n }\n }\n }", "title": "" }, { "docid": "f3a162fd8abab06fec68aa3b0c1cc4a2", "score": "0.6135298", "text": "function updateSelection() {\n var selectionTool = $('#shapeSelect');\n var selectionToolValue = selectionTool.val();\n if (!(selectionToolValue === 'Selection')) {\n document.getElementById('delete').disabled = true;\n selectedShape.selected = false;\n render();\n }\n}", "title": "" }, { "docid": "602ed36042593e63a82c34dcec169d2a", "score": "0.6114755", "text": "function selectFigure(select) {\n selected=select.value; \n console_area.value+=\"Figure selected \"+selected+\"\\n\";\n}", "title": "" }, { "docid": "0d1dc2e987a6d08ace761402e86a21b9", "score": "0.60646385", "text": "function draw() {\n // if the mosue is pressed. Current tool will start drawing. \n if (mouseIsPressed)\n {\n currentTool.draw()\n }\n // updating stroke size for the front End in Html\n updateStrokeSizeHTML();\n \n}", "title": "" }, { "docid": "e2befbd561f33952237ead5a7eacda57", "score": "0.6063383", "text": "setSelected() {\n this._selected = true;\n super.stroke('yellow');\n }", "title": "" }, { "docid": "47934b2c60c70df19e6a7fda518e34a5", "score": "0.60548264", "text": "function snappviz_selectionchange(selectiontype_obj) {\r\n //alert(\"Selection Changed - \" + $('#selectiontype').val());\r\n document.applets[0].appletController(\"selection\", jQuery('#selectiontype').val(), \"\", \"\");\r\n}", "title": "" }, { "docid": "f231b34c72a36d8835cbf7de9fd634ed", "score": "0.6026599", "text": "function draw() {\n\tif (clicked === true) {\n\t\tvar current_color = $('#selected-color.swatch').css('background-color');\n\t\t$(this).css('background-color', current_color);\n\t}\n}", "title": "" }, { "docid": "d91aa1d9837028b6b2dc96b57d59053f", "score": "0.59398574", "text": "function mySelectedEvent(){ //anonymous function to deal with selection event\n\n // this.elt.id: caller selector(link from)\n // this.elt.value: selected option value from that selector (linked to)\n var caller = this.elt.id\n var callee = this.elt.value.slice(-1) //\"module3\" etc. get the last character - linked module\n\n //console.log(\"linked from: \", caller, \" linked to: \", callee)\n _this.mySavedSketch[caller].linkedTo = callee //etc. caller(later) is linked to option\n _this.mySavedSketch[callee].linkedFrom = caller //caller, linked each other\n\n //match gear size and motorType\n _this.mySavedSketch[caller].servoAngle = _this.mySavedSketch[callee].servoAngle\n _this.mySavedSketch[caller].gearSize = _this.mySavedSketch[callee].gearSize\n\n //this is for same modules are attached\n if(_this.mySavedSketch[caller].module == _this.mySavedSketch[callee].module){\n _this.mySavedSketch[caller].x = 67 //this should be parents' gear size\n _this.mySavedSketch[caller].y = -47 //default is attach right, so only need 'x' mvmt info\n\n //this is for wing -> flower\n } else if ((_this.mySavedSketch[caller].module == 3) && (_this.mySavedSketch[callee].module == 1)){\n _this.mySavedSketch[caller].x = 200\n _this.mySavedSketch[caller].y = 62\n\n } else if ((_this.mySavedSketch[caller].module == 1) && (_this.mySavedSketch[callee].module == 3)){\n _this.mySavedSketch[caller].x = 67\n _this.mySavedSketch[caller].y = -170\n }\n //this is for wing -> flower\n\n if(!_this.linked){\n _this.selectDriver.attribute('id', 0).option('Module '+caller +' to '+callee) //add each other\n _this.selectDriver.attribute('id', 1).option('Module '+callee+' to '+caller)\n }\n\n _this.master = caller\n _this.slave = callee\n _this.linked = true //-->> if delete is called, this should be revoked again\n }", "title": "" }, { "docid": "c2fd0c1bd206ebff7621d7535eded8d0", "score": "0.59230435", "text": "function fingerChoice() {\n choiceDialog(0, 0, ghostDialog, 14000);\n}", "title": "" }, { "docid": "29383e8469fc014a0bbc570021d99be9", "score": "0.59096223", "text": "function select(event) {\n menuOption = 0;\n var x = event.clientX - canvas.offsetLeft,\n y = event.clientY - canvas.offsetTop; \n val = Math.floor(x / 60);\n \n menuOption = val;\n switch (val) {\n case 0:\n setDefaultShapeColor(255, 1, 1);\n \n break;\n case 1:\n setDefaultShapeColor(1, 1, 255);\n break;\n\n case 2:\n setDefaultShapeColor(1, 255, 1);\n break;\n \n case 3:\n setDefaultShapeColor(255, 255, 1);\n break;\n \n default:\n setDefaultShapeColor();\n \n }\n console.log(context.fillStyle );\n\n}", "title": "" }, { "docid": "1eed2992544c1b6e4c46ca0a7eff1004", "score": "0.59032553", "text": "function render_select(context)\n{\n\tif(selection_coordinates != null)\n\t{\n\t\tstroke_tile(selection_coordinates.x, selection_coordinates.y, grid_selected_color, context);\n\t}\n}", "title": "" }, { "docid": "377ffe56d2b4fba66be9c22c0630142e", "score": "0.5899612", "text": "onSelectionChange() {}", "title": "" }, { "docid": "450b03129b5bc52b01c9a79db5eefc2b", "score": "0.58966136", "text": "function mousePressed() {\n //Un cop iniciem el Sketch eliminem les instruccions i deixem funcionant la resta\n if (mostrarInstruccions) {\n mostrarInstruccions = false;\n mainCanvas.background(255);\n }\n ratoli = true;\n}", "title": "" }, { "docid": "6012a8fd31a22e183f936470ba929a05", "score": "0.58892584", "text": "static selectEventHandler(e) {\n // if the user hasn't started a word yet, just return\n if (!Controller.startSquare) {\n return\n }\n\n // if the new square is actually the previous square, just return\n let lastSquare = Controller.selectedSquares[Controller.selectedSquares.length - 1];\n if (lastSquare == e.detail) {\n return\n }\n\n // see if the user backed up and correct the selectedSquares state if\n // they did\n let backTo\n for (let i = 0; i < Controller.selectedSquares.length; i++) {\n let selectedSquare = Controller.selectedSquares[i]\n if (selectedSquare.x == e.detail.x && selectedSquare.y == e.detail.y) {\n backTo = i + 1\n break\n }\n }\n\n while (backTo < Controller.selectedSquares.length) {\n let target = Controller.selectedSquares[Controller.selectedSquares.length - 1]\n Controller.myView.removeSelected(target.x, target.y)\n\n Controller.selectedSquares.splice(Controller.selectedSquares.length - 1, 1);\n Controller.curWord = Controller.curWord.substr(0, Controller.curWord.length - 1)\n lastSquare = Controller.selectedSquares[Controller.selectedSquares.length - 1]\n }\n\n // see if this is just a new orientation from the first square\n // this is needed to make selecting diagonal words easier\n let newOrientation = Controller.calcOrientation(\n Controller.startSquare.x,\n Controller.startSquare.y,\n e.detail.x,\n e.detail.y\n )\n\n if (newOrientation) {\n Controller.selectedSquares.forEach( sq => {\n Controller.myView.removeSelected(sq.x, sq.y)\n })\n Controller.myView.addSelected(Controller.startSquare.x, Controller.startSquare.y)\n\n Controller.selectedSquares = [Controller.startSquare]\n Controller.curWord = Controller.myQuiz.grid[Controller.startSquare.y][Controller.startSquare.x]\n Controller.curOrientation = newOrientation\n lastSquare = Controller.startSquare\n }\n\n // see if the move is along the same orientation as the last move\n let orientation = Controller.calcOrientation(\n lastSquare.x,\n lastSquare.y,\n e.detail.x,\n e.detail.y\n )\n\n // if the new square isn't along a valid orientation, just ignore it.\n // this makes selecting diagonal words less frustrating\n if (!orientation) {\n return\n }\n\n // finally, if there was no previous orientation or this move is along\n // the same orientation as the last move then play the move\n if (!Controller.curOrientation || Controller.curOrientation === orientation) {\n Controller.curOrientation = orientation;\n Controller.playTurn(e.detail);\n }\n }", "title": "" }, { "docid": "8ca4fb671e0169012f45f4bdf3be304d", "score": "0.5867546", "text": "function optionChanged(newSelection) {\n buildPlots(newSelection)\n getDemoInfo(newSelection)\n}", "title": "" }, { "docid": "39f3f7e7104586694d644f8866642bf0", "score": "0.5864976", "text": "function onSelectStart() {\n this.userData.isSelecting = true;\n }", "title": "" }, { "docid": "f2cdca19addbee57b3f17f640373f102", "score": "0.5863332", "text": "function selectionHandler(){\r var handler = function(){\r var newSelection = app.selection;\r\r _.each(newSelection, function(item){\r if(!_.inArray(item, eventForwarder.selection)){\r selected(item);\r }\r });\r _.each(eventForwarder.selection, function(item){\r if(!_.inArray(item, newSelection)){\r deselected(item);\r }\r });\r eventForwarder.selection = newSelection;\r };\r app.doScript(handler, ScriptLanguage.JAVASCRIPT, [], UndoModes.ENTIRE_SCRIPT);\r }", "title": "" }, { "docid": "e71072615fb57286b43e3e4eaa0d6337", "score": "0.5856222", "text": "function select() {\n \tif (selected == false)\n \t\ttoggleSelection();\n }", "title": "" }, { "docid": "930de6bd471f8ce6fc00677547f83838", "score": "0.5853114", "text": "function selectedChanged(window,elems) {\n const mode = svgCanvas.getMode();\n _self.selected = elems.filter(Boolean);\n editor.paintBox.fill.update();\n editor.paintBox.stroke.update();\n editor.panel.updateContextPanel(_self.selected);\n }", "title": "" }, { "docid": "4e6c849be6b23270b1a27e5cd06125f3", "score": "0.5848187", "text": "function selectHandler() {\n var selectedItem = chart.getSelection()[0];\n if (selectedItem) {\n \n var value = data.getValue(selectedItem.row, 0);\n model_selected(value,0,true); // so numclones=value, num_soln=0 (best solution)\n }\n }", "title": "" }, { "docid": "91cb6717c1eec52918f9c9202bbbdfb5", "score": "0.5814204", "text": "function pick() {\n\t\t\t\t\t\t\t\tinsert(completions[sel.selectedIndex]);\n\t\t\t\t\t\t\t\tclose();\n\t\t\t\t\t\t\t\tsetTimeout(function(){editor.focus();}, 50);\n\t\t\t\t\t\t\t}", "title": "" }, { "docid": "0456fdb948dde0c9f7b576dbf8cdf8f3", "score": "0.5800146", "text": "function Select() {\n\n\t}", "title": "" }, { "docid": "fba9f664f0a3c9026662cbd56c696cc6", "score": "0.579769", "text": "function outputSelection()\n\t\t{\n\t\t\tif(UI.selection)\n\t\t\tOutput.list($selection[0]);\n\t\t}", "title": "" }, { "docid": "eaa24912c545979dbffb28ed690a9e2a", "score": "0.5794281", "text": "onSelectionChanged(sel) {\n const {setContextObjectsBatchLoad} = this.props;\n const ids = this.selectedObjectIDs(sel);\n setContextObjectsBatchLoad(this.selectionPath(), ids);\n }", "title": "" }, { "docid": "cf4d08aab97e32ae3135d866bf2017a4", "score": "0.57876307", "text": "function handleSelection( e )\r\n{\r\n\t//Get selected features\r\n\tvar features = e.selected;\r\n\tvar feature;\r\n\t\r\n\t//TODO???: Handle multi-select?\r\n\tif( features != undefined )\r\n\t{\r\n\t\tfeature = features[0];\r\n\t\t\r\n\t\tif( feature != undefined )\r\n\t\t\t$(\"#shapeList\").val( feature.getId() ).trigger('change');\r\n\t}\t\t\r\n}", "title": "" }, { "docid": "9981dd55aa138d60fd1a2c36722bef01", "score": "0.57814074", "text": "function select(_obj) {\n console.log(\"Beginning select\");\n\n // we need to deselect the object\n if (selected != null) {\n deselect();\n }\n\n selected = _obj;\n\n // attach css\n selected.children().attr(\"stroke\", \"yellow\");\n selected.children().attr(\"stroke-width\", \"5\");\n $(\"#shape_owner\").text(\"user\" + owners[_obj.attr(\"id\")])\n\n }", "title": "" }, { "docid": "7902d32a2f1954380e5bfd3a8a0c1668", "score": "0.57763565", "text": "setSelection(selection) {\n this.selection = selection;\n this.onSelection.dispatch(this.selection);\n }", "title": "" }, { "docid": "dca9075489855b419cf08320ed9febbd", "score": "0.57462686", "text": "function selectionHandler(selection) {\n\n\t\tvar featObj = null;\n\t\tif (selection.hasOwnProperty(\"features\")) {\n\t\t\tfeatObj = selection.features[0];\n\t\t} else {\n\t\t\tif (selection.length > 0) {\n\t\t\t\tfeatObj = selection[0];\n\t\t\t}\n\t\t}\n\t\tif (featObj != null) {\n\t\t\tcurrentFeatures = [];\n\t\t\tcurrentFeatures.push({\n\t\t\t\tlayerId: featObj._layer.layerId,\n\t\t\t\tgeometry: featObj.geometry,\n\t\t\t\tattributes: featObj.attributes\n\t\t\t});\n\n\t\t\tvar parcelPoly = featObj.geometry;\n\t\t\tparcelPoly.spatialReference = map.spatialReference;\n\t\t\tvar center = queryPoint == undefined ? parcelPoly.getCentroid() : queryPoint;\n\t\t\tqueryPoint = undefined;\n\t\t\tmap.infoWindow.setFeatures([featObj]);\n\t\t\tmap.infoWindow.show(center);\n\t\t\tmap.setExtent(parcelPoly.getExtent().expand(2.5), true);\n\t\t\tmap.centerAt(center);\n\n\t\t\tvar parid = featObj.attributes[\"dmp\"];\n\t\t\t//Refresh the URL with the currently selected parcel\n\t\t\tif (typeof history.pushState !== \"undefined\") {\n\t\t\t\twindow.history.pushState(null, null, \"?parid=\" + featObj.attributes.dmp);\n\t\t\t}\n\t\t}\n\t}", "title": "" }, { "docid": "92f2426bc0c38fe22571bf1c77e42c6a", "score": "0.57411355", "text": "function addActionForHtmlUI(){\n // Clear the canvas\n document.getElementById('clear').onclick = function() { \n g_shapesList = []; \n renderAllShapes(); \n }; \n\n // Buttons that change cursor shape directly\n document.getElementById('pointButton').onclick = function() { g_selectedType = POINT; }; \n document.getElementById('triglButton').onclick = function() { g_selectedType = TRIANGLE; };\n document.getElementById('circlButton').onclick = function() { g_selectedType = CIRCLE; };\n\n document.getElementById('bgButton').onclick = function() { \n // Specify the color for clearing <canvas> and clear it\n gl.clearColor(g_selectedColor[0], g_selectedColor[1], g_selectedColor[2], g_selectedColor[3]);\n gl.clear(gl.COLOR_BUFFER_BIT);\n renderAllShapes();\n };\n\n // Slider color change of shape\n document.getElementById('redSlide').addEventListener('mouseup', \n function() { g_selectedColor[0] = this.value/100; });\n document.getElementById('greSlide').addEventListener('mouseup', \n function() { g_selectedColor[1] = this.value/100; });\n document.getElementById('bluSlide').addEventListener('mouseup', \n function() { g_selectedColor[2] = this.value/100; });\n document.getElementById('alpSlide').addEventListener('mouseup', \n function() { g_selectedColor[3] = this.value/100; });\n\n // Slider to change the size of our shape\n document.getElementById('sizeSlide').addEventListener('mouseup',\n function() { g_selectedSize = this.value; });\n\n // Slider to change the size of our shape\n document.getElementById('sideSlide').addEventListener('mouseup',\n function() { g_selectedSides = this.value; });\n\n // Drop down menu and select button for coloring book set\n // document.getElementById('bookButton').onclick = function() { \n // g_selectedBook = document.getElementById(\"colorBook\").value; \n // console.log(g_selectedBook); \n // coloringBook();\n // };\n}", "title": "" }, { "docid": "7a7956dbb11acce5bce53f7269deacf3", "score": "0.57244104", "text": "selectionSetWillChange() {}", "title": "" }, { "docid": "dc376844498b8b59c74e598524d84549", "score": "0.5721182", "text": "function render(){\n selectBoxes[selected].set('stroke', 'red');\n state.canvas.sadd(charDisplays[selected]);\n state.canvas.sadd(skillDisplays[selected]);\n state.canvas.srenderAll();\n }", "title": "" }, { "docid": "780d8969b95a17a657749a0179295560", "score": "0.57196534", "text": "function updateShape() {\n selectedShape.changed = true;\n selectedShape.indexOfChange = shapeArrayPointer;\n var fillColor = $('#fillColorChoice');\n selectedShape.fillColor = fillColor.val();\n selectedShape.newFillColor = fillColor.val();\n var lineColor = $('#lineColorChoice');\n selectedShape.lineColor = lineColor.val();\n selectedShape.newLineColor = lineColor.val();\n var widthLine = $('#lineWidthChoice');\n selectedShape.lineWidth = widthLine.val();\n selectedShape.newLineWidth = widthLine.val();\n render();\n}", "title": "" }, { "docid": "d1af8facd5d9cc1bd81db411b3238fbb", "score": "0.5712516", "text": "function optionSelect(action) {\r\n switch (action) {\r\n case 'CLICK_ELEMENT':\r\n canvas.onmousedown = function (e) {\r\n console.log(e.clientX + \" \" + e.clientY)\r\n\r\n const posX = Round(getPosX(e));\r\n const posY = Round(getPosY(e))\r\n\r\n ctx.fillStyle = \"red\";\r\n ctx.fillRect(posX - 2, posY - 2, 4, 4)\r\n createElement(posX, posY, e)\r\n }\r\n break;\r\n case 'DRAW_ARROW':\r\n var checkClickFirst = false;\r\n var pointPrev = {\r\n x: 0,\r\n y: 0\r\n }\r\n canvas.onmousedown = function (e) {\r\n const posX = Round(getPosX(e))\r\n const posY = Round(getPosY(e))\r\n ctx.fillStyle = \"red\";\r\n // ctx.fillRect(posX-2, posY-2,4,4)\r\n if (!checkClickFirst) {\r\n pointPrev = {\r\n x: posX,\r\n y: posY\r\n }\r\n checkClickFirst = true;\r\n }\r\n else {\r\n\r\n const point = {\r\n x: posX,\r\n y: posY\r\n }\r\n // drawLine(pointPrev.x, pointPrev.y, point.x, point.y)\r\n DrawArrow(pointPrev.x, pointPrev.y, point.x, point.y)\r\n pointPrev = point\r\n checkClickFirst = false;\r\n }\r\n createElement(posX, posY, e)\r\n\r\n }\r\n break;\r\n case 'DRAW_DASH':\r\n var checkClickFirst = false;\r\n var pointPrev = {\r\n x: 0,\r\n y: 0\r\n }\r\n canvas.onmousedown = function (e) {\r\n const posX = Round(getPosX(e))\r\n const posY = Round(getPosY(e))\r\n ctx.fillStyle = \"red\";\r\n // ctx.fillRect(posX-2, posY-2,4,4)\r\n if (!checkClickFirst) {\r\n pointPrev = {\r\n x: posX,\r\n y: posY\r\n }\r\n checkClickFirst = true;\r\n }\r\n else {\r\n const point = {\r\n x: posX,\r\n y: posY\r\n }\r\n DrawDash(pointPrev.x, pointPrev.y, point.x, point.y)\r\n\r\n pointPrev = point\r\n checkClickFirst = false;\r\n }\r\n createElement(posX, posY, e)\r\n\r\n }\r\n break;\r\n case 'DRAW_REC':\r\n var checkClickFirst = false;\r\n var pointPrev = {\r\n x: 0,\r\n y: 0\r\n }\r\n canvas.onmousedown = function (e) {\r\n const posX = Round(getPosX(e))\r\n const posY = Round(getPosY(e))\r\n ctx.fillStyle = \"red\";\r\n ctx.fillRect(posX, posY, 4, 4)\r\n if (!checkClickFirst) {\r\n pointPrev = {\r\n x: posX,\r\n y: posY\r\n }\r\n checkClickFirst = true;\r\n }\r\n else {\r\n\r\n const point = {\r\n x: posX,\r\n y: posY\r\n }\r\n console.log(pointPrev.x, pointPrev.y, point.x, point.y)\r\n drawREC(pointPrev.x, pointPrev.y, point.x, point.y)\r\n pointPrev = point\r\n checkClickFirst = false;\r\n }\r\n }\r\n break;\r\n case 'DRAW_DASH_WITH_ONE_DOT':\r\n var checkClickFirst = false;\r\n var pointPrev = {\r\n x: 0,\r\n y: 0\r\n }\r\n canvas.onmousedown = function (e) {\r\n const posX = Round(getPosX(e))\r\n const posY = Round(getPosY(e))\r\n ctx.fillStyle = \"red\";\r\n // ctx.fillRect(posX-2, posY-2,4,4)\r\n if (!checkClickFirst) {\r\n pointPrev = {\r\n x: posX,\r\n y: posY\r\n }\r\n checkClickFirst = true;\r\n }\r\n else {\r\n const point = {\r\n x: posX,\r\n y: posY\r\n }\r\n DrawDashWithDot(pointPrev.x, pointPrev.y, point.x, point.y)\r\n pointPrev = point\r\n checkClickFirst = false;\r\n }\r\n createElement(posX, posY, e)\r\n }\r\n break;\r\n case 'DRAW_DASH_WITH_TWO_DOTS':\r\n\r\n var checkClickFirst = false;\r\n var pointPrev = {\r\n x: 0,\r\n y: 0\r\n }\r\n canvas.onmousedown = function (e) {\r\n const posX = Round(getPosX(e))\r\n const posY = Round(getPosY(e))\r\n ctx.fillStyle = \"red\";\r\n // ctx.fillRect(posX-2, posY-2,4,4)\r\n if (!checkClickFirst) {\r\n pointPrev = {\r\n x: posX,\r\n y: posY\r\n }\r\n checkClickFirst = true;\r\n }\r\n else {\r\n const point = {\r\n x: posX,\r\n y: posY\r\n }\r\n DrawDashWith2Dots(pointPrev.x, pointPrev.y, point.x, point.y)\r\n pointPrev = point\r\n checkClickFirst = false;\r\n }\r\n createElement(posX, posY, e)\r\n }\r\n break;\r\n case 'DRAW_CIRCLE_DASH':\r\n var inputValue = document.getElementById(\"inputRadius\").value\r\n if (inputValue === '')\r\n alert(\"Bạn chưa nhập bán kính\")\r\n else {\r\n if (inputValue < 10 || inputValue > 60) {\r\n alert(\"Bán kính quá nhỏ hoặc quá to để hiện thị\")\r\n break;\r\n }\r\n alert(\"Chọn vị trí bạn muốn vẽ\")\r\n const radius = parseFloat(inputValue) * 5\r\n\r\n canvas.onmousedown = function (e) {\r\n const posX = Round(getPosX(e))\r\n const posY = Round(getPosY(e))\r\n\r\n ctx.fillStyle = \"red\";\r\n DrawCirleWithDash(posX, posY, radius)\r\n ctx.fillRect(posX, posY, 4, 4)\r\n createElement(posX, posY, e)\r\n }\r\n }\r\n break;\r\n case 'DRAW_ELIP_DASH':\r\n var inputValueRa = document.getElementById(\"inputRa\").value\r\n var inputValueRb = document.getElementById(\"inputRb\").value\r\n if (inputValue === '')\r\n alert(\"Bạn chưa nhập bán kính\")\r\n else {\r\n // if (inputValue < 10 || inputValue > 60) {\r\n // alert(\"Bán kính quá nhỏ hoặc quá to để hiện thị\")\r\n // break;\r\n // }\r\n alert(\"Chọn vị trí bạn muốn vẽ\")\r\n const Ra = parseFloat(inputValueRa) * 5\r\n const Rb = parseFloat(inputValueRb) * 5\r\n\r\n canvas.onmousedown = function (e) {\r\n const posX = Round(getPosX(e))\r\n const posY = Round(getPosY(e))\r\n\r\n ctx.fillStyle = \"red\";\r\n midptellipse(posX, posY, Ra, Rb)\r\n ctx.fillRect(posX, posY, 4, 4)\r\n createElement(posX, posY, e)\r\n }\r\n }\r\n break;\r\n default:\r\n alert(\"Chức năng chưa cập nhật\")\r\n }\r\n\r\n}", "title": "" }, { "docid": "74fc434f5a19b08e1a7c1e59ecabfad8", "score": "0.5708364", "text": "function updateSelection() {\n // retrieve the name, gravity of the matching celestial body\n const { name, gravity } = bodies.find(body => body.name === this.getAttribute('data-name'));\n // update the UI with the fabricated functions\n updateGravity(gravity);\n updateName(name);\n selectButton(this);\n}", "title": "" }, { "docid": "e8028ad4a46a20a9d8672f5dc53a71c1", "score": "0.569405", "text": "chooseData() {\n // ******* TODO: PART I *******\n //Changed the selected data when a user selects a different\n // menu item from the drop down.\n\n }", "title": "" }, { "docid": "03f7b80679c556d29528b99adec2e62a", "score": "0.5687967", "text": "onSelection (event) {\n this.sendEvent(\"selection\");\n }", "title": "" }, { "docid": "3b8d9fb98dc09aedc85e7561763548c0", "score": "0.5684992", "text": "function bindColorSelect() {\n $('#colors .color, #colors .static div').click(function(e){\n var isStroke = $('#tool_stroke').hasClass('active');\n var picker = isStroke ? \"stroke\" : \"fill\";\n var color = robopaint.utils.rgbToHex($(this).css('background-color'));\n var paint = null;\n var noUndo = false;\n\n // Webkit-based browsers returned 'initial' here for no stroke\n if (color === 'transparent' || color === 'initial' || color === '#none') {\n color = 'none';\n paint = new $.jGraduate.Paint();\n }\n else {\n paint = new $.jGraduate.Paint({alpha: 100, solidColor: color.substr(1)});\n }\n\n methodDraw.paintBox[picker].setPaint(paint);\n\n methodDraw.canvas.setColor(picker, color, noUndo);\n\n if (isStroke) {\n if (color != 'none' && svgCanvas.getStrokeOpacity() != 1) {\n svgCanvas.setPaintOpacity('stroke', 1.0);\n }\n } else {\n if (color != 'none' && svgCanvas.getFillOpacity() != 1) {\n svgCanvas.setPaintOpacity('fill', 1.0);\n }\n }\n });\n}", "title": "" }, { "docid": "8ecfaf5d14275b13782fd60219f7181b", "score": "0.56701595", "text": "function selection() {\n\tif(arguments[0] == \"all\") {\n\t\t\tfor(i = 0; i < play_num; i++){\n\t\t\t\tpl[i].message(\"selection\", 1, arguments[1], arguments[2]);\n\t\t\t\t}\n\t} else { \n\t\tpl[(arguments[0]-1)].message(\"selection\", 1, arguments[1], arguments[2]);\n\t}\n}", "title": "" }, { "docid": "a72d945f15f06b850d0c9af78c4b2656", "score": "0.5668055", "text": "function map_selection_screen_start_game() {\n _action = PLAYER_ACTIONS.MAP_SELECTED;\n}", "title": "" }, { "docid": "93b6554491769518b6ed9739e818277d", "score": "0.5660397", "text": "function selectHandler(){\n \t \n\t\t var selectedItem = barchart.getSelection()[0];\n if (selectedItem) \n {\n make = bardata.getValue(selectedItem.row, 0);\n // alert('The user selected ' + make);\n //getPieChartData();\n \n getPiebyModel(make);\n }\n }", "title": "" }, { "docid": "f04ba47f1f8e61e40b2a40c6a3ef94f1", "score": "0.56540453", "text": "onSelect(event) {\n super.onSelect(event);\n this.glow = this.componentShapeFill.glow();\n this.glow.toBack();\n }", "title": "" }, { "docid": "6d1b1dae1b2df8a0cbe8e342f664eeb5", "score": "0.56537205", "text": "function startDrawing(type) {\n var btn_brushstroke = document.getElementById('startDrawingBrush');\n var btn_shape = document.getElementById('startDrawingShape');\n var btn_erase = document.getElementById('startDrawingEraser');\n shapes_canvas.style.cursor = 'crosshair'\n if (type == 'brushstroke') {\n btn_brushstroke.classList.toggle('active');\n if (btn_brushstroke.classList.contains('active')) {\n if (btn_shape.classList.contains('active')) {\n btn_shape.classList.toggle('active');\n }\n editing_status = 'draw_brush';\n if (is_selected) {\n selected_shape = null;\n is_transforming = null;\n removeSelection();\n clearCanvas();\n reDrawShape();\n }\n return\n }\n editing_status = null;\n }\n if (type == 'shape') {\n btn_shape.classList.toggle('active');\n if (btn_shape.classList.contains('active')) {\n if (btn_brushstroke.classList.contains('active')) {\n btn_brushstroke.classList.toggle('active');\n }\n editing_status = 'draw_shape';\n if (is_selected) {\n selected_shape = null;\n is_transforming = null;\n removeSelection();\n clearCanvas();\n reDrawShape();\n }\n return\n }\n editing_status = null;\n }\n if (type == 'erase') {\n alert('Eraser')\n }\n}", "title": "" }, { "docid": "29181a9edeaa201b302d0022ed82c11c", "score": "0.5647605", "text": "function DtSelection() {}", "title": "" }, { "docid": "e2ab4fd871af0cfbe69d0862e42493ce", "score": "0.5645433", "text": "function brush() {\n brushed = selected(); \n pc.render();\n extent_area();\n }", "title": "" }, { "docid": "850b8b8b46a1f7f24d90a3d165b30a82", "score": "0.56412876", "text": "function selectHandler() {\n\t\tmobile += 1;\n\t\tvar selectedItemRow = chart.getSelection()[0].row;\n\t\tvar selectedItemCol = chart.getSelection()[0].column;\n\t\tif (selectedItemRow != null){\n\t\t\t//alert(data.getValue(selectedItemRow, 0));\n\t\t\txValue = data.getValue(selectedItemRow, 0);\n\t\t\tyValue = data.getValue(selectedItemRow, selectedItemCol);\n\t\t\tvar valid = checkIndex();\n\n\t\t\tif(valid){\n\t\t\t\tclickIndex += 1;\n\t\t\t\t//clickedX.push(xValue);\n\t\t\t\t//clickedY.push(yValue);\n\t\t\t\tgetRequest();//xValue, yValue);\n\t\t\t}\n\t\t}\n\t}", "title": "" }, { "docid": "9a212344d030e47af9d6fafa49fc243f", "score": "0.5630216", "text": "function change_selection() {\n $(this.event.target).addClass('addColor').siblings().removeClass('addColor')\n selected_item = this.event.target.id\n}", "title": "" }, { "docid": "adb61a9523d79c644e4e9664d4daf032", "score": "0.5627736", "text": "function selectionChange(args) {\n if (args.state === \"changing\") {\n var type;\n if (args.selectedItems.length) {\n //gets the selected object type.\n type = args.selectedItems[0].type;\n if (!(args.selectedItems.length > 1) && type === \"connector\") {\n /*\n if selected object is connector, set the connectors tab item avaiable in the property panel should be active.\n */\n $(\"#tabContent\").ejTab(\"option\", \"selectedItemIndex\", 3);\n }\n //User Handles associated with the selector will be shown based on the selection.\n ShowHandles(diagram, args);\n }\n else {\n if (!diagram._selectedObject.pinned) {\n document.getElementById(\"propertyEditor\").style.display = \"none\";\n }\n }\n /*\n Toolbar visibility will be updated based on the selection and its used to perform diagram functionalities such as\n clipboard commands, align commands at run time.\n */\n ToolBarVisibility(args, type);\n if (diagram._selectedObject.pinned) {\n /*\n The selected object properties will be bind to property panel only if property panel is pinned state (i,e only in visible state).\n if property panel not in visible state, selected object properties will be bind when click on the settings user handle.\n You can refer user handles specific information to method.js file.\n */\n ko.applyBindings(diagram._selectedObject.select(args.selectedItems));\n }\n /*\n Diagram Size will be updated based on the property panel visibility.\n */\n setDiagramSize(diagram._selectedObject.pinned);\n }\n}", "title": "" }, { "docid": "b322069a91bcd53032c1315e0bee6d88", "score": "0.56254834", "text": "function startSelector () {\n \"use strict\";\n if (userSelections === true) {\n document.getElementById('selection').style.display = \"none\";\n renderFlag = true;\n } else {\n alert('Please select a player to start the game.');\n }\n}", "title": "" }, { "docid": "1e0e667c6a9cacdfc556b4193298639a", "score": "0.5623697", "text": "_picking() {\n // TEST ONLY\n // this.receiveWord(this.currentDrawer.id, \"current\");\n // end test\n\n if (this.state !== GameStates.Picking) {\n return; // error\n }\n console.log(\"picking\");\n\n // on vérifie que le joueur courrant est connecté sinon on attend pour rien\n if (this.isCurrentPlayerConnected()) {\n if (this.currentWord.length > 0) {\n console.log(\"NEXT STEP\");\n // le mot a été selectionné alors on dessine et on valide pour le drawer\n this.sendNextWord();\n this.state = GameStates.Drawing;\n }\n } else {\n // on change de joueur\n this.state = GameStates.NextPlayer;\n }\n }", "title": "" }, { "docid": "e4ae0297272b88455942ed2f34261cbd", "score": "0.56203973", "text": "function onSelectedMeme(memeIdx){\n setMeme(memeIdx);\n openMemeGenSection();\n renderCanvas();\n}", "title": "" }, { "docid": "e8d70cc52737b615fbadb9c53401349d", "score": "0.5618849", "text": "function makeInitialSelection() {\n\t GLOBALS.node_id = GLOBALS.root_node_id;\n\t $.publish(\"/node/click\", GLOBALS.node_id);\n\t}", "title": "" }, { "docid": "420f54c6f83b2fc255b03c035e251eca", "score": "0.56110066", "text": "select() {\n if (!this.selected) {\n this.selected = true;\n this._emitSelectionChange();\n }\n }", "title": "" }, { "docid": "ed723c85d450bf78f5986af89a5497a8", "score": "0.5610497", "text": "function firstRetrieval() {\n var selection = jcrop_api.getSelection();\n\tvar container = jcrop_api.getContainerSize();\n\n var portion = [image_size[0] / container[0], image_size[1] / container[1]];\n var new_selection = [selection.x * portion[0],selection.y * portion[1],selection.w * portion[0],selection.h * portion[1]];\n parseInt_array(new_selection);\n\twindow.selection = new_selection;\n\tvar info_obj = {imgurl: imgUrl, gender: gender, style: style, area_arr: new_selection};\n\tsubmit(0, info_obj, callback_firstRetrieval);\n}", "title": "" }, { "docid": "eaa82c4e5910f7ee88598f3cd8bd9136", "score": "0.56021076", "text": "function xChoice(){\n $(\".boxes li\").eq(xSquareClicked).addClass(\"box-filled-2\");\n $(\".boxes li\").eq(xSquareClicked).css(\"background-image\", \"url(./img/x.svg)\");\n\n ///Pushed the passed square to the array of x Moves and to the array of filled squares\n xMoves.push(xSquareClicked);\n filledSquares.push(xSquareClicked);\n \n //When the square have been selected, disabled the hover effect for it\n $(\".boxes li\").eq(xSquareClicked).off();\n }", "title": "" }, { "docid": "f415b953e0f65bcd4c150c6ae3dcf1a9", "score": "0.5595745", "text": "function selectionCallback(x, d) {\n $log.debug('Selection callback', x, d);\n }", "title": "" }, { "docid": "83108c43a1542c84b642e6a6259f6e07", "score": "0.5594615", "text": "function selectHandler() {\n\t var selectedItem = chart.getSelection()[0];\n\t if (selectedItem) {\n\t console.log ('User wants to get information about week: '+ selectedItem.row);\n\t // TO DO: display information about a specific week\n\t\t\tdisplayWeekRUP(selectedItem.row);\n\t }\n\t}", "title": "" }, { "docid": "0f8b3c3553f701180ccdfbb8250e768a", "score": "0.5592162", "text": "function mousePressed() {\n\tsetup();\n}", "title": "" }, { "docid": "64b27f8769dc36e918ee165efe863b96", "score": "0.55914927", "text": "function mousePressed(){\n if(selected === null){\n let collision = checkClick(mouseX, mouseY);\n if(collision !== null){\n selected = collision;\n }else{\n createVertex();\n }\n }else{\n let collision = checkClick(mouseX, mouseY);\n if(collision === null){\n selected = null;\n }else{\n if(lengthType.checked() || (lengthInput.value() != '' && (!isNaN(lengthInput.value())))){\n digraph.addEdge(selected, collision, lengthInput.value());\n }\n if(isNaN(lengthInput.value())){\n lengthInput.value('');\n }\n selected = null;\n }\n }\n}", "title": "" }, { "docid": "3efa3c067c5f6d0ee048fe0798b7f750", "score": "0.55878913", "text": "function chooseData() {\n\n // ******* TODO: PART I *******\n //Changed the selected data when a user selects a different\n // menu item from the drop down.\n\n}", "title": "" }, { "docid": "0d84474a7449c7e9525baba2fb977094", "score": "0.5587008", "text": "function polygonSelectionMethod(){\n\n\t// hide the download kml button\n\tupdate_button = document.getElementById('downloadkml')\n\tupdate_button.style.display = 'none';\n\n\t// get the variable name\n\tvar selection = $(\"input[name='polygon-selection-method']:checked\").val();\n\t\n\tif (selection == \"Province\"){\n\n\t\tCountryorProvince = 0;\n\n\t\t// remove the drawing manager\n\t\tif (drawingManager){\n\t\t\tdrawingManager.setMap(null);\n\t\t}\n\n\t\t// clear existing overlays\n\t\tclearMap();\n\n\t\tPROVINCES.forEach((function(provinceName) {\n\t\tmap.data.loadGeoJson('static/province/' +provinceName + '.json')}).bind());\n\t\t\tmap.data.setStyle(function(feature) {\n\t\t\treturn {\n\t\t\t fillColor: 'white',\n\t\t\t strokeColor: 'white',\n\t\t\t strokeWeight: 2\n\t\t\t\t};\n\t\t\t });\n\t\t}\n\n\tif (selection == \"Country\"){\n\t\t\n\t\tCountryorProvince = 1;\n\n\t\t// remove the drawing manager\n\t\tif (drawingManager){\n\t\t\tdrawingManager.setMap(null);\n\t\t}\n\n\t\t// clear existing overlays\n\t\tclearMap();\n\n\t\tCOUNTRIES.forEach((function(country) {\n\t\tmap.data.loadGeoJson('static/country/' +country + '.json')}).bind());\n\t\t\tmap.data.setStyle(function(feature) {\n\t\t\treturn {\n\t\t\t fillColor: 'white',\n\t\t\t strokeColor: 'white',\n\t\t\t strokeWeight: 2\n\t\t\t\t};\n\t\t\t });\n\t\t}\t\t\n\n\tif (selection == \"Draw Polygon\"){\t\n\t\t\n\t\tCountryorProvince = 0;\n\t\n\t\t// clear existing overlays\n\t\tclearMap();\n\t\n\t\t// setup drawing \n\t\tcreateDrawingManager();\n\t\t}\n\n}", "title": "" }, { "docid": "11753806a2bd73505a0f5c3034b32cfb", "score": "0.55757606", "text": "change() {\n const selectEl = this.$()[0];\n const selectedIndex = selectEl.selectedIndex;\n const content = this.get('content');\n const hasPrompt = !!this.get('prompt');\n let selection;\n\n // decrement index by 1 if we have a prompt\n const contentIndex = hasPrompt ? selectedIndex - 1 : selectedIndex;\n\n if(hasPrompt && selectedIndex === 0) {\n // leave selection as undefined\n } else {\n selection = content.objectAt(contentIndex);\n }\n\n // set the local, shadowed selection to avoid leaking\n // changes to `selection` out via 2-way binding\n this.set('_selection', selection);\n\n const changeCallback = this.get('action');\n changeCallback(selection);\n }", "title": "" }, { "docid": "6077f15a18d27af68f41193f4fd8db79", "score": "0.5573681", "text": "function selectHandler() {\n var selectedItem = strain_chart.getSelection()[0];\n if (selectedItem) {\n $('#phenotype_table_filter > label > input:first').removeClass('flash');\n //var value = strain_data.getValue(selectedItem.row, selectedItem.column);\n var strain = phenotype_overview['strains'][selectedItem.row+1][0];\n var phenotype_table = $($.fn.dataTable.fnTables(true)).dataTable();\n phenotype_table.fnFilter( strain );\n try {\n $('#navbar_annotations > a:first').click();\n }\n catch(err) {\n\n }\n $('#phenotype_table_filter > label > input:first').addClass('flash');\n }\n }", "title": "" }, { "docid": "0d2e76bb031e4657e79dbd0fc9314e7d", "score": "0.5571243", "text": "function ollClicked(oll)\r\n{\r\n selectAllOll(oll, !ollHasSelected(oll));\r\n renderSelection();\r\n}", "title": "" }, { "docid": "8780ba18b12ad42295b96be15234b62a", "score": "0.5555219", "text": "static startTurnEventHandler(e) {\n Controller.startSquare = e.detail;\n Controller.selectedSquares.push(e.detail);\n Controller.curWord = Controller.myQuiz.grid[e.detail.y][e.detail.x]\n Controller.myView.addSelected(e.detail.x, e.detail.y)\n }", "title": "" }, { "docid": "74a0e85020bae70865c3b30e494e9a4b", "score": "0.5551421", "text": "_setSelection() {\n if(this.colors.includes(this.color) || this.hideAdvanced){\n this.setBasic();\n } else {\n this.setAdvanced();\n }\n }", "title": "" }, { "docid": "abee20def161ff6adf54eeafe575ce0d", "score": "0.5550504", "text": "function selectionChange(e) {\n var pointRng;\n\n // Check if the button is down or not\n if (e.button) {\n // Create range from mouse position\n pointRng = rngFromPoint(e.x, e.y);\n\n if (pointRng) {\n // Check if pointRange is before/after selection then change the endPoint\n if (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n pointRng.setEndPoint('StartToStart', startRng);\n } else {\n pointRng.setEndPoint('EndToEnd', startRng);\n }\n\n pointRng.select();\n }\n } else {\n endSelection();\n }\n }", "title": "" }, { "docid": "91259556c70cd170e6de8e665d8563f8", "score": "0.55482876", "text": "function putMouse()\n{\n\tstrokeWeight(3);\n\t\n\tif (is_pick_toy_mode)\n\t{\n\t\tif (NextToNextStep(mouseX, mouseY) != NOT_CHOSEN)\n\t\t{\n\t\t\tstroke(0);\t\n\t\t\txMouseMark();\n\t\t}\n\t\telse if (NextToAddDirection(pickedToy.x, pickedToy.y, mouseX, mouseY) != NOT_CHOSEN)\n\t\t{\n\t\t\tvMouseMark();\n\t\t}\n\t\telse if (onSamePickToy(mouseX, mouseY))\n\t\t{\n\t\t\tfill(0);\n\t\t\tstroke(0);\t\n\t\t\tline(mouseX - 5, mouseY + 5, mouseX + 5, mouseY - 5);\n\t\t\tline(mouseX + 5, mouseY + 5, mouseX - 5, mouseY - 5);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfill(0);\n\t\t\tstroke(0);\t\n\t\t\tcircle(mouseX, mouseY, 15);\n\t\t}\n\t}\n\telse if (is_re_jump_case)\n\t{\n\t\tstroke(0);\t\n\t\tif (NextToNextStep(mouseX, mouseY) != NOT_CHOSEN)\n\t\t{\n\t\t\txMouseMark();\n\t\t}\n\t\telse if (onSamePickToy(mouseX, mouseY))\n\t\t{\n\t\t\tvMouseMark();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfill(0);\n\t\t\tcircle(mouseX, mouseY, 15);\n\t\t}\n\t}\n\telse\n\t{\t\n\t\tstroke(0);\t\n\t\t// check if toy we can pick\n\t\tif (clickNextToPickToy(mouseX, mouseY) != NOT_CHOSEN)\n\t\t{\n\t\t\txMouseMark();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfill(0);\n\t\t\tcircle(mouseX, mouseY, 15);\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d3fcb0860ffb3a5ca5f1693cbae7c4bb", "score": "0.5544286", "text": "function paint(){\n if ($scope.lastSuggestedName == $scope.name){\n $scope.name = $scope.lastSuggestedName = $scope.getSuggestedNameCallback({componentType: $scope.typeSelected});\n }\n\n $scope.paperSurface.project.clear();\n if ($scope.typeSelected == 'rect'){\n $scope.path = new $scope.paperSurface.Path.Rectangle([$scope.paperSurface.view.size.width/4, $scope.paperSurface.view.size.height/4], [$scope.paperSurface.view.size.width/2, 80]);\n $scope.path.strokeColor = 'black';\n }\n else if ($scope.typeSelected == 'circle'){\n $scope.path = new $scope.paperSurface.Path.Circle([$scope.paperSurface.view.size.width/2, $scope.paperSurface.view.size.height/2], 45);\n $scope.path.strokeColor = 'black';\n }\n $scope.paperSurface.project.activeLayer.addChild($scope.path);\n }", "title": "" }, { "docid": "6675d8311e7c018831ee5d9113ab9554", "score": "0.5542111", "text": "function onLayerSelected(value){\n onUpdate({\n question: 'layer',\n type: 'layer',\n value,\n isSketch: value === sketchLayerId,\n ...layer\n });\n setSelectedLayer(value);\n }", "title": "" }, { "docid": "c5c80df08b96a006de14caf85baab42e", "score": "0.5541427", "text": "function unusedSelCancel() {\r\n\r\n drawStep(CurStepObj);\r\n}", "title": "" }, { "docid": "49dcebf1822c24d8bc8c167ec5e192fe", "score": "0.55400264", "text": "function selecting() {\n // Don't do anything if user not in SELECTING mode\n if (mode.value() !== \"SELECTING\" && mode.value() !== \"FIRSTSELECTING\") {\n return;\n }\n mode.value(\"SORTING\");\n av.umsg(interpret(\"av_c6\"));\n exer.gradeableStep(); // mark this as a gradeable step;\n // also handles continuous feedback\n }", "title": "" }, { "docid": "d8f6c56cebedd8e41660ece5ad34f896", "score": "0.55381835", "text": "function activateColorPicking(){\n\tenablePick = true;\n\tvar bt = getId('brush');\n\tbt.disabled = true;\n\tbt = getId('drawpath');\n\tbt.disabled = true;\n\tresetDrawtool();\n}", "title": "" }, { "docid": "f9ca62607af52b459ff1652bc23b3357", "score": "0.5533255", "text": "function draw(userSelect, compSelect) {\n userPoints.innerHTML = user\n compPoints.innerHTML = comp\n selectText.innerHTML = `It was a draw! You both chose ${compSelect}`\n if (userSelect === \"Rock\") {\n rock.classList.add('draw-color')\n setTimeout(function () { rock.classList.remove('draw-color') }, 700);\n } else if (userSelect === \"Paper\") {\n paper.classList.add('draw-color')\n setTimeout(function () { paper.classList.remove('draw-color') }, 700);\n } else {\n scissor.classList.add('draw-color')\n setTimeout(function () { scissor.classList.remove('draw-color') }, 700);\n }\n}", "title": "" }, { "docid": "83ad5d95663fb645eeba6c7564b18119", "score": "0.55304015", "text": "function sketchpad_mouseDown() {\n mouseDown=1;\n drawDot(ctx,mouseX,mouseY,pencilThickness, currentColor);\n}", "title": "" }, { "docid": "6535e8cea14e65918cdf3615af276d16", "score": "0.5524684", "text": "selectionSetDidChange() {}", "title": "" }, { "docid": "1444842aa959a76b93c938440b97e1f6", "score": "0.55240077", "text": "onSelection(callback) {\n $('[data-id=class]').on('change', callback);\n $('[data-id=submit-selection]').on('click', callback);\n }", "title": "" }, { "docid": "1fd634d986ac81a5fced7d95bb722c58", "score": "0.55189353", "text": "function expandedShape(){\n if(Object.keys(currentSelection).length > 2){\n noFill()\n stroke(\"rgba(\" + colors.red + \",\" + colors.green + \",\" + colors.blue + \",\" + vol + \")\")\n strokeWeight(3)\n beginShape();\n for(x in currentSelection){\n var sel = currentSelection[x]\n vertex(h+(h*sel[\"vert\"][0]*(fcount/4)), h+(h*sel[\"vert\"][1]*(fcount/4)))\n bezierVertex(h+(h*sel[\"vert\"][2]*(fcount/4)),h+(h*sel[\"vert\"][3]*(fcount/4)),\n h+(h*sel[\"vert\"][4]*(fcount/4)),h+(h*sel[\"vert\"][5]*(fcount/4)),\n h*sel[\"vert\"][6],h*sel[\"vert\"][7])\n }\n endShape(CLOSE);\n }\n}", "title": "" }, { "docid": "3ddf0cbe4e8fa7ddb102090a91d9f0f6", "score": "0.55163133", "text": "onMouseDown(){\n this.inputController.selection.start(this.x, this.y)\n }", "title": "" }, { "docid": "d3e0e3ece4e423ae68864cdb6886ac70", "score": "0.5510593", "text": "function draw(event){\n\t\tif(pressed === true) {\n\t\t\t$(event.target).css('background-color', selectedColor);\n\t\t}\n\t}", "title": "" }, { "docid": "3330a9b88a262abbfd22c407bddb7517", "score": "0.5504728", "text": "hintRightClickPerturbingSelection() {\n this._saveSelection();\n }", "title": "" }, { "docid": "6a72f68668089fa837dbc163a029f4cc", "score": "0.55029297", "text": "function selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tendSelection();\n\t\t\t\t}\n\t\t\t}", "title": "" }, { "docid": "6a72f68668089fa837dbc163a029f4cc", "score": "0.55029297", "text": "function selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tendSelection();\n\t\t\t\t}\n\t\t\t}", "title": "" }, { "docid": "6a72f68668089fa837dbc163a029f4cc", "score": "0.55029297", "text": "function selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tendSelection();\n\t\t\t\t}\n\t\t\t}", "title": "" }, { "docid": "6a72f68668089fa837dbc163a029f4cc", "score": "0.55029297", "text": "function selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tendSelection();\n\t\t\t\t}\n\t\t\t}", "title": "" }, { "docid": "6a72f68668089fa837dbc163a029f4cc", "score": "0.55029297", "text": "function selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tendSelection();\n\t\t\t\t}\n\t\t\t}", "title": "" }, { "docid": "6a72f68668089fa837dbc163a029f4cc", "score": "0.55029297", "text": "function selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tendSelection();\n\t\t\t\t}\n\t\t\t}", "title": "" }, { "docid": "6a72f68668089fa837dbc163a029f4cc", "score": "0.55029297", "text": "function selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tendSelection();\n\t\t\t\t}\n\t\t\t}", "title": "" }, { "docid": "958ad0e1662bae2e52781fabe29bba12", "score": "0.55005616", "text": "mouseUp() {\n this.draw = false;\n }", "title": "" }, { "docid": "fb059a5c6e80698ab033e0d32a0edde1", "score": "0.54971206", "text": "function selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0)\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else\n\t\t\t\t\tendSelection();\n\t\t\t}", "title": "" }, { "docid": "54080da8d2d7b9b340df70ae3db5cbae", "score": "0.5494201", "text": "function drawSelected() {\n\tif (itemSelectedByPlayer == selectionPerson.itemf) {\n\t\tctx.drawImage(selectionPerson.itemf, canvas.width / 100 * 45, -canvas.height/9 + canvas.height/40, canvas.width/10, canvas.height/4);\n\t}\n\telse if (itemSelectedByPlayer == selectionPerson.hat) {\n\t\tctx.drawImage(selectionPerson.hat, canvas.width / 100 * 45, canvas.height/20 + canvas.height/40, canvas.width/10, canvas.height/4);\n\t}\n\telse if (itemSelectedByPlayer == selectionPerson.shirt) {\n\t\tctx.drawImage(selectionPerson.shirt, canvas.width / 100 * 45, -canvas.height/30 + canvas.height/40, canvas.width/10, canvas.height/4);\n\t}\n\telse if (itemSelectedByPlayer == selectionPerson.pants) {\n\t\tctx.drawImage(selectionPerson.pants, canvas.width / 100 * 45, -canvas.height/10 + canvas.height/40, canvas.width/10, canvas.height/4);\n\t}\n\telse if (itemSelectedByPlayer == selectionPerson.shoes) {\n\t\tctx.drawImage(selectionPerson.shoes, canvas.width / 100 * 45, -canvas.height/6 + canvas.height/40, canvas.width/10, canvas.height/4);\n\t}\n\telse if (itemSelectedByPlayer == selectionPerson.itemb) {\n\t\tctx.drawImage(selectionPerson.itemb, canvas.width / 100 * 45, -canvas.height/9 + canvas.height/40, canvas.width/10, canvas.height/4);\n\t}\n\t\n//\tselectArray[0].draw();\n}", "title": "" }, { "docid": "4d88223f112d83694b00ea750baec45b", "score": "0.5488982", "text": "function draw() {\n\n noStroke()\n if(mouseIsPressed) {\n fill(53,88,52)\n circle(mouseX, mouseY, 10)\n }\n\n \n}", "title": "" } ]
8bf0b1f68fb00588e968b7d1293ea19c
Save Session to DB
[ { "docid": "0f8d56450904e7ba3f264f8b003ea9d9", "score": "0.7540738", "text": "async save() {\n let id = this.data.id\n return await db.put(`session:${id}`, this.data)\n }", "title": "" } ]
[ { "docid": "3c1421edb3008b621fadee3415f8dde0", "score": "0.85752803", "text": "saveToDB() {\n\t\t// Saves Session info to state\n\t\tthis.sessionToDB = {\n\t\t\tcourse : this.selectedCourse,\n\t\t\ttime : this.activeSession.time,\n\t\t\tdate : new Date()\n\t\t};\n\t\t// Writes to DB\n\t\tglobal.createSession(this.sessionToDB);\n\t}", "title": "" }, { "docid": "cfbba15462cfb7e76f7d283e1e341962", "score": "0.8016452", "text": "save() {\n\t\t// saveToDB method saves session to to DB\n\t\tthis.saveToDB();\n\t\t// Resets Timer\n\t\tthis.reset();\n\t}", "title": "" }, { "docid": "82eacb7c277202bc9cff571c42adc836", "score": "0.72252923", "text": "function saveSession(callback) {\n\t\t/* jshint validthis:true */\n\t\tvar session = this.req.session;\n\t\tsession.save(function(err) {\n\t\t\tif (err) {\n\t\t\t\tsession = {\n\t\t\t\t\tstatus: 'failure',\n\t\t\t\t\treason: err\n\t\t\t\t};\n\t\t\t}\n\t\t\tcallback(null, session);\n\t\t});\n\t}", "title": "" }, { "docid": "46a4aa6347619498f64b3224cb326051", "score": "0.72105235", "text": "saveSession(session, timeout) {\n LocalStorageHelper.setSession(session);\n LocalStorageHelper.set(LocalStorageHelper.TIMEOUT, timeout);\n Config.session = session;\n Config.timeout = timeout;\n }", "title": "" }, { "docid": "2c588df36f789abd2e600223e00dc9aa", "score": "0.70732236", "text": "function saveSession(data) {\n localStorage.setItem('username', data.username);\n localStorage.setItem('id', data._id);\n localStorage.setItem('authtoken', data._kmd.authtoken);\n userLoggedIn();\n }", "title": "" }, { "docid": "000303030eb5d03b756f627633daa0f2", "score": "0.7050855", "text": "save() {\n var string = JSON.stringify(this[PINGA_SESSION_STATE]);\n\n localStorage.setItem(this.userId, string);\n }", "title": "" }, { "docid": "17b66be32988c6230e8190b077b8deda", "score": "0.6869968", "text": "function save_grading_session (grading_session) {\n if (is_login(req.session)) {\n req.easy_feedback = { // so we can use in the next middleware\n _new_session: grading_session\n };\n return next();\n }\n grading_session.template = predefined_templates()[0].text;\n storage.temp_commit(req.session, grading_session, function (err) {\n if (err) {\n throw err;\n }\n end_request(res.status(201));\n });\n }", "title": "" }, { "docid": "25bc418d052a030afca5c76e595e4761", "score": "0.68610203", "text": "store(data) {\n return store.save(this.SESSION_KEY, data);\n\n }", "title": "" }, { "docid": "d0ecd923c9c4714fb1d6cd8faa128e28", "score": "0.6806508", "text": "async storeSession(identifier, session) {\n let key = this.sessionKey(identifier, formatAuth(session.auth));\n let data = JSON.stringify(session.serialize());\n await this.storage.write(key, data);\n await this.touchSession(identifier, session.auth);\n }", "title": "" }, { "docid": "13d69b92f40181aa6d3d6eb69256a5e8", "score": "0.663934", "text": "function saveSession(userData){\n //Shte zapazim sesiqta v localStorage no moje i v sessionStorage\n //Po princim se pravi s biskvitki\n\n //setvame authtoken\n localStorage.setItem('authtoken', userData._kmd.authtoken);\n \n //setvame username\n localStorage.setItem('username', userData.username);\n\n //setvame Id\n localStorage.setItem('userId', userData._id);\n\n }", "title": "" }, { "docid": "980a4169923886d105b09d1df83de042", "score": "0.6588039", "text": "_maybeSaveSession() {\n if (this.session && this._options.stickySession) {\n saveSession(this.session);\n }\n }", "title": "" }, { "docid": "471f3e0489482f04330243b5a6db0e46", "score": "0.6566103", "text": "function store(session) {\n var defered = $q.defer();\n \n $http({\n method: 'POST',\n url: './Session/session.model.php',\n params: session\n })\n .success(function(response) {\n defered.resolve(response);\n })\n .error(function(err) {\n defered.reject(err);\n })\n \n return defered.promise;\n }", "title": "" }, { "docid": "457c0adb0216de2207bdc851da7e7168", "score": "0.65173864", "text": "function savesessiondata(taid) {\n // Check the id's been sent\n if (taid === undefined || !taid) {\n return false;\n }\n var localtaid = taid;\n // Get the textarea with that ID\n var theta = document.getElementById(localtaid);\n // Check it exists\n if (theta === null) {\n return false;\n }\n // Get the textarea's content\n var tacontent = theta.value;\n // Write it to a session var of that name, just overwrite if it exists\n if (window.sessionStorage) {\n if (!is_ie8) {\n window.sessionStorage.setItem(localtaid, tacontent);\n\n /*var map = createMap(taid);\n if (map.map.length > 0)\n window.sessionStorage.setItem(map.tableId, JSON.stringify(map, null, 2));*/\n var selectors = getSelectors();\n window.sessionStorage.setItem('selectors', JSON.stringify(selectors, null, 2));\n }\n }\n }", "title": "" }, { "docid": "6fbbea1ee7ca47612099d1745869b14d", "score": "0.64873725", "text": "function storeInSession() {\n sessionStorage.setItem(\"dataStorage\", dataObject)\n}", "title": "" }, { "docid": "d158fb0c4013eace60e7bc54a24ec0ff", "score": "0.64695585", "text": "function saveFormData(req, data, cb) {\n if (req.session && sessionStore) {\n if (!req.session.orders) { req.session.orders = {}; }\n req.session.orders[data.order_id] = data;\n sessionStore.set(data.session_id, req.session, function(err) {\n return cb(err);\n });\n }\n else return cb(new Error('No session storage to save form data.'));\n }", "title": "" }, { "docid": "fb35bcdea66c963f7da3cea4fce4bb27", "score": "0.6453803", "text": "function saveSession () {\nGetDate();\nvar data = {'tpid':mypid, 'tdate':d, qansd:0,};\nlocalStorage.setItem('myData', JSON.stringify(data));\n}", "title": "" }, { "docid": "10f5a6382dc72b8cc1dd179833d9a9fe", "score": "0.6435418", "text": "function SaveTestSession () {\nvar tsdata = {'tpid':pid, 'tdate':d, qansd:anscount };\nlocalStorage.setItem('tsData', JSON.stringify(tsdata));\n}", "title": "" }, { "docid": "3142253b76ae17f525d6f1226585bf68", "score": "0.6387281", "text": "function saveSession(session) {\n const hasSessionStorage = 'sessionStorage' in WINDOW;\n if (!hasSessionStorage) {\n return;\n }\n\n try {\n WINDOW.sessionStorage.setItem(REPLAY_SESSION_KEY, JSON.stringify(session));\n } catch (e) {\n // Ignore potential SecurityError exceptions\n }\n}", "title": "" }, { "docid": "fe555ec6711a29c5ea92f9adca2d59b5", "score": "0.6368172", "text": "function createSessionAndPost (req, res, next) {\n models.Sessions.create().then( insertRes => {\n //console.log('INSERTED ROW: ', insertRes);\n console.log('We are in createSessionAndPost');\n return models.Sessions.get({id: insertRes.insertId});\n }).then( record => {\n // adding session to request\n req.session = {hash: record.hash};\n // adding cookie to response\n res.cookies = {shortlyid: {value: record.hash}};\n res.cookie('shortlyid', record.hash);\n console.log('Browser has cookie');\n next();\n });\n}", "title": "" }, { "docid": "e815d74feeebbd60239dc551b508875c", "score": "0.63424444", "text": "function saveNewGameSession() {\n fetch(GAME_SESSION_URL, {method: \"POST\"})\n .then(res => res.json())\n .then(newGameSession => {\n console.log(\"newGameSession from saveNewGameSession()'s POST request: \", newGameSession)\n localStorage.setItem(\"browserGameSessionId\", `${newGameSession.id}`)\n currentGameSession = newGameSession\n console.log(\"currentGameSession: \", currentGameSession)\n drawNewGame()\n })\n}", "title": "" }, { "docid": "0a90f830952b70ea04b07db9f02201e1", "score": "0.6341259", "text": "function saveSession(purchase) {\n if (purchase) {\n service.purchase = purchase;\n try {\n localStorage.setItem(CO_SESSION, JSON.stringify(purchase));\n }\n catch (err) {\n console.log(\"Couldn't save product's data: \" + err);\n }\n } else {\n console.log(\"No product to save to the local storage.\");\n }\n }", "title": "" }, { "docid": "d8c961adfe77d175689c14cafbcd393b", "score": "0.63078016", "text": "function save2SessionStorage(key, value) {\n if (sessionStorage == null) {\n console.log(\"SessionStorage not supported by browser.\");\n } else {\n sessionStorage.setItem(key, value);\n }\n}", "title": "" }, { "docid": "1880ce1106bcf441cd67318d24edbe2d", "score": "0.62956345", "text": "storeNewSession(){\n localStorage.setItem('highScoreHistory', JSON.stringify(this.highScore))\n localStorage.setItem('namesHistory', JSON.stringify(this.names))\n }", "title": "" }, { "docid": "651dc9eb313242ba3ac5672b94c068a7", "score": "0.6246889", "text": "set (sessionId, session, callback) {\n\t\t\tlet now = new Date ();\n\n\t\t\tlet expiration;\n\t\t\tif (session && session.cookie && session.cookie.expires) {\n\t\t\t\texpiration = new Date (session.cookie.expires);\n\t\t\t} else {\n\t\t\t\texpiration = new Date (now.getTime () + this.options.expiration);\n\t\t\t}\n\n\t\t\tlet sessionData = {};\n\t\t\tfor (let key in session) {\n\t\t\t\tif (key === 'cookie') {\n\t\t\t\t\tsessionData [key] = session [key].toJSON ? session [key].toJSON () : session [key];\n\t\t\t\t} else {\n\t\t\t\t\tsessionData [key] = session [key];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tthis.collection.update ({_id: sessionId}, {\n\t\t\t\t$set: { session: sessionData, expiresAt: expiration, createdAt: now }\n\t\t\t}, {multi: false, upsert: true}, (error, numAffected, newDocument) => {\n\t\t\t\tif (!error && numAffected === 0 && !newDocument) {\n\t\t\t\t\terror = new Error (`Failed to set session for ID ${JSON.stringify (sessionId)}`);\n\t\t\t\t}\n\n\t\t\t\tcallback (error);\n\t\t\t});\n\t\t}", "title": "" }, { "docid": "6ec2d362f69be5eadb4715d035eb7797", "score": "0.6219287", "text": "function afterSaving(err){\r\n if(err){console.log(err); res.send(500);}\r\n req.session._id = newUser._id;\r\n req.session.preferred = newUser.preferred;\r\n console.log(newUser._id);\r\n res.send(200);\r\n }", "title": "" }, { "docid": "bea31415e0fe1373ff0484034d8e467c", "score": "0.6216471", "text": "function saveSessionData(key, value) {\n try {\n if (value === null || typeof value === \"undefined\") {\n value = \"\";\n }\n sessionStorage.setItem(key, value.toString());\n }\n catch (e) {\n throw new Models.ApiError(\"Local Storage\", 'We are unable to process your request. This can sometimes be caused by private browsing mode in some browsers.', \"Unable to set local storage key \" + key + \" to value \" + value + \" (err=\" + e + \")\");\n }\n}", "title": "" }, { "docid": "cb677c2480e94735014f200199f10f2e", "score": "0.62088925", "text": "function saveingToSessionAndCookie(req, res, userObject) {\n // create new token\n const token = createToken({ id: userObject.id });\n //adding to cookie\n res.cookie(authCookieName, token);\n res.cookie('_u_i%d%_', encryptCookie(userObject.id));\n if (userObject.roles.includes('Admin'))\n res.cookie('_ro_le_', encryptCookie('Admin'));\n else if (userObject.roles.includes('Moderator'))\n res.cookie('_ro_le_', encryptCookie('Moderator'));\n\n //add to Session cookie!\n req.session.isNoReading = userObject.isNoReading;\n req.session.auth_cookie = token;\n req.session.user = userObject;\n req.session.isAdmin = userObject.roles.includes('Admin');\n req.session.isModerator = userObject.roles.includes('Moderator');\n req.session.save();\n}", "title": "" }, { "docid": "4fb698c66f5db182a590506c1c3ba39a", "score": "0.6206658", "text": "function addSession(session,tab,url,sessionTabs) {\n var db = getDatabase();\n var res = \"\";\n db.transaction(function(tx) {\n //console.debug(\"Adding to sessions db:\" + session + \" \" + url);\n\n var rs = tx.executeSql('INSERT OR REPLACE INTO sessions VALUES (?,?,?,?);', [session,tab,url,sessionTabs]);\n if (rs.rowsAffected > 0) {\n res = \"OK\";\n //console.log (\"Saved to database\");\n } else {\n res = \"Error\";\n //console.log (\"Error saving to database\");\n }\n }\n );\n // The function returns “OK” if it was successful, or “Error” if it wasn't\n return res;\n}", "title": "" }, { "docid": "98d80e0123718aab25adde5bd13264cb", "score": "0.61891526", "text": "async storeInSession(key, value) {\n this.assertNotEmpty(\"key\",key);\n key = this._createKey(key);\n let ttl=REDIS_CONFIG.SESSION_TTL_IN_SECS;\n value=JSON.stringify(value);\n logger.info(\"storeInSession(%s) start\",key)\n await getClient().set(key, value);\n await getClient().expire(key, ttl);\n }", "title": "" }, { "docid": "e23cdc913a9a7f9c019c0f7667bf032b", "score": "0.618538", "text": "function saveSession(todo) {\n // check session storage for existing todos\n let todos;\n if(sessionStorage.getItem('todos') === null) {\n todos = [];\n } else {\n todos = JSON.parse(sessionStorage.getItem('todos'));\n }\n todos.push(todo);\n sessionStorage.setItem('todos', JSON.stringify(todos));\n}", "title": "" }, { "docid": "2b5c13c7c47ef9d24b3f22969661009a", "score": "0.61823666", "text": "function saveAuthInSession (userInfo) {\n sessionStorage.setItem('authToken', userInfo._kmd.authtoken);\n sessionStorage.setItem('userId', userInfo._id);\n sessionStorage.setItem('username', userInfo.username);\n sessionStorage.setItem('name', userInfo.name);\n}", "title": "" }, { "docid": "c9f848bb7b858a4fddb571897c0d0826", "score": "0.6126097", "text": "function saveLocationSession(lastLongitude,lastLatitude){\n window.sessionStorage.setItem(\"lastLongitude\", lastLongitude);\n window.sessionStorage.setItem(\"lastLatitude\", lastLatitude);\n}", "title": "" }, { "docid": "f2b57e3f48848eadcbf372809e94b843", "score": "0.6124168", "text": "function storeSessionData(session, user) {\n return new Promise((resolve, reject) => {\n var sessionRef = db.collection(\"sessions\").doc(session);\n // Atomically add a new region to the \"regions\" array field.\n sessionRef\n .set({\n role: user.role,\n uid: user.uid\n })\n .then(res => {\n resolve({ sessionCookie: session });\n console.log(\"session cookie saved in DB\", res);\n return res;\n })\n .catch(error => {\n utils.handleError(error);\n reject(new Error(\"Unable to store Session. \" + error.message));\n return;\n });\n });\n}", "title": "" }, { "docid": "31d931b01720797eaa80f8509e2472ab", "score": "0.6118236", "text": "function setSession(data){\n sessionid = data\n}", "title": "" }, { "docid": "1f825c9665d4ed19cd8495a146bcfe6b", "score": "0.611399", "text": "function saveSpaceToSessionStorage() {\n let currSpaceID = sessionStorage.getItem(\"Space\");\n var mySpaceJSON = JSON.stringify(mySpace);\n sessionStorage.setItem('mySpaceJSON', mySpaceJSON);\n}", "title": "" }, { "docid": "842c49466d5d411f71628b5b0dc154e7", "score": "0.6102714", "text": "function saveSession(email, t) {\n // Store the token for HTTP requests later\n token = t;\n\n // Store the credentials to the secure vault\n //const vault = await this.getVault();\n return authVault.storeToken(email, serializeMultiToken(token));\n }", "title": "" }, { "docid": "b36ba0aa33cada67d11ba81d16abb751", "score": "0.6089834", "text": "function _store(token) {\n\n\t// Set the session in localStorage\n\tlocalStorage['_session'] = token\n\n\t// Set the session in a cookie\n\tCookies.set('_session', token, 86400, '.' + window.location.hostname, '/');\n}", "title": "" }, { "docid": "c63a2dfd262f58483ee57a5f6260edc9", "score": "0.60866964", "text": "function saveToStorage(key, value){\n sessionStorage.setItem(key, value);\n}", "title": "" }, { "docid": "a6caf66dea3808e29a358eb937c92572", "score": "0.60664", "text": "function saveToSession(data){\n jQuery.ajax({\n dataType: \"json\",\n method: \"POST\",\n data: {'table':JSON.stringify(data)},\n url: \"api/saveTable\"\n });\n}", "title": "" }, { "docid": "8737a0560276f26d953cbc87720d5284", "score": "0.6056614", "text": "async save () {}", "title": "" }, { "docid": "fab8c2670d59477d31f4e72f4d4ba965", "score": "0.6051356", "text": "function storeInSession(key, value) {\n\twindow.sessionStorage.setItem(key, JSON.stringify([value]));\n}", "title": "" }, { "docid": "696719dcbccafe8a76c46967d8caf3e7", "score": "0.6044085", "text": "function commit_grading_session (req, res, next) {\n var to_commit = req.easy_feedback.grading_session;\n if (is_login(req.session)) {\n storage.user.session_update(req.session, req.query.id, to_commit,\n finish_commit);\n } else {\n storage.temp_commit(req.session, to_commit, finish_commit);\n }\n\n function finish_commit (err) {\n if (err) {\n throw err;\n }\n next();\n }\n}", "title": "" }, { "docid": "77ae7a5683457d165e3e69c7ff86d936", "score": "0.604238", "text": "function signUp (data, success, fail ) {\r\n Beaver.create(data, function(data){\r\n if (data) {\r\n Session.create(data, success)\r\n } else{\r\n fail()\r\n }\r\n })\r\n }", "title": "" }, { "docid": "a9bde8b321ab271cee1d49dfdd31f4cc", "score": "0.60264844", "text": "function setSession() {\n let sesObj = {\n \"GUID\": contactID,\n \"username\": contactObj[\"firstname\"],\n \"contactObj\": contactObj,\n \"mortgageList\": mortgageList,\n \"paymentList\": paymentList\n };\n document.cookie = \"user=\" + JSON.stringify(sesObj) + \";\" + \"path=/\";\n\n //window.location.replace(\"/Pages/Account.html\");\n document.location.reload(true);\n}", "title": "" }, { "docid": "66c8fa4f2d62ee85a89573fa92ef2e47", "score": "0.6023701", "text": "function SessionStore() {\n\n}", "title": "" }, { "docid": "e314729d8d18588e15880ac171247175", "score": "0.6007585", "text": "function insertActiveSession(session)\n{\n\tif (!verifyActiveSession(session))\n\t\tconsole.log(\"ERROR: insertActiveSession() - session argument missing fields!\");\n\n\telse\n\t\tinsertRequestOrSession(\"activeSessions\", session);\n}", "title": "" }, { "docid": "c0fb22efe09291bf7310ed5673c1b848", "score": "0.5996546", "text": "function savePassword() {\n if (debugmode) {\n sessionStorage.setItem('password', pwd);\n sessionStorage.setItem('pin', pin);\n }\n}", "title": "" }, { "docid": "7565da279387168c11c53253521b2248", "score": "0.5992879", "text": "async save() {}", "title": "" }, { "docid": "096abed1eaf55245becd9c2661a6e59d", "score": "0.59826064", "text": "function saveKUser() \n{\n var username=\"k\";\n var password=\"k\";\n sessionStorage.setItem(username,password);\n}", "title": "" }, { "docid": "ab12d7d9405555717c61cc47033297f1", "score": "0.59807837", "text": "send() {\n let session = this.session;\n if (!session || !session.isDestroyed) {\n return super.send.apply(this, arguments);\n }\n let sessId = session.id,\n cookieSessionId = storeObj.signId(sessId),\n cookieOpt = getCookieOptions();\n if (session.isDestroyed()) { // if the session is destroyed, we have to remove it.\n cookieOpt.expires = new Date(1); //old expiration\n let delCookie = cookie.serialize(opt.cookieName, cookieSessionId, cookieOpt);\n this._addCookie(delCookie);\n storeObj.destroySession(sessId, (e) => {\n if (e && e.ns !== 'SESSION') logger.warn('Failed to remove session ' + sessId + ' from store.');\n });\n session.clear();\n return super.send.apply(this, arguments);\n }\n if (this[ignoreSave]) {\n return super.send.apply(this, arguments);\n }\n // save it.\n let args = arguments;\n storeObj.saveSession(session, (e, wasSaved) => {\n if (e && e.ns !== 'SESSION') {\n logger.warn(`Failed to store session '${sessId}' to store. [${e.code} - ${e.message}]`);\n }\n if (wasSaved) {\n cookieOpt.expires = new Date(Date.now() + opt.expire * 1000);\n let reqCookie = cookie.serialize(opt.cookieName, cookieSessionId, cookieOpt);\n this._addCookie(reqCookie);\n }\n super.send.apply(this, args);\n });\n }", "title": "" }, { "docid": "4d35e012bda09894e259570b36151931", "score": "0.59796923", "text": "initSession() {\n if (sessionStorage.getItem(\"session\") == null) {\n var session = new Session();\n sessionStorage.setItem(\"session\", JSON.stringify(session));\n }\n }", "title": "" }, { "docid": "f3ec1edc582b6a9609317f6cb9be5178", "score": "0.5975798", "text": "save_notes(req, res){\n req.session.user.notes = req.body.notes;\n return true;\n }", "title": "" }, { "docid": "3544c0caf37ed29fab1fa44babedf4e9", "score": "0.59659106", "text": "function saveCart() {\n sessionStorage.setItem('shoppingCart', JSON.stringify(cart));\n }", "title": "" }, { "docid": "4228f354c92a5b7a326b2497162e7718", "score": "0.59587216", "text": "function saveCart() {\n sessionStorage.setItem('cart', JSON.stringify(cart));\n}", "title": "" }, { "docid": "7fa82a46108092e5d4e5071bfe54eaba", "score": "0.5954967", "text": "function saveCart() {\n sessionStorage.setItem('shoppingCart', JSON.stringify(cart));\n }", "title": "" }, { "docid": "68f85368b37ea86b5b45cbd9d2d2d0fa", "score": "0.59439003", "text": "function sesion(){\n\t\tvar nombre = $(\"#nombre\").val();\n\t\tvar rfc = $(\"#rfc\").val();\n\t\tvar tel = $(\"#tel\").val();\n\t\tvar cel = $(\"#cel\").val();\n\t\tvar email = $(\"#email\").val();\n\t\tvar city = $(\"#city\").val();\n\t\tvar edo = $(\"#edo\").val();\n\t\t\t//LLENAMOS LAS VARIABLES DE SESION CON LOS DATOS\n\t\tsessionStorage.setItem(\"nombre\",nombre);\n\t\tsessionStorage.setItem(\"rfc\",rfc);\n\t\tsessionStorage.setItem(\"tel\",tel);\n\t\tsessionStorage.setItem(\"cel\",cel);\n\t\tsessionStorage.setItem(\"email\",email);\n\t\tsessionStorage.setItem(\"city\",city);\n\t\tsessionStorage.setItem(\"edo\",edo);\n\t}", "title": "" }, { "docid": "b0fa171a02944f8734e4f492b6753903", "score": "0.5940887", "text": "store(){\n this.memory = this.getResult();\n this.local.saveCookie(this.memory);\n }", "title": "" }, { "docid": "c6f721f293654df69dc75157a9ffc7c7", "score": "0.5930102", "text": "function storeToSession(key, value) {\n if (sessionStorage) {\n sessionStorage[key] = value;\n }\n else {\n throw Error(\"Session storage not supported\");\n }\n}", "title": "" }, { "docid": "6086b7454420196ae4ac341a257ac3d6", "score": "0.5926382", "text": "function storeToSession(key, value) {\r\n if (sessionStorage) {\r\n sessionStorage[key] = value;\r\n }\r\n else {\r\n throw Error(\"Session storage not supported\");\r\n }\r\n}", "title": "" }, { "docid": "3c82ec4569d013861017ef8148946799", "score": "0.5925596", "text": "function storeInSession(e) {\n var inputId = e.srcElement.id;\n sessionStorage.setItem(e.srcElement.id, $(\"#\" + inputId).val());\n // console.log(sessionStorage);\n}", "title": "" }, { "docid": "892c4679d379acb4c70e1d26c9c927f9", "score": "0.5916082", "text": "function RegisterAndLoginTheUser(session,data){\n session.destroy();\n session.loggedIn = true;\n session.email = data.email;\n session.name = data.firstName;\n session.level = 1;\n}", "title": "" }, { "docid": "3e9a82990c46aa090aedd28937952d57", "score": "0.59108484", "text": "save() {\n var json = JSON.stringify(this.entities);\n window.localStorage.setItem(this.entitiesStorageKey, json);\n }", "title": "" }, { "docid": "c45a36e2a11767df73566ef898fa19e6", "score": "0.59078497", "text": "function createSession() {\n var sessionNumber = randomSession();\n var datetime = getCurrentDateTime();\n firebase.database().ref('sessions/' + sessionNumber).set({\n active: true,\n tutorID: firebase.auth().currentUser.uid,\n dateCreated: datetime\n }).then(function (json) {\n console.log(\"Successfully created session.\");\n document.location.href = \"arboard.html?session=\" + sessionNumber;\n }).catch(function (error) {\n console.log(\"Error creating session: \" + error);\n });\n}", "title": "" }, { "docid": "0af49973779b4c76597021167b24333f", "score": "0.5905079", "text": "function save(){}", "title": "" }, { "docid": "e762a056d789037bed09eb67839f0782", "score": "0.59039503", "text": "touch (sessionId, session, callback) {\n\t\t\tlet now = new Date ();\n\t\t\tlet update = {\n\t\t\t\tupdatedAt: now\n\t\t\t};\n\n\t\t\tif (session && session.cookie && session.cookie.expires) {\n\t\t\t\tupdate.expiresAt = new Date (session.cookie.expires);\n\t\t\t} else {\n\t\t\t\tupdate.expiresAt = new Date (now.getTime () + this.options.expiration);\n\t\t\t}\n\n\t\t\tthis.collection.update ({_id: sessionId}, {$set: update}, {multi: false, upsert: false}, (error, numAffected) => {\n\t\t\t\tif (!error && numAffected === 0) {\n\t\t\t\t\terror = new Error (`Failed to touch session for ID ${JSON.stringify (sessionId)}`);\n\t\t\t\t}\n\n\t\t\t\tcallback (error);\n\t\t\t});\n\t\t}", "title": "" }, { "docid": "793dd36b161bb88190daac9cd5ad8968", "score": "0.5846342", "text": "function onSessionEnded(sessionEndedRequest, session) {\n const sessionAttributes = session.attributes;\n let sessionPackage;\n if(sessionAttributes.networkName) {\n sessionPackage = {networkName: sessionAttributes.networkName};\n }\n if(sessionAttributes.password) {\n if(sessionPackage){\n sessionPackage = Object.assign(sessionPackage ,{password: sessionAttributes.password});\n } else {\n sessionPackage = {password: sessionAttributes.password};\n }\n \n }\n if (sessionPackage) {\n dataTable().insert({\n userid: session.user.userId,\n Data: JSON.stringify(sessionPackage)\n });\n console.log('Insertion Complete');\n }\n \n \n console.log(sessionPackage);\n console.log(`onSessionEnded requestId=${sessionEndedRequest.requestId}, sessionId=${session.sessionId}`);\n}", "title": "" }, { "docid": "a8565a210fb4cae590d0780e2c203605", "score": "0.5829988", "text": "function signIn (data, success, fail) {\r\n Beaver.findBeaver(data, function(result){\r\n if (result) {\r\n Session.create(result, success)\r\n } else{\r\n fail()\r\n }\r\n })\r\n }", "title": "" }, { "docid": "015ea71416ac96999ebfc5cc00aae708", "score": "0.5829826", "text": "function sessionStorageUser() {\n const data = JSON.stringify(user)\n if (checkForStorage()) {\n sessionStorage.setItem(USER_IDENTITY_KEY, data)\n }\n}", "title": "" }, { "docid": "39db2388d246b4f0a6b68bbbc573b391", "score": "0.5825897", "text": "save()\n\t{\n\t\tthis.dataStorage.setItem(this.id, this.data);\n\t\tthis.settingsStorage.setItem(this.id, this.settings);\n\t}", "title": "" }, { "docid": "89146e9143caf13f97edcadaa65a98af", "score": "0.5809351", "text": "function saveSessionMini() {\r\n // Not connected?\r\n if (!isConnected())\r\n return;\r\n\r\n // Save the actual Jappix Mini DOM\r\n setDB('jappix-mini', 'dom', jQuery('#jappix_mini').html());\r\n setDB('jappix-mini', 'nickname', MINI_NICKNAME);\r\n\r\n // Save the scrollbar position\r\n var scroll_position = '';\r\n var scroll_hash = jQuery('#jappix_mini div.jm_conversation:has(a.jm_pane.jm_clicked)').attr('data-hash');\r\n\r\n if (scroll_hash)\r\n scroll_position = document.getElementById('received-' + scroll_hash).scrollTop + '';\r\n\r\n setDB('jappix-mini', 'scroll', scroll_position);\r\n\r\n // Save the session stamp\r\n setDB('jappix-mini', 'stamp', getTimeStamp());\r\n\r\n // Suspend connection\r\n con.suspend(false);\r\n\r\n handleClose();\r\n\r\n logThis('Jappix Mini session save tool launched.', 3);\r\n}", "title": "" }, { "docid": "b1696ec96e1a5dbe13a18fde17ff3653", "score": "0.58084124", "text": "function MongoSessionStore() {\n\t}", "title": "" }, { "docid": "ec35ad1f1f28379f9ee5add09dce3e9d", "score": "0.57986856", "text": "function writeToSessionStorage(key, value) {\n let storage = window['sessionStorage'];\n if (!storage) {\n console.log('Session storage not available in your browser. Are your cookies disabled?');\n return;\n }\n if (!key || !value) {\n console.log(\"Can't store provided key value pair:\", key, value);\n return;\n }\n storage.setItem(key, value);\n}", "title": "" }, { "docid": "68ec1345b39386809a859b950e7efde5", "score": "0.57959074", "text": "function updateSession() {\n\n\t\t\t\tvar createReq = Titanium.Network.createHTTPClient();\n\t\t\t\tif(Ti.App.localonline === \"local\") {\n\t\t\t\t\tcreateReq.open(\"POST\", \"http://localhost/SmartScan/post_afrekenen.php\");\n\t\t\t\t} else {\n\t\t\t\t\tcreateReq.open(\"POST\", \"http://sofiehendrickx.eu/SmartScan/post_afrekenen.php\");\n\t\t\t\t}\n\n\t\t\t\tvar params = {\n\t\t\t\t\tid : Ti.App.sessionId,\n\t\t\t\t\ttotaal : Ti.App.totaal,\n\t\t\t\t\tnum_products : Ti.App.num_products\n\t\t\t\t};\n\n\t\t\t\tcreateReq.onload = function() {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar json = this.responseText;\n\t\t\t\t\t\tTi.API.info('JSON: ' + json);\n\t\t\t\t\t\tvar response = JSON.parse(json);\n\t\t\t\t\t\tif(response.add === true) {\n\t\t\t\t\t\t\tTi.API.info('Sessie ' + Ti.App.sessionId + ' beëindigd');\n\t\t\t\t\t\t\tSmart.navGroup.open(Smart.ui.createAfrekenenWindow(), {\n\t\t\t\t\t\t\t\tanimated : false\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\talert('U hebt nog geen producten gescand.');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} catch(e) {\n\t\t\t\t\t\talert(e);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\t//Databank niet ok (path, MAMP,...)\n\t\t\t\tcreateReq.onerror = function(e) {\n\t\t\t\t\tTi.API.info(\"TEXT onerror: \" + this.responseText);\n\t\t\t\t\talert('Er is iets mis met de databank.');\n\t\t\t\t};\n\t\t\t\tcreateReq.send(params);\n\t\t\t}", "title": "" }, { "docid": "68ec1345b39386809a859b950e7efde5", "score": "0.57959074", "text": "function updateSession() {\n\n\t\t\t\tvar createReq = Titanium.Network.createHTTPClient();\n\t\t\t\tif(Ti.App.localonline === \"local\") {\n\t\t\t\t\tcreateReq.open(\"POST\", \"http://localhost/SmartScan/post_afrekenen.php\");\n\t\t\t\t} else {\n\t\t\t\t\tcreateReq.open(\"POST\", \"http://sofiehendrickx.eu/SmartScan/post_afrekenen.php\");\n\t\t\t\t}\n\n\t\t\t\tvar params = {\n\t\t\t\t\tid : Ti.App.sessionId,\n\t\t\t\t\ttotaal : Ti.App.totaal,\n\t\t\t\t\tnum_products : Ti.App.num_products\n\t\t\t\t};\n\n\t\t\t\tcreateReq.onload = function() {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar json = this.responseText;\n\t\t\t\t\t\tTi.API.info('JSON: ' + json);\n\t\t\t\t\t\tvar response = JSON.parse(json);\n\t\t\t\t\t\tif(response.add === true) {\n\t\t\t\t\t\t\tTi.API.info('Sessie ' + Ti.App.sessionId + ' beëindigd');\n\t\t\t\t\t\t\tSmart.navGroup.open(Smart.ui.createAfrekenenWindow(), {\n\t\t\t\t\t\t\t\tanimated : false\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\talert('U hebt nog geen producten gescand.');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} catch(e) {\n\t\t\t\t\t\talert(e);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\t//Databank niet ok (path, MAMP,...)\n\t\t\t\tcreateReq.onerror = function(e) {\n\t\t\t\t\tTi.API.info(\"TEXT onerror: \" + this.responseText);\n\t\t\t\t\talert('Er is iets mis met de databank.');\n\t\t\t\t};\n\t\t\t\tcreateReq.send(params);\n\t\t\t}", "title": "" }, { "docid": "5812bf8f880851faa812d93ff2fc5bb3", "score": "0.576931", "text": "function setSessionStorage(data){\n\t\tvar store = $window.sessionStorage;\n\t\tfor(var key in data){\n\t\t\tif(data.hasOwnProperty(key)){\n\t\t\t\tstore.setItem(key, data[key]);\n\t\t\t}\n\t\t}\n\t}", "title": "" }, { "docid": "83679757587578279db760a315a2f7b6", "score": "0.5757235", "text": "session() {\n const {isCodeOrg, identifier, workshopCode, cohortNumber, sessionId} = this.state;\n return Session.create({\n isCodeOrg,\n identifier,\n workshopCode,\n cohortNumber,\n sessionId,\n clientTimestampMs: new Date().getTime(),\n location: window.location.toString()\n });\n }", "title": "" }, { "docid": "b09c61013e919c331cb83646b5c84220", "score": "0.57365304", "text": "function savedatainsession(id){\n\tvar addeduser = \"\";\n\tif(userExistArray.length != 0){\n\t\tfor(var t=0; t<userExistArray.length; t++){\n\t\t\tif(t == 0){\n\t\t\t\taddeduser = userExistArray[t];\n\t\t\t}else{\n\t\t\t\taddeduser += \",\"+ userExistArray[t];\n\t\t\t}\n\t\t}\n\t}\n\t$('#'+id).empty();\n\tcloseDialog(id);\n\tvar sessionid = seletedSessionId.split(\"__\");\n\tvar url = getURL('Console') + \"action=putConsoleInvitation&query={'MAINCONFIG': [{'user': '\"+globalUserName+\"','addeduser': '\"+addeduser+\"','sessionid': '\"+sessionid[1]+\"'}]}\";\n $.ajax({\n url: url,\n dataType: 'html',\n method: 'POST',\n proccessData: false,\n async:false,\n success: function(data) {\n \tdata = $.trim(data);\n\t\t\tgetActiveUser();\n\t\t}\n });\n\n}", "title": "" }, { "docid": "d438f9aa22b756780e04148ae9bfe93a", "score": "0.5732818", "text": "function saveToDatabase() { //TODO - AJAX TO REAL DATABASE\n\tlocalStorage.setItem('db', JSON.stringify(mocked_tasks));\n}", "title": "" }, { "docid": "559a7b9bed26f6890eb4b4798fb6e4a4", "score": "0.57177466", "text": "saveJWTTokenSession(token) {\n sessionStorage.setItem(this.JWT_STORAGE_KEY, JSON.stringify(token));\n }", "title": "" }, { "docid": "8f15d572a99446fd11b73ace83b433b2", "score": "0.5711978", "text": "set_socket_id_to_session(req, res){\n // If there was not socket id set in session\n if(req.session.connected_to_new_room){\n // Update/set the session socket id to be used on each reload\n req.session.socket_id = req.body.id\n\n // Set the room functions controller base id to socket id from session\n // This will help us when user leaves the room so we can remove him from\n // an array\n console.log(`Accessing RMC at ${req.session.id_saved_under}`)\n this.rooms[req.body.room][req.session.id_saved_under].base_id = req.session.socket_id;\n }\n\n if(req.session.user == undefined || req.session.connected_to_new_room){\n // initialize new object that will hold all user data\n const id_for_nickname = req.body.id.substring(req.body.id.indexOf('#', 0) + 1, req.body.id.indexOf('#', 0) + 6)\n\n req.session.user = {\n notes: \"\",\n username: \"User#\" + id_for_nickname\n }\n }\n \n res.send({\n success: true,\n sid: req.session.socket_id,\n user: req.session.user\n })\n }", "title": "" }, { "docid": "a96969777d7a83a18d82682e321cdb81", "score": "0.5711562", "text": "get sessData() {\n return this._sessData || {};\n }", "title": "" }, { "docid": "6f68741feef5a819fca9a402582e81fa", "score": "0.569963", "text": "save() {\n const ctx = this.selectCtx();\n ctx.save();\n }", "title": "" }, { "docid": "fda4475213d9049047e61a05643a366b", "score": "0.5694677", "text": "save () {\n Cookies.set('name', this.name, { expires: this.EXPIRE_DAYS }) \n Cookies.set('email', this.email, { expires: this.EXPIRE_DAYS })\n Cookies.set('url', this.url, { expires: this.EXPIRE_DAYS })\n }", "title": "" }, { "docid": "18f37df23d52f3c44089e2d21d25e789", "score": "0.56943697", "text": "function saveUserId(userId) {\n sessionStorage.setItem('userId', JSON.stringify(userId))\n}", "title": "" }, { "docid": "600cbbda93e2c0b576e73a65c801ad7c", "score": "0.5687543", "text": "function _save() {\n _dropOldEvents(); // remove expired events\n try {\n _storage_service.jStorage = JSON.stringify(_storage);\n // If userData is used as the storage engine, additional\n if (_storage_elm) {\n _storage_elm.setAttribute('jStorage', _storage_service.jStorage);\n _storage_elm.save('jStorage');\n }\n _storage_size = _storage_service.jStorage ? String(_storage_service.jStorage).length : 0;\n } catch (E7) { /* probably cache is full, nothing is saved this way*/ }\n }", "title": "" }, { "docid": "ccf429e9ee9dac50843254ee4c83a4d3", "score": "0.5687323", "text": "function store_id(clicked_id){\n sessionStorage.setItem('idBusiness', clicked_id);\n}", "title": "" }, { "docid": "f843c042d1d2c232bb47a831e86cc835", "score": "0.56804365", "text": "function saveInfos()\n{\n var clientString = JSON.stringify(clientsList);//convert object to string\n sessionStorage.setItem(\"clientInfos\", clientString);\n\n}", "title": "" }, { "docid": "b91f6553331736d305c37347d3ac023b", "score": "0.56775254", "text": "function upsertSession(sessionId, session, callback) {\n const {\n defaultKeyspace,\n tableName\n } = this\n\n cqlsh.execute(`\n INSERT INTO\n ${defaultKeyspace}.${tableName} (\n sid, session\n ) VALUES (?, ?);\n ;`, [sessionId, JSON.stringify(session)]\n ).then((results) => {\n callback && defer(callback)\n }).catch((error) => {\n callback && defer(callback, error)\n })\n}", "title": "" }, { "docid": "90bc9dbb0a0ec26ad070bf0ec55e6c03", "score": "0.56698954", "text": "connect(){\n // add a session\n App.core.use(bodyParser.urlencoded({extended: true}));\n App.core.use(bodyParser.json());\n App.core.use(cookieParser());\n\n // init store\n this.config.store = new sessionStore({\n database: App.db.connection, // there will be stablished connection in lazyLoad mode\n sessionModel: App.db.models.sessions,\n transform: function (data) {\n return data;\n },\n ttl: (60 * 60 * 24),\n autoRemoveInterval: (60 * 60 * 3)\n });\n\n // run session \n App.core.use(session(this.config));\n }", "title": "" }, { "docid": "40b53825254749fd90a824e7f1f84171", "score": "0.5669815", "text": "function saveLoginToken(cookie, sessionId, emailAddress){\n\t\t\tlocalStorage.setItem(\"cookie\", cookie);\n\t\t\tlocalStorage.setItem(\"sessionId\", sessionId);\n\t\t\tlocalStorage.setItem(\"emailAddress\", emailAddress);\n\t\t}", "title": "" }, { "docid": "11a3e4534e51f278e855520ebf9d302e", "score": "0.5656392", "text": "function saveSession(product, photosURLs) {\n if (product) {\n var productWithoutPhotos = $.extend({}, product);\n productWithoutPhotos = Product.removePhotoPaths(productWithoutPhotos);\n productWithoutPhotos = Product.extractData(productWithoutPhotos);\n if (typeof productWithoutPhotos.price == \"string\") {\n productWithoutPhotos.price = parseFloat(productWithoutPhotos.price);\n }\n try {\n localStorage.setItem(AP_SESSION, JSON.stringify(productWithoutPhotos));\n }\n catch (err) {\n console.log(\"Couldn't save product's data: \" + err);\n }\n } else {\n console.log(\"No product to save to the local storage.\");\n }\n }", "title": "" }, { "docid": "b1230d95de9a0ef746c0878f22020a29", "score": "0.564063", "text": "function saveGame() {\n var game = GameService.getGame();\n game.user_id = userInfoService.getUserId();\n\n //Save the game when the user exits\n $.ajax({\n type: \"POST\",\n url: \"https://guarded-earth-8421.herokuapp.com/game\",\n data: game\n });\n }", "title": "" }, { "docid": "8e7974721160f0df744665f9b5ceb5ab", "score": "0.5632963", "text": "_save(storage, key, value) {\n try {\n storage[key] = JSON.stringify(value);\n } catch (err) {\n console.log('Cannot access local/session storage:', err);\n }\n }", "title": "" }, { "docid": "b78130698a430b90935f19ea40769cda", "score": "0.5632896", "text": "async createAuthSession(params) {\n const preparedPayload = prepareModelPayload(\n params,\n AUTH_SESSION_COLUMNS,\n AUTH_SESSION_COLUMNS_MAPPING,\n );\n\n const insertSQL = this.database('auth_sessions').insert(preparedPayload).toString();\n const row = await this.database.getRow(\n `${insertSQL} on conflict (uid) do update set uid = excluded.uid\n returning *, now() as database_time`,\n );\n\n return initObject(row, this);\n }", "title": "" }, { "docid": "e4e72e5ea74e303e5efe7e344e337e36", "score": "0.56183845", "text": "function savePaymentData(paymentData, cb) {\n\n if (!sessionStore) return cb(null, paymentData);\n\n sessionStore.get(paymentData.session_id, function(err, session) {\n var order;\n if (err ||\n !session ||\n !session.orders ||\n !(order = session.orders[paymentData.order_id])) return cb(null, paymentData);\n\n var keys = Object.keys(paymentData);\n keys.forEach(function(key) {\n if (!order[key]) {\n order[key] = paymentData[key];\n }\n });\n\n sessionStore.set(paymentData.session_id, session, function(err){\n if (session.passport && session.passport.user) { order.user = session.passport.user; }\n return cb(null, order);\n });\n });\n }", "title": "" }, { "docid": "e479e5779932da0aed887af56fd1fc4c", "score": "0.56104445", "text": "function Session() {}", "title": "" }, { "docid": "60654e33aef9f718cd2abacc92bbd714", "score": "0.5606943", "text": "function write(obj)\n\t{\n\t\ttry \n\t\t{\n\t\t\tsessionStorage.setItem(key, JSON.stringify(obj));\n\t\t\treturn true;\n\t\t} catch(e) \n\t\t{\n\t\t\treturn false;\n\t\t}\n\t}", "title": "" }, { "docid": "28f312886e4903a6c95c625df97cb064", "score": "0.5601662", "text": "storeOrder(order) {\n this.storeInSession(KEYS.ORDER, order);\n }", "title": "" }, { "docid": "807f99a1d2e4dab662ce64c600ec01bc", "score": "0.55955714", "text": "function setSessionStorage(key, value){\n sessionStorage.setItem(key,JSON.stringify(value));\n}", "title": "" }, { "docid": "1ff4fdc4eba1ac0e23aa4069d73161d7", "score": "0.55844456", "text": "function saveQuantity(id) {\n var quantity = document.getElementById(id).value;\n window.sessionStorage.setItem(id, quantity);\n}", "title": "" } ]
2bad13911889ff5631a5f8d526c5db57
AccessoryInfo is a model class containing a subset of Accessory data relevant to the internal HAP server, such as encryption keys and username. It is persisted to disk.
[ { "docid": "3634adf1b99e91abc4fc5efd0fd22d1b", "score": "0.77590126", "text": "function AccessoryInfo(username) {\n this.username = username;\n this.displayName = \"\";\n this.category = \"\";\n this.pincode = \"\";\n this.signSk = bufferShim.alloc(0);\n this.signPk = bufferShim.alloc(0);\n this.pairedClients = {}; // pairedClients[clientUsername:string] = clientPublicKey:Buffer\n this.configVersion = 1;\n this.configHash = \"\";\n\n this.relayEnabled = false;\n this.relayState = 2;\n this.relayAccessoryID = \"\";\n this.relayAdminID = \"\";\n this.relayPairedControllers = {};\n this.accessoryBagURL = \"\";\n}", "title": "" } ]
[ { "docid": "8ed97ad3ccb7203b273ca335a79a0b09", "score": "0.632364", "text": "updateAccessoryInformation({ accessory, model, serial, firmwareVersion, }) {\n const Characteristic = this.api.hap.Characteristic;\n WiserPlatformPlugin.getOrCreateService(accessory, this.api.hap.Service.AccessoryInformation)\n .setCharacteristic(Characteristic.Manufacturer, 'Drayton')\n .setCharacteristic(Characteristic.Model, model)\n .setCharacteristic(Characteristic.SerialNumber, serial)\n .setCharacteristic(Characteristic.FirmwareRevision, firmwareVersion);\n }", "title": "" }, { "docid": "3005805ab349c72f389189b66ffb89a0", "score": "0.6150844", "text": "function Accessory(name, price, color, imageHref) {\n this.name = name;\n this.price = price;\n this.color = color;\n this.imageHref = imageHref;\n this.toString = function() {\n return this.name + \" - color: \" + this.color + \" - price: \" + this.price;\n }\n}", "title": "" }, { "docid": "3d553ff8d8579580a7682f1f325b2671", "score": "0.58253336", "text": "initAccessory() {\n return new Accessory(this.getName(), this.getUuid(), this.api.hap.Accessory.Categories.AIR_DEHUMIDIFIER);\n }", "title": "" }, { "docid": "134409804fc541e5a1f56543577f95ca", "score": "0.56669664", "text": "initAccessory() {\n return new Accessory(this.getName(), this.getUuid(), this.api.hap.Accessory.Categories.FAN);\n }", "title": "" }, { "docid": "134409804fc541e5a1f56543577f95ca", "score": "0.56669664", "text": "initAccessory() {\n return new Accessory(this.getName(), this.getUuid(), this.api.hap.Accessory.Categories.FAN);\n }", "title": "" }, { "docid": "93d400f04ac4f825c672d5d6e212a786", "score": "0.562868", "text": "get Accessory () {\n return this._platform._homebridge.platformAccessory\n }", "title": "" }, { "docid": "5804b99b9e7530b55bd3fcb277b878f1", "score": "0.55063045", "text": "function DiskInfo() {\n _classCallCheck(this, DiskInfo);\n\n DiskInfo.initialize(this);\n }", "title": "" }, { "docid": "b46d9ee943a7687160cdf67014267a2a", "score": "0.5470199", "text": "function Accessory(devices, context) {\n // debug(\"Accessory\", devices);\n this.aid = devices.aid;\n this.deviceID = context.deviceID;\n this.homebridge = context.homebridge;\n this.id = context.id;\n this.options = context.options;\n this.services = {};\n this.playback = false;\n this.television = false;\n this.link = [];\n devices.services.forEach(function (element) {\n // debug(\"Service\", element);\n switch (element.type.substring(0, 8)) {\n case \"0000003E\": // Accessory Information\n this.info = information(element.characteristics);\n this.name = this.info.Name;\n break;\n default:\n if (!this.info) {\n this.name = \"Unknown\";\n this.info = {};\n this.info.Manufacturer = \"Unknown\";\n this.info.Name = \"Unknown\";\n }\n var service = new Service(element, this);\n // debug(\"New\", service);\n // if (service.service) {\n this.services[service.iid] = service;\n // }\n if (service.playback) {\n this.playback = true;\n }\n // debug(\"New\", service.service);\n if (service.service === \"Television\") {\n // debug(\"Found TV\", service.iid);\n this.television = true;\n }\n if (service.linked) {\n this.link[service.iid] = service.linked;\n }\n }\n }.bind(this));\n // debug(\"Services.setup\", this.name, this.services.length);\n}", "title": "" }, { "docid": "72593d5d37969ea582f9b9aeeb996a79", "score": "0.5153406", "text": "configureAccessory(accessory) {\n this.log(\"Configuring cached accessory [%s]\", accessory.displayName, accessory.context.deviceId, accessory.UUID);\n\n // Set the accessory to reachable if plugin can currently process the accessory,\n // otherwise set to false and update the reachability later by invoking\n // accessory.updateReachability()\n accessory.reachable = true;\n\n this.accessories.set(accessory.UUID, accessory);\n }", "title": "" }, { "docid": "552ccf0ae59598d0eeda6b1c50d23800", "score": "0.50681555", "text": "configureAccessory(platformAccessory) {\n this._addAccessoryFromConfig(\n platformAccessory.context.config,\n platformAccessory\n );\n }", "title": "" }, { "docid": "62b69e8e9182436ee0397ea156a486ca", "score": "0.4998115", "text": "configureAccessory(platformAccessory) {\n this._addAccessoryFromConfig(platformAccessory.context.config, platformAccessory);\n }", "title": "" }, { "docid": "9f1ca19ba005ed1a2d0f0f7b77b10207", "score": "0.48694956", "text": "function AccountBalanceInfo() {\n _classCallCheck(this, AccountBalanceInfo);\n\n AccountBalanceInfo.initialize(this);\n }", "title": "" }, { "docid": "8afc55ce16e9d85ecbb4bb6532edd037", "score": "0.4821529", "text": "function AccountInfo(name, totalBalance, deposit) {\n this.name = name,\n this.totalBalance = totalBalance;\n}", "title": "" }, { "docid": "fa94d62895e752dc98f48bfc9287f915", "score": "0.47710654", "text": "async setUserInfo() {\n const { cookie_client, cookie_server, keyStr } = this.oss;\n let info = await this.reqUserInfo();\n\n if (!info || !info.employee) {\n return this.login();\n }\n const authVal = encode(keyStr, JSON.stringify(info));\n let uuid = this._createUUIDticket();\n setStorage(cookie_client, authVal);\n setCookie(cookie_server, uuid);\n this.linkAuthToUserInfo();\n }", "title": "" }, { "docid": "a4270e5b516f0487beac5c18e332a24b", "score": "0.47599524", "text": "function Accounts_info(account, total_area, total_time, productivity) {\n\tthis.account = account;\n\tthis.total_area = total_area;\n\tthis.total_time = total_time;\n\tthis.productivity = productivity;\n}", "title": "" }, { "docid": "47608aad771ee998decc670601c28952", "score": "0.47597018", "text": "function ISYAccessoryBaseSetup(accessory, log, device) {\n\taccessory.log = msg => log(device.name + \": \" + msg);\n\taccessory.device = device;\n\taccessory.address = device.address;\n\taccessory.name = device.name;\n\taccessory.uuid_base = device.isy.address + \":\" + device.address;\n}", "title": "" }, { "docid": "7b71fa640267b9f5850938c8481e99f1", "score": "0.4745366", "text": "set info(response)\n {\n if (!response) {\n return;\n }\n\n this.store.setItem('info', response);\n }", "title": "" }, { "docid": "699ad3b48060e058b95aa5193736e45d", "score": "0.46441057", "text": "getBasicInfo() {\n return zx_internal.getObjectInfo(this._handle, zx_internal.ZX_INFO_HANDLE_BASIC);\n }", "title": "" }, { "docid": "89ed0491888634ea17b4efbb828410e2", "score": "0.46380576", "text": "function EvohomeDhwAccessory(\n platform,\n log,\n dhwId,\n username,\n password,\n interval_getStatus\n) {\n this.uuid_base = dhwId;\n this.name = platform.name + \" Hot Water\";\n this.displayName = this.name;\n this.platform = platform;\n this.dhwId = dhwId;\n this.log = log;\n this.model = \"domesticHotWater\";\n this.username = username;\n this.password = password;\n this.currentTemperature = -99;\n this.currentState = true;\n\n // Enable logging of temperature\n this.loggingService = new FakeGatoHistoryService(\"thermo\", this, {\n storage: \"fs\",\n });\n\n setInterval(this.periodicCheckStatus.bind(this), interval_getStatus * 1000);\n}", "title": "" }, { "docid": "41b2fa24c9b12f31e4cd6bc537aa0214", "score": "0.46221367", "text": "getInfo() {\n return {\n username: this.username,\n auiID: this.auiID\n };\n }", "title": "" }, { "docid": "ed3cd6757c5543bbb9721525262e37cd", "score": "0.45996934", "text": "function SignInInfo() {\n /**\n * ObjectId formatted session ID\n * @type {String}\n */\n this.sid = undefined;\n /**\n * Roles\n * @type {[String]}\n */\n this.roles = [];\n /**\n * Nick name to be displayed\n * @type {string}\n */\n this.nickname = \"\";\n /**\n * Avatar URL\n * @type {string}\n */\n this.avatar = \"\";\n /**\n * Oauth provider\n * @type {string}\n */\n this.hasLogin = \"\";\n}", "title": "" }, { "docid": "b60007f64781bc9d9393db2df250ccb2", "score": "0.45815223", "text": "get info()\n {\n let info = this.store.getItem('info');\n \n return info ? info : {};\n }", "title": "" }, { "docid": "e77e32b955e090e7ce6c0afa2b4338d6", "score": "0.45649463", "text": "function toggleInfo() {\n UISettingsService.saveInfo(CedarUser.toggleInfo());\n }", "title": "" }, { "docid": "29531dea97917f706d056d0f83de0423", "score": "0.45557436", "text": "get info() {\n return this._info;\n }", "title": "" }, { "docid": "c5b6676bdfc4ac2badd19e68bcc12785", "score": "0.4548917", "text": "async info(opts) {\n if (typeof opts === \"string\") {\n opts = { id: opts };\n }\n\n opts = utils.normalizeKeys(opts);\n opts = utils.defaults(opts, this.consul._defaults);\n\n const req = {\n name: \"acl.legacy.info\",\n path: \"/acl/info/{id}\",\n params: { id: opts.id },\n query: {},\n };\n\n if (!opts.id) {\n throw this.consul._err(errors.Validation(\"id required\"), req);\n }\n\n utils.options(req, opts);\n\n return await this.consul._get(req, utils.bodyItem);\n }", "title": "" }, { "docid": "9ff48c9e3da9883993b8c4e0bef85af2", "score": "0.45365202", "text": "getAccessory(AccessoryID, success) {\n connection.query('select * from Accessories where AccessoryID=?', [AccessoryID], (error, results) => {\n if (error) return console.error(error);\n\n success(results[0]);\n });\n }", "title": "" }, { "docid": "df9c2b31b8a20edfb01e710632d41f78", "score": "0.4529589", "text": "function albumInfo(artist, image, idvalue, imagePath) {\n this.artist = artist\n this.image = image\n this.idvalue = idvalue\n this.imagePath = imagePath\n }", "title": "" }, { "docid": "df9c2b31b8a20edfb01e710632d41f78", "score": "0.4529589", "text": "function albumInfo(artist, image, idvalue, imagePath) {\n this.artist = artist\n this.image = image\n this.idvalue = idvalue\n this.imagePath = imagePath\n }", "title": "" }, { "docid": "7353f75683e62a8d1aa7587cff8c8df4", "score": "0.448787", "text": "function getSeatInfoObject(responseData){\r\n\tif(hasSeatInfo(responseData)){\r\n\t\treturn copy(responseData.seatInfo);\r\n\t}\r\n\treturn null;\r\n}", "title": "" }, { "docid": "005fadaf79a1d33a915bfa91193ce959", "score": "0.44679078", "text": "function AreaInfo(name, gender ,address , educations , professions){\r\n this.name = name;\r\n this.gender = gender;\r\n this.address = address;\r\n this.educations = educations;\r\n this.professions = professions;\r\n}", "title": "" }, { "docid": "c384edeb83424c2d3833cfbe5d98941e", "score": "0.44661543", "text": "function AccountInfo(firstname, lastname, email) {\n this.firstname = firstname;\n this.lastname = lastname;\n this.email = email;\n}", "title": "" }, { "docid": "d738f042e3e4582b2563e0eac0666a8d", "score": "0.44609058", "text": "async createAccessories() {\n const that = this;\n await this.isy.initialize(() => true).then(() => {\n const results = [];\n that.log(`Accessories to configure: ${this.accessoriesToConfigure.size}`);\n const deviceList = that.isy.deviceList;\n this.log.info(`ISY has ${deviceList.size} devices and ${that.isy.sceneList.size} scenes`);\n for (const device of deviceList.values()) {\n const configs = [];\n for (const config of that.config.devices) {\n if (utils_1.isMatch(device, config.filter)) {\n configs.push(config);\n /* \t\tthis.log.debug('Config', JSON.stringify(config, null, '\\t'),\n 'added for device', `${device.name}(${device.displayName})`); */\n }\n }\n this.deviceConfigMap.set(device.address, configs);\n }\n for (const device of that.isy.sceneList.values()) {\n const configs = [];\n for (const config of that.config.devices) {\n if (utils_1.isMatch(device, config.filter)) {\n configs.push(config);\n /* \tthis.log.debug('Config', JSON.stringify(config, null, '\\t'),\n 'added for scene', device.name + '(' + device.displayName + ')'); */\n }\n }\n this.deviceConfigMap.set(device.address, configs);\n }\n for (const device of deviceList.values()) {\n let homeKitDevice = null;\n const garageInfo = that.getGarageEntry(device.address);\n if (!that.shouldIgnore(device) && !device.hidden) {\n if (results.length >= 100) {\n that.log.warn('Skipping any further devices as 100 limit has been reached');\n break;\n }\n this.rename(device);\n if (garageInfo !== null) {\n let relayAddress = device.address.substr(0, device.address.length - 1);\n relayAddress += `2`;\n const relayDevice = that.isy.getDevice(relayAddress);\n homeKitDevice = new ISYGarageDoorAccessory_1.ISYGarageDoorAccessory(device, relayDevice, garageInfo.name, garageInfo.timeToOpen, garageInfo.alternate, this);\n }\n else {\n homeKitDevice = that.createAccessory(device);\n }\n if (homeKitDevice !== null) {\n if (device.address.endsWith('1')) { //Parents only\n results.push(homeKitDevice);\n }\n // if (homeKitDevice instanceof ISYKeypadDimmerAccessory) {\n // results.push(new ISYDimmableAccessory(device as InsteonDimmableDevice, this));\n // \t} Double device load not needed\n // Make sure the device is address to the global map\n // deviceMap[device.address] = homeKitDevice;\n // results.set(id,homeKitDevice);\n }\n else {\n that.log.warn(`Device ${device.displayName} is not supported yet.`);\n }\n }\n }\n for (const scene of this.isy.sceneList.values()) {\n if (!this.shouldIgnore(scene)) {\n results.push(new ISYSceneAccessory_1.ISYSceneAccessory(scene, this));\n }\n }\n if (that.isy.elkEnabled && that.isy.getElkAlarmPanel()) {\n // if (results.size >= 100) {\n // that.logger('Skipping adding Elk Alarm panel as device count already at maximum');\n // }\n const panelDevice = that.isy.getElkAlarmPanel();\n panelDevice.name = that.renameDeviceIfNeeded(panelDevice);\n const panelDeviceHK = new ISYElkAlarmPanelAccessory_1.ISYElkAlarmPanelAccessory(panelDevice, this);\n // deviceMap[panelDevice.address] = panelDeviceHK;\n results.push(panelDeviceHK);\n }\n that.log.info(`Filtered device list has: ${results.length} devices`);\n for (const homeKitDevice of results) {\n this.accessoriesWrappers.set(homeKitDevice.UUID, homeKitDevice);\n const s = this.accessoriesToConfigure.get(homeKitDevice.UUID);\n if (s !== null && s !== undefined) {\n // that.log(\"Configuring linked accessory\");\n homeKitDevice.configure(s);\n that.accessoriesToConfigure.delete(homeKitDevice.UUID);\n }\n else {\n homeKitDevice.configure();\n this.accessories.push(homeKitDevice.platformAccessory);\n // that.homebridge.registerPlatformAccessories(pluginName, platformName, [homeKitDevice.platformAccessory]);\n this.accessoriesToRegister.push(homeKitDevice.platformAccessory);\n }\n }\n });\n }", "title": "" }, { "docid": "4cd104729b9f625aed24e0ec6f34dcf2", "score": "0.44497877", "text": "function showAttractionInfos() {\r\n // delete old informations from the map\r\n //clearAllMarker();\r\n // add the marks of the scenic area's attractions and the mark for current location\r\n markList = [];\r\n if (cur_scenic_data == null) return;\r\n\r\n for (var i = 0, marker; i < cur_scenic_data.attractions.length; i++) {\r\n // if phone is verified, show the proper mark along purchased state, but if not then show with unpaid state\r\n var img_url = 'resource/image/unpaid.png';\r\n if (bPhoneverified == 1) {\r\n switch (cur_scenic_data.attractions[i].buy_state) {\r\n case 1:\r\n img_url = 'resource/image/test.png';\r\n break;\r\n case 2:\r\n img_url = 'resource/image/paid.png';\r\n break;\r\n }\r\n } else {\r\n if (cur_scenic_data.attractions[i].buy_state == 1) {\r\n img_url = 'resource/image/test.png';\r\n }\r\n }\r\n\r\n marker = new AMap.Marker({\r\n map: map,\r\n icon: img_url,\r\n offset: new AMap.Pixel(-15, -15),\r\n position: cur_scenic_data.attractions[i].position\r\n });\r\n marker.setMap(map);\r\n marker.on('click', markerClick);\r\n\r\n markList.push(marker);\r\n }\r\n\r\n // show mark and circle in current location\r\n location_circle = new AMap.Circle({\r\n map: map,\r\n center: currentLocation, //设置线覆盖物路径\r\n radius: 20,\r\n strokeColor: \"#818de9\", //边框线颜色\r\n strokeOpacity: 0.7, //边框线透明度\r\n strokeWeight: 1, //边框线宽\r\n fillColor: \"#818de9\", //填充色\r\n fillOpacity: 0.35//填充透明度\r\n });\r\n location_circle.setMap(map);\r\n\r\n location_mark = new AMap.Marker({\r\n map: map,\r\n position: currentLocation,\r\n icon: \"resource/image/location.png\",\r\n offset: new AMap.Pixel(-9, -8),\r\n autoRotation: true\r\n });\r\n location_mark.setMap(map);\r\n //location_mark.setzIndex(300);\r\n //location_circle.setzIndex(299);\r\n map.setCenter(cur_scenic_data.position);\r\n map.setZoom(parseInt(cur_scenic_data.zoom) - 1);\r\n if (bCommentaryState == 0) explain_area_control('play');\r\n if (bMovable == 1) {\r\n// showNotification('您当前不在景区内!');\r\n }\r\n}", "title": "" }, { "docid": "6fcb786ea7f590dacc03aa1d009f2040", "score": "0.44250548", "text": "function MetadataInfo() {\n this.type = '';\n this.property = '';\n this.value = '';\n this.info = '';\n }", "title": "" }, { "docid": "4fec377932759133904d3611bf0bb243", "score": "0.4393801", "text": "constructor(key, info) {\n\t this.key = void 0;\n\t this.info = void 0;\n\t this.key = key;\n\t this.info = info;\n\t }", "title": "" }, { "docid": "592af65f0b52442f9c9fcce28a7fbb44", "score": "0.43881893", "text": "function ArtistInfo(data) {\n console.dir(data);\n this._data = Object.freeze({\n oaAnchorId: prop(data, \"oa_anchor_id\"),\n oaArtistId: prop(data, \"oa_artist_id\"),\n musicbrainzGid: prop(data, \"musicbrainz_gid\"),\n requestId: prop(data, \"request_id\"),\n name: prop(data, \"name\"),\n bio: prop(data, \"bio.media.0.data.text\") || prop(data, \"bio\"),\n coverPhoto: prop(data, \"cover_photo.0.media\") || prop(data, \"cover_photo\"),\n factCard: prop(data, \"fact_card.media.0.data\") || prop(data, \"fact_card\"),\n profilePhoto: new MediaCollection(prop(data, \"profile_photo.media\") || prop(data, \"profile_photo\")),\n //artistImages: new ParticleCollection(prop(data, \"artist_images\")),\n styleTags: prop(data, \"style_tags.media.0.data.tags\") || prop(data, \"style_tags\")\n });\n}", "title": "" }, { "docid": "2586814e49a20a45d1a5eed55821a30b", "score": "0.43855116", "text": "function _createOSDDetails(data) {\n var temp = {};\n\n temp.host = data.hostname;\n temp.utilisation = \"m_50%\";\n temp.weight = data.weight;\n temp.storageProfile = \"m_SSD\";\n temp.pool = \"m_Pool1\";\n temp.devicePath = \"m_host1:/dev/disk/pci-0005:00-sas\";\n temp.name = \"OSD.\" + data.osd;\n temp.state = data.state;\n temp.uuid = data.uuid;\n\n temp.journal = {};\n temp.journal.devicePath = \"m_host1:/var/lib/ceph/osd/ceph-9/journal\";\n temp.journal.capacity = \"m_32\";\n\n temp.domain = {};\n temp.domain.dataCenter = \"m_DC1\";\n temp.domain.room = \"m_Server-room\";\n temp.domain.rack = \"m_Rack1\";\n temp.domain.chasis = \"m_Chasis1\";\n temp.domain.host = data.hostname;\n\n return temp;\n }", "title": "" }, { "docid": "943fb8c475ed2ceafd0ceb5084822c1c", "score": "0.43515903", "text": "getAccessoryStatuses(success) {\n connection.query('select * from AccessoryStatus', (error, results) => {\n if (error) return console.error(error);\n\n success(results);\n });\n }", "title": "" }, { "docid": "ae801075db73eb162e7b9bed37ce942e", "score": "0.4347839", "text": "function infoMode(title){\r\n // initializing an array of an object\r\n let info = {};\r\n // reading and parsing the info file\r\n let lines = readFile(title, \"info.txt\");\r\n // appending fieldname along with its corresponding value\r\n info[\"title\"] = lines[0];\r\n info[\"author\"] = lines[1];\r\n info[\"stars\"] = lines[2];\r\n\r\n return info;\r\n}", "title": "" }, { "docid": "65970c47e32e4ee285d60a75fcab6db4", "score": "0.43136597", "text": "getAccessory(id)\n\t{\n\t\tif(id != null)\n\t\t{\n\t\t\tfor(var i = 0; i < accessories.length; i++)\n\t\t\t{\n\t\t\t\tif(accessories[i].id == id)\n\t\t\t\t{\n\t\t\t\t\treturn accessories[i];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}", "title": "" }, { "docid": "277b8d3d3ccc901f49197c6e1b5e3872", "score": "0.42926386", "text": "deviceInfo(successCallback, errorCallback) {\n try {\n let _self = this;\n this.communication.sendEncrypted('{ \"device\" : \"info\" }', function(response) {\n if (response.device) {\n _self.state.seeded = response.device.seeded;\n _self.name = response.device.name;\n successCallback(response);\n } else {\n errorCallback(response);\n }\n });\n } catch (e) {\n errorCallback(e);\n }\n }", "title": "" }, { "docid": "75fa209956238436a4b1223405d834a2", "score": "0.42900193", "text": "function onInfo(confUuid, info) {\n localStorage.setItem(confUuid+\"info\", JSON.stringify(info));\n}", "title": "" }, { "docid": "2bd43e88b9b56868d72752296b873890", "score": "0.4273255", "text": "function getDashboardInfo() {\n // Obtener datos desde un servidor\n fetch(\"https://cdn.rawgit.com/jesusmartinoza/Fuse-Workshop/9731ceb3/raw_api.json\")\n .then(function(response) {\n // Devuelve la respuesta con Headers\n return response.json(); // Parsear el body a JSON\n })\n .then(function(response) {\n books.clear();\n if(response.success) {\n books.addAll(response.data.popular);\n activities.addAll(response.data.activities);\n special.addAll(response.data.special);\n }\n })\n}", "title": "" }, { "docid": "c859280e14c7d4d7772b4a6d75d57435", "score": "0.424549", "text": "updateInfo()\n {\n if (this.detached) return;\n\n const player = store.getState().player;\n \n const index = this.inventory.rows.selected;\n const item = player.inventory.items[index];\n \n let infoContent = '';\n if (item) {\n infoContent = `{bold}${item.name}{/bold}\\n`; \n Object.keys(item.attributes).forEach(attr => {\n if (item.attributes[attr])\n infoContent += `\\n${attr}: {cyan-fg}${item.attributes[attr]}{/}`;\n });\n }\n \n this.info.setContent(infoContent);\n this.screen.render();\n }", "title": "" }, { "docid": "8d867a3d5786c3e275dc95a756b8571a", "score": "0.42447448", "text": "function EvohomeThermostatAccessory(\n platform,\n log,\n name,\n device,\n systemId,\n deviceID,\n thermostat,\n temperatureUnit,\n username,\n password,\n interval_setTemperature,\n offsetMinutes\n) {\n this.uuid_base = systemId + \":\" + deviceID;\n this.name = name;\n\n this.displayName = name; // fakegato\n this.device = device;\n this.model = device.modelType;\n this.serial = deviceID;\n this.systemId = systemId;\n\n this.deviceID = deviceID;\n\n this.thermostat = thermostat;\n this.temperatureUnit = temperatureUnit;\n\n this.platform = platform;\n this.username = username;\n this.password = password;\n\n this.log = log;\n\n this.loggingService = new FakeGatoHistoryService(\"thermo\", this, {\n storage: \"fs\",\n });\n\n this.targetTemperateToSet = -1;\n\n this.offsetMinutes = offsetMinutes;\n\n setInterval(\n this.periodicCheckSetTemperature.bind(this),\n interval_setTemperature * 1000\n );\n}", "title": "" }, { "docid": "e5649a7126cec376a16017442800abda", "score": "0.42447406", "text": "accessories(callback) {\n\t\tvar that = this;\n\t\tthis.isy.initialize(() => {\n\t\t\tvar results = [];\n\t\t\tvar deviceList = that.isy.getDeviceList();\n\t\t\tfor (var device of deviceList) {\n\t\t\t\tvar homeKitDevice = null;\n\t\t\t\tvar garageInfo = that.getGarageEntry(device.address);\n\t\t\t\tif (!that.shouldIgnore(device)) {\n\t\t\t\t\tif (results.length >= 100) {\n\t\t\t\t\t\tthat.logger(\"ISYPLATFORM: Skipping any further devices as 100 limit has been reached\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdevice.name = that.renameDeviceIfNeeded(device);\n\t\t\t\t\tif (garageInfo != null) {\n\t\t\t\t\t\tlet relayAddress = device.address.substr(0, device.address.length - 1);\n\t\t\t\t\t\trelayAddress += \"2\";\n\t\t\t\t\t\tvar relayDevice = that.isy.getDevice(relayAddress);\n\t\t\t\t\t\thomeKitDevice = new ISYGarageDoorAccessory(that.logger.bind(that), device, relayDevice, garageInfo.name, garageInfo.timeToOpen, garageInfo.alternate);\n\t\t\t\t\t} else {\n\t\t\t\t\t\thomeKitDevice = this.createAccessory(device);\n\t\t\t\t\t}\n\t\t\t\t\tif (homeKitDevice != null) {\n\t\t\t\t\t\t// Make sure the device is address to the global map\n\t\t\t\t\t\t//deviceMap[device.address] = homeKitDevice;\n\t\t\t\t\t\tresults.push(homeKitDevice);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (that.isy.elkEnabled) {\n\t\t\t\tif (results.length >= 100) {\n\t\t\t\t\tthat.logger(\"ISYPLATFORM: Skipping adding Elk Alarm panel as device count already at maximum\");\n\t\t\t\t} else {\n\t\t\t\t\tvar panelDevice = that.isy.getElkAlarmPanel();\n\t\t\t\t\tpanelDevice.name = that.renameDeviceIfNeeded(panelDevice);\n\t\t\t\t\tvar panelDeviceHK = new ISYElkAlarmPanelAccessory(that.log, panelDevice);\n\t\t\t\t\t//deviceMap[panelDevice.address] = panelDeviceHK;\n\t\t\t\t\tresults.push(panelDeviceHK);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthat.logger(`ISYPLATFORM: Filtered device list has: ${results.length} devices`);\n\t\t\tcallback(results);\n\t\t});\n\t}", "title": "" }, { "docid": "8284718329ace18a31fb1f434b42b1bd", "score": "0.42301175", "text": "function isInfoOpen() {\n return CedarUser.isInfoOpen();\n }", "title": "" }, { "docid": "33e98e9f78c3a4d5abd8f339f45d34ea", "score": "0.42184976", "text": "function showStoreInfo(storeInfo){\n\t\tvar info_div = document.getElementById('info_div');\n\t\tinfo_div.innerHTML = 'Class location: '\n\t\t\t+ storeInfo.name\n + '<br>Ability: ' + storeInfo.ability\n + '<br>Hours: ' + storeInfo.hours;\n\t}", "title": "" }, { "docid": "a13475343c381e86f25b08382de3e6ce", "score": "0.4216049", "text": "function PanasiaInfo(obj) {\n this.id = obj.id\n this.states = obj.states\n this.orderNumber = obj.orderNumber\n this.product = obj.product\n this.country = obj.country\n this.trackerWebsite = panasia.getLink(obj.id)\n}", "title": "" }, { "docid": "29d862726cfe012651eeba5b32f06867", "score": "0.4213813", "text": "instance(data) {\n console.log('## setting up instance of: ApologyDTO object');\n this.apologyID = data.apologyID;\n this.userID = data.userID;\n this.uid = data.uid;\n this.fcmToken = data.fcmToken;\n this.stackTrace = data.stackTrace;\n this.stringDate = data.stringDate;\n this.userMessage = data.userMessage;\n this.date = data.date;\n this.problemResolvedSent = data.problemResolvedSent;\n this.version = data.version;\n this.versionCode = data.versionCode;\n this.device = data.device;\n this.path = data.path;\n }", "title": "" }, { "docid": "b55c657cc13efa2d386a0b34a96a65bb", "score": "0.4208383", "text": "function ofAppInfo( info ){\n\n\tdocument.getElementById( 'info' ).innerText = 'INFO: '+ JSON.stringify( info )\n}", "title": "" }, { "docid": "348de86a4f47a9877dc9cfa62e820317", "score": "0.4207641", "text": "function versionInfoObject() {\n // extract information from the config\n const gitVersion = grunt.config.get('gitinfo');\n const local = gitVersion.local || {};\n const branch = local.branch || {};\n const current = branch.current || {};\n\n return JSON.stringify(\n {\n git: !!current.SHA,\n SHA: current.SHA,\n shortSHA: current.shortSHA,\n date: grunt.template.date(new Date(), 'isoDateTime', true),\n apiVersion: grunt.config.get('pkg').version\n },\n null,\n 4\n );\n }", "title": "" }, { "docid": "a298e3e9248e81e6c347f44636082785", "score": "0.42075977", "text": "function UserInfo(user_number) {\n\tthis.number = user_number;\n\tthis.logon getter = function() {\n\t\tvar u = new User(this.number);\n\t\treturn u.stats.laston_date;\n\t}\n\n\tthis.writeLine = function() {\n\t\tvar u = new User(this.number);\n\n\t\tvar spacer = \" \";\n\t\t\n\t\tvar alias = u.alias + spacer;\n\t\tvar age = \" \\1h\\1k\" + (u.age + spacer).substr(0,3);\n\t\tvar sex = ((u.gender.toUpperCase() == \"M\")?\"\\1n\\1bdude\":\"\\1n\\1mchic\");\n\t\tvar location = \" \\1h\\1b\" + (u.location + spacer).substr(0,24).replace(/([^a-z0-9])/ig,\"\\1n$1\\1h\\1b\");\n\t\tvar laston = (new Date(system.timestr(u.stats.laston_date)));\n\t\tlaston = \" \\1n\\1b\" + laston.formatDate(\"mm\\/dd\\/yy h:nn\").replace(/(\\W)/g,\"\\1h\\1k$1\\1n\\1b\");\n\t\tvar mode = u.connection + spacer;\n\t\n\t\tconsole.print(\"\" +\n\t\t\t\"\\1h \\1n\\1h\" + alias.substr(0,20) +\n\t\t\tage + sex + location +\n\t\t\t\"\\1h\\1b \" + laston +\n\t\t\t\"\\1h\\1k \" + mode.substr(0,6) + \"\\1n\\r\\n\"\n\t\t);\n\n\t}\n}", "title": "" }, { "docid": "29c4b68815dd753e9c2fdc83c88d3f8e", "score": "0.42020512", "text": "function storeServerInfo() {\n\twindow.localStorage.setItem('rn.ts.serverInfo', JSON.stringify(serverInfo));\n}", "title": "" }, { "docid": "241f4ea2740e5f5fcd4b18549b87a5c2", "score": "0.41979167", "text": "toString() {\n const accessKey = this.accessKey !== null\n ? `_${this.accessKey}`\n : '';\n return `${this.type}${this.ownerId}_${this.id}${accessKey}`;\n }", "title": "" }, { "docid": "a26113be79431467ad08fef9172f7a18", "score": "0.41937178", "text": "function IndigoGarageDoorAccessory(platform, deviceURL, json) {\n IndigoAccessory.call(this, platform, deviceURL, json);\n\n var s = this.addService(Service.GarageDoorOpener);\n s.getCharacteristic(Characteristic.CurrentDoorState)\n .on('get', this.getCurrentDoorState.bind(this));\n\n s.getCharacteristic(Characteristic.TargetDoorState)\n .on('get', this.getTargetDoorState.bind(this))\n .on('set', this.setTargetDoorState.bind(this));\n\n s.getCharacteristic(Characteristic.ObstructionDetected)\n .on('get', this.getObstructionDetected.bind(this));\n}", "title": "" }, { "docid": "3155a923fed2a9545271a7dcffc21baf", "score": "0.41865125", "text": "function formatInfo(info) {\n var output = info['name'] + ' (' + info['symbol'] + ')\\n';\n output += ('CoinMarketCap ID: ' + info['id'] + '\\n')\n output += ('CoinMarketCap Rank: ' + info['rank'] + '\\n');\n output += ('https://coinmarketcap.com/currencies/' + info['id'] + '/\\n\\n');\n\n output += ('Price USD: $' + formatNum(info['price_usd']) + '\\n');\n output += ('Price BTC: ' + info['price_btc'] + ' BTC\\n\\n');\n\n output += ('Market Cap: $' + formatNum(info['market_cap_usd']) + '\\n');\n output += ('24h Volume: $' + formatNum(info['24h_volume_usd']) + '\\n');\n output += ('Available Supply: ' + formatNum(info['available_supply']) + '\\n');\n output += ('Total Supply: ' + formatNum(info['total_supply'])+ '\\n');\n if (info['max_supply']) {\n output += ('Maximum Supply: ' + formatNum(info['max_supply']) + '\\n');\n }\n\n output += ('\\nChange 1h: ' + formatNum(info['percent_change_1h']) + '%\\n');\n output += ('Change 24h: ' + formatNum(info['percent_change_24h']) + '%\\n');\n output += ('Change 7d: ' + formatNum(info['percent_change_7d']) + '%\\n\\n');\n\n return output + 'Last Updated: '\n + new Date(parseInt(info['last_updated']) * 1000).toString();\n}", "title": "" }, { "docid": "2f43147f4deb1dc88020e25b89696ea7", "score": "0.4165254", "text": "getAccessoryTypes(success) {\n connection.query('select * from AccessoryTypes', (error, results) => {\n if (error) return console.error(error);\n\n success(results);\n });\n }", "title": "" }, { "docid": "81e23f3eca48618fc9b8e4bc2609f624", "score": "0.41534343", "text": "function getIndustryInfo() {\n\treturn this.industryName + ' ' + this.connectionCount;\n}", "title": "" }, { "docid": "ef2a49e2f36b7d9c154b665006065501", "score": "0.41471714", "text": "createSystemInfo() {\n let systemInfo = new PdfDictionary();\n systemInfo.items.setValue(this.dictionaryProperties.registry, new PdfString('Adobe'));\n systemInfo.items.setValue(this.dictionaryProperties.ordering, new PdfString(this.dictionaryProperties.identity));\n systemInfo.items.setValue(this.dictionaryProperties.supplement, new PdfNumber(0));\n return systemInfo;\n }", "title": "" }, { "docid": "ef2a49e2f36b7d9c154b665006065501", "score": "0.41471714", "text": "createSystemInfo() {\n let systemInfo = new PdfDictionary();\n systemInfo.items.setValue(this.dictionaryProperties.registry, new PdfString('Adobe'));\n systemInfo.items.setValue(this.dictionaryProperties.ordering, new PdfString(this.dictionaryProperties.identity));\n systemInfo.items.setValue(this.dictionaryProperties.supplement, new PdfNumber(0));\n return systemInfo;\n }", "title": "" }, { "docid": "1e2079ad3e6425f8bd0c3f784b11fa34", "score": "0.41249433", "text": "get acl() {\n return this._metadata.acl;\n }", "title": "" }, { "docid": "58d1ac534317105a40e9a60829891fc1", "score": "0.4121585", "text": "info() {\n let info =\n {\n connectionState: this.socket.connectionState(),\n endPointURL: this.socket.endPointURL(),\n hasLogger: this.getHasLogger(),\n isConnected: this.socket.isConnected(),\n nextMessageRef: this.socket.makeRef(),\n protocol: this.socket.protocol()\n }\n\n this.socketSend(\"Info\", info)\n }", "title": "" }, { "docid": "b6cffc6f720a2f8dad32205dc3397340", "score": "0.4112949", "text": "function storeSessionInfo(infoName, value) {\n var key;\n if (that.loginResult === progress.data.Session.LOGIN_SUCCESS &&\n typeof(sessionStorage) === 'object' && _storageKey) {\n\n key = _storageKey;\n if (infoName) {\n key = key + \".\" + infoName;\n }\n if (typeof(value) !== 'undefined') {\n sessionStorage.setItem(key, JSON.stringify(value));\n }\n }\n }", "title": "" }, { "docid": "764ccba0f5dade487f3293dda98d4b94", "score": "0.41086638", "text": "function mangaInfo(manga) {\n var inputClass = \"input-\" + window.s.slugify(manga.title);\n var panelClass = \"panel-\" + window.s.slugify(manga.title);\n var dataChapter = [inputClass, manga.title, manga.id];\n var dataDel = [panelClass, manga.title];\n var title = window.s.titleize(manga.title);\n var photo =\n '<img class=\"activator thumbnail\" src=\"' + manga.thumbnail + '\"</img>';\n var author =\n '<span id=\"author\"> <strong class=\"black-text\">Author:</strong> ' +\n window.s.titleize(manga.author) +\n \"</span><br/>\";\n var status =\n '<span id=\"status\"> <strong class=\"black-text\">Series Status:</strong> ' +\n window.s.humanize(manga.seriesStatus) +\n \"</span>&nbsp;&nbsp;\";\n var userStats =\n '<span id=\"userStats\"> <strong class=\"black-text\">My Status:</strong> ' +\n window.s.humanize(manga.userStatus) +\n \"</span>\";\n var chapter =\n '<span class=\"float-right\"> <strong class=\"black-text\">Current Chapter:' +\n ' </strong> <a class=\"' +\n inputClass +\n '\" href=\"' +\n manga.url +\n '\" target=\"_blank\">' +\n manga.chapter +\n \"</a></span>&nbsp;&nbsp;&nbsp;\";\n var type =\n '<span id=\"type\"> <strong class=\"black-text\">Type:</strong> ' +\n window.s.humanize(manga.type) +\n \"</span><br>\";\n var direction =\n '<span id=\"direction\"><strong class=\"black-text\">Reading Direction:' +\n \"</strong>\" +\n \" \" +\n window.s.titleize(manga.direction) +\n \"</span><br/>\";\n var altName =\n '<span id=\"altName\"> <strong class=\"black-text\">Other Names:</strong> ' +\n window.s.titleize(window.s.toSentence(manga.altName, \", \", \", \")) +\n \"</span><br/><br/>\";\n var categories =\n '<span id=\"categories\"> <strong class=\"black-text\">Categories:</strong> ' +\n window.s.titleize(window.s.toSentence(manga.categories, \", \", \", \")) +\n \"</span>\";\n var plot =\n '<p id=\"plot\"> <strong class=\"black-text\">Plot:</strong> ' +\n window.s.humanize(manga.plot) +\n \"</p><br/><br/>\";\n var addOne =\n '<a class=\"btn tooltipped color-Bp-light\" data-position=\"bottom\" ' +\n 'data-delay=\"50\" data-tooltip=\"Increase Chapter Number by One\" ' +\n \"onclick=\\\"oneUp('\" +\n dataChapter +\n \"')\\\">\" +\n '<i class=\"material-icons\">plus_one</i></a>';\n var del =\n '<a class=\"btn tooltipped color-Bp-light\" data-position=\"bottom\" ' +\n 'data-delay=\"50\" data-tooltip=\"Delete Manga\" onclick=\"delManga(\\'' +\n dataDel +\n '\\')\"><i class=\"material-icons\">delete</i></a>';\n var upd =\n '<a class=\"btn tooltipped color-Bp-light\" data-position=\"bottom\" ' +\n 'data-delay=\"50\" data-tooltip=\"Update Manga Information\" href=\\'/user/' +\n user.toLowerCase() +\n \"/\" +\n encodeURIComponent(manga.title) +\n '\\'\"><i class=\"material-icons\">update</i></a>';\n var buttons =\n '<div class=\"row center-align\">' +\n '<div class=\"input-field.col.s12.m6\">' +\n del +\n addOne +\n upd +\n \"</div></div>\";\n var html =\n '<div class=\"col s12 m6 manga-panel ' +\n panelClass +\n '\"><div class=\"card large\" style=\"overflow: hidden;\"><div ' +\n 'class=\"card-image waves-effect waves-block waves-light ' +\n 'color-Bp-light hoverable activator\">' +\n photo +\n '</div><div class=\"card-content\"> <span class=\"card-title ' +\n 'activator black-text\">' +\n title +\n '<i class=\"material-icons right\">more_vert</i></span> <br>' +\n chapter +\n direction +\n '</div><div class=\"card-action\">' +\n buttons +\n '</div><div class=\"card-reveal\" style=\"display: none; transform:' +\n ' translateY(0px);\"><span class=\"card-title black-text\">' +\n title +\n '<br/><br/><i class=\"material-icons right\">close</i></span> ' +\n altName +\n author +\n status +\n userStats +\n type +\n categories +\n plot +\n \"</div></div></div>\";\n return html;\n}", "title": "" }, { "docid": "e2e7fba3b36aed6aa1bb85149367f395", "score": "0.41012704", "text": "getEntityEntryAccess(internal_name) {\n if (IsString(internal_name, true)) {\n const entryAccess = this.asset.entryAccess.get(internal_name);\n return IsArray(entryAccess, true) ? entryAccess : [];\n }\n }", "title": "" }, { "docid": "ad04f6f044547247ccc9c19b5b9592eb", "score": "0.408937", "text": "function getPhysicalInfo() {\n return rest.one(\"physicalinfo\").get();\n }", "title": "" }, { "docid": "a8442dc6d10dd87cd1baf849bcac7e41", "score": "0.40864298", "text": "setInfoKey(key, object, type) {\n let data;\n if (typeof object === 'string' && !type) {\n // match old behavior where strings encode to raw utf8 as opposed to\n // eosio-abi encoded strings (varuint32 length prefix + utf8 bytes)\n data = eosio.Bytes.from(object, 'utf8');\n }\n else {\n data = eosio.Serializer.encode({ object, type });\n }\n this.setRawInfoKey(key, data);\n }", "title": "" }, { "docid": "5fec7e97580effa0b17df571dd51b270", "score": "0.4081795", "text": "getConfigAccessory(id)\n\t{\n\t\tif(this.config != null && this.config.platforms != null)\n\t\t{\n\t\t\tfor(const i in this.config.platforms)\n\t\t\t{\n\t\t\t\tif(this.config.platforms[i].accessories != null)\n\t\t\t\t{\n\t\t\t\t\tfor(const j in this.config.platforms[i].accessories)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(this.config.platforms[i].accessories[j].id == id)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treturn this.config.platforms[i].accessories[j];\n\t\t\t\t\t\t}\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthis.logger.log('error', 'bridge', 'Bridge', 'Config.json %read_error%!');\n\t\t}\n\n\t\treturn null;\n\t}", "title": "" }, { "docid": "f5e376f6d4bb460ce651017883c9e93a", "score": "0.40812695", "text": "function TrackerInfo(obj) {\n this.attempts = obj.attempts\n this.id = obj.id\n this.states = obj.states\n this.origin = obj.origin,\n this.destiny = obj.destiny\n this.trackerWebsite = exportModule.getLink(this.id)\n}", "title": "" }, { "docid": "e7161cd3d396a47c2b98ae457beed72d", "score": "0.40743953", "text": "getInfo() {\n return {\n name: this.name,\n category: this.category,\n description: `${this.name} is ${this.description}.`,\n image: this.imageSrc,\n price: `€${this.price}`\n };\n }", "title": "" }, { "docid": "340469fa6f8c2b79ce70b4142f3914d7", "score": "0.40717402", "text": "getStorageAccessory(id)\n\t{\n\t\tif(this.storage != null)\n\t\t{\n\t\t\treturn this.storage[id];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// TODO: Log Storage Not Ready\n\t\t}\n\n\t\treturn null;\n\t}", "title": "" }, { "docid": "f7f730f27de4b2b479bdcffee8b9452f", "score": "0.40669212", "text": "function _sessionInfo(){}", "title": "" }, { "docid": "27fe6ea0603432d7b64b39fd2319761d", "score": "0.40638235", "text": "function storeProfileInfo() {\n sessionStorage.setItem(\"user\", JSON.stringify(userProfile));\n }", "title": "" }, { "docid": "05958869a92382f5909b73452b829bc6", "score": "0.4061221", "text": "function createNewMusicInfo()\n{\n\tmusicInfo = {};\n\n\t//Mandatory, just give the player name\n\tmusicInfo.player = null;\n\t//Check player is ready to start doing info checks. ie. it is fully loaded and has the song title\n\t//While false no other info checks will be called\n\tmusicInfo.readyCheck = null;\n\n\tmusicInfo.state = null;\n\tmusicInfo.title = null;\n\tmusicInfo.artist = null;\n\tmusicInfo.album = null;\n\tmusicInfo.cover = null;\n\tmusicInfo.duration = null;\n\tmusicInfo.position = null;\n\tmusicInfo.durationString = null;\n\tmusicInfo.positionString = null;\n\tmusicInfo.volume = null;\n\tmusicInfo.rating = null;\n\tmusicInfo.repeat = null;\n\tmusicInfo.shuffle = null;\n\n\t//Optional, only use if more data parsing needed in the Rainmeter plugin\n\tmusicInfo.trackID = null;\n\tmusicInfo.artistID = null;\n\tmusicInfo.albumID = null;\n\n\t//@TODO Make it possible to define custom update rates?\n\t//@TODO Event based updating?\n\n\treturn musicInfo;\n}", "title": "" }, { "docid": "72945c80602860586d80b247d5a00556", "score": "0.40584895", "text": "function getDataDirectory(info)\n{\n if (process.platform === 'darwin')\n {\n return path.join(process.env.APPDATA || '', 'Library', 'Application Support', info.vendor, info.name);\n }\n else if (process.platform === 'win32')\n {\n return path.join(process.env.APPDATA || '', info.vendor, info.name);\n }\n else\n {\n return path.join(process.env.HOME || '', info.vendor, info.name);\n }\n}", "title": "" }, { "docid": "82eda96f1af3908a365f06f7a91d2d84", "score": "0.40555978", "text": "function getSessionInfo() {\r\n var sessionInfo = {\r\n do_api_token: null,\r\n ssh_key_location: null\r\n }\r\n\r\n return prompt(promptQuestions).then(answers => {\r\n sessionInfo.do_api_token = answers.do_api_token\r\n sessionInfo.ssh_key_location = answers.ssh_key_location\r\n sessionInfo.domain = answers.domain\r\n sshKey = process.env.HOME + '/.ssh/' + sessionInfo.ssh_key_location\r\n client = new DigitalOceanApi({\r\n token: sessionInfo.do_api_token\r\n })\r\n return sessionInfo\r\n }).catch(error => console.log(error))\r\n}", "title": "" }, { "docid": "d52c3b1445302ab997c702bc7e151970", "score": "0.40555775", "text": "async linkAuthToUserInfo() {\n const { demon, cookie_client, cookie_server, keyStr } = this.oss;\n let uuid = getCookie(cookie_server);\n let info = decode(keyStr, getStorage(cookie_client));\n const url = `${demon}/caso/client/principal`;\n await axios.post(url, { id: uuid, principal: info, expire: 60 * 60 * 24 * 30 })\n this.addWatermark();\n }", "title": "" }, { "docid": "e1eaf993724f632ed15d14195c58a016", "score": "0.4045852", "text": "async viewUser (ctx, name, aadharNumber){\n\tconst userKey = ctx.stub.createCompositeKey('org.property-registration-network.userinfo',[name + '-' + aadharNumber]);\n\tlet userDetailsBuffer = await ctx.stub.getState(userKey).catch(err => consloe.log(err));\n\treturn JSON.parse(userDetailsBuffer.toString());\n}", "title": "" }, { "docid": "189c38274a82be03a7ac7a64d2b7684d", "score": "0.40299952", "text": "function getBarcodeInfo() {\n var last_updated = store.get('updated');\n console.log(last_updated);\n var num_records = Object.keys(store.get('barcode_data')).length;\n console.log(num_records);\n document.querySelector(\"#barcode-info-popup\").opened = true;\n document.querySelector(\"#barcodes-count\").textContent = num_records;\n document.querySelector(\"#barcodes-last-updated\").textContent = last_updated;\n return {\n 'last updated': last_updated,\n 'number of barcodes': num_records\n }\n }", "title": "" }, { "docid": "92b12f84d53c342663b831fadbc02f58", "score": "0.40280095", "text": "async getSystemInformation() { \n \n const results = await this.executeSQL(this.StatementLibrary.SQL_SYSTEM_INFORMATION); \n const sysInfo = results[0];\n\n return Object.assign(\n\t super.getSystemInformation()\n\t, {\n sessionUser : sysInfo.SESSION_USER\n , dbName : sysInfo.DATABASE_NAME\n , serverHostName : sysInfo.SERVER_HOST\n , databaseVersion : sysInfo.DATABASE_VERSION\n , serverVendor : sysInfo.SERVER_VENDOR_ID\n , nls_parameters : {\n serverCharacterSet : sysInfo.SERVER_CHARACTER_SET\n , databaseCharacterSet : sysInfo.DATABASE_CHARACTER_SET\n }\n }\n\t)\n }", "title": "" }, { "docid": "a2542fc1217db9ab7f95e4b4ace3114d", "score": "0.40272626", "text": "function PetInfo(breed, hairLength, age) {\n\tthis.breed = breed,\n this.hairLength = hairLength,\n this.age = age\n}", "title": "" }, { "docid": "4a9cb3b25f1009cfb004cd1d1cfad279", "score": "0.4027121", "text": "function addToWishList(accessory) {\n if (localStorage.getItem('accessory1') === null) {\n let accessory1asJson = JSON.stringify(accessory);\n localStorage.setItem('accessory1', accessory1asJson);\n } else if (localStorage.getItem('accessory2') === null) {\n let accessory2asJson = JSON.stringify(accessory);\n localStorage.setItem('accessory2', accessory2asJson);\n } else if (localStorage.getItem('accessory3') === null) {\n let accessory3asJson = JSON.stringify(accessory);\n localStorage.setItem('accessory3', accessory3asJson);\n } else {\n alert(\"Sorry, but your wishlist is full!!\")\n }\n }", "title": "" }, { "docid": "5d1174616ec129fd9c088e3287dbd876", "score": "0.40092686", "text": "registerPlatformAccessory(platformAccessory) {\n this.log.debug('Register Platform Accessory (%s)', platformAccessory.displayName);\n this.api.registerPlatformAccessories('homebridge-tuya-web', 'TuyaWebPlatform', [platformAccessory]);\n }", "title": "" }, { "docid": "2e41c1e0d2d8fef0a6e77a2884286f1c", "score": "0.40080687", "text": "function EntityInfo(obj) {\n const {id, states} = obj\n\n this.id = id\n this.states = states\n\n this.trackerWebsite = tracker.getLink(id)\n}", "title": "" }, { "docid": "185226ac6abca60e7c6068caf873daf8", "score": "0.39941776", "text": "function initializeCharacterInfo() {\n \"use strict\";\n characterInfo = {\n spouse: {\n firstName: \"\",\n lastName: \"Jones\",\n female: \"Felicity\",\n male: \"Felix\",\n neutral: \"Charlie\",\n facebookAccountNumber: \"FB44271\",\n occupation: \"Real Estate Broker\",\n employer: \"Glass Houses Realty\",\n criminalRecord: \"N/A\",\n identityRevealed: true,\n rel: {\n trainer: {\n key: \"spouseToTrainer\",\n assignedVal: null,\n possibilities: [\n \"Your spouse cheats with the trainer\",\n \"Your spouse has unrequited feelings for the trainer\",\n \"The trainer has unrequited feelings for your spouse\",\n \"Your spouse has no special relationship with the trainer\"\n ]\n },\n dogWalker: {\n key: \"spouseToDogWalker\",\n assignedVal: null,\n possibilities: [\n \"Your spouse cheats with the dog walker\",\n \"The dog walker has unrequited feelings for your spouse\",\n \"Your spouse buys weed from the dog walker\",\n \"Your spouse has no special relationship with the dog walker\"\n ]\n },\n friend: {\n key: \"spouseToFriend\",\n assignedVal: null,\n possibilities: [\n \"Your spouse complains about you to the friend\",\n \"Your spouse talks about erotic novels with the friend\"\n ]\n }\n }\n },\n trainer: {\n firstName: \"\",\n lastName: \"Beckham\",\n female: \"Aaliyah\",\n male: \"Arnold\",\n neutral: \"Adrian\",\n facebookAccountNumber: \"FB96233\",\n occupation: \"Personal Fitness Trainer\",\n employer: \"Ab-Solute Fitness\",\n criminalRecord: \"N/A\",\n identityRevealed: false,\n rel: {\n dogWalker: {\n key: \"trainerToDogWalker\",\n assignedVal: 0,\n possibilities: [\n \"The trainer buys weed from the dog walker\",\n \"The trainer gossips about your spouse with the dog walker\"\n ]\n },\n spouseOfFriend: {\n key: \"trainerToSpouseOfFriend\",\n assignedVal: 0,\n possibilities: [\n \"the Trainer has an affair with the friend's spouse\"\n ]\n },\n syndicateEmployee: {\n key: \"trainerToSyndicateEmployee\",\n assignedVal: 0,\n possibilities: [\n \"Trainer mentions spouses to Syndicate Solutions Worker\"\n ]\n },\n bankVP: {\n key: \"trainerToBankVP\",\n assignedVal: 0,\n possibilities: [\n \"Trainer asks BankVP for loan\"\n ]\n }\n }\n },\n dogWalker: {\n firstName: \"\",\n lastName: \"Slaks\",\n male: \"Ralph\",\n female: \"Riya\",\n neutral: \"Riley\",\n facebookAccountNumber: \"FB26934\",\n occupation: \"Dog Walker\",\n employer: \"Neighborhood WatchDogs\",\n criminalRecord: \"Misdemeanor, Marijuana Possesion, 2013\",\n identityRevealed: false,\n rel: {\n friend: {\n key: \"dogWalkerToFriend\",\n assignedVal: null,\n possibilities: [\n \"The dog walker sells weed to the Friend\",\n \"The dog walker sleeps with the friend\"\n ]\n },\n spouseOfFriend: {\n key: \"dogWalkerToSpouseOfFriend\",\n assignedVal: 0,\n possibilities: [\n \"The friend's spouse owes the dog walker money\"\n ]\n },\n drugLord: {\n key: \"dogWalkerToDrugLord\",\n assignedVal: 0,\n possibilities: [\n \"The Dog Walker wants to join the Drug Lord's crew\"\n ]\n }\n }\n },\n friend: {\n firstName: \"\",\n lastName: \"Reynolds\",\n female: \"Samantha\",\n male: \"Samuel\",\n neutral: \"Sam\",\n facebookAccountNumber: \"FB59077\",\n occupation: \"First Grade Teacher\",\n employer: \"Big Brother, Big Sister Elementary\",\n criminalRecord: \"N/A\",\n identityRevealed: false/*,\n rel: {\n }*/\n },\n spouseOfFriend: {\n firstName: \"Jessie\",\n lastName: \"Reynolds\",\n female: \"Jessie\",\n male: \"Jessie\",\n facebookAccountNumber: \"FB83848\",\n occupation: \"Hotel Manager\",\n employer: \"XKey Suites\",\n criminalRecord: \"N/A\",\n identityRevealed: false,\n rel: {\n \n }\n },\n drugLord: {\n firstName: \"Rowan\",\n lastName: \"Nales\",\n female: \"Rowan\",\n male: \"Rowan\",\n facebookAccountNumber: \"FB61023\",\n occupation: \"unknown\",\n employer: \"unknown\",\n criminalRecord: \"Felony, Coccaine Possesion with Intent to Sell, 1997 <br >Suspected Kingpin of Fort Meade Drug Ring\",\n identityRevealed: false,\n rel: {\n \n }\n \n },\n syndicateEmployee: {\n firstName: \"Quinn\",\n lastName: \"Zareth\",\n female: \"Quinn\",\n male: \"Quinn\",\n facebookAccountNumber: \"FB10302\",\n occupation: \"Security Consutlant\",\n employer: \"Syndicate Solutions\",\n criminalRecord: \"N/A\",\n identityRevealed: false,\n rel: {\n nsaBoss: {\n key: \"syndicateEmployeeToNSABoss\",\n assignedVal: 0,\n possibilities: [\n \"The Syndicate Solutions Employee discusses Operation Alexander with your NSA Boss\"\n ]\n },\n hacker: {\n key: \"syndicateEmployeeToHacker\",\n assignedVal: 0,\n possibilities: [\n \"The hacker sends the Drug Lord's client list to the Syndicate Employee\"\n ]\n }\n }\n },\n nsaBoss: {\n firstName: \"Harper\",\n lastName: \"Keithson\",\n female: \"Harper\",\n male: \"Harper\",\n facebookAccountNumber: \"FB35739\",\n occupation: \"Fort Meade Unit Manager\",\n employer: \"National Security Administration\",\n criminalRecord: \"N/A\",\n identityRevealed: false,\n rel: {\n }\n },\n hacker: {\n firstName: \"Trix\",\n lastName: \"Bit\",\n female: \"Trix\",\n male: \"Trix\",\n facebookAccountNumber: \"FB94127\",\n occupation: \"Computer Specialist and Hacker.\",\n employer: \"Freelance contractor at Syndicate Solutions\",\n criminalRecord: \"N/A\",\n identityRevealed: false,\n rel: {\n }\n \n },\n bankVP: {\n firstName: \"Morgan\",\n lastName: \"Hallsworth\",\n female: \"Morgan\",\n male: \"Morgan\",\n facebookAccountNumber: \"FB335570\",\n occupation: \"Vice President\",\n employer: \"PatriotBank\",\n criminalRecord: \"N/A\",\n identityRevealed: false,\n rel: {\n }\n }\n };\n}", "title": "" }, { "docid": "a4e86bac91219c3f2e393d38cc73d86c", "score": "0.39937675", "text": "function get_credit_card_info() {\n AccountModel.getccinfo().then(function (response) {\n self.Getccinfo1 = angular.copy(response.data); \n }, function (error) { \n });\n\n }", "title": "" }, { "docid": "f44be517b8341c6567afe01a2263f412", "score": "0.39916667", "text": "function getUserInfo() {\n if($scope.user.account){\n checkMail();\n // Check for new mail every X number of milliseconds\n mailCheckTimer = setInterval(resetMail, 10000); // 10 seconds\n }\n\n // Check the user's permission level\n if ($scope.user.account && ($scope.user.account == \"Administrator\" ||\n $scope.user.account == \"Region Leader\" ||\n $scope.user.account == \"Chapter Leader\")) {\n $scope.isAdmin = true;\n } else {\n $scope.isAdmin = false;\n }\n }", "title": "" }, { "docid": "42b562ddcc67caf28ba2ab823a3b6ad8", "score": "0.39900294", "text": "saveInfo() {\n for (let key in this.editableTexts) {\n if (this.editableTexts.hasOwnProperty(key)) {\n this.editableTexts[key].save();\n }\n }\n\n this.updateMap();\n this.updateImage();\n this.updateIcon();\n\n console.log(`PUT ${this.recId}`);\n // DatabaseUpdater.putRec(this.rec);\n }", "title": "" }, { "docid": "e3dbccd6817decd0eadd1bcbc75a711b", "score": "0.39895174", "text": "function DeviceInfo(deviceParams) {\n this.viewer = Viewers.CardboardV2;\n this.updateDeviceParams(deviceParams);\n this.distortion = new Distortion(this.viewer.distortionCoefficients);\n}", "title": "" }, { "docid": "7eaae73e788501f40f8da054895712a9", "score": "0.39894915", "text": "async getProfileInfo({ request, response }) {\n try {\n const reqData = await request.all();\n\n // check if caregiver exists or not\n const caregiver = await caregiverService.checkCaregiver(\n reqData.registration_no,\n );\n if (!caregiver) {\n return await util.sendErrorResponse(\n response,\n message.CAREGIVER_NOT_FOUND,\n );\n }\n\n // get caregivers data for profile overview\n const data = await caregiverService.getProfileInfo(caregiver.id);\n\n return util.sendSuccessResponse(response, {\n success: true,\n ...message.SUCCESS,\n data,\n });\n } catch (error) {\n return util.sendErrorResponse(response, { data: error });\n }\n }", "title": "" }, { "docid": "b4f208838eae95de1dde84f7ac294b75", "score": "0.39871058", "text": "function AxisInfo(axis, formulaInfos){\n this.id = axis;\n\n this.formulasInfo = formulaInfos;\n\n this.depth = this.formulasInfo.length;\n\n this.formulas = this.formulasInfo.map(function(formInfo){\n // Overwrite axis id with corresponding AxisInfo instance\n formInfo.axis = this;\n\n return formInfo.formula;\n }, this);\n\n /**\n * Map of axis values to labels.\n */\n this.valueLabel = {};\n }", "title": "" }, { "docid": "bd4c147cb091c90009c1ac08dcd751d1", "score": "0.39869347", "text": "function ProviderData() { }", "title": "" }, { "docid": "bd4c147cb091c90009c1ac08dcd751d1", "score": "0.39869347", "text": "function ProviderData() { }", "title": "" }, { "docid": "bd4c147cb091c90009c1ac08dcd751d1", "score": "0.39869347", "text": "function ProviderData() { }", "title": "" }, { "docid": "bd4c147cb091c90009c1ac08dcd751d1", "score": "0.39869347", "text": "function ProviderData() { }", "title": "" }, { "docid": "ff864ae8675ae9e9db2bd69151b7914f", "score": "0.3983245", "text": "async getUserInfoFromServer({ commit, state }, callback) {\n let userEmail = { useremail: state.email }\n await accountApi.getUserInfo(userEmail, res => {\n let mode\n mode = res.data.length === 0 ? __C.FORM.EDIT_MODE_NEW : __C.FORM.EDIT_MODE_READ\n if (callback) callback(mode)\n if (res.data.length === 0) return\n let formattedObj = __F.obj2Lowercase(res.data)\n commit('setIdx', formattedObj.id)\n state.userInfo = formattedObj\n })\n }", "title": "" }, { "docid": "9c714f88fd9c83978f566d1aee52eff0", "score": "0.3982734", "text": "function createInfo(info) {\n document.getElementById('empty').innerHTML = '';\n\n var header = document.createElement('div');\n var avatar = document.createElement('img');\n var personalInfo = document.createElement('div');\n var username = document.createElement('div');\n var fullname = document.createElement('div');\n var bio = document.createElement('div');\n\n header.setAttribute('class', 'header');\n avatar.setAttribute('src', info.avatar_url);\n avatar.setAttribute('class', 'avatar');\n personalInfo.setAttribute('class', 'personalInfo');\n username.setAttribute('class', 'username');\n fullname.setAttribute('class', 'fullname');\n bio.setAttribute('class', 'bio');\n\n username.innerHTML = '@' + info.login;\n fullname.innerHTML = info.name;\n bio.innerHTML = info.bio;\n\n personalInfo.append(username, fullname, bio);\n header.append(avatar, personalInfo);\n\n document.getElementById('empty').append(header);\n\n validate(info.login, username, '@username');\n validate(info.name, fullname, 'Full Name');\n validate(info.bio, bio, 'This user has no bio...');\n}", "title": "" }, { "docid": "96ac31fb0cebfe3428c07a92228fbc72", "score": "0.39771456", "text": "function buildApplicationInfoReport(data){\n\t\t\n\t\tvar vm = new ViewMode(reportItem, 140, 'Session Info:', 'reportTitle');\n\t\treportItem.appendChild(CreateSeperator());\n\t\tvar tl = new TransitionList(reportItem, '100%', false, 'fxPressAwayFAST', '', 400, 'transitionListItemContainer', null, null);\n\t\t\n\t\tif(data.generalInfo){\n\t\t\tvm.add('sessionOverview_appInfo', 'Session Info', function () { tl.switchTo('sessionOverview_appInfoPage'); });\n\t\t\tvar page1 = tl.addReportToList('sessionOverview_appInfoPage');\n\t\t\tpage1.appendChild(createGeneralInfoSection(data.generalInfo, null, data.rerunCommand, data.platformInfo));\n\t\t}\n\t\t\n\t\tif(data.output){\n\t\t\tvm.add('sessionOverview_appOutput', 'Application Output', function () { tl.switchTo('sessionOverview_appOutputPage'); });\n\t\t\tvar page2 = tl.addReportToList('sessionOverview_appOutputPage');\n\t\t\tpage2.appendChild(createApplicationOutputSection(data.output));\n\t\t}\n\t\t\n\t\tif(data.KDFSessionInfo){\n\t\t\tvm.add('sessionOverview_KDFInfo', 'Session Info', function () { tl.switchTo('sessionOverview_KDFInfoPage'); });\n\t\t\tvar page3 = tl.addReportToList('sessionOverview_KDFInfoPage');\n\t\t\tpage3.appendChild(createGeneralInfoSection(data.generalInfo, data.KDFSessionInfo, data.rerunCommand, data.platformInfo));\n\t\t}\n\t\t\n\t\tif(data.sourceCode != null){\n\t\t\tvm.add('sessionOverview_source', 'Kernel Code', function () { tl.switchTo('sessionOverview_sourcePage'); });\n\t\t\tvar page4 = tl.addReportToList('sessionOverview_sourcePage');\n\t\t\tcreateSourceCodeViewer(data.sourceCode, page4);\n\t\t}\n\t\t\n\t}", "title": "" }, { "docid": "1603d76d7e063411a35ae22c03408009", "score": "0.39766482", "text": "function Info(){\n\t\tthis.titre = \"\";\n\t\tthis.contenu = \"\";\n\t}", "title": "" } ]
05d62bf0360173974dd4008e1e1a7f48
Initializes the currencies with values from the api
[ { "docid": "d229cfe46677e89ffb87674c41187aba", "score": "0.5948339", "text": "async componentDidMount() {\n const fetchedCurrencies = await getCurrencies()\n this.setState({ currencies: fetchedCurrencies })\n }", "title": "" } ]
[ { "docid": "835f4223306ae984aefaa8c12fd34fb7", "score": "0.76618624", "text": "function initialize(){\n request('https://coinbase.com/api/v1/currencies/exchange_rates/', function (error, response, body) {\n if (!error && response.statusCode == 200) {\n exchange_rates = JSON.parse(body);\n }\n });\n}", "title": "" }, { "docid": "207cfc87f3f320af6db86f46dc1e34fe", "score": "0.73016", "text": "constructor() { \n \n Currency.initialize(this);\n }", "title": "" }, { "docid": "e92ec17e94ba9b7a1cf6493c20f322b9", "score": "0.71664", "text": "setCurrencies() {\n game.itempiles.API.setCurrencies(this.#getCurrenciesConfig())\n }", "title": "" }, { "docid": "2e69b120605a679ed393566509288052", "score": "0.6970709", "text": "constructor() { \n Currency.initialize(this);\n CurrencyExchange.initialize(this);\n }", "title": "" }, { "docid": "cfcada8b84e3a568bcd77f77b42c038d", "score": "0.69375926", "text": "constructor() { \n \n CurrencyExchange.initialize(this);\n }", "title": "" }, { "docid": "5926c7566814044adae5ae8479b7b773", "score": "0.69331044", "text": "function setupCurrencyData(currencyData) {\r\n if(currencyData) {\r\n try {\r\n currencyJSONData = JSON.parse(currencyData);\r\n rates = currencyJSONData.rates;\r\n var baseCurrency = currencyJSONData.base;\r\n //base currency is 1\r\n rates[baseCurrency] = 1;\r\n } catch(e) {\r\n console.log(e);\r\n }\r\n }\r\n}", "title": "" }, { "docid": "881dbe9482974f8fadf604933d884438", "score": "0.6822887", "text": "constructor() {\n \"ngInject\";\n this.qty = 1;\n this.cost = 2;\n this.inCurr = 'EUR';\n this.currencies = ['USD', 'EUR', 'CNY'];\n this.usdToForeignRates = {\n USD: 1,\n EUR: 0.74,\n CNY: 6.09\n };\n }", "title": "" }, { "docid": "584b1258eb981479a260d76ce4bf0f80", "score": "0.66893727", "text": "fetchCurrencies(currencyNames){\n fetch('https://api.exchangeratesapi.io/latest')\n .then(res => res.json())\n .then(data => {\n this.setState({\n currencyData : [...Object.keys(data.rates), data.base].map(currencyCode=>{\n var object = {};\n object.key = currencyCode;\n if(currencyNames!=null && currencyNames[currencyCode] != null){\n object.name = currencyNames[currencyCode];\n }\n else{\n object.name = currencyCode;\n }\n if(data.rates[currencyCode] != undefined){\n object.rate = data.rates[currencyCode]\n } else{\n object.rate = 1;\n }\n return object;\n })\n });\n });\n }", "title": "" }, { "docid": "53b86bb81a0b7ef2a2f49bf81affc5fe", "score": "0.6681046", "text": "getCurrencies() {\n return Api().get('/currencies');\n }", "title": "" }, { "docid": "c6439120b4c79996ae3b31eaf7362a8b", "score": "0.6656616", "text": "async getCurrencyAPI() {\n const url = `https://min-api.cryptocompare.com/data/all/coinlist?api_key=${this.apikey}`\n\n // Fetch to api\n const getUrlCurruency = await fetch(url)\n\n // Response in JSON\n const currencies = await getUrlCurruency.json()\n return {\n currencies\n }\n }", "title": "" }, { "docid": "49e8c123405a2d3e59fe05ac4cc400a0", "score": "0.6483157", "text": "async getCurrencies() {\n let url = this.#endpoints.currencies;\n let payload = {\n accessToken: this.apiKey\n }\n let config = {\n method: \"post\",\n body: JSON.stringify(payload)\n };\n\n return this.#request(url, config)\n .then(response => {\n if (response.success) {\n return response\n } \n throw Error(response.message)\n })\n .catch(err => { throw Error(err.message) });\n }", "title": "" }, { "docid": "06614b9debac7dbbe2955bb22da0147f", "score": "0.6466686", "text": "function getCurrencyOptions() {\n let apiURL = 'https://api.coingecko.com/api/v3/simple/supported_vs_currencies'\n fetch(apiURL)\n .then(response => response.json())\n .then(data => {\n $('#currencies').autocomplete({\n source: data\n });\n });\n }", "title": "" }, { "docid": "31b185673a09881f5479063da4633d7e", "score": "0.64195764", "text": "function caclulate() {\n const currency_one = currencyEl_one.value;\n const currency_two = currencyEl_two.value;\n\n //https://cors-anywhere.herokuapp.com/\n fetch(`https://api.exchangerate-api.com/v4/latest/${currency_one}`)\n .then(res => res.json())\n .then(data => {\n // console.log(data);\n const rate = data.rates[currency_two];\n rateEl.innerText = `1 ${currency_one} = ${rate} ${currency_two}`;\n amountEl_two.value = (amountEl_one.value * rate).toFixed(2);\n });\n}", "title": "" }, { "docid": "305eddc8f547f4f606ec522f1bf4ca98", "score": "0.64122814", "text": "componentDidMount() {\n axios\n .get(\"https://api.exchangeratesapi.io/latest\")\n .then(response => {\n const currencyAr = [\"EUR\"];\n for (const key in response.data.rates) {\n currencyAr.push({value:key});\n }\n this.setState({ currencies: currencyAr, pCurrencies: response.data.rates});\n })\n .catch(err => {\n console.log(\"oppps\", err);\n });\n }", "title": "" }, { "docid": "92e123b212f3a4d57d990ac8ee44e005", "score": "0.63931763", "text": "currencies() {\n return this.getCurrenciesV1()\n .catch((err) => {\n console.error(\"Error in 'currencies' method of nomics module\\n\" + err);\n throw new Error(err);\n });\n }", "title": "" }, { "docid": "1f56f13346b789fdf1cc67b0df5e7e60", "score": "0.63814", "text": "getAllRates() {\r\n axios.get(`https://api.exchangeratesapi.io/latest?base=${this.baseCurrency}`)\r\n .then((resp) => {\r\n this.dispatchBaseRates(resp.data.rates);\r\n })\r\n .catch((error) => console.error(error))\r\n }", "title": "" }, { "docid": "67de15548b5ce9b88831293f6e31db62", "score": "0.6287611", "text": "function loadRates() {\n return coinmarketcap.ticker(\"\", \"\").then((input) => {\n var result = {};\n input.forEach((item) => {\n result[item.symbol.replace(/[^\\w\\s]/gi, '_')] = item.percent_change_7d;\n });\n return result;\n }); \n}", "title": "" }, { "docid": "31b40c13d511cb66d959aeecd0263124", "score": "0.6284654", "text": "componentDidMount() {\n\n let url = \"http://data.fixer.io/api/latest?access_key=91621b72535926c5dfb7205215e2436d\";\n\n axios\n .get(url)\n .then(response => {\n // Initialized with 'EUR' because the base currency is 'EUR'\n // and it is not included in the response\n\n console.log(response);\n\n const currencyAr = [\"EUR\"]\n for (const key in response.data.rates) {\n currencyAr.push(key)\n }\n this.setState({ currencies: currencyAr.sort() })\n })\n .catch(err => {\n console.log(\"Opps\", err.message);\n });\n }", "title": "" }, { "docid": "326fd93a1ecd31037d1f720c2a2b5ee4", "score": "0.6282512", "text": "function caclulate() {\n const currency_one = currencyEl_one.value;\n const currency_two = currencyEl_two.value;\n\n // // test fetch with dummy data in the items.json.\n // // Here we use the fetch GET method to get data from items.json.\n // // fetch also have post, put/patch, delete methods.\n // fetch('items.json')\n // // this step can only get a Response, not the actual data.\n // // .then(res => console.log(res))\n // // because with fetch api, in order to get he actual data, we need to format it to what we want.\n // // so in here we need to format it to json with res.json()\n // .then(res => res.json())\n // .then(data => (document.body.innerHTML = data[0].text));\n fetch(`https://api.exchangerate-api.com/v4/latest/${currency_one}`)\n .then(res => res.json())\n .then(data => {\n // console.log(data);\n const rate = data.rates[currency_two];\n\n rateEl.innerText = `1 ${currency_one} = ${rate} ${currency_two}`;\n\n amountEl_two.value = (amountEl_one.value * rate).toFixed(2);\n });\n}", "title": "" }, { "docid": "055c84e9cbea965c9d3814e8514565e5", "score": "0.6269346", "text": "currencies(){\n return fetch(`${this.base+this.urls.currencies}`).then((response)=> response.json());\n }", "title": "" }, { "docid": "835a42dabfb1b9dfc3f76c5b6c77c413", "score": "0.6233775", "text": "function getCurrencyList(){\n let url = \"https://api.exchangeratesapi.io/latest\";\n let xhr = new XMLHttpRequest();\n xhr.open(\n \"GET\",\n url,\n true\n );\n xhr.onload = function() {\n if(this.status == 200) {\n let currency1 = document.querySelector(\".currency1\");\n let currency2 = document.querySelector(\".currency2\");\n let result = JSON.parse(this.responseText);\n let currencyList = Object.keys(result.rates);\n currencyList.push(\"EUR\");\n console.log(currencyList);\n outputCurrencyList(currencyList, currency1, \"USD\");\n outputCurrencyList(currencyList, currency2, \"JPY\");\n }\n }\n xhr.send();\n}", "title": "" }, { "docid": "591df9f511758502e649f35eae29e012", "score": "0.6207255", "text": "componentDidMount() {\r\n axios\r\n .get(\"http://api.openrates.io/latest\")\r\n .then(response => {\r\n // Initialized with 'EUR' because the base currency is 'EUR'\r\n // and it is not included in the response\r\n const currencyAr = [\"EUR\"]\r\n for (const key in response.data.rates) {\r\n currencyAr.push(key)\r\n }\r\n this.setState({ currencies: currencyAr.sort() })\r\n })\r\n .catch(err => {\r\n console.log(\"Opps\", err.message);\r\n });\r\n }", "title": "" }, { "docid": "35e22bc2b3b5fde22608282f226357bf", "score": "0.6204603", "text": "async function getCurrency() {\n const response = await fetch(urlEx);\n const data = await response.json();\n\n // Convert to USD base\n const usdRate = data.rates.USD;\n\n for (const c in data.rates) {\n data.rates[c] /= usdRate;\n }\n\n return data.rates; // Object - Each item is a currency code & its exchange rate to USD\n}", "title": "" }, { "docid": "a834b36719da0c15f758b0d780720668", "score": "0.6184309", "text": "constructor() { \n BaseResponse.initialize(this);GetDealsConversionRatesInPipelineAllOf.initialize(this);\n GetDealsConversionRatesInPipeline.initialize(this);\n }", "title": "" }, { "docid": "181c241bf586f753b37d30911eb7fd65", "score": "0.6173121", "text": "function calculate() {\r\n /**\r\n * firstly take the value of the currency one so we put ${currency_one} after the api link\r\n * in this case preselected value is usd dollar but we can select which we want\r\n * all currency value are in id currency-one.\r\n * we convert the value in json format in res and then extract the data from it \r\n * \r\n */\r\n const currency_one = currencyEl_one.value; // take the currency value \r\n const currency_two = currencyEl_two.value;\r\n\r\n fetch('Currencies_Values.json')\r\n .then(res => res.json())\r\n .then(data => {\r\n //const rate = extract values of the currencies two from rates in api.exchange \r\n const rate = data.rates[currency_two];\r\n const rate1 = data.rates[currency_one];\r\n \r\n \r\n // rateE1 is to display the result of exchange\r\n \r\n \r\n /**\r\n * according the selected currencies the amount_two value is equal\r\n * to the value of input 1 per rate which is value is from api.exchange\r\n * tpFixed(2) means 2 numbers after the comma\r\n * \r\n */\r\n const base = 'XOF'\r\n const cfa = 5/`${rate1}`;\r\n if(currency_one === base){\r\n \r\n rateEl.innerText = `5 ${currency_one} = ${rate.toFixed(5)} ${currency_two} `;\r\n\r\n };\r\n if(currency_one !== base && currency_two=== base){ \r\n rateEl.innerText = `1 ${currency_one} = ${cfa.toFixed(3)} ${currency_two}` ;\r\n };\r\n\r\n //amountEl_two.value = ((amountEl_one.value * rate)).toFixed(2);\r\n if(currency_one === base && currency_two!== base) {\r\n amountEl_two.value = ((amountEl_one.value * rate)/5).toFixed(3); \r\n }else{\r\n amountEl_two.value = ((amountEl_one.value * cfa).toFixed(3)); \r\n };\r\n if(currency_one === base && currency_two=== base){\r\n rateEl.innerText = `5 ${currency_one} = 5 ${currency_two} `;\r\n amountEl_two.value = amountEl_one.value ; \r\n }\r\n })\r\n \r\n }", "title": "" }, { "docid": "5e6a49510e148d48d661eb1076e715bf", "score": "0.6142436", "text": "function currencyAPI(currencySymbols, amountUSD) {\n\n\tconsole.log(currencySymbols+\" \"+amountUSD);\n\tvar settings = {\n\t\t\"async\": true,\n\t\t\"crossDomain\": true,\n\t\t\"url\": \"https://currency-converter5.p.rapidapi.com/currency/convert?format=json&from=USD&to=\" + currencySymbols + \"&amount=\" + amountUSD,\n\t\t\"method\": \"GET\",\n\t\t\"headers\": {\n\t\t\t\"x-rapidapi-host\": \"currency-converter5.p.rapidapi.com\",\n\t\t\t\"x-rapidapi-key\": \"92cebe218cmshe8d74a9c1f090cep1da599jsn481891ebdf92\"\n\t\t}\n\t};\n\n\t$.ajax(settings).done(function (response) {\n\t\trate = \"response.rates\" + currencySymbols + \".rate\";\n\t\tconsole.log(response);\n\t\tcurrencyReturn = response.rates[currencySymbols].rate_for_amount;\n\t\tcurrencyReturn = parseFloat(currencyReturn).toFixed(2);\n\t\tif (currencySymbols === \"EUR\") {\n\t\t\tlockPrice = marketPrice;\n\t\t\t// currencyAPI(\"EUR\", marketPrice);\n\t\t\t$(\"#defaultCtry1\").html(\" = \" + currencyReturn);\n\t\t}\n\t\tif (currencySymbols === \"JPY\") {\n\t\t\tlockPrice = marketPrice;\n\t\t\t// currencyAPI(\"JPY\", marketPrice);\n\t\t\t$(\"#defaultCtry2\").html(\"= \" + currencyReturn);\n\t\t}\n\t\tif (currencySymbols === \"GBP\") {\n\t\t\tlockPrice = marketPrice;\n\t\t\t// currencyAPI(\"GBP\", marketPrice);\n\t\t\t$(\"#defaultCtry3\").html(\" = \" + currencyReturn);\n\t\t}\n\t\tif (CCflag) {\n\t\t\t$(\"#displayCurrencyValue\").html(newsym+\" = \" + currencyReturn);\n\t\t\tdisplayCurrencyValue\n\t\t\tconsole.log(CCflag+ \"currencyReturn=\" + currencyReturn + \" stockSymbol=\" + newsym);\n\t\t\tCCflag = false;\n\t\t}\n\t});\n}", "title": "" }, { "docid": "76cc5795cc4cb2d8f3c9bcf2a488dab4", "score": "0.6134974", "text": "function calculate(){\n const currency_one = currencyElementOne.value;\n const currency_two = currencyElementTwo.value;\n fetch(`https://api.exchangerate-api.com/v4/latest/${currency_one}`,{\n mode: 'no-cors',\n header: {\n 'Access-Control-Allow-Origin':'*',\n }\n }).then(res => res.json())\n .then(data => {\n //console.log(data)\n const rate = data.rates(currency_two);\n console.log(rate);\n });\n console.log(currency_one,currency_two);\n\n}", "title": "" }, { "docid": "60ce8575246d497bd577fe79923057be", "score": "0.6115543", "text": "function processCurrencyValues(data) {\n if(data && data.error) {\n setErrorType('error');\n setErrorMessage('Currency conversion for this currency is not available now.'); \n setShowErrorMessage(true);\n } else {\n const setCurrencyData = [];\n const currency = Object.keys(data.rates);\n const quotes = Object.values(data.rates);\n currency.forEach((currencyCode, index) => {\n setCurrencyData.push({\n 'currency': currencyCode,\n 'quote': quotes[index]\n })\n });\n setcurrencyData(setCurrencyData);\n setShowCurrencyData(true);\n }\n }", "title": "" }, { "docid": "c5488726861bf2d856d4fde968afda28", "score": "0.61107665", "text": "init() {\r\n\r\n /* get currencies and set them to select elements */\r\n this.idbHelper.getCurrencies((error, currencies) => {\r\n if(error) {\r\n console.error(error);\r\n return;\r\n }\r\n this.addCurrencyOptions(currencies);\r\n });\r\n\r\n /* add new conversion */\r\n document.querySelector('.button.convert').addEventListener('click', this.handleConvertClick);\r\n\r\n /* Add swap event to the swap button */\r\n document.querySelector('.button.swap').addEventListener('click', this.handleSwapClick);\r\n\r\n /* get initial saved convesions from IDB */\r\n this.idbHelper.getSavedConversions((error, conversions) => {\r\n if(error) {\r\n console.log(error.message);\r\n return;\r\n }\r\n for(let i in conversions) {\r\n const savedConversion = conversions[i];\r\n const {fr, to, amount} = savedConversion;\r\n // show saved conversion first\r\n this.putCoversionCard(savedConversion);\r\n // fetch conversion from network and update UI\r\n this.idbHelper.fetchConversion(fr, to, amount, (error, conversion) => {\r\n if(conversion) {\r\n this.putCoversionCard(conversion);\r\n conversions[i] = conversion;\r\n }\r\n });\r\n }\r\n this.addedConversions = conversions;\r\n this.idbHelper.saveAddedConversions(this.addedConversions);\r\n });\r\n }", "title": "" }, { "docid": "fe5e524730263b2277ccd16569c54b63", "score": "0.6085356", "text": "static getCurrencies() {\n return new Promise(function(resolve, reject) {\n let request = new XMLHttpRequest();\n const url = `https://v6.exchangerate-api.com/v6/${process.env.API_KEY}/latest/USD`;\n request.onload = function() {\n if (this.status === 200) {\n resolve(request.response);\n } else {\n reject(request.response);\n }\n };\n request.open(\"GET\", url, true);\n request.send();\n });\n }", "title": "" }, { "docid": "2ada5998490e631f4b813cf10de2f486", "score": "0.60812694", "text": "function updateCurrencyData () {\r\n\tgetCurrency(getCurrencyCb);\r\n}", "title": "" }, { "docid": "41798389c1b518c796935d1328d79d41", "score": "0.6078286", "text": "function initCoinList() {\r\n binance.bookTickers((error, ticker) => {\r\n ticker.map((data) => {\r\n Object.keys(CURRENCIES).map((currency) => {\r\n if (data.symbol.includes(currency)) COINS[data.symbol] = { ...EMPTY }\r\n })\r\n })\r\n obtainHistoricData()\r\n })\r\n}", "title": "" }, { "docid": "b568a2ec8c89433450489e510f8eea67", "score": "0.6075279", "text": "function convertCurrencies(cr1, cr2) {\n let url = `https://api.exchangeratesapi.io/latest?base=${cr1}&symbols=${cr2}`;\n let xhr = new XMLHttpRequest();\n xhr.open(\n \"GET\",\n url,\n true\n );\n xhr.onload = function() {\n if(this.status == 200) {\n let result = JSON.parse(this.responseText);\n console.log(result.rates[cr2]);\n outputExchangeRate(cr1, cr2, result.rates[cr2]);\n }\n }\n xhr.send();\n}", "title": "" }, { "docid": "73c2d6c5d8a5a26691cf69111fde6e4e", "score": "0.604826", "text": "function fetchCurrencies() {\n const url = \"https://free.currencyconverterapi.com/api/v5/currencies\";\n const listCurrRequest = new Request(url);\n\n if (!(\"fetch\" in window)) {\n console.log(\"Fetch API not found\");\n return;\n }\n\n return fetch(listCurrRequest)\n .then(response => {\n return respondJson(response);\n })\n .then(resJson => {\n const currencies = formatCurrencies(resJson.results);\n saveCurrencies(currencies);\n return currencies;\n })\n .catch(err => {\n console.log(err);\n });\n}", "title": "" }, { "docid": "7dc0cb504dee3afe8df44d5b6a09b5c5", "score": "0.6013477", "text": "handleCurrencyConversion() {\n let endpointURL = 'http://data.fixer.io/api/latest?access_key=b831ee4392d4f2acf242d71c8e9c0755&base=' \n + this.sellCurrencyValue + '&symbols=' + this.buyCurrencyValue;\n \n // calling apex class method to make callout\n getCurrencyData({strEndPointURL : endpointURL})\n .then(data => {\n\n window.console.log('jsonResponse ===> '+JSON.stringify(data));\n\n // retriving the response data\n let exchangeData = data['rates'];\n \n this.rate = exchangeData[this.buyCurrencyValue];\n\n if(this.rate && this.sellAmountValue){\n this.buyAmountValue = (this.sellAmountValue * this.rate).toFixed(2);\n } else {\n this.buyAmountValue = null;\n }\n\n })\n .catch(error => {\n window.console.log('callout error ===> '+JSON.stringify(error));\n })\n }", "title": "" }, { "docid": "002454e19d819ba76a9e03c1702dfe5f", "score": "0.6000549", "text": "function dbv_load_currency_rates() {\n var $url = dbv_get_static_url() + '/currencyRates.js';\n $.getScript($url, function() { dbv_change_currency(); } );\n}", "title": "" }, { "docid": "d1fee502fd7539646c6d2203bbc144d4", "score": "0.598189", "text": "async function loadCurrency() {\r\n const response = await fetch(currencyURL);\r\n const xmlTest = await response.text();\r\n const parser = new DOMParser();\r\n const currencyData = parser.parseFromString(xmlTest, \"text/xml\");\r\n // <Cube currency=\"USD\" rate=\"1.1321\" />\r\n const rates = currencyData.querySelectorAll(\"Cube[currency][rate]\");\r\n const result = Object.create(null);\r\n for (let i = 0; i < rates.length; i++) {\r\n const rateTag = rates.item(i);\r\n const rate = rateTag.getAttribute(\"rate\");\r\n const currency = rateTag.getAttribute(\"currency\");\r\n result[currency] = rate;\r\n }\r\n result[\"EUR\"] = 1;\r\n // result[\"RANDOM\"] = 1 + Math.random();\r\n return result;\r\n}", "title": "" }, { "docid": "36c53cb94dd3961f84cee94b5ef37729", "score": "0.59772223", "text": "getCurrencyExchangeRate() {\n fetch(urlCurrency)\n .then(res => res.json())\n .then(\n (result) => {\n this.setState({\n currencyRate: result['Realtime Currency Exchange Rate']['5. Exchange Rate']\n });\n },\n (error) => {\n this.setState({\n currencyRate: 0,\n error\n });\n }\n );\n }", "title": "" }, { "docid": "0c1310b3e93d6a3cae943b407dde8e25", "score": "0.5963271", "text": "function fetchListOfCurrencies() {\n fetch(endpoint)\n .then(response => response.json())\n .then(myJson => {\n const currencies = Object.keys(myJson.results).sort();\n\n addCurrenciesToSelect(currencies);\n })\n .catch(err =>\n console.error(\n `The following error occured while getting currencies. ${err}`,\n ),\n );\n }", "title": "" }, { "docid": "6bd3d871d5ce0b4111cec17cef77b868", "score": "0.5955588", "text": "function getExchangeRates(currency) {\n\nvar request = new XMLHttpRequest()\nvar currencySelector= document.getElementById(\"currency\");\nvar currency=currencySelector.options[currencySelector.selectedIndex].value;\n\nif (currency === \"initial\") {\n\treturn;\n}\nrequest.open('GET', 'https://api.exchangeratesapi.io/latest?base='+currency, true)\nrequest.onload = function () {\n // Begin accessing JSON data here\n var data = JSON.parse(this.response)\n\n if (request.status >= 200 && request.status < 400) {\n var currency = document.getElementsByClassName(\"currency_rate\");\n\n for (var i=0; i <= currency.length; i++) {\n var selectedName = document.getElementById(\"nameList_\"+i).value;\n var concated = selectedName.substring(selectedName.length - 3, selectedName.length);\n\n if(data.rates[concated] === undefined){\n currency[i].innerHTML = \"Currency Unavailable\"\n } else {\n currency[i].innerHTML = data.rates[concated];\n }\n\n //for (var j = 0, j)\n //if(concated ===\n console.log(data.rates[concated]);\n }\n //for(var i = 0, i <= clone_count, i++){\n //}\n\n } else {\n console.log('error')\n alert(\"Issue fetching currency rates currently\")\n }\n}\n\nrequest.send();\n}", "title": "" }, { "docid": "95217b859835085e8e0de2d19c51e7a9", "score": "0.5945373", "text": "async watchCurrencies() {\n\t\tif (!this.stopWatchingCurrencies) {\n\t\t\tthis.stopWatchingCurrencies = await fireEvery(async () => {\n\t\t\t\tconst {price: kmdPriceInUsd} = this.coinPrices.find(x => x.symbol === 'KMD');\n\t\t\t\tlet {portfolio: currencies} = await this.api.portfolio();\n\n\t\t\t\t// TODO(sindresorhus): Move the returned `mm` currency info to a sub-property and only have cleaned-up top-level properties. For example, `mm` has too many properties for just the balance.\n\n\t\t\t\t// Mixin useful data for the currencies\n\t\t\t\tcurrencies = currencies.map(currency => {\n\t\t\t\t\tconst {price, percentChange24h} = this.coinPrices.find(x => x.symbol === currency.coin);\n\n\t\t\t\t\tif (price) {\n\t\t\t\t\t\tcurrency.cmcPriceUsd = price;\n\t\t\t\t\t\tcurrency.cmcBalanceUsd = currency.balance * price;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// We handle coins not on CMC\n\t\t\t\t\t\t// `currency.price` is the price of the coin in KMD\n\t\t\t\t\t\tcurrency.cmcPriceUsd = currency.price * kmdPriceInUsd;\n\t\t\t\t\t\tcurrency.cmcBalanceUsd = currency.balance * currency.cmcPriceUsd;\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrency.symbol = currency.coin; // For readability\n\t\t\t\t\tcurrency.name = coinlist.get(currency.symbol, 'name') || currency.symbol;\n\t\t\t\t\tcurrency.cmcPercentChange24h = percentChange24h;\n\n\t\t\t\t\tcurrency.balanceFormatted = roundTo(currency.balance, 8);\n\t\t\t\t\tcurrency.cmcPriceUsdFormatted = formatCurrency(currency.cmcPriceUsd);\n\t\t\t\t\tcurrency.cmcBalanceUsdFormatted = formatCurrency(currency.cmcBalanceUsd);\n\n\t\t\t\t\treturn currency;\n\t\t\t\t});\n\n\t\t\t\tif (!_.isEqual(this.state.currencies, currencies)) {\n\t\t\t\t\tthis.setState({currencies});\n\t\t\t\t}\n\t\t\t}, 1000);\n\t\t}\n\n\t\treturn this.stopWatchingCurrencies;\n\t}", "title": "" }, { "docid": "92881fedf6cb4cec84ccdecbe591f547", "score": "0.59309566", "text": "loadEUFiat(data) {\n const response = JSON.parse(data);\n const date = new Date(response.date).toLocaleDateString();\n const result = response.rates[this.Currency];\n\n this.fiatEU = {\n Name: $t.fiatName[this.Currency], // string\n Price: result, // float number\n LastUpdate: date, // string\n };\n\n this.loadPrevPriceEU(null, response.date);\n }", "title": "" }, { "docid": "4c9e5996b53e6eeaedcafd94af4e945b", "score": "0.5930805", "text": "connect () {\n if (this.connected) {\n return Promise.resolve()\n }\n\n return request.get(API_URL)\n .then((response) => {\n const quotes = response.body.list.resources\n for (let quote of quotes) {\n if (!quote.resource || quote.resource.classname !== 'Quote') {\n continue\n }\n const fields = quote.resource.fields\n const symbol = fields.symbol.slice(0,3)\n const price = fields.price\n this.rates[symbol] = price\n }\n this.connected = true\n })\n }", "title": "" }, { "docid": "7deba1fcf3d5115256bbf9ca7556b100", "score": "0.5923781", "text": "function calculate() {\n /*fetch(\"assets/items.json\")\n .then(res => res.json())\n .then(data => console.log(data));*/\n\n const currency1 = currency_one.value;\n const currency2 = currency_two.value;\n\n fetch(`https://api.exchangerate-api.com/v4/latest/${currency1}`)\n .then(res => res.json())\n .then(data => {\n const rate = data.rates[currency2];\n rateEl.innerText = `1 ${currency1} = ${rate} ${currency2} `;\n amount_two.value = (amount_one.value * rate).toFixed(2);\n });\n}", "title": "" }, { "docid": "2fecf595447aba0f58724e2e5cbb8988", "score": "0.5917138", "text": "function loadRates() {\n var xhr = new XMLHttpRequest();\n xhr.open('GET', 'https://wt-fb6aae95fd4ceea28cd307ec9422fdb1-0.sandbox.auth0-extend.com/refreshRate');\n xhr.onload = function() {\n if (xhr.status === 200) {\n var temp = JSON.parse(xhr.responseText);\n // normalize the data\n for(i = 0; i < temp.length; i++) {\n var rate = temp[i];\n switch (rate.id) {\n case 3: // BRH\n allRates.brh.buy = rate.value;\n allRates.brh.sell = rate.value;\n break;\n case 4: // Buy BUH\n allRates.buh.buy = rate.value;\n break;\n case 5: // Sell BUH\n allRates.buh.sell = rate.value;\n break;\n case 6: // Buy Unibank\n allRates.unibank.buy = rate.value;\n break;\n case 7: // Sell Unibank\n allRates.unibank.sell = rate.value;\n break;\n case 8: // Buy Sogebank\n allRates.sogebank.buy = rate.value;\n break;\n case 9: // Sell Sogebank\n allRates.sogebank.sell = rate.value;\n break;\n case 12: // Buy Capital\n allRates.capital.buy = rate.value;\n break;\n case 13: // Sell Capital\n allRates.capital.sell = rate.value;\n break;\n case 14: // Buy BNC\n allRates.bnc.buy = rate.value;\n break;\n case 15: // Sell BNC\n allRates.bnc.sell = rate.value;\n break;\n case 16: // Buy BPH\n allRates.bph.buy = rate.value;\n break;\n case 17: // Sell BPH\n allRates.bph.sell = rate.value;\n break;\n }\n }\n var refreshDate = new Date();\n // Store in a local storage\n store.set({\n rates: allRates,\n refresh: refreshDate,\n });\n // recalculate the display value\n changeRate();\n calculate();\n // Manipulate the DOme\n refreshTimeElement.textContent = formatDate(refreshDate);\n loadingElement.style.opacity = 0;\n }\n else {\n loadingElement.textContent = \"Echec\";\n }\n };\n xhr.send();\n}", "title": "" }, { "docid": "3ee8b43aee17e0741cd54988c0d1858c", "score": "0.58959496", "text": "function init(){\n if(!getApiKey()) return;\n retrieveAvailableVoices().then(data => {\n if (data.error) {\n console.error(\"Got error when requesting voices: \", data);\n alert(\"ERROR\\n\" + data.error.code + \" - \" + data.error.status + \"\\n\" + data.error.message);\n return;\n }\n \n //store globally for later use in the other functions\n voices = data.voices;\n\n populateLanguages();\n populateGenders();\n populateVoices();\n });\n}", "title": "" }, { "docid": "6b0933af86a338d981f9f9e004cb74de", "score": "0.58880746", "text": "static initialize(obj, currency, beneficiary) { \n obj['currency'] = currency;\n obj['beneficiary'] = beneficiary;\n }", "title": "" }, { "docid": "f260b1a500a12ae866bd356f776770fd", "score": "0.58872485", "text": "function getValues() {\n\n setValueRate($scope.valueCurrency, false, function() {\n showValue('paymentVolume');\n showValue('tradeVolume');\n showValue('xrpCapitalization');\n });\n\n api.getPaymentVolume({}, function(err, resp) {\n var data;\n if (err || !resp || !resp.rows) {\n console.log(err);\n data = {total: 0};\n\n } else {\n data = resp.rows[0];\n }\n\n paymentVolumeXRP = data;\n showValue('paymentVolume');\n });\n\n api.getExchangeVolume({}, function(err, resp) {\n var data;\n if (err || !resp || !resp.rows) {\n console.log(err);\n data = {total: 0};\n } else {\n data = resp.rows[0];\n }\n\n tradeVolumeXRP = data;\n showValue('tradeVolume');\n });\n }", "title": "" }, { "docid": "91822cd0b18822277bdf9e43586124da", "score": "0.585385", "text": "getCurrencies() {\r\n const currencyListUrl = \"https://free.currconv.com/api/v7/currencies?apiKey=8ba20ab26fd911197977\";\r\n return fetch(currencyListUrl)\r\n .then((resp) => resp.json()) // Transform the data into json\r\n .then((data) => {\r\n let currencies = data.results;\r\n let currenciesArray = Object.values(currencies);\r\n\r\n currenciesArray.sort((a, b) => a.currencyName.localeCompare(b.currencyName)) //sort the surrencies in alphabetical order by currency Name\r\n\r\n this.dbPromise.then(function(db){\r\n \r\n if(!db) return;\r\n\r\n let tx = db.transaction('currency-list', 'readwrite');\r\n let currencyListStore = tx.objectStore('currency-list');\r\n currenciesArray.forEach(function(currency) {\r\n currencyListStore.put(currency);\r\n });\r\n });\r\n \r\n this.displayCurrencyDropdown(currenciesArray); \r\n });\r\n }", "title": "" }, { "docid": "6586ab4e3879bd14f40655a45c31042c", "score": "0.5827714", "text": "constructor() {\n super()\n\n this.state = {\n currencyTrending: {},\n apiOn: false\n }\n }", "title": "" }, { "docid": "f928d354b1ffca2eeaf2fd312ebdbfb8", "score": "0.5825179", "text": "fetchCurrencies() {\n this.setState({ loading: true });\n\n const { page } = this.state\n //since will we use to the Root API url in a couple places- turn it a variable\n fetch(`${API_URL}/cryptocurrencies?page=${page}&perPage=20`)\n // to avoid repetition since we will use fetch again- set as a helper function-> handleResponse\n .then(handleResponse)\n .then((data) => {\n console.log('Success', data);\n const { currencies, totalPages } = data;\n \n //remember- the data.currencies below is specifying the map to exact data required from the data object in API\n this.setState({ \n currencies,\n totalPages,\n loading: false,\n });\n })\n .catch((error) => {\n //Qn- where is the second error, first in value in the API\n this.setState({\n error: error.errorMessage, \n loading: false \n });\n });\n\n }", "title": "" }, { "docid": "9a206c79c78a8a42a1fb533585ad6b97", "score": "0.5825051", "text": "function calculate(){\n const currency_1 = currency_one.value;\n const currency_2 = currency_two.value;\n\n fetch(`https://api.exchangerate-api.com/v4/latest/${currency_1}`)\n .then(res => res.json())\n .then(data => {\n // console.log(data);\n const rate = data.rates[currency_2];\n\n rateEl.innerText = `1 ${currency_1} = ${rate} ${currency_2}`\n\n amount_two.value = (amount_one.value * rate).toFixed(2);\n })\n\n \n}", "title": "" }, { "docid": "8fcc5e03703ed29ed2a5787ca5ea5052", "score": "0.5820673", "text": "function init() {\n\n $.ajax({\n\n url:'https://www.discogs.com/sell/post/' + releaseId,\n\n type: 'GET',\n\n dataType: 'html',\n\n success: function(response) {\n\n // Clear out old prices if they exist\n $('.de-price').remove();\n\n // Reset our values\n items = $('.shortcut_navigable .item_description .item_condition span.item_media_condition');\n\n priceContainer = [];\n\n prices = $('td.item_price span.price');\n\n result = $(response);\n\n nodeId = resourceLibrary.findNode(result);\n\n priceKey = resourceLibrary.prepareObj( $(result[nodeId]).prop('outerHTML') );\n\n return checkForSellerPermissions();\n }\n });\n }", "title": "" }, { "docid": "3650c0d162ba5c2dd34d1dda022c2659", "score": "0.58176464", "text": "getActiveCurrencyFromService () {\n return Api()\n .get('api/public/listActiveCurrencies/')\n .then(({ data }) => data)\n .catch(e => handleError(e))\n }", "title": "" }, { "docid": "73fe5658c9db84b04b1437cb6fea9ef9", "score": "0.58069944", "text": "async getCurrencies() {\n const promises = this.currencies.map(currency =>\n this.getCurrency(currency.symbol)\n );\n\n const responses = await Promise.all(promises);\n return responses.map((response, index) => {\n return response.map(entry => {\n return {\n price: entry.open.toFixed(2),\n timestamp: entry.time * 1000\n };\n });\n });\n }", "title": "" }, { "docid": "6a150ca4a3884093da93dc6f39d10531", "score": "0.58044106", "text": "function calculate() {\n const currency_one = currencyEl_one.value;\n const currency_two = currencyEl_two.value;\n\n fetch(`https://v6.exchangerate-api.com/v6/(API KEY)/${currency_one}`)\n .then(res => res.json())\n .then(data => {\n //console.log(data.conversion_rates));\n const rate = data.conversion_rates[currency_two]\n \n rateEl.innerText = `1 ${currency_one} = ${rate} ${currency_two}`;\n\n amount_currency2.value = (amount_currency1.value * rate).toFixed(2)\n }\n)}", "title": "" }, { "docid": "8c1aee340fc7ce4a507d4119e9e042a8", "score": "0.5789823", "text": "loadCrypto(data) {\n const response = JSON.parse(data).data[this.cryptoID];\n const date = new Date(response.last_updated).toLocaleString();\n const result = response.quote[this.Currency];\n\n const { name, symbol, cmc_rank } = response;\n const { price, percent_change_24h, percent_change_1h, percent_change_7d } = result;\n\n this.crypto = {\n Name: name, // string\n Symbol: symbol, // string\n Rank: cmc_rank, // int number\n PrevPrice: price / (percent_change_24h + 100) * 100, // float number\n Price: price, // float number\n Delta: price - (price / (percent_change_24h + 100) * 100), // float number\n Percent1H: percent_change_1h, // float number\n Percent24H: percent_change_24h, // float number\n Percent7D: percent_change_7d, // float number\n LastUpdate: date, // string\n };\n\n this.dataLabel(this.crypto, 'crypto', this.crypto.Symbol, this.Currency, 'Percent24H');\n this.loadHistory();\n }", "title": "" }, { "docid": "2c0f0376811e1ebceb08efe1f27e6e4c", "score": "0.578217", "text": "function prepareCurrencies(conversions) {\n\tvar sortedCurrencies=[];\n\t$.each(conversions,function(currency,conversion) {\n\t\tsortedCurrencies.push(currency)\n\t});\n\tsortedCurrencies.sort();\n\t$.each(sortedCurrencies,function(index,currency) {\n\t\t$('#currency')\n\t\t\t.append('<option>'+currency+'</option>');\n\t});\n\n\t$('#currency')\n\t\t.val('USD')\n\t\t.selectmenu(\"refresh\")\n\t\t.change(function() {\n\t\t\tchangeCurrency();\n\t\t});\n\tchangeCurrency(); // first run\n} // prepareCurrencies", "title": "" }, { "docid": "7aeed9d5d64fcff8b8d059eb685bb45e", "score": "0.5774909", "text": "function ConverterModel() {\r\n var currencyArr = {}, value = 0;\r\n\r\n this.getCurrencies = function () {\r\n var http = new XMLHttpRequest();\r\n\r\n http.onreadystatechange = function () {\r\n if (http.readyState === 4 && http.status === 200) {\r\n currencyArr = {};\r\n parseXML(http);\r\n } else {\r\n currencyArr = JSON.parse(localStorage.getItem(\"currencyObj\"));\r\n }\r\n };\r\n http.open(\"POST\", \"https://devweb2019.cis.strath.ac.uk/~aes02112/ecbxml.php\", true);\r\n http.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\r\n http.send();\r\n\r\n function parseXML(http) {\r\n let repliesXML = http.responseXML;\r\n\r\n let elements = repliesXML.getElementsByTagName(\"Cube\");\r\n\r\n for(let i = 0; i < elements.length; i++) {\r\n if(elements[i].hasAttribute(\"currency\")) {\r\n currencyArr[elements[i].getAttribute(\"currency\")] = elements[i].getAttribute(\"rate\");\r\n }\r\n }\r\n currencyArr[\"EUR\"] = 1;\r\n let myJson = JSON.stringify(currencyArr);\r\n localStorage.setItem(\"currencyObj\", myJson);\r\n }\r\n };\r\n\r\n this.getCurrentValue = function () {\r\n return value;\r\n };\r\n\r\n this.setCurrentValue = function (val) {\r\n value = Math.floor(val);\r\n };\r\n\r\n this.calculateValue = function (srcCur, destCur, rate) {\r\n var val;\r\n if(srcCur === destCur) {\r\n val = this.getCurrentValue() * rate;\r\n this.setCurrentValue(val);\r\n } else if (srcCur === \"eur\") {\r\n val = this.getCurrentValue() * (currencyArr[destCur] * rate);\r\n this.setCurrentValue(val);\r\n } else {\r\n let x = this.getCurrentValue() / currencyArr[srcCur];\r\n this.setCurrentValue(x);\r\n val = this.getCurrentValue() * (currencyArr[destCur] * rate);\r\n this.setCurrentValue(val);\r\n }\r\n };\r\n\r\n //Set max length of value to prevent overflow\r\n this.maxVal = function () {\r\n return value.toString().length < 10;\r\n }\r\n}", "title": "" }, { "docid": "e44cb539c28e3b968260139e68782c18", "score": "0.5760562", "text": "function calculateRates() {\n const curOne = $currencyOne.value;\n const curTwo = $currencyTwo.value;\n\n fetch(`https://api.exchangerate-api.com/v4/latest/${curOne}`)\n .then(res => res.json())\n .then(data => {\n const rate = data.rates[curTwo];\n $rate.innerText = `1 ${curOne} = ${rate} ${curTwo}`;\n $amountTwo.value = ($amountOne.value * rate).toFixed(2);\n });\n}", "title": "" }, { "docid": "b795cb6ab96e1e9e8022320f2ec64396", "score": "0.5758305", "text": "constructor(update_rate) {\n super(update_rate);\n this.client = new CoinGecko();\n }", "title": "" }, { "docid": "01b20b19ed77e4e8522b4635131b7d13", "score": "0.5744975", "text": "function getCurrenciesInfo(request, response){\n\tlet URL = URL_prefix + 'countries?apiKey=' + APIkey;\n\trequest_module(URL, function(req, res, body){\n\t\tlet drop = new Currency();\n\t\tdrop.collection.remove();\n\t\tlet currencies = JSON.parse(body);\n\t\tfor(let property in currencies){\n\t\t\tfor (let nestedProperty in currencies[property]){\n\t\t\t\tlet newCurrency = new Currency();\n\t\t\t\tnewCurrency.countryName = currencies[property][nestedProperty][\"name\"];\n\t\t\t\tnewCurrency.currencyName = currencies[property][nestedProperty][\"currencyName\"];\n\t\t\t\tnewCurrency.currencyId = currencies[property][nestedProperty][\"currencyId\"];\n\t\t\t\tif(currencies[property][nestedProperty][\"currencySymbol\"]){\n\t\t\t\t\tnewCurrency.currencySymbol = currencies[property][nestedProperty][\"currencySymbol\"];\n\t\t\t\t};\n\t\t\t\tnewCurrency.save();\n\t\t\t};\t\t\n\t\t};\n\t\tsendResponse(\"currencies were retreived successfully!\");\n\t});\n\tfunction sendResponse(message){\n\t\tresponse.json(message);\n\t};\n}", "title": "" }, { "docid": "0fc69114fc3fb1fa3f8d86db312dd7ad", "score": "0.5726917", "text": "static initialize(obj, baseReq, stock, money, initPrice, maxSupply, maxPrice, maxMoney, earliestCancelTime) { \n obj['base_req'] = baseReq;\n obj['stock'] = stock;\n obj['money'] = money;\n obj['init_price'] = initPrice;\n obj['max_supply'] = maxSupply;\n obj['max_price'] = maxPrice;\n obj['max_money'] = maxMoney;\n obj['earliest_cancel_time'] = earliestCancelTime;\n }", "title": "" }, { "docid": "e2b7b98f5765f43c8a57d9327e0f02fd", "score": "0.57208455", "text": "async function LoadCurrencies() {\n\n // displays the progress bar when the page loads:\n showProgressBar();\n\n //get the currencies response (json) from the WEB API\n currenciesArray = await getApiResponse(CURRENCIES_LIST);\n\n //run over the array of cards, and display all cards:\n for (let i = CARDS_TO_IGNORE; i < CARDS_TO_DISPLAY; i++) {\n addCardToGrid(currenciesArray[i], i);\n }\n // activating the function to hide the hideProgressBar(spiner) after the cards are shown:\n hideProgressBar();\n }", "title": "" }, { "docid": "2f38e48550dbc37f9a2b3f3d254cf04d", "score": "0.57193506", "text": "function caclulate()\r\n{\r\n //Passinput Values from the DOM into the Function\r\n const currency_one = currencyEl_one.value;\r\n const currency_two = currencyEl_two.value;\r\n\r\n fetch(`https://api.exchangerate-api.com/v4/latest/${currency_one}`)\r\n .then(res => res.json())\r\n .then(data => {\r\n // console.log(data);\r\n const rate = data.rates[currency_two];\r\n\r\n rateEl.innerText = `1 ${currency_one} = ${rate} ${currency_two}`; // [1] [USD] = [8.52] [TRY]\r\n\r\n amountEl_two.value = (amountEl_one.value * rate).toFixed(2); // toFixed(2) for Decimal Values\r\n });\r\n}", "title": "" }, { "docid": "955f758a21646c87ed7e106851d8b9c1", "score": "0.569881", "text": "constructor(transport, currencyCode) {\n super(transport);\n this.currencyCode = currencyCode;\n }", "title": "" }, { "docid": "3ffd2cd2036334b9522f92af9963eb8b", "score": "0.569744", "text": "function init()\r\n{\r\n inr = document.getElementById(\"INR\");\r\n usd = document.getElementById(\"USD\");\r\n eur = document.getElementById(\"EUR\");\r\n cad = document.getElementById(\"CAD\");\r\n aud = document.getElementById(\"AUD\");\r\n}", "title": "" }, { "docid": "90824105c295769c43eee2b19af46837", "score": "0.56847763", "text": "function toEUR(){\n\n //declaration of variables to make an HTTP request\n var apikey = '033bd71ee6e561787d172fcccb6f9e64';\n var api_url = 'http://apilayer.net/api/live';\n var fromcurrancy='USD';\n \n //declaration of variable url to access the currancylayer data\n var request_url = api_url\n + '?'\n + 'access_key=' +encodeURIComponent(apikey)\n +'&currancies='+encodeURIComponent(fromcurrancy)\n +'&format=1';\n \n var request = new XMLHttpRequest();\n request.open('GET', request_url, true);\n \n request.onload = function() {\n \n if (request.status == 200){ \n // Success!\n var data = JSON.parse(request.responseText);\n //alert(data.results[0].formatted);\n var numberfrom=+document.getElementById('number').value;\n document.getElementById('result').innerHTML=(data.quotes.USDEUR)*numberfrom+' euros';\n \n \n } else if (request.status <= 500){ \n // We reached our target server, but it returned an error\n \n console.log(\"unable to geocode! Response code: \" + request.status);\n var data = JSON.parse(request.responseText);\n console.log(data.status.message);\n } else {\n console.log(\"server error\");\n }\n }\n \n request.onerror = function() {\n // There was a connection error of some sort\n console.log(\"unable to connect to server\"); \n };\n request.send();\n \n \n }", "title": "" }, { "docid": "3180dba4d12c6b8b8feccdc048f049f3", "score": "0.5676909", "text": "function getExchangeRate() {\n const sourceCurrency = document.querySelector('.currency_convert_from').value;\n const destinationCurrency = document.querySelector('.currency_convert_to').value;\n\n const url = buildAPIUrl(sourceCurrency, destinationCurrency);\n fetchCurrencyRate(url);\n }", "title": "" }, { "docid": "4379f4c24df10c70897ba297a0924e42", "score": "0.5675772", "text": "setup() {\n this.bank = new Bank()\n this.bank.addExchangeRate('EUR', 'USD', 1.2)\n this.bank.addExchangeRate('USD', 'KRW', 1100)\n }", "title": "" }, { "docid": "aaf867ce03d5029d4e4c791e8f71c66c", "score": "0.5663758", "text": "async updateExchangeRates () {\n if (!this.isActive) {\n return\n }\n const contractExchangeRates = {}\n const nativeCurrency = this.currency ? this.currency.state.nativeCurrency.toLowerCase() : 'eth'\n const pairs = this._tokens.map(token => token.address).join(',')\n const query = `contract_addresses=${pairs}&vs_currencies=${nativeCurrency}`\n if (this._tokens.length > 0) {\n try {\n const response = await fetch(`https://api.coingecko.com/api/v3/simple/token_price/ethereum?${query}`)\n const prices = await response.json()\n this._tokens.forEach(token => {\n const price = prices[token.address.toLowerCase()] || prices[ethUtil.toChecksumAddress(token.address)]\n contractExchangeRates[normalizeAddress(token.address)] = price ? price[nativeCurrency] : 0\n })\n } catch (error) {\n log.warn(`MetaMask - TokenRatesController exchange rate fetch failed.`, error)\n }\n }\n this.store.putState({ contractExchangeRates })\n }", "title": "" }, { "docid": "6f8067aee95c43754e8482c4972a8500", "score": "0.56597805", "text": "function calculate() {\n const currency_one = currency_El_one.value;\n const currency_two = currency_El_two.value;\n\n fetch(`https://api.exchangerate-api.com/v4/latest/${currency_one}`)\n .then(res => res.json())\n .then(data => {\n const rate = data.rates[currency_two];\n rateEl.innerText = `1 ${currency_one} = ${rate} ${currency_two}`;\n amount_El_two.value = (amount_El_one.value*rate).toFixed(2);\n });\n}", "title": "" }, { "docid": "cb7a1560e483cd2f5941e0f8db9613ef", "score": "0.56529677", "text": "function getCoinValue(startDate, endDate, currency, init) {\n coindeskApi\n .get(`close.json?start=${startDate}&end=${endDate}&currency=${currency}`)\n .then(coinValue => {\n if(!init) { // if chart already created, it needs to be destroyed to prevent previous graph hover events to be triggered\n chart.destroy();\n }\n\n const dailyData = coinValue.data.bpi;\n const coinDates = Object.keys(dailyData);\n const coinValues = Object.values(dailyData);\n \n // define min and max values\n const coinValuesArray = [...coinValues];\n const minValue = Math.min.apply(null, coinValuesArray).toFixed(2);\n const maxValue = Math.max.apply(null, coinValuesArray).toFixed(2);\n\n // display results on html\n document.getElementById(`minValue`).innerText = `${minValue} ${currency}`;\n document.getElementById(`maxValue`).innerText = `${maxValue} ${currency}`;\n\n const $ctx = document.getElementById(`myChart`).getContext(`2d`);\n \n chart = new Chart($ctx, {\n type: `line`,\n data: {\n labels: coinDates,\n datasets: [{\n label: `Bitcoin Price Index`,\n data: coinValues\n }] \n }\n });\n })\n .catch(err => console.error(err))\n}", "title": "" }, { "docid": "68a85894d08b301ecfa92b37134aa234", "score": "0.5649378", "text": "function currencyCalculatorFactory() {\n\t\n\tvar collectCurrencyFromJSON= new Object();\n\tcollectCurrencyFromJSON= [];\n\n\t \n\t/**\n\t* Function returns JSON string\n\t*/\n\n\tfunction getJSONdata(url) {\n\t\tvar request = new XMLHttpRequest();\n\t\trequest.open('GET', url);\n\t\trequest.onreadystatechange = function(){\n\t\t\tif((request.status==200) && (request.readyState==4)){\n\t\t\t\tconsole.log(request.responseText);\n\t\t\t}\n\t }\n \t\n\t request(send);\n }\n\n\n\t/**\n\t* Function returns a Float\n\t*/\n\n\n\tfunction convertCurrencyCalculator (value) {\n\n\n\n\t}\n\n\n\t/**\n\t* Function writes to display, returns nothing\n\t*/\n\n\tfunction displayToScreen() {\n\n\n\t}\n\n\n\n\t}", "title": "" }, { "docid": "eaa3f884dbf9420dcb6f5262587c410f", "score": "0.5646752", "text": "function fetchCurrencyRate(url) {\n if (url === 'undefined') {\n return 'URL cannot be empty.';\n }\n\n fetch(url)\n .then(response => response.json())\n .then(myJson => {\n const inputAmount = getInput();\n const exchangeRate = Object.values(myJson);\n\n calculateExchangeRate(...exchangeRate, inputAmount);\n })\n .catch(err =>\n console.error(\n `The following error occured while getting the conversion rate. ${err}`,\n ),\n );\n }", "title": "" }, { "docid": "f5fcb0c7c8bd42ebbd78970ba6614f6c", "score": "0.56452477", "text": "static initialize(obj, amount, convertedAmount, exchangeRateUnit, operationId, recipient, sender, symbol) { \n obj['amount'] = amount;\n obj['convertedAmount'] = convertedAmount;\n obj['exchangeRateUnit'] = exchangeRateUnit;\n obj['operationId'] = operationId;\n obj['recipient'] = recipient;\n obj['sender'] = sender;\n obj['symbol'] = symbol;\n }", "title": "" }, { "docid": "3fcd2a992b927ea817f0e801dce6fb96", "score": "0.5641855", "text": "async getCryptocurrency (){\n const url = await fetch ('https://api.coinmarketcap.com/v1/ticker/');\n\n //Convert url values to JSON\n const cryptocurrency = await url.json();\n\n //return JSON values as object\n return {cryptocurrency}\n }", "title": "" }, { "docid": "dd44bbb1c9d572751c175d01f16eadd0", "score": "0.56415063", "text": "async getCurrencyRatesApiAsync() {\n let url = ROOT_URL;\n return fetch(url)\n .then(response => response.json())\n .then(responseJSON => this.loadCurrencyRates(responseJSON))\n .catch((error) => {\n //in case of exception in the service fallback to stubData\n this.loadCurrencyRates(rates);\n });\n }", "title": "" }, { "docid": "68169f25e1da6eb9daed79182cca48c4", "score": "0.5635005", "text": "getNomicsMetrics() {\n const url =\n `https://api.nomics.com/v1/currencies/ticker?key=${Constants.NOMICS_API_KEY}&ids=ICP&interval=1d`;\n axios.get(url)\n .then(res => {\n const icpToUsd = {\n value: parseFloat(res.data[0].price),\n error: 0\n };\n this.setState({\n icpToUsd: icpToUsd\n });\n })\n .catch(() => {\n this.setState(({ icpToUsd }) => ({\n icpToUsd: {\n ...icpToUsd,\n error: icpToUsd.error + 1\n }\n }));\n });\n }", "title": "" }, { "docid": "c205866798c95fdce6e3ea017cb535c3", "score": "0.5630805", "text": "function getPrices() {\n return fetch(\n `https://min-api.cryptocompare.com/data/pricemulti?fsyms=${cryptocurrencies.join(',')}&tsyms=USD,EUR`\n ).then(res => {\n return res.json()\n })\n}", "title": "" }, { "docid": "d1467a9e17f97ab5efa36d85725d21a4", "score": "0.5629495", "text": "function calculate() {\n\tconst currency1 = currencyOne.value;\n\tconst currency2 = currencyTwo.value;\n\n\tconsole.log(currency1, currency2);\n\n\tfetch(`https://api.exchangerate-api.com/v4/latest/${currency1}`)\n\t\t.then(res => res.json())\n\t\t.then(data => {\n\t\t\t//console.log(data);\n\t\t\tconst rate = data.rates[currency2];\n\n\t\t\trateElement.innerText = `1 ${currency1} = ${rate} ${currency2}`;\n\n\t\t\tamountTwo.value = (amountOne.value * rate).toFixed(2);\n\t\t});\n}", "title": "" }, { "docid": "670cf728aae5c1904350b1d1df44cd7d", "score": "0.56269634", "text": "function loadDataWithRsi() {\n cryptoApiService.getPoloniexData($scope.rsiPeriod, \"USD\").then(function (response) {\n currencyList = response.data;\n roundList(currencyList);\n $scope.currencyListUSD = currencyList;\n }, function (error) { $log.error(error.message); });\n\n cryptoApiService.getPoloniexData($scope.rsiPeriod, \"ETH\").then(function (response) {\n currencyList = response.data;\n roundList(currencyList);\n $scope.currencyListETH = currencyList;\n }, function (error) { $log.error(error.message); });\n\n cryptoApiService.getPoloniexData($scope.rsiPeriod, \"BTC\").then(function (response) {\n currencyList = response.data;\n roundList(currencyList);\n $scope.currencyListBTC = currencyList;\n }, function (error) { $log.error(error.message); });\n\n cryptoApiService.getPoloniexData($scope.rsiPeriod, \"XMR\").then(function (response) {\n currencyList = response.data;\n roundList(currencyList);\n $scope.currencyListXMR = currencyList;\n }, function (error) { $log.error(error.message); });\n }", "title": "" }, { "docid": "e0606c1e6eeb0ade0bad1c71336dac19", "score": "0.56156516", "text": "function calculate() {\n fetch(`https://api.exchangerate-api.com/v4/latest/USD.${currencyOne}`)\n .then(res => res.json())\n console.log(res);\n \n// PRILIKOM PREUZIMANJA API_KEY IZBACUJE GRESKU\n// PROVERITI PA NASTAVITI\n \n \n}", "title": "" }, { "docid": "d9405a51c7f571af35a4afa6490becb3", "score": "0.5613428", "text": "function convert(){\n// \"convert\" endpoint - convert any amount from one currency to another\n// using real-time exchange rates\n\n//declaration of variables to make an HTTP request\nvar apikey = '033bd71ee6e561787d172fcccb6f9e64';\nvar api_url = 'http://apilayer.net/api/live';\nvar fromcurrancy='USD';\n\n//declaration of variable url to access the currancylayer data\nvar request_url = api_url\n + '?'\n + 'access_key=' +encodeURIComponent(apikey)\n +'&currancies='+encodeURIComponent(fromcurrancy)\n +'&format=1';\n\nvar request = new XMLHttpRequest();\nrequest.open('GET', request_url, true);\n\nrequest.onload = function() {\n\n if (request.status == 200){ \n // in case of Success!\n var data = JSON.parse(request.responseText);\n \n //check data in our console\n console.log(data);\n console.log(\"your rate is from USD to EUR\");\n console.log(data.quotes.USDEUR);\n\n\n //print the data in my application\n //live rate from USD to EUR\n document.getElementById('rateUSDEUR').innerHTML=data.quotes.USDEUR;\n\n //live rate from EUR to USD\n var convertEURUSD=1/data.quotes.USDEUR;\n document.getElementById('rateEURUSD').innerHTML=convertEURUSD;\n\n\n} else if (request.status <= 500){ \n // We reached our target server, but it returned an error \n console.log(\"unable to geocode! Response code: \" + request.status);\n var data = JSON.parse(request.responseText);\n console.log(data.status.message);\n } else {\n console.log(\"server error\");\n }\n }\n\n request.onerror = function() {\n // There was a connection error of some sort\n console.log(\"unable to connect to server\"); \n };\n request.send();\n}", "title": "" }, { "docid": "ca8bfd9cfbfc722af2a4c69007e440df", "score": "0.5610382", "text": "function getRates( date, callback ){\n var url = \"http://data.fixer.io/api/\" + date;\n var key = \"e7653bf55ca8eaf257d57861f747dc44\";\n var base_currency = $(\"#base_currency\").val();\n $.getJSON(url, {access_key: key, base: base_currency, symbols: currencies.join(\",\")}, (res) => {\n console.log(res);\n callback(res);\n }).fail(function(){\n $(\"#rates-error\").text('Fixer io API is down.');\n });\n }", "title": "" }, { "docid": "2f8de77504de323523f80c5d39705585", "score": "0.56083167", "text": "function updateExchangeRates() {\n\t var currencies = [];\n\t var hasNegative = false;\n\t for (var cur in $scope.balances) {if ($scope.balances.hasOwnProperty(cur)){\n\t var components = $scope.balances[cur].components;\n\t for (var issuer in components) {if (components.hasOwnProperty(issuer)){\n\t // While we're at it, check for negative balances:\n\t hasNegative || (hasNegative = components[issuer].is_negative());\n\t currencies.push({\n\t currency: cur,\n\t issuer: issuer\n\t });\n\t }}\n\t }}\n\t $scope.hasNegative = hasNegative;\n\t var pairs = currencies.map(function(c){\n\t return {\n\t base:c,\n\t counter:{currency:'XRP'}\n\t };\n\t });\n\t if (pairs.length) {\n\t $scope.exchangeRatesNonempty = false;\n\t $http.post('https://api.ripplecharts.com/api/exchangeRates', {pairs: pairs, last: true})\n\t .success(function(response){\n\t for (var i = 0; i < response.length; i++) {\n\t var pair = response[i];\n\t if (pair.last > 0) { // Disregard unmarketable assets\n\t $scope.exchangeRates[pair.base.currency + ':' + pair.base.issuer] = pair.last;\n\t }\n\t }\n\n\t $scope.exchangeRatesNonempty = true;\n\t console.log('Exchange Rates: ', $scope.exchangeRates);\n\t });\n\t } else {\n\t $scope.exchangeRatesNonempty = true;\n\t }\n\t }", "title": "" }, { "docid": "3051aadb02c64c595d8ace1a0aca9e41", "score": "0.5595401", "text": "function init() {\n MainService.getpersonrates().then(function(response){\n if(response!=null){\n vm.personrates = JSON.parse(response);\n console.log(vm.personrates);\n }\n });\n MainService.getlevelsalary().then(function(response){\n if(response!=null){\n vm.levelsalary = JSON.parse(response);\n console.log(vm.levelsalary);\n }\n });\n MainService.getinsurancerates().then(function(response){\n if(response!=null){\n vm.insurancerates = JSON.parse(response);\n console.log(vm.insurancerates);\n }\n });\n MainService.getaversalary().then(function(response){\n if(response!=null){\n vm.aversalary =JSON.parse(response);\n console.log(vm.aversalary);\n }\n });\n }", "title": "" }, { "docid": "228688bfc86d86f0a0e2c7fbae6418b8", "score": "0.5589979", "text": "componentDidMount() {\n this.getCurrencies().then(data => {\n this.chartData = data;\n this.setCurrency(this.currencies[0]);\n });\n }", "title": "" }, { "docid": "64877de2fbbc6e6807a6651e53d74dc4", "score": "0.55789125", "text": "function fetchExchangeRateFromAPI(currencyCode, dbo, db, amount) {\n // Perform API Call to get new conversion rate\n var currentExchangeRate = 0;\n fetch(constants.CURRENCYURL)\n .then((response) => response.json())\n .then(function(data) {\n let currencyQuoteData = data.quotes;\n let exchangeTimeStamp = data.timestamp;\n //Frame JSON Object\n var quotes = [];\n var inputData = currencyQuoteData;\n for (var key in inputData) {\n if (inputData.hasOwnProperty(key)) {\n quotes.push({\n \"keypair\": key,\n \"value\": inputData[key],\n \"timestamp\": exchangeTimeStamp\n });\n if (key == currencyCode) {\n currentExchangeRate = inputData[key];\n }\n }\n }\n //Save the data to db\n dbo.collection(constants.COLLECTIONNAME).remove({}, function(err, result) {\n if (err) {\n throw err;\n } else {\n dbo.collection(constants.COLLECTIONNAME).insertMany(quotes, function(err, res) {\n if (err) {\n throw err;\n } else {\n //Do Nothing\n huobiCall(amount / currentExchangeRate, dbo, db);\n }\n });\n }\n });\n })\n .catch(function(error) {\n console.log(\"Error in file elaprice.js\" + error);\n });\n}", "title": "" }, { "docid": "b887e216cd25107a2796971886f6797a", "score": "0.55784065", "text": "function updateExchangeRates() {\n var currencies = [];\n var hasNegative = false;\n for (var cur in $scope.balances) {if ($scope.balances.hasOwnProperty(cur)){\n var components = $scope.balances[cur].components;\n for (var issuer in components) {if (components.hasOwnProperty(issuer)){\n // While we're at it, check for negative balances:\n hasNegative || (hasNegative = components[issuer].is_negative());\n currencies.push({\n currency: cur,\n issuer: issuer\n });\n }}\n }}\n $scope.hasNegative = hasNegative;\n var pairs = currencies.map(function(c){\n return {\n base:c,\n counter:{currency:'XRP'}\n };\n });\n if (pairs.length) {\n $scope.exchangeRatesNonempty = false;\n $http.post('https://api.ripplecharts.com/api/exchangeRates', {pairs: pairs, last: true})\n .success(function(response){\n for (var i = 0; i < response.length; i++) {\n var pair = response[i];\n if (pair.last > 0) { // Disregard unmarketable assets\n $scope.exchangeRates[pair.base.currency + ':' + pair.base.issuer] = pair.last;\n }\n }\n\n $scope.exchangeRatesNonempty = true;\n console.log('Exchange Rates: ', $scope.exchangeRates);\n });\n } else {\n $scope.exchangeRatesNonempty = true;\n }\n }", "title": "" }, { "docid": "4ade239ec605d7b214464e686729c850", "score": "0.55701464", "text": "getFromApi() {\n // Defining the forEach iterator function...\n if (!Object.prototype.forEach) {\n Object.defineProperty(Object.prototype, 'forEach', {\n value: function (callback, thisArg) {\n if (this == null) {\n throw new TypeError('Not an object');\n }\n thisArg = thisArg || window;\n for (var key in this) {\n if (this.hasOwnProperty(key)) {\n callback.call(thisArg, this[key], key, this);\n }\n }\n }\n });\n }\n // Getting our currencies from our free api\n fetch(this.url + 'currencies')\n .then((res) => {\n return res.json();\n })\n .then((res) => {\n res.results.forEach((value, key) => {\n this.currencies.push(value);\n });\n })\n .then(() => {\n // Setting data on IndexBD\n this.dbPromise.then((db) => {\n const tx = db.transaction('currencies', 'readwrite');\n const currenciesStore = tx.objectStore('currencies');\n this.currencies.forEach((value, key) => {\n currenciesStore.put(value, value.id);\n })\n return tx.complete;\n }).then(() => {\n this.getFromIDB();\n });\n })\n .catch((error) => {\n this.getFromIDB();\n });\n }", "title": "" }, { "docid": "38c8264a3e6cb7c1ac318842ecc23e21", "score": "0.556685", "text": "function calculate() {\n const currencyOneCode = currencyOnePicker.value;\n const currencyTwoCode = currencyTwoPicker.value;\n fetch(`https://v6.exchangerate-api.com/v6/9edf55432e8fe53827d04461/latest/${currencyOneCode}`)\n .then(res => res.json())\n .then(data => {\n // Get the exchange Rate from API Data\n const exchangeRate = data.conversion_rates[currencyTwoCode];\n // display the Conversion Rate\n rate.innerText = `1 ${currencyOneCode} = ${exchangeRate} ${currencyTwoCode}`;\n\n // Apply Conversion Rate and Update Amount of Currency Two\n currencyTwoAmount.value = (currencyOneAmount.value * exchangeRate).toFixed(2);\n\n\n });\n\n\n}", "title": "" }, { "docid": "d19b130bc7b6a7167516ebd770526c52", "score": "0.55596584", "text": "$onInit() {\n this.loading.init = true;\n\n return this.OvhApiMe.DepositRequest()\n .v6()\n .query()\n .$promise.then((deposit) => {\n this.depositRequests = deposit;\n\n if (!this.depositRequests.length) {\n return this.$q\n .all({\n balance: this.getBalance(),\n paymentMethods: this.ovhPaymentMethod.getAllPaymentMethods(),\n })\n .then((response) => {\n this.balance = response.balance;\n this.paymentMethods = filter(\n response.paymentMethods,\n ({ paymentType, status }) =>\n ['INTERNAL_TRUSTED_ACCOUNT', 'ENTERPRISE'].indexOf(\n paymentType,\n ) === -1 &&\n ['CANCELED_BY_CUSTOMER', 'CANCELING'].indexOf(status) === -1,\n );\n\n this.model.paymentMethod = find(this.paymentMethods, {\n default: true,\n });\n });\n }\n\n return this.depositRequests;\n })\n .catch((error) => {\n this.Alerter.alertFromSWS(\n this.$translate.instant('billing_history_balance_load_error'),\n {\n message: get(error, 'data.message'),\n type: 'ERROR',\n },\n 'billing_balance',\n );\n })\n .finally(() => {\n this.loading.init = false;\n });\n }", "title": "" }, { "docid": "75de4ce7af3226174acf2ec6df296183", "score": "0.5555531", "text": "function liveCurrencyratesConversion(transactionRecords, base = \"AUD\") {\n\n var currency;\n var currencies = [];\n var multicurrency = true;\n for (var i = 0; i < records.length; i++) {\n var invoice = records[i];\n if (i == 0) {\n currencies.push(currency);\n }\n\n else if (currencies.indexOf(invoice[\"CurrencyCode\"]) == -1) {\n currencies.push(invoice[\"CurrencyCode\"]);\n multicurrency = true;\n }\n\n }\n if (multicurrency) {\n var rates;\n $.ajax({\n \"url\": \"https://api.exchangerate-api.com/v4/latest/\" + base,\n \"method\": \"GET\",\n \"async \": false\n }).done((res) => {\n rates = res[\"rates\"];\n console.log(rates);\n });\n }\n\n\n}", "title": "" }, { "docid": "c24aa9f99ab49c78309834f6c195c7ed", "score": "0.5555397", "text": "createService() {\r\n this._service = new CurrencyService();\r\n }", "title": "" }, { "docid": "1bd07e8c120b96b51fc47868f83721ae", "score": "0.5548015", "text": "function convertCurrency(){\n const from = document.getElementById('from').value;\n const to = document.getElementById('from').value;\n const amount = document.getElementById('amount').value;\n const result = document.getElementById('result');\n\n if(from.length > 0 && to.length > 0 && amount.length > 0) {\n const xHttp = new XMLHttpRequest();\n xHttp.onreadystatechange = function(){\n if(xHttp.readyState == 4 && xHttp.status == 200) {\n const obj = JSON.parse(this.responseText);\n const fact = parseFloat(obj.rates[from]);\n if(fact!=undefined){\n result.innerHTML = parseFloat(amount) * fact;\n }\n }\n }\n xHttp.open('GET', 'http://api.fixer.io/latest?base=' + from + '&symbols=' + to, true);\n xHttp.send();\n }\n}", "title": "" }, { "docid": "c405f797b0cd4d6a24a3d70bf3f1dc1e", "score": "0.55347973", "text": "function getConverter(getRates){\n var fx = require(\"money\");\n fx.rates = {\n \"AUD\": 1.3,\n \"USD\": 1\n }\n fx.base = \"USD\"\n fx.settings = {\n from: \"USD\",\n to: \"AUD\"\n }\n if(getRates){\n request('https://openexchangerates.org/api/latest.json?app_id=18e01813d9694849a877e30fd1db3284')\n .then(function (resp){\n var data = JSON.parse(resp)\n fx.rates = data.rates\n })\n }\n return fx\n}", "title": "" }, { "docid": "acd51e22f2c03945e296d4ab8ea09278", "score": "0.5531561", "text": "function calculate() {\n const currency_one = currencyElOne.value;\n const currency_two = currencyElTwo.value;\n\n fetch(`https://v6.exchangerate-api.com/v6/05571b97af2fc7cf2f6ca10e/latest/${currency_one}`)\n .then(res => res.json())\n .then(data => {\n const rate = data.conversion_rates[currency_two];\n rateEl.innerText = `1 ${currency_one} = ${rate} ${currency_two}`;\n\n amountElTwo.value = (amountElOne.value * rate).toFixed(2) });\n}", "title": "" }, { "docid": "bc08f639a96709f5fd411efc880e5c8e", "score": "0.5530206", "text": "function Crypto2() {\n const [curCurrency, setCurCurrency] = useState(defaultOption);\n const [isLoading, setIsLoading] = useState(true);\n const [cryptoData, setCryptoData] = useState({});\n // let cryptoData = [];\n\n //===========================================\n // LIST OF CRYPTOCURRENCIES\n //===========================================\n const cryptoCurrency = [\n { name: \"Bitcoin\", symbol: \"BTC\" },\n { name: \"Ethereum\", symbol: \"ETH\" },\n { name: \"Litecoin\", symbol: \"LTC\" },\n ];\n\n //=============================================\n // API INIT\n //=============================================\n let cryptos = [];\n let url = \"https://coingecko.p.rapidapi.com/coins/markets?vs_currency=\";\n\n //====================================================\n // Converting available currency to array\n //====================================================\n\n cryptoCurrency.map((e) => {\n cryptos.push(e.name.toLowerCase());\n });\n\n //=======================================================\n // DECLARING ASYNC API\n //=======================================================\n\n let query = `${url}${curCurrency}&ids=${cryptos}`;\n\n async function getData() {\n let response = await fetch(query, {\n method: \"GET\",\n headers: {\n \"x-rapidapi-key\": process.env.REACT_APP_X_RapidAPI_Key,\n \"x-rapidapi-host\": \"coingecko.p.rapidapi.com\",\n },\n });\n\n let data = await response.json();\n return data;\n }\n\n //==========================================================\n // USEEFFECT HOOK\n //==========================================================\n\n useEffect(() => {\n getData().then((data) => {\n setCryptoData(data);\n setIsLoading(false);\n });\n }, [curCurrency]);\n\n //============================================\n // CHANGE CURRENCY\n //===========================================\n function changeCurrency(e) {\n console.log(\"value \", e.value);\n\n setCurCurrency(e.value);\n }\n\n //============================================\n //*************** RETURN ******************/\n //============================================\n return (\n <div>\n <Dropdown\n className=\"dropdown\"\n controlClassName=\"dropdownControl\"\n options={options}\n onChange={changeCurrency}\n value={curCurrency}\n placeholder=\"Select an option\"\n />\n {isLoading ? (\n <>\n <div className=\"newsSkeletonCont\">\n <Skeleton height={70} />\n <Skeleton height={20} count={3} />\n </div>\n <div className=\"newsSkeletonCont\">\n <Skeleton height={70} />\n <Skeleton height={20} count={3} />\n </div>\n <div className=\"newsSkeletonCont\">\n <Skeleton height={70} />\n <Skeleton height={25} count={3} />\n </div>\n </>\n ) : (\n Object.keys(cryptoData).map((e) => {\n return (\n <DataCard\n key={cryptoData[e][\"id\"]}\n image={cryptoData[e][\"image\"]}\n title={cryptoData[e][\"name\"]}\n currency={curCurrency}\n price={cryptoData[e][\"current_price\"]}\n symbol={cryptoData[e][\"symbol\"]}\n />\n );\n })\n )}\n </div>\n );\n}", "title": "" }, { "docid": "bc92fa84195d6fe6a35b76b91fdb0605", "score": "0.5524789", "text": "function getSupportedCurrencies (call, callback) {\n logger.info('Getting supported currencies...');\n _getCurrencyData((data) => {\n callback(null, {currency_codes: Object.keys(data)});\n });\n}", "title": "" } ]
d9dcc3f67587215b9b51a3b32dc53f4f
Eventos do Modal... Function para fechar o modal
[ { "docid": "571a5b0602c87cf72404d96dc1f2a9d0", "score": "0.0", "text": "function closeModal() {\n qs('.pizzaWindowArea').style.opacity = 0;\n\n setTimeout(()=>{\n qs('.pizzaWindowArea').style.display = 'none';\n }, 500);\n}", "title": "" } ]
[ { "docid": "2c7a6f49dc760e88cdce0b79d5b2cdc3", "score": "0.72198504", "text": "static showModal(args) {\n $(\"#Modal\").on('shown.bs.modal', function () {\n })\n\n\n $(function () {\n $(\"#Modal\").modal(\"show\");\n });\n if ('title' in args) {\n $(\".modal-header h5\").html(args.title);\n }\n if ('html' in args) {\n $(\".modal-body\").html(args.html);\n }\n if ('wide' in args) {\n $(\".modal-content\").addClass(\"modal-wide\")\n }\n\n if ('showFooter' in args) {\n $(\".modal-footer\").style.display = \"block\";\n }\n\n //add listener to empty close modal when\n $(\"#Modal\").on('hiden.bs.modal', function () {\n $(\".modal-header h5\").html(\"\");\n $(\".modal-body\").html(\"\");\n })\n\n\n }", "title": "" }, { "docid": "13ec3106a469c525bd2b20b9a9072726", "score": "0.71835357", "text": "function modalPoem() {\n // first, we grab the poem and place it in the modal\n getPoem(true, false);\n}", "title": "" }, { "docid": "00bfc9b2be66b69f41664b4566ca2ab6", "score": "0.7172625", "text": "function handleModal(event) {\n setOpen(!open);\n setModalNotif(\"\");\n }", "title": "" }, { "docid": "bff4e5f9cbfe824d0a2672e4c5a8d2cb", "score": "0.70933825", "text": "function launchModalHandler() {\n setModalVisible(true);\n }", "title": "" }, { "docid": "5dbeccfaea42f9df153f37c7d9f00850", "score": "0.7040931", "text": "closeModal() {\n //\n }", "title": "" }, { "docid": "13a63e4d98c58b871ffd25a02fc22a4d", "score": "0.6854921", "text": "handleModal()\n {\n this.isModalOpen=true; \n }", "title": "" }, { "docid": "e113e0adbf5baee4c43ed00c03ebe98d", "score": "0.68004334", "text": "function mensajes(texto)\n{\n crear_modal(texto);\n $(\"#modal_mensaje\").modal(\"show\");\n}", "title": "" }, { "docid": "f07da1002d6ccf54b2e061f2c86967bd", "score": "0.6769481", "text": "function modalEscuelasPredio(escuelaDatos) {\n \n // console.log('llega al modal predio')\n \n $(`<div class=\"modal fade\" id=\"myModalM${escuelaDatos.escuelaId}\" tabindex=\"-1\" role=\"dialog\">\n <div class=\"modal-dialog\" role=\"document\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>\n <h4 class=\"modal-title\">Escuela N° ${escuelaDatos.numero}</h4>\n </div>\n <div class=\"modal-body\">\n <p><b>CUE : </b>${escuelaDatos.cue}</p>\n <p><b>N° :</b> ${escuelaDatos.numero}</p>\n <p><b>Nombre :</b> ${escuelaDatos.nombre}</p>\n <p><b>Direccion:</b> ${escuelaDatos.domicilio}</p>\n <p><b>Localidad :</b> ${escuelaDatos.localidad}</p>\n <hr>\n <p style=\"text-align:center;\"><b>${escuelaDatos.perfil} A CARGO</b> </p> \n <p>${escuelaDatos.apellidoEtt}, ${escuelaDatos.nombreEtt}</p>\n <p>${escuelaDatos.telefonoEtt}</p>\n \n\n <div class=\"modal-footer\">\n\n <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Cerrar</button>\n <!-- <button type=\"button\" class=\"btn btn-primary\" id=\"\">Cargar</button> -->\n </div>\n </div><!-- /.modal-content -->\n </div><!-- /.modal-dialog -->\n</div><!-- /.modal -->\n*/\n\n\n `).appendTo('#escPredio')\n\n\n $('[id ^=myModalM]').modal('show') // importante para modal\n $('[id ^=myModalM]').on('hide.bs.modal',function(){ // importante para modal\n $('[id ^=myModalM]').remove() // importante para modal\n\n })\n\n }", "title": "" }, { "docid": "5ae52f5fa55531ebdbc75c1de5f12291", "score": "0.6760385", "text": "function LauchModal(tModal){\n switch (tModal) {\n case \"registro\":\n modal.style.display = \"block\";\n break;\n \n case \"ig\":\n moig.style.display = \"block\";\n break;\n\n default:\n break;\n }\n}", "title": "" }, { "docid": "78f38a44728174716a7d526709fa320e", "score": "0.6758578", "text": "function OpenModal() {\n\n limpiar();\n cambiar_color_obtener();\n $(\".modal-title\").text(\"Registrar Categoria\");\n $('#modal-categoria').modal('show');\n}", "title": "" }, { "docid": "78d4cf3a42665c2dbe69b999f5c710d8", "score": "0.6742927", "text": "openModal() { \n // to open modal window set 'bShowModal' tarck value as true\n this.bShowModal = true;\n }", "title": "" }, { "docid": "7992244f85a99d6a0a557cea777097e7", "score": "0.67276925", "text": "function limpiarMproducto(){\n\n $('#modalNuevo').on('shown.bs.modal', function () { \n $('#codigo_barra').focus();\n $('#codigo_barra').val(\"\");\n $('#descripcion').val(\"\");\n $('#costo').val(\"\");\n $('#venta').val(\"\");\n // $('#iditebis').val(\"\");\n $('#cantidad').val(\"\");\n $('#ubicacion').val(\"\");\n $('#categoria').val(\"\");\n }) \n }", "title": "" }, { "docid": "9be2b0928bbc44ad8ca9202fb792caa8", "score": "0.67147", "text": "function modalChangeElement(modalVar, buttonVar, spanVar, pVar) { //funzione che prende in pasto 4 variabili:\n //modalVar= id del modal che si dovrà aprire\n //buttonVar= id del pulsante che aprirà il modal\n //spanVar= classe dello span contenente la X per la chiusura del modal\n //pVar= la classe del p da selezionare\n buttonVar.onclick = function() { // Quando l'utente clicca sul pulsante\n modalVar.style.display = \"block\"; // si apre il modal\n }\n spanVar.onclick = function() { // Quando l'utente clicca sulla X\n modalVar.style.display = \"none\"; // si chiude il modal\n }\n window.onclick = function(event) { //OPZIONALE: Quando l'utente clicca su qualsiasi punto al di fuori del modal\n if (event.target == modalVar) { //Il modal si chiude\n modalVar.style.display = \"none\";\n }\n }\n $(pVar).on('click', function(){ //Quando l'utente clicca su un p all'interno del modal\n var current = $(this).text(); //prendo il contenuto del p cliccato\n $(buttonVar).text(current); // lo vado a sostituire nella navbar\n modalVar.style.display = \"none\"; // si chiude il modal\n });\n}", "title": "" }, { "docid": "654d0108092367f38e6d6f2223e779f1", "score": "0.66965127", "text": "function exibirCadastrarEntregador(){\r\n\t $('#editar_entregador').modal('show');\r\n }", "title": "" }, { "docid": "8d868609de86b9d3f924eb22774e5503", "score": "0.6692854", "text": "function modal_consulta_EventoSignificativo(){\r\n //$(\"#fecha_evento\").val();\r\n $(\"#modal_consultar_eventosignif\").modal(\"show\");\r\n}", "title": "" }, { "docid": "8bbc2e3b3d34ee8a8a4b134f8f107348", "score": "0.6682922", "text": "function parcelaEdicion(){\n $('#modalEdicion').on('shown.bs.modal', function () { \n $('#nombreu').focus(); \n }) \n }", "title": "" }, { "docid": "2c41d81f35ee1ce89a85e37b26f58628", "score": "0.6649396", "text": "function shown_bs_modal( /*event*/ ) {\n //Focus on focus-element\n var $focusElement = $(this).find('.init_focus').last();\n if ($focusElement.length){\n document.activeElement.blur();\n $focusElement.focus();\n }\n }", "title": "" }, { "docid": "ae96f243b10edcfcfc938f3f3477e4ee", "score": "0.66418713", "text": "function modalGo(self) {\n\n // remove old modal // TODO will I use this?\n if(modalOpen) {\n console.log('old');\n\n modalOpen = false;\n }\n\n self.classList.add('-selected');\n\n var beginAnim = setTimeout(function() {\n // create new\n var tempDiv = document.createElement('div');\n tempDiv.id = 'modal-temp';\n self.appendChild(tempDiv);\n centerThumb(self, modal, tempDiv);\n },600);\n\n\n}", "title": "" }, { "docid": "e1bce73932cfae09b63cf4407ed74ad1", "score": "0.6640737", "text": "function limpiarMcliente(){\n\n $('#modalNuevo').on('shown.bs.modal', function () { \n $('#nombre').focus();\n $('#nombre').val(\"\");\n $('#apellido').val(\"\");\n $('#direccion').val(\"\");\n $('#telefono').val(\"\");\n $('#tel_movil').val(\"\");\n $('#correo').val(\"\");\n $('#rnc').val(\"\");\n $('#nota').val(\"\");\n }) \n }", "title": "" }, { "docid": "9aeccc56e0be6883a99493a6565cdbaf", "score": "0.6634682", "text": "function modals_correo(titulo,mensaje){\n\n\tvar modal='<!-- Modal -->';\n\t\t\tmodal+='<div id=\"myModal3\" class=\"modal2 hide fade\" style=\"margin-top: 5%; background-color: rgb(41, 76, 139); color: #fff; z-index: 900000; behavior: url(../../css/PIE.htc);width: 60%;\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\" data-backdrop=\"true\">';\n\t\t\tmodal+='<div class=\"modal-header\" style=\"border-bottom: 0px !important;\">';\n\t\t\tmodal+='<button type=\"button\" class=\"close\" style=\"color:#fff !important;\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>';\n\t\t\tmodal+='<h4 id=\"myModalLabel\">'+titulo+'</h4>';\n\t\t\tmodal+='</div>';\n\t\t\tmodal+='<div class=\"modal-body\" style=\"max-width: 92% !important; background-color:#fff; margin: 0 auto; margin-bottom: 1%; border-radius: 8px; behavior: url(../../css/PIE.htc);\">';\n\t\t\tmodal+='<p>'+mensaje+'</p>';\n\t\t\tmodal+='</div>';\n\t\t\n\t\t\tmodal+='</div>';\n\t$(\"#main\").append(modal);\n\t\n\t$('#myModal3').modal({\n\t\tkeyboard: false,\n\t\tbackdrop: \"static\" \n\t});\n\t\n\t$('#myModal3').on('hidden', function () {\n\t\t$(this).remove();\n\t});\n\t\n}", "title": "" }, { "docid": "9aeccc56e0be6883a99493a6565cdbaf", "score": "0.6634682", "text": "function modals_correo(titulo,mensaje){\n\n\tvar modal='<!-- Modal -->';\n\t\t\tmodal+='<div id=\"myModal3\" class=\"modal2 hide fade\" style=\"margin-top: 5%; background-color: rgb(41, 76, 139); color: #fff; z-index: 900000; behavior: url(../../css/PIE.htc);width: 60%;\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\" data-backdrop=\"true\">';\n\t\t\tmodal+='<div class=\"modal-header\" style=\"border-bottom: 0px !important;\">';\n\t\t\tmodal+='<button type=\"button\" class=\"close\" style=\"color:#fff !important;\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>';\n\t\t\tmodal+='<h4 id=\"myModalLabel\">'+titulo+'</h4>';\n\t\t\tmodal+='</div>';\n\t\t\tmodal+='<div class=\"modal-body\" style=\"max-width: 92% !important; background-color:#fff; margin: 0 auto; margin-bottom: 1%; border-radius: 8px; behavior: url(../../css/PIE.htc);\">';\n\t\t\tmodal+='<p>'+mensaje+'</p>';\n\t\t\tmodal+='</div>';\n\t\t\n\t\t\tmodal+='</div>';\n\t$(\"#main\").append(modal);\n\t\n\t$('#myModal3').modal({\n\t\tkeyboard: false,\n\t\tbackdrop: \"static\" \n\t});\n\t\n\t$('#myModal3').on('hidden', function () {\n\t\t$(this).remove();\n\t});\n\t\n}", "title": "" }, { "docid": "bd8b41ce1b7b8f56f3310d887803f151", "score": "0.6633173", "text": "function on() {\n modal.style.display = \"block\";\n}", "title": "" }, { "docid": "3a3392fef61ebea82f0c416e678fb507", "score": "0.6631837", "text": "function modal(e) {\n\t return $.cModal(e);\n\t }", "title": "" }, { "docid": "22206fa73c465be44c3dbf1dff55a407", "score": "0.66256607", "text": "function agroquimicaEdicion(){\n $('#modalEdicion').on('shown.bs.modal', function () { \n $('#pagrou').focus(); \n }) \n }", "title": "" }, { "docid": "f5449e75a8cea1f6062785f8b78029bf", "score": "0.660956", "text": "function abrirModal(evt) {\r\n actual = evt.currentTarget;\r\n let modalID = actual.lastElementChild.getAttribute(\"id\");\r\n modal = document.getElementById(modalID);\r\n fondoBorroso.style.display = \"block\"; //pone borroso el fondo\r\n modal.style.display = \"block\"; //muestra el modal del card clickeado\r\n actual\r\n .getElementsByTagName(\"span\")[0]\r\n .addEventListener(\"click\", cerrarModal, false); //empieza a escuchar click en la x del modal.\r\n fondoBorroso.addEventListener(\"click\", cerrarModal, false); //activa event listener en fondo borroso para que se cierre modal al clickear en fondo borroso.\r\n actual.removeEventListener(\"click\", abrirModal, true); //quita el eventlistener del card (article) seleccionado.\r\n document.body.style.overflow = \"hidden\"; //oculta main scrollbar\r\n if ((actual.tagName = \"LI\")) {\r\n actual.style.cursor = \"default\";\r\n }\r\n}", "title": "" }, { "docid": "e8d98b93d63474333a37ade15806ccd4", "score": "0.659527", "text": "function modalWindow() {\n\n let modal = $(\".modal\");\n\n //Show modal window with click on buttons with data-type = recall\n $(\"[data-type = recall]\").each(function(i) {\n $(this).click(\n function() {\n console.log(`clicked ${i}`);//delete after finish\n modal.fadeIn(\"slow\");\n }\n ); \n });\n\n //Main close modal func\n let modalClose = () => {\n modal.fadeOut(\"slow\");\n };\n //Close modal by click on close button\n $(\".modal_close\").click(modalClose);\n\n //Close modal by click on ESC key\n $(document).on('keydown', function(e){\n if (e.key === 'Escape') {\n modalClose();\n }\n });\n\n \n modal.click(function(event) {\n // console.log(e.target);\n if (event.target === modal) {\n // modalClose(); \n modal.addClass('hidden');\n }\n });//???\n }", "title": "" }, { "docid": "a41064d70904750af7f8b456e0125d88", "score": "0.65901303", "text": "function onModalShown() {\n Y.log( 'Bootstrap event: shown comctl modal', 'debug', NAME );\n Y.doccirrus.comctl.modalVisible = true;\n\n if( callback ) {\n Y.log( 'Calling back' );\n return callback( null );\n }\n }", "title": "" }, { "docid": "7832a766395395b87a0406a5221fac61", "score": "0.65813005", "text": "function modals(titulo,mensaje){\n\n\tvar modal='<!-- Modal -->';\n\t\t\tmodal+='<div id=\"myModal2\" class=\"modal hide fade\" style=\"margin-top: 3%; background-color: rgb(41, 76, 139); color: #fff; z-index: 900000; behavior: url(../../css/PIE.htc)\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\" data-backdrop=\"true\">';\n\t\t\tmodal+='<div class=\"modal-header\" style=\"border-bottom: 0px !important;\">';\n\t\t\tmodal+='<button type=\"button\" class=\"close\" style=\"color:#fff !important;\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>';\n\t\t\tmodal+='<h4 id=\"myModalLabel\">'+titulo+'</h4>';\n\t\t\tmodal+='</div>';\n\t\t\tmodal+='<div class=\"modal-body\" style=\"max-width: 92% !important; background-color:#fff; margin: 0 auto; margin-bottom: 1%; border-radius: 8px; behavior: url(../../css/PIE.htc);\">';\n\t\t\tmodal+='<p>'+mensaje+'</p>';\n\t\t\tmodal+='</div>';\n\t\t\tmodal+='</div>';\n\t\t\t\n\t$(\"#main\").append(modal);\n\t\n\t$('#myModal2').modal({\n\t\tkeyboard: false,\n\t\tbackdrop: \"static\" \n\t});\n\t\n\t$('#myModal2').on('hidden', function () {\n\t\t$(this).remove();\n\t});\n}", "title": "" }, { "docid": "fc345c24f980b2ff4e1eb182b8f16c22", "score": "0.6580183", "text": "function mensajes_modal2(texto)\n{\n crear_modal2(texto);\n $(\"#modal_mensaje2\").modal(\"show\");\n}", "title": "" }, { "docid": "aae03214fc35a5360ad66168a921af50", "score": "0.65794086", "text": "MODAL_OPEN({ commit }, data) {\t\t\n\t\tcommit(\"SET_MODAL_OPEN\", data);\n\t}", "title": "" }, { "docid": "82e885c50dc5f1afcc1f173857b8f722", "score": "0.657928", "text": "function modelExtra(botonTrigger) {\n var modal = document.getElementById(\"agregarExtras\");\n if (botonTrigger === null) {\n var btn = document.getElementById(\"ExtraBtn\");//noombre del boton trigger\n } else {\n var btn = document.getElementById(botonTrigger);//noombre del boton de insertar...por defaul\n }\n var span = document.getElementsByClassName(\"ExtraSpan\")[0]; //span class\n\n btn.onclick = function () {\n modal.style.display = \"block\";\n }\n\n span.onclick = function () {\n modal.style.display = \"none\";\n }\n\n window.onclick = function (event) {\n if (event.target == modal) {\n modal.style.display = \"none\";\n //limpiar los inputs\n document.getElementById(\"nombreE\").setAttribute(\"value\", \"\");\n document.getElementById(\"precioE\").setAttribute(\"value\", null);\n }\n }\n}", "title": "" }, { "docid": "10e724527e2139fa35a8202a4df33ba4", "score": "0.6578923", "text": "function socioEdicion(){\n $('#modalEdicion').on('shown.bs.modal', function () { \n $('#snombreu').focus(); \n }) \n }", "title": "" }, { "docid": "f080de6d3a4967357ad9d6be8e8ecb95", "score": "0.65777564", "text": "function agroquimicaNuevo(){\n $('#modalNuevo').on('shown.bs.modal', function () { \n $('#pagro').focus(); \n }) \n }", "title": "" }, { "docid": "9390fd567d448c1321ceb8f33af435ff", "score": "0.6576012", "text": "function EvaluaMensaje(Titulo, Mensaje) {\n $('[id*=lbl_TitMensaje]')[0].innerText = Titulo;\n $('[id*=txt_Mensaje]')[0].innerText = Mensaje;\n $('#MensajeModal').modal('show');\n $('#MensajeModal').draggable();\n}", "title": "" }, { "docid": "b6662942f7e0d464d20bbca19f0d0d8c", "score": "0.657009", "text": "function modalSelected(e) {\n var currentModalOpen = false;\n var teamData = mandr_team_data['team-' + e.currentTarget.id];\n\n // Find out if the modal is already open\n var tester = document.getElementById('modal-' + e.target.id);\n if (tester) {\n currentModalOpen = true;\n }\n\n // Close all active modals\n closeModals();\n\n // If opening a new modal, start and pass mouse position for the modal\n if (!currentModalOpen && teamData) {\n modalBuild(teamData, e.pageX, e.pageY);\n }\n }", "title": "" }, { "docid": "a32dac4abc8bf8268c8d174185c8fdd3", "score": "0.6563965", "text": "function siembraNuevo(){\n $('#modalEdicion').on('shown.bs.modal', function () { \n $('#cantidadu').focus(); \n }) \n }", "title": "" }, { "docid": "b0a52f45ba149317c68ef5ea71292e44", "score": "0.65637183", "text": "function socioNuevo(){\n $('#modalNuevo').on('shown.bs.modal', function () { \n $('#snombre').focus(); \n }) \n }", "title": "" }, { "docid": "f45f5a7f1fd9cf11d451bf4f8f0bf086", "score": "0.65618926", "text": "function clickComplete(){\n\n\t\t\t\t\t\t\t\t$modDat\n\t\t\t\t\t\t\t\t\t.css({'min-height' : '0'})\n\t\t\t\t\t\t\t\t\t.html($m.modal.populate.entries($reg, $chf)); // populate the modal data\n\n\t\t\t\t\t\t\t\tTweenMax.set($modDat, {'left' : '-20px'}); // set the new content off to the left\n\t\t\t\t\t\t\t\tTweenMax.to($modDat, $ani, {'left' : '0', 'opacity' : '1'}); // animate the content in from the left\n\n\t\t\t\t\t\t\t} // end of clickComplete fnc", "title": "" }, { "docid": "df9f24e1b8dd09d93e584ec0ef8d2199", "score": "0.65613514", "text": "function clickEvent(e) { showModal($(this), args); }", "title": "" }, { "docid": "8103c8176d98b3f1effbd7e32cbb3852", "score": "0.65517", "text": "function setListenersOnBackFromController() {\n $('#editSongAlbumModal').modal('show');\n $('#formEditSongAlbum').addClass('d-none');\n $('#editButton').addClass('d-none');\n\n $('#editSongAlbumModal').on('hidden.bs.modal', function() {\n $('#modalAlertEditSong').addClass('d-none');\n $('#formEditSongAlbum').removeClass('d-none');\n $('#editButton').removeClass('d-none');\n });\n}", "title": "" }, { "docid": "f7c7f35401ef23f02d5a8c09f6e6dcb3", "score": "0.65446", "text": "actionModalDialog() {\n this.send(this.get('action'));\n this.set('showModal', false);\n }", "title": "" }, { "docid": "2e4315ae28d6859b44041cd05309563c", "score": "0.6534666", "text": "function merchClick(){\n var mItem = $(this).attr('name')\n displayModal(mItem);\n }", "title": "" }, { "docid": "8f84ac9502e79d9a3316a41d4a225330", "score": "0.6533556", "text": "function PrizeModalChange(stringObjectivo){\n imagePrizeChange(stringObjectivo);\n textModalchange(stringObjectivo);\n}", "title": "" }, { "docid": "6e9dc80b5b2cad4efb8bef8a11a695b5", "score": "0.6532466", "text": "function show_informacion_modal(agregar){\n $('#agregar-modal').modal();\n\n $('.delete-form input').attr('type', 'button');\n\n console.log('agregar', agregar)\n if (!agregar) {\n console.log(\"proeans\")\n $('#submit-btn').addClass('d-none');\n $('.asignatura-btn').removeClass('d-none');\n $('.editar_asignatura').html('<i class=\"far fa-edit\"></i>');\n $('.editar_asignatura').addClass('btn-success');\n $('.editar_asignatura').removeClass('btn-primary');\n\n $('#eliminar-btn').attr('data-codasig', $('[name=\"detail_codasig\"]').val())\n $('.editar_asignatura').attr('data-id', $('[name=\"detail_id\"]').val())\n }\n else {\n // activarPlugins()\n $('#submit-btn').removeClass('d-none');\n $('.asignatura-btn').addClass('d-none');\n }\n}", "title": "" }, { "docid": "1d401668ae1f9fff97745b742f2af192", "score": "0.6527369", "text": "function clickComplete(){\n\n\t\t\t\t\t\t\t\t$modDat\n\t\t\t\t\t\t\t\t\t.css({'min-height' : '0'})\n\t\t\t\t\t\t\t\t\t.html($m.modal.populate.entries($reg, $chf)); // populate the modal data\n\n\t\t\t\t\t\t\t\tTweenMax.set($modDat, {'left' : '20px'}); // set the new content off to the right\n\t\t\t\t\t\t\t\tTweenMax.to($modDat, $ani, {'left' : '0', 'opacity' : '1'}); // animate the content in from the right\n\n\t\t\t\t\t\t\t} // end of clickComplete fnc", "title": "" }, { "docid": "dd7bb7512202d36ec999e0b09c539b70", "score": "0.65261906", "text": "function showModal() {\n\t\t \t\n\t\t \tvar action = $(\"#myModal\").attr(\"action\");\n\t\t \n\t\t \tif (action == 'update' || action == 'create') {\n\t\t \t\t$(\"#myModal\").modal(\"show\");\n\t\t \t}\n\t\t \t\n\t\t }", "title": "" }, { "docid": "a0708c2afbaa053e9f2510d33d96e00e", "score": "0.6517807", "text": "function montaModal_listaAtividade(){\n\t$('.modal-trigger').leanModal();\n}", "title": "" }, { "docid": "7e308f52db84ffc70abcea172f43f821", "score": "0.6517292", "text": "openModal() { \n this.bShowModal = true;\n }", "title": "" }, { "docid": "5a1527c7510af53bdcd10df4cf9647da", "score": "0.6501583", "text": "function editarMproducto(){\n $('#modalEdicion').on('shown.bs.modal', function () { \n $('#codigo_barrau').focus(); \n }) \n }", "title": "" }, { "docid": "e7ea95d4276ef5ded54dde9ca824553e", "score": "0.6499581", "text": "eventHandlerDetalleShoppingCart(){\n\n // Suscribe al Evento Modal - Detalle del carrito\n $(\"#idCarrito\").click( buildItemsInShoppingCart ) ;\n\n // Suscribe al Evento Iniciar Compra\n $(\"#comprar\").click( iniciarCompra ) ;\n\n }", "title": "" }, { "docid": "cf7656075c3b3d36879370cfd96be5ca", "score": "0.64979947", "text": "function showModal(event){\r\n\t\t$('#modal-ToDos').fadeIn();\r\n\t\t$('.modal_ToDos-List').show();\r\n\t}", "title": "" }, { "docid": "6201ed49c5d79339d0cd5d0747ebc740", "score": "0.6488472", "text": "function agregar() {\r\n // se llama la funcion para limpiar los campos del formulario ubicado ene el modal\r\n limpiarCAmpos();\r\n // se cambian los botones del modal para mejor funcionabilidad\r\n $(\".modal-footer\").html(`<button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">Cerrar</button>\r\n <button type=\"button\" class=\"btn btn-primary\" onclick=\"guardar()\">Guardar</button>`);\r\n $(\"#modalProductos\").modal(\"show\");\r\n}", "title": "" }, { "docid": "f16cd0ed11ffcb2f49c75fa7d80cb506", "score": "0.6484301", "text": "function ShowModal() {\n\n // first, check to see if we should serve the modal. Modals get served any time \n // the session_count is less than or equal to three, except when both the cbwmodal cookie\n // value is \"skip\" and the session hasn't changed.\n if (ServeData.session_count <= 3 && (GetCookie(\"cbwmodal\") != \"skip\" || SessionChanged)) {\n\n //var modal_message = \"<span style='font-size:24px;font-weight:bold;'>Big News!</span><br/>We're donating up to 20% of our sales to the {{placeholder}}, and you don't need to buy a thing! Click <img id='cbw-modal-message-img1' class='cbw-modal-message-img cbw-main-btn cbw-close-modal'> or <img id='cbw-modal-message-img2' class='cbw-modal-message-img cbw-main-btn cbw-close-modal'> on any page to learn more.\";\n\n var modal_message1 = \"<span style='font-size:24px;font-weight:bold;'>Welcome, friend of {{placeholder}}!</span><br/>We're donating 20% of your purchase to {{placeholder}}. Plus, click any <img id='cbw-modal-message-img2' class='cbw-modal-message-img cbw-main-btn cbw-close-modal'> tell your friends on Facebook and Twitter about us and we'll donate 20% of everything they buy!\";\n\n var modal_message2 = \"<span style='font-size:24px;font-weight:bold;'>Big News!</span><br/>We're donating up to 20% of our sales to the charitable cause of your choice, and you don't need to buy a thing! Click any <img id='cbw-modal-message-img2' class='cbw-modal-message-img cbw-main-btn cbw-close-modal'> to learn more.\";\n // now check to see if a cblink value was passed in and if so, use the default cause\n // for this serve in the modal message\n if (CBCauseID && CBCauseID != \"\") {\n modal_message = modal_message1.replace(/{{placeholder}}/g, ServeData.default_cause_name);\n // Fix duplicate \"the\"s, and the \"the a\"s\n // FixCauseNames(modal_message);\n } else {\n // otherwise, just use the standard messaging\n modal_message = modal_message2;\n }\n \n // add the div that contains the modal, then add the text, css, and close button to the modal div\n $(\"<div id=\\\"cbw-modal-div\\\" class=\\\"cbw-reset cbw\\\">\").html( \"<div id='cbw-modal-1' class='cbw-modal'></div>\" ).appendTo(div);\n $(\"#cbw-modal-1\").append( modal_message);\n //$(\"#cbw-modal-1\").text( modal_message );\n $(\"#cbw-modal-1\").css({\n position: 'fixed',\n top: ($(window).height() - $(\"#cbw-modal-1\").height())/2,\n left: ($(window).width() - $(\"#cbw-modal-1\").width())/2,\n zIndex: 10000\n });\n //$(\"#cbw-modal-1\").append(\"<img id='cbw-modal-message-img1' class='cbw-modal-message-img'> or <img id='cbw-modal-message-img2' class='cbw-modal-message-img'> on any page to learn more.\");\n //$(\"#cbw-modal-1\").append(\"<img id='cbw-modal-message-img2' class='cbw-modal-message-img'>\");\n //$(\"#cbw-modal-1\").append(\"more text here\");\n //closeButton = $('<a href=\"#close-modal\" rel=\"cbw-modal:close\" class=\"close-modal\">' + 'close text' + '</a>');\n closeButton = $('<div id=\"cbw-close-modal-icon\" class=\"cbw-close-modal\"></div>');\n $(\"#cbw-modal-1\").append(closeButton);\n\n // $(\"#cbw-modal-message-img\").attr('src', CBAssetsBase + 'cb-white-ltblue-15x123.svg');\n $(\"#cbw-modal-message-img1\").attr('src', CBAssetsBase + 'causebutton-160x40.png');\n $(\"#cbw-modal-message-img2\").attr('src', CBAssetsBase + 'cause-86x40.png');\n $(\".cbw-modal-message-img\").css(\"height\",\"30\");\n \n // now add the tranparant background div and give it the correct styles\n $(\"<div id=\\\"cbw-modal-blocker-div\\\">\").html('<div class=\"jquery-modal blocker\"></div>').appendTo(div);\n $(\"#cbw-modal-blocker-div\").css({\n top: 0, right: 0, bottom: 0, left: 0,\n width: \"100%\", height: \"100%\",\n position: \"fixed\",\n zIndex: 9999,\n background: \"#333\",\n opacity: .75\n });\n\n // show the modal dialog\n $('#cbw-modal-1').show();\n\n // finally, set the cbwmodal cookie value to skip so this modal doesn't get shown \n // for this serve for at least another 24 hours\n SetCookie(\"cbwmodal\", \"skip\", 1440, \"/\");\n\n }\n\n }", "title": "" }, { "docid": "004058f84f3a2a674aa154052b11e5c7", "score": "0.64839655", "text": "function modalSucesso() {\n var stringHtml = ''\n + '<div class=\"row\">'\n + '<div class=\"col-md-12\">'\n + '<div class=\"text-center\">'\n + '<h4>Contrato cadastrado com <b>sucesso</b>.</h4>'\n + '</div>'\n + '</div>'\n + '</div>'\n + '<div class=\"row\">'\n + '<div class=\"col-md-2 col-md-offset-5\">'\n + '<button id=\"botaoOk\" class=\"btn btn-success btn-block\">OK</button>'\n + '</div>'\n + '</div>';\n\n $('#modalRodape').empty();\n $('#modalTitulo').html('Contrato Cadastrado');\n $('#modalCorpo').html(stringHtml);\n $('#botaoOk').click(function () {\n location.reload();\n limparTudo();\n });\n }", "title": "" }, { "docid": "c43ce6e8029c4c7ffe13c0976d1fd33c", "score": "0.6482991", "text": "function showModal(event) {\n var eventTarget = event.target;\n var eventTrigger = eventTarget.parentNode;\n var mymodal = $('#myModal');\n // console.log(thisa.dataset.alliance);\n mymodal.find('#modaltitle').text(eventTrigger.dataset.name);\n mymodal.find('#imagemodal').attr('src', eventTrigger.dataset.image);\n mymodal.find('#type').text(eventTrigger.dataset.genre);\n mymodal.find('#habitat').text(eventTrigger.dataset.habitat);\n mymodal.find('#group').text(eventTrigger.dataset.group);\n mymodal.find('#description').text(eventTrigger.dataset.description);\n mymodal.modal('show');\n }", "title": "" }, { "docid": "3b45bcb6a6c183db9444309ac476f062", "score": "0.64823943", "text": "function showModalDelete() {\n if (registros.status == '1') {\n var status = '0';\n $(\"#Modal-eliminaRegistro-Titulo\").text('Eliminar registro');\n $(\"#Modal-eliminaRegistro-Color\").removeClass(\"w3-blue\").addClass(\"w3-red\");\n } else {\n $(\"#Modal-eliminaRegistro-Color\").removeClass(\"w3-red\").addClass(\"w3-green\");\n $(\"#Modal-eliminaRegistro-Titulo\").text('Activar registro');\n var status = '1';\n }\n $(\"#eliminaID\").val(registros.id);\n $(\"#eliminaStatus\").val(status);\n $(\"#eliminaRegistro\").attr('action', idTablaLista.toLowerCase() + '/elimina');\n $(\"#Modal-eliminaRegistro-Contenido\").text('Clave = ' + registros.id + ' Nombre = ' + registros.nombre);\n $(\"#Modal-eliminaRegistro\").modal(\"show\");\n }", "title": "" }, { "docid": "41737f8154d3982329bd2d57a86375ee", "score": "0.6479954", "text": "function addNewEvent() {\n $('#AddEvent').modal('show');\n}", "title": "" }, { "docid": "e5518c53cc4bf316656d33fd4a76b1dc", "score": "0.6476265", "text": "saveModal()\n {\n this.columns=this.selectedFields;\n this.values=this.defaultValues;\n this.isModalOpen=false;\n }", "title": "" }, { "docid": "be7d6ceff13084f19f1a176bbede11d3", "score": "0.6474395", "text": "function setShowModal(e) {\n updateShowModal(!showModal)\n }", "title": "" }, { "docid": "4c57504fa240a05899ac3224dbb790e6", "score": "0.64661294", "text": "function seleccionar_producto(id_producto){\naddCarrito(id_producto);\n$('#modal-consultar-productos').modal('hide'); \n}", "title": "" }, { "docid": "dcee1a435a065015990098c362be8f31", "score": "0.6463878", "text": "function modalShow(title, footer)\n{\n $('#commonModalBody').html('<div class=\"loader\"></div>');\n $('#commonModalTitle').html('<b>'+title+'</b>');\n $('#commonModalFooter').html(''+footer+'');\n $('#commonModal').modal('show');\n}", "title": "" }, { "docid": "be10f10179b174dadb35c4b555fd4a69", "score": "0.6461028", "text": "function openModal(modal) {\n if (modal == null) return;\n if (modal != null) {\n // const button = document.getElementById(\"submitButton\");\n modal[0].classList.add(\"active\");\n overlay.classList.add(\"active\");\n createBeerForm();\n createIngForm();\n }\n} //event handler for opening modal and appending new beer form", "title": "" }, { "docid": "3fb27bd8c96a385bce52bd3a5f2b3dbe", "score": "0.646009", "text": "function handleModal(modalTitle, modalMsg, modalButton) {\n $('#myModal').on('shown.bs.modal', function () {\n $('#myModal').find('h4').html(modalTitle);\n $('#myModal').find('p').html(modalMsg);\n $('#myModal').find(':button').text(modalButton);\n $('#myInput').focus();\n });\n $('#myModal').modal('show');\n $('#myModal').on('hidden.bs.modal', function (e) {\n level.gameOver = false; // When dismissing the modal, re-enable 'allowedKeys'\n });\n}", "title": "" }, { "docid": "c720c34b555f8ee936d18baccfc76eb6", "score": "0.64583194", "text": "function fnAgregarCatalogoModal(){\n\t$('#divMensajeOperacion').addClass('hide');\n\t//console.log(\"fnAgregarCatalogoModal\");\n\n\tproceso = \"Agregar\";\n\n\t$(\"#txtClave\").prop(\"readonly\", false);\n\t$('#txtClave').val(\"\");\n\t$('#txtDescripcion').val(\"\");\n\n var titulo = '<h3><span class=\"glyphicon glyphicon-info-sign\"></span> Agregar Identificación de la Fuente</h3>';\n\n\n\t$('#ModalUR_Titulo').empty();\n $('#ModalUR_Titulo').append(titulo);\n\t$('#ModalUR').modal('show');\n}", "title": "" }, { "docid": "5e2a316809eafc8a5d122c6deac3c40f", "score": "0.6454579", "text": "function MandaMessaggioInserimento(testo) {\n jQuery(\"#testo-modal\").html(testo);\n jQuery(\"#modal-accettazione\").modal(\"toggle\");\n}", "title": "" }, { "docid": "05a9b78d426054a00f92321a24cbf411", "score": "0.64540446", "text": "function modalNuevaAlta() {\n $('#contratoDetallesmodalEN').modal();\n $('#form-ver').modal('hide');\n limpiarNuevosDatosAlta();\n validacionNuevaAlta();\n $('#nueva_alta_again').prop('disabled', false);\n}", "title": "" }, { "docid": "5cb48d133938ff1bc28df3a7004c8ab7", "score": "0.6451724", "text": "function handler() { \n \n $('#myModalColumn').foundation('reveal', 'open');\n $('#thisHolder').val($( this ).attr('id'));\n var templateName = $('#templateName').val();\n }", "title": "" }, { "docid": "b7e9312e9eed331183a606c17f9d8f1c", "score": "0.64436805", "text": "function modalOpen() {\n var verse = $('#verse').val();\n if (!verse)\n {\n $('#error').addClass(\"alert alert-danger alert-block\")\n $('#error strong').html(\"Vous n'avez pas spécifié de vers !\");\n } else {\n var modal = $('#exampleModalCenter')\n modal.modal(\"show\")\n // Hide the buttom if the verse is at 15\n if (parseInt($('.col-md-12 #verseActive:last').text()) + 1 >= $('#lastCountVerse').text()) {\n $(\"#continue\").css(\"display\", \"none\");\n }\n modal.find('.modal-body #modalVerse').text(verse)\n modal.find('.modal-body #verseModal').val(verse)\n }\n }", "title": "" }, { "docid": "19fbb14df980abd1fcc43355c2925a34", "score": "0.64431685", "text": "function modal_handel(info) {\n $(\".info.\" + info).on('click', function () {\n $('#airaModal').show();\n $(\".aira-modal-content.\" + info).show();\n });\n\n $(\".aira-close\").on('click', function () {\n $('#airaModal').hide();\n $(\".aira-modal-content.\" + info).hide();\n });\n}", "title": "" }, { "docid": "457c9bafaae7fed57b7ed864d7fba226", "score": "0.6441826", "text": "function MasInformacionProveedor(idconsecutivo,posicion) {\n\n document.getElementById('DetalleModalProveedortitle').innerHTML = 'Contacto de la Orden ' + datosordenproveedor[posicion].Codigo_Solicitud_Ciklos + ' - ' + idconsecutivo;\n\n document.getElementById('lblpacientePro').innerHTML = datosordenproveedor[posicion].Id_Afiliado;\n document.getElementById('lblpacientenombre').innerHTML = datosordenproveedor[posicion].NombreCompleto;\n document.getElementById('lblcontacto').innerHTML = datosordenproveedor[posicion].Contacto;\n document.getElementById('lblestado').innerHTML = datosordenproveedor[posicion].EstadoProveedor;\n document.getElementById('lblobgene').innerHTML = datosordenproveedor[posicion].ObservacionesGen;\n document.getElementById('lblfechaciklos').innerHTML = datosordenproveedor[posicion].Fecha_Registro_Solicitud\n document.getElementById('lblprofesionalsol').innerHTML = datosordenproveedor[posicion].ProfesionalSolicita;\n document.getElementById('lbldetalleciklos').innerHTML = datosordenproveedor[posicion].Descripcion;\n //document.getElementById('lblobaud').innerHTML = datosordenproveedor[posicion].ObservacionesAud; \n\n $(\"#DetalleModalProveedor\").modal();\n }", "title": "" }, { "docid": "c30b66cb623dbd7d02c7bb4e72b7f7a2", "score": "0.64377034", "text": "showModalDialog(event) {\n\t\t\tvar _event_id = event.id;\n\t\t\tthis.get('routing.router').transitionTo('month.modal', _event_id);\n\t\t}", "title": "" }, { "docid": "bd5cc95fdefebe04f393faeb24e5dfa7", "score": "0.64347136", "text": "function OpenModal() {\n\n limpiar();\n $(\".modal-title\").text(\"Registrar Sub Categoria\");\n $('#modal-subcategoria').modal('show');\n}", "title": "" }, { "docid": "32914edc0ccfd7519c0d6b097bc0f3c3", "score": "0.6432843", "text": "modal() {\n\t\t\n\t\tconst popup = document.querySelector('.modal');\n\t\tpopup.classList.remove('hide'); \n\n\t\tdocument.querySelector('.yes-please').addEventListener('click', function() {\n\t \t\tpopup.classList.add('hide'); \t\n\t \t}); \n\n\t\tdocument.querySelector('.no-thanks').addEventListener('click', function(){\n\t \tpopup.classList.add('hide');\n\t \tplayer.stopPlaying = true;\n\t\t});\n\t}", "title": "" }, { "docid": "00466faa38cb13c447a013103644b74d", "score": "0.64319015", "text": "function guardar_editar_etiqueta(e) {\n\n $(\".modal-body\").animate({ scrollTop: $(document).height() }, 1000); // colocamos el scrol al final\n\n crud_guardar_modal(\n e,\n '/dashboard/configuracion/etiquetas/guardar-editar',\n 'etiquetas',\n function(){ limpiar_form_etiqueta(); },\n function(){ console.log('Console Error'); }\n );\n}", "title": "" }, { "docid": "f998849b5e31a7a4a4cec386e5c6f2b6", "score": "0.64288133", "text": "function editarcedulas(e, id){\n\n e.preventDefault();\n let modaleditar = document.getElementById(\"modal-editar-cedulas\");\n\n modaleditar.style.opacity = 1;\n modaleditar.style.visibility = \"visible\";\n modaleditar.children[0].classList.remove(\"modal-close\");\n\n //#region Cerrar modal editar\n\n modaleditar.children[0].children[0].children[0].children[0].addEventListener(\n \"click\",\n () => {\n modaleditar.children[0].classList.add(\"modal-close\");\n\n setTimeout(() => {\n modaleditar.style.opacity = 0;\n modaleditar.style.visibility = \"hidden\";\n }, 500);\n }\n );\n\n //#endregion\n\n}", "title": "" }, { "docid": "d9605689b30fbc9fcd514304313b7740", "score": "0.64157677", "text": "openCloseModal() {\n if (this.carrello.length < 1 && !this.toggleModal) {\n alert('Attenzione! Carrello vuoto!')\n\n } else {\n this.toggleModal = !this.toggleModal\n }\n\n }", "title": "" }, { "docid": "53e4d605b3119fff745ac15c3dc5fd6f", "score": "0.6411731", "text": "function showModal(event) {\n $('.modal').modal('show');\n const clickedButton = $(event.target);\n const div = clickedButton.parents('.col-auto.mt-3');\n div.attr('id', 'clicked');\n}", "title": "" }, { "docid": "d8b8698d5f10ef3f349ee302c56a444a", "score": "0.6408226", "text": "modalFilled (modal) {\n let cr = document.getElementById('create-room')\n if(!cr) document.querySelector('.tingle-modal-box__footer').style.display='flex';\n let type = modal.__type;\n setTimeout(function(){ modal.checkOverflow() }, 300);\n var letsgo = document.querySelectorAll('.letsgo');\n if(!letsgo.length){\n\n modal.addFooterBtn(\"Let's Go ! <i class='fas fa-chevron-right'></i>\", 'tingle-btn tingle-btn--primary letsgo tingle-btn--pull-right', function(e){\n try { med.mutedStream = med.h.getMutedStream(); } catch(err){ console.warn(\"error in getting mutedstream\",err); }\n self.handleOk({type,modal,e});\n\n });\n }\n }", "title": "" }, { "docid": "f4270583b6c5e71c3c699c66b7045d45", "score": "0.6407148", "text": "function openModal() { \n $resetModal.hide(); \n $modalTitle.text('Confirmation'); \n const msg1 = document.querySelector('.modal-message');\n msg1.innerHTML ='Votre réservation a bien été annulée'; \n $okBtn.text('OK'); \n $modal.show();\n}", "title": "" }, { "docid": "3f01be5a720f30019bd8c34b96347a19", "score": "0.64061105", "text": "function abrirModalUsuarios(){\n $('#tituloModal').text(\"Buscar Usuarios\");\n $('#modal_usuarios').modal('show');\n }", "title": "" }, { "docid": "1dee68cd86591caece656f87fb367fbc", "score": "0.64031875", "text": "function modal1() {\r\n modal.style.display = \"block\";\r\n }", "title": "" }, { "docid": "421a2833f20822184265b2a144a405d6", "score": "0.6403156", "text": "function openToevoegenModal() {\n $('#CalendarModalToevoegen').modal();\n}", "title": "" }, { "docid": "e1bb5a2fd1f327e98eae19ce246a852b", "score": "0.64022326", "text": "function open_model() {\n modal.style.display = \"block\";\n }", "title": "" }, { "docid": "9186dbac8187dff3e5b7f280c3fd2e83", "score": "0.63981724", "text": "function cliqueFora() {\n const modal = document.querySelector(\".modal\");\n const body = document.querySelector(\"body\");\n\n window.addEventListener(\"click\", (event) => {\n if (\n event.target.className == \"div-botao\" ||\n event.target.className == \"container\" ||\n event.target.className == \"body\" ||\n event.target.className == \"div-logo\" ||\n event.target.className == \"div-btn\" ||\n event.target.className == \"nav\"\n ) {\n modal.style.display = \"none\";\n body.style.background = \"#fff\";\n }\n });\n\n //ESC PARA FECHAR O MODAL\n window.addEventListener(\"keyup\", (event) => {\n if (event.key === \"Escape\") {\n modal.style.display = \"none\";\n body.style.background = \"#fff\";\n }\n });\n}", "title": "" }, { "docid": "33077d03f1682ad4968297ed6b5b6b75", "score": "0.63980794", "text": "function dismissModal(){\n vent.trigger(events.DISMISS, currentModal);\n}", "title": "" }, { "docid": "a7fa6de73f3bf2860d358ce4c07746b6", "score": "0.63965356", "text": "function addOrder() {\n $('#selectRestaurant').modal();\n}", "title": "" }, { "docid": "6b00f83e45c9e838ca24341d669d0a23", "score": "0.63947594", "text": "function iniciaModal(modalID) {\r\n const modal = document.getElementById(modalID);\r\n//Se ele não consegui selecionar vai da falso e então ele não executa o código\r\n if(modal) {\r\n document.getElementById('login').classList.remove('mostrar');\r\n document.getElementById('modal-cadastro').classList.remove('mostrar');//Tirar a class mostrar dos dois modais\r\n document.querySelectorAll('.error').forEach((item)=>{\r\n item.classList.remove('error');//remove o erro antes de abrir o modal\r\n })\r\n modal.classList.add('mostrar'); //Listar todas as class e adicionar a que eu quero\r\n modal.addEventListener('click', (e) => {\r\n//Se clicar fora do modal ou no botão de x fecha o modal\r\n if(e.target.id == modalID || e.target.className == 'fechar' || e.target.className == 'fechar-login'){\r\n modal.classList.remove('mostrar');\r\n }\r\n });\r\n }\r\n}", "title": "" }, { "docid": "b4a2db892451dcd415f8fb1ce3dd4f08", "score": "0.6387724", "text": "function crear_modal(texto)\n{\n var cuerpo=texto;\n var cabecera='<h3 class=\"modal-title\" id=\"myModalLabel\" name=\"myModalLabel\" >Informaci&oacute;n:</h3>';\n //$(\"#cuerpo_mensaje\").css({\"height\":\"auto\"});\n $(\"#cuerpo_mensaje\").removeClass(\"cuerpo_normal\").removeClass(\"cuerpo_xdefecto\").removeClass(\"cuerpo_astecnico\").addClass(\"cuerpo_auto\");\n $(\"#cabecera_mensaje\").html(cabecera);\n $(\"#cuerpo_mensaje\").html(cuerpo);\n}", "title": "" }, { "docid": "cf924e42f7770b8b0d352a5f3ba21ce3", "score": "0.63801336", "text": "function limpiarMparcela(){\n $('#modalNuevo').on('shown.bs.modal', function () { \n $('#pnombre').focus();\n $('#pnombre').val(\"\");\n $('#pnumero').val(\"\");\n $('#pzona').val(\"\"); \n $('#pnota').val(\"\");\n }) \n }", "title": "" }, { "docid": "c739d01a2a0a8fbda0e480194e48fb80", "score": "0.6378869", "text": "function modal_ver_usuario(){\n\n $(document).on('click', '.ver-usuario', function(){\n\n // Inicializamos el modal\n var id_usuario = $(this).closest('.row-usuario').attr('id')\n console.log('idusuario: ', id_usuario)\n var este_usuario = get_object_by_id(id_usuario, global_usuarios)\n console.log('este usuario: ', este_usuario)\n $('#mu-id').val(este_usuario.id)\n $('#mu-nombre').val(este_usuario.nombre)\n $('#mu-apellido').val(este_usuario.apellido)\n $('#mu-telefono').val(este_usuario.telefono)\n $('#mu-mail').val(este_usuario.mail)\n $('#mu-pais').val(este_usuario.pais)\n $('#mu-fecha-nacimiento').val(este_usuario.fecha_nacimiento)\n var estado = 'Activo'\n if(este_usuario.estado==0){\n estado = 'Inactivo'\n }\n $('#mu-estado').val(estado)\n\n $('#ver-usuario-modal').fadeIn(100)\n })\n $(document).on('click', '#ver-usuario-modal .descartar-cambios, #ver-usuario-modal .mm-cerrar', function(){\n $('#ver-usuario-modal').fadeOut(100)\n })\n\n $(document).on('click', '#ver-usuario-modal', function(e){\n e.stopPropagation()\n })\n\n \n\n return `<div id=\"ver-usuario-modal\" class=\"m-modal\">\n <div>\n <div class=\"mm-cerrar\">x</div>\n\n \n <div class=\"mm-heading\">\n <div class=\"datos-inputs-cont\">\n <label>ID</label>\n <input disabled type=\"text\" value=\"\" id=\"mu-id\">\n </div>\n <div class=\"datos-inputs-cont\">\n <label>Nombre</label>\n <input disabled type=\"text\" value=\"Nombre\" id=\"mu-nombre\">\n </div>\n <div class=\"datos-inputs-cont\">\n <label>Apellido</label>\n <input disabled type=\"text\" value=\"Apellido\" id=\"mu-apellido\">\n </div>\n <div class=\"datos-inputs-cont\">\n <label>Fecha de nacimiento</label>\n <input disabled type=\"text\" value=\"03/03/1198\" id=\"mu-fecha-nacimiento\">\n </div>\n <div class=\"datos-inputs-cont\">\n <label>Telefono</label>\n <input disabled type=\"text\" value=\"11 3453-6398\" id=\"mu-telefono\">\n </div>\n <div class=\"datos-inputs-cont\">\n <label>Mail</label>\n <input disabled type=\"text\" value=\"[email protected]\" id=\"mu-mail\">\n </div>\n <div class=\"datos-inputs-cont\">\n <label>País</label>\n <input disabled type=\"text\" value=\"Argentina\" id=\"mu-pais\">\n </div>\n <div class=\"datos-inputs-cont\">\n <label>Estado</label>\n <input disabled type=\"text\" value=\"\" id=\"mu-estado\">\n </div>\n </div>\n <div>\n \n </div>\n \n </div>\n </div>` \n}", "title": "" }, { "docid": "69c6acf2bdb719b0ba926525ef1c84c8", "score": "0.6375649", "text": "function abrirConfirmModificarCongreso(){\n $('#confirmModificarCongreso').modal({\n backdrop: 'static',\n keyboard: false\n })\n .on('click', '#modificar', function(e) {\n $(\"#formularioModificarCongreso\").submit();\n });\n}", "title": "" }, { "docid": "e4df826df4bbcbb862dafdea72fb9771", "score": "0.63720393", "text": "openModal(event) {\n if(event.target.matches('.toolbar-delete')) return;\n if (event.target.closest('.note')) {\n this.$modal.classList.toggle('open-modal'); \n this.$modalTitle.value = this.title;\n this.$modalText.value = this.text;\n }\n }", "title": "" }, { "docid": "7a68c0b3935ea705b20bf01a2a9d757e", "score": "0.6367531", "text": "function exibirModalAcompanharPedido(event) {\t\n\t\tevent.preventDefault();\n\t\tvar pet = $(this).parent().parent().find('.result_checkbox_ped').val();\n\t\t$('.modal_acompanhar_pedido_hidden_cod').val(pet);\n\t\t$('.emailsAcompanharPedido').val($('input[name=\"userEmailSend\"]').val()+',');\t\n\t\t$('.telaoscura').fadeIn('slow');\n\t\t$('.modal_acompanhar_pedido').fadeIn('slow');\n\t\t$('html, body').css({\n\t\t\toverflow: 'hidden'\n\t\t});\n\t}", "title": "" }, { "docid": "bce60ffe29872a4e1f30cb35a237e0e9", "score": "0.6364966", "text": "function click(d) {\n\n if (curModal == \"echo\") {\n var modal = document.getElementById(\"myModalECHO\");\n modal.style.display = \"block\"; //change display to block so that it appears\n\n var span = document.getElementById(\"closeECHO\");\n span.onclick = function() {\n var modal = document.getElementById(\"myModalECHO\");\n modal.style.display = \"none\"; //change display to none when X is clicked\n }\n }\n\n if (curModal == \"bulb\") {\n var modal = document.getElementById(\"myModalBULB\");\n modal.style.display = \"block\"; //change display to block so that it appears\n\n var span = document.getElementById(\"closeBULB\");\n span.onclick = function() {\n var modal = document.getElementById(\"myModalBULB\");\n modal.style.display = \"none\"; //change display to none when X is clicked\n }\n }\n\n if (curModal == \"roomba\") {\n var modal = document.getElementById(\"myModalROOMBA\");\n modal.style.display = \"block\"; //change display to block so that it appears\n\n var span = document.getElementById(\"closeROOMBA\");\n span.onclick = function() {\n var modal = document.getElementById(\"myModalROOMBA\");\n modal.style.display = \"none\"; //change display to none when X is clicked\n }\n }\n\n if (curModal == \"nest\") {\n var modal = document.getElementById(\"myModalNEST\");\n modal.style.display = \"block\"; //change display to block so that it appears\n\n var span = document.getElementById(\"closeNEST\");\n span.onclick = function() {\n var modal = document.getElementById(\"myModalNEST\");\n modal.style.display = \"none\"; //change display to none when X is clicked\n }\n }\n\n if (curModal == \"security\") {\n var modal = document.getElementById(\"myModalSECURITY\");\n modal.style.display = \"block\"; //change display to block so that it appears\n\n var span = document.getElementById(\"closeSECURITY\");\n span.onclick = function() {\n var modal = document.getElementById(\"myModalSECURITY\");\n modal.style.display = \"none\"; //change display to none when X is clicked\n }\n }\n}", "title": "" }, { "docid": "9573c2888eae7837a2bf7c28126d603b", "score": "0.63632256", "text": "function modal(id_detalle) {\n var data = { id_detalle: id_detalle };\n $.ajax({\n dataType: 'json',\n method: 'POST',\n url: Routing.generate('ajax_cargar_opciones_valores'),\n data: data,\n }).done(function(response) {\n $(\"#detalle\").val(id_detalle); //cargo el id del detalle a editar\n cargarOpcionesPosibles(); //carga opciones alcanzables por el producto\n $('#click_opcion').html(response.lista_opciones_guardadas); //carga el listado de opciones seleccionadas para el detalle \n $(\"#valor\").val($('#total' + id_detalle).text()); //le pasa el valor total de la fila en el valor de la ventana modal\n $(\"input[name=cantidad]\").attr(\"id\", \"c\" + id_detalle); //se le cambia el id al input i se le asigna el numero de detalle\n $('#c' + id_detalle).val(response.cantidad); // al input con el id creado se le pasa el valor de cantidad\n $(\"input[name=valor_m]\").attr(\"id\", \"m\" + id_detalle); //se le cambia el id al input y se le asigna el numero de detalle\n $('#m' + id_detalle).val(response.valorModificado);\n $('#valor_o').val(response.totalOpciones);\n $('#myModal2').modal('show');\n });\n}", "title": "" }, { "docid": "f7bfcca55e2fbac645663d98baff8681", "score": "0.63576156", "text": "function register_event_handlers()\n {\n \n \n /* button #btn_cadastro_ligarar */\n \n \n /* button #btn_cadastro_desligarar */\n \n \n /* button #btn_cadastro_ligarar */\n $(document).on(\"click\", \"#btn_cadastro_ligarar\", function(evt)\n {\n /* Other options: .modal(\"show\") .modal(\"hide\") .modal(\"toggle\")\n See full API here: http://getbootstrap.com/javascript/#modals \n */\n \n $(\".uib_w_14\").modal(\"toggle\"); \n });\n \n /* button #btn_cadastro_desligarar */\n $(document).on(\"click\", \"#btn_cadastro_desligarar\", function(evt)\n {\n /* Other options: .modal(\"show\") .modal(\"hide\") .modal(\"toggle\")\n See full API here: http://getbootstrap.com/javascript/#modals \n */\n \n $(\".uib_w_16\").modal(\"toggle\"); \n });\n \n /* button #btn_cadastro_aumentarar */\n $(document).on(\"click\", \"#btn_cadastro_aumentarar\", function(evt)\n {\n /* Other options: .modal(\"show\") .modal(\"hide\") .modal(\"toggle\")\n See full API here: http://getbootstrap.com/javascript/#modals \n */\n \n $(\".uib_w_18\").modal(\"toggle\"); \n });\n \n /* button #btn_cadastro_diminuirar */\n $(document).on(\"click\", \"#btn_cadastro_diminuirar\", function(evt)\n {\n /* Other options: .modal(\"show\") .modal(\"hide\") .modal(\"toggle\")\n See full API here: http://getbootstrap.com/javascript/#modals \n */\n \n $(\".uib_w_21\").modal(\"toggle\"); \n });\n \n }", "title": "" }, { "docid": "d24435c6998231977afb70233c7ad87f", "score": "0.6356833", "text": "function minimizaModal(e) {\n let modalCompleto = $(e.target).closest(\".modal\")\n $(modalCompleto).toggleClass(\"modal-min\");\n if ($(modalCompleto).hasClass(\"modal-min\")) {\n $(modalCompleto).find(\".modal-content\").removeClass(\"modal-redimensionable\");\n $(modalCompleto).find(\".modal-header\").css(\"pointer-events\", \"none\")\n } else {\n $(modalCompleto).find(\".modal-content\").addClass(\"modal-redimensionable\");\n $(modalCompleto).find(\".modal-header\").css(\"pointer-events\", \"initial\")\n }\n }", "title": "" }, { "docid": "7c8db70afafd7a18f4a5213d45de45cd", "score": "0.6355773", "text": "function modal(id, personne, date, album, favoris, userId, createurId) {\n $('#personne').empty();\n $('#menu_personne').empty();\n $('#myModalLabel').empty();\n $('#btn_close').empty();\n var date_format = '';\n var menu = '';\n var separateur = [\"\", \"/\", \"\", \"/\", \"\", \"\", \"\", \" \", \"\", \":\", \"\", \":\", \"\", \"\"];\n for (i = 0; i < date.length; i++) {\n var c = date.charAt(i);\n date_format += c + separateur[i];\n }\n if (userId == createurId || userId == 1) {\n $('#btn_close').append('<button type=\"button\" class=\"btn btn_danger\" data-toggle=\"modal\" data-target=\"#modal\">Supprimer</button>');\n $('#suppr_id').val(id);\n }\n else {\n $('#btn_close').append('<button type=\"submit\" class=\"close\" data-dismiss=\"modal\" name=\"supprimer\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>');\n }\n //Si l'image ne fais pas partie des favoris de l'utilisateur on affiche une etoile bleu\n if (favoris == \"True\") {\n var favoris = '<form class=\"form form-inline\" role=\"form\" enctype=\"multipart/form-data\" method=\"post\">'\n + '<input type=\"hidden\" id=\"favoris\" name=\"favoris\">'\n + '<button onclick = \"enlever_favoris(' + id + ',' + userId + ');\" type=\"submit\" class=\"btn btn-warning glyphicon glyphicon-star\" ></button>';\n }\n //Si l'image ne fais pas partie des favoris de l'utilisateur on affiche une etoile jaune\n else {\n var favoris = '<form class=\"form form-inline\" role=\"form\" enctype=\"multipart/form-data\" method=\"post\">'\n + '<input type=\"hidden\" id=\"favoris\" name=\"favoris\">'\n + '<button onclick = \"ajouter_favoris(' + id + ',' + userId + ');\" type=\"submit\" class=\"btn glyphicon glyphicon-star-empty\" ></button>';\n }\n //creation du titre de la photo\n var titre = favoris + \" \" + album + '<small> | ' + date_format + '</small>' + '</form>';\n //Si personne n'est tagué on affiche le menu pour taguer des personnes\n if (personne == 0) {\n\n modifier_personne(personne, id);\n }\n //Sinon on affiche les personnes taggé sur la photo\n else {\n afficher_personne(personne, id);\n }\n //on ajoute le titre\n $('#myModalLabel').append(titre);\n //on ajoute la photo\n $('#modal-image').attr('src', '../php/thumbnail.php?id=' + id + '&size=1200');\n\n\n}", "title": "" }, { "docid": "67e140e14f35c30fff0402b425c86de8", "score": "0.6354257", "text": "function clickHandler(e){\n if(!inModal(e.target))\n props.deleteModal()\n }", "title": "" }, { "docid": "6cdd688562b6bf02cb349fa706ad80bb", "score": "0.635111", "text": "function ModalCerrarCondicion() {\n if (modalA === 1) {\n $('#contratoDetallesmodalE').modal('show');\n } else {\n if (modalA === 2) {\n $('#contratoDetallesmodalEN').modal('show');\n } else {\n $('#NuevoContratoDetallesmodalE').modal('show');\n }\n }\n}", "title": "" }, { "docid": "a778e1b0ee196909f0f1d11f4d09d141", "score": "0.6350671", "text": "function openModalEdit() {\n const movieToBeEdit = table.getSelectedRows();\n if ((movieToBeEdit.length > 1) || (movieToBeEdit == 0)){\n alert('Se debera seleccionar una pelicula para editar');\n }else {\n const mov = movieService.getOneMovie(movieToBeEdit[0].id);\n mov.then(function(movie){\n console.log(movie.data);\n $refs.movieNameM.value = movie.data.title;\n $refs.moviePlotM.value = movie.data.description;\n $refs.movieReleaseDateM.value = movie.data.year;\n $refs.movieCountryM.value = movie.data.country;\n $refs.movieRuntimeM.value = movie.data.runtime;\n $refs.movieLanguageM.value = movie.data.language;\n $refs.movieGeneresM.value = movie.data.genres;\n $refs.movieWritersM.value = movie.data.writers;\n $refs.movieDirectorsM.value = movie.data.directors;\n });\n $refs.modalM.classList.add('is-active');\n }\n}", "title": "" } ]
30688133cdc37ab0291b2e2976e3413a
Convert an array of values to options to append to select input
[ { "docid": "76ec48a5d914833d9ff63305283a8cf4", "score": "0.78528905", "text": "function arrayToOptions(opts, values) {\n var inputOpts = '';\n for (var i = 0; i < opts.length; i++) {\n var value = opts[i];\n if (values != null) value = values[i];\n inputOpts += \"<option value='\" + value + \"'>\" + opts[i] + \"</option>\\n\";\n\n }\n return inputOpts;\n }", "title": "" } ]
[ { "docid": "ed095d67ba988c8aae5abf9827e1487c", "score": "0.7156311", "text": "function dropdownValues (array,inputField){\n array.forEach(function(item){\n inputField.append(\"option\").text(item);\n });\n}", "title": "" }, { "docid": "14847447364111778f064a35aa3b621f", "score": "0.71198237", "text": "function add_select_options(select, opt_arr) {\n let i;\n for (i = 0; i < opt_arr.length; i++) {\n const option = document.createElement('option');\n option.value = opt_arr[i];\n option.textContent = opt_arr[i];\n select.add(option);\n }\n }", "title": "" }, { "docid": "95c8d1e62b65760f0e5f0bb252d3f41a", "score": "0.7085786", "text": "function add_options($select, values) {\n values.forEach(function (val) {\n var $option = $('<option />');\n $option.val(val);\n $option.text(val);\n $select.append($option);\n });\n }", "title": "" }, { "docid": "30c3df3ea67d8275908e2eb677a45a48", "score": "0.69957685", "text": "function setValueToInput(array) {\n sortArrayValues(array);\n var value = array.join(', ');\n\n if (!value) {\n value = $select.find('option:disabled').eq(0).text() || '';\n }\n\n $newSelect.val(value);\n }", "title": "" }, { "docid": "2d866c87431120f801e9b5d255e302eb", "score": "0.6928445", "text": "function addOptionToSelect(countyArr)\n{\n var optionsArr=[];\n\n for(i=0;i<countyArr.length;i++)\n {\n var option = document.createElement('option');\n option.text = countyArr[i];\n option.value = countyArr[i];\n optionsArr.push(option);\n }\n return optionsArr;\n}", "title": "" }, { "docid": "5e90581eeaaf8fe78409343e58e21b51", "score": "0.6738121", "text": "function makeselectarray(arr,atts={}) {\n // console.log(arr);\n var sel = '<select class=\"chosen-select\" multiple '+\n $.map(atts,function(v,i){ // atts pair value id=, name=, etc.\n return i+'=\"'+v+'\"';\n }).join(\" \")+'>';\n if(((arr[0] !== '') && (typeof arr[0] === 'string')) || ((arr[0] === '') && (typeof arr[1] === 'string')) ) {\n sel += arr.map(x=>'<option value=\"'+htmlEncode(x)+'\">'+x+'</option>').join(\"\");\n } else {\n arr.forEach(function(category) {\n for(let key in category) {\n sel += '<optgroup label=\"'+htmlEncode(key)+'\">';\n if(Array.isArray(category[key])) {\n sel += category[key].map(x=>'<option value=\"'+htmlEncode(x)+'\">'+x+'</option>').join(\"\");\n } else {\n sel += Object.keys(category[key]).map(x=>'<option value=\"'+htmlEncode(x)+'\">'+x+'</option>').join(\"\");\n }\n sel += '</optgroup>';\n }\n });\n }\n sel += '</select>';\n return sel;\n}", "title": "" }, { "docid": "ec10daca4142db5bed4b7f028f8aaba3", "score": "0.667326", "text": "function addSelectOptions(selectBox, optionArray) {\n\n // loop through array, adding 1 option per row\n for (var i=0; i < optionArray.length; ++i) {\n\n var option = selectBox.append('option').text(optionArray[i]);\n\n }\n}", "title": "" }, { "docid": "8731aad319c191ed2d0225b30c7cdbba", "score": "0.66640246", "text": "function addOptions(domElement, array) {\n var select = document.getElementsByName(domElement)[0];\n for (value in array) {\n var option = document.createElement(\"option\");\n option.text = array[value];\n select.add(option);\n }\n }", "title": "" }, { "docid": "6bcd3d70737e658a1a2d3d32f5afa99f", "score": "0.65890944", "text": "function updateOptions(array) {\n var optionView;\n optionView += '<option>SELECT WELL</option>';\n array.forEach(function (item) {\n optionView += '<option>' + item + '</option>';\n });\n return optionView;\n }", "title": "" }, { "docid": "d30737a5e1d3666b9c7c58d2119f205a", "score": "0.65663856", "text": "function myDropDown(array) {\n /*1----------*/ var select = document.getElementById(\"select\"),\n/*2----------*/ array;\n\n/*3----------*/ for (var i = 0; i < array.length; i++) {\n/*4----------*/ var option = document.createElement(\"OPTION\"),\n/*5----------*/ txt = document.createTextNode(array[i]);\n/*6----------*/ option.appendChild(txt);\n/*7----------*/ option.setAttribute(\"value\", array[i]);\n/*8----------*/ select.insertBefore(option, select.lastChild);\n }\n}", "title": "" }, { "docid": "492948856701d4729231fa84d4c2b3bb", "score": "0.653457", "text": "function addSelectElementOptions(arr){\n let selectElement = document.getElementById(\"repositories\");\n arr.forEach(rep => {\n let option = document.createElement('option');\n option.text = rep.name;\n option.value = rep.id;\n selectElement.appendChild(option);\n });\n}", "title": "" }, { "docid": "9cde5e599ddbc8b861ee4fd6c3d6553a", "score": "0.6468849", "text": "function setSelectOptions(selectId, newOptions, valuesArray) {\n var selectValue = $(\"#\"+selectId + \" option:selected\").val();\n var $el = $(\"#\" + selectId);\n $el.empty(); // remove old options\n $.each(newOptions, function(key,value) {\n $el.append($(\"<option></option>\").attr(\"value\", value).text(key));\n }); \n if (($.inArray(selectValue, multipleValuesAllowedLoanTypeNames) > -1) || !($.inArray(selectValue, valuesArray) > -1)) {\n $(\"#\"+selectId).val(selectValue);\n }\n}", "title": "" }, { "docid": "488dca087a6b648b4fbee8305d1c9d5d", "score": "0.6438225", "text": "function renderSelectOptions(){\n options.forEach((el, i) => {\n var option = \"<option>\" + el + \"</option>\";\n $('#options').append(option); \n })\n }", "title": "" }, { "docid": "b896702d987f20cf408ce082416fc1c5", "score": "0.6431906", "text": "function addOptions(domElement, array){\n\tvar selector = document.getElementsByName(domElement)[0]\n\tfor(curso in array){\n\t\tvar opcion = document.createElement(\"option\")\n\t\topcion.text = array[curso]\n\t\topcion.value = array[curso].toLowerCase()\n\t\tselector.add(opcion);\n\t}\n}", "title": "" }, { "docid": "604723d94cebff74f0b4b725a886c7d7", "score": "0.64206916", "text": "function populateDropdown(Arr, target) {\n let currentOption;\n\n for (let i = 0; i < Arr.length; i++) {\n currentOption = $(`<option value=\"${Arr[i][0]}\">`)\n target.append(currentOption);\n }\n}", "title": "" }, { "docid": "4a3e1d74bd3d2dfce6cb7fee95bbc11e", "score": "0.6415528", "text": "set values(values) {\n this.select.values = values;\n }", "title": "" }, { "docid": "7379163c8d1bac3143e172a2db2dc62b", "score": "0.6370414", "text": "function populateSelect(target, optList, array) {\n if (!target){\n return false;\n }\n else if(array) {\n select = document.getElementById(target);\n\n optList.forEach(function(item) {\n var opt = document.createElement('option');\n opt.value = item[1];\n opt.innerHTML = opt.value;\n select.appendChild(opt);\n });\n } else {\n select = document.getElementById(target);\n\n optList.forEach(function(item) {\n var opt = document.createElement('option');\n opt.value = item.nombreLugar;\n opt.innerHTML = opt.value;\n select.appendChild(opt);\n });\n }\n }", "title": "" }, { "docid": "84bf5c87d6fd9de2e197cc7e6b361476", "score": "0.63449275", "text": "function formMultiSelectOptions(sourceValues) {\n var destination = '';\n $.each(sourceValues, function (index, sourceValue) {\n destination += '<option value=\"' + sourceValue + '\" selected></option>';\n });\n\n return destination;\n }", "title": "" }, { "docid": "64d47810e4de9c4a421fa246a92318f7", "score": "0.63138926", "text": "function populateColors(){\n var colors = [\"White\", \"Black\", \"Grey\", \"Yellow\", \"Red\", \"Blue\", \"Green\",\n \"Brown\", \"Pink\", \"Orange\", \"Purple\"];\n\n var select = document.getElementById('vehicle-color');\n\n for(var i = 0; i < colors.length; i++){\n var options = colors[i];\n var element = document.createElement(\"option\");\n element.textContent = options;\n element.value = options;\n select.appendChild(element);\n }\n}", "title": "" }, { "docid": "a2ca236ba74e2f22947aec9d1019760f", "score": "0.63065505", "text": "function populateOptions(flavors) {\n // TODO\n var selectTag = document.getElementsByTagName(\"select\");\n var select = selectTag[0];\n select.remove(0)\n\n function optionsCreation(element) {\n var name = element.name;\n var option = document.createElement(\"option\");\n option.innerHTML = name;\n option.value = name;\n select.add(option);\n }\n arrayOfFlavors.map(optionsCreation);\n}", "title": "" }, { "docid": "a3e4cd4388ecfb8284879450240c4f9c", "score": "0.629895", "text": "function PopulateOptions() {\n const options = [\n \"Bagel\",\n \"Cafe\",\n \"Fuel\",\n \"Hotel\",\n \"Parking\",\n \"Pharmacy\",\n \"Police station\",\n \"Post office\",\n \"Restaurant\",\n \"Supermarket\",\n ];\n\n return options.map((option, index) => (\n <option key={index} value={option}>\n {option}\n </option>\n ));\n}", "title": "" }, { "docid": "6ce21698f68b289f959f2ce5c9a2d6b0", "score": "0.6296974", "text": "function generatesValuesArray() {\n var arrayValues = [];\n\n for (var i = 0, count = optionsValuesSelected.length; i < count; i++) {\n var text = $select.find('option').eq(optionsValuesSelected[i]).text().trim();\n var value = $select.find('option').eq(optionsValuesSelected[i]).attr('value');\n if(value !='ALL'){\n arrayValues.push(text);\n }\n }\n\n setValueToInput(arrayValues);\n }", "title": "" }, { "docid": "281ef64c016e3182768bc76ccf8a30cd", "score": "0.62912875", "text": "function addSelectOptions(value) {\n var option = document.createElement('option');\n // option.style.opacity = \"0.5\";\n option.setAttribute('value', value);\n option.style.fontFamily = \"Unisans-Thin\";\n option.appendChild(document.createTextNode(value));\n\n return option;\n}", "title": "" }, { "docid": "c272cfd61bfdb902d970b7cab104ffc6", "score": "0.62827766", "text": "function createSelectOptions(selectElement, selectOptions) {\n for (const option of selectOptions) {\n let optionElement = createElementWithValue(\"option\",\"\",option);\n optionElement.setAttribute(\"value\",option);\n selectElement.appendChild(optionElement);\n }\n}", "title": "" }, { "docid": "093b4998aa4f80400c39e1d688abbcac", "score": "0.6271917", "text": "function addOptions(domElement, array) {\n var select = document.getElementsByName(domElement)[0];\n \n for (var i=0; i<array.length;i++) {\n var option = document.createElement(\"option\");\n option.text = array[i].Nombre;\n option.value = array[i].Nit;\n select.add(option);\n }\n }", "title": "" }, { "docid": "7d3ed24a7663171bbb9a847c41c5d865", "score": "0.62452304", "text": "createOptions (values) {\n if(values.length <= 0) \n return [];\n\n let selectValues = values && values.map((value) => {\n if(value.SubCapabilities !== '') {\n \n let selectValue = {};\n selectValue.label = value.SubCapabilities\n selectValue.value = value.SubCapabilities\n\n\n return selectValue;\n }\n \n }).filter((item)=> {return item !== undefined})\n\n\n\n return selectValues;\n \n }", "title": "" }, { "docid": "e1f5b794c6a2648e58ffb38fc731353d", "score": "0.6241758", "text": "function populateDropDown() {\n keywordArray.forEach( (word) => {\n let $options = $('<option></option>');\n $options.text(word);\n $options.val(word);\n $('select').append($options);\n });\n}", "title": "" }, { "docid": "489d66e60dfe02c14ea9a1d29b359d9f", "score": "0.623526", "text": "function concatena_combo_selective_array(input_object, input_object_type, input_RR_filt, input_RR_codi, input_RR_text, input_filtro, input_value) {\n // declaracion de varialbes\n var var_largo_array, var_largo_actual, var_i;\n\n // inicializacion de variables\n var_largo_array = input_RR_codi.length;\n\n // verifica si esta llenando un combo simple o multiple\n var_largo_actual = input_object.length;\n if (input_object_type == \"S\") {\n // llena todos los elementos de la lista\n for (var_i = 0; var_i < var_largo_array; var_i++) {\n if (input_RR_filt[var_i] == input_filtro) {\n input_object.length = input_object.length + 1;\n input_object.options[input_object.length - 1].value = input_RR_codi[var_i];\n input_object.options[input_object.length - 1].text = input_RR_text[var_i];\n }\n }\n // ubica el elemento de la lista por defecto\n if (input_value != \"\") input_object.value = input_value;\n } else {\n // llena todos los elementos de la lista\n for (var_i = 0; var_i < var_largo_array; var_i++) {\n if (input_RR_filt[var_i] == input_filtro) {\n input_object.length = input_object.length + 1;\n input_object.options[input_object.length - 1].value = input_RR_codi[var_i];\n input_object.options[input_object.length - 1].text = input_RR_text[var_i];\n if (input_value != \"\") {\n if (input_value.indexOf(\",\" + input_RR_codi[var_i] + \",\") != -1)\n input_object.options[input_object.length - 1].selected = true;\n }\n }\n }\n }\n}", "title": "" }, { "docid": "01ece25f6c0b1808c06225fc03165203", "score": "0.6213029", "text": "function appendDataToSelect(sel, data) {\n for(let i = 0; i<data.length; i++){\n var opt = document.createElement(\"option\")\n opt.innerHTML = opt.value = data[i]\n sel.appendChild(opt)\n }\n}", "title": "" }, { "docid": "cbd061ad266fbd9929a48df69516484a", "score": "0.61917675", "text": "function populateOutputNameSelect(values, selValue) {\n var options = $.map(values, function (value) {\n return $(\"<option>\", {value: value}).text(value);\n });\n var select = $(\"#output-name-select\").empty();\n if (!selValue) {\n select.append(\"<option>\");\n }\n select.append(options);\n\n if (selValue) {\n select.val(selValue);\n }\n }", "title": "" }, { "docid": "5e5304e9e3dacdd0067feb6254e6bff2", "score": "0.6183297", "text": "function fillSelectData(target, data){\n\n for(var i = 0; i < data.length; i++) {\n var opt = document.createElement('option');\n opt.innerHTML = data[i];\n opt.value = data[i];\n target.appendChild(opt);\n }\n}", "title": "" }, { "docid": "cb4460537dcf1d96666859582057cd42", "score": "0.61465424", "text": "createOptionsVendors (values) {\n if(values.length <= 0) \n return [];\n\n let selectValues = values && values.map((value) => {\n if(value.SubCapabilities !== '') {\n \n let selectValue = {};\n selectValue.label = value.ManufacturerName\n selectValue.value = value.ManufacturerId\n\n return selectValue;\n }\n \n }).filter((item)=> {return item !== undefined})\n\n\n\n return selectValues;\n\n }", "title": "" }, { "docid": "ac65f7bbb284d1aeb9f1ee183db48b5d", "score": "0.6140857", "text": "function pushOptions(target, options) {\n options.forEach((item) => {\n\n let options = ` <option value=\"${item}\">${item}</option> `;\n target.append(options);\n\n });\n}", "title": "" }, { "docid": "d23ab3d8d97a59d04c3bfd361655e0e5", "score": "0.613841", "text": "function populateSelect(array, actualSelect) {\n const select = addAnOptionInSelect(actualSelect);\n array.forEach(element => (select(element.name, element.id)));\n}", "title": "" }, { "docid": "a41f5679dc3193b71bf66e7a3cfcd943", "score": "0.613351", "text": "function addOptions(types) {\n const select = $('#type');\n types.forEach(item => {\n const optionHtml = `\n <option value=\"${item}\">${item}</option> \n `;\n select.append(optionHtml);\n });\n}", "title": "" }, { "docid": "5008d63d691b01a011e45bfcae939c31", "score": "0.6131095", "text": "function createOptionsListFromStringList(strArray)\n{ \n let optionsList = [];\n\n strArray.forEach(element =>\n {\n optionsList = [...optionsList, {label: element+'', value: element+''}];\n });\n\n return optionsList;\n}", "title": "" }, { "docid": "878b693fff5d06239f5fa87cac148a07", "score": "0.6112571", "text": "function addOptions(arr, htmlEl) {\n for (let i = 0; i < arr.length; i++) {\n let option = document.createElement('option');\n option = document.createElement('option');\n option.innerText = arr[i].name;\n htmlEl.append(option);\n }\n}", "title": "" }, { "docid": "06419bf2a8067b8eddf15ea8d8ca0c5e", "score": "0.6100604", "text": "function addOptionsToSelect(list, select) {\n for (let i = 0; i < list.length; ++i) {\n let newOption = document.createElement('option');\n newOption.value = list[i];\n newOption.innerHTML = list[i];\n select.appendChild(newOption);\n }\n }", "title": "" }, { "docid": "85d22602d6b35b06fb8c64c3f025bb59", "score": "0.60947126", "text": "addMissingValuesToOptions(newOptions, value) {\n if (!value || (Array.isArray(value) && value.length === 0)) {\n return;\n }\n\n const valueIsInOptions = valueToCheck => {\n return newOptions.some(option => {\n return option.value === valueToCheck;\n });\n };\n\n const maybeAddOption = valueToCheck => {\n if (!valueIsInOptions(valueToCheck)) {\n // Since we don't have the label, we will use the value instead\n this.addOption(newOptions, valueToCheck, valueToCheck);\n }\n };\n\n if (Array.isArray(value)) {\n value.forEach(valueToCheck => {\n maybeAddOption(valueToCheck);\n });\n } else {\n maybeAddOption(value);\n }\n }", "title": "" }, { "docid": "55c166ba5a3a4651fda30bb7f77d660b", "score": "0.6089056", "text": "function optionValues(list) {\n list.forEach((dog) => {\n // console.log(dog)\n const select = document.querySelector('select')\n // console.log(select)\n const option = document.createElement('option')\n option.value = `${dog}`\n option.textContent = `${dog}`\n select.append(option)\n })\n}", "title": "" }, { "docid": "40b1b17107e6c49276d3f80c5acea921", "score": "0.607494", "text": "function populatelist(darray, elementid){\n \n var filteredArray = [...new Set(darray)];\n \n\n var sel = document.getElementById(elementid);\n \n for(var i = 0; i < filteredArray.length; i++) {\n var opt = document.createElement('option');\n opt.innerHTML = filteredArray[i];\n opt.value = filteredArray[i];\n sel.appendChild(opt);\n }\n}", "title": "" }, { "docid": "4295011ee257f0dc73df95f886e02463", "score": "0.60682476", "text": "function arrayToOptions(xs, f) {\n var ret = [];\n for (var _a = 0, xs_1 = xs; _a < xs_1.length; _a++) {\n var x = xs_1[_a];\n if (!f) {\n ret.push([x, f === null ? x : Object(_string__WEBPACK_IMPORTED_MODULE_4__[\"stringToWords\"])(x)]);\n }\n else {\n ret.push([x, f(x)]);\n }\n }\n return ret;\n }", "title": "" }, { "docid": "8823a79217bfdeef1bdb48f6b4c6c779", "score": "0.6062346", "text": "function gen_coerce_array() {\n\tvar coerce_array=[]\n\tvar temp=$('.dataselect select')\n\tfor(var i=0;i<temp.length;i++){\n\t\tcoerce_array.push($(temp[i]).val())\n\t}\n\n\tloadData(coerce_array)\n}", "title": "" }, { "docid": "e9894c3d975b055630fcbc71344989be", "score": "0.6060544", "text": "function loadStringsSelect(id, stringArray) {\n for (var i = 0; i < stringArray.length; i++) {\n console.log(stringArray[i]);\n console.log(stringArray.length);\n $(id).append('<option>' + stringArray[i] + '</option>');\n }\n}", "title": "" }, { "docid": "73722b67ef05cbb53d32a4d385a1adf9", "score": "0.60543627", "text": "function addValuesToSelect(selectID, listOfValues, defaultText) {\n\t\n\t$(selectID).dropdown('clear');\n\t$(selectID).empty().append('<option value=\"\">' + defaultText + '</option>');\n\t\n\tfor(let i = 0; i < listOfValues.length; i++) {\n\t\t$(selectID).append('<option value=\"' + listOfValues[i].toLowerCase() + '\">'\n\t\t\t\t+ listOfValues[i] + '</option>');\n\t}\n\t\n}", "title": "" }, { "docid": "a0d4cd11157d8b2ce3d2a4f0e7fa8bc9", "score": "0.6053737", "text": "function loadChoiceOptions(select, selected, array) {\n select.options.length=0;\n for (var i=1 ; i < array.length ; i++) {\n _addOption(select, array[i][0], selected==array[i][0]);\n }\n}", "title": "" }, { "docid": "68f5570dc8bd41ed94e2c3a17f1c7b76", "score": "0.60412794", "text": "function generateOptions(element, options)\n{\n var option = $('<option value=\"\"></option>');\n $(element).append(option); \n \n for (var i = 0; i < options.length; i++)\n {\n var option = $('<option value=\"' + options[i] + '\">' + options[i] + '</option>');\n $(element).append(option);\n }\n}", "title": "" }, { "docid": "c2a3bfe234dcf170b4d4ef98c513037f", "score": "0.6039167", "text": "function select2InputTags(queryStr) {\n var $input = $(queryStr)\n\n var $select = $('<select class=\"'+ $input.attr('class') + '\" multiple=\"multiple\"><select>')\n if ($input.val() != \"\") {\n $input.val().split(',').forEach(function(item) {\n $select.append('<option value=\"' + item + '\" selected=\"selected\">' + item + '</option>')\n });\n }\n $select.insertAfter($input)\n $input.hide()\n\n $select.change(function() {\n $input.val($select.val().join(\",\"));\n });\n\n return $select;\n }", "title": "" }, { "docid": "8cf84b04ebf45627572da9e15c1c8f44", "score": "0.6037658", "text": "function addOptionsToDuration(values){\n\tvar select = document.getElementById('duration');\n\t// remove all items\n\twhile(select.options.length > 0) {\n\t\tselect.remove(0);\n\t}\n\t\n\t// add all new items\n\tvalues.forEach(function (val) {\n\t\tvar opt = document.createElement('option');\n\t\topt.value = val;\n\t\topt.innerHTML = val;\n\t\tselect.appendChild(opt);\n\t});\n}", "title": "" }, { "docid": "c7a35136def47f6db41ff6a92c93aef3", "score": "0.6036001", "text": "function populateAutocomplete() {\n for (var i=0; i<usersArr.length; i++) {\n var option = document.createElement(\"option\");\n option.value = usersArr[i];\n option.appendChild(document.createTextNode(usersArr[i]));\n $autocomplete[0].appendChild(option);\n }\n}", "title": "" }, { "docid": "e791c17b264cf152fc8b6105da5810bb", "score": "0.60356486", "text": "function saveAllSelected (fromSelectArray, toArray, delim, escape, emptyLabel) {\n var i,j,escapedValue;\n // loop through all the select elements\n for (i = 0; i < fromSelectArray.length; i++) {\n toArray[i].value = ''; // clear out the value to start\n // now loop through all the values in the select element\n for (j = 0; j < fromSelectArray[i].length; j++) {\n // copy over the value as long as it is not the emptyLabel\n if (!(fromSelectArray[i].length == 1 && fromSelectArray[i].options[0].value == emptyLabel)) {\n var val = fromSelectArray[i].options[j].value.replace(new RegExp(escape+escape,\"g\"), escape+escape);\n toArray[i].value += val.replace(new RegExp(delim,\"g\"), escape+delim);\n }\n\n // add the delimiter (except after the last one)\n if (j + 1 < fromSelectArray[i].length) {\n toArray[i].value += delim;\n }\n }\n }\n}", "title": "" }, { "docid": "f77a8c31c787a1b10dcddedd75848ff8", "score": "0.60355276", "text": "function addOptions(options, select){\n options.forEach((element)=>{\n select.innerHTML+= `<option value=\"${element}\">${element}</option>`;\n })\n}", "title": "" }, { "docid": "95a6c4464dc18db0d29e0ac9b277fdb4", "score": "0.6017961", "text": "function addOption(options , select) {\n options.forEach((element) => {\n select.innerHTML += `<option value=\"${element}\">${element}</option>`\n })\n \n\n\n}", "title": "" }, { "docid": "a69045dc19b110b2be69cf311b9094fb", "score": "0.59951735", "text": "function populateDropdownMenu(options)\n{\n var select = document.getElementById(\"list\");\n for(var i = 0; i < options.length; i++) \n {\n var opt = options[i];\n var el = document.createElement(\"option\");\n el.textContent = opt;\n el.value = opt;\n select.appendChild(el);\n }\n}", "title": "" }, { "docid": "41622f1c2126a583bcb061c1403460f9", "score": "0.59914976", "text": "function addOptionsToCustomSelects() {\n $(document).on(\"click\", \".select__input\", function () {\n var inputName = $(this).data(\"name\");\n\n var result = selectOptions.find(function (item) {\n return item.name === inputName;\n });\n\n var options = \"\";\n result.options.forEach(function (item) {\n if (typeof item === \"string\") {\n options +=\n \"<p class='dropdown__option' data-value='\" +\n item +\n \"'>\" +\n item +\n \" </p>\";\n } else {\n var title =\n \"<div class='dropdown__title'><span>\" + item.title + \"</span></div>\";\n\n var nestedOptionsString = \"\";\n item.options.forEach(function (nestedOption) {\n nestedOptionsString +=\n \"<p class='dropdown__option' data-value='\" +\n nestedOption +\n \"'>\" +\n nestedOption +\n \" </p>\";\n });\n\n options += title + nestedOptionsString;\n }\n });\n\n var dropdown = $(this).next(\".dropdown\");\n dropdown.html(options);\n });\n}", "title": "" }, { "docid": "f561aa201b827b314379e21cdb827aca", "score": "0.5988383", "text": "function createOptions(optionsList){\n optionElements = []\n var n = optionsList.length\n for(var i=0;i<n;i++){\n optionElements.push(createNewElement(\"option\"))\n optionElements[i].innerText = optionsList[i]\n if(i===0){\n optionElements[i].value = \"\"\n }\n else{\n optionElements[i].value = optionsList[i]\n } \n }\n return optionElements\n}", "title": "" }, { "docid": "dd3a523fd00304a73467b5f7e41f6165", "score": "0.598077", "text": "function populateDropDown() {\n let notBaseSelect = $('option').not(\"#baseOption\");\n $(notBaseSelect).remove();\n\n\n keywordArray.forEach( word => {\n // console.log('values', word);\n let $options = $('<option></option>');\n $options.text(word);\n $options.val(word);\n $('select').append($options);\n });\n}", "title": "" }, { "docid": "19b668c7217cf0c936f2c5290f9c5f5a", "score": "0.5943463", "text": "function makeSelectOptions(){\n var select = document.getElementById(\"state\");\n for (var i=0; i< 10; i++){\n var state = capitalsArray[i];\n if (isNotAlreadyAnOption(state)){\n var optionNode = document.createElement(\"option\");\n var textNode = document.createTextNode(state); \n optionNode.appendChild(textNode);\n optionNode.setAttribute(\"value\", state);\n select.appendChild(optionNode); \n }\n } \n}", "title": "" }, { "docid": "d4d35d1f3b071499f421d8741cb85bd5", "score": "0.5929478", "text": "function addSelectOptions(v, i) {\r\n inputUnitList[i] = new Option (v, v);\r\n outputUnitList[i] = new Option (v, v);\r\n}", "title": "" }, { "docid": "91a9c08ad305dd04c6f8a93f6ecf17a5", "score": "0.5908955", "text": "_setOptionsFromValues(values) {\n this.options.forEach(option => option._setSelected(false));\n values.forEach(value => {\n const correspondingOption = this.options.find(option => {\n // Skip options that are already in the model. This allows us to handle cases\n // where the same primitive value is selected multiple times.\n return option.selected ? false : this.compareWith(option.value, value);\n });\n if (correspondingOption) {\n correspondingOption._setSelected(true);\n }\n });\n }", "title": "" }, { "docid": "91a9c08ad305dd04c6f8a93f6ecf17a5", "score": "0.5908955", "text": "_setOptionsFromValues(values) {\n this.options.forEach(option => option._setSelected(false));\n values.forEach(value => {\n const correspondingOption = this.options.find(option => {\n // Skip options that are already in the model. This allows us to handle cases\n // where the same primitive value is selected multiple times.\n return option.selected ? false : this.compareWith(option.value, value);\n });\n if (correspondingOption) {\n correspondingOption._setSelected(true);\n }\n });\n }", "title": "" }, { "docid": "91a9c08ad305dd04c6f8a93f6ecf17a5", "score": "0.5908955", "text": "_setOptionsFromValues(values) {\n this.options.forEach(option => option._setSelected(false));\n values.forEach(value => {\n const correspondingOption = this.options.find(option => {\n // Skip options that are already in the model. This allows us to handle cases\n // where the same primitive value is selected multiple times.\n return option.selected ? false : this.compareWith(option.value, value);\n });\n if (correspondingOption) {\n correspondingOption._setSelected(true);\n }\n });\n }", "title": "" }, { "docid": "f88486cf762a0b1716b046eb7aba365e", "score": "0.58980936", "text": "function createOptions (sel, array) {\n var options = sel.selectAll(\"option\")\n .data(array)\n .enter()\n .append(\"option\");\n \n options.text(function(d) {\n return d;\n })\n .attr(\"value\", function(d) {\n return d;\n });\n // display winner of championship in the drop down box\ndocument.getElementById('selectTeam').value = 'Toronto Raptors';\n}", "title": "" }, { "docid": "ef519768c1b5d15c41d7fd5c181d40c6", "score": "0.5886632", "text": "function populateParametersSelector(id, values) {\n\n values = values.split(\",\");\n\n $(id).append('<option value=\"\">choose parameters</option>');\n for (var i = 0; i < values.length; i++) {\n $(id).append('<option value=\"' + values[i].trim() + '\">' + values[i].trim() + \"</option>\");\n }\n }", "title": "" }, { "docid": "1a8e8be8ceded2311e7f7ddd5df90193", "score": "0.5871125", "text": "function extendSelect(_) {\n\t\tif (_.array !==undefined && _.array.length>0) {\n\t\t\t//var group = jQuery('<optgroup label=\"'+_.group+'\"></optgroup');\n\t\t\tfor (var i in _.array ) {\n\t\t\t\t\tif(!_.array.hasOwnProperty(i)) continue;\n\t\t\t\t\tvar o = _.sanitize ? new Option(RVS.F.sanitize_input(RVS.F.capitalise(_.array[i])),_.array[i],false,_.old===_.array[i]) : new Option(RVS.F.capitalise(_.array[i]),_.array[i],false,_.old===_.array[i]);\n\t\t\t\t\to.className=\"dynamicadded\";\n\t\t\t\t\t_.select.append(o);\n\t\t\t}\n\t\t\t//_.select.append(group);\n\t\t}\n\t}", "title": "" }, { "docid": "1cdf9fa09484e85e28d2c2cbeb9a0ada", "score": "0.5859597", "text": "function loadChoiceOptions(selectName, selectedOption, array) {\n\tvar select=\"select[name='\"+selectName+\"']\";\n\t$(select).empty();\n var width = 0;\n for (var i=1 ; i < array.length ; i++) {\n $(select).append(_createOption(array[i][0], selectedOption==array[i][0]));\n width=Math.max(array[i][0].length, width);\n }\n $(select).ccs(\"width\", width+\"em\");\n}", "title": "" }, { "docid": "be6e9d4235aec956ae2ec7d48e4974db", "score": "0.5858932", "text": "function PopulateOptionSelect(sel, array, property, first) {\n sel.options.length = 0;\n \n if (first) {\n AddOptionToSelect(sel, first, -1);\n }\n for (var i = 0; i < array.length; i++) {\n if (property) {\n AddOptionToSelect(sel, array[i][property], i);\n } else {\n AddOptionToSelect(sel, array[i], i);\n }\n }\n}", "title": "" }, { "docid": "f57b686d4677698c077ce3df9027bbf4", "score": "0.5857337", "text": "allSelected(options, values) {\n return every(options, option => some(values, ['value', option.value]));\n }", "title": "" }, { "docid": "62e8e768df51081dd78f4cca90bfbc92", "score": "0.58453757", "text": "function createOptionsOfArray(_) {\n\t\tvar ret = '<option value=\"none\">'+RVS_LANG.none+'</option>';\n\n\t\tfor (var i in _.array) {\n\t\t\tif(!_.array.hasOwnProperty(i)) continue;\n\t\t\tif ((_.filter===undefined || _.filter===\"all\" || _.filter === _.array[i].type)\t&& (_.subfilter===undefined || _.subfilter===\"all\" || _.subfilter===_.array[i].subtype))\n\t\t\t\tret += '<option '+(_.preselected===_.array[i][_.type] ? \"selected\" : \"\")+' value=\"'+_.array[i][_.type]+'\">'+_.array[i].title+'</option>';\n\t\t}\n\t\treturn ret;\n\t}", "title": "" }, { "docid": "618d1869a7c7e07909e2ad82d724d8fe", "score": "0.57758975", "text": "function fillOptions(genres) {\n let options = \"\";\n\n if (genres.length > 0) {\n genres.forEach(genre => {\n options +=\n '<option value=\"' + genre.id_genre + '\">' + genre.genre + \"</option>\";\n });\n }\n\n $(\"#multiple-checkboxes\").html(options);\n $(\"#multiple-checkboxes\").multiselect(\"rebuild\");\n}", "title": "" }, { "docid": "85c1db4032dbe97c01d4bab29fd63a0d", "score": "0.5762132", "text": "renderValues(data,item){\n item.style.display = 'inline-block'\n for(let i in data){\n let newValue = document.createElement('OPTION')\n newValue.value = data[i]\n newValue.innerHTML = data[i]\n item.appendChild(newValue)\n }\n \n }", "title": "" }, { "docid": "070b4be3830162f90496069b45522b30", "score": "0.5757173", "text": "function optionValues(lists) {\n const select = document.querySelector('#bourbon-drink')\n let results = lists.forEach((drink) => {\n const option = document.createElement('option')\n option.value = `${drink.strDrink}`\n option.textContent = `${drink.strDrink}`\n select.appendChild(option)\n });\n return results; \n}", "title": "" }, { "docid": "051b68ee5fdb889e5ae673b068a6c36f", "score": "0.57489955", "text": "function generate_rrrs_option(rrr_list) {\n var option;\n\n\n other_rrrs_selector = document.getElementById(\"other_rrrs_selector\");\n other_rrrs_selector.innerHTML = null;\n for (var i = 0; i < rrr_list.length; i++) {\n\n option = document.createElement('option');\n option.setAttribute(\"id\", rrr_list[i]);\n option.setAttribute(\"value\", rrr_list[i]);\n option.textContent = rrr_list[i];\n other_rrrs_selector.appendChild(option);\n }\n}", "title": "" }, { "docid": "451f25d129dd0ec6cfa035391ffbba66", "score": "0.573404", "text": "function setup_select() {\n var select = document.getElementById(\"form_client\");\n var options = [];\n for (let i=0; i<rec_json_obj.length; i++) {\n options.push(rec_json_obj[i]['id']);\n }\n\n for(var i = 0; i < options.length; i++) {\n var opt = options[i];\n var el = document.createElement(\"option\");\n el.textContent = '('+rec_json_obj[i]['id']+') '+rec_json_obj[i]['first_name']+' '+rec_json_obj[i]['second_name'];\n el.value = opt;\n select.appendChild(el);\n }\n}", "title": "" }, { "docid": "2cffef16411d523ba199e7921d9ac3e7", "score": "0.57309645", "text": "function populateDpts() {\n $.each(departments, function(i, dpt) {\n $('#selectDpt').append($(\"<option/>\", {\n value: departments[i][0],\n text: departments[i][1]\n }));\n });\n}", "title": "" }, { "docid": "2add80b8baf89068204e0e531cea266b", "score": "0.5721316", "text": "function armyList(library){\r\n\tvar arr = []\r\n\tfor (p in library){\r\n\t\tarr.push(p)\r\n\t}\r\n\tfor(var i = 0; i < arr.length; i++){\r\n\t\tif(library[arr[i]]){\r\n\t\t\tvar option = $('<option />')\r\n\t\t\toption.attr('value',arr[i])\r\n\t\t\tif(i == 0){\r\n\t\t\t\toption.attr('selected','selected')\r\n\t\t\t\tarmy = arr[i]\r\n\t\t\t}\r\n\t\t\toption.attr('label',library[arr[i]].armyname)\r\n\t\t\t\toption.appendTo($('#armyselect'))\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "256ab18767ad1cd4cace40388e3e66e5", "score": "0.5716311", "text": "function generate_parties_option(parties) {\n var option;\n\n party_selector = document.getElementById(\"party_selector\");\n party_selector.innerHTML = null;\n for (var i = 0; i < parties.length; i++) {\n\n option = document.createElement('option');\n option.setAttribute(\"id\", parties[i]);\n option.setAttribute(\"value\", parties[i]);\n option.textContent = parties[i];\n party_selector.appendChild(option);\n }\n\n}", "title": "" }, { "docid": "27be66a4fee03647d8fb992d795eac4f", "score": "0.57118833", "text": "function populateDropDown(userGroupMap) {\r\n\tvar userGroupSelect = document.getElementById(\"inputUserGroupInpt\");\r\n\tfor (var key in userGroupMap) {\t\t\t\t\r\n\t\tvar option = document.createElement(\"option\");\r\n\t\toption.text = userGroupMap[key];\r\n\t option.value = key+\"!\"+userGroupMap[key];\r\n\t option.className = \"form-control-general\";\r\n\t try {\r\n\t \tuserGroupSelect.add(option, null); //Standard \r\n\t }catch(error) {\r\n\t \t//regionSelect.add(option); // IE only\r\n\t }\r\n\t}\r\n}", "title": "" }, { "docid": "5e99bee643615f7014bc0ae61fbe75f4", "score": "0.57078284", "text": "function getSelectedValues(values) {\n if (_.isArray(values)) {\n var filteredValues = _.filter(values, function (val) {\n return val.selected;\n });\n\n return _.map(filteredValues, function (opt) {\n //TODO: decouple from controls.options data structure\n if (opt.id || opt.id === '') {\n return opt;\n }\n\n return opt.value;\n });\n } else {\n return values;\n }\n }", "title": "" }, { "docid": "bc12955a9381c6e3fd9a6e714563e586", "score": "0.5707747", "text": "makeOptionArrToTextArr(fromArr, toArr, isMixed){\n if (!fromArr || !toArr || 0==fromArr.length){\n return;\n }\n for(let i=0; i< fromArr.length; i++){\n toArr.push((isMixed ? fromArr[i] : '' ) + map.text[fromArr[i]]);\n }\n }", "title": "" }, { "docid": "009c5c691201045732897d18549f3293", "score": "0.5706899", "text": "function populateDropDown(list) {\n var initialVal = 0\n var dropdownTag = document.getElementById(\"selDataset\");\n // console.log(dropdownTag); //sanity check\n // console.log(list.length); //sanity check\n // console.log(list); //sanity check\n\n for (var i = 0; i < list.length; i++) {\n var newOption = list[i];\n\n var el = document.createElement(\"option\");\n el.textContent = newOption;\n el.value = newOption;\n\n dropdownTag.append(el);\n }\n}", "title": "" }, { "docid": "33879e9b2098a598c59dfb75d3567c4e", "score": "0.5700908", "text": "function addOptions(array) {\n var cuentasDestino = document.getElementsByName(\"cuentasOrigen\")[0];\n var cuentasDestino = document.getElementsByName(\"cuentasDestino\")[0];\n var session = sessionStorage.getItem(\"session\");\n var optionA;\n var optionB;\n for (value in array) {\n\n if(session.userName==value.userName){\n optionA = document.createElement(\"option\");\n optionA.text = array[value];\n }else {\n optionB = document.createElement(\"option\");\n optionB.text = array[value];\n }\n\n cuentasDestino.add(optionA);\n cuentasDestino.add(optionB);\n }\n}", "title": "" }, { "docid": "0fb53f9878b62cadf7e19ab1e34c04c9", "score": "0.5684174", "text": "function deptArray(dept) {\n var select = document.getElementById(\"departments\");\n\n for (var i = 0; i < dept.length; i++) {\n var option = document.createElement(\"OPTION\"),\n txt = document.createTextNode(dept[i].DepartmentCode);\n option.appendChild(txt);\n select.insertBefore(option, select.lastChild);\n }\n}", "title": "" }, { "docid": "3bed0eb43ce96099fd68ee4ba347f87b", "score": "0.56837034", "text": "setSelectOptions (haystack) {\n for (var i = haystack.length - 1; i >= 0; i--) {\n haystack[i].label = haystack[i].name\n haystack[i].value = haystack[i].id\n if (haystack[i].active === 1) {\n haystack[i].active = true\n } else {\n haystack[i].active = false\n }\n }\n return haystack\n }", "title": "" }, { "docid": "4ffd6fcf61da7cdfc442efd1a5eeda7a", "score": "0.5679049", "text": "function addOptions(){\n for(var i in filters){\n var opt = document.createElement(\"option\");\n opt.value = i;\n opt.innerHTML = i;\n filterType.appendChild(opt); \n }\n }", "title": "" }, { "docid": "b02c5f7c1fe26f7ce8ce4a616153261d", "score": "0.5672299", "text": "function addOption(selectId) {\n let select = document.getElementById(selectId);\n for(let s = 0; s < staffArray.length; s++) {\n let mem = staffArray[s];\n let el = document.createElement(\"option\");\n select.options[s] = new Option(staffArray[s], staffArray[s]);\n el.textContent = mem;\n el.value = mem;\n }\n}", "title": "" }, { "docid": "93f65cc0091266c7e3b142669a50cac2", "score": "0.56710595", "text": "function populateOrgSelect(target, optList, array) {\n if (!target){\n return false;\n }\n else if(array) {\n select = document.getElementById(target);\n\n optList.forEach(function(item) {\n var opt = document.createElement('option');\n opt.value = item.nombre;\n opt.innerHTML = opt.value;\n opt.setAttribute('id', item.id_organizacion);\n select.appendChild(opt);\n });\n } else {\n select = document.getElementById(target);\n\n optList.forEach(function(item) {\n var opt = document.createElement('option');\n opt.value = item.nombre;\n opt.innerHTML = opt.value;\n opt.setAttribute('id', item.id_organizacion);\n select.appendChild(opt);\n });\n }\n }", "title": "" }, { "docid": "b3f47530570b8970512d60887dc45d81", "score": "0.56685877", "text": "function dropdownList(arr){\n //iterate through items in each array and push unique values to arrays\n arr.forEach(([city,state,country,shape])=>{\n if (!cities.includes(city)){\n cities.push(city);\n }\n if (!states.includes(state)){\n states.push(state);\n }\n if (!countries.includes(country)){\n countries.push(country);\n }\n if (!shapes.includes(shape)){\n shapes.push(shape);\n }\n });\n}", "title": "" }, { "docid": "347a0d65db9416d371aff5c5a1c44aef", "score": "0.56641996", "text": "function populateDropDown(userGroupMap) {\r\n\tvar userGroupSelect = document.getElementById(\"userGroupInptId\");\r\n\tfor (var key in userGroupMap) {\t\t\t\t\r\n\t\tvar option = document.createElement(\"option\");\r\n\t\toption.text = userGroupMap[key];\r\n\t option.value = key+\"!\"+userGroupMap[key];\r\n\t option.className = \"form-control-general\";\r\n\t try {\r\n\t \tuserGroupSelect.add(option, null); //Standard \r\n\t }catch(error) {\r\n\t \t//regionSelect.add(option); // IE only\r\n\t }\r\n\t}\r\n}", "title": "" }, { "docid": "d9cf534c0fd66bcd59eecef04ffe4321", "score": "0.56617445", "text": "function optionsForSelect(select, options, textForBlankOption){\n if(textForBlankOption){\n var opt = new Element('option', {\n \"value\":\"\"\n }).insert(textForBlankOption);\n select.insert(opt)\n }\n\n options.each(function(pair){\n var opt = new Element('option', {\n \"value\":pair.key\n }).insert(pair.value);\n select.insert(opt);\n });\n}", "title": "" }, { "docid": "ff8db5c2bf430404099a283cb5e2e781", "score": "0.5656576", "text": "function setOption(drop){\n console.log(drop);\n drop.forEach((breed) => {\n //console.log(breed);\n let optionTag = document.createElement(\"option\")\n optionTag.textContent = breed\n optionTag.value = breed;\n selectTag.append(optionTag)\n });\n}", "title": "" }, { "docid": "0d3175e76133d00f5115e3898ca0e7e9", "score": "0.5652006", "text": "function createDropDown(element) {\n var mySelect = document.getElementById(\"filter-\" + element);\n var myArray = [];\n switch (element) {\n case \"city\":\n myArray = Array.from(cities).sort();\n break;\n case \"state\":\n myArray = Array.from(states).sort();\n break;\n case \"country\":\n myArray = Array.from(countries).sort();\n break;\n case \"shape\":\n myArray = Array.from(shapes).sort();\n break;\n default:\n break;\n }\n\n for (var i = 0; i < myArray.length; i++) {\n var option = document.createElement(\"option\");\n option.text = myArray[i];\n option.value = myArray[i];\n mySelect.appendChild(option);\n }\n}", "title": "" }, { "docid": "f41d79bc70a92280ec2947e3ab70ad61", "score": "0.56515145", "text": "function populateDays() {\n for (var i = 1; i < weekdays.length - 1; i++) {\n $('#weekDays').append($('<option>', {\n value: i,\n text: weekdays[i]\n }));\n }\n}", "title": "" }, { "docid": "8059ee15c27f9e06ac1634b747b06c6e", "score": "0.56489545", "text": "function genOptions(options) {\r\n let keys = Object.keys(options);\r\n let values = Object.values(options);\r\n let html = \"\"\r\n for (i in keys) {\r\n let selected = i == 0 ? ' selected=\"selected\"' : \"\";\r\n let option = '<option value=\"' + values[i] + '\"' + selected + '>' + keys[i] + '</option>';\r\n html += option;\r\n }\r\n selector.innerHTML = html;\r\n selector.onchange = () => {\r\n getData(selector.value);\r\n }\r\n}", "title": "" }, { "docid": "db293b4de3cc6c05a7d4cc7cc23cfd99", "score": "0.56463724", "text": "function element_bs_select(id,options,parent){\n var element = document.getElementById(id);\n for (var i = 0; i < options.length; i++) {\n var option = document.createElement(\"option\");\n option.text = options[i];\n option.value = i;\n element.add(option);\n }\n var out = document.getElementById(parent);\n out.appendChild(element);\n}", "title": "" }, { "docid": "99ce3d49d6acdc5e9aa9fb00ac5b929f", "score": "0.5644378", "text": "function populateBreedsSelect(breeds) {\n $breed_select.empty().append(function() {\n var output = '';\n $.each(breeds, function(key, value) {\n output += '<option id=\"' + value.id + '\">' + value.name + '</option>';\n });\n return output;\n });\n}", "title": "" }, { "docid": "99ce3d49d6acdc5e9aa9fb00ac5b929f", "score": "0.5644378", "text": "function populateBreedsSelect(breeds) {\n $breed_select.empty().append(function() {\n var output = '';\n $.each(breeds, function(key, value) {\n output += '<option id=\"' + value.id + '\">' + value.name + '</option>';\n });\n return output;\n });\n}", "title": "" }, { "docid": "3c52e678ff8136b375eb5248e9213ced", "score": "0.56437004", "text": "function populateOptionArray(options, optionArray){\n for(let i = 0; i<options.length; i++){\n for(let j=0; j<options[i].probability; j++)\n optionArray.push(options[i]);\n }\n}", "title": "" }, { "docid": "770740fc04f25975a0eb38d8485d9af0", "score": "0.5636105", "text": "function sizeSelectRendering(sizes) {\r\n\tvar sizeArray = sizes.split(\",\");\r\n\tvar selectTag = document.getElementsByName(\"size\")[0];\r\n\tfor (var i = 0; i <= sizeArray.length - 1; i++) {\r\n\t\tvar optionTag = document.createElement(\"option\");\r\n\t\tvar optionText = document.createTextNode(sizeArray[i]);\r\n\t\toptionTag.setAttribute(\"value\", sizeArray[i]);\r\n\t\toptionTag.appendChild(optionText);\r\n\t\tselectTag.appendChild(optionTag);\r\n\t}\r\n\tselectTag.value = sizeArray[0];\r\n}", "title": "" }, { "docid": "51d655d0e8f035f6564e1bc7540a3595", "score": "0.56339264", "text": "createSearchResults(nameArr, descArr) {\n const resultsArr = [];\n let counter = 0;\n nameArr.forEach((name) => {\n resultsArr.push(<option value={name} key={counter}>{descArr[counter]}</option>);\n counter++;\n });\n return resultsArr;\n }", "title": "" } ]
59e70451c229ad08641f1643adb7e989
Make Nav Items Avtive Add active class to the current Anchor in Nav Bar (highlight it)
[ { "docid": "91191fdff767c6fdd1aa24cc91b85bda", "score": "0.79275364", "text": "function ActiveMe() {\n var Ul = document.getElementById(\"myUl\");\n var Anchors = Ul.getElementsByClassName(\"nav-item\");\n for (var i = 0; i < Anchors.length; i++) {\n Anchors[i].addEventListener(\"click\", function () {\n var current = document.getElementsByClassName(\"active\");\n if (current.length > 0) {\n current[0].className = current[0].className.replace(\" active\", \"\");\n }\n this.className += \" active\";\n });\n }\n}", "title": "" } ]
[ { "docid": "0470a22dbdcd9de3559c00c36b841edc", "score": "0.8201059", "text": "function highlightActiveMenu(){\n\tvar aas = $$('.nav')[0].getElements('a');\n\taas.each(function(item){\n\t\tif (location.hash.contains(item.hash)){\n\t\t\titem.getParent().addClass('active');\n\t\t}\n\t});\n}", "title": "" }, { "docid": "6a661b8246854cc0b46f8ec4e9736b44", "score": "0.77956414", "text": "function updateActiveLink(e) {\n const links = document.getElementsByClassName(\"nav-item\");\n\n for (var i = 0; i < links.length; i++)\n links[i].classList.remove(\"active\");\n\n e.parentElement.classList.add(\"active\");\n}", "title": "" }, { "docid": "429a4dad28236e1f91464dee05c38314", "score": "0.7728387", "text": "function addActive() {\n for (var i = 0; i < navItems.length; i++) {\n // remove the active class from all li elements\n navItems[i].classList.remove('active');\n\n //add active class on this elements \n this.classList.add('active');\n }\n }", "title": "" }, { "docid": "21fa2b26dfcff119e4134e2a0cb93bf5", "score": "0.77143013", "text": "function navActive() {\n for (let i = 0; i < navLink.length; i++) {\n if (navLink[i].href === path) {\n navLink[i].classList.add('active');\n }\n }\n}", "title": "" }, { "docid": "99e2766b72e042be45e4580a482aaf46", "score": "0.7648149", "text": "function setActive() {\r\n aObj = document.getElementById('nav').getElementByTagName('a');\r\n for(i=0;i<Obj.length;i++) {\r\n if(document.location.href.indexOf(aObj[i].hred)>=0) {\r\n aObj[i].className='active';\r\n }\r\n }\r\n}", "title": "" }, { "docid": "e421fb008d0bcef179cbd33538422cdb", "score": "0.7598396", "text": "function highlight() {\n $(\"#nav a\").each(function() {\n const self = $(this);\n const href = self.attr(\"href\");\n const path = window.location.pathname;\n\n if (path === href) {\n self.addClass(\"active\");\n self.siblings().removeClass(\"active\");\n }\n });\n}", "title": "" }, { "docid": "e4893866e58a70225d0231d90a48f81a", "score": "0.7584975", "text": "function addActiveClass(element) {\n if (current === \"\") {\n //for root url\n if (element.attr('href').indexOf(\"index.html\") !== -1) {\n element.parents('.nav-item').last().addClass('active');\n if (element.parents('.sub-menu').length) {\n element.closest('.collapse').addClass('show');\n element.addClass('active');\n }\n }\n } else {\n //for other url\n if (element.attr('href').indexOf(current) !== -1) {\n element.parents('.nav-item').last().addClass('active');\n if (element.parents('.sub-menu').length) {\n element.closest('.collapse').addClass('show');\n element.addClass('active');\n }\n if (element.parents('.submenu-item').length) {\n element.addClass('active');\n }\n }\n }\n }", "title": "" }, { "docid": "df459536580d347edb44841a23cc478f", "score": "0.7558078", "text": "function addActiveClass(element) {\n if (current === \"\") {\n //for root url\n if (element.attr('href').indexOf(\"index.html\") !== -1) {\n element.parents('.nav-item').last().addClass('active');\n if (element.parents('.sub-menu').length) {\n element.closest('.collapse').addClass('show');\n element.addClass('active');\n }\n }\n } else {\n //for other url\n if (element.attr('href').indexOf(current) !== -1) {\n element.parents('.nav-item').last().addClass('active');\n if (element.parents('.sub-menu').length) {\n element.closest('.collapse').addClass('show');\n element.addClass('active');\n }\n if (element.parents('.submenu-item').length) {\n element.addClass('active');\n }\n }\n }\n }", "title": "" }, { "docid": "19b8aa2f22c575b14a7d37033659fd18", "score": "0.75327516", "text": "function changeActiveAnchor(current) {\n var goToAnchor = myAnchors[current];\n // Top button\n if (goToAnchor != '#accueil') {\n document.getElementById(\"button_to_top\").className = \"opacity1\";\n }\n else {\n document.getElementById(\"button_to_top\").className = \"opacity0\";\n }\n\n // For menu\n var anchorHeader = '';\n for (var i = 0; i < myAnchorsHeaderIds.length; i++) {\n if (myAnchorsHeaderIds[i] != anchorHeader) {\n anchorHeader = myAnchorsHeaderIds[i];\n document.getElementById(myAnchorsHeaderIds[i]).className = \"border_right_li\";\n }\n if (i == current) {\n document.getElementById(myAnchorsHeaderIds[i]).className = \"border_right_li active\";\n }\n }\n }", "title": "" }, { "docid": "5377aef12d32023506b7445643a3921f", "score": "0.75212336", "text": "function addActiveClassToNavbar(){\n navbarListItems.forEach(function(liElem){\n sections.forEach(function(section){\n // checks if the navber list item class list contains the section id\n if(liElem.classList.contains(section.getAttribute('id')) && section.classList.contains('your-active-class')){\n removeActiveFromListItems();\n liElem.classList.add('active');\n };\n });\n });\n }", "title": "" }, { "docid": "d06187763de640861bd3b5b3beb9e109", "score": "0.7516829", "text": "function addActiveClassToMainMenu() {\n // [url-path-segment]: [nav-item-classname]\n var rootPages = {\n 'future': 'future',\n 'international': 'international',\n 'current': 'current',\n 'research': 'research',\n 'learning-teaching': 'learning-teaching'\n },\n urlPathSegments = window.location.pathname.split('/');\n\n if (urlPathSegments.length > 1 && urlPathSegments[1] !== '' && hasProp(rootPages, urlPathSegments[1])) {\n var activeNavItemClass = rootPages[urlPathSegments[1]];\n var activeNavItem = document.querySelector(\".menu-bar .\".concat(activeNavItemClass));\n if (activeNavItem) activeNavItem.classList.add('active');\n }\n}", "title": "" }, { "docid": "92d4869bd9ac63507f113b0d23dac854", "score": "0.7511626", "text": "function highlightActiveLink() \n {\n let title = document.title; //assign document title to title \n \n title = title.toLowerCase(); //change the title name to all lowercase \n console.log(`The title of the page is ${title}`); //show which page you are on \n \n let navAnchors = document.querySelectorAll(\"li a\");\n \n for (const anchor of navAnchors)\n { \n let anchorString = anchor.getAttribute(\"href\"); \n anchorString = anchorString.substr(0, anchorString.length - 5); //get title name without '.html'\n \n if ((title === \"about\") && (anchorString === \"index\") || (title === anchorString))\n {\n \n anchor.className = \"nav-link active\"; //if you are on the particular page , active nav bar\n }\n \n } \n \n }", "title": "" }, { "docid": "aeea3b9701c4916957a7cb74d55fc80f", "score": "0.7511276", "text": "function activateNavItems() {\n document.querySelectorAll('.nav-item').forEach((navItem) => {\n navItem.addEventListener('click', function () {\n if (activeNavItem != this) {\n activeNavItem.classList.remove('nav-item-active');\n this.classList.add('nav-item-active');\n activeNavItem = this;\n }\n });\n });\n}", "title": "" }, { "docid": "fa46c219fb284d04902d40f052c59aba", "score": "0.7477241", "text": "function addActive(){\n allSections.forEach(section => {\n //active state to navigation items, create string to select the corresponding item on navigation menu\n let s1 = '#' + section.getAttribute(\"id\");\n let s2 = \"a[href='\"+ s1 +\"']\";\n let navItem = document.querySelector(s2);\n\n if(isInViewport(section)){\n section.classList.add('your-active-class');\n navItem.parentElement.classList.add('active');\n }\n else{\n section.classList.remove('your-active-class');\n navItem.parentElement.classList.remove('active');\n }\n });\n}", "title": "" }, { "docid": "1307d24e8a7412cafb25514e2927830b", "score": "0.747537", "text": "function addClass () {\n $('.menu-item-just').removeClass('menu-item_active');\n $(`.menu-item-just[href=\"#${id}\"]`).addClass('menu-item_active');\n }", "title": "" }, { "docid": "93f96166a24a02600d1df8981f89655a", "score": "0.7471108", "text": "function activeMenuItem($links) {\n var cur_pos = $(window).scrollTop() + 2,\n bottomPosition = $(document).height() - $(window).height() - $(window).scrollTop(),\n sections = $(\"section\"),\n nav = $links,\n nav_height = nav.outerHeight(),\n home = nav.find(\" > ul > li:first\");\n\n sections.each(function() {\n var top = $(this).offset().top - nav_height,\n bottom = top + $(this).outerHeight();\n\n if (cur_pos >= top && cur_pos <= bottom) {\n nav.find(\"> ul > li > a\").parent().removeClass(\"current-menu-item\");\n nav.find(\"a[href='#\" + $(this).attr('id') + \"']\").parent().addClass(\"current-menu-item\");\n } else if (cur_pos === 2) {\n nav.find(\"> ul > li > a\").parent().removeClass(\"current-menu-item\");\n home.addClass(\"current-menu-item\");\n }\n });\n }", "title": "" }, { "docid": "3a487b031a893dbd555136c8c6d497e2", "score": "0.7389069", "text": "function navActive(elem) {\n $(elem).addClass(\"active\").removeClass(\"inactive\");\n }", "title": "" }, { "docid": "8d97b7e0c451554acb347a4e99455d53", "score": "0.7387595", "text": "function addActiveClassToMainMenu() {\n // [url-path-segment]: [nav-item-classname]\n const rootPages = {\n study: \"future\",\n international: \"international\",\n students: \"current\",\n research: \"research\",\n engage: \"engage\",\n },\n urlPathSegments = window.location.pathname.split(\"/\");\n\n if (\n urlPathSegments.length > 1 &&\n urlPathSegments[1] !== \"\" &&\n hasProp(rootPages, urlPathSegments[1])\n ) {\n const activeNavItemClass = rootPages[urlPathSegments[1]];\n const activeNavItem = document.querySelector(\n `.menu-bar .${activeNavItemClass}`\n );\n\n if (activeNavItem) activeNavItem.classList.add(\"active\");\n }\n }", "title": "" }, { "docid": "8d97b7e0c451554acb347a4e99455d53", "score": "0.7387595", "text": "function addActiveClassToMainMenu() {\n // [url-path-segment]: [nav-item-classname]\n const rootPages = {\n study: \"future\",\n international: \"international\",\n students: \"current\",\n research: \"research\",\n engage: \"engage\",\n },\n urlPathSegments = window.location.pathname.split(\"/\");\n\n if (\n urlPathSegments.length > 1 &&\n urlPathSegments[1] !== \"\" &&\n hasProp(rootPages, urlPathSegments[1])\n ) {\n const activeNavItemClass = rootPages[urlPathSegments[1]];\n const activeNavItem = document.querySelector(\n `.menu-bar .${activeNavItemClass}`\n );\n\n if (activeNavItem) activeNavItem.classList.add(\"active\");\n }\n }", "title": "" }, { "docid": "0096f26be72886625092e7aa81e7afc3", "score": "0.73726094", "text": "function setActiveLink(e) {\n const navItems = document.getElementsByTagName('li');\n\n for (let i = 0; i < navItems.length; i++) {\n navItems[i].style.background = \"white\";\n navItems[i].style.color = \"black\";\n }\n e.target.style.background = \"black\";\n e.target.style.color = \"white\";\n\n}", "title": "" }, { "docid": "4d2fb564ef22e18c641b808d54a751c8", "score": "0.73594487", "text": "function setActiveLink() {\r\n\r\n const links = document.querySelectorAll('a'); \r\n const currentActiveSection = document.querySelector('.your-active-class');\r\n \r\n // loop for adding active link.\r\n if(currentActiveSection != null){\r\n for(link of links){\r\n \r\n const linkNavValue = link.textContent;\r\n \r\n if(currentActiveSection.getAttribute('data-nav') === linkNavValue){\r\n \r\n link.classList.add('your-active-class-link');\r\n \r\n }else{\r\n \r\n link.classList.remove('your-active-class-link');\r\n }\r\n }\r\n }\r\n}", "title": "" }, { "docid": "f45582530193c7a7fe8cc860ba1c5eaf", "score": "0.7358565", "text": "function active () {\n var header = document.getElementById(\"myTopnav\");\n var btns = header.getElementsByClassName(\"navlink\");\n for (var i = 0; i < btns.length; i++) {\n btns[i].addEventListener(\"click\", function () {\n var current = document.getElementsByClassName(\"active\");\n current[0].className = current[0].className.replace(\" active\", \"\");\n this.className += \" active\";\n });\n }\n }", "title": "" }, { "docid": "dc2b5b486064bb8d41dca00d780fe808", "score": "0.7342188", "text": "function makeActive() {\n for (const section of sections) {\n const box = section.getBoundingClientRect();\n const activeAnchor = document.getElementById(\"menu__item__\" + section.id);\n\n if (box.top <= 150 && box.bottom >= 150) {\n // Apply active state on the current section and the corresponding Nav link.\n section.className = \"active\";\n activeAnchor.className = \"menu__link active\";\n } else {\n // Remove active state from other section and corresponding Nav link.\n section.className = \"\";\n activeAnchor.className = \"menu__link\";\n }\n }\n}", "title": "" }, { "docid": "367fe7a53811706b3a1bfebb424fc98c", "score": "0.73225206", "text": "function activeNav(e) {\n var activeLinks = document.querySelectorAll(\".active\");\n var clickedLink = e.target;\n activeLinks.forEach((activeLink) => {\n activeLink.classList.remove('active');\n });\n\n clickedLink.parentElement.classList.add('active');\n}", "title": "" }, { "docid": "885d131c7f5142bb8fe47ab8d6c11d75", "score": "0.73061687", "text": "function activeItem(id) {\n $('.nav-link').each(function(index, element){\n $(element).removeClass('active');\n });\n\n $(id).addClass('active');\n}", "title": "" }, { "docid": "5a235060fc004a23c7bf53f49043dc28", "score": "0.7298632", "text": "function activeMenuItem($links) {\n var top = $(window).scrollTop(),\n windowHeight = $(window).height(),\n documentHeight = $(document).height(),\n cur_pos = top + 2,\n sections = $(\"section\"),\n nav = $links,\n nav_height = nav.outerHeight(),\n home = nav.find(\" > ul > li:first\");\n\n\n sections.each(function() {\n var top = $(this).offset().top - nav_height - 40,\n bottom = top + $(this).outerHeight();\n\n if (cur_pos >= top && cur_pos <= bottom) {\n nav.find(\"> ul > li > a\").parent().removeClass(\"active\");\n nav.find(\"a[href='#\" + $(this).attr('id') + \"']\").parent().addClass(\"active\");\n } else if (cur_pos === 2) {\n nav.find(\"> ul > li > a\").parent().removeClass(\"active\");\n home.addClass(\"active\");\n } else if ($(window).scrollTop() + windowHeight > documentHeight - 400) {\n nav.find(\"> ul > li > a\").parent().removeClass(\"active\");\n }\n });\n }", "title": "" }, { "docid": "2208d4ec9aba104f561df90dcb6a2d45", "score": "0.72823113", "text": "function setActive() {\n\n\t// if a menu item is clicked\n\tif (clickedSec != 0) {\n\t\t\n\t\tprevActive = currActive;\n\t\tcurrActive = clickedSec;\n\n\t\t// restore back to default\n\t\tclickedSec = 0;\n\n\t} else {\n\n\t\tcheckScrollDir();\n\n\t\tfor (sect of sects)\n\t\t\tisInViewport(sect);\t\t\t\n\t}\n\n\tif (prevActive != currActive) {\n\t\tcurrActive.classList.add('active');\n\t\tprevActive.classList.remove('active');\n\n\t\tlet activeNavi = document.getElementsByClassName(currActive.id)[0];\n\t\tactiveNavi.style.color = 'orange';\n\t\t\n\t\tlet nonactiveNavi = document.getElementsByClassName(prevActive.id)[0];\n\t\tnonactiveNavi.style.color = 'white';\n\t}\n}", "title": "" }, { "docid": "44ad69282a6da292f275f6b8d95a2976", "score": "0.727321", "text": "function activeLinks(event){\n\n var sections = [...document.querySelectorAll('.primary-nav a')];\n var scrollPost = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;\n sections.forEach(function(currlink){\n var val = currlink.getAttribute('href');\n var refElement = document.querySelector(val);\n if( refElement.offsetTop <= scrollPost && ( refElement.offsetTop + refElement.offsetHeight > scrollPost )){\n currlink.classList.add('active');\n }else{\n currlink.classList.remove('active');\n }\n });\n}", "title": "" }, { "docid": "0ecdda9a4157c8f24bc66f96423cc2c8", "score": "0.72405803", "text": "function makeLiActive(navItem, menuObj) {\n\t\tif(isHome) {\n\t\t\tnavItem.append('<li class=\"active\">' +'<a href=\"' + menuObj.link + '\" >' + menuObj.name + '</a></li>');\n\t\t}\n\t\telse\n\t\t\tnavItem.append('<li class=\"active\">' +'<a href=\"../' + menuObj.link + '\" >' + menuObj.name + '</a></li>');\n\t}", "title": "" }, { "docid": "91a103ee4ebda52daaefb939d5addb61", "score": "0.7239847", "text": "function changeActiveClass(elem){\n const previousActiveElement=document.querySelector('.your-active-class');\n previousActiveElement.classList.remove('your-active-class');\n elem.classList.add('your-active-class');\n\n const previousActiveNavItem=document.querySelector('.your-active-nav-menu');\n previousActiveNavItem.classList.remove('your-active-nav-menu');\n\n const newActiveNavItemID=elem.getAttribute('data-navItem-id');\n const newActiveNavItem=document.getElementById(newActiveNavItemID);\n newActiveNavItem.classList.add('your-active-nav-menu');\n navigationBar.scrollTo({ //centering the active item in the middle of the navigation bar.\n left: newActiveNavItem.offsetLeft-window.innerWidth*0.5+newActiveNavItem.offsetWidth*0.5+2, //2 is the half of the margin (4px)\n behavior: 'smooth'});\n}", "title": "" }, { "docid": "b4d22000653dafbce4bd5f25e30c0074", "score": "0.7217616", "text": "function changeActive(e) {\n var cur_pos = $(this).scrollTop();\n\n $('section').each(function() {\n var top = $(this).offset().top - nav_height,\n bottom = top + $(this).outerHeight();\n\n if (cur_pos >= top && cur_pos <= bottom) {\n nav.find('li').removeClass('active');\n\n nav.find('a[href=\"#' + $(this).attr('id') + '\"]').parent().addClass('active');\n }\n });\n}", "title": "" }, { "docid": "0c1bb6c80cf0b50afc88ea05829e5e30", "score": "0.71918374", "text": "function addActive() {\n \tvar scrollPos = win.scrollTop();\n \tjQuery('#main > *').each(function(){\n \t\tvar delta = navHeight,\n \t\t\tsection = jQuery(this),\n \t\t\ttop = section.offset().top - delta - offset - 1,\n\t \tbottom = top + section.outerHeight();\n \t\tif (scrollPos >= top && scrollPos <= bottom) {\n \t\t\tif(navLinks.find('a[href=\"#'+ jQuery(this).attr('id') + '\"]').length) {\n\t \t\tnavLinks.find('li').removeClass('active');\n \t\t\tnavLinks.find('a[href=\"#'+ jQuery(this).attr('id') + '\"]').closest('li').addClass('active');\n \t\t\t}\n \t\t}\n \t\telse if (scrollPos + window_height == doc_height) {\n\t \tif (!jQuery('.add-nav li:last').hasClass('active')) {\n \t\t\tnavLinks.find('li').removeClass('active');\n \t\t\tnavLinks.find('li:last').addClass('active');\n \t\t}\n \t\t}\n \t});\n \t}", "title": "" }, { "docid": "f246ad7a04c27592b2fe8390c1baeb13", "score": "0.71896994", "text": "activeNavLinkHandler(section) {\n const navAnchors = document.querySelectorAll('.menu__link');\n navAnchors.forEach((navAnchor) => {\n if (navAnchor.innerText === section.id) {\n navAnchor.classList.add('active');\n } else {\n navAnchor.classList.remove('active');\n }\n });\n }", "title": "" }, { "docid": "b1174ca3aadcdabedea67456eca2a212", "score": "0.7186883", "text": "function addActive() {\n for (let section of sections) {\n const relAnchor = document.querySelector(`a[href=\"#${section.id}\"]`);\n if (isInView(section)) {\n section.classList.add('your-active-class');\n relAnchor.classList.add('active__anchor')\n } else {\n section.classList.remove('your-active-class');\n relAnchor.classList.remove('active__anchor')\n }\n }\n}", "title": "" }, { "docid": "7e80e3864149a97644a4376940cec94c", "score": "0.717419", "text": "function setNavItemAsActive(element){\n const items = navbarList.getElementsByTagName('li');\n for(item of items){\n item.classList.remove('active');\n }\n element.classList.add('active');\n}", "title": "" }, { "docid": "c2342dbfaa47d94736298890d3ed71bf", "score": "0.7163076", "text": "function makeActive() {\n for (const [i, section] of sections.entries()) {\n const box = section.getBoundingClientRect();\n if (box.top <= 200 && box.bottom >= 200) {\n section.classList.add(\"your-active-class\");\n navbarLinks[i].classList.add(\"active\");\n } else {\n section.classList.remove(\"your-active-class\");\n navbarLinks[i].classList.remove(\"active\");\n }\n }\n}", "title": "" }, { "docid": "87ff8431184cd4b8ea0d99a63507230a", "score": "0.715769", "text": "setActiveTab(pageId) {\n console.log(pageId)\n for (let navItem of this.navItems) {\n if (`#${pageId}` === navItem.getAttribute(\"href\")) {\n navItem.classList.add(\"active\");\n } else {\n navItem.classList.remove(\"active\");\n }\n }\n }", "title": "" }, { "docid": "42a167e6020ad8f1da20787edf4fa54c", "score": "0.7148841", "text": "function setNavigationCurrent( item ){\n\n var $newLink = $( $navigation.find( '.link--chapter' )[ item ] ),\n $oldLink = $( '.link--chapter.active' );\n\n $oldLink.removeClass( 'active' );\n $newLink.addClass( 'active' );\n }", "title": "" }, { "docid": "68b1cc90aa7b874e21784a755dd686e6", "score": "0.71472424", "text": "function makeActive() { \n for (const section of sections) {\nconst link= document.querySelector('li[data-nav=\"' + section.id + '\"]');\nconst bounds = section.getBoundingClientRect();\n if (bounds.top <= 100 && bounds.bottom >= 100) {\n // active state on the current section and corresponding nav link\n section.classList.add('your-active-class');\n link.classList.add('active');\n \n } else {\n // active state from other section and link removed.\n section.classList.remove('your-active-class');\n link.classList.remove('active'); \n } \n }\n}", "title": "" }, { "docid": "2b243c4ee80cdfdb04e6bc21503776f7", "score": "0.71466297", "text": "function navItemActive() {\n if ($(\"#intro_header_title\").text() == \"Introduction\") {\n $(\"#nav_2\").addClass(\"text_red\");\n } else if ($(\"#digital_edition_header_title\").text() == \"Digital Edition\") {\n $(\"#nav_3\").addClass(\"text_red\");\n } else if ($(\"#semantic_indexes_header_title\").text() == \"Semantic Indexes\") {\n $(\"#nav_4\").addClass(\"text_red\");\n } else if ($(\"#works_indexes_header_title\").text() == \"Works Semantic Indexes\") {\n $(\"#nav_5\").addClass(\"text_red\");\n } else {\n $(\"#nav_1\").addClass(\"text_red\");\n }\n}", "title": "" }, { "docid": "1fcb9db791c756014b87d5f8e337c5a3", "score": "0.7132833", "text": "setActiveTab(pathname) {\n for (const link of this.navItems) {\n if (pathname === link.getAttribute(\"href\")) {\n link.classList.add(\"active\");\n } else {\n link.classList.remove(\"active\");\n }\n }\n }", "title": "" }, { "docid": "75e5bdb1947b41c66d88aadf3f379d1c", "score": "0.7122518", "text": "function setActiveLink(fragmentId) {\n $(\"#navbar a\").each(function (i, linkElement) {\n var link = $(linkElement),\n pageName = link.attr(\"href\").substr(1);\n if (pageName === fragmentId) {\n link.attr(\"class\", \"active\");\n } else {\n link.removeAttr(\"class\");\n }\n });\n }", "title": "" }, { "docid": "e20de9004445a79090528e3f7190aa5d", "score": "0.7121226", "text": "function setActiveLink(fragmentId) {\n $(\"#navbar a\").each(function(i, linkElement) {\n var link = $(linkElement),\n pageName = link.attr(\"href\").substr(1);\n if (pageName === fragmentId) {\n link.attr(\"class\", \"active\");\n } else {\n link.removeAttr(\"class\");\n }\n });\n }", "title": "" }, { "docid": "d12b4e18f56f3f4e0e4a102e7a06eb4f", "score": "0.711246", "text": "function setActiveNavigation(activeTab) {\n $(\".nav li\").removeClass(\"active\");\n\n $(\"#\" + activeTab).addClass(\"active\");\n }", "title": "" }, { "docid": "160529e18587f8731f1dd2ae8e2175c1", "score": "0.7111268", "text": "function addActiveClass() {\n for (const section of allSections) {\n const myPlace = section.getBoundingClientRect();\n const listItem = document.querySelector('a[href*=\"' + section.id + '\"]');\n if (myPlace.top <= 200 && myPlace.top >= -400) {\n section.classList.add(\"your-active-class\");\n listItem.classList.add(\"menu__link__active__class\");\n } else {\n section.classList.remove(\"your-active-class\");\n listItem.classList.remove(\"menu__link__active__class\");\n }\n // test placement\n // console.log(section.id + \" \" + myPlace.top + \" T \" + myPlace.bottom + \" B \" + section.classList);\n }\n}", "title": "" }, { "docid": "5c6815d7c6141fe8111c6bb45d80fbbd", "score": "0.71071124", "text": "function addActiveClass() {\n\n window.clearTimeout(isScrolling);\n\n for (let i = 0; i < sections.length; ++i) {\n const activeLink = navBarList.getElementsByTagName('li')[i].getElementsByTagName('a')[0];\n if (isInView(sections[i])) {\n sections[i].classList.add(\"your-active-class\");\n const secNumber = sections[i].getAttribute('data-nav');\n activeLink.classList.add('active-link');\n console.log(secNumber);\n\n }\n else {\n sections[i].classList.remove(\"your-active-class\");\n activeLink.classList.remove('active-link');\n\n }\n }\n}", "title": "" }, { "docid": "34f23151261c8d1d02653ace7a373bb9", "score": "0.7093863", "text": "function addActivClass(anchor) {\n const rmActiveLinks = document.querySelectorAll('.active-link');\n rmActiveLinks.forEach(itme => {\n itme.classList.remove(\"active-link\")\n });\n\n anchor.classList.add(\"active-link\");\n\n}", "title": "" }, { "docid": "456d9d546d51ebea7bfc4cd5ddb7ec5e", "score": "0.7087136", "text": "function activeMenuItem($links) {\r\n var top = $(window).scrollTop(),\r\n windowHeight = $(window).height(),\r\n documentHeight = $(document).height(),\r\n cur_pos = top + 2,\r\n sections = $(\"section\"),\r\n nav = $links,\r\n nav_height = nav.outerHeight(),\r\n home = nav.find(\" > ul > li:first\"),\r\n contact = nav.find(\" > ul > li:last\");\r\n\r\n\r\n sections.each(function() {\r\n var top = $(this).offset().top - nav_height - 40,\r\n bottom = top + $(this).outerHeight();\r\n\r\n if (cur_pos >= top && cur_pos <= bottom) {\r\n nav.find(\"> ul > li > a\").parent().removeClass(\"current\");\r\n nav.find(\"a[href='#\" + $(this).attr('id') + \"']\").parent().addClass(\"current\");\r\n } else if (cur_pos === 2) {\r\n nav.find(\"> ul > li > a\").parent().removeClass(\"current\");\r\n home.addClass(\"current\");\r\n } else if($(window).scrollTop() + windowHeight > documentHeight - 400) {\r\n nav.find(\"> ul > li > a\").parent().removeClass(\"current\");\r\n contact.addClass(\"current\");\r\n }\r\n });\r\n }", "title": "" }, { "docid": "b6d2588a279a2fd47a4e862b9c765c9f", "score": "0.7081786", "text": "function updateHeaderActiveClass() {\n $('.header__menu li').each(function(i, val) {\n if ($(val).find('a').attr('href') == window.location.pathname.split('/').pop()) {\n $(val).addClass('is-active');\n } else {\n $(val).removeClass('is-active')\n }\n });\n }", "title": "" }, { "docid": "9e04d0068c587d5837e7454a66255a45", "score": "0.70417047", "text": "function SetActiveMenu() {\n var path = window.location.pathname;\n path = path.replace(/\\/$/, \"\");\n path = decodeURIComponent(path);\n\n $(\".nav a\").each(function () {\n $(this).click(function () {\n if (this.href == window.location.href.replace(\"Admin\",\"\")) {\n // $(this).closest(\"li\").removeClass()(\"active\");\n $(this).closest(\"li\").addClass(\"active\");\n }\n });\n\n });\n\n}", "title": "" }, { "docid": "1e921e451f35ef0d538e63765a1120ab", "score": "0.70200497", "text": "function setActiveItem(pos) {\r\n $('nav li.active').removeClass('active');\r\n $('nav li').eq(pos-1).addClass('active');\r\n }", "title": "" }, { "docid": "f2b2e817bbc9336b67b4ce8a09808c06", "score": "0.701931", "text": "function makeActive(){ \n for(const section of sections){\n //add active class and highlight (\"getBoundingClientRect()\" function returns the size of an element and its position relative to the viewport)\n const box= section.getBoundingClientRect();// where is the section in the viewport, and how big is it?\n if(box.top <=110 && box.bottom >= 110){// if the section is between these numbers in the viewport then it means its active\n section.classList.add(\"your-active-class\");\n document.querySelector(`.navbar-link-${section.id}`).classList.add(\"active\");\n } else {\n //remove active class when not viewing the section, so that it removes the highlighting\n section.classList.remove(\"your-active-class\");\n document.querySelector(`.navbar-link-${section.id}`).classList.remove(\"active\");\n }\n }\n}", "title": "" }, { "docid": "3be005cb9b997f538f0c2cc77160c8ed", "score": "0.69994855", "text": "function liAddActiveClass(numb) {\n navLIS.forEach(li => {\n li.classList.remove(\"active\");\n });\n navLIS[numb].classList.add(\"active\");\n}", "title": "" }, { "docid": "8f502bd5043ccd7462e533faf11f6e4e", "score": "0.69960153", "text": "function activeSectionInNav() {\n const navItems = document.querySelectorAll('.navigation__item');\n\n navItems.forEach((item, index) => {\n if (index === visibleSectionIndex) {\n item.classList.add('active');\n } else {\n item.classList.remove('active');\n }\n })\n}", "title": "" }, { "docid": "26a524efa9c7c001e69c77a0999292c8", "score": "0.6991166", "text": "function dynamicActiveClass() {\n var pathNameOfCurrentPage = window.location.pathname;\n $('a[href=\"' + pathNameOfCurrentPage + '\"]').parent().addClass('active');\n }", "title": "" }, { "docid": "56a17f73ceb5174911ca2c4b96a1a8d7", "score": "0.6987653", "text": "function onScroll(event) {\n var scrollPos = $(document).scrollTop();\n $(\" .navigation .nav-item a\").each(function () {\n var currLink = $(this);\n var refElement = $(currLink.attr(\"href\"));\n if (\n refElement.position().top <= scrollPos &&\n refElement.position().top + refElement.height() > scrollPos\n ) {\n $(\".navigation .nav-item a\").removeClass(\"active\");\n currLink.addClass(\"active\");\n } else {\n currLink.removeClass(\"active\");\n }\n });\n}", "title": "" }, { "docid": "0306853c81e5f2a2bb5b674f14ac0cf7", "score": "0.6975629", "text": "function makeMenuActive(){\n\t\t\tvar hash = window.location.hash.split('/');\n\t\t\tif(hash && hash[1] === 'category') {\n\t\t\t\tvar categoryId = hash[2];\n\t\t\t\tfor (var i = 0; i < menu_rows.length; i++) {\n\t\t\t\t\tif( menu_rows[i].attr('data-category-id') === categoryId ) {\n\t\t\t\t\t\tmenu_rows[i].addClass('active');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "999eb5c15b191b9d99b90b6894262ed3", "score": "0.6971895", "text": "function setActive(element) {\n element.classList.add(\"active\");\n element.parentElement.classList.add(\"active\");\n\n let parent_collection = element.closest(\"li.nav-list-item\").parentElement.closest(\"li.nav-list-item\");\n if (parent_collection !== null) {\n parent_collection.classList.add(\"active\");\n }\n}", "title": "" }, { "docid": "263aed8e5102f29a217827c6d121f0bc", "score": "0.69711864", "text": "function scrollActiveLink() {\n const sections = $$('section[id]')\n const nav = $('.nav')\n let windowScroll = this.pageYOffset\n if (nav) {\n const navMenu = nav.querySelector('#nav-menu')\n if (navMenu) {\n sections.forEach((linkSection) => {\n let sectionId = linkSection.getAttribute('id')\n let currentHeight = linkSection.offsetHeight\n let currentTop = linkSection.offsetTop\n if (windowScroll > currentTop && windowScroll <= currentTop + currentHeight) {\n $('#nav-menu a[href*=' + sectionId + ']').classList.add('nav__item--active')\n } else {\n $('#nav-menu a[href*=' + sectionId + ']').classList.remove('nav__item--active')\n }\n })\n }\n }\n}", "title": "" }, { "docid": "2a3d43d27d43972f0edb072f376a93c5", "score": "0.69584894", "text": "function snMakeActive(snNavElement)\r\n{\r\n\tif(!jq(snNavElement).parent().hasClass('active'))\r\n\t{\r\n\t\tjq(snNavElement).parent().prevAll().removeClass('active');\r\n\t\tjq(snNavElement).parent().nextAll().removeClass('active');\r\n\t\tjq(snNavElement).parent().addClass('active');\t\r\n\t}\r\n}", "title": "" }, { "docid": "76b7aa5d7bfd55a3f4eb455a46cd8e0c", "score": "0.6917251", "text": "function activeState() {\n window.addEventListener('scroll', () => {\n for (let i = 0; i < allSections.length; i++) {\n rect = allSections[i].getBoundingClientRect();\n // Set sections as active\n if (rect.top >= -50 && rect.top <= 250) {\n allSections[i].classList.add('your-active-class');\n let activeNav = allSections[i].getAttribute('data-nav');\n const allLinks = document.querySelectorAll('li');\n //set link as active\n allLinks.forEach((eachlink) => {\n if (eachlink.innerText == activeNav) {\n eachlink.classList.add('active');\n } else {\n eachlink.classList.remove('active');\n }\n\n })\n\n } else {\n allSections[i].classList.remove('your-active-class');\n }\n }\n\n })\n\n}", "title": "" }, { "docid": "c41f6083f631235fa9695d6ae9af4c38", "score": "0.6908356", "text": "function activateNav(pos){\r\n\t\tvar offset = 100;\r\n\t\twin.unbind('hashchange', hashchange);\r\n\t\tfor(var i=sectionscount;i>0;i--){\r\n\t\t\tif(sections[i-1].pos <= pos+offset){\r\n\t\t\t\tnavanchors.removeClass('current');\r\n\t\t\t\tnavanchors.eq(i-1).addClass('current');\r\n\t\t\t\twin.bind('hashchange', hashchange);\r\n\t\t\t\tbreak;\r\n\t\t\t};\r\n\t\t}\t\r\n\t}", "title": "" }, { "docid": "cabf79b62b75bb0b22fd3741a79109b3", "score": "0.6905645", "text": "function activeClassNav() {\n $(window).scroll( function () {\n let scroll = $(this).scrollTop();\n $('a').removeClass('active');\n\n if (scroll >= $('#home').offset().top -100 && scroll < $('#services').offset().top - 100) {\n $('li > a[href=\"#home\"]').addClass('active');\n }\n if (scroll > $('#services').offset().top -100 && scroll < $('#portfolio').offset().top - 100) {\n $('li > a[href=\"#services\"]').addClass('active');\n }\n if (scroll > $('#portfolio').offset().top -100 && scroll < $('#about').offset().top - 100) {\n $('li > a[href=\"#portfolio\"]').addClass('active');\n }\n if (scroll > $('#about').offset().top -100 && scroll < $('#contact').offset().top - 100) {\n $('li > a[href=\"#about\"]').addClass('active');\n }\n if (scroll > $('#contact').offset().top -100) {\n $('li > a[href=\"#contact\"]').addClass('active');\n }\n });\n}", "title": "" }, { "docid": "777b94ff830cdab8a45574fc8c63420b", "score": "0.68873", "text": "function active_link(active_section) {\n // get the data nav from the section\n let section_nav = active_section.getAttribute('data-nav');\n //get all links\n let links = document.querySelectorAll('a');\n //loop on links\n links.forEach((link) =>{\n if(link.textContent == section_nav){\n links.forEach( (link) => { \n link.classList.remove('your-active-class'); \n });\n //add active class to active link\n link.classList.add('your-active-class');\n };\n });\n }", "title": "" }, { "docid": "532e12fd7d0e48f7d53bf5a1dc22ea9b", "score": "0.6879343", "text": "function setActive(indices) {\n let nav = $('#nav-list');\n let children = nav.children();\n children.removeClass('active');\n\n indices.forEach(function(index) {\n let active = children.eq(index);\n active.addClass('active'); \n });\n }", "title": "" }, { "docid": "ef7d4ac93318710b89cfe80bfa26a695", "score": "0.6872441", "text": "function changeActiveAnchor(current) {\n var goToAnchor = myAnchors[current];\n // Top button\n if (goToAnchor != '#home') {\n document.getElementById(\"button_to_top\").className = \"opacity1\";\n }\n else {\n document.getElementById(\"button_to_top\").className = \"opacity0\";\n }\n }", "title": "" }, { "docid": "db16c6e89322001c5ef6d910442ee919", "score": "0.6871601", "text": "function activeate(){\nnavLink.forEach(n =>n.classList.remove('activeLink'));\nthis.classList.add('activeLink');\n\n//remove navbox when li clicked\nmenu.classList.remove('active');\n}", "title": "" }, { "docid": "150878b6a6a0997604021c0e1d123bff", "score": "0.686191", "text": "applyActiveStyle() {\n if (!this.ref.current) {\n return;\n }\n\n const previous = this.ref.current.previousSibling;\n if (previous && previous.matches(`.${styles.menuItem}`)) {\n previous.classList.add(styles.menuItemPreviousActive);\n }\n\n const after = this.ref.current.nextSibling;\n if (after && after.matches(`.${styles.menuItem}`)) {\n after.classList.add(styles.menuItemAfterActive);\n }\n }", "title": "" }, { "docid": "7b7c6d223e5279ec38923c41fa018801", "score": "0.6852716", "text": "function setActive(){\n window.addEventListener('scroll', function(e){\n \n let section = null;\n let lessValue = 999999;\n for (sec of sections) {\n if (isSectionInView(sec, -280, lessValue)) {\n lessValue = sec.getBoundingClientRect().top;\n section = sec;\n };\n };\n\n if(!section)\n section = sections[0];\n\n const navItem = navbarList.querySelector(`[data-section=${section.id}]`);\n setNavItemAsActive(navItem)\n addClassToActiveSection(section)\n });\n}", "title": "" }, { "docid": "14512555277bd48d95b0947f574230f7", "score": "0.6847651", "text": "function active(sref, params) {\n if ($state.isActive(sref, params)) {\n element.addClass(attrs.activeClass);\n } else {\n element.removeClass(attrs.activeClass);\n }\n }", "title": "" }, { "docid": "9e312da1f3b7544e903b4ac2d569a6d7", "score": "0.6837846", "text": "function setActiveItem() {\n var active;\n for (var heading of headings) {\n if (!active && heading.element.offset().top >= window.scrollY) {\n active = heading;\n }\n heading.listItem.toggleClass(\"active\", heading === active);\n }\n }", "title": "" }, { "docid": "93a7dc76d125a434bd0f11f0ff1d5dbb", "score": "0.6823613", "text": "function activeState($link) {\n $link.parents('.tek-tabs__nav, .sticky-tabs__nav').find('a').removeClass('active');\n $link.addClass('active');\n }", "title": "" }, { "docid": "bde767101d4cb70f22e1c2488f7b7946", "score": "0.6821211", "text": "function highlight() {\n\t\tvar scrollTop = $(window).scrollTop();\n\t\tvar navitem;\n\t\tif (scrollTop >= about && scrollTop < biography) {\n\t\t\tnavitem = $('a[href=\"#about-section\"]');\n\t\t} else if (scrollTop >= biography && (scrollTop + 60) < education) {\n\t\t\tnavitem = $('a[href=\"#biography-section\"]');\n\t\t} else if ((scrollTop + 60) >= education && (scrollTop + 60) < industry) {\n\t\t\tnavitem = $('a[href=\"#education-section\"]');\n\t\t} else if ((scrollTop + 60) >= industry && (scrollTop + 60) < research) {\n\t\t\tnavitem = $('a[href=\"#industry-section\"]');\n\t\t} else if ((scrollTop + 60) >= research && (scrollTop + 60) < projects) {\n\t\t\tnavitem = $('a[href=\"#research-section\"]');\n\t\t} else if ((scrollTop + 60) >= projects && (scrollTop + 60) < resources) {\n\t\t\tnavitem = $('a[href=\"#projects-section\"]');\n\t\t} else {\n\t\t\tnavitem = $('a[href=\"#resources-section\"]');\n\t\t}\n\t\tif (current_navitem != navitem) {\n\t\t\t// jQuery Function Number 6\n\t\t\tcurrent_navitem.css(\"background-color\", \"#EEEEEE\");\n\t\t\tnavitem.css(\"background-color\", \"#ddd\");\n\t\t\tcurrent_navitem = navitem;\n\t\t}\n\t}", "title": "" }, { "docid": "70cd910b7d238e9faf892c7c068d49d8", "score": "0.68090725", "text": "function clickNavItem(button) {\n const navButtons = [...document.querySelectorAll('.nav-items a')]\n \n if(!button.classList.contains('active')) {\n navButtons.forEach(button => {\n button.classList.remove('active')\n })\n button.classList.add('active')\n }\n}", "title": "" }, { "docid": "93ec0b2b9d95e0dbd4441fde0bb6f8e2", "score": "0.68057567", "text": "function activeSction(currentSection) {\n currentSection.classList.add(\"your-active-class\", \"active\");\n currentSection.style.cssText = \"background-color: lightRed;\";\n\n removeActivelink();\n activateNavLinks(currentSection.getAttribute('id'));\n}", "title": "" }, { "docid": "d49229cc801637400b3ebe73585d8d5d", "score": "0.679964", "text": "function addClassActiveToSection() {\n let sections = [...document.querySelectorAll('section')];\n let nav = document.querySelectorAll('li a');\n console.log(nav);\n\n document.addEventListener('scroll', function() {\n let i = 0;\n sections.forEach(function(section) {\n if (isInViewport(section)) {\n section.classList.add('your-active-class')\n nav.item(i).classList.add('menu__active__link');\n } else {\n section.classList.remove('your-active-class');\n nav.item(i).classList.remove('menu__active__link');\n }\n i++;\n })\n })\n}", "title": "" }, { "docid": "9e4f11c5fc8e826ad6c025fbe9102f42", "score": "0.6791416", "text": "function setActiveSection() {\n\n for (const section of sections) {\n const boundingRect = section.getBoundingClientRect();\n if (boundingRect.top <= 50 && boundingRect.top >= 0) {\n // remove active state from old section and nav-item\n if (currentActiveSection) {\n currentActiveSection.classList.remove('your-active-class');\n document.getElementById(`nav-item-${currentActiveSection.id}`).classList.remove('active-nav-item');\n }\n // add active state to current section and nav-item\n section.classList.add('your-active-class');\n currentActiveSection = section;\n document.getElementById(`nav-item-${section.id}`).classList.add('active-nav-item');\n }\n }\n\n}", "title": "" }, { "docid": "a67e07e817030a3e7c379b102b2e401a", "score": "0.679134", "text": "function updateNav(obj){\n\t\t\tvar last = null;\n\t\t\tobj.find('li a').each(function(){\n\t\t\t\ttry{\n\t\t\t\t\tif($($(this).attr('href')).offset().top<=($(document).scrollTop()+100)){\n\t\t\t\t\t\tlast = $(this);\n\t\t\t\t\t}\n\t\t\t\t}catch(e){}\n\t\t\t});\n\t\t\tif(!last) last=obj.find('li a').eq(0);\n\t\t\tobj.find('li.active').removeClass('active');\n\t\t\tlast.parent().addClass('active');\n\t\t}", "title": "" }, { "docid": "239eb70c269240aa0f3513462ab5df05", "score": "0.6779454", "text": "function setActive(section) {\n if(activeSection != undefined && activeNav != undefined) {\n // removes the old active classes\n activeSection.classList.remove('your-active-class');\n activeNav.classList.remove('active__link');\n }\n\n // set new active section & nav item\n activeSection = section;\n activeSection.classList.add('your-active-class'); \n activeNav = navBarLinks[section.id];\n activeNav.classList.add('active__link');\n}", "title": "" }, { "docid": "1c06401f35f52f335770a5d14a6da4be", "score": "0.6778983", "text": "function sliderUpdateNav() {\n sliderNavigation.find('.active').removeClass('active');\n sliderNavigation.find('a:eq(' + sliderCurrentSlide + ')').addClass('active');\n}", "title": "" }, { "docid": "970b5f12c901284cf4f3168944677878", "score": "0.67465633", "text": "activeMenuOnScroll () {\n let pageOffset = window.pageYOffset;\n let idSelected;\n let lastValue = null;\n\n for(let key in this.offsets){\n // check if hasOwnProperty\n if(!this.offsets.hasOwnProperty(key)) continue;\n let value = this.offsets[key];\n // check if pageOffset is on this loop value\n if( value > pageOffset || (value < lastValue && lastValue !== null)) continue;\n // if all is good add new last value and select this section id\n lastValue = value;\n idSelected = key;\n }\n\n this.navLinks.forEach(\n (item) => item.classList.remove('active')\n );\n // check if we have a section selected\n if(!idSelected) return;\n document.querySelector(`a[href^='${idSelected}']`).classList.add('active');\n }", "title": "" }, { "docid": "95d38f5a209fa92071f42965496e9d42", "score": "0.67327374", "text": "function selectMenuItem(item) {\n\n var liEls = sidebarNavigation.getElementsByTagName('li');\n for(var i=0; i<liEls.length; i++) {\n liEls[i].classList.remove('active');\n }\n\n item.parentElement.classList.add('active');\n\n }", "title": "" }, { "docid": "a330a3abea5e59fe1254b898f4366c3d", "score": "0.6732139", "text": "function onNavBarLoad() {\n $(\"#nav-tasklist\").addClass(\"nav-active\");\n}", "title": "" }, { "docid": "414347df505b22834e238b8cac1b37af", "score": "0.672785", "text": "function changeActiveStatus(){\r\n//creating a const var to hold the links in the nav bar\r\nconst links = document.querySelectorAll('.menu__link');\r\n//loop through each section\r\nsections.forEach(section => {\r\n //Take infromation about the current section position\r\n const positionOfSection = section.getBoundingClientRect();\r\n //if the top of the section is more than 0px from above and less than 200px from above\r\n if(positionOfSection.top>=0&&positionOfSection.top<=200){\r\n //loop through all section and then remove class \"activated\"\r\n sections.forEach(section =>{section.classList.remove('activated');})\r\n //add the class \"activated\" to the current section\r\n section.classList.add('activated');\r\n //Remove all the anchors and remove the class \"activated-link\"\r\n links.forEach(link=>{link.classList.remove('activated-link');})\r\n //loop through the anchors to find the anchor with the text content the same as the dat-* attribute in the section\r\n //the anchor that satisfies the condition takes the class 'activated-link'\r\n links.forEach(link=>{if(link.textContent==section.getAttribute('data-nav'))link.classList.add('activated-link');})\r\n\r\n }})\r\n}", "title": "" }, { "docid": "6d210d4d007ab45fff44492af9bdcf2e", "score": "0.6725015", "text": "function activeLink(actSection)\n{\n // query all links and store in variable \n let links = document.querySelectorAll('a'),\n // extract data-nav value and store in variable\n Nav_value = actSection.getAttribute('data-nav');\n // loop for all links\n links.forEach(link =>\n {\n // condition if data nav value == content of text \n if(link.textContent == Nav_value)\n {\n //loop for all links\n links.forEach(link =>\n {\n // remove active link\n link.classList.remove('your-active-link');\n });\n // Add active link\n link.classList.add('your-active-link');\n }\n });\n}", "title": "" }, { "docid": "530f73e12e8457e792889c48618833d1", "score": "0.6718301", "text": "updateActiveState(){\n var self = this;\n \n for (var key in config.blockSectionData) {\n var section = config.blockSectionData[key];\n \n if(key === 'projects' || key === 'experience'){ \n var activeL = self.el.querySelector(self.navBtnprefix+section.navLink);\n \n if(section.active) {\n activeL.classList.add(self.activeClass);\n } else {\n activeL.classList.remove(self.activeClass);\n } \n }\n }\n }", "title": "" }, { "docid": "3297d2a8d93c8bb9cd68355c7c14a1ec", "score": "0.67153513", "text": "function setActive() {\r\n const sections = document.querySelectorAll('section');\r\n\r\n for (sxn of sections) {\r\n // loop through each section checking if it's in the viewport\r\n if (elementInViewport(sxn)) {\r\n sxn.classList.add('section--active'); // set section class to Active\r\n activeNav(sxn.id) //set the navitem classes active/or remove\r\n } else {\r\n sxn.classList.remove('section--active'); //remove the class active if it exists\r\n }\r\n }\r\n }", "title": "" }, { "docid": "7ca89b082b1c1f77fcce901e098f591a", "score": "0.6706603", "text": "function properHighlight() {\n\t$(\"#searchLinks\").children(\"li\").each(function(i) {\n\t\tif(currentSearchString === $(this).data(\"searchTerm\")) {\n\t\t\t$(this).children().addClass(\"active\");\n\t\t} else {\n\t\t\t$(this).children().removeClass(\"active\");\n\t\t}\n\t});\n}", "title": "" }, { "docid": "63b1e7b10f399548307777eaf7f6cfe0", "score": "0.6688019", "text": "highlightAboutNav(input) {\n\t\tlet navs = this.getNavs();\n\t\t{/*Removes active nav item*/}\n\t\tfor (var i = navs.length - 1; i >= 0; i--) \n\t\t\tnavs[i].classList.remove('about-active');\n\t\t{/*Activates nav item*/}\n\t\tfor (var i = navs.length - 1; i >= 0; i--) \n\t\t\tif (input === navs[i].innerText.toLowerCase())\n\t\t\t\tnavs[i].classList.add('about-active')\n\t}", "title": "" }, { "docid": "4d33d1eb081e4e1fbde2ae3f9e34dbff", "score": "0.66864616", "text": "function getActiveMenuItem(pageIndex) {\r\n var index = null;\r\n $('.nav-link').each(function () {\r\n if (pageIndex) {\r\n index = $(this).attr('data-index').toLowerCase();\r\n if (index == pageIndex) {\r\n $(this).addClass('active');\r\n $(this).parent('.nav-item').addClass('active');\r\n } else {\r\n $(this).removeClass('active');\r\n $(this).parent('.nav-item').removeClass('active');\r\n }\r\n } else {\r\n if ($(this).hasClass('active')) {\r\n index = $(this).attr('data-index').toLowerCase();\r\n }\r\n }\r\n });\r\n return index;\r\n}", "title": "" }, { "docid": "c2be752faa335ae4dabeeb5e95197e64", "score": "0.6676975", "text": "initActiveNav() {\n var url = window.location.pathname;\n this.adminNavs.forEach(function (nav) {\n nav.active = url.startsWith(nav.url);\n });\n }", "title": "" }, { "docid": "8a59e5c6710864c1afb17704f9926d55", "score": "0.66687864", "text": "function activeNavBar() {\n if ($(window).scrollTop() > 0) {\n navBar.addClass(\"active-navbar\");\n } else {\n navBar.removeClass(\"active-navbar\");\n }\n }", "title": "" }, { "docid": "3d3b8fcf13d64abeb0afb36cbb7a7279", "score": "0.665816", "text": "function Active() {\n sections.forEach(section => {\n const rect = section.getBoundingClientRect();\n const Links = document.querySelector(`a[href=\"#${section.getAttribute('id')}\"]`);\n const sectionHalf = section.offsetTop - (section.offsetHeight / 2);\n const sectionBehind = section.offsetTop + (section.offsetHeight / 2);\n if (\n (rect.top >= 0) &&\n (rect.left >= 0) &&\n (Math.floor(rect.right) <= window.innerWidth) &&\n (window.pageYOffset > sectionHalf) && (window.pageYOffset <= sectionBehind)) {\n section.classList.add('active');\n Links.classList.add('current');\n } else if (window.pageYOffset >= sectionBehind || window.pageYOffset < section.offsetTop) {\n section.classList.remove('active');\n Links.classList.remove('current');\n }\n })\n}", "title": "" }, { "docid": "a63fcefbf633e41ea46517e3b2f13a95", "score": "0.6655043", "text": "function activeClass(){\n for (let i=0; i<numSections ;i++){\n if (sections[i].href === window.href && (sections[i].getBoundingClientRect().top >= 0 ))\n {\n sections[i].className='active';\n }\n else {\n sections[i].classList.remove('active');\n }\n }\n}", "title": "" }, { "docid": "42f4217f811cf056e5bf7d2114febacb", "score": "0.6621747", "text": "function onScroll() {\r\n \r\n var scroll_top = $(document).scrollTop();\r\n\r\n $(\"#main-menu a\").each(function () {\r\n \r\n var hash = $(this).attr(\"href\");\r\n \r\n var target = $(hash);\r\n \r\n if ((target.position().top <= scroll_top + (target.outerHeight())/2) && (target.offset().top + target.outerHeight() > scroll_top)) \r\n {\r\n \r\n $(\"a.active\").removeClass(\"active\");\r\n \r\n $(this).addClass(\"active\"); \r\n \r\n } \r\n else \r\n {\r\n $(this).removeClass(\"active\");\r\n }\r\n });\r\n}", "title": "" }, { "docid": "eff7418dc29bcab754185342a9e477f8", "score": "0.66206473", "text": "_routeIsActiveEvent() {\n let _self = this;\n\n $(\"nav ul.navbar-nav li.nav-item a\").each(function () {\n let menuSlug = $(this).attr(\"data-slug\");\n\n if (menuSlug && (menuSlug === _self.routeSlug)) {\n $(this).addClass('active');\n }\n });\n }", "title": "" }, { "docid": "5e900910266b353ed207e663408d586d", "score": "0.66199327", "text": "function addClass(elmt){\n elmt.className = 'active';\n}", "title": "" }, { "docid": "65495dad716aeccb0b763d11fae949c3", "score": "0.6618126", "text": "function navActive($rootScope, $window, AuthServ) {\n\n function link(scope, element, attrs) {\n var li = element.parent();\n if (li[0].nodeName === 'LI') {\n $rootScope.$on('$routeChangeSuccess', function(e) {\n if (element[0].href === $window.location.href) {\n li.addClass('active');\n } else {\n li.removeClass('active');\n }\n })\n\n\n $rootScope.$on('$routeChangeStart', function(e) {\n\n var isLoggedIn = AuthServ.isLoggedIn();\n\n var isLoginMenu = (element[0].innerText === 'Login');\n var isRegisterMenu = (element[0].innerText === 'Register');\n\n if (isRegisterMenu || isLoginMenu) {\n if (isLoggedIn) {\n li.addClass('hide');\n } else {\n li.removeClass('hide');\n }\n }\n\n\n })\n\n }\n }\n\n return {\n restrict: 'A',\n link: link\n }\n }", "title": "" }, { "docid": "fc4973d601eec027e3b759fa0916996a", "score": "0.66150874", "text": "function activeSubNav(link){\n\t\t//first make all links unactive\n\t\t$scope.activeLinkArray = [];\n\t\t$scope.activeLinkArray['client'] = '';\n\t\t$scope.activeLinkArray['employee'] = '';\n\t\t$scope.activeLinkArray['consultant'] = '';\n\t\t$scope.activeLinkArray['all'] = '';\n\t\t//then active the clicked link\n\t\t$scope.activeLinkArray[link] = 'active';\n\t}", "title": "" }, { "docid": "e466aa92486076591d846bbc5780ddae", "score": "0.66047287", "text": "function setActive(className) {\n document.querySelectorAll('header .navbar ul li button').forEach((btn) => {\n btn.classList.remove('active')\n })\n document.querySelector(`header .${className}`).classList.add('active')\n }", "title": "" } ]
b9adcd46599a0a7703f9a1ce54b7fed2
Shows the previous image in the sequence
[ { "docid": "704dfa3e5f6a846fbe53ac773b94a2a7", "score": "0.72122765", "text": "function ShowPreviousImage() {\n loadXMLDoc(-1);\n}", "title": "" } ]
[ { "docid": "ab709e47bb56a3da8f8e4c7062927836", "score": "0.83883876", "text": "function showPrevImage() {\n\t// Decrease the index by 1, round up to the last image if the index become -1\n\tconst numImages = imageList.length\n\timageIdx = (imageIdx - 1 + numImages) % numImages;\n\tshowImageWithCurrentIdx();\n }", "title": "" }, { "docid": "1bc4fc7db034d0006c445911b1e90e95", "score": "0.8323525", "text": "function showPreviousImage() {\n return show(currentIndex - 1);\n }", "title": "" }, { "docid": "83f59a2c9dac6ac9b224b31061cec80a", "score": "0.8175187", "text": "function prev(){\r\n\tsetCurrent(current-1);\r\n\tshowImage();\r\n}", "title": "" }, { "docid": "dc85f9123f41e19f4671f12336f86941", "score": "0.7974364", "text": "function prev(){\n current_image = current_image - 1;\n \n if(current_image < 0){\n current_image = imagelist.length - 1;\n }\n\n print(\"prev image is \" + current_image);\n}", "title": "" }, { "docid": "1ad7b476d5de7092f80fbf135e5d2db0", "score": "0.7829741", "text": "function previousImage(){\n\ti--;\n\tchangeImage();\n}", "title": "" }, { "docid": "ebbd65f1fde14be877d5ef09dfbdea88", "score": "0.7753911", "text": "function PreviousImageClick()\n {\n if(currentIndex ==0)\n {\n currentIndex = ImageArray.length - 1;\n }\n else\n {\n currentIndex -= 1;\n }\n timeCounter -= 1;\n LoadImages();\n }", "title": "" }, { "docid": "45a8cb87651afcaa6afd271d11d1a782", "score": "0.7726546", "text": "function prevImage() {\n let prev_image = current_image-1;\n if (prev_image < 0) prev_image = total_images - 1;\n images[current_image].className = images[current_image].className.replace('pictures__image--show', '').trim();\n images[prev_image].className += ' pictures__image--show';\n current_image = prev_image;\n }", "title": "" }, { "docid": "8af703f422cd0e7cc8cab8a6fb680558", "score": "0.77249104", "text": "function prevImg(){\n prevImg\n }", "title": "" }, { "docid": "5ee97ca5e294a1c83274f04a724caa28", "score": "0.7605325", "text": "function prev(){\n var cartelera = document.getElementById(\"pelis\");\n num--;\n if(num<0){\n\tnum = images.length-1;\n }\n cartelera.src = images[num];\n}", "title": "" }, { "docid": "364d58d2faecc1b198699650f7ce3e43", "score": "0.7602484", "text": "function previousPicture() {\n COUNTER_OBJ.picturesIndex--;\n COUNTER_OBJ.picturesIndex = COUNTER_OBJ.picturesIndex < 0 ? ALL_PICS.length - 1 : COUNTER_OBJ.picturesIndex; \n changePictureInDom();\n}", "title": "" }, { "docid": "aa512c84b7c6190308aa5941916ab64c", "score": "0.76022774", "text": "function prev() {\n\t\n\timagebox.jumpto(\n\t\t\n\t\t// wrap to end\n\t\t_options.continuousGalleries && current === 0? gallery.length-1:\n\t\t// previous image\n\t\tcurrent > 0? current-1:\n\t\t// don't jump\n\t\tnull\n\t);\n}", "title": "" }, { "docid": "3140d878d0a87992af15e934ca727f5e", "score": "0.7598584", "text": "function previousImage(){\n console.log('previous image');\n let imageBack = images.findIndex(image => image === currentImage) - 1;\n //console.log(imageBack);\n if (imageBack >= 0) {\n slide.backgroundImage = `url(./img/gallerie/${images[imageBack]})`; //switches to previous image in array\n currentImage = images[imageBack];\n } else {\n slide.backgroundImage = `url(./img/gallerie/${images[images.length - 1]})`; //switches to last image in array\n currentImage = images[images.length - 1];\n }\n toggleDot();\n}", "title": "" }, { "docid": "0381a243e9f5655039f95e0ea6133d70", "score": "0.75744677", "text": "function prev(){\r\n if(i<1){\r\n var l = i\r\n } else {\r\n var l = i-=1;\r\n }\r\n document.imgSrc.src = myImgSrc + myImg[l] + myImgEnd;\r\n}", "title": "" }, { "docid": "dc1c8e7aab30f170f7102d94cd0aeb49", "score": "0.75229657", "text": "function doPrevious(){\r\n\tif (document.images && thisPic > 0) {\r\n\t\tthisPic--\r\n\t\tdocument.myPicture.src=myPix[thisPic]\r\n\t}\r\n}", "title": "" }, { "docid": "b4f62dfa09e44e8a2b2e23f3bbbfe6fb", "score": "0.75197196", "text": "function showPrevImage() {\n showPhoto(currentImage.previousElementSibling || gallery.lastElementChild);\n }", "title": "" }, { "docid": "b2aec8c9ec70cb0ad558ee772c48420e", "score": "0.74988765", "text": "function prev(){\n if(i<1){\n var l = i\n } else {\n var l = i-=1;\n }\n document.productImg.src = myImgSrc + myImg[l] + myImgEnd;\n}", "title": "" }, { "docid": "2f6e2cae31780efb07617f3627173eea", "score": "0.7488472", "text": "function prevSlide(){\r\n\tsetCurrent(current-1);\r\n\tshowImage(true);\r\n}", "title": "" }, { "docid": "ed6ddec29fecd52f6e206ec2b0895d12", "score": "0.7485007", "text": "function movePrevious() {\n if (index <= 0) {\n index = pix.length-1;\n } else {\n index -= 1;\n }\n var imagename = 'images/' + pix[index] + '.jpg'\n document.getElementById('slide_display').src=imagename;\n}", "title": "" }, { "docid": "9c131aaa10f1dfd6e855128a32f86fbe", "score": "0.74625814", "text": "function previousImage () {\n\t'use strict';\n\timageGalleryIndex--;//decrement the index tracker\n\tif (imageGalleryIndex < 0) {//check to make sure the index tracker has not gone past 0\n\t\timageGalleryIndex = imageFilePaths.length - 1;//reset the index tracker to the end of the array if it has gone past 0\n\t}\n\tchangeImage();//call the function to change the image\n}", "title": "" }, { "docid": "226345e5ea5341580c2b8d11fc636780", "score": "0.74510425", "text": "function previousImage() {\n\tif (isModalVisible()) {\n\t\timgIndex--;\n\t\tif (imgIndex < 0) {\n\t\t\timgIndex = userPhotosResp.data.length - 1;\n\t\t}\n\t\tshowImage(imgIndex);\n\t}\n}", "title": "" }, { "docid": "b744e1e856412a9f4392934c34437f34", "score": "0.7435814", "text": "function showPrevImage_3() {\n\t// change imageNum\n\timageNum_3 -= 1;\n\tcheckControls_3();\n\t// how many pixels from the left should imageRow now be?\n\tlet pixelsFromLeft_3 = -carouselWidth_3 * imageNum_3;\n\t// change css for imageRow\n\timageRow_3.style.left = pixelsFromLeft_3 + \"px\";\n}", "title": "" }, { "docid": "3c915237c23f0e93cd6150bfd290a2c3", "score": "0.7405883", "text": "function previousImage(){\n /* if statement to know if already at the first image, because if yes, imgNumber may not decrease. */\n if(imgNumber > 1){\n imgNumber--\n }\n\t\n /* If already at the first image, and click the previous button, the slideshow must show the last image. */\n else{\n imgNumber = numberOfImg\n }\n\t\n /* load the image into the document. write imgNumber-1, since an array always starts from 0! */\n document.slideImage.src = image[imgNumber-1]\n \n}", "title": "" }, { "docid": "77acc9efb9be0f4931792842b0b70884", "score": "0.73652273", "text": "function previous() {\r\n if (i === 0) {\r\n i = GALLERY.length - 1;\r\n } else {\r\n i--;\r\n }\r\n let currentImg = document.getElementById(\"image\");\r\n currentImg.src = GALLERY[i];\r\n currentImg.alt = GALLERY_ALT[i];\r\n }", "title": "" }, { "docid": "5011d71cb2e250430c14b54a9ffa2569", "score": "0.7354779", "text": "function prevPic() {\n // Decrement current picture.\n picNum--;\n if (picNum < 0) {\n picNum = picObjList.length - 1;\n }\n myImage.src = folderName + picObjList[picNum].src;\n caption.innerHTML = picObjList[picNum].caption;\n }", "title": "" }, { "docid": "3e6f2e1e18beeca799bae8b9cafc8386", "score": "0.7346783", "text": "function prevPic() {\n picNum--;\n if (picNum < 0) {\n picNum = objList.length - 1;\n }\n // change the src attribute of the image element to the desired new image)\t\t\t\t\n updatePic();\n }", "title": "" }, { "docid": "a885b3766892b163892cecd9c63e8ae8", "score": "0.732909", "text": "function previous_image(){\n \n for(i = 0; i < lenght; i++){\n \n //cycle the images:\n if (img[i] == currentImage){\n \n if(i -1 >= 0){\n currentImage = img[i-1];\n $(\"#img_panel\").attr(\"src\", img[i-1]);\n return false;\n }else{\n currentImage = img[lenght-1];\n $(\"#img_panel\").attr(\"src\", img[lenght-1]);\n return false;\n }\n \n }\n \n }\n}", "title": "" }, { "docid": "0b32fb87b2616aaeef7c6544b7b67b08", "score": "0.73233", "text": "function loadPreviousImage() {\n currentImageIndex -= 1;\n if (currentImageIndex < 0) {\n currentImageIndex = images.length - 1;\n }\n\n var previousImage = images[currentImageIndex];\n loadImage(previousImage);\n}", "title": "" }, { "docid": "2504a301187afe03692a57606d88b54d", "score": "0.730883", "text": "function previous(){\n updatePrevious();\n if(self.options.currentSlide == 1){\n if(self.options.currentFrame - 1 < 0) return;\n previousFrame();\n self.options.currentSlide = self.lastPerFrame[self.options.currentFrame] + 1;\n } \n self.options.currentSlide--;\n update();\n }", "title": "" }, { "docid": "7424f70899b776d750df60dbe307e77f", "score": "0.73062956", "text": "prev_img() {\n this.ele_corrente -= 1;\n if(this.ele_corrente < 0) {\n this.ele_corrente = this.immagini_slider.length -1;\n this.reset_play();\n }\n }", "title": "" }, { "docid": "1963633f2fafbacfb9740c774184c146", "score": "0.73019654", "text": "function prevImage(n) {\n currentPosition == 0 ? null : moveImage((currentPosition += n));\n}", "title": "" }, { "docid": "09d2c3446cca16e5d7f88a97925bb051", "score": "0.7282705", "text": "previousImage() {\n\t\tlet index = this.state.imageIndex;\n\n\t\t//We want to decrease the image index for the carousel, but if this paging action takes us under 0, we need to reset\n\t\tif (index - 1 < 0) {\n\t\t\tindex = this.props.app.images.length - 1;\n\t\t} else {\n\t\t\tindex--;\n\t\t}\n\n\t\tthis.setState({\n\t\t\timageIndex: index\n\t\t});\n\t}", "title": "" }, { "docid": "1125dbebf9eb959b5f0873852e3cb3cc", "score": "0.72797465", "text": "previous() {\n this._frame--;\n this._calculateNextTransform();\n }", "title": "" }, { "docid": "6533ae5e441bab5b09fc761dfda85dd1", "score": "0.72697186", "text": "function previousImage(carousel) {\r\n\tif (currentImg === \"undefined\") currentImg = 0;\r\n\tcurrentImg = Math.max(currentImg-1, 0);\r\n\tscrollImages( IMG_WIDTH * currentImg, speed, carousel);\r\n}", "title": "" }, { "docid": "31851b9a81c35871e6297c8f195bd28b", "score": "0.7264751", "text": "function previousImage(carousel) {\n\tif (currentImg === \"undefined\") currentImg = 0;\n\tcurrentImg = Math.max(currentImg-1, 0);\n\tscrollImages( IMG_WIDTH * currentImg, speed, carousel);\n}", "title": "" }, { "docid": "d15100a6e18668b93545b4e354bc6d2a", "score": "0.725648", "text": "function prevImage() {\n if ( --Id < 0) {\n Id = image.length-1;\n }\n console.log(Id);\n currentImageID();\n}", "title": "" }, { "docid": "2f050a00ef7391d96961faf71032cf58", "score": "0.7253096", "text": "function prevImage() {\n\tvar slides = document.getElementsByClassName(\"imageList\");\n\n\tfor (var i = 0; i < slides.length; i++) {\n\t\tslides[i].style.zIndex = '1';\n\t}\n\t\n\tif (currentImage > 0) {\n\t\t// --currentImage decrements the variable, returning the new value\n\t\t// Displays the previous picture in front of the others\n\t\tslides[--currentImage].style.zIndex = '2';\n\t}\n\telse {\n\t\tcurrentImage = slides.length-1;\n\t\tslides[currentImage].style.zIndex = '2';\n\t}\n}", "title": "" }, { "docid": "10dda096237f734224c42f2c7a37bb00", "score": "0.72314847", "text": "function prevOtterPic() {\r\n index = (otters + index - 1) % otters;\r\n setDetailsFromThumb(thumbnails[index]);\r\n}", "title": "" }, { "docid": "343cb05bf42cf0dc3a64b73721a86357", "score": "0.7227954", "text": "function displayPreviousImageBig() {\n\tx = (x <=0 ) ? imagesBig.length-1 : x-1;\n\timageBig.src = imagesBig[x];\n\tlinkBig.href = linksBig[x];\n}", "title": "" }, { "docid": "8a281373d64eee9322a2cd1cc239386b", "score": "0.72182316", "text": "function prevImg() {\n if (imageIndex === 0) {\n imageIndex = numberOfImages;\n }\n slider(--imageIndex);\n}", "title": "" }, { "docid": "d474f436edfa9fe5ab610a8a541171ce", "score": "0.7173815", "text": "function previous() {\n //decrements index to signal going backward in allPhotos[]\n var updatedIndex = parseInt(selectedPhoto.dataset.id) - 1;\n var updatedUrl = getLarger(updatedIndex);\n\n if (updatedIndex > -1) {\n selectedPhoto.setAttribute(\"src\", updatedUrl);\n selectedPhoto.setAttribute(\"data-id\", updatedIndex);\n photoTitle.textContent = getTitle(updatedIndex);\n }\n\n //continues to check user's button pressing\n backAndForth(selectedPhoto.dataset.id);\n}", "title": "" }, { "docid": "e2e9fadcf129ff0ab8efcf824d77bfe3", "score": "0.7137301", "text": "function navigatePrevious() {\n var previous = im.getCreator();\n\n if(previous) {\n im = previous;\n refreshIMDisplay();\n }\n}", "title": "" }, { "docid": "f5e2c3bb08d2f93318083eebfcebf963", "score": "0.7132337", "text": "function prev() {\n\t slide(false, false);\n\t }", "title": "" }, { "docid": "11cb44777693392967bf274075ae3dfd", "score": "0.71153", "text": "function prev() {\n if (index > 0) {\n index--;\n } else {\n index = thumbList.length-1;\n }\n\n var active = thumbList[index];\n var imgsrc = active.getAttribute('src');\n changePhoto(imgsrc);\n highlightThumb();\n }", "title": "" }, { "docid": "7dd5bb450c9ece3a9d4ff6eb5c8d6e44", "score": "0.70774865", "text": "function previousPicture(){\n if(index === 0){\n index = numOfPictures - 1;\n }else{\n index--;\n }\n let naturalDisasterPicture = naturalDisasterPictures[index];\n document.getElementById(\"natural-disaster-picture\").src = naturalDisasterPicture;\n}", "title": "" }, { "docid": "d2ed7984c232c1f191ba0dd32bb23f84", "score": "0.7074307", "text": "function previous(event) {\r\n if (imageLinksQty > 1 && selector !== \"hb-single\" && !nextPrevFlag) {\r\n nextPrevFlag = true;\r\n if (customOptions.animation === \"slide\") {\r\n // set css animation property to the currently displayed image to slide out from center to right\r\n imageObjects[curIndex].style.animation = \"slidePreviousOut 0.3s ease-out forwards\";\r\n // setTimeout for the animation to complete and then run the code inside\r\n window.setTimeout(function () {\r\n // set currently displayed and slided image opacity to 0\r\n imageObjects[curIndex].style.opacity = 0;\r\n // set the current image display to none\r\n imageObjects[curIndex].style.display = \"none\";\r\n resetZoom(imageObjects[curIndex].getElementsByTagName(\"img\")[0]);\r\n // to check if the number of image has reached the minimum length of imageLinks if yes then set to imageLinks maximum length\r\n if (curIndex === 0) {\r\n curIndex = (imageLinksQty);\r\n }\r\n // decrement the number of image to display the previous image\r\n curIndex -= 1;\r\n updateCounter(curIndex);\r\n preloadPrev(curIndex, customOptions.preload);\r\n // set the display to block so that previous image is visible\r\n imageObjects[curIndex].style.display = \"block\";\r\n // set css animation to the next image to slide in from left to center\r\n imageObjects[curIndex].style.animation = \"slidePreviousIn 0.3s ease-out forwards\";\r\n nextPrevFlag = false;\r\n }, 300);\r\n } else if (customOptions.animation === \"fade\") {\r\n // set opacity of the current image to 0\r\n imageObjects[curIndex].style.opacity = 0;\r\n // setTimeout for the animation to complete and then run the code inside\r\n window.setTimeout(function () {\r\n // set the current image display to none\r\n imageObjects[curIndex].style.display = \"none\";\r\n resetZoom(imageObjects[curIndex].getElementsByTagName(\"img\")[0]);\r\n // to check if the number of image has reached the minimum length of imageLinks if yes then set to imageLinks maximum length\r\n if (curIndex === 0) {\r\n curIndex = (imageLinksQty);\r\n }\r\n // decrement the number of image to display the previous image\r\n curIndex -= 1;\r\n updateCounter(curIndex);\r\n preloadPrev(curIndex, customOptions.preload);\r\n // set the display to block so that next image is visible\r\n imageObjects[curIndex].style.display = \"block\";\r\n window.setTimeout(function () {\r\n // set the opacity of the next image to 1\r\n imageObjects[curIndex].style.opacity = 1;\r\n }, 50);\r\n nextPrevFlag = false;\r\n }, 300);\r\n }\r\n }\r\n }", "title": "" }, { "docid": "519da3c9af2944286d235aaf21eabbbf", "score": "0.70709395", "text": "function handleanimationControlPanelBtnBack(){\n setCurImg(curImg - 1);\n}", "title": "" }, { "docid": "fab406f81d0f4ff4a5543c49cd089339", "score": "0.70654714", "text": "showPreviousKanji(e) {\n let evt = new Event(\"back-next\");\n // if moving back from last kanji in array, change styling of next button\n if (this.index === this.kanjiArray.length - 1) {\n evt.next = true;\n document.dispatchEvent(evt);\n }\n // if you are going back to first kanji in array, change styling of back btn\n if (this.index === 1) {\n evt.back = true;\n document.dispatchEvent(evt);\n }\n // if currently not viewing the first kanji in array, subtract index and go back one\n if (this.index > 0) {\n this.index--;\n \n this.getKanji(\"\");\n }\n }", "title": "" }, { "docid": "4f1705a2ae77d787c521470caf985211", "score": "0.70545423", "text": "function playPrevious () {\n \n if (slideDisplay == 0) {\n reset();\n slideDisplay = slidesLength - 1;\n addClassToElement(slides[slideDisplay], options.classNameForDisplay);\n addClassToElement(slides[slideDisplay].children[0], options.imageTrsansition);\n if(options.showThumbnails) {\n addClassToElement(sliderThumbnails.children[slideDisplay], options.classNameForThumbnail); \n }\n } else {\n reset();\n slideDisplay--;\n addClassToElement(slides[slideDisplay], options.classNameForDisplay);\n addClassToElement(slides[slideDisplay].children[0], options.imageTrsansition);\n if(options.showThumbnails) {\n addClassToElement(sliderThumbnails.children[slideDisplay], options.classNameForThumbnail); \n }\n } \n}", "title": "" }, { "docid": "971788439eaebbe23f74bd1f91e80b02", "score": "0.70545274", "text": "previous() {\n // If no internal steps, or already at the first one, go to previous slide\n const stepCount = this.steps.length;\n if (!stepCount || this.currentStepIndex === 0) {\n this.displaySlide(Math.max(this.currentSlideIndex - 1, 0), {\n showAllSteps: true,\n });\n return;\n }\n\n this.currentStep().classList.remove('js-step-visible');\n this.currentStepIndex -= 1;\n }", "title": "" }, { "docid": "7b2b2320c673e9800c090fdcd9d0a33c", "score": "0.70538706", "text": "function forwards() {\n // if array reaches 0 start at array end\n i--\n if(i < 0){\n i = evoLine.length - 1;\n }\n // each click shows new image, and updates i\n img.src = evoLine[i]\n}", "title": "" }, { "docid": "a75abdf2c67b277f67aa844fad30837f", "score": "0.70499945", "text": "function prev(){\n\tnewSlide = sliderInt -1;\n\tshowSlide(newSlide);\n}", "title": "" }, { "docid": "c4c7d543f47c794dc591b771d50c4994", "score": "0.70175177", "text": "function forwardButton() {\n if(ImageCounter === images.length-1){\n ImageCounter = 0;\n accessImage.src=images[ImageCounter]\n }\n else{\n ImageCounter++;\n accessImage.src=images[ImageCounter]\n \n }\n \n}", "title": "" }, { "docid": "db98c377e9f8581df0d198e7adacaf19", "score": "0.7014833", "text": "previous() {\n this.step--;\n\n if(this.currentElement)\n this.toggleResizeObserver(false);\n\n this.makeStep();\n }", "title": "" }, { "docid": "c06041658f81d01371c5ee9218e84c6e", "score": "0.70055467", "text": "function imageBack() {\n //image.setAttribute(\"src\", imageArray[imageIndex]);\n imageIndex--;\n if (imageIndex < 0) {\n imageIndex = (imageArray.length - 1);\n }\n image.setAttribute(\"src\", imageArray[imageIndex]);\n}", "title": "" }, { "docid": "920a910ef2d6e30638d97583e329bbe8", "score": "0.69964457", "text": "function change_previous_img()\n{\n if(i==2)\n {\n disable_previous_key();\n }\n var previousImage=\"images/slideshow/slide\" +(--i)+\".jpg\"\n document.getElementById(\"image\").setAttribute(\"src\",previousImage );\n \n}", "title": "" }, { "docid": "13e74649cf7f54301286101eff7f73d4", "score": "0.6991816", "text": "function displayNextImage() {\n $('#plant-3a').attr('src', 'assets/plant3a_before.png');\n }", "title": "" }, { "docid": "958e2b3935122708df0dc1a4faf7e7f9", "score": "0.6981189", "text": "function prev_image()\r\n\t{\r\n\t\tvar present_slide=\"#slide\"+list[current];\r\n\t\tvar next_slide=\"#slide\"+list[current-1];\r\n\t\tif (current===0) {\r\n\t\t\tcurrent = total_slide;\r\n\t\t\tnext_slide=\"#slide\"+list[current-1];\r\n\t\t\tfor(i=1;i<=total_slide;i++)\r\n\t\t\t{\r\n\t\t\t\t$(\"#slide\"+i).css(\"left\",\"-100%\");\r\n\t\t\t}\r\n\t\t\t$(\"#slide\"+current).css(\"left\",\"0%\");\r\n\t\t\tcurrent--;\r\n\r\n\t\t}\r\n\t\telse{\r\n\t\t\tcurrent--;\r\n\t\t\t$(present_slide).css(\"left\",\"-100%\");\r\n\t\t\t$(next_slide).css(\"left\",\"0%\");\r\n\t\t}\r\n\t}", "title": "" }, { "docid": "701481af323abfe3a671990cbb8064a2", "score": "0.69661146", "text": "function getPreviousImage(){\r\n // Get the current image\r\n var current = getSRC();\r\n // Defaults the next image to the first image in the library\r\n var nextIndex = 0;\r\n // Get the images library\r\n var images = getOverlays();\r\n for(var i = 0; i < images.length; i++){\r\n if(images[i]==current){\r\n // Calculate next index\r\n nextIndex = (images.length+i-1)%(images.length);\r\n }\r\n }\r\n return images[nextIndex];\r\n}", "title": "" }, { "docid": "6f0d668693c76727c8207f49cfdd79ff", "score": "0.6926629", "text": "function backImg() {\n if (0 < activeImg) {\n --activeImg\n mainImg.src = activeAllImg[activeImg].src\n return null\n }\n\n activeImg = activeAllImg.length - 1\n mainImg.src = activeAllImg[activeImg].src\n return null\n }", "title": "" }, { "docid": "c5448edec4f18350268191c8eed867bb", "score": "0.69249004", "text": "function prev() {\n\t\t slide(false, false);\n\t\t }", "title": "" }, { "docid": "a759c1efd97642150df607b45e68474a", "score": "0.69214016", "text": "back() {\n\t const index = this.steps.indexOf(this.currentStep);\n\t this.show(index - 1, false);\n\t }", "title": "" }, { "docid": "b946578a7a7e0d108163db4151a360c2", "score": "0.6866874", "text": "function previous () {\n\n\t\thideCentered();\n\t\tshutUp();\n\t\tif (engine.Step >= 1) {\n\t\t\tengine.Step -= 1;\n\t\t\tconst back = [\"show\", \"play\", \"display\", \"hide\", \"stop\", \"wait\", \"scene\", \"clear\", \"vibrate\", \"notify\", \"next\"];\n\t\t\tlet flag = true;\n\t\t\ttry {\n\t\t\t\twhile (engine.Step > 0 && flag) {\n\t\t\t\t\tif (typeof label[engine.Step] == \"string\") {\n\t\t\t\t\t\tif (back.indexOf(label[engine.Step].split(\" \")[0]) > -1) {\n\t\t\t\t\t\t\tconst parts = replaceVariables(label[engine.Step]).split(\" \");\n\t\t\t\t\t\t\tswitch (parts[0]) {\n\t\t\t\t\t\t\t\tcase \"show\":\n\t\t\t\t\t\t\t\t\tif (typeof characters[parts[1]] != \"undefined\") {\n\t\t\t\t\t\t\t\t\t\t$_(\"[data-character='\" + parts[1] + \"']\").remove();\n\t\t\t\t\t\t\t\t\t\tif (engine.CharacterHistory.length > 1) {\n\t\t\t\t\t\t\t\t\t\t\tengine.CharacterHistory.pop();\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tconst last_character = engine.CharacterHistory.slice(-1)[0];\n\t\t\t\t\t\t\t\t\t\tif (typeof last_character != \"undefined\") {\n\t\t\t\t\t\t\t\t\t\t\tif (last_character.indexOf(\"data-character='\" + parts[1] + \"'\") > -1) {\n\t\t\t\t\t\t\t\t\t\t\t\t$_(\"#game\").append(last_character);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tif (typeof parts[3] != \"undefined\" && parts[3] != \"\") {\n\t\t\t\t\t\t\t\t\t\t\t$_(\"[data-image='\" + parts[1] + \"']\").addClass(parts[3]);\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t$_(\"[data-image='\" + parts[1] + \"']\").remove();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tengine.ImageHistory.pop();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\t\tcase \"play\":\n\t\t\t\t\t\t\t\t\tif (parts[1] == \"music\") {\n\t\t\t\t\t\t\t\t\t\tmusicPlayer.removeAttribute(\"loop\");\n\t\t\t\t\t\t\t\t\t\tmusicPlayer.setAttribute(\"src\", \"\");\n\t\t\t\t\t\t\t\t\t\tengine.Song = \"\";\n\t\t\t\t\t\t\t\t\t\tmusicPlayer.pause();\n\t\t\t\t\t\t\t\t\t\tmusicPlayer.currentTime = 0;\n\t\t\t\t\t\t\t\t\t} else if (parts[1] == \"sound\") {\n\t\t\t\t\t\t\t\t\t\tsoundPlayer.removeAttribute(\"loop\");\n\t\t\t\t\t\t\t\t\t\tsoundPlayer.setAttribute(\"src\", \"\");\n\t\t\t\t\t\t\t\t\t\tengine.Sound = \"\";\n\t\t\t\t\t\t\t\t\t\tsoundPlayer.pause();\n\t\t\t\t\t\t\t\t\t\tsoundPlayer.currentTime = 0;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\t\tcase \"stop\":\n\t\t\t\t\t\t\t\t\tif (parts[1] == \"music\") {\n\t\t\t\t\t\t\t\t\t\tconst last_song = engine.MusicHistory.pop().split(\" \");\n\n\t\t\t\t\t\t\t\t\t\tif (last_song[3] == \"loop\") {\n\t\t\t\t\t\t\t\t\t\t\tmusicPlayer.setAttribute(\"loop\", \"\");\n\t\t\t\t\t\t\t\t\t\t} else if (last_song[3] == \"noloop\") {\n\t\t\t\t\t\t\t\t\t\t\tmusicPlayer.removeAttribute(\"loop\");\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif (typeof music !== \"undefined\") {\n\t\t\t\t\t\t\t\t\t\t\tif (typeof music[last_song[2]] != \"undefined\") {\n\t\t\t\t\t\t\t\t\t\t\t\tmusicPlayer.setAttribute(\"src\", \"audio/music/\" + music[last_song[2]]);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tmusicPlayer.setAttribute(\"src\", \"audio/music/\" + last_song[2]);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tmusicPlayer.setAttribute(\"src\", \"audio/music/\" + last_song[2]);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tmusicPlayer.play();\n\t\t\t\t\t\t\t\t\t\tengine.Song = last_song.join(\" \");\n\t\t\t\t\t\t\t\t\t} else if (parts[1] == \"sound\") {\n\t\t\t\t\t\t\t\t\t\tconst last = engine.SoundHistory.pop().split(\" \");\n\n\t\t\t\t\t\t\t\t\t\tif (last[3] == \"loop\") {\n\t\t\t\t\t\t\t\t\t\t\tsoundPlayer.setAttribute(\"loop\", \"\");\n\t\t\t\t\t\t\t\t\t\t} else if (last[3] == \"noloop\") {\n\t\t\t\t\t\t\t\t\t\t\tsoundPlayer.removeAttribute(\"loop\");\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tif (typeof sound !== \"undefined\") {\n\t\t\t\t\t\t\t\t\t\t\tif (typeof sound[last[2]] != \"undefined\") {\n\t\t\t\t\t\t\t\t\t\t\t\tsoundPlayer.setAttribute(\"src\", \"audio/sound/\" + sound[last[2]]);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tsoundPlayer.setAttribute(\"src\", \"audio/sound/\" + last[2]);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tsoundPlayer.setAttribute(\"src\", \"audio/sound/\" + last[2]);\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tsoundPlayer.play();\n\t\t\t\t\t\t\t\t\t\tengine.Sound = last.join(\" \");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\t\tcase \"scene\":\n\t\t\t\t\t\t\t\t\tengine.SceneHistory.pop();\n\t\t\t\t\t\t\t\t\tengine.Scene = engine.SceneHistory.slice(-1)[0];\n\n\t\t\t\t\t\t\t\t\tif (typeof engine.Scene != \"undefined\") {\n\t\t\t\t\t\t\t\t\t\t$_(\"[data-character]\").remove();\n\t\t\t\t\t\t\t\t\t\t$_(\"[data-image]\").remove();\n\t\t\t\t\t\t\t\t\t\t$_(\"[data-ui='background']\").removeClass ();\n\n\t\t\t\t\t\t\t\t\t\tif (typeof scenes[engine.Scene] !== \"undefined\") {\n\t\t\t\t\t\t\t\t\t\t\t$_(\"[data-ui='background']\").style(\"background\", \"url(img/scenes/\" + scenes[engine.Scene] + \") center / cover no-repeat\");\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t$_(\"[data-ui='background']\").style(\"background\", engine.Scene);\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tif (typeof engine.SceneElementsHistory !== \"undefined\") {\n\t\t\t\t\t\t\t\t\t\t\tif (engine.SceneElementsHistory.length > 0) {\n\t\t\t\t\t\t\t\t\t\t\t\tvar scene_elements = engine.SceneElementsHistory.pop ();\n\n\t\t\t\t\t\t\t\t\t\t\t\tif (typeof scene_elements === \"object\") {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor (const element of scene_elements) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$_(\"#game\").append (element);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tengine.SceneElementsHistory = [];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\twhipeText();\n\t\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\t\tcase \"display\":\n\t\t\t\t\t\t\t\t\tif (parts[1] == \"message\") {\n\t\t\t\t\t\t\t\t\t\t$_(\"[data-ui='message-content']\").html(\"\");\n\t\t\t\t\t\t\t\t\t\t$_(\"[data-ui='messages']\").removeClass(\"active\");\n\t\t\t\t\t\t\t\t\t} else if (parts[1] == \"image\") {\n\t\t\t\t\t\t\t\t\t\t$_(\"[data-image='\" + parts[2] + \"']\").remove();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"hide\":\n\t\t\t\t\t\t\t\t\tif (typeof characters[parts[1]] != \"undefined\" && engine.CharacterHistory.length > 0) {\n\t\t\t\t\t\t\t\t\t\t$_(\"#game\").append(engine.CharacterHistory.pop());\n\n\t\t\t\t\t\t\t\t\t} else if (typeof images[parts[1]] != \"undefined\" && engine.ImageHistory > 0) {\n\t\t\t\t\t\t\t\t\t\t$_(\"#game\").append(engine.ImageHistory.pop());\n\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tflag = false;\n\t\t\t\t\t\t\t\t\t\tengine.Step += 1;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tflag = false;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif ((engine.Step - 1) >= 0) {\n\t\t\t\t\t\t\t\tengine.Step -= 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tflag = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (typeof label[engine.Step] == \"object\") {\n\t\t\t\t\t\tif (typeof label[engine.Step].Function !== \"undefined\") {\n\t\t\t\t\t\t\tassertAsync(label[engine.Step].Function.Reverse).then(function () {\n\t\t\t\t\t\t\t\tblock = false;\n\t\t\t\t\t\t\t}).catch(function () {\n\t\t\t\t\t\t\t\tblock = false;\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ((engine.Step - 1) >= 0) {\n\t\t\t\t\t\t\tengine.Step -= 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tflag = false;\n\t\t\t\t\t\tengine.Step += 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tanalyseStatement (label[engine.Step]);\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(\"An error ocurred while trying to exectute the previous statement.\\n\" + e);\n\t\t\t}\n\t\t}\n\t}", "title": "" }, { "docid": "da7fd037fedd0b06cff7f15d9a54a166", "score": "0.68545246", "text": "function prev(prev){\n var posicion = parseInt(prev.id) - 1;\n if(posicion == -1){\n posicion = gallery.totalImagesload - 1;\n }\n var card = document.getElementById(posicion);\n paintOverlay(card,false);\n}", "title": "" }, { "docid": "90aa99ba2c6d5a688ec6b36a61cda937", "score": "0.6807569", "text": "prevImage() {\n this.setState({\n currentImage: this.state.currentImage - 1,\n })\n }", "title": "" }, { "docid": "1dbc3dea9628a267c936efff87bdd480", "score": "0.6806341", "text": "function bringBackTheInitialImageAgainInsteadOfUrl() {\n\n}", "title": "" }, { "docid": "711a8458d294c79523cf184cc4236bdf", "score": "0.6804363", "text": "function displayNextImage() {\n $('#plant-8a').attr('src', 'assets/plant8a_before.png');\n }", "title": "" }, { "docid": "4067719c1214e6c7ee42333719b50f1e", "score": "0.67961454", "text": "function prevSlide() {\n position = $slider.find(\".show\").index() - 1;\n if (position < 0) position = size - 1;\n changeCarousel(position);\n }", "title": "" }, { "docid": "4067719c1214e6c7ee42333719b50f1e", "score": "0.67961454", "text": "function prevSlide() {\n position = $slider.find(\".show\").index() - 1;\n if (position < 0) position = size - 1;\n changeCarousel(position);\n }", "title": "" }, { "docid": "4067719c1214e6c7ee42333719b50f1e", "score": "0.67961454", "text": "function prevSlide() {\n position = $slider.find(\".show\").index() - 1;\n if (position < 0) position = size - 1;\n changeCarousel(position);\n }", "title": "" }, { "docid": "187d5ca9b1175542c63ea649ea360454", "score": "0.6788961", "text": "prev () {\n this.goTo(this.getCurrentIndex() - 1);\n }", "title": "" }, { "docid": "5c0617242d54bccd036242503888ddba", "score": "0.67697734", "text": "function previousSlide() {\n if(current === 0) \n return;\n\n slides[current].fadeOut(fadeDuration);\n current = (current - 1) % slides.length;\n slides[current].fadeIn(fadeDuration);\n }", "title": "" }, { "docid": "59d34b3736bbb56186cffb4f8ee3e922", "score": "0.67659414", "text": "function prevItem() {\n hideItems();\n currentIndex = currentIndex > 0 ? currentIndex - 1 : slidesLength - 1;\n updateIndexes();\n showItems();\n }", "title": "" }, { "docid": "20f9ae54b662201c38f52e855079a58d", "score": "0.6728166", "text": "function back () {\n showStep( stepIndex - 1 )\n }", "title": "" }, { "docid": "ecb15766bddd658bf3c7575611b8b679", "score": "0.67273796", "text": "function _previousStep() {\n if (this._currentStep === 0) {\n return false;\n }\n this._lastStep = this._currentStep;\n var nextStep = this._introItems[--this._currentStep];\n if ( typeof (this._introBeforeChangeCallback) !== 'undefined') {\n this._introBeforeChangeCallback.call(this, nextStep.element);\n }\n \n window.targetElement = nextStep;\n _showElement.call(this, nextStep);\n }", "title": "" }, { "docid": "eaabdf6aff9e12021601667845e0f547", "score": "0.6712354", "text": "function displayNextImage() {\n $('#plant-5a').attr('src', 'assets/plant5a_before.png');\n }", "title": "" }, { "docid": "6aa234fe0939752df8afe7114fe9be68", "score": "0.67113966", "text": "prev() {\n impress().prev();\n }", "title": "" }, { "docid": "b4ef0da4bdff0d682c6354b16ac06b5b", "score": "0.6701832", "text": "function prevSlide () {\n\t\n\tCurrentSlide--;\n // if slide number(CurrentSlide ) less than zero then CurrentSlide is equal to length of slides\n\tif (CurrentSlide < 0) {\n\t\tCurrentSlide = slides.length - 1;\n\t}\n\tdisplay(CurrentSlide);\n \n}", "title": "" }, { "docid": "5a1f1e5fb40c70b844c11b0b502f3250", "score": "0.66937864", "text": "backPicture(){\n if(this.count > 0){\n this.count--\n } else {\n this.count = 4\n }\n }", "title": "" }, { "docid": "ea10d1ea4835af5720cff9d70d2dc241", "score": "0.66914415", "text": "function galleryPrev() {\n if (current>1) {\n current -= 1;\n slider.css(\"background-image\", \"url(images/pictures/picture\" + current + \".png)\")\n }\n}", "title": "" }, { "docid": "82f8ba6ab01801a8b03a751dbddd39a9", "score": "0.6681397", "text": "function prevImg(){\n\n // salvare il riferimento dell'img attiva al click\n var imgActive = $('.images img.active');\n // salvare il riferimento del pallino attivo al click\n var ballActive = $('.nav i.active');\n // salvo le animations\n var animationNext = $('.images img.animationNext');\n var animationPrev = $('.images img.animationPrev');\n\n // togliere la classe active all'img\n imgActive.removeClass('active');\n // togliere la classe active al pallino\n ballActive.removeClass('active');\n // tolgo l'animations\n animationNext.removeClass('animationNext');\n animationPrev.removeClass('animationPrev');\n\n // se è l'ultimo aggiungi la classe active al first\n if ((imgActive.hasClass('first')) && (ballActive.hasClass('first'))) {\n $(\".images img.last\").addClass('active animationPrev');\n $(\".nav i.last\").addClass('active');\n\n //altrimenti aggiungere la classe active al next\n }else {\n imgActive.prev().addClass('active animationPrev');\n ballActive.prev().addClass('active');\n }\n\n }", "title": "" }, { "docid": "b74c3b7994c5ff95b8eac5834b0a155f", "score": "0.66763586", "text": "prev() {\n if (this.options.waitForAnimationEnd === true && this.slideAnimation.hasEnded() === false) {\n return;\n }\n this.slider.prev();\n }", "title": "" }, { "docid": "5221c0762d8c88c0beb237d0bd6173f2", "score": "0.6674843", "text": "function displayNextImage() {\n $('#bush4a').attr('src', 'assets/bush4a_before.png');\n }", "title": "" }, { "docid": "4324d7f8335773db945fc54165971fa7", "score": "0.66603845", "text": "prev () {\n var prev = this.steps.indexOf( this.activeStep ) - 1;\n prev = prev >= 0 ? this.steps[ prev ] : this.getStep(-1);\n\n return this.moveTo(prev);\n }", "title": "" }, { "docid": "1d85642d10d398e3f35949c348154943", "score": "0.6659977", "text": "function _previousStep() {\n this._direction = 'backward';\n\n if (this._currentStep === 0) {\n return false;\n }\n\n var nextStep = this._introItems[--this._currentStep];\n if (typeof this._introBeforeChangeCallback !== 'undefined') {\n this._introBeforeChangeCallback.call(this, nextStep.element);\n }\n\n _showElement.call(this, nextStep);\n }", "title": "" }, { "docid": "3e595547de0dac7a5b0d1da9446de772", "score": "0.6659926", "text": "function clickPrev(event) {\n event.stopPropagation();\n currentImg = currentImg.prev();\n showOverImg();\n}", "title": "" }, { "docid": "7bb2b588e3a904b000fc5ee778a6df20", "score": "0.6658541", "text": "function _previousStep() {\n this._direction = 'backward';\n\n if (this._currentStep === 0) {\n return false;\n }\n\n var nextStep = this._introItems[--this._currentStep];\n if (typeof (this._introBeforeChangeCallback) !== 'undefined') {\n this._introBeforeChangeCallback.call(this, nextStep.element);\n }\n\n _showElement.call(this, nextStep);\n }", "title": "" }, { "docid": "7bb2b588e3a904b000fc5ee778a6df20", "score": "0.6658541", "text": "function _previousStep() {\n this._direction = 'backward';\n\n if (this._currentStep === 0) {\n return false;\n }\n\n var nextStep = this._introItems[--this._currentStep];\n if (typeof (this._introBeforeChangeCallback) !== 'undefined') {\n this._introBeforeChangeCallback.call(this, nextStep.element);\n }\n\n _showElement.call(this, nextStep);\n }", "title": "" }, { "docid": "7bb2b588e3a904b000fc5ee778a6df20", "score": "0.6658541", "text": "function _previousStep() {\n this._direction = 'backward';\n\n if (this._currentStep === 0) {\n return false;\n }\n\n var nextStep = this._introItems[--this._currentStep];\n if (typeof (this._introBeforeChangeCallback) !== 'undefined') {\n this._introBeforeChangeCallback.call(this, nextStep.element);\n }\n\n _showElement.call(this, nextStep);\n }", "title": "" }, { "docid": "7bb2b588e3a904b000fc5ee778a6df20", "score": "0.6658541", "text": "function _previousStep() {\n this._direction = 'backward';\n\n if (this._currentStep === 0) {\n return false;\n }\n\n var nextStep = this._introItems[--this._currentStep];\n if (typeof (this._introBeforeChangeCallback) !== 'undefined') {\n this._introBeforeChangeCallback.call(this, nextStep.element);\n }\n\n _showElement.call(this, nextStep);\n }", "title": "" }, { "docid": "7bb2b588e3a904b000fc5ee778a6df20", "score": "0.6658541", "text": "function _previousStep() {\n this._direction = 'backward';\n\n if (this._currentStep === 0) {\n return false;\n }\n\n var nextStep = this._introItems[--this._currentStep];\n if (typeof (this._introBeforeChangeCallback) !== 'undefined') {\n this._introBeforeChangeCallback.call(this, nextStep.element);\n }\n\n _showElement.call(this, nextStep);\n }", "title": "" }, { "docid": "280533c8b3c5691076ca2e905c12bedd", "score": "0.6656743", "text": "function _previousStep() {\n\t this._direction = 'backward';\n\t\n\t if (this._currentStep === 0) {\n\t return false;\n\t }\n\t\n\t var nextStep = this._introItems[--this._currentStep];\n\t if (typeof (this._introBeforeChangeCallback) !== 'undefined') {\n\t this._introBeforeChangeCallback.call(this, nextStep.element);\n\t }\n\t\n\t _showElement.call(this, nextStep);\n\t }", "title": "" }, { "docid": "db5c086d6f8d71fa1c9223f47031074e", "score": "0.6650889", "text": "@action\n prev() {\n this.currentIndex--;\n\n if (this.currentIndex < 0) {\n this.currentIndex = this.loop ? this.itemsCount - 1 : 0;\n }\n\n this._resetPositionIndexes(false);\n this._transform(false);\n }", "title": "" }, { "docid": "932bbb453ac099de703303aeaf947e56", "score": "0.66405755", "text": "function _previousStep() {\n this._direction = 'backward';\n\n if (this._currentStep === 0) {\n return false;\n }\n\n --this._currentStep;\n\n if (typeof (this._introBeforeChangeCallback) !== 'undefined') {\n var continueStep = this._introBeforeChangeCallback.call(this);\n }\n\n // if `onbeforechange` returned `false`, stop displaying the element\n if (continueStep === false) {\n ++this._currentStep;\n return false;\n }\n\n var nextStep = this._introItems[this._currentStep];\n _showElement.call(this, nextStep);\n }", "title": "" }, { "docid": "932bbb453ac099de703303aeaf947e56", "score": "0.66405755", "text": "function _previousStep() {\n this._direction = 'backward';\n\n if (this._currentStep === 0) {\n return false;\n }\n\n --this._currentStep;\n\n if (typeof (this._introBeforeChangeCallback) !== 'undefined') {\n var continueStep = this._introBeforeChangeCallback.call(this);\n }\n\n // if `onbeforechange` returned `false`, stop displaying the element\n if (continueStep === false) {\n ++this._currentStep;\n return false;\n }\n\n var nextStep = this._introItems[this._currentStep];\n _showElement.call(this, nextStep);\n }", "title": "" }, { "docid": "2d9f549b830c3e3482f100d9b96af59b", "score": "0.66361153", "text": "function previousSong() {\n songIndex--;\n if (songIndex < 0) {\n songIndex = 6;\n };\n song.src = songs[songIndex];\n thumbnail.src = thumbnails[songIndex];\n p_background.src = thumbnails[songIndex];\n\n songArtist.innerHTML = songArtists[songIndex];\n songTitle.innerHTML = songTitles[songIndex];\n\n playing = true;\n playPause();\n}", "title": "" }, { "docid": "eae6ffeee5f9c3e9ea49f683e2b3bb34", "score": "0.66296816", "text": "function displayNextImage() {\n $('#bush6a').attr('src', 'assets/bush6_a_before.png');\n }", "title": "" }, { "docid": "7a2093ce83b93f189fa09563f53c37ae", "score": "0.6624973", "text": "function showFarmInfoPagePrevious() {\n\tcallMethodForPageChangeAndProgressBarImage(3, 0);\n}", "title": "" }, { "docid": "70f53c5f23c7e057bcab1fcf1ef1bdd2", "score": "0.6606312", "text": "showNext()\n\t{\n\n\t\tthis._currentImagePointer ++;\n\n\t\tif ( this._currentImagePointer > this._loadedImages.length -1 )\n\t\t\tthis._currentImagePointer = 0;\n\n\t\tthis.showImage( this._currentImagePointer )\n\n\t}", "title": "" }, { "docid": "6580808bb3789c4c29dd8506ee48fe94", "score": "0.65816647", "text": "function prevStep(){\n setStep(step-1);\n }", "title": "" }, { "docid": "1fab50c56faee74060baf63b1cc8706a", "score": "0.65732366", "text": "function showPrevious()\n{\n var form = this.form;\n var regDomain = form.RegDomain.value;\n var regYear = form.RegYear.value;\n var regNum = Number(form.RegNum.value) - 1;\n var prevUrl = \"BirthRegDetail.php?RegDomain=\" + regDomain +\n \"&RegYear=\" + regYear +\n \"&RegNum=\" + regNum;\n if (typeof(args.showimage) == 'string' &&\n args.showimage.toLowerCase() == 'yes')\n prevUrl += \"&ShowImage=Yes\";\n location = prevUrl;\n return false;\n}", "title": "" } ]
ddad717e47d39a5375c5ca694a6de82f
Load the Invoices list
[ { "docid": "83828fc5fa02ed29e7e3f5e97fa4e5b5", "score": "0.79259676", "text": "function getInvoiceList() {\n var criteria = {\n dVendno: base.criteria.vendorNumber,\n dPostdt: base.criteria.postDate\n };\n\n DataService.post('api/ap/asapentry/apemagetinvoices', { data: criteria, busy: true }, function (data) {\n if (data) {\n base.datasetInvoices = data;\n self.applyInvoices = angular.copy(base.datasetInvoices);\n }\n });\n }", "title": "" } ]
[ { "docid": "911e504a434ac4103d3eeb3cb75bb007", "score": "0.7987174", "text": "function getinvoices() {\n InvoiceService.get().then(invoices => {\n $scope.invoices = invoices;\n });\n\n }", "title": "" }, { "docid": "290d635c613ff0679df7b27d3ffe3d5f", "score": "0.7281946", "text": "async getList() {\n this.LOG.info({\n step: 'InvoiceService getList()',\n message: 'Get invoice list called',\n });\n try {\n const data = await this.DB.dbFind(Constants.COLLECTION_NAME_INVOICES, {});\n if (data) {\n return data.map((invoiceItem) => {\n return {\n invoiceId: invoiceItem.invoiceId,\n createdDate: moment(invoiceItem.createdDate).format('MMMM Do YYYY, h:mm:ss a'),\n grandTotal: invoiceItem.grandTotal,\n };\n });\n }\n this.LOG.warn({\n step: 'InvoiceService getList()',\n message: 'Empty invoices object returned',\n });\n return null;\n } catch (error) {\n this.LOG.error({\n step: 'InvoiceService getList()',\n message: 'Error while retrieving or formatting the invoice list',\n error: error.message,\n });\n return null;\n }\n }", "title": "" }, { "docid": "2d3dbad1be26e216f1e0d2c43599fb7c", "score": "0.7139939", "text": "async function getInvoices() {\n const invoices = await lndService.getInvoices();\n\n const reversedInvoices = [];\n for (const invoice of invoices.invoices) {\n reversedInvoices.unshift(invoice);\n }\n\n return reversedInvoices;\n}", "title": "" }, { "docid": "2964d89f0b234e3c7b328ba75657e486", "score": "0.6819764", "text": "async function getInvoices(req, res) {\n try {\n const stripeInvoices = await Stripe.getInvoices(\n req.user.organization.stripeCustomerId\n );\n const invoices = [];\n\n // Return a subset of fields from Stripe's API response\n for (let invoice of stripeInvoices.data) {\n const items = [];\n\n for (let item of invoice.lines.data) {\n items.push({\n description: item.description\n });\n }\n\n invoices.push({\n number: invoice.number,\n date: invoice.date,\n items: items,\n total: invoice.total\n });\n }\n\n return SendResponse(res, 200, invoices);\n } catch (err) {\n return SendResponse(res, 500, err);\n }\n}", "title": "" }, { "docid": "a801d02c14a822489cce17a12dee36d0", "score": "0.6782983", "text": "function loadListInvoice(result){\n\tresult.forEach(loadInvoice);\n\t$('#all-invoice').html(numOfAll);\n\t$('#thisM').html(numOfThisM);\n\t$('#thisD').html(numOfToday);\n}", "title": "" }, { "docid": "99c6143bd0d599faadd208f7e76f9203", "score": "0.60327744", "text": "function loadINVDRaft(){\n var Invoice = { \"permissionType\" : \"add\", \"appName\":\"Invoices\"};\n var jsonString = JSON.stringify(Invoice);\n\n var client = $serviceCall.setClient(\"getInvoiceDraftByKey\",\"invoice\");\n client.ifSuccess(function(data){\n var data = data;\n\n loadSettings();\n loaDCus(data.profileID);\n \n vm.TDinv = data;\n vm.ship = vm.TDinv.shipping / vm.TDinv.exchangeRate;\n\n if(vm.TDinv.invoiceLines){\n for (var i = vm.TDinv.invoiceLines.length - 1; i >= 0; i--) {\n InvoiceService.setArray(vm.TDinv.invoiceLines[i])\n }\n }\n InvoiceService.removeTaxArray(0)\n for (var i = vm.TDinv.taxAmounts.length - 1; i >= 0; i--) {\n InvoiceService.setTaxArr(vm.TDinv.taxAmounts[i])\n }\n vm.taxArray = InvoiceService.getTaxArr();\n fillview();\n });\n client.ifError(function(data){\n console.log(\"error loading setting data\")\n })\n client.uniqueID($state.params.itemId); //details.invoiceNo send projectID as url parameters\n client.postReq();\n }", "title": "" }, { "docid": "521589612375935fe9237223bd147172", "score": "0.5921186", "text": "function _loadList() {\n ItemService.all().then(\n function (response) {\n vm.items = response.data;\n },\n function(err) {\n console.log('Error', err);\n });\n }", "title": "" }, { "docid": "04b0ed1280ac0f0fa2cd35a78dc2b9bd", "score": "0.5811891", "text": "function loadOffices(){\n console.log('Fetching all offices');\n var deferred = $q.defer();\n $http.get(urls.OFFICE_NOAUTH_SERVICE_API)\n .then(\n function (response){\n console.log('Fetched successfully all offices');\n\n $localStorage.offices = response.data.value;\n deferred.resolve(response);\n },\n function (errResponse){\n console.error('Error while Fetching offices');\n console.error(errResponse);\n deferred.reject(errResponse);\n }\n );\n return deferred.promise;\n }", "title": "" }, { "docid": "c5ece6d8d1ed0676db6bf81b70354e8a", "score": "0.574149", "text": "constructor() { \n \n Invoice.initialize(this);\n }", "title": "" }, { "docid": "2ce6c9550793776e5294c4a9af63fed7", "score": "0.57322925", "text": "function listItemsCredit() {\n var items = $(\"#items\").val();\n var company_id = $(\"#invoice_company_id\").val();\n \n $.get('/invoices/list_items/' + company_id, {\n items: items\n },\n function(data) {\n $(\"#list_items\").html(data);\n documentReady();\n });\n }", "title": "" }, { "docid": "7d6c1dd8beaa0815c4e61bca4ca4643d", "score": "0.57317513", "text": "getInvoicesExecutive(idusuario) {\n return fetch(API_URL + `invoice-executive/${idusuario}`, config);\n }", "title": "" }, { "docid": "85b1a26625645e9dd2d4571c352cbb1a", "score": "0.57018834", "text": "function approveAllInvoices() {\n startLoad();\n domo.post(`/domo/datastores/v1/collections/ap-app-data/documents/query`,{\n \"content.approved\": {\n $ne: 'true'\n }\n })\n .then(data => {\n const reqBody = [];\n data.forEach(inv => {\n // Create empty object\n const obj = {};\n // Set approval variables\n inv.content.approved = 'true';\n inv.content.approval_timestamp = new Date().toISOString();\n\n // Setup object to be pushed into bulk update request\n obj.id = inv.id;\n obj.content = inv.content;\n reqBody.push(obj);\n });\n domo.put(`/domo/datastores/v1/collections/ap-app-data/documents/bulk`, reqBody)\n .then(data => {\n endLoad();\n document.querySelector('.selected').click();\n const mTxt = `<span class=\"secondary-text\">${data.Updated}</span> invoices have been successfully approved!`\n const bTxt = 'Okay'\n const bId = 'close'\n showModal(mTxt, bTxt, bId);\n })\n .catch(err => console.log(err));\n })\n .catch(err => console.log(err));\n}", "title": "" }, { "docid": "f3e33fbc7a48d4b8131b4e95b55f02f8", "score": "0.56248945", "text": "function voicesLoaded()\n{\n\tvoix.listVoices();\n}", "title": "" }, { "docid": "650c9e745eec6147037449c524214305", "score": "0.56211835", "text": "function createInvoice(data){\n invoiceCount.innerHTML = `There are ${data.length} total invoices`\n noInvoices.style.display = \"none\";\n for(i=0;i < data.length; i++){\n const invoice = document.createElement(\"div\");\n invoice.classList.add('each-invoice');\n invoice.innerHTML = `<div class=\"item-invoice\">#${data[i].id}</div>\n <div class=\"item-invoice\">Due ${data[i].paymentDue}</div>\n <div class=\"item-invoice\">${data[i].clientName}</div>\n <div class=\"item-invoice due\">£ ${data[i].total}</div>\n <div class=\"item-invoice payment ${data[i].status}\"><span></span> ${data[i].status}</div>\n <div onClick=\"hello\" class=\"item-invoice icon\"><a href=\"./invoice.html?${data[i].id}\"><img src=\"./assets/icon-arrow-right.svg\" alt=\"Right arrow\"></a></div>`;\n invoices.append(invoice);\n }\n}", "title": "" }, { "docid": "8b024daf79c1b5af8ba287f89b4148b0", "score": "0.56205994", "text": "function populateInvoiceTable() {\n\n // Empty content string\n var table = $('#invoiceTable table tbody');\n\n // Clear table each redraw\n table.html('')\n\n // jQuery AJAX call for JSON\n $.getJSON( '/invoices/list', function( invoiceData ) {\n\n // For each item in our JSON, add a table row and cells to the content string\n $.each(invoiceData, function(){\n\n //Create table row\n var tableRow = $('<tr/>').appendTo(table);\n \n // Create the withdraw button/link for each row\n var detailsButton = $('<span/>')\n .attr('id','cancel_'+this._id+'')\n .addClass('button-green')\n .html('Details')\n .data(this); \n\n // Create the withdraw button/link for each row\n var printButton = $('<span/>')\n .attr('id','cancel_'+this._id+'')\n .addClass('button-green')\n .html('Print')\n .data(this); \n // Append the rest of the blank <td> values to fill in our table row\n $('<td/>').appendTo(tableRow).html(this._id);\n $('<td/>').appendTo(tableRow).html(this.customer);\n $('<td/>').appendTo(tableRow).html(this.priority);\n $('<td/>').appendTo(tableRow).html(this.amount);\n $('<td/>').appendTo(tableRow).html(this.confirmed);\n $('<td/>').appendTo(tableRow).html(detailsButton);\n $('<td/>').appendTo(tableRow).html(printButton);\n\n });\n });\n }", "title": "" }, { "docid": "ae2ac3f37a8b5802ff9fd6e7194ad8aa", "score": "0.5604805", "text": "function load() {\n organizationList.loading = true;\n $log.debug(\"OrganizationList is loading\");\n organizationList.list = Organization.query();\n organizationList.list.$promise.catch(\n handleOrganizationListLoadError\n ).finally(\n function () {\n organizationList.loading = false;\n $log.debug(\"OrganizationList has finished loading\");\n }\n );\n }", "title": "" }, { "docid": "eda074c35b164c68d8b67a38da0ba16a", "score": "0.55574256", "text": "function load() {\r\n loadList();\r\n setPageNumber();\r\n}", "title": "" }, { "docid": "a06de77c659255610d502d743f3921fb", "score": "0.55455154", "text": "function _setup_row_for_invoice_section(db) {\n\t\t\ttry {\n\t\t\t\tvar rows = db.execute('SELECT * FROM my_' + _type + '_invoice WHERE ' + _type + '_id=? and status_code=1', _selected_job_id);\n\t\t\t\tvar invoices_count = rows.getRowCount();\n\t\t\t\trows.close();\n\t\t\t\tif (invoices_count > 0) {\n\t\t\t\t\tvar row = Ti.UI.createTableViewRow({\n\t\t\t\t\t\tfilter_class : 'invoice',\n\t\t\t\t\t\ttitle : (_type == 'job' ? 'Invoices' : 'Quotes'),\n\t\t\t\t\t\tclassName : 'invoice',\n\t\t\t\t\t\theight : 'auto',\n\t\t\t\t\t\thasChild : true,\n\t\t\t\t\t\tview_url : 'job/edit/job_invoices.js'\n\t\t\t\t\t});\n\t\t\t\t\tvar invoices_label = Ti.UI.createLabel({\n\t\t\t\t\t\tright : 5,\n\t\t\t\t\t\tbackgroundColor : self.table_view_row_number_label_background_color,\n\t\t\t\t\t\tcolor : '#fff',\n\t\t\t\t\t\twidth : 30,\n\t\t\t\t\t\theight : 20,\n\t\t\t\t\t\ttextAlign : 'center',\n\t\t\t\t\t\ttext : invoices_count,\n\t\t\t\t\t\tborderRadius : 8\n\t\t\t\t\t});\n\t\t\t\t\trow.add(invoices_label);\n\t\t\t\t\tself.data[_section_no].add(row);\n\t\t\t\t}\n\t\t\t\t_section_no++;\n\t\t\t} catch (err) {\n\t\t\t\tself.process_simple_error_message(err, window_source + ' - _setup_row_for_invoice_section');\n\t\t\t\treturn;\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "7bc2694186ed45947aeed0c6833990b5", "score": "0.54585123", "text": "function refreshPage() {\n return datacontext.getEntityList(incidents, datacontext.entityAddress.incident, false, 'ProductIncidents', null, null, null, null, 'incidentID');\n }", "title": "" }, { "docid": "2b9c410a7337c1869a1bb5178a278693", "score": "0.5458451", "text": "function loadAll() {\n var Notes = [\n {\n 'name' : 'Jane Doe',\n 'mrn' : '123456',\n }\n ];\n \n \n }", "title": "" }, { "docid": "5ab6b3aff6d6d615aba7bc18fbbcd4e3", "score": "0.54242396", "text": "_get (id, params) {\n const { stripe } = this.filterParams(params);\n return this.stripe.invoices.retrieve(id, stripe);\n }", "title": "" }, { "docid": "0c18d2f0ff4815b40f5d36060df50077", "score": "0.54124004", "text": "async _load_invoice_to_cart(offline_pos_name) {\n if (this.frm.doc.items.length > 0) {\n await new Promise((resolve, reject) => {\n frappe.confirm(\n 'Your current cart contains some items. ' +\n 'Do you really want to clear them and load the saved invoice?',\n resolve,\n reject\n );\n });\n }\n\n const invoice = await db.draft_invoices.get(offline_pos_name);\n frappe.model.add_to_locals(invoice);\n ['items', 'payments', 'taxes'].forEach((field) =>\n invoice[field].forEach(frappe.model.add_to_locals)\n );\n this.frm.refresh(invoice.name);\n\n this.customer_field.value = this.frm.doc.customer;\n this.customer_field.refresh();\n\n this.available_loyalty_points.value = this.frm.doc.loyalty_points;\n this.available_loyalty_points.refresh();\n\n this.$cart_items.empty();\n this.$cart_items.append(\n this.frm.doc.items.map(this.get_item_html.bind(this))\n );\n\n this.update_discount_fields();\n this.update_grand_total();\n this.update_taxes_and_totals();\n this.update_qty_total();\n }", "title": "" }, { "docid": "1aa2a6bced8466aa541fe3a5b47c656d", "score": "0.5411541", "text": "function Invoices (serverClient) {\n var self = this;\n\n function init () {}\n\n /**\n * Gets a list of invoicing data for a given account alias for a given month\n * @param {Object} params - invoice params\n * @example\n * {\n * year: 2015,\n * month: 7,\n * pricingAccountAlias: 'PALIAS'\n * }\n * {\n * date: moment().subtract(2, 'months')\n * }\n * {\n * date: new Date('2015-09-01T03:24:00')\n * }\n * @returns {Promise<InvoiceData>} - promise that resolved by InvoiceData.\n *\n * @instance\n * @function getInvoice\n * @memberof Invoices\n */\n self.getInvoice = function (params) {\n var convertedParams = new InvoiceConverter().convert(params);\n\n return serverClient.getInvoice(\n convertedParams.year,\n convertedParams.month,\n convertedParams.pricingAccountAlias\n );\n };\n\n init();\n}", "title": "" }, { "docid": "c035277d7541c1dd6b15191e087e4c04", "score": "0.5394092", "text": "function addInvoiceToList(invoice,taget){\n\tvar itemString ='';\n\tinvoice.items.forEach(function(itemp,i){\n\t\titemString +=itemp.product_id+'(x'+itemp.number+'), ';\n\t});\n\titemString = itemString.substring(0, itemString.length - 2);\n\tvar date = new Date(parseFloat(invoice.date));\n\tvar html = '<a href=\"invoice-template.php?id='+invoice.id+'\" class=\"list-group-item\">'+\n\t\t '<span class=\"badge\">'+date.toLocaleDateString()+'</span>'+\n\t\t ' <span class=\"badge\">'+invoice.name+'</span>'+\n\t\t '<h4 class=\"list-group-item-heading\">Mã khách hàng: '+invoice.customers_id+' - Mã hoá đơn: '+invoice.id+'</h4>'+\n\t\t '<h5 class=\"list-group-item-text\">Sản phẩm: '+itemString+'</h5>'+\n\t\t'</a>';\n\ttaget.append(html);\n}", "title": "" }, { "docid": "950ff7759415087532eec72df3fb860b", "score": "0.5393147", "text": "function loadPage() {\n\n\t\t\t\t$limit = vmlog.pageItem;\n\t\t\t\t$offset = vmlog.page * 10;\n\n\t\t\t\tApiServiceLog.paginacao($limit, $offset)\n\t\t\t\t\t.then(function (paginacao) {\n\t\t\t\t\t\tvar list = [];\n\t\t\t\t\t\tfor (var i = 0; i < paginacao.data.length; i++) {\n\t\t\t\t\t\t\tlist.push(paginacao.data[i]);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$scope.pageItems = list;\t\t\t\t\t\t\n\n\t\t\t\t\t})\n\t\t\t\t\t.catch(function () {\n\t\t\t\t\t\talert('Erro ao carregar a tabela!');\n\t\t\t\t\t})\n\n\t\t\t}", "title": "" }, { "docid": "9b9fdb1ccf4ed47e6aff8f8922ece49b", "score": "0.5387941", "text": "function loadRecords() {\n var promiseGet = customerService.getCustomers(); //The MEthod Call from service\n\n promiseGet.then(function (pl) { $scope.Customers = pl.data },\n function (errorPl) {\n $log.error('failure loading customers', errorPl);\n });\n }", "title": "" }, { "docid": "5608e249b5160a82388b4189bd60805f", "score": "0.5361262", "text": "function loadRecords() {\n var promiseGet = customerService.getCustomers(); //The MEthod Call from service\n\n promiseGet.then(function (pl) { $scope.Customers = pl.data },\n function (errorPl) {\n $log.error('failure loading Customer', errorPl);\n });\n }", "title": "" }, { "docid": "26d7a3a0d90ddc6919b96f9938f79140", "score": "0.53517485", "text": "function loadPartyRecords(isPaging) {\n\n var apiRoute = baseUrl + 'GetParty/';\n var listParty = challanService.getModel(apiRoute, page, pageSize, isPaging);\n listParty.then(function (response) {\n $scope.listParty = response.data;\n },\n function (error) {\n console.log(\"Error: \" + error);\n });\n }", "title": "" }, { "docid": "0d3ae10da65e131eff98849c3a33d51f", "score": "0.53260666", "text": "function loadAllBooks() {\n request('GET','/books').then(displayAllBooks).catch(errorHandle)\n }", "title": "" }, { "docid": "6a8bb56a4a9662e944be0dc7cfa0cffd", "score": "0.5316103", "text": "static getInvoice(req, res)\n {\n let content = super.getContentOf(\"/flipkartv3/getInvoice.js\");\n\n content.invoices.shipmentId = req.params.shipment_id;\n\n return res.json(content);\n }", "title": "" }, { "docid": "b714d520a37d819e4ed375559a41c7ce", "score": "0.5289769", "text": "function loadView() {\n\t\tvar srv1 = comc.requestLiteList('INVIESTA', $scope.cntx);\n\t\tvar srv2 = comc.requestLiteList('INVITIPO', $scope.cntx);\n\t\t\n\t\t$q.all([srv.stResp(false, srv1, srv2)]).then(function(){\n\t\t\tvar srv3 = comc.request('invi/list', $scope.cntx);\n\t\t\t\n\t\t\t$q.all([srv.stResp(true, srv3)]).then(function(){\n\t\t\t\tview();\n\t\t\t});\n\t\t});\n\t}", "title": "" }, { "docid": "3ec99f0ce229d2c47dcac734afef3664", "score": "0.5278767", "text": "function loadItems() {\n API.getOrders()\n .then(res =>\n setItems(res.data)\n )\n .catch(err => console.log(err));\n }", "title": "" }, { "docid": "4e3e0574815b312700bb77130e6dd9e0", "score": "0.5277818", "text": "invitations() {\n let rqst = this.client.newSignedRequest('GET', `${this.urlPrefix}/invitations/list`, null);\n return this.client._wrapWithPromise(rqst);\n }", "title": "" }, { "docid": "f34bdb4101552765f226b30456a0d737", "score": "0.52750576", "text": "function loadCurrencyRecords(isPaging) {\n\n var apiRoute = baseUrl + 'GetCurrency/';\n var listCurrency = challanService.getModel(apiRoute, page, pageSize, isPaging);\n listCurrency.then(function (response) {\n $scope.listCurrency = response.data;\n },\n function (error) {\n console.log(\"Error: \" + error);\n });\n }", "title": "" }, { "docid": "0d18f458a712913ccf3b410d11b202db", "score": "0.5274", "text": "function loadRecords() {\n\n var promiseGet = Service.GetpeopleInfos();\n promiseGet.then(function(p1) {\n $scope.peopleInfos = p1.data;\n $scope.clear();\n }, \n function(errorP1) {\n $log.error('failure to load the peopleInfo', errorP1);\n\n });\n }", "title": "" }, { "docid": "dc43c3c45cb269b0dffce324882e0ac8", "score": "0.52436215", "text": "function loadInstitutions() {\n institutionService.query(\n function(data) {\n $scope.institutions = data;\n },\n function(error) {\n $log.error(error);\n }\n );\n }", "title": "" }, { "docid": "176a4809b6cdfbb198f08dc5fef74f3c", "score": "0.5214078", "text": "function member_to_payment_report(member, invoices) {\n member.invoices = [];\n member.member.invoices.forEach(\n\t(invoice) => {\n\t logger.info(\"Check: Looking up \" + invoice.id);\n\t const found_invoices = invoices.findById(invoice.id);\n\t logger.info(\"Check: Invoice number = \" + found_invoices.length);\n\t found_invoices.forEach(\n\t\t(inv) => member.invoices.push(inv)\n\t );\n\t}\n );\n\n return template.render(member);\n}", "title": "" }, { "docid": "4801cda7be94db5a8c9b4d883ff31972", "score": "0.5213157", "text": "function loadRecords() {\n var promiseGet = productService.getProducts(); //The MEthod Call from service\n\n promiseGet.then(function (pl) { $scope.products = pl.data },\n function (errorPl) {\n $log.error('failure loading products', errorPl);\n });\n }", "title": "" }, { "docid": "df7b5df1f843cdcc7778a4885b5722bf", "score": "0.52022225", "text": "function loadItems() {\n connection.query(\"SELECT * FROM products\", function(err, res){\n if (err) throw err;\n\n console.table(res);\n\n inquireCustomerForItem(res)\n })\n}", "title": "" }, { "docid": "38b88a6d81332811940c33b1728201fc", "score": "0.51972854", "text": "function getPaidInvoiceTableData(query) {\n startLoad();\n \n domo.get(query)\n .then(data => {\n let responseData = [];\n let reqBody = [];\n data.forEach(inv => responseData.push(inv));\n domo.get(`/domo/datastores/v1/collections/ap-app-data/documents/`)\n .then(appData => {\n appData.forEach(item => {\n let temp = {};\n const i = responseData.findIndex(inv => inv.unique_id.toString() === item.content.unique_id.toString());\n if(i !== -1) {\n responseData[i].approved = item.content.approved;\n responseData[i].approval = item.content.approval_timestamp;\n temp.id = item.id;\n temp.content = item.content;\n temp.content.paid = 'true';\n reqBody.push(temp);\n };\n });\n responseData.sort((a,b) => {\n return b.amount - a.amount;\n });\n paintPaidTable(responseData);\n domo.put(`/domo/datastores/v1/collections/ap-app-data/documents/bulk`, reqBody)\n .then(data => {\n return true;\n })\n .catch(err => console.log(err));\n })\n .catch(err => console.log(err));\n })\n .catch(err => console.log(err));\n }", "title": "" }, { "docid": "bd7dd976905cd98df5988bd991be42ec", "score": "0.5187336", "text": "getOfficesFromDb() {\n const request = new Request('/get_offices', {\n method: 'GET',\n headers: { \"Content-Type\": \"application/json\" }\n });\n\n // Create a list to return.\n let rtrnList = {};\n\n fetch(request).then(res => res.json()).then(result => {\n //if success then update the office list\n if (result.success) {\n const officeList = result.offices;\n // Reformat the offices by iterating through them all\n let office, i;\n for (i in officeList) {\n office = officeList[i]; // current office pointer\n rtrnList[i] = {\n id: office.id_Office,\n country: office.Country,\n city: office.City,\n address: office.Address\n };\n }\n console.log(rtrnList);\n this.updateState({ offices: rtrnList });\n }\n else {\n console.log(\"Error\");\n }\n }).catch(err => {\n console.log(err);\n });\n }", "title": "" }, { "docid": "d613816cdf0e0a943b15ffe9eecd7e4d", "score": "0.5187016", "text": "function _getRecords() {\n vm.loading = true;\n\n RecordService\n .getAllRecords()\n .then(function(result) {\n vm.items = result.data.data;\n vm.totalCount = result.data.data.length;\n })\n .catch(function(err) {\n console.log(err);\n NotifyService.error(\"An error occured trying load records.\")\n })\n .finally(function() {\n vm.loading = false;\n })\n }", "title": "" }, { "docid": "bd96afe0937e5b2bbf2228d0df54ba8c", "score": "0.51822174", "text": "function loadListaReservasInd() {\n var lista = localStorage.getItem('listaReservasInd');\n if (lista == null) {\n return [];\n }\n else {\n return JSON.parse(lista);\n }\n }", "title": "" }, { "docid": "6f6b5a489947f21ad1aa34d8ad2aaac6", "score": "0.5177968", "text": "function loadList() {\n showLoadingMessage();\n return $.ajax(apiUrl, {\n dataType: 'json'\n }).then(function(response) {\n hideLoadingMessage();\n globalData = response.Global;\n response.Countries.forEach(function(item) {\n var country = {\n Country: item.Country,\n CountryCode: item.CountryCode,\n TotalConfirmed: item.TotalConfirmed,\n NewConfirmed: item.NewConfirmed,\n TotalDeaths: item.TotalDeaths,\n NewDeaths: item.NewDeaths,\n TotalRecovered: item.TotalRecovered,\n NewRecovered: item.NewRecovered,\n Date: item.Date\n };\n add(country);\n });\n addGlobalDataTableStructure();\n addCountryTableHeadline();\n }).catch(function() {\n hideLoadingMessage();\n addErrorMessage();\n });\n }", "title": "" }, { "docid": "d4f485f4c3ebff498145621ec0907331", "score": "0.5177274", "text": "function loadItineraries(data){\n\tvar itinerariesHTML = HandlebarsTemplates['itineraries']({itineraries : data});\n\t$(\".itineraries\").html(itinerariesHTML);\n}", "title": "" }, { "docid": "2a01f98d330c3e08f349df0e9b2e75fa", "score": "0.5175359", "text": "function setPoInv() {\n var tbody = getById('t_inv_body'),\n nopo = getInner('t_inv_nopo'),\n rows = tbody.childNodes.length,\n\t\tlistInv = getById('listInvoice'),\n\t\ttotalRp = getById('totalRpInv'),\n res = {};\n \n // Get Result\n res.nopo = nopo;\n res.invoice = new Array();\n\tvar totalInvoice = 0;\n for (var i=0;i<rows;i++) {\n var tmp = getById('el_inv_'+i),\n tmp2 = getById('t_noinvoice_'+i),\n\t\t\ttmp3 = getById('t_nilaiinvoice_'+i).getAttribute('value');\n\t\t\t\n if (tmp.checked) {\n res.invoice.push(tmp2.innerHTML);\n\t\t\ttotalInvoice += parseFloat(tmp3);\n }\n }\n if (res.invoice.length>4) {\n alert(\"Maximum Invoice selected is 4\");return;\n }\n \n // Set Result\n document.getElementById('nopo').value = res.nopo;\n\ttotalRp.value = totalInvoice;\n\tvar tmpInv = \"\";\n for (i in res.invoice) {\n\t\ttmpInv += \"<div id='noinv_\"+i+\"'>\"+res.invoice[i]+\"</div>\";\n }\n listInv.innerHTML = tmpInv;\n closeDialog();\n}", "title": "" }, { "docid": "3fefe6b34003767efda5b54989d4b019", "score": "0.5170562", "text": "function ciniki_sapos_invoices() {\n this.init = function() {\n this.invoices = new M.panel('Invoices',\n 'ciniki_sapos_invoices', 'invoices',\n 'mc', 'large', 'sectioned', 'ciniki.sapos.invoices.invoices');\n this.invoices.year = null;\n this.invoices.month = 0;\n this.invoices.invoice_type = 0;\n this.invoices.payment_status = 0;\n this.invoices.data = {};\n this.invoices.sections = {\n 'years':{'label':'', 'type':'paneltabs', 'selected':'', 'tabs':{}},\n 'months':{'label':'', 'visible':'no', 'type':'paneltabs', 'selected':'0', 'tabs':{\n '0':{'label':'All', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,0);'},\n '1':{'label':'Jan', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,1);'},\n '2':{'label':'Feb', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,2);'},\n '3':{'label':'Mar', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,3);'},\n '4':{'label':'Apr', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,4);'},\n '5':{'label':'May', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,5);'},\n '6':{'label':'Jun', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,6);'},\n '7':{'label':'Jul', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,7);'},\n '8':{'label':'Aug', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,8);'},\n '9':{'label':'Sep', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,9);'},\n '10':{'label':'Oct', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,10);'},\n '11':{'label':'Nov', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,11);'},\n '12':{'label':'Dec', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,12);'},\n }},\n 'types':{'label':'', 'visible':'no', 'type':'paneltabs', 'selected':'0', 'tabs':{\n '0':{'label':'All', 'visible':'no', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,0);'},\n '10':{'label':'Invoices', 'visible':'no', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,10);'},\n// '11':{'label':'Monthly Invoices', 'visible':'no', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,11);'},\n// '19':{'label':'Yearly Invoices', 'visible':'no', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,19);'},\n '20':{'label':'Carts', 'visible':'no', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,20);'},\n '30':{'label':'POS', 'visible':'no', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,30);'},\n '40':{'label':'Orders', 'visible':'no', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,40);'},\n '90':{'label':'Quotes', 'visible':'no', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,90);'},\n }},\n 'payment_statuses':{'label':'', 'visible':'yes', 'type':'paneltabs', 'selected':'0', 'tabs':{\n '0':{'label':'All', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,null,0);'},\n '10':{'label':'Payment Required', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,null,10);'},\n '40':{'label':'Partial Payment', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,null,40);'},\n '50':{'label':'Paid', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,null,50);'},\n '55':{'label':'Refund Required', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,null,55);'},\n '60':{'label':'Refunded', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,null,60);'},\n }},\n// 'statuses':{'label':'', 'visible':'yes', 'type':'paneltabs', 'selected':'0', 'tabs':{\n// '0':{'label':'All', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,null,0);'},\n// '10':{'label':'Entered', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,null,20);'},\n// '40':{'label':'Deposit', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,null,40);'},\n// '50':{'label':'Paid', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,null,50);'},\n// '55':{'label':'Refunded', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,null,55);'},\n// '60':{'label':'Void', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,null,60);'},\n// }},\n 'invoices':{'label':'', 'type':'simplegrid', 'num_cols':5,\n 'sortable':'yes',\n 'headerValues':['Invoice #', 'Date', 'Customer', 'Amount', 'Status'],\n 'sortTypes':['number', 'date', 'text', 'number', 'text'],\n 'noData':'No Invoices Found',\n },\n '_buttons':{'label':'', 'buttons':{\n 'excel':{'label':'Download Excel', 'fn':'M.ciniki_sapos_invoices.downloadExcel();'},\n }},\n// 'totals':{'label':'Totals', 'list':{\n// 'num_invoices':{'label':'Number of Invoices'},\n// 'total_amount':{'label':'Amount Invoiced'},\n// }},\n };\n this.invoices.footerValue = function(s, i, d) {\n if( this.data.totals != null ) {\n switch(i) {\n case 0: return this.data.totals.num_invoices;\n case 1: return '';\n case 2: return '';\n case 3: return this.data.totals.total_amount;\n case 4: return '';\n }\n }\n };\n this.invoices.footerClass = function(s, i, d) {\n if( i == 4 ) { return 'alignright'; }\n return '';\n };\n this.invoices.sectionData = function(s) {\n// if( s == 'totals' ) { return this.sections[s].list; }\n return this.data[s];\n };\n this.invoices.noData = function(s) {\n return this.sections[s].noData;\n };\n this.invoices.listLabel = function(s, i, d) {\n return d.label;\n };\n this.invoices.listValue = function(s, i, d) {\n return this.data.totals[i];\n };\n this.invoices.cellValue = function(s, i, j, d) {\n if( s == 'invoices' ) {\n switch(j) {\n case 0: return d.invoice.invoice_number;\n case 1: return d.invoice.invoice_date;\n case 2: return d.invoice.customer_display_name;\n case 3: return d.invoice.total_amount_display;\n case 4: return d.invoice.status_text;\n }\n }\n };\n \n this.invoices.rowFn = function(s, i, d) {\n if( d == null ) {\n return '';\n }\n if( s == 'invoices' ) {\n return 'M.ciniki_sapos_invoices.invoices.openInvoice(\\'' + d.invoice.id + '\\');';\n// return 'M.startApp(\\'ciniki.sapos.invoice\\',null,\\'M.ciniki_sapos_invoices.showInvoices();\\',\\'mc\\',{\\'invoice_id\\':\\'' + d.invoice.id + '\\'});';\n }\n };\n this.invoices.openInvoice = function(i) {\n M.startApp('ciniki.sapos.invoice',null,'M.ciniki_sapos_invoices.showInvoices();','mc',{'invoice_id':i, 'list':this.data.invoices});\n };\n this.invoices.addButton('add', 'Invoice', 'M.startApp(\\'ciniki.sapos.invoice\\',null,\\'M.ciniki_sapos_invoices.showInvoices();\\',\\'mc\\',{});');\n this.invoices.addClose('Back');\n };\n\n //\n // Arguments:\n // aG - The arguments to be parsed into args\n //\n this.start = function(cb, appPrefix, aG) {\n args = {};\n if( aG != null ) { args = eval(aG); }\n\n //\n // Create the app container if it doesn't exist, and clear it out\n // if it does exist.\n //\n var appContainer = M.createContainer(appPrefix, 'ciniki_sapos_invoices', 'yes');\n if( appContainer == null ) {\n M.alert('App Error');\n return false;\n } \n\n //\n // Setup the invoice types\n //\n var ct = 0;\n var default_type = 0;\n if( (M.curTenant.modules['ciniki.sapos'].flags&0x010000) > 0 ) {\n this.invoices.sections.types.tabs['90'].visible = 'yes';\n if( default_type != '' ) { default_type = 90; }\n ct++;\n } else {\n this.invoices.sections.types.tabs['90'].visible = 'no';\n }\n if( (M.curTenant.modules['ciniki.sapos'].flags&0x010000) > 0 ) {\n this.invoices.sections.types.tabs['90'].visible = 'yes';\n if( default_type != '' ) { default_type = 90; }\n ct++;\n } else {\n this.invoices.sections.types.tabs['90'].visible = 'no';\n }\n if( (M.curTenant.modules['ciniki.sapos'].flags&0x01) > 0 ) {\n this.invoices.sections.types.tabs['10'].visible = 'yes';\n if( default_type != '' ) { default_type = 10; }\n ct++;\n// if( (M.curTenant.modules['ciniki.sapos'].flags&0x1000) > 0 ) {\n// this.invoices.sections.types.tabs['11'].visible = 'yes';\n// ct++;\n// this.invoices.sections.types.tabs['19'].visible = 'yes';\n// ct++;\n// }\n } else {\n this.invoices.sections.types.tabs['10'].visible = 'no';\n }\n if( (M.curTenant.modules['ciniki.sapos'].flags&0x08) > 0 ) {\n this.invoices.sections.types.tabs['20'].visible = 'yes';\n if( default_type != '' ) { default_type = 20; }\n ct++;\n } else {\n this.invoices.sections.types.tabs['20'].visible = 'no';\n }\n if( (M.curTenant.modules['ciniki.sapos'].flags&0x10) > 0 ) {\n this.invoices.sections.types.tabs['30'].visible = 'yes';\n if( default_type != '' ) { default_type = 30; }\n ct++;\n } else {\n this.invoices.sections.types.tabs['30'].visible = 'no';\n }\n if( (M.curTenant.modules['ciniki.sapos'].flags&0x20) > 0 ) {\n this.invoices.sections.types.tabs['40'].visible = 'yes';\n if( default_type != '' ) { default_type = 40; }\n ct++;\n } else {\n this.invoices.sections.types.tabs['40'].visible = 'no';\n }\n\n if( ct > 1 ) {\n this.invoices.sections.types.visible = 'yes';\n this.default_type = 0; // Default to all for more than one type\n } else {\n this.invoices.sections.types.visible = 'no';\n }\n \n if( args.invoice_type != null && args.invoice_type != '' ) {\n default_type = args.invoice_type;\n }\n\n M.api.getJSONCb('ciniki.sapos.invoiceStats', {'tnid':M.curTenantID}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_sapos_invoices.invoices;\n if( rsp.stats.min_invoice_date_year != null ) {\n var year = new Date().getFullYear();\n p.sections.years.tabs = {};\n for(var i=rsp.stats.min_invoice_date_year;i<=year;i++) {\n p.sections.years.tabs[i] = {'label':i, 'fn':'M.ciniki_sapos_invoices.showInvoices(null,' + i + ',null);'};\n }\n }\n var dt = new Date();\n M.ciniki_sapos_invoices.showInvoices(cb, dt.getFullYear(), 0, default_type, 0);\n });\n };\n\n this.showInvoices = function(cb, year, month, type, pstatus) {\n if( year != null ) {\n this.invoices.year = year;\n this.invoices.sections.years.selected = year;\n }\n if( month != null ) {\n this.invoices.month = month;\n this.invoices.sections.months.selected = month;\n }\n if( type != null ) {\n this.invoices.invoice_type = type;\n this.invoices.sections.types.selected = type;\n }\n if( pstatus != null ) {\n this.invoices.payment_status = pstatus;\n this.invoices.sections.payment_statuses.selected = pstatus;\n }\n this.invoices.sections.months.visible = (this.invoices.month>0)?'yes':'yes';\n this.invoices.sections.types.visible = 'no';\n var tc = 0;\n this.invoices.sections.types.tabs['0'] = {'label':'All', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,0);'};\n if( (M.curTenant.modules['ciniki.sapos'].flags&0x010000) > 0 ) {\n this.invoices.sections.types.tabs['90'] = {'label':'Quotes', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,90);'};\n tc++;\n }\n if( (M.curTenant.modules['ciniki.sapos'].flags&0x01) > 0 ) {\n this.invoices.sections.types.tabs['10'] = {'label':'Invoices', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,10);'};\n tc++;\n// if( (M.curTenant.modules['ciniki.sapos'].flags&0x1000) > 0 ) {\n// this.invoices.sections.types.tabs['11'] = {'label':'Monthly', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,11);'};\n// tc++;\n// this.invoices.sections.types.tabs['19'] = {'label':'Yearly', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,19);'};\n// tc++;\n// }\n }\n if( (M.curTenant.modules['ciniki.sapos'].flags&0x08) > 0 ) {\n this.invoices.sections.types.tabs['20'] = {'label':'Carts', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,20);'};\n tc++;\n }\n if( (M.curTenant.modules['ciniki.sapos'].flags&0x10) > 0 ) {\n this.invoices.sections.types.tabs['30'] = {'label':'POS', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,30);'};\n tc++;\n }\n if( (M.curTenant.modules['ciniki.sapos'].flags&0x10) > 0 ) {\n this.invoices.sections.types.tabs['40'] = {'label':'Orders', 'fn':'M.ciniki_sapos_invoices.showInvoices(null,null,null,40);'};\n tc++;\n }\n if( tc > 1 ) {\n this.invoices.sections.types.visible = 'yes';\n }\n M.api.getJSONCb('ciniki.sapos.invoiceList', {'tnid':M.curTenantID,\n 'year':this.invoices.year, 'month':this.invoices.month,\n 'payment_status':this.invoices.payment_status, 'type':this.invoices.invoice_type,\n 'sort':'invoice_date'}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_sapos_invoices.invoices;\n p.data.invoices = rsp.invoices;\n p.data.totals = rsp.totals;\n p.sections._buttons.buttons.excel.visible=(rsp.invoices.length>0)?'yes':'no';\n// p.sections.invoices.visible = (rsp.invoices.length > 0)?'yes':'no';\n p.refresh();\n p.show(cb);\n });\n };\n\n this.downloadExcel = function() {\n var args = {'tnid':M.curTenantID, 'output':'excel'};\n if( this.invoices.year != null ) { args.year = this.invoices.year; }\n if( this.invoices.month != null ) { args.month = this.invoices.month; }\n if( this.invoices.payment_status != null ) { args.payment_status = this.invoices.payment_status; }\n M.api.openFile('ciniki.sapos.invoiceList', args);\n };\n}", "title": "" }, { "docid": "437ddd8943788e23a758b25ced34a312", "score": "0.5168985", "text": "function ViewInvoices(props) {\n const { invoices, fetchInvoices, history, location } = props;\n const params = queryString.parse(location.search);\n const classes = useStyles();\n const [selected, setSelected] = useState([]);\n const [openFilter, setOpenFilter] = useState(\n Object.keys(params).length > 0\n );\n const [compact, setCompact] = useState(false);\n const [page, setPage] = useState(parseInt(params.page, 10) || 0);\n const [rowsPerPage, setRowsPerPage] = React.useState(\n params.limit || DEFAULT_ROWS_PER_PAGE\n );\n const defaultFilterValues = toFilterState(filterFields, params);\n const [filterValues, setFilterValues] = useState(defaultFilterValues);\n\n const generateURL = (values, page, rowsPerPage) => {\n const flatValues = toURLParams(filterFields, values);\n const params = new URLSearchParams(flatValues);\n params.append(\"page\", page);\n params.append(\"limit\", rowsPerPage);\n\n history.push(\"/invoices?\" + params.toString());\n };\n\n if (!(\"page\" in params) || !(\"limit\" in params)) {\n generateURL(filterValues, page, rowsPerPage);\n }\n\n if (\"start_date\" in params) {\n params[\"start_date\"] = new Date(Number(params[\"start_date\"]));\n }\n if (\"end_date\" in params) {\n params[\"end_date\"] = new Date(Number(params[\"end_date\"]));\n }\n\n const handleAction = (type) => {\n if (type === \"filter\") {\n setOpenFilter(!openFilter);\n } else if (type === \"compact\" || type === \"default\") {\n setCompact(!compact);\n }\n };\n\n const onClick = (invoice) => {\n history.push(\"/invoices/\" + invoice.id);\n };\n\n // TODO: Create a deep copy without serializing!\n const onFilterValueChange = (field, value) => {\n const newValues = Object.assign({}, filterValues);\n newValues[field] = value;\n setFilterValues(newValues);\n\n generateURL(newValues, page, rowsPerPage);\n };\n\n const onFilterClear = () => {\n const defaultValues = toFilterState(filterFields, {});\n setFilterValues(defaultValues);\n\n generateURL(defaultValues, page, rowsPerPage);\n };\n\n const descendingComparator = (invoiceA, invoiceB, orderBy) => {\n const keys = {\n invoiceNumber: \"invoiceNumber\",\n createdAt: \"createdAt\",\n dueAt: \"dueAt\",\n status: \"status\",\n total: \"total\",\n };\n const key = keys[orderBy];\n let valueA = invoiceA[key];\n let valueB = invoiceB[key];\n\n if (typeof valueA === \"string\") {\n valueA = valueA.toLowerCase();\n } else if (valueA instanceof Date) {\n valueA = valueA.getTime();\n }\n\n if (typeof valueB === \"string\") {\n valueB = valueB.toLowerCase();\n } else if (valueB instanceof Date) {\n valueB = valueB.getTime();\n }\n\n return valueB < valueA ? -1 : valueB > valueA ? 1 : 0;\n };\n\n const renderCellValue = (row, rowIndex, column, columnIndex) => {\n switch (column.id) {\n case \"invoiceNumber\": {\n return row.invoiceNumber;\n }\n\n case \"name\": {\n return row.account.firstName + \" \" + row.account.lastName;\n }\n\n case \"createdAt\": {\n return toDateString(row.createdAt);\n }\n\n case \"dueAt\": {\n return toDateString(row.dueAt);\n }\n\n case \"status\": {\n return statusNames[row.status];\n }\n\n case \"total\": {\n return row.total + \" INR\";\n }\n\n default: {\n return \"Unknown Column\";\n }\n }\n };\n\n const onChangePage = (newPage) => {\n setPage(newPage);\n generateURL(filterValues, newPage, rowsPerPage);\n };\n\n const onChangeRowsPerPage = (newRowsPerPage) => {\n setPage(0);\n setRowsPerPage(newRowsPerPage);\n generateURL(filterValues, 0, newRowsPerPage);\n };\n\n useEffect(() => {\n const flatValues = toURLParams(filterFields, filterValues);\n flatValues.page = page;\n flatValues.limit = rowsPerPage;\n fetchInvoices(flatValues);\n }, [fetchInvoices, filterValues, page, rowsPerPage]);\n\n return (\n <div>\n <WorkspaceToolbar\n title=\"Invoices\"\n selectionCount={selected.length}\n actions={compact ? actions1 : actions2}\n onAction={handleAction}\n />\n <Grid container={true} className={classes.container}>\n <Grid item={true} lg={openFilter ? 10 : 12}>\n {invoices && invoices.records.length > 0 && (\n <WorkspaceTable\n headers={headers}\n onSelected={setSelected}\n selected={selected}\n compact={compact}\n onClick={onClick}\n rows={invoices.records}\n renderCellValue={renderCellValue}\n totalRows={invoices.totalRecords}\n page={page}\n rowsPerPage={rowsPerPage}\n onChangePage={onChangePage}\n onChangeRowsPerPage={onChangeRowsPerPage}\n descendingComparator={descendingComparator}\n />\n )}\n\n {(!invoices || invoices.records.length === 0) && (\n <NoRecords\n message=\"There are no invoices yet.\"\n image=\"assets/images/empty-invoices.svg\"\n action={false}\n />\n )}\n </Grid>\n {openFilter && (\n <Grid item={true} lg={2}>\n <WorkspaceFilter\n fields={filterFields}\n values={filterValues}\n onValueChange={onFilterValueChange}\n onClear={onFilterClear}\n />\n </Grid>\n )}\n </Grid>\n </div>\n );\n}", "title": "" }, { "docid": "6561a42bdcc2b1e2107b347e917934d7", "score": "0.5168428", "text": "async function loadAccidentList() {\n try {\n \n \n const accidents = await getDataAsync(`${BASE_URL}accident`);\n displayAccidents(accidents);\n \n } // catch and log any errors\n catch (err) {\n console.log(err);\n }\n }", "title": "" }, { "docid": "c7a03b05b9e268af659839ffac1c22e8", "score": "0.5166423", "text": "static _LoadOrderedItemsFromSession(){\n if(Storage.Session.get.CheckoutList){\n let loadedList = JSON.parse(Storage.Session.get.CheckoutList);\n\n loadedList.forEach(orderedItem => {\n this.Add(Product.Instances[orderedItem.representedProduct], orderedItem.quantity);\n });\n }\n }", "title": "" }, { "docid": "1952378345a725b39f9b079c0ebd625d", "score": "0.5160895", "text": "function loadRecords() {\n var promiseGet = productService.getProducts(); //The MEthod Call from service\n\n promiseGet.then(function (pl) { $scope.Products = pl.data },\n function (errorPl) {\n $log.error('failure loading Product', errorPl);\n });\n }", "title": "" }, { "docid": "0be581c1cecdcb05ebf9a71af298debd", "score": "0.51590323", "text": "function loadBills() {\n BillAPI.getBills()\n .then((res) => setBills(res.data))\n .catch((err) => console.log(err));\n }", "title": "" }, { "docid": "a036b2923c302242f90be9be17a8193d", "score": "0.5152117", "text": "constructor(props) {\n super(props)\n\n this.state = {\n invoice: []\n }\n this.addInvoice = this.addInvoice.bind(this);\n this.editInvoice = this.editInvoice.bind(this);\n this.deleteInvoice = this.deleteInvoice.bind(this);\n }", "title": "" }, { "docid": "6f67ee709fe0df132a143884582b5d81", "score": "0.5148765", "text": "initStore() {\n this.loadCompaniesList(); // Loadign companies to show\n }", "title": "" }, { "docid": "585a06547a7f1b6c1e786240a0f0465a", "score": "0.51390094", "text": "get numVoices () {\n return this._voices.length;\n }", "title": "" }, { "docid": "ebcad221957e649dfbc5891bdf6ea268", "score": "0.51248586", "text": "function loadDataTable() {\n var params = { company_id:user_data.company_id };\n ProductsService.index(params).then(function(response) {\n $scope.datas = response.data.records;\n $scope.search();\n $scope.select($scope.currentPage);\n });\n }", "title": "" }, { "docid": "17f7cfc78218c8fc0d932255c7974afd", "score": "0.5112017", "text": "async loadRegions () {\n const saved = await fetch('/regions.json');\n this.filter.region.items = await saved.json();\n }", "title": "" }, { "docid": "d30f2e2996fa607de3a21ba76f312c12", "score": "0.5102556", "text": "function GetAllAdverts() {\n debugger;\n var getAdvertData = crudAJService.getAdverts();\n getAdvertData.then(function (book) {\n $scope.books = book.data;\n }, function () {\n alert('Error in getting book records');\n });\n }", "title": "" }, { "docid": "64e2aaf84b125c1fd6493ff4c13a0cc2", "score": "0.50756043", "text": "function loadRecords() {\n var promiseGet = employeeService.getEmployees(); //The MEthod Call from service\n\n promiseGet.then(function (pl) { $scope.Employees = pl.data },\n function (errorPl) {\n $log.error('failure loading Employee', errorPl);\n });\n }", "title": "" }, { "docid": "3bdb762bfb51c77990ab191ea8ca32b0", "score": "0.50688636", "text": "function PurchaseInvoiceDataSource(restService, searchObject, sort, paginator) {\n var _this = _super.call(this) || this;\n _this.restService = restService;\n _this.searchObject = searchObject;\n _this.sort = sort;\n _this.paginator = paginator;\n _this.data = [];\n _this.getDataList();\n return _this;\n }", "title": "" }, { "docid": "199b6d08d02a6d3da24e7f9be66dd966", "score": "0.5057767", "text": "function getItems() {\n\t\t$.get(\"/api/items\", function(data) {\n\t\t\tconsole.log(data);\n\t\t\tinitilizeRows(data);\n\t\t})\n\t}", "title": "" }, { "docid": "41b0105120bb04a4ec2f7cdcf2756a28", "score": "0.50516593", "text": "@action loadNumbers() { this.props.AsyncDemoStore.getManyDataItems(); }", "title": "" }, { "docid": "f80a1bd958c24886a40836a41f149561", "score": "0.5043929", "text": "obtenerTodosIngresoInsumo() {\n return axios.get(`${API_URL}/ingreso_insumo/`);\n }", "title": "" }, { "docid": "d64516826b5d05f1866ee8ad2b159d06", "score": "0.50415885", "text": "function newInvoices(){\n return {foo: 130, bar: 250};\n}", "title": "" }, { "docid": "0b179a8f4c4cbdea76ca3c9b11afa301", "score": "0.50379467", "text": "function loadJournal(param)\n{\n if (!Banana.document || !param || typeof (Banana.document.journalCustomersSuppliers) === 'undefined')\n return false;\n\n var journal = Banana.document.journalCustomersSuppliers(\n Banana.document.ORIGINTYPE_CURRENT, Banana.document.ACCOUNTTYPE_NORMAL);\n var filteredRows = journal.findRows(loadJournal_filter);\n var tableVatCodes = Banana.document.table('VatCodes');\n\n if (!journal || !filteredRows || !tableVatCodes)\n return false;\n\n var periodStart = Banana.Converter.toDate(param.startDate);\n var periodEnd = Banana.Converter.toDate(param.endDate);\n param.customers = {};\n param.suppliers = {};\n param.journal = {};\n param.journal.rows = [];\n\n //Variabili per numerazione registro\n var progRegistri = {};\n var previousIndexGroup = -1;\n \n //Salva i nomi delle colonne del giornale\n var tColumnNames = journal.columnNames;\n param.journal = loadJournal_setColumns(param.journal, tColumnNames);\n\n //Carica l'elenco clienti/fornitori\n for (var i = 0; i < filteredRows.length; i++) {\n //Controllo periodo\n var validPeriod = false;\n var value = filteredRows[i].value(\"JDate\");\n var currentDate = Banana.Converter.stringToDate(value, \"YYYY-MM-DD\");\n if (currentDate >= periodStart && currentDate <= periodEnd)\n validPeriod = true;\n if (!validPeriod)\n continue;\n\n //Solamente righe con JInvoiceRowCustomerSupplier=1 (cliente) or JInvoiceRowCustomerSupplier=2 (fornitore)\n var isCustomer=false;\n var isSupplier=false;\n if (filteredRows[i].value(\"JInvoiceRowCustomerSupplier\")==1)\n isCustomer=true;\n else if (filteredRows[i].value(\"JInvoiceRowCustomerSupplier\")==2)\n isSupplier=true;\n if (!isCustomer && !isSupplier)\n continue;\n\n var accountId = filteredRows[i].value(\"JAccount\");\n if (accountId && accountId.length>0) {\n var accountObj = getAccount(accountId);\n if (accountObj) {\n if (isCustomer) {\n param.customers[accountId] = accountObj;\n }\n else {\n param.suppliers[accountId] = accountObj;\n }\n }\n }\n }\n \n //Carica le registrazioni IVA\n for (var i = 0; i < filteredRows.length; i++) {\n //Solo operazioni IVA\n var isVatOperation = filteredRows[i].value(\"JVatIsVatOperation\");\n if (!isVatOperation)\n continue;\n\n //Controllo periodo\n var validPeriod = false;\n var value = filteredRows[i].value(\"JDate\");\n var currentDate = Banana.Converter.stringToDate(value, \"YYYY-MM-DD\");\n if (currentDate >= periodStart && currentDate <= periodEnd)\n validPeriod = true;\n if (!validPeriod)\n continue;\n\n //La registrazione IVA deve contenere un conto cliente/fornitore\n /*TODO: vedere se si può semplificare controllando meno campi*/\n var isCustomer=false;\n var isSupplier=false;\n var accountId = filteredRows[i].value(\"JAccount\");\n var contraAccountId = filteredRows[i].value(\"JContraAccount\");\n var vatTwinAccountId = filteredRows[i].value(\"VatTwinAccount\");\n var accountDebitId = filteredRows[i].value(\"AccountDebit\");\n var accountCreditId = filteredRows[i].value(\"AccountCredit\");\n if (!accountDebitId && !accountCreditId) {\n //contabilità entrate-uscite\n accountDebitId = filteredRows[i].value(\"Account\");\n accountCreditId = filteredRows[i].value(\"Category\");\n }\n\n if (accountId && accountId in param.customers) {\n isCustomer = true;\n }\n else if (contraAccountId && contraAccountId in param.customers) {\n isCustomer = true;\n accountId = contraAccountId;\n }\n else if (vatTwinAccountId && vatTwinAccountId in param.customers) {\n isCustomer = true;\n accountId = vatTwinAccountId;\n }\n else if (accountDebitId && accountDebitId in param.customers) {\n isCustomer = true;\n accountId = accountDebitId;\n }\n else if (accountCreditId && accountCreditId in param.customers) {\n isCustomer = true;\n accountId = accountCreditId;\n }\n else if (accountId && accountId in param.suppliers) {\n isSupplier = true;\n }\n else if (contraAccountId && contraAccountId in param.suppliers) {\n isSupplier = true;\n accountId = contraAccountId;\n }\n else if (vatTwinAccountId && vatTwinAccountId in param.suppliers) {\n isSupplier = true;\n accountId = vatTwinAccountId;\n }\n else if (accountDebitId && accountDebitId in param.suppliers) {\n isSupplier = true;\n accountId = accountDebitId;\n }\n else if (accountCreditId && accountCreditId in param.suppliers) {\n isSupplier = true;\n accountId = accountCreditId;\n }\n\n //Crea un oggetto json dove vengono salvate tutte le informazioni della riga\n var jsonLine = {};\n for (var j = 0; j < tColumnNames.length; j++) {\n var columnName = tColumnNames[j];\n value = filteredRows[i].value(columnName);\n if (value) {\n jsonLine[columnName] = xml_escapeString(value);\n }\n else {\n jsonLine[columnName] = '';\n }\n }\n\n //Dati supplementari\n jsonLine[\"IT_ClienteConto\"] = '';\n jsonLine[\"IT_ClienteDescrizione\"] = '';\n jsonLine[\"IT_ClienteIntestazione\"] = '';\n jsonLine[\"IT_ClienteTipologia\"] = '';\n jsonLine[\"IT_ClientePartitaIva\"] = '';\n jsonLine[\"IT_ClienteCodiceFiscale\"] = '';\n jsonLine[\"IT_ClienteIDPaese\"] = '';\n\n if (isCustomer)\n jsonLine[\"IT_ClienteTipologia\"] = 'C';\n else if (isSupplier)\n jsonLine[\"IT_ClienteTipologia\"] = 'F';\n\n if (isCustomer || isSupplier) {\n jsonLine[\"IT_ClienteConto\"] = accountId;\n var accountObj = getAccount(accountId);\n if (accountObj) {\n jsonLine[\"IT_ClienteDescrizione\"] = accountObj[\"Description\"];\n jsonLine[\"IT_ClientePartitaIva\"] = accountObj[\"VatNumber\"];\n jsonLine[\"IT_ClienteCodiceFiscale\"] = accountObj[\"FiscalNumber\"];\n var intestazione = accountId + \" \" + accountObj[\"Description\"];\n if (accountObj[\"VatNumber\"].length>0) {\n intestazione = accountId + \"/\" + accountObj[\"VatNumber\"] + \" \" + accountObj[\"Description\"];\n }\n jsonLine[\"IT_ClienteIntestazione\"] = intestazione;\n jsonLine[\"IT_ClienteIDPaese\"] = getCountryCode(accountObj);\n }\n }\n\n //IT_Aliquota\n //IT_Gr_IVA\n //IT_Gr1_IVA\n //IT_Registro\n jsonLine[\"IT_Aliquota\"] = '';\n jsonLine[\"IT_Gr_IVA\"] = '';\n jsonLine[\"IT_Gr1_IVA\"] = '';\n jsonLine[\"IT_Registro\"] = '';\n var vatCode = filteredRows[i].value(\"JVatCodeWithoutSign\");\n if (vatCode.length) {\n var rowVatCodes = tableVatCodes.findRowByValue('VatCode', vatCode);\n if (rowVatCodes) {\n var percAssoluta = rowVatCodes.value(\"VatRate\");\n if (Banana.SDecimal.isZero(percAssoluta))\n percAssoluta = '0.00';\n jsonLine[\"IT_Aliquota\"] = percAssoluta;\n var gr = rowVatCodes.value(\"Gr\");\n jsonLine[\"IT_Gr_IVA\"] = gr;\n jsonLine[\"IT_Registro\"] = gr;\n if (gr.indexOf('-')>0 || gr.length==1) {\n var gr0 = gr.substr(0,1);\n if (gr0 == \"A\")\n jsonLine[\"IT_Registro\"] = \"Acquisti\";\n else if (gr0 == \"V\")\n jsonLine[\"IT_Registro\"] = \"Vendite\";\n else if (gr0 == \"C\")\n jsonLine[\"IT_Registro\"] = \"Corrispettivi\";\n else if (gr0 == \"L\")\n jsonLine[\"IT_Registro\"] = \"Liquidazioni\";\n }\n\n var gr1 = rowVatCodes.value(\"Gr1\");\n jsonLine[\"IT_Gr1_IVA\"] = gr1;\n }\n }\n\n //IT_ProgRegistro\n var registro = jsonLine[\"IT_Registro\"];\n var noProgressivo = 0;\n if (progRegistri[registro])\n noProgressivo = parseInt(progRegistri[registro]);\n var indexGroup = filteredRows[i].value(\"JContraAccountGroup\") ;\n if (indexGroup != previousIndexGroup) {\n noProgressivo += 1;\n }\n previousIndexGroup = indexGroup;\n progRegistri[registro] = noProgressivo;\n jsonLine[\"IT_ProgRegistro\"] = noProgressivo.toString();\n\n //IT_Imponibile\n //Tolto il segno perché nel file xml non esiste imponibile negativo? (controllare)\n jsonLine[\"IT_Imponibile\"] = '';\n value = filteredRows[i].value(\"JVatTaxable\");\n if (Banana.SDecimal.isZero(value))\n value = '0.00';\n else if (jsonLine[\"IT_Registro\"] == \"Vendite\" || jsonLine[\"IT_Registro\"] == \"Corrispettivi\")\n value = Banana.SDecimal.invert(value);\n jsonLine[\"IT_Imponibile\"] = value;\n\n //IT_ImportoIva\n jsonLine[\"IT_ImportoIva\"] = '';\n value = filteredRows[i].value(\"VatAmount\");\n if (Banana.SDecimal.isZero(value))\n value = '0.00';\n else if (jsonLine[\"IT_Registro\"] == \"Vendite\" || jsonLine[\"IT_Registro\"] == \"Corrispettivi\")\n value = Banana.SDecimal.invert(value);\n jsonLine[\"IT_ImportoIva\"] = value;\n\n //IT_IvaContabilizzata\n jsonLine[\"IT_IvaContabilizzata\"] = '';\n value = filteredRows[i].value(\"VatPosted\");\n if (Banana.SDecimal.isZero(value))\n value = '0.00';\n else if (jsonLine[\"IT_Registro\"] == \"Vendite\" || jsonLine[\"IT_Registro\"] == \"Corrispettivi\")\n value = Banana.SDecimal.invert(value);\n jsonLine[\"IT_IvaContabilizzata\"] = value;\n\n //IT_Lordo\n jsonLine[\"IT_Lordo\"] = '';\n value = Banana.SDecimal.add(filteredRows[i].value(\"JVatTaxable\"), filteredRows[i].value(\"VatAmount\"));\n if (Banana.SDecimal.isZero(value))\n value = '0.00';\n else if (jsonLine[\"IT_Registro\"] == \"Vendite\" || jsonLine[\"IT_Registro\"] == \"Corrispettivi\")\n value = Banana.SDecimal.invert(value);\n jsonLine[\"IT_Lordo\"] = value;\n\n/*\n3. Dati relativi ai campi “detraibile” e “deducibile”\n\nUno dei dati che può essere fornito è quello relativo alla percentuale di\ndetraibilità o, in alternativa, alla deducibilità del costo riportato in fattura. Tale\ndato, la cui indicazione è facoltativa, è riferito all’eventuale deducibilità o\ndetraibilità del costo ai fini delle imposte sui redditi in capo all’acquirente o\ncommittente persona fisica che non opera nell’esercizio di impresa, arte o\nprofessione (cfr., pagina 11 delle specifiche tecniche “Detraibile: contiene il\nvalore percentuale di detraibilità se gli importi si riferiscono a spese detraibili.\nDeducibile: indica se gli importi si riferiscono a spese deducibili ai fini di\nimposte diverse dall’Iva”). A titolo di esempio, qualora la fattura sia emessa da\nuna impresa edile nei confronti di un cliente privato in relazione a lavori di\nristrutturazione edilizia, il 50% del costo riportato nel documento potrebbe essere\nportato in detrazione dei redditi del cliente: in tal caso, l’informazione – se\ndisponibile – potrebbe essere riportata nell’apposito campo della comunicazione.\nSi precisa che la compilazione di uno dei due campi in oggetto esclude la\ncompilazione dell’altro. \n\nLa % detraibile può essere diversa dalla % non imponibile di Banana\nI due dati sono facoltativi, si prevede l'aggiunta di due colonne nella tabella registrazioni,\nnelle quali l'utente può inserire la % manualmente\n\nEsibilitaIva\n(i valori ammessi sono “I” per esigibilità immediata, “D” per esigibilità differita e “S” per scissione dei pagamenti). \n*/\n //IT_Detraibile\n //IT_Deducibile\n //IT_EsigibilitaIva\n jsonLine[\"IT_Detraibile\"] = '';\n jsonLine[\"IT_Deducibile\"] = '';\n jsonLine[\"IT_EsigibilitaIva\"] = 'I';\n\n //IT_ImponibileDetraibile\n //IT_ImponibileNonDetraibile\n jsonLine[\"IT_ImponibileDetraibile\"] = '';\n jsonLine[\"IT_ImponibileNonDetraibile\"] = '';\n value = filteredRows[i].value(\"VatPercentNonDeductible\");\n if (!Banana.SDecimal.isZero(value)) {\n value = Banana.SDecimal.subtract('100', value);\n var rate = Banana.SDecimal.round(value, {'decimals':2});\n var taxable = filteredRows[i].value(\"VatTaxable\");\n var amount = taxable * rate /100;\n amount = Banana.SDecimal.roundNearest(amount, '0.01');\n jsonLine[\"IT_ImponibileDetraibile\"] = amount;\n amount = Banana.SDecimal.subtract(taxable, amount);\n jsonLine[\"IT_ImponibileNonDetraibile\"] = amount;\n }\n else {\n var taxable = filteredRows[i].value(\"VatTaxable\");\n jsonLine[\"IT_ImponibileDetraibile\"] = taxable;\n }\n\n //IT_NoDoc\n jsonLine[\"IT_NoDoc\"] = '';\n var noDoc = xml_escapeString(filteredRows[i].value(\"DocInvoice\"));\n if (noDoc.length<=0)\n noDoc = xml_escapeString(filteredRows[i].value(\"Doc\"));\n jsonLine[\"IT_NoDoc\"] = noDoc;\n\n //IT_DataDoc\n //Se è utilizzata la colonna DocInvoice viene ripresa la data di emissione fattura JInvoiceIssueDate\n //Altrimenti se si utilizza la colonna DateDocument viene ripresa questa oppure la data di registrazione Date\n jsonLine[\"IT_DataDoc\"] = '';\n if (filteredRows[i].value(\"DocInvoice\") && filteredRows[i].value(\"DocInvoice\").length>0)\n jsonLine[\"IT_DataDoc\"] = filteredRows[i].value(\"JInvoiceIssueDate\");\n else if (filteredRows[i].value(\"DateDocument\") && filteredRows[i].value(\"DateDocument\").length>0)\n jsonLine[\"IT_DataDoc\"] = filteredRows[i].value(\"DateDocument\");\n else\n jsonLine[\"IT_DataDoc\"] = filteredRows[i].value(\"Date\");\n\n //IT_TipoDoc\n //TD01 Fattura \n //TD04 Nota di credito \n //TD05 Nota di debito\n //TD07 Fattura semplificata\n //TD08 Nota di credito semplificata\n //TD10 Fattura di acquisto intracomunitario beni (IdPaese != IT)\n //TD11 Fattura di acquisto intracomunitario servizi (IdPaese != IT)\n jsonLine[\"IT_TipoDoc\"] = '';\n var tipoDoc = filteredRows[i].value(\"JInvoiceDocType\");\n if (tipoDoc.length<=0)\n tipoDoc = filteredRows[i].value(\"DocType\");\n\n if (jsonLine[\"JVatNegative\"] == '1') {\n if (isCustomer) {\n if (tipoDoc == '14' || tipoDoc == '12')\n jsonLine[\"IT_TipoDoc\"] = 'TD05';\n else\n jsonLine[\"IT_TipoDoc\"] = 'TD01';\n }\n else if (isSupplier) {\n jsonLine[\"IT_TipoDoc\"] = 'TD04';\n }\n }\n else {\n if (isCustomer) {\n jsonLine[\"IT_TipoDoc\"] = 'TD04';\n }\n else if (isSupplier) {\n if (tipoDoc == '24' || tipoDoc == '22')\n jsonLine[\"IT_TipoDoc\"] = 'TD05';\n else\n jsonLine[\"IT_TipoDoc\"] = 'TD01';\n }\n }\n\n if (vatCode.length && isSupplier) {\n var rowVatCodes = tableVatCodes.findRowByValue('VatCode', vatCode);\n if (rowVatCodes) {\n var vatGr = rowVatCodes.value(\"Gr\");\n if (vatGr && vatGr.indexOf(\"EU-S\")>=0) {\n jsonLine[\"IT_TipoDoc\"] = 'TD11';\n }\n else if (vatGr && vatGr.indexOf(\"EU\")>=0) {\n jsonLine[\"IT_TipoDoc\"] = 'TD10';\n }\n else if (vatGr && vatGr.indexOf(\"REV-S\")>=0 && jsonLine[\"IT_ClienteIDPaese\"] != \"IT\") {\n jsonLine[\"IT_TipoDoc\"] = 'TD11';\n }\n else if (vatGr && vatGr.indexOf(\"REV\")>=0 && jsonLine[\"IT_ClienteIDPaese\"] != \"IT\") {\n jsonLine[\"IT_TipoDoc\"] = 'TD10';\n }\n }\n }\n\n //Controllo IdPaese e TipoDocumento \n //Valori ammessi per fornitori esteri TipoDoc 10 per acquisti beni e TipoDoc 11 per acquisto servizi\n var tipoDocumentoCorretto = true;\n if (isSupplier && jsonLine[\"IT_ClienteIDPaese\"] == \"IT\") {\n if (jsonLine[\"IT_TipoDoc\"] == 'TD10' || jsonLine[\"IT_TipoDoc\"] == 'TD11') {\n tipoDocumentoCorretto = false;\n }\n }\n else if (isSupplier && jsonLine[\"IT_ClienteIDPaese\"].length>0){\n if (jsonLine[\"IT_TipoDoc\"] != 'TD10' && jsonLine[\"IT_TipoDoc\"] != 'TD11') {\n tipoDocumentoCorretto = false;\n }\n }\n if (!tipoDocumentoCorretto) {\n var msg = '[' + jsonLine[\"JTableOrigin\"] + ': Riga ' + (parseInt(jsonLine[\"JRowOrigin\"])+1).toString() + '] ';\n msg += getErrorMessage(ID_ERR_DATIFATTURE_TIPODOCUMENTO_NONAMMESSO);\n msg = msg.replace(\"%1\", jsonLine[\"IT_TipoDoc\"] );\n msg = msg.replace(\"%2\", jsonLine[\"IT_ClienteIDPaese\"] );\n Banana.document.addMessage( msg, ID_ERR_DATIFATTURE_TIPODOCUMENTO_NONAMMESSO);\n }\n\n //IT_Natura\n //N1 esclusa ex art. 15 (bollo, spese anticipate in nome e per conto della controparte, omaggi, interessi moratori, ecc.)\n //N2 non soggetta (Fuori campo IVA/Escluso IVA, codice da utilizzare per i contribuenti minimi e forfettari)\n //N3 non imponibile (esportazione, cessione di beni intra UE)\n //N4 esente (esente art. 10 D.P.R. 633/72) \n //N5 regime del margine / IVA non esposta in fattura ex art. 74-ter\n //N6 inversione contabile (reverse charge)\n //N7 IVA assolta in altro stato UE, vendite a distanza o prestazioni di servizi di telecomunicazioni\n //Il codice natura può essere sovrascritto alla colonna VatExtraInfo oppure dalla colonna Gr1 della tabella codici iva\n jsonLine[\"IT_Natura\"] = '';\n var vatExtraInfo = filteredRows[i].value(\"VatExtraInfo\");\n if (vatExtraInfo.startsWith(\"N\") && vatExtraInfo.length==2) {\n var test = vatExtraInfo.substring(vatExtraInfo,1);\n jsonLine[\"IT_Natura\"] = vatExtraInfo;\n }\n if (jsonLine[\"IT_Natura\"].length<=0) {\n var rowVatCodes = tableVatCodes.findRowByValue('VatCode', vatCode);\n if (rowVatCodes) {\n var vatGr = rowVatCodes.value(\"Gr\");\n var vatGr1 = rowVatCodes.value(\"Gr1\");\n vatGr1 = vatGr1.toUpperCase();\n var rowVatDescription = rowVatCodes.value(\"Description\");\n if (!rowVatDescription)\n rowVatDescription = \"\";\n rowVatDescription = rowVatDescription.toLowerCase();\n rowVatDescription = rowVatDescription.replace(\" \",\"\");\n if (vatGr1 && vatGr1.startsWith(\"N\") && vatGr1.length==2) {\n jsonLine[\"IT_Natura\"] = vatGr1;\n }\n else if (rowVatDescription.indexOf(\"art.15\")>0) {\n jsonLine[\"IT_Natura\"] = 'N1';\n }\n else if (rowVatDescription.indexOf(\"art.74\")>0) {\n jsonLine[\"IT_Natura\"] = 'N5';\n }\n else if (rowVatDescription.indexOf(\"art.7\")>0) {\n jsonLine[\"IT_Natura\"] = 'N3';\n }\n else if (rowVatDescription.indexOf(\"art.3\")>0) {\n jsonLine[\"IT_Natura\"] = 'N1';\n }\n else if (vatGr.indexOf(\"-FC\")>=0) {\n jsonLine[\"IT_Natura\"] = 'N2';\n }\n else if (vatGr.startsWith(\"V-NI\") || vatGr.startsWith(\"A-NI\")) {\n jsonLine[\"IT_Natura\"] = 'N3';\n }\n else if (vatGr.startsWith(\"V-ES\") || vatGr.startsWith(\"A-ES\")) {\n jsonLine[\"IT_Natura\"] = 'N4';\n }\n else if (vatGr.startsWith(\"V-NE\") || vatGr.startsWith(\"A-NE\")) {\n jsonLine[\"IT_Natura\"] = 'N5';\n }\n else if (vatGr.indexOf(\"-REV\")>=0) {\n jsonLine[\"IT_Natura\"] = 'N6';\n }\n }\n }\n\n //Controllo IT_Natura e aliquota\n var aliquota = jsonLine[\"IT_Aliquota\"];\n var imposta = jsonLine[\"IT_IvaContabilizzata\"];\n var msg = '[' + jsonLine[\"JTableOrigin\"] + ': Riga ' + (parseInt(jsonLine[\"JRowOrigin\"])+1).toString() + '] ';\n\n //Se il campo Natura è valorizzato i campi Imposta e Aliquota devono essere vuoti\n //Eccezione: fatture ricevute con natura “N6”: vanno anche obbligatoriamente valorizzati i campi Imposta e Aliquota\n if (jsonLine[\"IT_Natura\"].length>0) {\n if (isSupplier && jsonLine[\"IT_Natura\"] == \"N6\") {\n if (Banana.SDecimal.isZero(aliquota) || Banana.SDecimal.isZero(imposta)) {\n msg += getErrorMessage(ID_ERR_XML_ELEMENTO_NATURA_N6);\n Banana.document.addMessage( msg, ID_ERR_XML_ELEMENTO_NATURA_N6);\n }\n }\n else {\n if (!Banana.SDecimal.isZero(imposta) && !Banana.SDecimal.isZero(aliquota)) {\n msg += getErrorMessage(ID_ERR_XML_ELEMENTO_NATURA_PRESENTE);\n Banana.document.addMessage( msg, ID_ERR_XML_ELEMENTO_NATURA_PRESENTE);\n }\n }\n }\n //Se il campo Natura non è valorizzato, lo devono essere i campi Imposta e Aliquota\n //Controlla solamente registro vendite/acquisti\n else if (jsonLine[\"IT_Registro\"]== \"Acquisti\" || jsonLine[\"IT_Registro\"] == \"Vendite\") {\n if (Banana.SDecimal.isZero(imposta) && Banana.SDecimal.isZero(aliquota)) {\n msg += getErrorMessage(ID_ERR_XML_ELEMENTO_NATURA_NONPRESENTE);\n Banana.document.addMessage( msg, ID_ERR_XML_ELEMENTO_NATURA_NONPRESENTE);\n }\n }\n\n //Corrispettivi\n jsonLine[\"IT_CorrFattureNormali\"] = '';\n jsonLine[\"IT_CorrFattureFiscali\"] = '';\n jsonLine[\"IT_CorrFattureScontrini\"] = '';\n jsonLine[\"IT_CorrFattureDifferite\"] = '';\n jsonLine[\"IT_CorrispettiviNormali\"] = '';\n jsonLine[\"IT_CorrispettiviScontrini\"] = '';\n jsonLine[\"IT_CorrRicevuteFiscali\"] = '';\n jsonLine[\"IT_CorrTotaleGiornaliero\"] = '';\n var contoIvaAssociato = filteredRows[i].value(\"VatTwinAccount\");\n if (contoIvaAssociato.length && vatCode.length) {\n var colonnaCorrispettivi = getColonnaCorrispettivi(contoIvaAssociato);\n if (colonnaCorrispettivi.length) {\n var lordo = Banana.SDecimal.add(filteredRows[i].value(\"JVatTaxable\"), filteredRows[i].value(\"VatAmount\"));\n jsonLine[colonnaCorrispettivi] = lordo;\n jsonLine[\"IT_CorrTotaleGiornaliero\"] = lordo;\n }\n }\n\n //IT_RegistrazioneValida\n //Serve per sapere se la riga IVA è stata inclusa nelle registrazioni clienti/fornitori\n //Quelle scartate verranno segnalate in una tabella di controllo\n jsonLine[\"IT_RegistrazioneValida\"] = '';\n\n //Aggiunge la riga nei parametri\n if (isCustomer) {\n if (!param.customers[accountId].rows)\n param.customers[accountId].rows = [];\n jsonLine[\"IT_RegistrazioneValida\"] = '1';\n param.customers[accountId].rows.push(jsonLine);\n //console.log(jsonLine[\"Description\"]);\n }\n else if (isSupplier) {\n if (!param.suppliers[accountId].rows)\n param.suppliers[accountId].rows = [];\n jsonLine[\"IT_RegistrazioneValida\"] = '1';\n param.suppliers[accountId].rows.push(jsonLine);\n }\n //Write rows for debugging purposes\n /*var jsonString = filteredRows[i].toJSON();\n var jsonObj = JSON.parse(jsonString);\n param.journal.rows.push(jsonObj);*/\n param.journal.rows.push(jsonLine);\n\n }\n \n return param;\n \n}", "title": "" }, { "docid": "40c64eb35594866b357b475927fce746", "score": "0.50348145", "text": "function getItems(invoiceId, setOrderItems, setOrderTotal) {\n getInvoiceItems(invoiceId, setOrderItems, formatOrderItems, setOrderTotal);\n}", "title": "" }, { "docid": "f1202f7197d49802ee3a9fd96e2e7087", "score": "0.5032126", "text": "function loadList() {\n\tvar list = JSON.parse(localStorage.getItem('Lista'));\n\tif (list != null)\n\t\tfor (let i = 0; i < list.length; i++) {\n\t\t\tvar element = new CreateNote(list[i].amount, list[i].product, list[i].color, list[i].key);\n\t\t\tlistNotes.push(element);\n\t\t}\n}", "title": "" }, { "docid": "ff368f1ef8ef45d837ff30ab13f68f56", "score": "0.50265163", "text": "function load() {\n DateFactory.getAllDates()\n .then(data => {\n $scope.dates = data;\n RatingFactory.rateDates(data); // MAGIC, automatically updates $scope.dates\n });\n }", "title": "" }, { "docid": "39b17f30791c2e123d764ca87bbff17e", "score": "0.50243944", "text": "static fetchAll(cb) {\r\n getProductsFromFile(cb);\r\n }", "title": "" }, { "docid": "9ce3d495ae1a98694a2f1073a413393c", "score": "0.50218296", "text": "function loadObject() {\n\t\t\tconsole.log(\"loadObject()\");\n\n\t\t\tif (vm.results.length == 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (vm.selectedIndex < 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tMPAnnotGetAPI.get({key: vm.results[vm.selectedIndex].genotypeKey}, function(data) {\n\t\t\t\tvm.apiDomain = data;\n\t\t\t\tvm.apiDomain.genotypeKey = vm.results[vm.selectedIndex].genotypeKey;\n\t\t\t\tvm.apiDomain.genotypeDisplay = vm.results[vm.selectedIndex].genotypeDisplay;\n\t\t\t\tselectAnnot(0);\n\n\t\t\t\t// create new rows\n \tfor(var i=0;i<5; i++) {\n \taddAnnotRow();\n \t}\n\n\t\t\t}, function(err) {\n\t\t\t\tpageScope.handleError(vm, \"API ERROR: MPAnnotGetAPI.get\");\n\t\t\t});\n\n\t\t}", "title": "" }, { "docid": "647b17802b1e0bd11b9942295b7b10ac", "score": "0.5017461", "text": "function getList() {\n\t\t\tIngredientService.getList($rootScope.userLogin.token, $rootScope.offset).success(function (res) {\n\t\t\t\tres.results.forEach(function(el){\n\t\t\t\t\tel.status = el.status === 0 ? true : false;\n\t\t\t\t});\n\t\t\t\t$rootScope.listData = res.results;\n\t\t\t\t$scope.bigTotalItems = res.count;\n\t\t\t}).error(function (err, status, res) {\n\t\t\t\tif (err.detail){\n toastr.error(err.detail);\n }\n for( var key in err){\n var x = 'err.'+key;\n toastr.error(key.toUpperCase()+\": \"+eval(x)[0]);\n }\n\t\t\t});\n\t\t}", "title": "" }, { "docid": "ce3b65cea85bf0641ee16e4647205e62", "score": "0.5010058", "text": "function loadRecords() {\n var promiseGet = ConfigService.getAllProc(); //The Method Call from service\n promiseGet.then(function (pl) {\n var self = this;\n $scope.Configs = pl.data;\n },\n function (errorPl) {\n $log.error('Error al cargar los datos almacenados', errorPl);\n });\n }", "title": "" }, { "docid": "ba8cae2e54a79d3adbf876ba98d49394", "score": "0.50083447", "text": "function findInvoice(obj) {\n\tvar param='po='+obj.getAttribute('nopo')+'&tipe='+obj.getAttribute('tipe');\n tujuan='keu_slave_vp_po.php?proses=invoice';\n\t\n\tpost_response_text(tujuan, param, respog);\n\t\n\tfunction respog()\n\t{\n\t\tif(con.readyState==4)\n\t\t{\n\t\t\tif (con.status == 200) {\n\t\t\t\tbusy_off();\n\t\t\t\tif (!isSaveResponse(con.responseText)) {\n\t\t\t\t\talert('ERROR TRANSACTION,\\n' + con.responseText);\n\t\t\t\t} else {\n var contPO = document.getElementById('hasilPO'),\n contInvoice = document.getElementById('hasilInvoice');\n contInvoice.innerHTML = con.responseText;\n contInvoice.style.display = \"\";\n contPO.style.display = \"none\";\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbusy_off();\n\t\t\t\terror_catch(con.status);\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "558a4d4bb309efa9ac0775046ab63117", "score": "0.50080466", "text": "loadLists(){\n\n this.getTickets('all');\n this.getTickets('assign-me');\n this.getTickets('no-assign');\n\n setTimeout(()=>{\n this.initTableRowEvents();\n }, 1000);\n }", "title": "" }, { "docid": "b4095510510a5610ad80cc53b4338b71", "score": "0.5003732", "text": "static fetchAll(cb) {\n getProductsFromFile(cb);\n }", "title": "" }, { "docid": "ee0833dd1032f759929a57946514f408", "score": "0.5003539", "text": "async function loadOrders(customer_id = 2, date_ini = '2021-03-19', date_end = '2021-03-19') {\n const data = await fetch(`/orders?customer_id=${customer_id}&date_ini=${date_ini}&date_end=${date_end}`).then(x => x.json());\n const orders = getModelData(data);\n app.orders = orders;\n}", "title": "" }, { "docid": "48f837646232ace5826f69052012b9e3", "score": "0.49990395", "text": "function onReaderLoad(event) {\n var obj = JSON.parse(event.target.result);\n console.log(obj);\n\n insertOrders(obj);\n getOrders(addToDOM);\n }", "title": "" }, { "docid": "20fb2e9e8f0e592cc8e07411319fe59b", "score": "0.49949205", "text": "function findIncidencias(cb){\n Incidencias.find({})\n .populate(\"idTIncidencia\")\n .populate(\"iEmpleado\")\n .exec(function(err, incidencias) {\n if(err)\n cb(true);\n cb(false, incidencias);\n });\n}", "title": "" }, { "docid": "ddbc0d5297e0d28888d1f850d44085f0", "score": "0.49901512", "text": "function buscaLubWithPopulate() {\r\n\t\tLubrificacaoService.getAllWithPopulate()\r\n\t\t\t.success(function(data){\r\n\t\t\t\tvm.dados = data;\r\n\t\t\t})\r\n\t\t\t.error(function(data) {\r\n\t\t\t\tconsole.log(data);\r\n\t\t\t})\r\n\t}", "title": "" }, { "docid": "26a23c368a1f52c17715a292ee995706", "score": "0.49889663", "text": "function loadBooksList($scope) {\n\t\tbookService.list($scope.params, function(books) {\n \t\t\t$scope.books = books;\n\t\t});\n\t}", "title": "" }, { "docid": "6d983f0e342d75b2dbe7fcc4688cb546", "score": "0.49794433", "text": "function findOrdersLineItems() {\n TeamPhunFactory.getOrderLineItem()\n .then(function(response) {\n vm.allOrderLineItems = response;\n return response;\n },\n function(error) {\n console.log(error + \"Unable to load the order line item from the factory to the controller!\");\n });\n }", "title": "" }, { "docid": "82283c05c51823043a3c51fd982477ef", "score": "0.49789405", "text": "function loadBooks() {\n API.getBooks()\n .then(res => setBooks(res.data) )\n .catch(err => console.log(err));\n\n console.log(books);\n }", "title": "" }, { "docid": "35ce9167694cd1b7aa50b674cfd3a620", "score": "0.49728242", "text": "static fetchAll(callback){\n getProductsFromFile(callback)\n }", "title": "" }, { "docid": "b79a729bc76072c55368a5a3e5827fd0", "score": "0.49687344", "text": "function loadList() {\n bindingDirective.loadAll(\n function success() {\n unsetModelHandlers();\n showList();\n setModelHandlers();\n },\n function failure() {\n alert('No se ha podido cargar la lista de ensamblados.');\n }\n );\n }", "title": "" }, { "docid": "eaa09a87fd037bee67504b18e87d289b", "score": "0.49659407", "text": "function populateItems(cb) {\n var url = \"../data/order1.json\";\n $.get(url)\n .done(function(data) {\n console.log(data);\n renderItems(data.order.ordered_items);\n $('#table-num').html( pickATableNumber() );\n if(cb !== undefined) { cb(); }\n })\n .fail(function() {\n alert(\"error retrieving data from the server\");\n });\n }", "title": "" }, { "docid": "5cda37719c62e88909cb0ce022acb583", "score": "0.49642625", "text": "function loadItems() {\n var url = './main';\n var data = null;\n // get the JSON array from the server.\n fetch(url, {\n method: 'GET',\n })\n .then(res => {\n return res.json();\n })\n .then(items => {\n console.log(items);\n // record the item and print to the web page\n if (!items || items.length === 0) {} else {\n listItems(items);\n }\n })\n .catch(err => {\n console.error(err); // print error\n })\n }", "title": "" }, { "docid": "6bb127f5295aa48998a44c56f3a86b59", "score": "0.49627024", "text": "function init() {\n findAllCustomers();\n findAllStoreOwners();\n findAllRegistrationRequests();\n }", "title": "" }, { "docid": "1e08b2a659f85581ec8e5322006e9487", "score": "0.49594977", "text": "function loadProducts() {\n $http.get(\"http://localhost:3000/api/meals\").success(function (offerings) {\n app.offerings = offerings;\n });\n }", "title": "" }, { "docid": "40a9691d190743697ab36269702b2811", "score": "0.4947691", "text": "function getInvitiesList(req, res) {\n if (!req.body.users_id) {\n return res.json(Response(402, \"failed\", constantsObj.validationMessages.requiredFieldsMissing));\n } else {\n var count = parseInt(req.body.count ? req.body.count : 0);\n var skip = parseInt(req.body.count * (req.body.page - 1));\n var sorting = utility.getSortObj(req.body);\n var user_id = req.body.users_id;\n var job_id = req.body.job_id;\n var searchText = decodeURIComponent(req.body.searchText).replace(/[[\\]{}()*+?,\\\\^$|#\\s]/g, \"\\\\s+\");;\n async.waterfall([\n function (callback) {\n JobInvities.getAllInvitesList(user_id, job_id, searchText, skip, count, sorting).then(function (listArr) {\n callback(null, listArr);\n }).catch(function (err) {\n callback(err)\n });\n }\n ], function (err, mainArr) {\n if (err) {\n return res.json(Response(500, \"failed\", constantsObj.validationMessages.internalError, err));\n } else {\n return res.json({\n 'code': 200,\n status: 'success',\n \"message\": constantsObj.messages.dataRetrievedSuccess,\n \"data\": mainArr,\n \"totalLength\": count\n });\n }\n });\n }\n}", "title": "" }, { "docid": "fee48eb49fabaa8e201f744eb75366bb", "score": "0.49452212", "text": "function loadCompanies() {\n xhr.requestCompanies(function(response) { \n var companyMap = {};\n \n response.forEach(function(item){\n var company = new Company(item.id, item.name, item.earnings, item.parent);\n companyMap[item.id] = company; \n }); \n \n companies = new CompanyContainer();\n \n for(key in companyMap) { \n if (companyMap[key].getParentId()) {\n companyMap[companyMap[key].getParentId()].addChildCompany(companyMap[key]);\n } else {\n companies.addChildCompany(companyMap[key])\n }\n }\n \n var $companyList = $(\"#company-list\");\n $companyList.html(\"\");\n var ul = companies.render();\n if (ul) $companyList.append(ul);\n \n });\n }", "title": "" }, { "docid": "0e9783826e4085e4d8d6a4337b74dbea", "score": "0.49366742", "text": "function fetchVoices() {\n if(speech.onvoiceschanged !== undefined) {\n speech.onvoiceschanged = () => renderVoices();\n }\n}", "title": "" }, { "docid": "a5f0597f2984197e9b6279bf2fd77997", "score": "0.493197", "text": "function loadProjects() {\n reviewStudentAppService.loadProjects().then(function (data) {\n data = data.filter(proj=>{\n return proj.owner_email == vm.adminEmail\n })\n console.log(data)\n vm.projects = data;\n for (var i = 0; i < vm.projects.length; i++) {\n for (var x = 0; x < vm.projects[i].members.length; x++) {\n vm.members[x] = [vm.projects[i]._id, vm.projects[i].title, vm.projects[i].members[x], vm.projects[i].members_detailed[x]];\n }\n }\n loadData();\n });\n }", "title": "" }, { "docid": "0407bf74edd2924a4f37cb781794835a", "score": "0.49276477", "text": "getEmployees() {\n API.getEmployees().then(function(res) {\n for (let i = 0; i < res.data.length; ++i) {\n employees.push(res.data[i].EMP_NAME);\n }\n console.log(\"employees table loaded!\");\n });\n }", "title": "" }, { "docid": "d98fec49f23806ca27a6de20acae0550", "score": "0.49257588", "text": "function loadItems(currentPage) {\n var startPage = (currentPage - 1) * itemsPerPage;\n var endPage = startPage + itemsPerPage;\n var itemsToShow = items.slice(startPage, endPage);\n\n $ws.itemsList(itemsToShow, items.length);\n }", "title": "" }, { "docid": "96a7e137ba9d2161330de1895122e5fb", "score": "0.49249476", "text": "load() {\n if (localStorage.contacts !== undefined) {\n // the array of contacts is saved in JSON, let's convert\n // it back to a reak JavaScript object.\n this.contactsList = JSON.parse(localStorage.contacts);\n }\n }", "title": "" }, { "docid": "770f1ed87d2e7f00e6a2cf215860aab7", "score": "0.49215868", "text": "function getProducts() {\n $.get(\"/api/14products\", function(products) {\n initializeRows(products);\n });\n }", "title": "" }, { "docid": "d35a4ff5ba002fb09fd08e3ffbef052c", "score": "0.49167463", "text": "async function getUpcomingInvoice(req, res) {\n try {\n const stripeInvoice = await Stripe.getUpcomingInvoice(\n req.user.organization.stripeCustomerId\n );\n const items = [];\n\n for (let item of stripeInvoice.lines.data) {\n items.push({\n description: item.description\n });\n }\n\n // Return a subset of fields from Stripe's API response\n const invoice = {\n number: stripeInvoice.number,\n next_payment_attempt: stripeInvoice.next_payment_attempt,\n items: items,\n total: stripeInvoice.total\n };\n\n return SendResponse(res, 200, invoice);\n } catch (err) {\n return SendResponse(res, 500, err);\n }\n}", "title": "" }, { "docid": "031aaf28df07bc4f77b16c77d18f9b0a", "score": "0.49146885", "text": "function loadVenues(ids) {\n VENUE_INFO.empty();\n for (let id of ids) {\n $.ajax({\n method: 'GET',\n url: `${VENUES_URL}/venues/${id}`,\n headers: AUTH_HEADERS\n }).then(renderVenue)\n .catch(handleError)\n }\n }", "title": "" }, { "docid": "c05aa584829c6e5a8fb51c37668a23cd", "score": "0.49145356", "text": "function generateInvoice(rowNo)\n{\n var aData = poDataTable.fnGetData(rowNo);\n\n showInvocieFromPO(aData);\n}", "title": "" }, { "docid": "83fe906d2492563db1f5fb9363e7e7b1", "score": "0.49114385", "text": "function loadBooks() {\n API.getBooks()\n .then(res => \n setBooks(res.items)\n )\n .catch(err => console.log(err));\n }", "title": "" } ]
172f7d474740f3a0a992a7d120efec2d
Deletes Sample Data from table
[ { "docid": "657fe21bbddf04c77c826f4908bdb80d", "score": "0.54544014", "text": "function deleteRecord(id) {\r\n var elemIndex = id.split(\"-\")[1];\r\n objs.splice(elemIndex, 1);\r\n sortIfTableSorted();\r\n setTableRows();\r\n createDullDiv();\r\n}", "title": "" } ]
[ { "docid": "b7e778bf8ffbc85a97a4c555ed8117b8", "score": "0.675668", "text": "removeSample() {\n let item = this.getItem(this.cel);\n let id = item.getAttribute('data-uid');\n\n this.removeSampleView(item, id);\n this._removeStoredSample(id);\n }", "title": "" }, { "docid": "082e3b8f7349c2f279bd6f4e3f62ed05", "score": "0.6531247", "text": "function _deselectAllSamples() {\n $window.datatable.clearSelected();\n }", "title": "" }, { "docid": "7474865eb85450943e2947dc17ebe202", "score": "0.65292794", "text": "deleteSample() {\n if (this.state.sampleItems.length) {\n this.api.removeFromCollection('sample_collection', { id: this.state.sampleItems[0].id })\n }\n }", "title": "" }, { "docid": "8ab0ad5262858aa4cedf96b70df76c7e", "score": "0.64877474", "text": "function deleteData() {\n var collCnt = db.crudCollection.count();\n var opCnt = Math.round(getRandom(1, collCnt)/5);\n\n print(\"Deleting \" + opCnt);\n var doc;\n for (var i = 0; i < opCnt; i++) {\n doc = db.crudCollection.findOne();\n db.crudCollection.remove(doc);\n }\n}", "title": "" }, { "docid": "137434d722632a44e3cf59266a0d12b6", "score": "0.6208582", "text": "function cleanseData(table, beforeTimestamp) {\n table.where('timestamp').below(beforeTimestamp).toArray(function(rows) {\n _(rows).forEach(function(row) {\n table.delete(row.id);\n })\n });\n }", "title": "" }, { "docid": "137434d722632a44e3cf59266a0d12b6", "score": "0.6208582", "text": "function cleanseData(table, beforeTimestamp) {\n table.where('timestamp').below(beforeTimestamp).toArray(function(rows) {\n _(rows).forEach(function(row) {\n table.delete(row.id);\n })\n });\n }", "title": "" }, { "docid": "b06da5c8d4e54957069f6adeb9265d9c", "score": "0.61886585", "text": "function deleteRecords() {\n itemOperations.remove()\n printTable(itemOperations.items)\n}", "title": "" }, { "docid": "972c95502345d81dc0170c7d1b2b23b8", "score": "0.6144989", "text": "function Delete() {\n for (let i=1; i<table.rows.length-1; i++) {\n table.rows[i].cells[5].onclick = function() {\n let index = this.parentElement.rowIndex;\n table.deleteRow(index);\n myLibrary.splice(index-1,1);\n saveToLocalStorage();\n }\n }\n}", "title": "" }, { "docid": "e9c08613b6dcda4bb26326c6fe5d0d74", "score": "0.61225104", "text": "function deleteTableRows(tableName) {\n hamsterdb.transaction(function (transaction) {\n var executeQuery = \"DELETE FROM \" + tableName;\n transaction.executeSql(executeQuery, [],\n //On Success\n function (tx, result) { log('Delete successfully'); },\n //On Error\n function (error) { log('Something went Wrong'); });\n });\n}", "title": "" }, { "docid": "f261a10d7717e46d344f01338a6a6f0e", "score": "0.6109624", "text": "function removeDBData(tableName, obj){\n var transaction = window.MutantDB.db.transaction(tableName, 'readwrite');\n var objectStore = transaction.objectStore(tableName);\n objectStore.delete(obj.id);\n}", "title": "" }, { "docid": "f1b27e67f55e56398bc1e2a2dfea6d7f", "score": "0.60917944", "text": "function deleteTable(table){\n db.run(\"DROP TABLE IF EXISTS \" + table);\n }", "title": "" }, { "docid": "e32ff7cf9d90907cd32ca8f69f2d1c3a", "score": "0.6090284", "text": "function deleteInfo() {\n\td3.select(\"tbody\")\n\t\t.selectAll(\"tr\").remove()\n\t\t.selectAll(\"td\").remove();\n}", "title": "" }, { "docid": "b16d5f5a16efe58bcd118c9dc6b1af02", "score": "0.6086265", "text": "function clearTable() {\n console.log(\"Clearing Table\");\n d3.select(\"tbody\")\n .selectAll(\"tr\").remove()\n .selectAll(\"td\").remove();\n }", "title": "" }, { "docid": "b16d5f5a16efe58bcd118c9dc6b1af02", "score": "0.6086265", "text": "function clearTable() {\n console.log(\"Clearing Table\");\n d3.select(\"tbody\")\n .selectAll(\"tr\").remove()\n .selectAll(\"td\").remove();\n }", "title": "" }, { "docid": "aaec5cbf45ea191e724525c33719d63d", "score": "0.60797113", "text": "function deleteTable(){\n\tvar myTable = document.getElementById(\"pixelCanvas\");\n\tvar rowCount = myTable.rows.length;\n\t//alert(rowCount);\n\twhile (rowCount>0) {\n\t myTable.deleteRow(rowCount-1);\n\t rowCount--\n\t}\n}", "title": "" }, { "docid": "431c8d7727bd4347d26df459f03607f4", "score": "0.6015391", "text": "function deleteRecords(){\n\n /**\n * let row = document.createElement(\"tr\");\n let thead = document.createElement(\"th\");\n let tdata1 = document.createElement(\"td\");\n let tdata2 = document.createElement(\"td\");\n let tdata3 = document.createElement(\"td\");\n let tdata4 = document.createElement(\"td\");\n let deleteButton = document.createElement(\"button\");\n */\n\n row.removeChild(thead)\n row.removeChild(tdata1);\n row.removeChild(tdata2);\n row.removeChild(tdata3);\n row.removeChild(tdata4);\n row.removeChild(deleteButton);\n tableBody.removeChild(row)\n\n localStorage.removeItem(data);\n}", "title": "" }, { "docid": "4f044a6e523bce911ec8c978cb1e1fcf", "score": "0.60131675", "text": "deleteTable() {\n this._element.parentNode.removeChild(this._element);\n }", "title": "" }, { "docid": "18523bb4f8a8cbb87e9ffa657bf5ca3e", "score": "0.59900814", "text": "function cleartable(table){\n const tableObject = document.getElementById(table);\n const rowCount = tableObject.tBodies[0].rows.length;\n if (rowCount > 0){\n for (var i=0; i<=rowCount; i++){\n tableObject.deleteRow(0);\n }\n }\n}", "title": "" }, { "docid": "18523bb4f8a8cbb87e9ffa657bf5ca3e", "score": "0.59900814", "text": "function cleartable(table){\n const tableObject = document.getElementById(table);\n const rowCount = tableObject.tBodies[0].rows.length;\n if (rowCount > 0){\n for (var i=0; i<=rowCount; i++){\n tableObject.deleteRow(0);\n }\n }\n}", "title": "" }, { "docid": "12840241bd834d75a78202dc972008d4", "score": "0.59896153", "text": "function pres_clearTable(table, skipHeader) {\n\tvar first = 1;\n\tif (skipHeader == true) {\n\t\tfirst = 0;\n\t}\n\tfor ( var i = table.rows.length - 1; i >= first; i--) {\n\t\ttable.deleteRow(i);\n\t}\n}", "title": "" }, { "docid": "5a37bc4b28cc0fe7a67dc7bd6f7b3fdd", "score": "0.5983988", "text": "tableDelete(){\n\t\t\t// we get first the list of all the rows we want to get rid of\n let list = ISelection;\n\t\t\t\t // then we deal with each one of them\n for(let item of list){\n // get the stored row from the table\n let row= this.getRows.filter(row => row.getId == item)[0];\n // then hide it from the actual table\n row.hideRow();\n // get the index of the row in the stack in table object\n let x = this.getRows.map(row => (row.getId == item)? true:false);\n\t\t\t\t\t\t// we substract it from the stack and save the rest as new one (this helps the economy of the memory)\n this.setRows = deleteFromArray(this.getRows, null, x.indexOf(true)); \n // then clear it from the selection list (ARRAY STACK HEAP !!!! who cares lol) \n ISelection=deleteFromArray(ISelection,item);\n }\n }", "title": "" }, { "docid": "c4cb5ba49fe2c88427a5620afd6a881b", "score": "0.59623975", "text": "function deletePDFTableRecords() {\n d3.json(\"service/deletePDFTable\", function (error, texts) {\n console.log('deleted PDF Table records');\n });\n}", "title": "" }, { "docid": "e48ba1fa0702175ae7cbf138a1c03be8", "score": "0.5953928", "text": "function clearTable(table,table_size) {\n\n for (var i=0; i < table_size - 1; i++) {\n table.deleteRow(0);\n \n }\n}", "title": "" }, { "docid": "b131ff992fc6fa2d6735ede2bc20bc44", "score": "0.5945282", "text": "function deleteRow(btn) {\n var row = btn;\n var indexToDelete = row.rowIndex - 1;\n\n console.log(\"indexToDelete value: \" + indexToDelete);\n document.getElementById(\"tableJS\").deleteRow(row.rowIndex);\n storeData.splice(indexToDelete, 1); //remove object from storeData\n}", "title": "" }, { "docid": "295b8254b3d909c66b6c07b2a8bedb15", "score": "0.5930466", "text": "function wellTableDelete(wellToDelete, callBack) {\n\tfor (i = 0; i < wellToDelete.length; i++) {\n\t\tvar j = i;\n\t\tdb.query(`DELETE FROM well_testing WHERE wellBarcode=\"` + wellToDelete[j].wellBarcode + `\" AND poolBarcode=\"` + wellToDelete[j].poolBarcode + `\";`);\n\t\tdb.query(`DELETE FROM well WHERE wellBarcode=\"` + wellToDelete[j].wellBarcode + `\";`);\n\t}\n\tcallBack();\n}", "title": "" }, { "docid": "2f5c57d5b3cc48b4877c73f535f3041a", "score": "0.5912244", "text": "async deleteEntry(table, idColumnName, idValue) {\n return await this.query('DELETE FROM ?? WHERE ??=?', [table, idColumnName, idValue]);\n }", "title": "" }, { "docid": "16504a82ae6202602154e298f12c40f7", "score": "0.5911836", "text": "function clear_table() {\n var temp_tr = d3.selectAll(\".temp-tr\").remove();\n}", "title": "" }, { "docid": "aba5b8034ae7cdf1a7658e6609ebea5b", "score": "0.58860356", "text": "function deleteTable(tableName) {\n document.getElementById(tableName).remove();\n }", "title": "" }, { "docid": "0aa8c813748ed00c22e40d80a43a6739", "score": "0.5869884", "text": "function clearTable(){\n\tfor (var i = table.rows.length - 1; i > 0; i--) {\n\t\ttable.deleteRow(i);\n\t}\n}", "title": "" }, { "docid": "2d995402906d9df72709b1d36d900b1b", "score": "0.58488536", "text": "function deleteOldSkill() {\n\tdocument.getElementById('skills-table').deleteRow(3);\n}", "title": "" }, { "docid": "df8df3301e51e94e6364ed259d509806", "score": "0.5845961", "text": "deleteAll() {\n data.histories.length = 0;\n }", "title": "" }, { "docid": "bcfdaae280dd11ab5e7a2a34f39cd50a", "score": "0.58331", "text": "function cleanTable() {\n if (carTable) {\n\tcarTable.remove();\n }\n if (trainTable) {\n\ttrainTable.remove();\n }\n\n}", "title": "" }, { "docid": "b17d862a9111ed2d3ae3aeb04cf3c766", "score": "0.57943326", "text": "function deleteTableData(query) {\n\n var deferred = $q.defer();\n WebSqlDb(query, []).then(function (res) {\n\n deferred.resolve(res);\n }, function (err) {\n deferred.reject(err);\n\n });\n return deferred.promise;\n }", "title": "" }, { "docid": "e3957b319d2e23657fe5ee1c0bf40952", "score": "0.5793948", "text": "function clearDiffTable() {\n var tableEl = document.getElementById(\"diffTable\");\n var allrows = tableEl.rows;\n var l = allrows.length;\n for(var i=0; i < l; i++) {\n tableEl.deleteRow(0);\n }\n}", "title": "" }, { "docid": "125a704a18ae62573774285eda912b75", "score": "0.57912767", "text": "function deleteTbody() {\n d3.select(\"tbody\")\n .selectAll(\"tr\").remove()\n .selectAll(\"td\").remove();\n }", "title": "" }, { "docid": "5699c1cd5554ab11824a9acbd494b5c7", "score": "0.57857066", "text": "function clearTable() {\n var tableHeaderRowCount = 1;\n var table = document.getElementById('table');\n var rowCount = table.rows.length;\n for (var i = tableHeaderRowCount; i < rowCount; i++) {\n table.deleteRow(tableHeaderRowCount);\n }\n}", "title": "" }, { "docid": "d3df5f785e0a7e3e6bd9d4bed07567c2", "score": "0.57796293", "text": "function runClear() {\n // clear out the previous table\n tbody.selectAll(\"tr\").remove();\n // Fill the table\n FillTable(tableData);\n}", "title": "" }, { "docid": "f9fcb27c9f4b5b71571022bb96a10964", "score": "0.57467633", "text": "function deleteRows(){\n for(let i = 0; i<rowCount; i++){\n document.getElementById(\"myTable\").deleteRow(1);\n }\n rowCount = 0;\n}", "title": "" }, { "docid": "8ec658680d8299dfbcc1f0cf093a4890", "score": "0.57334024", "text": "function deleteTbody() {\n d3.select(\"tbody\")\n .selectAll(\"tr\").remove()\n .selectAll(\"td\").remove();\n}", "title": "" }, { "docid": "8ec658680d8299dfbcc1f0cf093a4890", "score": "0.57334024", "text": "function deleteTbody() {\n d3.select(\"tbody\")\n .selectAll(\"tr\").remove()\n .selectAll(\"td\").remove();\n}", "title": "" }, { "docid": "f2268c45fea0854df1e27b58612a2449", "score": "0.572536", "text": "function deleteTableRow(table) {\n if(table.childElementCount > 1) table.removeChild(table.children[1]);\n }", "title": "" }, { "docid": "53d1cda971d92a834cea4769c09f9254", "score": "0.5686676", "text": "function deleteRow1(){ \t \t\n \ttbl.deleteRow(1);\n \t}", "title": "" }, { "docid": "17bff2fbfd9ddf024187c6973d0b651b", "score": "0.56679446", "text": "dropTable() {\n this.client.query(\"DROP TABLE gifs\");\n }", "title": "" }, { "docid": "264b73958d6c477530d9a03b410b2737", "score": "0.566372", "text": "static async deleteTable() {\n return await delete_table_1.deleteTable(this.schema);\n }", "title": "" }, { "docid": "4b6b674764baca95c38e695fed1f908c", "score": "0.5659162", "text": "function cleanSkillTable() {\n queryStmts('Drop TABLE Skill', 'DELETE FROM `sheets` WHERE Name = \"Skill\"');\n}", "title": "" }, { "docid": "8371fe67cd439af4d45cc513ccb7fc56", "score": "0.56438965", "text": "function deleteTable() {\n $(\"div.row\").remove();\n}", "title": "" }, { "docid": "8c9b0611841097e47ccee09f041c907d", "score": "0.56390315", "text": "function clearTableExceptHeader(table) {\r\n\twhile (table.rows.length > 1) {\r\n\t\ttable.deleteRow(1);\r\n\t}\r\n}", "title": "" }, { "docid": "07554b8c42468967d289a59c2a80ff37", "score": "0.5612448", "text": "function removeTable() {\n var Parent = document.getElementById(\"main_data_table\");\n while(Parent.hasChildNodes()) {\n Parent.removeChild(Parent.firstChild);\n }\n }", "title": "" }, { "docid": "87c75413ab95c6e0c2fa299da452c25e", "score": "0.5612403", "text": "function deleteTest() {\n// Add some data in order to test delete//\n todo.add('Delete Me');\n// Assert data was added correctly //\n assert.equal(todo.getCount(), 1, '1 item should exist');\n// Delete all the records //\n todo.deleteAll();\n// Assert record was deleted //\n assert.equal(todo.getCount(), 0, 'No items should exist');\n// Note that test has completed //\n testsCompleted++;\n}", "title": "" }, { "docid": "874c1242bc7d106fa93fcc8fcce42824", "score": "0.56020415", "text": "deleteRecord(row) {\r\n // const { id } = row;\r\n // const index = this.findRowIndexById(id);\r\n // if (index !== -1) {\r\n // this.records = this.records\r\n // .slice(0, index)\r\n // .concat(this.records.slice(index + 1));\r\n // }\r\n }", "title": "" }, { "docid": "8cf5749821a34c65dfccc0cd320f4860", "score": "0.5601972", "text": "function deleteAllRecords() {\n // on ouvre la base, et on déclare les listeners\n var request = indexedDB.open(\"BDFlux\", 1);\n request.onerror = errorOpen;\n request.onupgradeneeded = createDatabase;\n\n request.onsuccess = function(event) {\n var db = event.target.result;\n\n // on ouvre une transaction qui permettra d'effectuer la suppression\n var transaction = db.transaction([\"table_flux\"], \"readwrite\");\n transaction.oncomplete = function(event) {displayList(db);};\n transaction.onerror = function(event) {\n window.alert('erreur de transaction suppression');\n };\n\n var fluxStore = transaction.objectStore(\"table_flux\");\n var req = fluxStore.clear();\n req.onsuccess = function(event) {\n }\n req.onerror = function(event) {\n window.alert('erreur suppression');\n }\n }\n}", "title": "" }, { "docid": "64c904f84f864dc201429a8a31b9f186", "score": "0.55885845", "text": "function clearTable() {\n let tableDiv = document.getElementById(\"virus-table\");\n tableDiv.parentNode.removeChild(tableDiv);\n}", "title": "" }, { "docid": "198e8c693ab4361247039e9ab18c92d6", "score": "0.5577512", "text": "function fDelete(id){\n \n console.log(`Id ${id} removido!`)\n\n delete db_data[id]\n\n fSyncData()\n \n}", "title": "" }, { "docid": "eeaa39d9381546c41e3330a66f972c38", "score": "0.5574314", "text": "function deleteSubTable(numClass){\n var classesArray= Object.entries(capTableData.classes);\n var seriesArray=Object.entries(classesArray[numClass][1]);\n\n nameClass=classesArray[numClass][0];\n\n $('#'+nameClass+'-table').html(''); \n}", "title": "" }, { "docid": "998e1d18a9f129ab86db9429f1d37e91", "score": "0.5570423", "text": "function delPerson (config, table, key, name) {\n\n const knex = require('knex')({\n client: 'pg',\n connection: config\n });\n\n knex(table).where(key, name)\n .del().asCallback(function (err, rows) {\n if (err) console.log(err);\n knex.select().from('famous_people')\n .asCallback(function (err, rows) {\n if (err) console.error(err);\n console.log(rows);\n });\n });\n}", "title": "" }, { "docid": "56cec707859d2480bd30a39954da8ccc", "score": "0.55622476", "text": "function deleteSamples(delType, evCounter, letter, contCounter) {\n\tvar tempKey=\"\";\n\t//var letter = String.fromCharCode(letterCtr);\n\tvar moreSets = true;\n\tvar moreCountainers = true;\n\tvar counter = 0;\n var ii=0;\n\tswitch (delType) {\n\t case '0': //del one sample - group (single)\n\t\t\ttempKey = '!C&'+evCounter + '&'+letter+'&' + contCounter;\n \n\t\t for (i=0; i< ls.length; i++) {\n\t\t\t if (ls.key(i).indexOf(\"!C&\"+evCounter + '&'+letter)!== -1) {\n\t\t\t\t\t counter++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (counter > 1) {\n\t \t\t\tif (tempKey in ls) {\n\t\t\t\t\tls.removeItem(tempKey);\n\t\t\t\t\tconsole.log('Deleting sample: ' +tempKey );\n\t\t\t\t\t//createCurrentSets(evCounter,'single');\n\t\t\t\t}\n\t\t\t } else {\n\t\t\t\t alert(\"groups can not be empty. Please delete the group instead\");\n\t\t\t }\t\t\t\n\t\t//sampleLabel'+stctr+letter+counter\n\t\t\n\t\t//addsamplesCounter'+eventKey.split('&')[1]+'A\"\n\t\t\tvar ttt = $('#addsamplesCounter'+evCounter+letter).val();\n\t\t\tif (ttt != 1) { \n\t\t\t\t$('#addsamplesCounter'+evCounter+letter).val(ttt-1);\n\t\t\t\t$('#sampleLabel'+evCounter+letter+contCounter).remove();\n\t\t\t}\n\t \tbreak;\n\t case '1': //del sample - Set\n\t\t for (i=0; i< ls.length; i++) {\n\t\t\t if (ls.key(i).indexOf(\"!S&\"+evCounter)!== -1) {\n\t\t\t\t\t counter++;\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t\tif (counter > 1) {\n\t\t\t\t for (var key in ls) {\n\t\t \t//for (i=0; i< ls.length; i++) {\n\t\t\t \tif (key.indexOf(\"!C&\"+evCounter + '&'+letter)!== -1) {\n\t\t\t\t\t console.log(\"deleting container: \"+key);\n\t\t\t\t\t ls.removeItem(key);\n\t\t\t\t\t}\t\n\t\t\t \tif (key.indexOf(\"!S&\"+evCounter + '&'+letter)!== -1) {\n\t\t\t\t\t console.log(\"deleting group/set: \"+key);\n\t\t\t\t\t ls.removeItem(key);\n\t\t\t\t\t}\t\n\t\t\t\t\tcreateCurrentSets(evCounter,'MULT');\n\t\t\t\t}\n\t\t\t } else {\n\t\t\t\t alert(\"event can not be without sets/group. Please delete the event instead\");\n\t\t\t }\t\n\t \tbreak;\t\t\n\t\t\t\n\t case '2':\t//del Event Single\t \n\t\t for (var key in localStorage) {\n\t\t\t if (key.indexOf(\"!C&\"+evCounter)!== -1) {\n\t\t\t\t\t console.log(\"deleting container: \"+key);\n\t\t\t\t\t ls.removeItem(key);\n\t\t\t\t}\n\t\t\t if (key.indexOf(\"!S&\"+evCounter)!== -1) {\n\t\t\t\t\t console.log(\"deleting group/set: \"+key);\n\t\t\t\t\t ls.removeItem(key);\n\t\t\t\t}\t\n\t\t\t if (key.indexOf(\"!E&\"+evCounter)!== -1) {\n\t\t\t\t\t console.log(\"deleting event: \"+key);\n\t\t\t\t\t ls.removeItem(key);\n\t\t\t\t}\t\t\t\t\t\t\t\n\t\t\t}\n\t\t\t$('#currentButton').click();\n\t \tbreak;\t\n\t}\n\t\n}", "title": "" }, { "docid": "08db4923b98784f7b1078ce5adc590ae", "score": "0.55576146", "text": "function tableDelete(name) {\n localStorage.removeItem(tableGetStorageName(name));\n}", "title": "" }, { "docid": "498bd89ac5adefb6596a319657204bad", "score": "0.555461", "text": "delete() {\n if (F.alse())\n this.unsafemp.delete(); // just to trigger errors if the source is modified\n this.pendingChanges.add('delete', [true]);\n }", "title": "" }, { "docid": "5be00b7042828dea04dd35e8317a2c94", "score": "0.5549145", "text": "function deleteRow() {\r\n document.getElementById(\"main-table\").deleteRow(0);\r\n}", "title": "" }, { "docid": "55c47a1039b164c384cebcf4bfc6cd9b", "score": "0.55490726", "text": "function deleteTable() {\n for (var i = document.getElementById(\"myTable\").rows.length - 1; i > 0; i--) {\n document.getElementById(\"myTable\").deleteRow(i);\n }\n}", "title": "" }, { "docid": "bd9eeeadd501234a5fc265f0c96042ee", "score": "0.55386037", "text": "function deleteData(tableId, id){\n var deleteItem = \"delete\" + id;\n\tvar table = document.getElementById(\"exerciseTable\");\n\tvar numRows = table.rows.length;\n\n\t//loop through the table to find the row to delete\n\tfor(var i = 1; i < numRows; i++){\n\t\tvar row = table.rows[i];\n\t\tvar findData = row.getElementsByTagName(\"td\");\n var erase = findData[findData.length -1];\n //delete if match\t\t \n\t\tif(erase.children[1].id === deleteItem){\n\t\t\ttable.deleteRow(i);\n\t\t}\n\n\t}\n\n\tvar req = new XMLHttpRequest();\n\t\n //open request to delete data\n\treq.open(\"GET\", \"/delete?id=\" + id, true);\n\n\treq.addEventListener(\"load\",function(){\n //if request is successfull print a simple message or error if not\n\t\tif(req.status >= 200 && req.status < 400){\n\t \tconsole.log('success');\n\t\t} else {\n\t\t console.log('error');\n\t\t}\n\t});\n\n //send it\n\treq.send(\"/delete?id=\" + id);\n\n}", "title": "" }, { "docid": "553b625c4449462bb49b58cc3950944c", "score": "0.5538358", "text": "function characterdatadeletedatamiddle() {\n var success;\n if(checkInitialization(builder, \"characterdatadeletedatamiddle\") != null) return;\n var doc;\n var elementList;\n var nameNode;\n var child;\n var childData;\n \n var docRef = null;\n if (typeof(this.doc) != 'undefined') {\n docRef = this.doc;\n }\n doc = load(docRef, \"doc\", \"staff\");\n elementList = doc.getElementsByTagName(\"address\");\n nameNode = elementList.item(0);\n child = nameNode.firstChild;\n\n child.deleteData(16,8);\n childData = child.data;\n\n assertEquals(\"characterdataDeleteDataMiddleAssert\",\"1230 North Ave. Texas 98551\",childData);\n \n}", "title": "" }, { "docid": "e9191492fa723b1d06207f6ea4768c48", "score": "0.553066", "text": "function deleteData() {\n MongoClient.connect(url, function (err, client) {\n assert.equal(null, err);\n var db = client.db(dbName);\n db.collection(collectionName).deleteOne({\n session_id: '6ad6ce06-8471-47db-b930-dbee490131be'\n }, function (err, res) {\n assert.equal(null, err);\n console.log(\"Item deleted\");\n client.close();\n });\n });\n}", "title": "" }, { "docid": "e55a8fce9026a591d667d8804380eb47", "score": "0.55288243", "text": "function deletePokemonFromTableAndDB(event) {\n const element = event.target;\n event.preventDefault();\n deletePokemon(element.attributes[\"data-id\"].value);\n const row = element.parentNode.parentNode;\n row\n .parentNode\n .removeChild(row);\n}", "title": "" }, { "docid": "e095bf29e546012ef8bafec91a748c90", "score": "0.5528295", "text": "delete(type, id) {\n console.log('Deleting ' + type + ' with ID: ' + id);\n this.typeToTable(type).delete(id);\n this.storeTable(type);\n }", "title": "" }, { "docid": "6565aa4ae484c5d031815f26de527017", "score": "0.5525798", "text": "static async delete({ database }) {\n database.query(\"DELETE * FROM WAIFUS\");\n }", "title": "" }, { "docid": "81ac8c54ce7ea577d89cde5fd9129ea8", "score": "0.5525474", "text": "function deleteAll(idToDel){\n rowsGoles.splice(0,rowsGoles.length);\n mostrarTabla();\n }", "title": "" }, { "docid": "c7c0ac3cff7daeeb2752f2761dbe45ee", "score": "0.5522465", "text": "function deleteLastRow(){\n var deleteLastRow = tableData.rows.length;\n tableData.deleteRow(deleteLastRow - 1);\n \n }", "title": "" }, { "docid": "8271921f3f1199fb11d2a518e9ddd678", "score": "0.5510652", "text": "async function removeTable() {\n \n const Table = Parse.Object.extend(\"Table\");\n const query = new Parse.Query(Table)\n query.equalTo(\"qrCodeValue\", deleteTable.tableId)\n\n const chosenTable = await query.find(); \n console.log(chosenTable[0])\n chosenTable[0].destroy().then((table) => {\n console.log(table + \" is destroyed\")\n res.send({ msg: \"table is destroyed\" })\n }, (error) => {\n console.log(error)\n res.send({ msg: \"error\" })\n });\n\n }", "title": "" }, { "docid": "7654da1fec8c0041ce5831f90996ca02", "score": "0.5508712", "text": "static clearTable(){\n const tbody= App.tableBody;\n\n while(tbody.firstChild) {\n tbody.removeChild(tbody.firstChild);\n }\n }", "title": "" }, { "docid": "a7510073be8e8015c88bfe5d6c64fb45", "score": "0.55012864", "text": "function clearTable() {\r\n try {\r\n dbprod.execute('drop table if exists Items');\r\n dbprod.execute('create table if not exists Items (CodProd integer unique, DescProd text, PrecProd numeric)');\r\n //var rs = dbprod.execute('select * from Items');\r\n //populateTable(rs);\r\n var rsCount = dbprod.execute('select count(*) from Items');\r\n if (rsCount.isValidRow()) {\r\n if (rsCount.field(0) > 0){\r\n nRecords = (rsCount.field(0) - 1);\r\n }\r\n }\r\n rsCount.close();\r\n Pager(tableName,itemsPerPage);\r\n init(nRecords);\r\n showPageNav('pageNavPosition');\r\n showPage(1);\r\n }\r\n catch (e) {\r\n alert(e);\r\n }\r\n}", "title": "" }, { "docid": "9a454dcde3f35dadccd3f60edded1745", "score": "0.5500302", "text": "function removeRow(delButton){\n const rowIndex = delButton.parentNode.parentNode.rowIndex;\n document.getElementById(\"table\").deleteRow(rowIndex)\n\n//Finds corresponding Book object in library and deletes it\n for (i = 0; i < library.length; i++){\n if (library[i].entryID == delButton.parentNode.parentNode.getAttribute(\"data-id\")){\n library.splice(i, 1)\n }\n }\n}", "title": "" }, { "docid": "b882bbf06f14fe2abba719773ccd55bd", "score": "0.5499177", "text": "function removeTable() {\n $(\"#pixelCanvas\").empty();\n }", "title": "" }, { "docid": "376eb227c7d09c9e907d288864c7b9bf", "score": "0.5490768", "text": "function hc_characterdatadeletedatabegining() {\n var success;\n if(checkInitialization(builder, \"hc_characterdatadeletedatabegining\") != null) return;\n var doc;\n var elementList;\n var nameNode;\n var child;\n var childData;\n \n var docRef = null;\n if (typeof(this.doc) != 'undefined') {\n docRef = this.doc;\n }\n doc = load(docRef, \"doc\", \"hc_staff\");\n elementList = doc.getElementsByTagName(\"acronym\");\n nameNode = elementList.item(0);\n child = nameNode.firstChild;\n\n child.deleteData(0,16);\n childData = child.data;\n\n assertEquals(\"data\",\"Dallas, Texas 98551\",childData);\n \n}", "title": "" }, { "docid": "f21285cab79c52919b1d63a9d79b1a90", "score": "0.5487627", "text": "function tableclear() {\n let rows = document.querySelector(\"tbody\");\n //Smart way to delete rows ;D\n while (rows.rows[0])\n rows.deleteRow(0);\n}", "title": "" }, { "docid": "0c8af6b212213ab92bfdc6bcbfc054df", "score": "0.54749525", "text": "function characterdatadeletedatabegining() {\n var success;\n if(checkInitialization(builder, \"characterdatadeletedatabegining\") != null) return;\n var doc;\n var elementList;\n var nameNode;\n var child;\n var childData;\n \n var docRef = null;\n if (typeof(this.doc) != 'undefined') {\n docRef = this.doc;\n }\n doc = load(docRef, \"doc\", \"staff\");\n elementList = doc.getElementsByTagName(\"address\");\n nameNode = elementList.item(0);\n child = nameNode.firstChild;\n\n child.deleteData(0,16);\n childData = child.data;\n\n assertEquals(\"characterdataDeleteDataBeginingAssert\",\"Dallas, Texas 98551\",childData);\n \n}", "title": "" }, { "docid": "849d085d7ecc539bac0a0a9f2ad30c40", "score": "0.546881", "text": "deleteRow(state, rowIndex) {\n state.currentQuestionInfo.rows.splice(rowIndex, 1);\n }", "title": "" }, { "docid": "11ff5604d52e99d1aced4ec6d80cf91c", "score": "0.546415", "text": "function deleteGame(tableData) {\n axios\n .post('/api/game/delete', tableData)\n .then(response => {\n createGame();\n })\n .catch(error =>\n console.log(error)\n );\n }", "title": "" }, { "docid": "d28c68892947ab61f512201dab4b13ea", "score": "0.54611284", "text": "function deleteRow(studentId)\n{\n sendCommand(\"remove&studentId=\" + studentId); \n}", "title": "" }, { "docid": "fd7671cdde5b4dd45955c4432f030b85", "score": "0.54587567", "text": "async function removeDataFromDb(event) {\n const rowElemId = +event.target.attributes.id.value;\n const res_ = await fetch(`/api/db:${rowElemId}`, {\n method: \"DELETE\"\n });\n\n if (res_.ok) {\n console.log('Fetch (DELETE) request success!');\n delete dataFromDB[rowElemId];\n renderDbData();\n } else\n console.log('Fetch (DELETE) request error!');\n}", "title": "" }, { "docid": "9948f4f8cdc0edc88fc2355abba479fd", "score": "0.54576874", "text": "function clearTable()\n{\n var table = document.getElementById('searchResults');\n var rowCount = table.rows.length;\n for (var i = 0; i < rowCount; i++) {\n table.deleteRow(0);\n }\n}", "title": "" }, { "docid": "253ad0ecc87a2c2e5abfd2324dafa0fa", "score": "0.5450148", "text": "function deleteGrid() {\r\n pixelTable.children().remove();\r\n}", "title": "" }, { "docid": "e321a924bddd343cbead2abb9f01894c", "score": "0.5445469", "text": "function deleteSymbol(){\n document.getElementById(\"rtSymbolsTbl\").deleteRow(rows-1);\n rows--;\n}", "title": "" }, { "docid": "2ae92a33d91c6436d06b622d21ae8758", "score": "0.5426552", "text": "function remove_student(event){\n let row = $(event.target).parent();\n row = row[0].rowIndex;\n student_array.splice(row-1, 1);\n update_data();\n}", "title": "" }, { "docid": "41b366d537c4aee563d7d905fe88147d", "score": "0.54238206", "text": "function removeTable() {\n\tvar currentTable = document.getElementById('tbl');\n\twhile ( currentTable.rows.length > 0 ) {\n\t\tcurrentTable.deleteRow(0);\n\t}\n}", "title": "" }, { "docid": "647ebf171511b2f7b7a65e973e25b59f", "score": "0.5423205", "text": "function deleteInTable(json) {\n\n let buttonDel = document.querySelector(\".btn-deleted\");\n let input = document.querySelector(\".deleted__num\");\n let tbody = document.querySelector('tbody');\n\n buttonDel.addEventListener(\"click\", deleteRow);\n\n function deleteRow() {\n let rowNum = input.value;\n if (!rowNum) return;\n delete json.data[rowNum];\n tbody.innerHTML = \"\";\n addinTable(Object.values(json.data));\n // JSON.stringify(json);\n // getData();\n };\n\n }", "title": "" }, { "docid": "effba8b348b832fe68305b9cd22ef218", "score": "0.5422714", "text": "function deleteTable() {\r\n let deleteTable = document.getElementById('tableA');\r\n let parentEl = deleteTable.parentElement;\r\n parentEl.removeChild(deleteTable);\r\n}", "title": "" }, { "docid": "68e58d0f45110596a732ca9a6ad75c72", "score": "0.5418153", "text": "async deletePointsTableByID(ctx) {\n let id = ctx.params.id;\n await Model.points\n .deleteOne({ _id: id })\n .then(result => {\n if(result.deletedCount > 0) { ctx.body = \"Delete Successful\"; }\n else { throw \"Error deleting point\"; }\n })\n .catch(error => {\n throw new Error(error);\n });\n }", "title": "" }, { "docid": "98f50ff65d358dccd2bc134f077e31db", "score": "0.5416455", "text": "async clear() {\n const table = await this.viewer.getTable();\n await table.clear();\n }", "title": "" }, { "docid": "8d7092e9b87fe8ded9547fb0ca9cbf98", "score": "0.5407685", "text": "function deleteData(){\n\t$(\"#del-btn\").click(function(e){\n\t\tvar url = \"ServletDbController\";\n\t\tvar id = $(\"#id-input\").val();\n\t\tvar query = \"delete\";\n\t\tvar param = {\n\t\t\t\tidInput : id,\n\t\t\t\toperationType : query\n\t\t};\n\t\t$.post(url,param,function(){\n\t\t\tgetAllData();\n\t\t\t$(\"#id-input\").val('').attr(\"disabled\",false);\n\t\t});\n\n\t})\n}", "title": "" }, { "docid": "555be41bc425e9f8a4783df7618db8c8", "score": "0.5404108", "text": "function deleteEmployee (row) {\n\n //get the employees array index from the row id and remove the employee from the array\n let employeeIndex = Number(row.prop('id').slice(6)); //removes empRow and converts to a number\n employees.splice(employeeIndex, 1);\n\n //delete the row from the table on the DOM\n $(row).remove();\n}", "title": "" }, { "docid": "86761b73c85dbe6e1a44d6c04c1806ef", "score": "0.54039216", "text": "function DeleteEntries()\n {\n var query;\n // Error trapping in the simplest form\n try\n {\n // optimally you will know which items you want to delete from the database\n // using the following code and the record ID, you can delete the entry\n //-----------------------------------------------------------------------\n // query = \"DELETE FROM demo_table WHERE iddemo_table=?UID\";\n // MySqlParameter oParam = cmd.Parameters.Add(\"?UID\", MySqlDbType.Int32);\n // oParam.Value = 0;\n //-----------------------------------------------------------------------\n query = \"DELETE FROM demo_table WHERE iddemo_table\";\n if (con.State.ToString() != \"Open\")\n con.Open();\n \n var cmd = new MySql.Data.MySqlClient.MySqlCommand(query, con);\n cmd.ExecuteNonQuery();\n }\n catch (ex)\n {\n Debug.Log(ex.ToString());\n }\n }", "title": "" }, { "docid": "43f76f18df1282b0f1afc6f0410d8a51", "score": "0.53955716", "text": "function clear_data(){\r\n for (var member in wordTable){\r\n delete wordTable[member];\r\n }\r\n input_txt = \"\";\r\n}", "title": "" }, { "docid": "3dfef12cb91fc547cdf1133f27ade0ef", "score": "0.53935945", "text": "async deleteAllTestCases() {\n let res = await axios.delete(`http://${this.host}:${this.port}/ts/testcase`);\n return res.data;\n }", "title": "" }, { "docid": "221d2f76f292cb76c695ef8a42b0f46c", "score": "0.53864586", "text": "del() {\n // Make sure tableName is processed by the formatter first.\n const { tableName } = this;\n const withSQL = this.with();\n const wheres = this.where();\n return (\n withSQL +\n `delete from ${this.single.only ? 'only ' : ''}${tableName}` +\n (wheres ? ` ${wheres}` : '')\n );\n }", "title": "" }, { "docid": "f597cf855c252810c297bfe2d25c94c4", "score": "0.53861773", "text": "function deleteTableData(query) {\n\n var deferred = $q.defer();\n $cordovaSQLite.execute(db, query, []).then(function(res) {\n deferred.resolve(res);\n }, function(err) {\n deferred.reject(err);\n });\n return deferred.promise;\n }", "title": "" }, { "docid": "d522e7b0078d0c29205d7ef52931a69b", "score": "0.5383237", "text": "function clearTable(tableData){\n d3.json('./static/cumProd.json').then((data) => {\n tableData = data;\n tbody = d3.select(\"tbody\");\n tbody.html(\"\");\n tableData.forEach((well) => {\n let row = tbody.append(\"tr\");\n Object.values(well).forEach((val) => {\n let cell = row.append(\"td\");\n cell.text(val);\n //CODE TO RESET DROPDOWN i.e. CLEAR SELECTION\n var dropDown = document.getElementById(\"siteFilter\"); \n dropDown.selectedIndex = 0\n })})})}", "title": "" }, { "docid": "19a470487ea63dd6870fafb037dd4c92", "score": "0.5381429", "text": "function EliminarListaProductos(tx) {\n tx.executeSql('DELETE FROM productos');\n}", "title": "" }, { "docid": "c8b84cf658172201706cbd7269c6ae91", "score": "0.5380654", "text": "function clearCart() {\n table.removeRows;\n}", "title": "" }, { "docid": "4a38edfd72020ce4977a11205901af42", "score": "0.5376332", "text": "function deleteARow(id) {\n var req = new XMLHttpRequest(); \n var payload = {}\n payload.id = id \n\n var table = document.getElementById(\"table\")\n rowNumber = table.rows.length;\n\n //table.deleteRow(id)\n\n //row_to_delete = table.getElementById(id)\n //table.deleteRow(row_to_delete)\n\n req.open('DELETE', url, true); \n req.setRequestHeader(\"Content-type\", \"application/json\"); \n req.addEventListener('load', function() {\n if (req.status >= 200 && req.status < 400) {\n var response = JSON.parse(req.responseText); \n\n table.deleteRow(id)\n //response.id = id\n\n //var data = response.results\n //console.log(\"Here's print data number 1: \")\n //console.log(data)\n \n // Write a function to create a table and call that function here\n //createTable(data); \n\n } else {\n console.log(\"Error in network request: \" + req.statusText);\n }\n });\n req.send(JSON.stringify(payload));\n event.preventDefault()\n}", "title": "" } ]
93c30e97e61f68c18b3400686bfb2e4e
Set ups the lighting in the scene.
[ { "docid": "76569fc92e44d04a001df73e9f7c0814", "score": "0.8089877", "text": "function lightingSetUp(){\n\n keyLight = new THREE.DirectionalLight(0xFFFFFF, 1.0);\n keyLight.position.set(3, 10, 3).normalize();\n keyLight.name = \"Light1\";\n\n fillLight = new THREE.DirectionalLight(0xFFFFFF, 1.2);\n fillLight.position.set(0, -5, -1).normalize();\n fillLight.name = \"Light2\";\n\n backLight = new THREE.DirectionalLight(0xFFFFFF, 0.5);\n backLight.position.set(-10, 0, 0).normalize();\n backLight.name = \"Light3\";\n\n scene.add(keyLight);\n scene.add(fillLight);\n scene.add(backLight);\n}", "title": "" } ]
[ { "docid": "5279dfe29f6f97ae4f8d47c7549766f8", "score": "0.79046977", "text": "init() {\n super.init();\n this.log( \"init()\");\n this.scene.add( this._light);\n }", "title": "" }, { "docid": "efc1b19b2adf900bc11d7fdd87d2e08b", "score": "0.78940153", "text": "function setupLight(){\r\n\r\n\t//an ambient light for \"basic\" illumination\r\n\tambientLight = new THREE.AmbientLight( 0x444444 );\r\n\tscene.add( ambientLight );\r\n\r\n\t//a directional light for some nicer additional illumination\r\n\tdirectionalLight = new THREE.DirectionalLight( 0xffeedd );\r\n\tdirectionalLight.position.set( 0, 0, 1 ).normalize();\r\n\tscene.add( directionalLight );\r\n\r\n\t//set up the point light but without adding it to the scene\r\n\tpointlight = new THREE.PointLight( 0x444444, 2, 30 );\r\n\tpointLight.position.set( 0, 0, 37 );\r\n\r\n}", "title": "" }, { "docid": "0c1604190cc3b139f3e14b3d55778dd4", "score": "0.7802054", "text": "setLighting() {\n this.ambientLight = new THREE.AmbientLight( this.props.data.ambientLight, 1.7 );\n this.scene.add( this.ambientLight );\n\n this.directionalLight = new THREE.DirectionalLight( this.props.data.directionalLight , 2);\n this.scene.add( this.directionalLight );\n }", "title": "" }, { "docid": "aacc911bce4fe67469218666dcb00096", "score": "0.7637374", "text": "setupLights() {\n //setup lights\n this.light1 = new BABYLON.DirectionalLight(\"dir01\", new BABYLON.Vector3(0.0, -1.0, 0.0), src_1.MfgScene.scene);\n this.light1.intensity = 1.0;\n this.light1.position = new BABYLON.Vector3(0.0, 0.0, 0.0);\n }", "title": "" }, { "docid": "55a0d8f0bcd9020148a4b2061fcdb8e4", "score": "0.74208426", "text": "setLights(){\n var ambientLight = new THREE.AmbientLight(0xF47a42);\n if(this.enable_shadows){\n //ambientLight.castShadow = true;\n //this.scene.add(new THREE.CameraHelper( ambientLight.shadow.camera ));\n //ambientLight.shadowCameraVisible = true;\n }\n this.Scene.add(ambientLight);\n var light = new THREE.PointLight(0xffffff);\n light.position.set(0,250,0);\n if(this.enable_shadows){\n light.castShadow = true;\n light.shadow.camera.visible = true;\n light.shadow.camera.right = 5;\n light.shadow.camera.left = -5;\n light.shadow.camera.top = 5;\n light.shadow.camera.bottom = -5;\n }\n this.Scene.add(light);\n }", "title": "" }, { "docid": "ff1a3c6807719164de6b48b14aecbfe8", "score": "0.72931975", "text": "setupLights() {\n //setup lights\n this.light1 = new BABYLON.DirectionalLight(\"dir01\", new BABYLON.Vector3(0.2, -1, 0), src_1.MfgScene.scene);\n this.light1.intensity = 1.0;\n this.light1.position = new BABYLON.Vector3(0, 80, 0);\n this.light2 = new BABYLON.PointLight(\"omni01\", new BABYLON.Vector3(-10.0, 0.0, -10.0), src_1.MfgScene.scene);\n this.light2.intensity = 1.0;\n this.light2.diffuse = new BABYLON.Color3(1.0, 0.0, 0.0);\n this.light2.specular = new BABYLON.Color3(1.0, 0.0, 0.0);\n this.light3 = new BABYLON.PointLight(\"spot01\", new BABYLON.Vector3(10.0, 0.0, 10.0), src_1.MfgScene.scene);\n this.light3.intensity = 1.0;\n this.light3.diffuse = new BABYLON.Color3(0.0, 0.0, 1.0);\n this.light3.specular = new BABYLON.Color3(0.0, 0.0, 1.0);\n }", "title": "" }, { "docid": "5852b5f995b47d7d3b971daab577450e", "score": "0.72570807", "text": "function initLights() {\n var light = new THREE.PointLight(0xffffff);\n light.position.set(25, 50, 25); // position is a Vector3 with default value (0, 1, 0) gScene.add(light);\n gScene.add(light);\n var light = new THREE.DirectionalLight(0x002288);\n light.position.set(-10, -10, -10);\n gScene.add(light);\n // var light = new THREE.AmbientLight(0x222222, 0.9);\n // gScene.add(light);\n var light = new THREE.HemisphereLight( 0xffffbb, 0x080820, 0.5 );\n gScene.add( light );\n // var gLight = new THREE.DirectionalLight(0xfffbd1);\n // gLight.position.set(30, 30, 30);\n // gLight.castShadow = true;\n // var sphere = new THREE.SphereBufferGeometry(5, 16, 8);\n // var lightMesh = new THREE.Mesh(sphere, new THREE.MeshBasicMaterial({ color: 0xfffbd1 }));\n // gLight.add(lightMesh);\n // gScene.add(gLight);\n // gObjects.push(lightMesh);\n // gObjects.push(gLight);\n}", "title": "" }, { "docid": "46bcaf7c56b964f7c83307008910f7bf", "score": "0.72533315", "text": "createLights () {\n this.ambientLight = new THREE.AmbientLight(0xffffff, 0.35);\n this.add (this.ambientLight);\n\n this.spotLight = new THREE.SpotLight( 0xffffff );\n this.spotLight.position.set( 200, 70, 40 );\n this.spotLight.castShadow = true;\n this.add (this.spotLight);\n }", "title": "" }, { "docid": "2615dcb1644e5c69962bf48797777332", "score": "0.72222453", "text": "function initScene() {\n scene.background = new THREE.Color('0xffffff');\n \n gf = new ARCH.GeometryFactory(scene);\n mt = new ARCH.MaterialFactory();\n \n const light = new THREE.DirectionalLight(0xffffff, 1.0);\n light.position.set(0, 0, 1000);\n scene.add(light);\n // refresh global objects\n // ARCH.refreshSelection();\n}", "title": "" }, { "docid": "ad7c8b854670100ba1eb6c7322c9a1be", "score": "0.71800274", "text": "function add_lights_to_scene() {\n\n // Creates a white directional light\n var directional_light_1 = new THREE.DirectionalLight(0xffffff);\n\n // Sets the direction/position (x=1, y=1, z=1) of\n // the previously created directional light\n directional_light_1.position.set(1, 1, 1);\n\n // Adds the previously created directional light to\n // Scene (Atom Representation Scene)\n flipping_spinning_bitcoin_experiment_scene.add(directional_light_1);\n\n\n // Creates a blue directional light\n var directional_light_2 = new THREE.DirectionalLight(0x002288);\n\n // Sets the direction/position (x=-1, y=-1, z=-1) of\n // the previously created directional light\n directional_light_2.position.set(- 1, - 1, - 1);\n\n // Adds the previously created directional light to\n // Scene (Atom Representation Scene)\n flipping_spinning_bitcoin_experiment_scene.add(directional_light_2);\n\n\n // Creates a gray ambient light\n var ambient_light = new THREE.AmbientLight(0x222222);\n\n // Adds the previously created ambient light to\n // Scene (Atom Representation Scene)\n flipping_spinning_bitcoin_experiment_scene.add(ambient_light);\n\n}", "title": "" }, { "docid": "b93485ae3a5d5e512033fb5b551f0553", "score": "0.7109431", "text": "createLights () {\n\t // add subtle ambient lighting\n\t this.ambientLight = new THREE.AmbientLight(0xccddee, 0.35); // Creando luz ambiental\n\t this.add (this.ambientLight); // FIXMI ¿Porqué se le añade a la escena?\n\t\t\t\t\t\t\t\t\t\t\t\t// Creía que darle valor a la variable bastaba.\n\n\t // add spotlight for the shadows\n\t this.spotLight = new THREE.SpotLight( 0xffffff ); // Creando un foco\n\t this.spotLight.position.set( 60, 60, 40 ); // Posicionando el foco\n\t this.spotLight.castShadow = true; // Indicando Sombra arrojada\n\t // the shadow resolution\n\t this.spotLight.shadow.mapSize.width=2048 // Resolución de la sombra\n\t this.spotLight.shadow.mapSize.height=2048; // en anchura y altura\n\t this.add (this.spotLight);\n }", "title": "" }, { "docid": "70867217a387eab0029375fd371e475a", "score": "0.7089809", "text": "function addLights() {\n\tlight = new THREE.DirectionalLight(0x3333ee, 3.5, 500 );\n\tscene.add( light );\n\tlight.position.set(POS_X,POS_Y,POS_Z);\n}", "title": "" }, { "docid": "b72a41659f5ad41339ba9e2c2dfe4222", "score": "0.70797104", "text": "createLights () {\n // add subtle ambient lighting\n this.ambientLight = new THREE.AmbientLight(0xccddee, 0.35);\n this.add (this.ambientLight);\n\n //NUEVA LUZ AMBIENTE\n this.nuevaLuz = new THREE.AmbientLight(0x404040, 0.6);\n this.add (this.nuevaLuz);\n \n // add spotlight for the shadows\n this.spotLight = new THREE.SpotLight( 0xffffff );\n this.spotLight.position.set( 150, 60, 0 );\n this.spotLight.castShadow = true;\n // the shadow resolution\n this.spotLight.shadow.mapSize.width=2048;\n this.spotLight.shadow.mapSize.height=2048;\n this.add (this.spotLight);\n }", "title": "" }, { "docid": "eb1465b53598d5c5bcd652bbaf25b4a2", "score": "0.7066243", "text": "createLights () {\n // add subtle ambient lighting\n this.ambientLight = new THREE.AmbientLight(0xccddee, 0.35);\n this.add (this.ambientLight);\n \n // add spotlight for the shadows\n this.spotLight = new THREE.SpotLight( 0xffffff );\n this.spotLight.position.set( 0, 110, 0 );\n this.spotLight.castShadow = true;\n // the shadow resolution\n this.spotLight.shadow.mapSize.width=2048;\n this.spotLight.shadow.mapSize.height=2048;\n this.add (this.spotLight);\n }", "title": "" }, { "docid": "4a00ed39b1fd1b3bba04d840758bb7fe", "score": "0.70575124", "text": "initLights() {\n var i = 0;\n // Lights index.\n\n // Reads the lights from the scene graph.\n for (var key in this.graph.lights) {\n if (i >= 8)\n break; // Only eight lights allowed by WebGL.\n\n if(key == \"roomLight\") {\n this.roomLightID = i;\n }\n\n if(key == \"treeLight\") {\n this.treeLightID = i;\n }\n\n if (this.graph.lights.hasOwnProperty(key)) {\n var light = this.graph.lights[key];\n \n this.lights[i].setPosition(light[2][0], light[2][1], light[2][2], light[2][3]);\n this.lights[i].setAmbient(light[3][0], light[3][1], light[3][2], light[3][3]);\n this.lights[i].setDiffuse(light[4][0], light[4][1], light[4][2], light[4][3]);\n this.lights[i].setSpecular(light[5][0], light[5][1], light[5][2], light[5][3]);\n\n if (light[1] == \"spot\") {\n this.lights[i].setSpotCutOff(light[6]);\n this.lights[i].setSpotExponent(light[7]);\n this.lights[i].setSpotDirection(light[8][0], light[8][1], light[8][2]);\n }\n\n this.lights[i].setVisible(true);\n if (light[0])\n this.lights[i].enable();\n else\n this.lights[i].disable();\n\n this.lights[i].update();\n\n i++;\n }\n }\n }", "title": "" }, { "docid": "325602f921519a0d3afe8f9f13a34719", "score": "0.7033576", "text": "onLoaded() {\n var ambientLight = new THREE.AmbientLight(0x404040, 0.5); // soft white light\n this.add(ambientLight);\n\n this.vLab.WebGLRenderer.gammaFactor = 1.5;\n }", "title": "" }, { "docid": "259acda52c81bd677bbf212649c802bb", "score": "0.7000217", "text": "createLights () {\n // add subtle ambient lighting\n this.ambientLight = new THREE.AmbientLight(0xccddee, 0.35);\n this.add (this.ambientLight);\n \n // add spotlight for the shadows\n this.spotLight = new THREE.SpotLight( 0xffffff );\n this.spotLight.position.set( 60, 60, 40 );\n this.spotLight.castShadow = true;\n // the shadow resolution\n this.spotLight.shadow.mapSize.width=2048;\n this.spotLight.shadow.mapSize.height=2048;\n this.add (this.spotLight);\n\n //-----------------\n //New Light\n //-----------------\n // add spotlight for the shadows\n this.spotLight2 = new THREE.SpotLight( 0xff0000 );\n this.spotLight2.position.set( -60, 60, 40 );\n this.spotLight2.castShadow = true;\n // the shadow resolution\n this.spotLight2.shadow.mapSize.width=2048;\n this.spotLight2.shadow.mapSize.height=2048;\n this.add (this.spotLight2);\n }", "title": "" }, { "docid": "01c962260dfc82d9dc129f68856fba87", "score": "0.6994198", "text": "initLighting() {\n\n //*Turn on the helpers below for debugging purposes if needed\n\n //soft white light coming from the sky and soft brown reflecting from the ground\n var hemisphereLight = new THREE.HemisphereLight(0x404040, 0xffe5a3, 0.5);\n this.scene.add(hemisphereLight);\n\n //light bulb positioned on the right of the camera's initial position\n var lightBulbRight = new THREE.PointLight(0x404040, 1, 0, 2);\n lightBulbRight.position.set(280, 175, 280);\n lightBulbRight.castShadow = true;\n lightBulbRight.shadow.mapSize.set(512, 512);\n lightBulbRight.shadow.camera.far = 1000;\n this.scene.add(lightBulbRight);\n\n /* var lightBulbRightHelper = new THREE.PointLightHelper(lightBulbRight, 10);\n lightBulbRightHelper.visible = true;\n this.scene.add(lightBulbRightHelper); */\n\n //light bulb positioned on the left of the camera's initial position\n var lightBulbLeft = new THREE.PointLight(0x404040, 1, 0, 2);\n lightBulbLeft.position.set(-280, 175, 280);\n lightBulbLeft.castShadow = true;\n lightBulbLeft.shadow.mapSize.set(512, 512);\n lightBulbLeft.shadow.camera.far = 1000;\n this.scene.add(lightBulbLeft);\n\n /* var lightBulbLeftHelper = new THREE.PointLightHelper(lightBulbLeft, 10);\n lightBulbLeftHelper.visible = true;\n this.scene.add(lightBulbLeftHelper); */\n\n //sunlight coming out of the window in the middle pointing at the closet\n var sunLightCenter = new THREE.DirectionalLight(0xffffff, 1);\n sunLightCenter.position.set(-450, 100, -600);\n sunLightCenter.target = this.group;\n sunLightCenter.castShadow = true;\n sunLightCenter.shadow.mapSize.set(512, 512);\n sunLightCenter.shadow.camera.near = 0.5;\n sunLightCenter.shadow.camera.far = 1200000;\n this.scene.add(sunLightCenter);\n\n /* var sunLightCenterHelper = new THREE.DirectionalLightHelper(sunLightCenter, 5);\n this.scene.add(sunLightCenterHelper); */\n }", "title": "" }, { "docid": "aea43c87536b763bf27beee2323b4754", "score": "0.697769", "text": "function initScene(){\n renderer.setSize( window.innerWidth, window.innerHeight);\n document.getElementById('main').appendChild(renderer.domElement);\n\n scene.add(light);\n\n camera = new THREE.PerspectiveCamera(\n 35,\n window.innerWidth / window.innerHeight,\n 1,\n 1000\n );\n\n camera.position.z = 100;\n scene.add(camera);\n\n box = new THREE.Mesh(\n new THREE.BoxGeometry(20, 20, 20),\n new THREE.MeshBasicMaterial({ color: 0x2E4272 })\n );\n\n box.name = \"box\";\n scene.add(box);\n\n render()\n }", "title": "" }, { "docid": "d66db72143435444d3bcaca098f20e67", "score": "0.6954712", "text": "function lights() {\r\n scene.add( new THREE.AmbientLight( 0x666666 ) );\r\n var light = new THREE.DirectionalLight( 0xdfebff, 1 );\r\n light.position.set( 50, 200, 100 );\r\n light.position.multiplyScalar( 1.3 );\r\n light.castShadow = true;\r\n light.shadow.mapSize.width = 1024;\r\n light.shadow.mapSize.height = 1024;\r\n\r\n var light2 = new THREE.PointLight(0xffffff,1,5)\r\n \r\n light2.position.z = 1\r\n light2.position.y = 1\r\n \r\n light2.castShadow = true;\r\n\r\n var light3 = new THREE.PointLight(0xffffff,1,5)\r\n \r\n light3.position.z = 1\r\n light3.position.y = 1\r\n light3.position.x = 1.5\r\n \r\n light2.castShadow = false;\r\n \r\n //scene.add(light2)\r\n \r\n\r\n\r\n var lights = new THREE.PointLight( 0xdfebff, 1 )\r\n scene.add( lights );\r\n lights.translateX(3)\r\n\r\n \r\n var lights2 = new THREE.PointLight( 0xdfebff, 1 )\r\n scene.add( lights2 );\r\n lights2.translateX(-3)\r\n \r\n \r\n var lights4 = new THREE.PointLight( 0xdfebff, 1 )\r\n scene.add( lights4 );\r\n lights4.translateZ(-3)\r\n\r\n scene.add( light );\r\n }", "title": "" }, { "docid": "9d18b2ce2cb36b196e582331c528b9b4", "score": "0.6938856", "text": "initLights() {\n\n var i = 0;\n // Lights index.\n\n // Reads the omni lights from the scene graph.\n for (var key in this.graph.lights) {\n if (i >= 8)\n break; // Only eight lights allowed by WebGL.\n\n\n if (this.graph.lights.hasOwnProperty(key)) {\n var light = this.graph.lights[key];\n\n if(light.type == 'omni'){\n\n //lights are predefined in cgfscene\n this.lights[i].setPosition(light.location.wCoord, light.location.xCoord, light.location.yCoord, light.location.zCoord);\n this.lights[i].setAmbient(light.ambient.r, light.ambient.g, light.ambient.b, light.ambient.a);\n this.lights[i].setDiffuse(light.diffuse.r, light.diffuse.g, light.diffuse.b, light.diffuse.a);\n this.lights[i].setSpecular(light.specular.r, light.specular.g, light.specular.b, light.specular.a);\n\n this.lights[i].setVisible(true);\n if (light.enabled)\n this.lights[i].enable();\n else\n this.lights[i].disable();\n\n this.lights[i].update();\n i++;\n\n }else if(light.type == 'spot'){\n this.lights[i].setPosition(light.location.wCoord, light.location.xCoord, light.location.yCoord, light.location.zCoord);\n this.lights[i].setAmbient(light.ambient.r, light.ambient.g, light.ambient.b, light.ambient.a);\n this.lights[i].setDiffuse(light.diffuse.r, light.diffuse.g, light.diffuse.b, light.diffuse.a);\n this.lights[i].setSpecular(light.specular.r, light.specular.g, light.specular.b, light.specular.a);\n this.lights[i].setSpotCutOff(light.angle);\n this.lights[i].setSpotDirection(light.target.xCoord - light.location.xCoord, light.target.yCoord - light.location.yCoord, light.target.zCoord - light.location.zCoord);\n this.lights[i].setSpotExponent(light.exponent);\n \n this.lights[i].setVisible(true);\n if (light.enabled)\n this.lights[i].enable();\n else\n this.lights[i].disable();\n \n this.lights[i].update();\n \n i++;\n }\n\n \n }\n }\n\n \n }", "title": "" }, { "docid": "c7a79869e6dd3aafcecdd06e7cdae878", "score": "0.69217575", "text": "function addLights() {\n scene.add(new THREE.AmbientLight(0xbbbbbb));\n\n //\n // For nice introduction to Three.JS see the book \"Learning Three.js: The JavaScript 3D Library for WebGL - Second Edition\", https://www.packtpub.com/web-development/learning-threejs-javascript-3d-library-webgl-second-edition\" by Jos Dirksen\n //\n var spotLightFlare = new THREE.SpotLight(0xffffff);\n spotLightFlare.position.set(120, 610, -3000);\n spotLightFlare.castShadow = false;\n spotLightFlare.intensity = 0.5;\n scene.add(spotLightFlare);\n\n var textureFlare0 = THREE.ImageUtils.loadTexture(\"/images/lensflare/lensflare0.png\");\n var textureFlare3 = THREE.ImageUtils.loadTexture(\"/images/lensflare/lensflare3.png\");\n\n var flareColor = new THREE.Color(0xffaacc);\n var lensFlare = new THREE.LensFlare(textureFlare0, 200, 0.0, THREE.AdditiveBlending, flareColor);\n\n lensFlare.add(textureFlare3, 60, 0.6, THREE.AdditiveBlending);\n lensFlare.add(textureFlare3, 70, 0.7, THREE.AdditiveBlending);\n lensFlare.add(textureFlare3, 120, 0.9, THREE.AdditiveBlending);\n lensFlare.add(textureFlare3, 70, 1.0, THREE.AdditiveBlending);\n \n lensFlare.position.copy(spotLightFlare.position);\n scene.add(lensFlare);\n\n}", "title": "" }, { "docid": "17542f03bbb9a662aa4a2b62ac119354", "score": "0.6901249", "text": "function init(){\n\t/* CHECK FOR WEBGL */\n\t\n\t// camera\n\t// lights\n\t\n}", "title": "" }, { "docid": "0d6a14061f9e5837a2d3eb013f290b1c", "score": "0.6881423", "text": "initLights()\r\n {\r\n var i = 0; // Lights index.\r\n // Reads the lights from the scene graph.\r\n for (let key in this.graph.lights)\r\n {\r\n if (i >= 8) break; // Only eight lights allowed by WebGL.\r\n if (this.graph.lights.hasOwnProperty(key))\r\n {\r\n var light = this.graph.lights[key];\r\n\r\n this.lights[i].setPosition(light[2][0], light[2][1], light[2][2], light[2][3]);\r\n this.lights[i].setAmbient(light[3][0], light[3][1], light[3][2], light[3][3]);\r\n this.lights[i].setDiffuse(light[4][0], light[4][1], light[4][2], light[4][3]);\r\n this.lights[i].setSpecular(light[5][0], light[5][1], light[5][2], light[5][3]);\r\n\r\n if (light[1] == \"spot\"){\r\n this.lights[i].setSpotCutOff(light[6]);\r\n this.lights[i].setSpotExponent(light[7]);\r\n this.lights[i].setSpotDirection(light[8][0], light[8][1], light[8][2]);\r\n }\r\n\r\n this.lights[i].setVisible(true);\r\n if(light[0]) this.lights[i].enable();\r\n else this.lights[i].disable();\r\n \r\n this.lights[i].update();\r\n i++;\r\n }\r\n }\r\n }", "title": "" }, { "docid": "0d6a14061f9e5837a2d3eb013f290b1c", "score": "0.6881423", "text": "initLights()\r\n {\r\n var i = 0; // Lights index.\r\n // Reads the lights from the scene graph.\r\n for (let key in this.graph.lights)\r\n {\r\n if (i >= 8) break; // Only eight lights allowed by WebGL.\r\n if (this.graph.lights.hasOwnProperty(key))\r\n {\r\n var light = this.graph.lights[key];\r\n\r\n this.lights[i].setPosition(light[2][0], light[2][1], light[2][2], light[2][3]);\r\n this.lights[i].setAmbient(light[3][0], light[3][1], light[3][2], light[3][3]);\r\n this.lights[i].setDiffuse(light[4][0], light[4][1], light[4][2], light[4][3]);\r\n this.lights[i].setSpecular(light[5][0], light[5][1], light[5][2], light[5][3]);\r\n\r\n if (light[1] == \"spot\"){\r\n this.lights[i].setSpotCutOff(light[6]);\r\n this.lights[i].setSpotExponent(light[7]);\r\n this.lights[i].setSpotDirection(light[8][0], light[8][1], light[8][2]);\r\n }\r\n\r\n this.lights[i].setVisible(true);\r\n if(light[0]) this.lights[i].enable();\r\n else this.lights[i].disable();\r\n \r\n this.lights[i].update();\r\n i++;\r\n }\r\n }\r\n }", "title": "" }, { "docid": "54c7c477e1cce0b396742663bcaa52f5", "score": "0.6874634", "text": "function setupScene() {\n\n\t// RENDERER\n\trenderer = new THREE.WebGLRenderer( { antialias: false } );\n\n\trenderer.gammaInput = true;\n\trenderer.gammaOutput = true;\n\n\trenderer.setSize(window.innerWidth, window.innerHeight);\n\n\t// setClearColorHex() is depricated\n\trenderer.setClearColor( 0x000000, 1.0 );\n\tdocument.body.appendChild( renderer.domElement );\n\n\t// CAMERA\n\tcamera = new THREE.PerspectiveCamera( 40, window.innerWidth/window.innerHeight, 1, 10000 );\n\tcamera.position.set( 0, 0, 1000);\n\n\t// CONTROLS\n\tcameraControls = new THREE.OrbitControls(camera, renderer.domElement);\n\tcameraControls.target.set(0,0,0);\n\tcameraControls.target.set(0,200,0);\n\n\t// SCENE\n\tscene = new THREE.Scene();\n\tscene.fog = new THREE.Fog( 0x808080, 2000, 4000 );\n\n\t// LIGHTS\n\tvar ambientLight = new THREE.AmbientLight( 0x222222 );\n\n\tvar light = new THREE.DirectionalLight( 0xFFFFFF, 1.0 );\n\tlight.position.set( 200, 400, 500 );\n\n\tvar light2 = new THREE.DirectionalLight( 0xFFFFFF, 1.0 );\n\tlight2.position.set( -500, 250, -200 );\n\n\tscene.add(ambientLight);\n\tscene.add(light);\n\tscene.add(light2);\n\n\t// EVENTS\n\twindow.addEventListener( 'resize', onWindowResize, false );\n\n}", "title": "" }, { "docid": "d9ffce99b81a5aa50e502dc741aa7518", "score": "0.6873732", "text": "function addLight(h, s, l, x, y, z) {\n console.log('sun added at position: ',x,y,z);\n _sunLight = new THREE.PointLight(0xffffff, 1.5, 4500);\n _sunLight.color.setHSL(h, s, l);\n _sunLight.position.set(x, y, z);\n // _scene.add( _sunLight );\n\n var flareColor = new THREE.Color(0xffffff);\n flareColor.setHSL(h, s, l + 0.5);\n\n _lensFlare = new THREE.LensFlare(textureFlare0, 700, 0.0, THREE.AdditiveBlending, flareColor);\n\n _lensFlare.add(textureFlare2, 512, 0.0, THREE.AdditiveBlending);\n _lensFlare.add(textureFlare2, 512, 0.0, THREE.AdditiveBlending);\n _lensFlare.add(textureFlare2, 512, 0.0, THREE.AdditiveBlending);\n\n _lensFlare.add(textureFlare3, 60, 0.6, THREE.AdditiveBlending);\n _lensFlare.add(textureFlare3, 70, 0.7, THREE.AdditiveBlending);\n _lensFlare.add(textureFlare3, 120, 0.9, THREE.AdditiveBlending);\n _lensFlare.add(textureFlare3, 700, 6.0, THREE.AdditiveBlending);\n\n //lensFlare.customUpdateCallback = lensFlareUpdateCallback;\n _lensFlare.position = _sunLight.position;\n\n _scene.add(_lensFlare);\n\n }", "title": "" }, { "docid": "742d811ecf179141178f30d735556894", "score": "0.68617004", "text": "function addThreeLight() {\n\n directionalLight = new THREE.DirectionalLight(0xffffff);\n directionalLight.position.set(1, 1, 1).normalize();\n scene.add(directionalLight);\n\n }", "title": "" }, { "docid": "1c2ad93aeb000fc6b462045f8e5e6a4f", "score": "0.6828233", "text": "initLights() {\n var i = 0;\n // Lights index.\n\n // Reads the lights from the scene graph.\n for (var key in this.graph.lights) {\n if (i >= 8)\n break; // Only eight lights allowed by WebGL.\n\n if (this.graph.lights.hasOwnProperty(key)) {\n var light = this.graph.lights[key];\n\n this.lightStates[key] = (light[0] === true ? true : false);\n\n this.lights[i].setPosition(light[2][0], light[2][1], light[2][2], light[2][3]);\n this.lights[i].setAmbient(light[3][0], light[3][1], light[3][2], light[3][3]);\n this.lights[i].setDiffuse(light[4][0], light[4][1], light[4][2], light[4][3]);\n this.lights[i].setSpecular(light[5][0], light[5][1], light[5][2], light[5][3]);\n //light[6] is attenuation\n this.lights[i].setConstantAttenuation(light[6][0]);\n this.lights[i].setLinearAttenuation(light[6][1]);\n this.lights[i].setQuadraticAttenuation(light[6][2]);\n\n if (light[1] == \"spot\") {\n this.lights[i].setSpotCutOff(light[7]);\n this.lights[i].setSpotExponent(light[8]);\n this.lights[i].setSpotDirection(light[9][0], light[9][1], light[9][2]);\n } else if (light[1] == \"omni\") {\n // Do nothing, all functions should have been called already\n }\n\n if (this.lightStates[key] === true) {\n this.lights[i].setVisible(true);\n this.lights[i].enable();\n } else {\n this.lights[i].setVisible(false);\n this.lights[i].disable();\n }\n\n this.lights[i].update();\n\n i++;\n }\n }\n }", "title": "" }, { "docid": "fe12e9c276e52948111b95d54c7bf1c4", "score": "0.6826719", "text": "function initializeLights(){\n\tvar x = root.width()*0.255;\n\n\t//add 16 lights, adjust x coordinate after each new placement \n\tfor(i=0; i<16; i++){\n\t\t addImage(\"wLED.png\", x, root.height()*.65);\n\t\t//console.log(\"light: \" + i);\n\t\tx += root.width()*.041;\n\t}\n\n\tconsole.log(\"lights initialized\");\n\tconsole.log(\"light color changed\");\n}", "title": "" }, { "docid": "de4a0d13b0021047df6d9363e5d22caa", "score": "0.68259984", "text": "function addLights() {\n\tvar lights = [];\n\tlights[0] = new THREE.PointLight(0xffffff, 1, 0);\n\tlights[0].position.set(0, 200, 0);\n\n\tlights.forEach(function (element) {\n\t\taddToScene(element);\n\t});\n}", "title": "" }, { "docid": "81d1092b4f8884030eee7754ed67542a", "score": "0.68156445", "text": "initLights() {\r\n var i = 0;\r\n // Lights index.\r\n\r\n // Reads the lights from the scene graph.\r\n for (var key in this.graph.lights) {\r\n if (i >= 8)\r\n break; // Only eight lights allowed by WebGL.\r\n\r\n if (this.graph.lights.hasOwnProperty(key)) {\r\n var light = this.graph.lights[key];\r\n\r\n //lights are predefined in cgfscene\r\n this.lights[i].setPosition(light[1][0], light[1][1], light[1][2], light[1][3]);\r\n this.lights[i].setAmbient(light[2][0], light[2][1], light[2][2], light[2][3]);\r\n this.lights[i].setDiffuse(light[3][0], light[3][1], light[3][2], light[3][3]);\r\n this.lights[i].setSpecular(light[4][0], light[4][1], light[4][2], light[4][3]);\r\n\r\n if (light[5] != null) {\r\n this.lights[i].setSpotDirection(light[5][0] - light[1][0], light[5][1] - light[1][1], light[5][2] - light[1][2], light[5][3] - light[1][3])\r\n this.lights[i].setSpotCutOff(light[6]);\r\n this.lights[i].setSpotExponent(light[7]);\r\n }\r\n\r\n this.lights[i].setVisible(true);\r\n if (light[0])\r\n this.lights[i].enable();\r\n else\r\n this.lights[i].disable();\r\n\r\n this.lights[i].update();\r\n\r\n i++;\r\n }\r\n }\r\n\r\n }", "title": "" }, { "docid": "bc03fa0c07840e2c9ccaa7495e974177", "score": "0.67978865", "text": "initLights() {\n\t\tvar i = 0;\n\t\t// Lights index.\n\n\t\t// Reads the lights from the scene graph.\n\t\tfor (var key in this.graph.lights) {\n\t\t\tif (i >= 8)\n\t\t\t\tbreak; // Only eight lights allowed by WebGL.\n\n\t\t\tif (this.graph.lights.hasOwnProperty(key)) {\n\t\t\t\tvar light = this.graph.lights[key];\n\n\t\t\t\t//lights are predefined in cgfscene\n\t\t\t\tthis.lights[i].setPosition(light[1][0], light[1][1], light[1][2], light[1][3]);\n\t\t\t\tthis.lights[i].setAmbient(light[2][0], light[2][1], light[2][2], light[2][3]);\n\t\t\t\tthis.lights[i].setDiffuse(light[3][0], light[3][1], light[3][2], light[3][3]);\n\t\t\t\tthis.lights[i].setSpecular(light[4][0], light[4][1], light[4][2], light[4][3]);\n\n\t\t\t\tthis.lights[i].setVisible(true);\n\t\t\t\tif (light[0])\n\t\t\t\t\tthis.lights[i].enable();\n\t\t\t\telse\n\t\t\t\t\tthis.lights[i].disable();\n\n\t\t\t\tif (this.graph.spots.hasOwnProperty(key)) {\n\t\t\t\t\tvar spot = this.graph.spots[key];\n\n\t\t\t\t\tthis.lights[i].setSpotCutOff(spot[0]);\n\t\t\t\t\tthis.lights[i].setSpotExponent(spot[1]);\n\t\t\t\t\tthis.lights[i].setSpotDirection(spot[2][0] - light[1][0], spot[2][1] - light[1][1], spot[2][2] - light[1][2]);\n\t\t\t\t}\n\n\t\t\t\tthis.lights[i].update();\n\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t}", "title": "" }, { "docid": "3667b69434db71ea6988aa543eea0fb6", "score": "0.678211", "text": "initLights() {\n\n //Setup lights\n for (let i = 0; i < this.graph.lights.length; i++) {\n\n const light = this.graph.lights[i];\n\n this.lights[i].setPosition(light.location.x, light.location.y, light.location.z, light.location.w);\n this.lights[i].setAmbient(light.ambient.r, light.ambient.g, light.ambient.b, light.ambient.a);\n this.lights[i].setDiffuse(light.diffuse.r, light.diffuse.g, light.diffuse.b, light.diffuse.a);\n this.lights[i].setSpecular(light.specular.r, light.specular.g, light.specular.b, light.specular.a);\n\n //Detect if it's spotlight\n if (light.angle != undefined) {\n this.lights[i].setSpotCutOff(light.angle);\n this.lights[i].setSpotExponent(light.exponent);\n //TODO doesn't seem right\n this.lights[i].setSpotDirection(light.target.x, light.target.y, light.target.z);\n }\n\n this.lights[i].setVisible(true);\n\n if (light.enable)\n this.lights[i].enable();\n else\n this.lights[i].disable();\n\n this.lights[i].update();\n }\n\n }", "title": "" }, { "docid": "11e22c381fb19269804c68df12ca003b", "score": "0.67741555", "text": "initLights() {\n \n var i = 0;\n var location_index, ambient_index, diffuse_index, specular_index, attenuation_index, target_index;\n var enable_index, angle_index, exponent_index, type_index;\n var attributeNames = [\"location\", \"target\", \"ambient\", \"diffuse\", \"specular\", \"attenuation\", \"enable\", \"exponent\" , \"angle\", \"type\"];\n // Reads the lights from the scene graph.\n var light;\n for (var key in this.graph.Lights) {\n // Only eight lights allowed by WebGL.\n if (i >= 8)\n break; \n\n light = this.graph.Lights[key];\n location_index =attributeNames[0];\n target_index =attributeNames[1];\n ambient_index = attributeNames[2];\n diffuse_index =attributeNames[3]; \n specular_index =attributeNames[4];\n attenuation_index =attributeNames[5];\n enable_index =attributeNames[6];\n exponent_index = attributeNames[7];\n angle_index =attributeNames[8];\n type_index = attributeNames[9];\n\n // atributes that are common betteewn lights (omin and spot)\n this.lights[i].setPosition(light[location_index][0], light[location_index][1], light[location_index][2], light[location_index][3], light[location_index][4]);\n this.lights[i].setAmbient(light[ambient_index][0], light[ambient_index][1], light[ambient_index][2], light[ambient_index][3] , light[ambient_index][4]);\n this.lights[i].setDiffuse(light[diffuse_index][0], light[diffuse_index][1], light[diffuse_index][2], light[diffuse_index][3], light[diffuse_index][4]);\n this.lights[i].setSpecular(light[specular_index][0], light[specular_index][1], light[specular_index][2], light[specular_index][3], light[specular_index][4]);\n this.lights[i].setConstantAttenuation(light[attenuation_index][0]);\n this.lights[i].setLinearAttenuation(light[attenuation_index][1]);\n this.lights[i].setQuadraticAttenuation(light[attenuation_index][2]);\n \n if (light[type_index] == \"spot\") {\n this.lights[i].setSpotCutOff(light[angle_index]);\n this.lights[i].setSpotExponent(light[exponent_index]);\n this.lights[i].setSpotDirection(light[target_index][0] - light[location_index][0], light[target_index][1] - light[location_index][1], light[target_index][2] - light[location_index][2]);\n }\n\n if (light[enable_index] == true){\n this.lights[i].enable();\n }\n else{\n this.lights[i].disable();\n }\n this.lights[i].setVisible(true);\n \n this.lights[i].update();\n i++;\n \n }\n }", "title": "" }, { "docid": "9cc83637f3c61e5e221b302d9ed916d3", "score": "0.67721784", "text": "initializeScene() {\n // Add a box at the scene origin\n let box = new THREE.Mesh(\n new THREE.BoxBufferGeometry(0.1, 0.1, 0.1),\n new THREE.MeshPhongMaterial({color: '#DDFFDD'})\n )\n box.position.set(0, 0.05, 0)\n var axesHelper = AxesHelper(0.2);\n this.floorGroup.add(axesHelper);\n this.floorGroup.add(box)\n\n // Add a few lights\n this.scene.add(new THREE.AmbientLight('#FFF', 0.2))\n let directionalLight = new THREE.DirectionalLight('#FFF', 0.6)\n directionalLight.position.set(0, 10, 0)\n this.scene.add(directionalLight)\n }", "title": "" }, { "docid": "5ae557b49f4f83e640acb4a98e7aa24a", "score": "0.6761071", "text": "initLights() {\n var i = 0;\n // Lights index.\n\n // Reads the lights from the scene graph.\n for (var key in this.graph.lights) {\n if (i >= 8)\n break; // Only eight lights allowed by WebGL.\n\n if (this.graph.lights.hasOwnProperty(key)) {\n var light = this.graph.lights[key];\n\n this.lights[i].setPosition(light[2][0], light[2][1], light[2][2], light[2][3]);\n this.lights[i].setAmbient(light[3][0], light[3][1], light[3][2], light[3][3]);\n this.lights[i].setDiffuse(light[4][0], light[4][1], light[4][2], light[4][3]);\n this.lights[i].setSpecular(light[5][0], light[5][1], light[5][2], light[5][3]);\n\n if (light[1] == \"spot\") {\n this.lights[iGameO].enable();\n } else\n this.lights[i].disable();\n\n this.lights[i].update();\n\n i++;\n }\n }\n }", "title": "" }, { "docid": "ca898acb66356fd5e8b173d9bcffa047", "score": "0.6746625", "text": "constructor() {\n super(new BABYLON.Vector3(-80.0, 40.0, -80.0), new BABYLON.Vector3(0, 0, 0), lib_1.LibUI.COLOR_ORANGE_MAYFLOWER);\n this.light1 = null;\n this.light2 = null;\n this.light3 = null;\n this.shadowGenerator1 = null;\n this.setupLights();\n this.setupShadows();\n this.setupGround();\n this.setupCollidableBox();\n this.setupSpheres();\n this.setupBox0();\n /*\n this.setupCompound();\n */\n this.setupGlassPanes();\n this.setupSkybox();\n this.setupSprites();\n this.importMesh();\n }", "title": "" }, { "docid": "a023e7bd13b113a545583a18c21997e0", "score": "0.6705859", "text": "function addLight() {\r\n\t\tlight = new THREE.DirectionalLight(0xffffff, 1.5);\r\n\t\tlight.castShadow = false;\r\n\t\tlight.position.x = -10;\r\n\t\tlight.position.y = 15;\r\n\t\tlight.position.z = -20;\r\n\t\tscene.add(light);\r\n\t\t\r\n\t\tvar hemiLight = new THREE.HemisphereLight( 0xcccccc, 0x1B1B1B );\r\n\t\themiLight.position.set( 0, 0, 0 );\r\n\t\tscene.add(hemiLight);\r\n\t}", "title": "" }, { "docid": "b83bafdb074bf6c563221f9ffe268683", "score": "0.67010295", "text": "initLight(){\n this._light = this.disposable( new AmbientLight( 0xFFFFFF)); // soft white light\n this._light.name = `${this.id}:light`;\n }", "title": "" }, { "docid": "21ac92931d92a368da7aa0274434d7ee", "score": "0.6679511", "text": "function start() {\n\t// Initialize a shader program; this is where all the lighting\n\t// for the vertices and so forth is established.\n\t//const shaderProgram = initShaders(gl);\n\t\n\t// Collect all the info needed to use the shader program.\n\t// Look up which attributes our shader program is using\n\t// for aVertexPosition, aVertexNormal, aTextureCoord,\n\t// and look up uniform locations.\n\tconst programInfo = {\n\t program: shaderProgram,\n\t attribLocations: {\n\t\tvertexPosition: gl.getAttribLocation(shaderProgram, 'aVertexPosition'),\n\t\tvertexNormal: gl.getAttribLocation(shaderProgram, 'aVertexNormal'),\n\t\ttextureCoord: gl.getAttribLocation(shaderProgram, 'aTextureCoord'),\n\t },\n\t uniformLocations: {\n\t\tscaleVector : gl.getUniformLocation(shaderProgram, 'uScaleVector'),\n\t\tprojectionMatrix: gl.getUniformLocation(shaderProgram, 'uProjectionMatrix'),\n\t\tmodelViewMatrix: gl.getUniformLocation(shaderProgram, 'uModelViewMatrix'),\n\t\tnormalMatrix: gl.getUniformLocation(shaderProgram, 'uNormalMatrix'),\n\t\tuSampler: gl.getUniformLocation(shaderProgram, 'uSampler'),\n\t },\n\t};\n\n\t// Here's where we call the routine that builds all the\n\t// objects we'll be drawing.\n\tconst buffers = initBuffers(gl);\n\n\tconst texture = glhelper.loadTexture(gl, 'img/cubetexture.png');\n\n\tvar then = 0;\n\n\t// Draw the scene repeatedly\n\tfunction render(now) {\n\t now *= 0.001; // convert to seconds\n\t const deltaTime = now - then;\n\t then = now;\n\n\t drawScene(gl, programInfo, buffers, texture, deltaTime);\n\n\t requestAnimationFrame(render);\n\t}\n\trequestAnimationFrame(render);\n }", "title": "" }, { "docid": "c1f7e618374b0576118541809aa20f42", "score": "0.666802", "text": "function createLights(){\n\tconst hemiLight = new THREE.HemisphereLight( 0xffffff, 0x444444 );\n\themiLight.position.set( 0, 20, 0 );\n\n\tconst dirLight = new THREE.DirectionalLight( 0xffffff );\n\tdirLight.position.set( - 3, 10, - 10 );\n\tdirLight.castShadow = true;\n\tdirLight.shadow.camera.top = 10;\n\tdirLight.shadow.camera.bottom = - 10;\n\tdirLight.shadow.camera.left = - 10;\n\tdirLight.shadow.camera.right = 10;\n\tdirLight.shadow.camera.near = 0.1;\n\tdirLight.shadow.camera.far = 40;\n\tconst hemiLightHelper = new THREE.HemisphereLightHelper(hemiLight,10);\n\tconst dirLightHelper = new THREE.DirectionalLightHelper(dirLight,10);\n\t//scene.add(hemiLightHelper);\n\t//scene.add(dirLightHelper);\n\n\tconst light = new THREE.PointLight( 0xffffff );\n\tlight.position.set( 50, 100, 50 );\n\tlight.power=3\n\n\tscene.add( light );\n\tscene.add( dirLight );\n\tscene.add( hemiLight );\n}", "title": "" }, { "docid": "225f9a790ebd183c63c775d2a8617b80", "score": "0.6667474", "text": "function init() {\n \n\trefScene = Date.now();\n \tdocument.addEventListener(\"keydown\", onKeyPressed, false); \n\n scene.add(listEntities);\n \trender.createSky();\n\n // Light\n\n var light1 = new THREE.DirectionalLight( 0x5599ff, 0.15 );\n light1.position.set( 0, 0, -1 ).normalize();\n light1.castShadow = true;\n light1.shadowCameraVisible = true;\n scene.add( light1 ); \n\t\n var light2 = new THREE.DirectionalLight( 0xff5577, 0.25);\n light2.position.set( 1, 1, 0 ).normalize();\n light2.castShadow = true;\n light2.shadowCameraVisible = true;\n scene.add( light2 ); \n \n //var light3 = new THREE.DirectionalLight( 0x222244, 0.8 );\n var light3 = new THREE.DirectionalLight( 0xFFFFFF, 0.2 );\n light3.position.set( -1, -1, 0 ).normalize();\n light3.castShadow = true;\n light3.shadowCameraVisible = true;\n scene.add( light3 ); \n\n}", "title": "" }, { "docid": "ebf269af7e5c1b004ea9e15df9315d7f", "score": "0.66487575", "text": "_onChanged() {\n if (this.gameObject !== undefined) {\n switch (this.type) {\n case LightType_1.LightType.Spot:\n {\n let color = 0xffffff;\n let intensity = 1.0;\n let distance = 0.0;\n let angle = Math.PI * 0.1;\n let exponent = 10.0;\n let light = new Graphic_1.GL.SpotLight(color, intensity, distance, angle, exponent);\n light.target.name = light.name + ' Target';\n light.position.set(5, 10, 7.5);\n light.castShadow = true;\n this._gameObject.core = light;\n }\n break;\n case LightType_1.LightType.Directional:\n {\n let color = 0xffffff;\n let intensity = 1.0;\n let light = new Graphic_1.GL.DirectionalLight(color, intensity);\n light.target.name = light.name + ' Target';\n light.position.set(5, 10, 7.5);\n light.castShadow = true;\n this._gameObject.core = light;\n }\n break;\n case LightType_1.LightType.Area:\n console.warn(\"not suport Area Light\");\n case LightType_1.LightType.Point:\n {\n let color = 0xffffff;\n let intensity = 1.0;\n let distance = 0.0;\n let light = new Graphic_1.GL.PointLight(color, intensity, distance);\n light.castShadow = true;\n this._gameObject.core = light;\n }\n break;\n case LightType_1.LightType.Hemisphere:\n {\n let skyColor = 0x00aaff;\n let groundColor = 0xffaa00;\n let intensity = 1.0;\n let light = new Graphic_1.GL.HemisphereLight(skyColor, groundColor, intensity);\n light.position.set(0, 10, 0);\n this._gameObject.core = light;\n }\n break;\n case LightType_1.LightType.Ambient:\n {\n let color = 0x222222;\n let light = new Graphic_1.GL.AmbientLight(color);\n light.position.set(0, 20, 0);\n this._gameObject.core = light;\n }\n break;\n }\n }\n }", "title": "" }, { "docid": "16b9be40a3004903d7f80d1ae9a7bf5c", "score": "0.66330457", "text": "function init() {\r\n\r\n //creating a scene.\r\n scene = new THREE.Scene();\r\n scene.background = new THREE.Color(0xbffffd);\r\n\r\n //Fog color.\r\n fogColor = new THREE.Color(0xffffff);\r\n\r\n //Fog\r\n scene.fog = new THREE.FogExp2(0xffffff, 1.5);\r\n\r\n //Creating a virtual camera so that we can see the scene.\r\n camera = new THREE.PerspectiveCamera( 75, 1000 / 700, 0.01, 1000);\r\n camera.position.z = 0.2;\r\n \r\n //Creating a renderer which helps in rendering the scene.\r\n renderer = new THREE.WebGLRenderer();\r\n renderer.setSize(1000, 700);\r\n document.body.appendChild(renderer.domElement);\r\n\r\n //Creating OrbitControls to help viewer rotate the 3D model.\r\n const controls = new THREE.OrbitControls( camera, renderer.domElement );\r\n\r\n //To load the 3D model.\r\n const loader = new THREE.GLTFLoader();\r\n\r\n loader.load('models/router.glb', object => {\r\n\r\n const router = object.scene.children[0];\r\n\r\n scene.add(object.scene);\r\n })\r\n\r\n //Adding lightings.\r\n const pointLight = new THREE.PointLight(0xffffff, 1);\r\n scene.add(pointLight); \r\n pointLight.position.set(1, 9, 1)\r\n\r\n const directional_light = new THREE.DirectionalLight(0xffffff, 2);\r\n scene.add(directional_light);\r\n\r\n const ambientLight = new THREE.AmbientLight(0xffffff, 0.5);\r\n scene.add(ambientLight);\r\n\r\n //Creating an artificial sun.\r\n const sun_geometry = new THREE.SphereBufferGeometry(0.1, 30, 30);\r\n const sun_material = new THREE.MeshBasicMaterial({color: 0xffff00});\r\n const sun = new THREE.Mesh(sun_geometry, sun_material);\r\n scene.add(sun);\r\n sun.position.set(1, 4, 1);\r\n\r\n //Calling the update function.\r\n update();\r\n }", "title": "" }, { "docid": "273948a665824ebd6a7cced4e5d488b5", "score": "0.6615885", "text": "initialize3D() {\n let width = this._canvas.width;\n let height = this._canvas.height;\n //Creates the scene where 3D Objects will be added\n this._scene = new THREE.Scene();\n //Creates the camera which will be the point of view to render the scene\n this._camera = new THREE.PerspectiveCamera(50, width / height, 0.1, 1000);\n this._camera.position.z = 50;\n this._camera.position.y = 30;\n this._camera.lookAt(new THREE.Vector3(0, 0, 0));\n //Creates the renderer which will render the scene from the camera point of view\n this._renderer = new THREE.WebGLRenderer({ canvas: this._canvas, antialias: true });\n this._renderer.shadowMap.enabled = true;\n this._renderer.shadowMap.type = THREE.PCFSoftShadowMap;\n this._renderer.shadowMap.needsUpdate = true;\n //Adds an ambient light to the scene. It lights all the vertex of the scene with the same intensity.\n let ambientLight = new THREE.AmbientLight(0xFFFFFF, 0.5);\n this._scene.add(ambientLight);\n //Adds a directional light to the scene.\n let spotLight = new THREE.DirectionalLight(0xFFAA44, 1);\n spotLight.position.set(20, 20, 20);\n spotLight.castShadow = true;\n spotLight.shadow.mapSize.width = 2048;\n spotLight.shadow.mapSize.height = 2048;\n spotLight.shadow.camera.left = -100;\n spotLight.shadow.camera.right = 100;\n spotLight.shadow.camera.top = 100;\n spotLight.shadow.camera.bottom = -100;\n //Attaches the light to a pivot to rotate the light arround the scene\n let lightPivot = new THREE.Object3D();\n lightPivot.add(spotLight);\n this._scene.add(lightPivot);\n this._objects.set('light', spotLight);\n this._objects.set('lightPivot', lightPivot);\n //Adds orbital controls to control the scene from the mouse and the keyboard\n let controls = new THREE.OrbitControls(this._camera, this._canvas);\n controls.minDistance = 5;\n controls.maxDistance = 100;\n }", "title": "" }, { "docid": "859b06c2807c8b3d301b7912216eea3b", "score": "0.6604192", "text": "function MainLight () {\n }", "title": "" }, { "docid": "01101da4b88beb9be012267f2d3e2846", "score": "0.6601905", "text": "function setupLights(gl, program, light, viewMatrix) {\n let { ambientIntensity, diffuseIntensity, position } = light;\n \n // fix light in world space\n position = vecMatMul(viewMatrix, Float32Array.from([...position, 1])).subarray(0, 3);\n\n const ambientILoc = program.uniforms.u_ia;\n const diffuseILoc = program.uniforms.u_id;\n const positionLoc = program.uniforms.u_light_position;\n\n gl.uniform3fv(positionLoc, position);\n gl.uniform1f(ambientILoc, ambientIntensity);\n gl.uniform1f(diffuseILoc, diffuseIntensity);\n}", "title": "" }, { "docid": "3783b461459f576b5a2292b25eae7be6", "score": "0.65955865", "text": "function setLightsNight() {\n scene.remove(hemiLight);\n hemiLight = new THREE.HemisphereLight(0xffffff, 0x000000, 0.6);\n hemiLight.position.set(0, 50, 0);\n scene.add(hemiLight);\n\n //hemiLightHelper = new THREE.HemisphereLightHelper(hemiLight, 10);\n //scene.add(hemiLightHelper);\n\n scene.remove(dirLight);\n scene.remove(dirLight.target);\n dirLight = new THREE.DirectionalLight(0xffffff, 0.05);\n dirLight.position.set(-1, 1.75, 1);\n dirLight.position.multiplyScalar(30);\n scene.add(dirLight);\n\n dirLight.castShadow = true;\n\n dirLight.shadow.mapSize.width = 2048;\n dirLight.shadow.mapSize.height = 2048;\n\n var d = 100;\n\n dirLight.shadow.camera.left = -d;\n dirLight.shadow.camera.right = d;\n dirLight.shadow.camera.top = d;\n dirLight.shadow.camera.bottom = -d;\n\n dirLight.shadow.camera.far = 3500;\n dirLight.shadow.bias = -0.0001;\n\n\n //dirLightHeper = new THREE.DirectionalLightHelper(dirLight, 10);\n //scene.add(dirLightHeper);\n scene.add(dirLight.target);\n\n}", "title": "" }, { "docid": "3e72019e03fe9791b1f12066a6f2067f", "score": "0.657976", "text": "function init() {\n\n\t\t\t\t// Create a camera, which defines where we're looking at.\t\t\n\t\t\t\trenderer = new THREE.WebGLRenderer( { \n\t\t\t\t\t\t\t\t\t\tcanvas : document.getElementById( rendererCanvasID ), //canvas\n\t\t\t\t\t\t\t\t\t\talpha : true, \n\t\t\t\t\t\t\t\t\t\tantialias: true \n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\trenderer.setSize( windowWidth, windowHeight );\n\n\n\t\t\t\t//Scene\n\t\t\t\tscene = new THREE.Scene();\n\n\n\t\t\t\t//camera\n\t\t\t\tcamera = new THREE.PerspectiveCamera(70, windowWidth / windowHeight, 1, 100);\n\t\t\t\tcamera.position.set(1, 1, 22);\n\n\t\t\t\t//controls\n\t\t\t\tcontrols = new THREE.OrbitControls(camera, renderer.domElement);\n\t\t\t\tcontrols.addEventListener('change', function() {\n\t\t\t\t\trenderer.render(scene, camera);\n\t\t\t\t}, false);\n\t\t\t\tcontrols.enableZoom = false;\n\t\t\t\tcontrols.enablePan = false;\n\n\n\n\t\t\t\t// Immediately use the texture for material creation\n\t\t\t\tmaterial = new THREE.MeshPhongMaterial({\n\t\t\t\t\tcolor: 0xEB6D35,\n\t\t\t\t\tspecular: 0xEB6D35,\n\t\t\t\t\tshininess: 15,\n\t\t\t\t\tflatShading: THREE.FlatShading,\n\t\t\t\t\tside: THREE.DoubleSide,\n\t\t\t\t\ttransparent: true,\n\t\t\t\t\topacity: .8\n\t\t\t\t});\n\n\n\t\t\t\t//HemisphereLight\n\t\t\t\tconst light1 = new THREE.DirectionalLight(0xffffff);\n\t\t\t\tlight1.position.set(-5, 10, 10);\n\t\t\t\tconst light2 = new THREE.PointLight(0xffffff, .7, 0);\n\t\t\t\tlight2.position.set(5, 5, -5);\n\n\t\t\t\tscene.add(light1, light2);\n\n\t\t\t\t//put the target object inside a parent object so the manipulation is easier\n\t\t\t\tparent = new THREE.Object3D();\n\n\n\t\t\t\taddObject();\n\n\t\t\t\tparent.position.set(-radius, height / 2, 0);\n\t\t\t\tparent.rotation.y = Math.PI;\n\t\t\t\tscene.add(parent);\n\n\n\t\t\t\trenderer.render(scene, camera);\n\t\t\t}", "title": "" }, { "docid": "6ce62498b9f9603427f75f2215d49573", "score": "0.6571788", "text": "function init(){\n\n camera = new THREE.PerspectiveCamera(70, width / height, 1, 10000);\n camera.position.z = 500;\n\n scene = new THREE.Scene();\n\n light = new THREE.PointLight(0xffffff, 1.1, 10000);\n light.position.set(0, 0, 500);\n\n generateParticles(450);\n generateEdges(geometries);\n\n renderer = new THREE.WebGLRenderer({alpha:true, antialias: true});\n renderer.setSize(width, height);\n\n document.getElementById('container').appendChild(renderer.domElement); // append renderer to body\n\n // add event listeners\n document.addEventListener('mousemove', onMouseMove);\n // document.addEventListener('mouseleave', onMouseLeave);\n window.addEventListener('resize', onResize);\n\n scene.add(light);\n\n}", "title": "" }, { "docid": "d0fb06cad52f86d534a97fb3ca061ecb", "score": "0.657099", "text": "addLight(){\n this.scene.lightsEnabled.push(this.enabled);\n this.scene.interface.addALight(this.i, this.id);\n }", "title": "" }, { "docid": "21f90f3e1390578fdebc96f635a0d3d0", "score": "0.6570531", "text": "function createLights() {\n hemisphereLight = new THREE.HemisphereLight(0xaaaaaa,0x000000, .9)\n shadowLight = new THREE.DirectionalLight(0xffffff, .9);\n shadowLight.position.set(150, 350, 350);\n shadowLight.castShadow = true;\n shadowLight.shadow.camera.left = -400;\n shadowLight.shadow.camera.right = 400;\n shadowLight.shadow.camera.top = 400;\n shadowLight.shadow.camera.bottom = -400;\n shadowLight.shadow.camera.near = 1;\n shadowLight.shadow.camera.far = 1000;\n shadowLight.shadow.mapSize.width = 2048;\n shadowLight.shadow.mapSize.height = 2048;\n scene.add(hemisphereLight); \n scene.add(shadowLight);\n }", "title": "" }, { "docid": "3f386a68fab32f64be591b56a1d5999d", "score": "0.65601337", "text": "function updateLight() {\n\tgl.uniform3fv(state.loc.light.position, [0.5, 0.5, 0.5]);\n\n\tgl.uniform4fv(state.loc.light.ambientIntensity, [0.7, 0.7, 0.7, 1.0]);\n\tgl.uniform4fv(state.loc.light.diffuseIntensity, [0.5, 0.5, 0.5, 1.0]);\n\tgl.uniform4fv(state.loc.light.specularIntensity, [0.7, 0.7, 0.7, 1.0]);\n}", "title": "" }, { "docid": "a386b8ba93989102150a3e49b22db54b", "score": "0.6556259", "text": "function Light(name,scene){var _this=_super.call(this,name,scene)||this;/**\n * Diffuse gives the basic color to an object.\n */_this.diffuse=new BABYLON.Color3(1.0,1.0,1.0);/**\n * Specular produces a highlight color on an object.\n * Note: This is note affecting PBR materials.\n */_this.specular=new BABYLON.Color3(1.0,1.0,1.0);/**\n * Defines the falloff type for this light. This lets overrriding how punctual light are\n * falling off base on range or angle.\n * This can be set to any values in Light.FALLOFF_x.\n *\n * Note: This is only usefull for PBR Materials at the moment. This could be extended if required to\n * other types of materials.\n */_this.falloffType=Light.FALLOFF_DEFAULT;/**\n * Strength of the light.\n * Note: By default it is define in the framework own unit.\n * Note: In PBR materials the intensityMode can be use to chose what unit the intensity is defined in.\n */_this.intensity=1.0;_this._range=Number.MAX_VALUE;_this._inverseSquaredRange=0;/**\n * Cached photometric scale default to 1.0 as the automatic intensity mode defaults to 1.0 for every type\n * of light.\n */_this._photometricScale=1.0;_this._intensityMode=Light.INTENSITYMODE_AUTOMATIC;_this._radius=0.00001;/**\n * Defines the rendering priority of the lights. It can help in case of fallback or number of lights\n * exceeding the number allowed of the materials.\n */_this.renderPriority=0;_this._shadowEnabled=true;_this._excludeWithLayerMask=0;_this._includeOnlyWithLayerMask=0;_this._lightmapMode=0;/**\n * @hidden Internal use only.\n */_this._excludedMeshesIds=new Array();/**\n * @hidden Internal use only.\n */_this._includedOnlyMeshesIds=new Array();_this.getScene().addLight(_this);_this._uniformBuffer=new BABYLON.UniformBuffer(_this.getScene().getEngine());_this._buildUniformLayout();_this.includedOnlyMeshes=new Array();_this.excludedMeshes=new Array();_this._resyncMeshes();return _this;}", "title": "" }, { "docid": "ba0c791602985ce7e465d93d647548b6", "score": "0.6539065", "text": "Start(){\n\t\tthis.track = new THREE.Object3D();\n\t\tthis.material = new THREE.MeshBasicMaterial( {color: 0xFFFFFF, wireframe: true} );\n\n\t\tthis.createTrack();\n\n\t\tscene.add(this.track);\n\t}", "title": "" }, { "docid": "2b23b7592987278b841e703afb0d8095", "score": "0.65165335", "text": "function init() {\n scene = new THREE.Scene();\n\n renderer = new THREE.WebGLRenderer();\n renderer.setClearColor(new THREE.Color(0xEEEEEE));\n renderer.setSize(window.innerWidth, window.innerHeight);\n\n camera = perspCam;\n camera.position.x = 0;\n camera.position.y = 500;\n camera.position.z = 500;\n camera.lookAt(scene.position);\n\n var axes = new THREE.AxesHelper(20);\n scene.add(axes);\n\n document.body.appendChild(renderer.domElement);\n\n createStructure();\n createDirectionalLight();\n\n //Creating spotlights\n createSpotlight(300, 300, 300);\n createSpotlight(0, 300, -450);\n createSpotlight(-300, 300, 300);\n\n //Adding event listeners\n window.addEventListener(\"keydown\", onKeyDown);\n window.addEventListener(\"keyup\", onKeyUp);\n window.addEventListener(\"resize\", onResize);\n\n //Adding key actions\n addKeyActions();\n\n animate();\n}", "title": "" }, { "docid": "f5f92b50516efb785ea75f04279eb97d", "score": "0.65105873", "text": "function main() {\r\n // 1. create the scene\r\n scene = new THREE.Scene();\r\n scene.background = new THREE.Color(0x000000);\r\n\r\n // 2. create an locate the camera + light \r\n camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 1000);\r\n camera.position.x = 15;\r\n camera.position.z = 10;\r\n\r\n // light\r\n lights = [\r\n ambientLight = new THREE.AmbientLight(0xffffff, 2),\r\n directionalLight = new THREE.DirectionalLight(0xffffff, 2),\r\n hemisphereLight = new THREE.HemisphereLight(0xffffff, 0x00FF00, 2),\r\n pointLight = new THREE.PointLight(0xffffff, 2, 100, 2),\r\n spotLight = new THREE.SpotLight(0xffffff, 2, 100, 1, 1, 1)\r\n ];\r\n lights.forEach((light) => {\r\n light.position.set(0, 15, 50);\r\n scene.add(light);\r\n light.visible = false;\r\n });\r\n lights[document.querySelector('input[name=\"Light\"]:checked').value].visible = true;\r\n\r\n document.getElementById('lightChange').addEventListener('change', function () {\r\n lights.forEach((light) => {\r\n light.visible = false;\r\n });\r\n lights[document.querySelector('input[name=\"Light\"]:checked').value].visible = true;\r\n });\r\n\r\n // 3. create an locate the object on the scene \r\n // box\r\n box = new THREE.Mesh(\r\n new THREE.BoxGeometry(1, 1, 1),\r\n new THREE.MeshBasicMaterial({\r\n color: 'rgb(161,40,48)'\r\n })\r\n );\r\n scene.add(box);\r\n box.position.x = -3.5;\r\n box.position.y = 1.5;\r\n\r\n // cone\r\n cone = new THREE.Mesh(\r\n new THREE.ConeGeometry(0.5, 1, 6),\r\n new THREE.MeshLambertMaterial({\r\n color: 'rgb(161,40,48)',\r\n emissive: 'rgb(0,100,0)',\r\n emissiveIntensity: 0.3,\r\n wireframe: true\r\n })\r\n );\r\n scene.add(cone);\r\n cone.position.y = 1.5;\r\n\r\n // cylinder\r\n cylinder = new THREE.Mesh(\r\n new THREE.CylinderGeometry(0.5, 0.5, 1, 20),\r\n new THREE.MeshStandardMaterial({\r\n color: 'rgb(161,40,48)',\r\n metalness: 0.5,\r\n roughness: 0.5\r\n })\r\n );\r\n scene.add(cylinder);\r\n cylinder.position.x = 3.5;\r\n cylinder.position.y = 1.5;\r\n\r\n // torus\r\n torus = new THREE.Mesh(\r\n new THREE.TorusGeometry(0.4, 0.2, 20, 20),\r\n new THREE.MeshPhysicalMaterial({\r\n color: 'rgb(161,40,48)',\r\n metalness: 0.5,\r\n roughness: 0.5,\r\n clearcoat: 0.8\r\n })\r\n );\r\n scene.add(torus);\r\n torus.position.x = -3.5;\r\n torus.position.y = -0.5;\r\n\r\n // dodecahedron\r\n dodecahedron = new THREE.Mesh(\r\n new THREE.DodecahedronGeometry(0.5),\r\n new THREE.MeshPhongMaterial({\r\n color: 'rgb(161,40,48)',\r\n shininess: 100,\r\n wireframe: true\r\n })\r\n );\r\n scene.add(dodecahedron);\r\n dodecahedron.position.y = -0.5;\r\n\r\n // torusknot\r\n torusknot = new THREE.Mesh(\r\n new THREE.TorusKnotGeometry(0.4, 0.2, 20, 20, 2, 3),\r\n new THREE.MeshNormalMaterial()\r\n );\r\n scene.add(torusknot);\r\n torusknot.position.x = 3.5;\r\n torusknot.position.y = -0.5;\r\n\r\n // lathe\r\n const points = [];\r\n for (let i = 0; i < 10; ++i)\r\n points.push(new THREE.Vector2(Math.sin(i * 0.2) * 0.3 + 0.3, (i - 5) * 0.08));\r\n lathe = new THREE.Mesh(\r\n new THREE.LatheGeometry(points),\r\n new THREE.MeshDepthMaterial()\r\n );\r\n scene.add(lathe);\r\n lathe.position.y = -2;\r\n\r\n // 4. create the renderer \r\n renderer = new THREE.WebGLRenderer();\r\n renderer.setSize(window.innerWidth - 100, window.innerHeight - 200);\r\n document.body.appendChild(renderer.domElement);\r\n\r\n const controls = new THREE.OrbitControls(camera, renderer.domElement);\r\n renderer.render(scene, camera, controls);\r\n\r\n //call main animation loop\r\n mainLoop();\r\n}", "title": "" }, { "docid": "c96b87323c6e7d393e07f61d55524deb", "score": "0.64999443", "text": "function init() {\n ////////////////////////////////////////////////////////\n //THREE Setup\n ///////////////////////////////////////////////////////\n // crear nuestra escena - OBJETO.\n scene = new THREE.Scene(); // crea un objeto escena.\n\n //////////////////////////////////////////////////////\n //LUCES\n //////////////////////////////////////////////////////\n\n let light = new THREE.PointLight(0xffffff, 1, 100); //creo nueva luz blanca\n light.position.set(0, 4, 4); //indico la posicion de la luz EN EL VIDEO PONE 0 en el último 4\n light.castShadow = true; //activo la capacidad de generar sombras.\n scene.add(light); //agrego la luz a mi escena \n\n let lightSphere = new THREE.Mesh( // Esfera de luz\n new THREE.SphereGeometry(0.1), //Tamaño pequeño\n new THREE.MeshBasicMaterial({ \n color: 0xffffff, // Este es un color blanco\n transparent: true, // Decimos que es transparente\n opacity: 0.8 // Le damos opacidad\n })\n );\n\n lightSphere.position.copy(light); // Estamos creando una pantalla de lampara. \n // Estamos copiando la esfera a donde tenemos el objeto\n scene.add(lightSphere);\n\n //creamos luces \n let ambientLight = new THREE.AmbientLight(0xcccccc); //creo las luz 0.5?? ESO ESTÁ EN EL VIDEO DE CLASE 7 pro luego NO lo pone\n scene.add(ambientLight); //agrego la luz a mi escena. \n\n camera = new THREE.Camera(); //creo objeto camara \n scene.add(camera); // agrego camara a la escena\n\n //permite mostrar las cosas en 3d en la pantalla\n renderer = new THREE.WebGLRenderer({\n antialias: true,\n alpha: true // permite generar transparencias para que las cosas se vean sin fondo\n });\n\n renderer.setClearColor(new THREE.Color('lightgrey'), 0);\n renderer.setSize(640, 480); // Esto es para la definicion\n renderer.domElement.style.position = 'absolute';\n renderer.domElement.style.top = '0px';\n renderer.domElement.style.left = '0px';\n\n renderer.shadowMap.enabled = true; // Hacemos una sombra\n renderer.shadowMap.type = THREE.PCFSoftShadowMap; // Acá especificamos el tipo de sombra\n\n document.body.appendChild(renderer.domElement); // agregarlo a nuestra pagina web\n // Esto es como una plantilla, rara ves varía, es similar a la instruccion de scene.add camera \n // Lo que estamos haciendo es añadiendo el renderer a la pag web que tenemos abierta\n\n //tiempo\n clock = new THREE.Clock();\n deltaTime = 0;\n totalTime = 0;\n\n ////////////////////////////////////////////////////////\n //AR Setup. \n //Acá viene todo lo que tiene que ver con realidad aumentada\n ///////////////////////////////////////////////////////\n\n arToolkitSource = new THREEx.ArToolkitSource({\n sourceType: 'webcam', \n // con esto nuestra app sabe q tiene q activar el video de nuestra camara web\n });\n\n function onResize() { // Acá estamos generando una funcion dentro de otra\n arToolkitSource.onResize() //EN EL VIDEO PONE ; pero esto NO va\n arToolkitSource.copySizeTo(renderer.domElement) //EN EL VIDEO PONE ; pero esto NO va\n if (arToolkitContext.arController !== null) { //Esto significa NO es IGUAL\n arToolkitSource.copySizeTo(arToolkitContext.arController.canvas) //EN EL VIDEO PONE ; pero esto NO va\n }\n }\n\n // Esto permite generar mis objetos en realidad aumentada\n arToolkitSource.init(function onReady() {\n onResize();\n });\n\n //agregamos un event listener\n //como se da cuenta que agrandamos o achicamos la pantalla)\n window.addEventListener('resize', function () { onResize() }); //Esto ajusta la pantalla del dispositivo\n\n //Setup ArKitContext\n arToolkitContext = new THREEx.ArToolkitContext({ //EN EL VIDEO al principio lo pone sin la X, pero esta SI va\n cameraParametersUrl: 'data/camera_para.dat',\n detectionMode: 'mono' // Modo de deteccion monocromatico, solo detecta imgs en BYN o escala de grises\n });\n\n arToolkitContext.init(function onCompleted() {\n camera.projectionMatrix.copy(arToolkitContext.getProjectionMatrix());\n });\n\n /////////////////////////////////////////////////\n //Marker setup \n //Desde este punto de puede hacer todo personalizado, lo anterior es una plantilla\n /////////////////////////////////////////////////\n\n markerRoot1 = new THREE.Group(); //creamos un grupo de objetos\n scene.add(markerRoot1); // agregamos el grupo a la escena. \n\n //Creamos nuestro marcador ACA HAY QUE CAMBIAR EL NOMBRE DEL MARCADOR, yo podría poner mas de un marcador\n let markerControl = new THREEx.ArMarkerControls(arToolkitContext, markerRoot1, {\n\n type: 'pattern', patternUrl: 'data/pattern-MarcadorIsabelPinto.patt', // por pattern es que los archivos se llaman .patt\n // El data/patter-MarcadorIsabelPinto.patt es el marcador que vamos a utilizar en esta tarea\n });\n\n /////////////////////////////////////////////////\n //GEOMETRY\n /////////////////////////////////////////////////\n\n //Creo una geometria cubo son 3 PASOS - GEOMETRY 1\n let geo1 = new THREE.CubeGeometry(.75, .75, .75); // PASO 1: crear la plantilla, los numeros son las dimensiones en la clase pone puros 25, luego lo cambia a 75\n // PASO 2: creo material \n // ESTO SALE EN EL MIN 2:06:01 Y ES BIEN DISTINTO EL CODIGO - REVISAR (LE PONE TRANSPARENCIA Y OPACIDAD)\n let material1 = new THREE.MeshLambertMaterial({ color: Math.random() * 0xffffff }); //creamos el material \n // Esto nos da u color random cada ves que inicialicemos nuestra app\n\n //Creo una geometria - GEOMETRY 2\n let geo2 = new THREE.CubeGeometry(.75, .75, .75); // crear la plantilla\n //creo material \n let material2 = new THREE.MeshLambertMaterial({ color: Math.random() * 0xffffff }); //creamos el material\n\n //////////////MESH1//////////////////////////////////////////\n // PASO 3 creo un mesh con la geometria y el material \n mesh1 = new THREE.Mesh(geo1, material1); //nuestro mesh \n //Cambio la posicion de mi mesh \n mesh1.position.y = 0.5;\n mesh1.position.z = -0.3;\n\n //Activo el recibir y proyectar sombras en otros meshes\n mesh1.castShadow = true;\n mesh1.receiveShadow = true;\n\n //////////////MESH2//////////////////////////////////////////\n //creo un mesh con la geometria y el material \n mesh2 = new THREE.Mesh(geo2, material2); //nuestro mesh \n //CAMBIO LA POSICION DE MI MESH \n mesh2.position.x = 0.75;\n mesh2.position.y = 1.0;\n //activo el recibir y proyectar sombras en otros meshes\n mesh2.castShadow = true;\n mesh2.receiveShadow = true;\n\n\n // ESTO LO PONE COMO COMENTARIO PQ LUEGO AGREGA LOS OBJETOS DE RHINO, es cm para no agregar los mesh a la escena\n //markerRoot1.add(mesh1); //esta linea agrega el cubo a mi grupo y finalmente se puede ver en la escena \n //markerRoot1.add(mesh2); //agregando el mesh 2 a mi escena\n\n ////////////////////PISO////////////////\n let floorGeometry = new THREE.PlaneGeometry(20, 20); // Es el plano dde se ubican mis geometrias ??\n let floorMaterial = new THREE.ShadowMaterial(); // Material transparente, su unica funcion es recibir sombras\n floorMaterial.opacity = 0.25; // Este valor no puede ser 1 pq la sombra se vería super fuerte y falsa, sería totalmente negra\n\n let floorMesh = new THREE.Mesh(floorGeometry, floorMaterial);\n\n floorMesh.rotation.x = -Math.PI / 2; //Se rota para dejarlo totalmente horizontal\n floorMesh.receiveShadow = true; //Le decimos que SI reciba sombras\n markerRoot1.add(floorMesh);\n\n /////// OBJ IMPORT/////////////////////\n function onProgress(xhr) { console.log((xhr.loaded / xhr.total * 100) + \"% loaded\"); }\n function onError(xhr) { console.log(\"ha ocurrido un error\") };\n\n //////OBJETO RHINO 1 ///////////////\n new THREE.MTLLoader()\n .setPath('data/models/')\n .load('1.mtl', function (materials) {\n materials.preload();\n new THREE.OBJLoader()\n .setMaterials(materials)\n .setPath('data/models/')\n .load('1.obj', function (group) {\n RhinoMesh = group.children[0];\n RhinoMesh.material.side = THREE.DoubleSide;\n RhinoMesh.scale.set(0.2, 0.2, 0.2);\n RhinoMesh.castShadow = true;\n RhinoMesh.receiveShadow = true;\n\n markerRoot1.add(RhinoMesh);\n }, onProgress, onError);\n });\n\n //////OBJETO RHINO 2 ///////////////\n new THREE.MTLLoader()\n .setPath('data/models/')\n .load('2.mtl', function (materials) {\n materials.preload();\n new THREE.OBJLoader()\n .setMaterials(materials)\n .setPath('data/models/')\n .load('2.obj', function (group) {\n RhinoMesh2 = group.children[0];\n RhinoMesh2.material.side = THREE.DoubleSide;\n RhinoMesh2.scale.set(0.2, 0.2, 0.2);\n RhinoMesh2.castShadow = true;\n RhinoMesh2.receiveShadow = true;\n\n markerRoot1.add(RhinoMesh2);\n }, onProgress, onError);\n });\n\n //////OBJETO RHINO 3 ///////////////\n new THREE.MTLLoader()\n .setPath('data/models/')\n .load('3.mtl', function (materials) {\n materials.preload();\n new THREE.OBJLoader()\n .setMaterials(materials)\n .setPath('data/models/')\n .load('3.obj', function (group) {\n RhinoMesh3 = group.children[0];\n RhinoMesh3.material.side = THREE.DoubleSide;\n RhinoMesh3.scale.set(0.2, 0.2, 0.2);\n RhinoMesh3.castShadow = true;\n RhinoMesh3.receiveShadow = true;\n\n markerRoot1.add(RhinoMesh3);\n }, onProgress, onError);\n });\n\n //////OBJETO RHINO 4 ///////////////\n new THREE.MTLLoader()\n .setPath('data/models/')\n .load('4.mtl', function (materials) {\n materials.preload();\n new THREE.OBJLoader()\n .setMaterials(materials)\n .setPath('data/models/')\n .load('4.obj', function (group) {\n RhinoMesh4 = group.children[0];\n RhinoMesh4.material.side = THREE.DoubleSide;\n RhinoMesh4.scale.set(0.2, 0.2, 0.2);\n RhinoMesh4.castShadow = true;\n RhinoMesh4.receiveShadow = true;\n\n markerRoot1.add(RhinoMesh4);\n }, onProgress, onError);\n });\n\n //////OBJETO RHINO 5 cintillo///////////////\n new THREE.MTLLoader()\n .setPath('data/models/')\n .load('5.mtl', function (materials) {\n materials.preload();\n new THREE.OBJLoader()\n .setMaterials(materials)\n .setPath('data/models/')\n .load('5.obj', function (group) {\n RhinoMesh5 = group.children[0];\n RhinoMesh5.material.side = THREE.DoubleSide;\n RhinoMesh5.scale.set(0.2, 0.2, 0.2);\n RhinoMesh5.castShadow = true;\n RhinoMesh5.receiveShadow = true;\n \n markerRoot1.add(RhinoMesh5);\n }, onProgress, onError);\n });\n\n \n\n}", "title": "" }, { "docid": "87851bebf51a9434886b8417142c5d52", "score": "0.6496335", "text": "function setLightsDay() {\n scene.remove(hemiLight);\n hemiLight = new THREE.HemisphereLight(0xffffff, 0xffffff, 0.6);\n hemiLight.color.setHSL(0.6, 1, 0.6);\n hemiLight.groundColor.setHSL(0.095, 1, 0.75);\n hemiLight.position.set(0, 50, 0);\n scene.add(hemiLight);\n\n //hemiLightHelper = new THREE.HemisphereLightHelper(hemiLight, 10);\n //scene.add(hemiLightHelper);\n\n //\n scene.remove(dirLight);\n scene.remove(dirLight.target);\n dirLight = new THREE.DirectionalLight(0xffffff, 1);\n dirLight.color.setHSL(0.1, 1, 0.95);\n dirLight.position.set(-1, 1.75, 1);\n dirLight.position.multiplyScalar(30);\n scene.add(dirLight);\n\n dirLight.castShadow = true;\n\n dirLight.shadow.mapSize.width = 2048;\n dirLight.shadow.mapSize.height = 2048;\n\n var d = 100;\n\n dirLight.shadow.camera.left = -d;\n dirLight.shadow.camera.right = d;\n dirLight.shadow.camera.top = d;\n dirLight.shadow.camera.bottom = -d;\n\n dirLight.shadow.camera.far = 3500;\n dirLight.shadow.bias = -0.0001;\n\n\n //dirLightHeper = new THREE.DirectionalLightHelper(dirLight, 10);\n //scene.add(dirLightHeper);\n scene.add(dirLight.target);\n\n}", "title": "" }, { "docid": "d19f9f3879b35463e39909bcf9ff633c", "score": "0.64788747", "text": "function initLight(id){\n \tinit(id);\n\t}", "title": "" }, { "docid": "2c137454a3b0cdcc2b4a1800fb899d8b", "score": "0.64730835", "text": "function init() {\n scene = new THREE.Scene()\n camera = new THREE.PerspectiveCamera(45, innerWidth / innerHeight, 1, 1000);\n camera.position.z = 5;\n renderer = new THREE.WebGLRenderer()\n renderer.setClearColor(0x379683, 1);\n renderer.setSize(window.innerWidth, window.innerHeight);\n renderer.domElement.setAttribute(\"id\", \"canvas\")\n document.body.appendChild(renderer.domElement);\n \n geometry = new THREE.BoxGeometry(1.5, 1.5, 1.5);\n material = new THREE.MeshPhongMaterial({ color: 0x05386b, map: texture });\n cube = new THREE.Mesh(geometry, material);\n cube.position.x = 1;\n scene.add(cube);\n\n var dl = new THREE.DirectionalLight(0xffffff, 0.8);\n dl.position.x = 1;\n dl.position.z = 2;\n scene.add(dl);\n\n var al = new THREE.AmbientLight(0xffffff);\n al.intensity = 0.3;\n scene.add(al);\n}", "title": "" }, { "docid": "089078467dc39ef45201a4444097ce76", "score": "0.64698833", "text": "function createScene() {\r\n\r\n // Create the scene space\r\n var scene = new BABYLON.Scene(engine);\r\n\r\n // Add a camera to the scene and attach it to the canvas\r\n camera = new BABYLON.ArcRotateCamera(\"Camera\", Math.PI / 2, Math.PI / 4, 4, BABYLON.Vector3.Zero(), scene);\r\n \r\n \r\n // Add lights to the scene\r\n var myLight = new BABYLON.DirectionalLight(\"dir01\", new BABYLON.Vector3(0, -0.5, 1.0), scene);\r\n\r\n // Add and manipulate meshes in the scene\r\n lock1 = BABYLON.MeshBuilder.CreateBox(\"box1\", {height: \".5\", width: \".2\", depth: \".2\"}, scene);\r\n lock2 = BABYLON.MeshBuilder.CreateBox(\"box2\", {height: \".5\", width: \".2\", depth: \".2\"}, scene);\r\n lock3 = BABYLON.MeshBuilder.CreateBox(\"box3\", {height: \".5\", width: \".2\", depth: \".2\"}, scene);\r\n\r\n //set position of locks \r\n lock1.position.x = 1;\r\n lock2.position.x = 0;\r\n lock3.position.x = -1;\r\n \r\n light = new BABYLON.HemisphericLight(\"HemiLight\", new BABYLON.Vector3(1, 1, 0), scene);\r\n\r\n //Materials\r\n blueMat = new BABYLON.StandardMaterial(\"blueMat\", scene);\r\n blueMat.diffuseColor = new BABYLON.Color3(0, 0, 1);\r\n blueMat.specularColor = new BABYLON.Color3(0.2, 0.2, 0.87);\r\n\r\n whiteMat = new BABYLON.StandardMaterial(\"whiteMat\", scene);\r\n whiteMat.diffuseColor = new BABYLON.Color3(0.1, 0.1, 0.1);\r\n whiteMat.specularColor = new BABYLON.Color3(0, 0, 0);\r\n\r\n greenMat = new BABYLON.StandardMaterial(\"greenMat\", scene);\r\n greenMat.diffuseColor = new BABYLON.Color3(0, 1, 0);\r\n greenMat.specularColor = new BABYLON.Color3(.5, 1, .2);\r\n \r\n \r\n\r\n \r\n return scene;\r\n}", "title": "" }, { "docid": "d7e1704643c93a9cfd37a7a99d72f60f", "score": "0.64673275", "text": "function createLights(scene) {\n lights[0] = new THREE.PointLight(\"#004d99\", 0.5, 0);\n lights[1] = new THREE.PointLight(\"#004d99\", 0.5, 0);\n lights[2] = new THREE.PointLight(\"#004d99\", 0.7, 0);\n lights[3] = new THREE.AmbientLight(\"#ffffff\");\n\n lights[0].position.set(200, 0, -400);\n lights[1].position.set(200, 200, 400);\n lights[2].position.set(-200, -200, -50);\n\n scene.add(lights[0]);\n scene.add(lights[1]);\n scene.add(lights[2]);\n scene.add(lights[3]);\n}", "title": "" }, { "docid": "3e09569c5573f8093174f511c681256e", "score": "0.64578", "text": "launch() {\n // get the size of the window\n this.el.renderer.setSize(window.innerWidth, window.innerHeight);\n // get this dom element\n this.dom.appendChild(this.el.renderer.domElement);\n\n this.cube = new THREE.Mesh(this.els.geometry, this.els.material);\n this.el.scene.add(this.cube);\n\n this.light = new THREE.AmbientLight(0x404040); // soft white light\n this.el.scene.add(this.light);\n\n this.el.camera.position.z = 5;\n // this.render();\n }", "title": "" }, { "docid": "f71e70ff23d3a36c4d01c3ec863a9891", "score": "0.6449734", "text": "function setupMainScene() {\n camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 10000);\n camera.position.z = 500;\n\n scene = new THREE.Scene();\n\n cUniforms2 = {\n texture: {\n type: \"t\",\n value: rtTexture\n },\n delta: {\n type: \"v2\",\n value: new THREE.Vector2(1.0 / simRes, 1.0 / simRes)\n }\n };\n waterMat = new THREE.ShaderMaterial({\n uniforms: cUniforms2,\n vertexShader: document.getElementById('vs_rt').textContent,\n fragmentShader: document.getElementById('fs_setColor').textContent,\n wireframe: true\n });\n var waterGeo = new THREE.PlaneGeometry(512, 512, simRes - 1, simRes - 1);\n water = new THREE.Mesh(waterGeo, waterMat);\n water.rotation.x = THREE.Math.degToRad(-45);\n scene.add(water);\n\n\n // add a basic directional light\n var lt = new THREE.DirectionalLight(0xffffff);\n lt.position.set(300, 400, 0);\n lt.target.position.set(0, 0, 0);\n scene.add(lt);\n\n}", "title": "" }, { "docid": "44b9ebf1c9bc72db3053e9aea45f0593", "score": "0.64441746", "text": "function updateLights() {\n dirLight.position.set(robot.position.x, 50, robot.position.z);\n dirLight.target.position.set(robot.position.x - 10, 0, robot.position.z - 10);\n hemiLight.position.set(robot.position.x, 0, robot.position.z);\n if (mode_dn == 0) {\n skyDay.position.set(controls.getObject().position.x, robot.position.y, controls.getObject().position.z);\n } else {\n skyNight.position.set(controls.getObject().position.x, robot.position.y, controls.getObject().position.z);\n }\n\n}", "title": "" }, { "docid": "d01be770df0e9ab6f0b63f20db283662", "score": "0.6416139", "text": "async init() {\n // init scene\n this.scene = new THREE.Scene();\n this.scene.background = new THREE.Color(config.renderController.light.background);\n \n // init light\n const directionLight = new THREE.DirectionalLight(\n new THREE.Color(config.renderController.light.directional.color),\n config.renderController.light.directional.intensity);\n directionLight.position.set(...config.renderController.light.directional.position);\n this.scene.add(directionLight);\n\n const ambientLight = new THREE.AmbientLight(\n new THREE.Color(config.renderController.light.ambient.color),\n config.renderController.light.ambient.intensity);\n this.scene.add(ambientLight);\n\n // init camera\n this.camera = new THREE.PerspectiveCamera(\n config.renderController.camera.fov,\n window.innerWidth / window.innerHeight,\n config.renderController.camera.near,\n config.renderController.camera.far);\n this.camera.position.set(...config.renderController.camera.defaultPosition);\n this.scene.add(this.camera);\n\n // init renderer\n this.renderer = new THREE.WebGLRenderer({antialias: config.renderController.antialias});\n\n // load textures\n const loader = new THREE.TextureLoader();\n const textureSet = config.renderController.texture;\n for (const textureName in textureSet) {\n this.textures[textureName] = {};\n for (const textureType in textureSet[textureName]) {\n let texture;\n try {\n texture = await loader.loadAsync(textureSet[textureName][textureType]);\n } catch {\n throw new LoadTextureError(`Cannot load map '${textureType}' of texture '${textureName}'.`);\n }\n this.textures[textureName][textureType] = texture;\n }\n }\n }", "title": "" }, { "docid": "da5128f3a47bc9ef4205a5358ad82929", "score": "0.64067733", "text": "function init() {\n // Instantiate a new Scene object\n //scene = new Scene();\n setupRenderer(); // setup the default renderer\n setupCamera(); // setup the camera\n /* ENTER CODE HERE */\n // add an axis helper to the scene\n axes = new AxisHelper(10);\n scene.add(axes);\n console.log(\"Added Axis Helper to scene...\");\n //Add a Plane to the Scene\n plane = new gameObject(new PlaneGeometry(24, 24, 1, 1), new LambertMaterial({ color: 0x123456 }), 0, 0, 0);\n plane.rotation.x = -0.5 * Math.PI;\n plane.receiveShadow = true;\n scene.add(plane);\n console.log(\"Added Plane Primitive to scene...\");\n // Add Lights to the scene\n spotLight = new SpotLight(0xffffff);\n spotLight.position.set(14, 40, 12);\n spotLight.rotation.set(0, 0, 0);\n spotLight.intensity = 2;\n spotLight.castShadow = true;\n //make shadows more neat and a bit brighter\n spotLight.shadowMapWidth = 1024;\n spotLight.shadowMapHeight = 1024;\n spotLight.shadowDarkness = 0.5;\n spotLight.shadowCameraFar = 1000;\n spotLight.shadowCameraNear = 0.1;\n scene.add(spotLight);\n ambientLight = new AmbientLight(0x949494);\n scene.add(ambientLight);\n console.log(\"Added a AmbientLight and SpotLight Light to Scene\");\n //load Textures for the tower\n concreteTexture = THREE.ImageUtils.loadTexture('Content/textures/concrete.jpg');\n redGlassTexture = THREE.ImageUtils.loadTexture('Content/textures/red.jpg');\n blueGlassTexture = THREE.ImageUtils.loadTexture('Content/textures/blue.jpg');\n whitePlalsticTexture = THREE.ImageUtils.loadTexture('Content/textures/white.jpg');\n //generate tower\n tower = new Object3D();\n towerBase = new Object3D();\n towerRestaraunt = new Object3D();\n towerTop = new Object3D();\n //firs 8 block of tower\n scaler = 0.9;\n addCubes(0, 1, 0, 1.2, 1, 1.2, towerBase, concreteTexture);\n addCubes(0, 2, 0, 1.15, 1, 1.15, towerBase, concreteTexture);\n addCubes(0, 3, 0, 1.10, 1, 1.10, towerBase, concreteTexture);\n addCubes(0, 4, 0, 1.05, 1, 1.05, towerBase, concreteTexture);\n addCubes(0, 5, 0, 1, 1, 1, towerBase, concreteTexture);\n addCubes(0, 6, 0, 0.95, 1, 0.95, towerBase, concreteTexture);\n addCubes(0, 7, 0, 0.9, 1, 0.9, towerBase, concreteTexture);\n addCubes(0, 8, 0, 0.85, 1, 0.85, towerBase, concreteTexture);\n //restaraunt part\n addCubes(0, 8.33, 0, 1.6, 0.33, 1.6, towerRestaraunt, whitePlalsticTexture);\n addCubes(0, 8.66, 0, 1.7, 0.33, 1.7, towerRestaraunt, blueGlassTexture);\n addCubes(0, 9, 0, 1.5, 0.34, 1.5, towerRestaraunt, whitePlalsticTexture);\n //top part with antiplane signal\n addCubes(0, 9.33, 0, 0.2, 1.5, 0.2, towerTop, concreteTexture);\n addCubes(0, 10, 0, 0.21, 0.5, 0.21, towerTop, redGlassTexture);\n tower.add(towerBase);\n tower.add(towerRestaraunt);\n tower.add(towerTop);\n scene.add(tower);\n // add controls\n gui = new GUI();\n control = new Control(0.00);\n addControl(control);\n // Add framerate stats\n addStatsObject();\n console.log(\"Added Stats to scene...\");\n document.body.appendChild(renderer.domElement);\n gameLoop(); // render the scene\t\n function addCubes(x, y, z, h, w, d, attachTo, cubeTexture) {\n var cubeGeometry = new CubeGeometry(h * scaler, w * scaler, d * scaler);\n var thisCube = new Mesh(cubeGeometry, new LambertMaterial({ color: 0xffffff, map: cubeTexture }));\n //-----------Random Color Cubes(now replaced with textures)------------------------------------\n //var thisCube:Mesh = new Mesh(cubeGeometry,new LambertMaterial({color: Math.random() * 0xffffff}));\n thisCube.position.set(x * scaler, y * scaler - 0.5, z * scaler);\n thisCube.castShadow = true;\n thisCube.receiveShadow = true;\n attachTo.add(thisCube);\n }\n }", "title": "" }, { "docid": "d519da8bfaeae61ce5a8526f32afb64e", "score": "0.6399347", "text": "function Light() {\n\n this.ambientLight = function ( x, y, z, color, intensity) {\n ambientLight = new THREE.AmbientLight(color, intensity);\n ambientLight.position.set(x,y,z);\n \tscene.add(ambientLight);\n }\n\n this.pointLight = function ( x,y,z, color, intensity, distance) {\n light = new THREE.PointLight(color, intensity, distance);\n \tlight.position.set(x,y,z);\n \tlight.castShadow = true;\n \tlight.shadow.camera.near = 0.1;\n \tlight.shadow.camera.far = 25;\n \tscene.add(light);\n }\n\n this.hemisphereLight = function () {\n hemisphere = new THREE.HemisphereLight( 0xeeeeff, 0x777788, 0.75 );\n\t\themisphere.position.set( -3,6,-3 );\n\t\tscene.add( hemisphere );\n }\n\n}", "title": "" }, { "docid": "213d6c6261d9b366f3b1dbab0e1fae0a", "score": "0.63924503", "text": "function setupBasicScene() {\n // make a ground plane.\n let geometry1 = new THREE.BoxGeometry(10, 0.1, 10);\n let material1 = new THREE.MeshStandardMaterial({\n color: \"#dddddd\",\n metalness: 0.2,\n roughness: 0.8\n });\n /**@type{THREE.Mesh} */\n let ground = new THREE.Mesh(geometry1, material1);\n ground.position.set(0, -1, 0);\n scene.add(ground);\n\n let locs = [-2, 2];\n /**@type{THREE.Geometry} */\n let geometry2 = new THREE.CylinderGeometry(0.5, 0.75, 2, 16, 8);\n /**@type{THREE.Material} */\n let material2 = new THREE.MeshPhongMaterial({ color: \"#888888\", shininess: 50 });\n locs.forEach(function(x_loc) {\n locs.forEach(function(z_loc) {\n /**@type{THREE.Mesh} */\n let object = new THREE.Mesh(geometry2, material2);\n object.position.x = x_loc;\n object.position.z = z_loc;\n object.position.y = 0;\n object.receiveShadow = true;\n\n scene.add(object);\n });\n });\n\n /**@type{THREE.AmbientLight} */\n let amb_light = new THREE.AmbientLight(0xffffff, 0.2);\n scene.add(amb_light);\n }", "title": "" }, { "docid": "c33eb852c8a7eae164c6591928311e73", "score": "0.6391905", "text": "function setupStage(){\n let geometry = new THREE.BoxGeometry();\n let material = new THREE.MeshBasicMaterial({\n color: 0xffffff,\n wireframe:true,\n });\n\n stageBox = new THREE.Mesh( geometry , material );\n\n camera.position.z = 1.25;\n camera.position.y = .55;\n camera.rotation.x = -.5;\n\n mainAmbientLight = new THREE.AmbientLight( 0xd6d6d6 , 0.9 );\n mainDirectionalLight = new THREE.DirectionalLight( 0xffffff, 0.4 );\n\n mainDirectionalLight.position.set(4,4,-4);\n\n scene.add( stageBox , mainAmbientLight , mainDirectionalLight );\n\n renderer.render( scene , camera );\n}", "title": "" }, { "docid": "018cad63455ecf88370d544575b4ff5c", "score": "0.63811606", "text": "function addLight(scene, h, s, l, x, y, z) {\n THREE.ImageUtils.crossOrigin = '';\n var textureLoader = new THREE.TextureLoader();\n var textureFlare0 = textureLoader.load(\"https://s3.amazonaws.com/jsfiddle1234/lensflare0.png\");\n\n var light = new THREE.PointLight(0xffffff, 1.5, 10);\n light.color.setHSL(h, s, l);\n light.position.set(x, y, z);\n scene.add(light);\n light = light;\n\n var flareColor = new THREE.Color(0xaaaaaaa);\n flareColor.setHSL(h, s, l + 0.5);\n\n var lensFlare = new THREE.LensFlare(textureFlare0, 200, 0.0, THREE.AdditiveBlending, flareColor);\n\n lensFlare.position.copy(light.position);\n scene.add(lensFlare);\n }", "title": "" }, { "docid": "1d0e2120f8dd6472008b51cfae868d50", "score": "0.63762385", "text": "setXMLLightOnSceneComponentsRgb(){\n if (this.enabled)\n this.scene.lights[this.i].enable();\n else this.scene.lights[this.i].disable();\n\n this.scene.lights[this.i].setAmbient(this.ambientElems[0].r,this.ambientElems[0].g, this.ambientElems[0].b, this.ambientElems[0].a);\n this.scene.lights[this.i].setDiffuse(this.diffuseElems[0].r,this.diffuseElems[0].g, this.diffuseElems[0].b, this.diffuseElems[0].a);\n this.scene.lights[this.i].setSpecular(this.specularElems[0].r, this.specularElems[0].g, this.specularElems[0].b, this.specularElems[0].a);\n this.scene.lights[this.i].setVisible(true);\n\n }", "title": "" }, { "docid": "87f61f3bb08b89f2b06f3207d56989b4", "score": "0.6373868", "text": "function addLight( h, s, l, x, y, z ) {\n var light = new THREE.PointLight( 0xffffff, 1.5, 2000 );\n light.color.setHSL( h, s, l );\n light.position.set( x, y, z );\n scene.add( light );\n\n var flareColor = new THREE.Color( 0xffffff );\n flareColor.setHSL( h, s, l + 0.5 );\n\n var lensFlare = new THREE.LensFlare( textureFlare0, 700, 0.0, THREE.AdditiveBlending, flareColor );\n\n lensFlare.add( textureFlare2, 512, 0.0, THREE.AdditiveBlending );\n lensFlare.add( textureFlare2, 512, 0.0, THREE.AdditiveBlending );\n lensFlare.add( textureFlare2, 512, 0.0, THREE.AdditiveBlending );\n\n lensFlare.add( textureFlare3, 60, 0.6, THREE.AdditiveBlending );\n lensFlare.add( textureFlare3, 70, 0.7, THREE.AdditiveBlending );\n lensFlare.add( textureFlare3, 120, 0.9, THREE.AdditiveBlending );\n lensFlare.add( textureFlare3, 70, 1.0, THREE.AdditiveBlending );\n\n lensFlare.customUpdateCallback = lensFlareUpdateCallback;\n lensFlare.position.copy( light.position );\n\n scene.add( lensFlare );\n}", "title": "" }, { "docid": "65591806ff88d2671536e35513985dd8", "score": "0.6365163", "text": "function init() {\n\t// Create the scene and set the scene size.\n\tscene = new THREE.Scene();\n\t\n\t// keep a loading manager\n\tloadingManager = new THREE.LoadingManager();\n\n\t// Get container information\n\tcontainer = document.createElement('div');\n\tdocument.body.appendChild( container ); \n\t\t\n\tvar WIDTH = window.innerWidth, HEIGHT = window.innerHeight; //in case rendering in body\n\t\n\t// Create a renderer and add it to the DOM.\n\trenderer = new THREE.WebGLRenderer({antialias:true});\n\trenderer.setSize(WIDTH, HEIGHT);\n\t// Set the background color of the scene.\n\trenderer.setClearColor(0x333333, 1);\n\t//document.body.appendChild(renderer.domElement); //in case rendering in body\n\tcontainer.appendChild( renderer.domElement );\n\n\t// Create a camera, zoom it out from the model a bit, and add it to the scene.\n\tcamera = new THREE.PerspectiveCamera(45.0, WIDTH / HEIGHT, 0.01, 100);\n\tcamera.position.set(-2, 2, -5);\n\tscene.add(camera);\n\t// Create an event listener that resizes the renderer with the browser window.\n\twindow.addEventListener('resize', function () {\n\t\t\tvar WIDTH = window.innerWidth, HEIGHT = window.innerHeight;\n\t\t\trenderer.setSize(WIDTH, HEIGHT);\n\t\t\tcamera.aspect = WIDTH / HEIGHT;\n\t\t\tcamera.updateProjectionMatrix();\n\t\t}\n\t);\n \n\t// Create a light, set its position, and add it to the scene.\n\tvar alight = new THREE.AmbientLight(0xFFFFFF);\n\talight.position.set(-100.0, 200.0, 100.0);\n\tscene.add(alight);\n\n\tvar directionalLight = new THREE.DirectionalLight( 0xFFFFFF,0.5);\n\tdirectionalLight.position.set( 0, 5, 0 );\n\tdirectionalLight.castShadow = true;\n\tscene.add(directionalLight);\n\n\t// Load in the mesh and add it to the scene.\n\tvar sawBlade_texPath = 'assets/sawblade.jpg';\n\tvar sawBlade_objPath = 'assets/sawblade.obj';\n\tOBJMesh(sawBlade_objPath, sawBlade_texPath, \"sawblade\");\n\n\tvar ground_texPath = 'assets/ground_tile.jpg';\n\tvar ground_objPath = 'assets/ground.obj';\n\tOBJMesh(ground_objPath, ground_texPath, \"ground\");\n\n\tvar slab_texPath = 'assets/slab.jpg';\n\tvar slab_objPath = 'assets/slab.obj';\n\tOBJMesh(slab_objPath, slab_texPath, \"slab\");\n\n\t //Stanford Bunny\n\tvar bunny_texPath = 'assets/rocky.jpg';\n\tvar bunny_objPath = 'assets/stanford_bunny.obj';\n\tOBJMesh(bunny_objPath, bunny_texPath, \"bunny\");\n\n\t //Sphere\n\tvar sphere_texPath = 'assets/rocky.jpg';\n\tvar sphere_objPath = 'assets/sphere.obj';\n\tOBJMesh(sphere_objPath, sphere_texPath, \"sphere\");\n\t\n\t/*\n\t //Cube\n\tvar cube_texPath = 'assets/rocky.jpg';\n\tvar cube_objPath = 'assets/cube.obj';\n\tOBJMesh(cube_objPath, cube_texPath, \"cube\");\n\t\n\t //Cone\n\tvar cone_texPath = 'assets/rocky.jpg';\n\tvar cone_objPath = 'assets/cone.obj';\n\tOBJMesh(cone_objPath, cone_texPath, \"cone\");\n\t*/\n\t\n\t// Add OrbitControls so that we can pan around with the mouse.\n\tcontrols = new THREE.OrbitControls(camera, renderer.domElement);\n\n\tcontrols.enableDamping = true;\n\tcontrols.dampingFactor = 0.4;\n\tcontrols.userPanSpeed = 0.01;\n\tcontrols.userZoomSpeed = 0.01;\n\tcontrols.userRotateSpeed = 0.01;\n\tcontrols.minPolarAngle = -Math.PI/2;\n\tcontrols.maxPolarAngle = Math.PI/2;\n\tcontrols.minDistance = 0.01;\n\tcontrols.maxDistance = 30;\n\n\t// clock for saw rotation\n\tsawClock = new THREE.Clock();\n\tsawDeltaTime = sawClock.getDelta();\n\n\tparticleSystem = createParticleSystem();\n\tscene.add(particleSystem);\n\n\t// Performance statistics (FPS, Size, etc)\n\tstats = new Stats();\n\tcontainer.appendChild( stats.dom );\n}", "title": "" }, { "docid": "5f05fcd35a049f1a3d28219adba9371f", "score": "0.6343963", "text": "function initialiseLighting() {\n gl.uniform3f(program.pointLightingLocationUniform, 0, 0, 0);\n gl.uniform3f(program.pointLightingDiffuseColorUniform, .5, .5, .5);\n gl.uniform3f(program.pointLightingSpecularColorUniform, .5, .5, .5);\n gl.uniform1i(program.samplerSpecularMapUniform, 1);\n gl.uniform1i(program.samplerDarkMapUniform, 0);\n gl.uniform3f(program.ambientColorUniform, .1, .1, .1); \n gl.uniform3f(program.materialEmissiveColorUniform, 0, 0, 0);\n}", "title": "" }, { "docid": "b30080df9fe2b2890adcce6a21d5e655", "score": "0.63413864", "text": "function init() {\n var container = document.getElementById( 'container' );\n \n camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 1000 );\n camera.position.set( 0, 0, 120 );\n \n // Add Orbit Controls\n //controls = new THREE.OrbitControls( camera );\n //controls.addEventListener( 'change', render );\n \n scene = new THREE.Scene();\n \n scene.add( new THREE.AmbientLight( 0x00020 ) );\n \n // ADD THE MOVING LIGHTS\n light1 = new THREE.PointLight( 0x80ff80, lightInt, lightDist );\n light1.position.set(0, 0, lightZ);\n scene.add( light1 );\n \n light2 = new THREE.PointLight( 0xff2020, lightInt, lightDist );\n light2.position.set(0, 0, lightZ);\n scene.add( light2 );\n \n light3 = new THREE.PointLight( 0xff8000, lightInt, lightDist );\n light3.position.set(0, 0, lightZ);\n scene.add( light3 );\n \n \n \n // ADD TRACKERS SPRITES TO EACH LIGHT\n /*var PI2 = Math.PI * 2;\n var program = function ( context ) {\n \n context.beginPath();\n context.arc( 0, 0, 0.5, 0, PI2, true );\n context.fill();\n \n };\n \n var sprite = new THREE.Sprite( new THREE.SpriteCanvasMaterial( { color: 0x80ff80, program: program } ) );\n light1.add( sprite );\n \n var sprite = new THREE.Sprite( new THREE.SpriteCanvasMaterial( { color: 0xff2020, program: program } ) );\n light2.add( sprite );\n \n var sprite = new THREE.Sprite( new THREE.SpriteCanvasMaterial( { color: 00xff8000, program: program } ) );\n light3.add( sprite );*/\n \n\n \n // CREATE A RANDOM TRIANGULATED MESH\n // Create Points\n genPoints();\n \n triangulate(points);\n \n \n // SETUP RENDERER\n renderer = new THREE.CanvasRenderer();\n renderer.setPixelRatio( window.devicePixelRatio );\n renderer.setSize( window.innerWidth, window.innerHeight );\n container.appendChild( renderer.domElement );\n \n // Add resize listener\n window.addEventListener( 'resize', onWindowResize, false );\n \n // ADD STATS\n //stats = new Stats();\n //document.getElementById( 'container' ).appendChild(stats.dom);\n\n // CREATE THE MOUSE LIGHT\n // Setup and add light to scene\n mouseLight = new THREE.PointLight( 0xffffff, 0, 300 );\n scene.add(mouseLight);\n\n // On mouse move update the \"mousePos\" var to the current mouse position in world\n var mousePos; \n addEventListener(\"mousemove\", function(event) {\n mouseLight.power = mouseLightPow;\n \n mouse.set(\n ( event.clientX / window.innerWidth ) * 2 - 1, //x\n -( event.clientY / window.innerHeight ) * 2 + 1, //y\n 0.5\n );\n \n mouse.unproject( camera );\n \n var dir = mouse.sub( camera.position ).normalize();\n \n var distance = - camera.position.z / dir.z;\n \n mousePos = camera.position.clone().add( dir.multiplyScalar( distance ) );\n \n // Set mouse light to the new mouse position\n mouseLight.position.set(mousePos.x, mousePos.y, 10);\n });\n \n \n // ON CLICK ADD A NEW POINT, REMOVE OLD MESH, AND THEN RE-TRIANGULATE\n addEventListener(\"click\", function(event) {\n scene.remove( mesh );\n \n var x = -mousePos.x;\n var y = mousePos.y;\n var z = noise.perlin2(x/100, y/100) * 10;\n \n points.push([x, y, z]);\n \n triangulate(points);\n });\n}", "title": "" }, { "docid": "ad06b6106519f68f1886643ee498370a", "score": "0.6341287", "text": "function init() {\n\n // Create the scene and set the scene size.\n scene = new THREE.Scene();\n var WIDTH = window.innerWidth,\n HEIGHT = window.innerHeight;\n var mesh;\n // Create a renderer and add it to the DOM.\n renderer = new THREE.WebGLRenderer({antialias:true});\n renderer.shadowMapEnabled = true; //Needs to be enabled for shadows\n renderer.setSize(WIDTH, HEIGHT);\n $('#container').empty();\n $('#container').append(renderer.domElement);\n\n //add fog to the scene. zoom in and out gets brighter and darker. delete if you want\n // scene.fog = new THREE.FogExp2( 0x000000, .0235 );\n\n // Create a camera, zoom it out from the model a bit, and add it to the scene. .PerspectiveCamera (Feild of view, Aspect Ratio\n // .. Near(start rendering), Far (vanishing point? horizon line?))\n camera = new THREE.PerspectiveCamera(50, WIDTH / HEIGHT, 0.1, 20000);\n //.PerspectiveCamera (zoom, )\n camera.position.set(281.5454554532732, 20.717505604326544, 19.709799474934318);\n scene.add(camera);\n\n // Create an event listener that resizes the renderer with the browser window.\n window.addEventListener('resize', function() {\n var WIDTH = window.innerWidth,\n HEIGHT = window.innerHeight;\n renderer.setSize(WIDTH, HEIGHT);\n camera.aspect = WIDTH / HEIGHT;\n camera.updateProjectionMatrix();\n });\n\n // Add OrbitControls so that we can pan around with the mouse.\n controls = new THREE.OrbitControls(camera, renderer.domElement);\n\n // Set the background color of the scene.\n // renderer.setClearColorHex(0xfff, 1);\n\n //making the light factory\n var lightFactory = function(x,y,z) {\n var light = new THREE.SpotLight(0xfffff);\n light.position.set(x,y,z);\n light.castShadow = true;\n scene.add(light);\n return light;\n }\n\n // Create a light\n // var light1 = lightFactory(0,100,0);\n // var light2 = lightFactory(100,0,0);\n var light3 = lightFactory( 0,100,100);\n // var light3 = lightFactory( 0,0,0);\n\n var light = new THREE.HemisphereLight(0xfffff, 0xfffff, .5);\n scene.add(light);\n\n // create lines\n // var line1 = lineFactory();\n // lines.push(line1);\n\n\n }", "title": "" }, { "docid": "74bcaee50181aead07dff69f9cd42a59", "score": "0.6340183", "text": "function setUp(options) {\n scene = createScene(near, far, color);\n plane = createPlane(far / 2, far / 2, 0, 0, 0);\n scene.add(plane);\n plane.receiveShadow = true;\n\n camera = createCamera(near, far);\n if (options.axesHelper) {\n var axesHelper = new THREE.AxesHelper(far / 2);\n scene.add(axesHelper);\n }\n\n // https://www.w3schools.com/colors/colors_picker.asp\n light0 = new THREE.HemisphereLight(0x443333, 0x111122);\n scene.add(light0);\n light1 = addShadowedLight(420, 380, 450, 0xffffff, 1.0, 1, far * 1.5, 150,options.lightDebug);\n light2 = addShadowedLight(250, 250, -350, 0xffaa00, 0.1, 1, far * 1.5, 150,options.lightDebug);\n\n light3 = new THREE.AmbientLight(0xffffff, 0.5);\n scene.add(light3);\n\n // Light\n /*\n var light = new THREE.DirectionalLight(0xffffff, 1.0);\n light.position.set(10, 5, 10);\n light.target = base;\n scene.add(light);\n */\n}", "title": "" }, { "docid": "e4b54274dc34bb752542a10058dee206", "score": "0.633644", "text": "function turnOnLights() {\n lightsFadeIn(bulb1);\n lightsFadeIn(bulb2);\n lightsFadeIn(bulb3);\n lightsFadeIn(bulb4);\n lightsFadeIn(bulb5);\n lightsFadeIn(bulb6);\n lightsFadeIn(leftSpeaker);\n lightsFadeIn(rightSpeaker);\n lightsFadeIn(balloonsButton);\n lightsFadeIn(table);\n lightsFadeIn(cake);\n lightsFadeIn(floor);\n}", "title": "" }, { "docid": "bff46cd1ecd9b93dc34479cf702bbcfe", "score": "0.63267756", "text": "function initThreeJs() {\n scene = new THREE.Scene();\n camera = new THREE.PerspectiveCamera(\n /* fov =*/ 75,\n /* aspectRatio =*/ window.innerWidth / window.innerHeight,\n /* nearFrustum =*/.1,\n /* farFrustum =*/ 1000);\n camera.position.set(0, 1, 1);\n renderer = new THREE.WebGLRenderer();\n renderer.setSize(window.innerWidth, window.innerHeight);\n document.body.appendChild(renderer.domElement);\n clock = new THREE.Clock();\n controls = new OrbitControls(camera, renderer.domElement);\n // Add the light to the scene.\n const light = new THREE.PointLight(0xffffff, 1, 0);\n light.position.set(0, 100, 0);\n scene.add(light);\n\n fetchData();\n}", "title": "" }, { "docid": "1ebc3d0b56bf31e50b7814b11d32361b", "score": "0.6325189", "text": "function animate() {\n requestAnimationFrame( animate );\n renderer.render( scene, camera );\n controls.update();\n light2.position.set(camera.position.x,camera.position.y,camera.position.z);\n}", "title": "" }, { "docid": "464be5047f04588ea2a4b94b96b05d45", "score": "0.63122046", "text": "initLights() {\n let index = 0;\n\n for (let i = 0; i < this.graph.light.omnis.length && index < 8; i++) {\n const light = this.graph.light.omnis[i];\n this.lightValues[light.id] = light;\n\n let pos = light.location;\n let amb = light.ambient;\n let dif = light.diffuse;\n let spe = light.specular;\n let l = this.lights[index];\n\n l.setPosition(pos.x, pos.y, pos.z, 1);\n l.setVisible(true);\n l.setAmbient(amb.r, amb.g, amb.b, amb.a);\n l.setDiffuse(dif.r, dif.g, dif.b, dif.a);\n l.setSpecular(spe.r, spe.g, spe.b, spe.a);\n l.setConstantAttenuation(0);\n l.setLinearAttenuation(0.1);\n l.setQuadraticAttenuation(0);\n\n index++;\n }\n\n for (let i = 0; i < this.graph.light.spots.length && index < 8; i++) {\n const light = this.graph.light.spots[i];\n this.lightValues[light.id] = light;\n\n let pos = light.location;\n let to = light.target;\n let amb = light.ambient;\n let dif = light.diffuse;\n let spe = light.specular;\n let l = this.lights[index];\n\n l.setPosition(pos.x, pos.y, pos.z, 1);\n l.setVisible(true);\n l.setAmbient(amb.r, amb.g, amb.b, amb.a);\n l.setDiffuse(dif.r, dif.g, dif.b, dif.a);\n l.setSpecular(spe.r, spe.g, spe.b, spe.a);\n l.setSpotCutOff(light.angle);\n l.setSpotExponent(light.exponent);\n l.setSpotDirection(to.x - pos.x, to.y - pos.y, to.z - pos.z);\n\n l.setConstantAttenuation(0);\n l.setLinearAttenuation(0.1);\n l.setQuadraticAttenuation(0);\n\n index++;\n }\n }", "title": "" }, { "docid": "61f84a8bb729fb8ea23073bbc20b0c15", "score": "0.6307657", "text": "function Setup() {\n\t\tdocument.body.style.overflow = \"hidden\";\n\t\tdocument.body.style.cursor = \"none\";\n\t\tclock = new THREE.Clock();\n\t\tW = window.innerWidth, H = window.innerHeight; // Width and Height variables.\n\t\tif (!Detector.webgl) {\n\t\t\trenderer = new THREE.CanvasRenderer;\n\t\t\tconsole.log(\"using CanvasRenderer\");\n\t\t} else {\n\t\t\trenderer = new THREE.WebGLRenderer({antialias:true});\n\t\t\tconsole.log(\"using WebGLRenderer\");\n\t\t}\n\t\trenderer.setSize(W, H); // Set renderer size to fill browser.\n\t\tdocument.body.appendChild(renderer.domElement); // attach Renderer to HTML Body.\n\t\tscene = new THREE.Scene();\n\t\t// detect if touch device or not\n\t\tif (Modernizr.touch) {\n\t\t\tmobile = true;\n\t\t} else {\n\t\t\tmobile = false;\n\t\t}\n\t\tAssets();\n\t\tscene_1_setup();\n\t}", "title": "" }, { "docid": "45a43c052005a9bf00109ae07a8b3a16", "score": "0.62952864", "text": "function initGL() {\n var prog = createProgram(gl,\"vshader-source\",\"fshader-source\");\n gl.useProgram(prog);\n gl.enable(gl.DEPTH_TEST);\n \n /* Get attribute and uniform locations */\n \n a_coords_loc = gl.getAttribLocation(prog, \"a_coords\");\n a_normal_loc = gl.getAttribLocation(prog, \"a_normal\");\n gl.enableVertexAttribArray(a_coords_loc);\n gl.enableVertexAttribArray(a_normal_loc);\n \n u_modelview = gl.getUniformLocation(prog, \"modelview\");\n u_projection = gl.getUniformLocation(prog, \"projection\");\n u_normalMatrix = gl.getUniformLocation(prog, \"normalMatrix\");\n u_material = {\n diffuseColor: gl.getUniformLocation(prog, \"material.diffuseColor\"),\n specularColor: gl.getUniformLocation(prog, \"material.specularColor\"),\n emissiveColor: gl.getUniformLocation(prog, \"material.emissiveColor\"),\n specularExponent: gl.getUniformLocation(prog, \"material.specularExponent\")\n };\n u_lights = new Array(4);\n for (var i = 0; i < 4; i++) {\n u_lights[i] = {\n enabled: gl.getUniformLocation(prog, \"lights[\" + i + \"].enabled\"),\n position: gl.getUniformLocation(prog, \"lights[\" + i + \"].position\"),\n color: gl.getUniformLocation(prog, \"lights[\" + i + \"].color\") \n };\n }\n \n gl.uniform3f( u_material.specularColor, 0.1, 0.1, 0.1 ); // specular properties don't change\n gl.uniform1f( u_material.specularExponent, 16 );\n gl.uniform3f( u_material.emissiveColor, 0, 0, 0); // default, will be changed temporarily for some objects\n \n\n for (var i = 1; i < 4; i++) { // set defaults for lights\n gl.uniform1i( u_lights[i].enabled, 0 ); \n gl.uniform4f( u_lights[i].position, 0, 0, 1, 0 ); \n gl.uniform3f( u_lights[i].color, 1,1,1 ); \n }\n \n // Lights are set on in the draw() method \n}", "title": "" }, { "docid": "800ff0b095578bf57d431e84051ff666", "score": "0.62936765", "text": "function LightController() {\n\n\t//offsets for the frontLight, backLight and inLight + intensities relativ to the car position - just optimized for veyron car type\n\tlet SCALE = 1.6;\n\tlet frontLight = {\n\t\t intensity_side: 80,\n\t\t\tintensity_cone: 20,\n\t\t\tcone: { offset_x: SCALE * 0, offset_y: SCALE * 25, offset_z: SCALE * 58,\n\t\t\ttarget: { offset_x: SCALE * 0, offset_y: SCALE * -8, offset_z: SCALE * 125 }\n\t\t\t\t\t\t},\n\t\t\tside: { left: { offset_x: SCALE * -42, offset_y : SCALE * 38, offset_z : SCALE * 117 },\n\t\t\t\t\tright: { offset_x: SCALE * 42, offset_y : SCALE * 38, offset_z : SCALE * 117 }\n\t\t\t\t\t\t}\n\t};\n\n\tlet dayLight = {\n\t\t intensity_side: 80,\n\t\t\tintensity_cone: 20,\n\t\t\tcone: { offset_x: SCALE * 0, offset_y: SCALE * 25, offset_z: SCALE * 58,\n\t\t\ttarget: { offset_x: SCALE * 0, offset_y: SCALE * -8, offset_z: SCALE * 125 }\n\t\t\t\t\t\t},\n\t\t\tside: { left: { offset_x: SCALE * -42, offset_y : SCALE * 38, offset_z : SCALE * 117 },\n\t\t\t\t\tright: { offset_x: SCALE * 42, offset_y : SCALE * 38, offset_z : SCALE * 117 }\n\t\t\t\t\t\t}\n\t};\n\n\tlet backLight = {\n\t\t\tintensity: 80,\n\t\t\tright: { left: { offset_x: SCALE * -23, offset_y: SCALE * 49, offset_z: SCALE * -123 },\n\t\t \t\t\tright: { offset_x: SCALE * -33, offset_y: SCALE * 49, offset_z: SCALE * -123 } },\n\t\t\tleft: { right: { offset_x: SCALE * 23, offset_y: SCALE * 49, offset_z: SCALE * -123 },\n\t\t \t\t\tleft: { offset_x: SCALE * 33, offset_y: SCALE * 49, offset_z: SCALE * -123 } }\n\t}\n\n\tlet inLight = { intensity: 90, offset_x: 0, offset_y: SCALE * 54, offset_z: SCALE * 4}\n\n\n\t/**\n\t* Checks the current car driving direction and lets the car blink when it turns right or left, backlight on when it drives back\n\t*\n\t* @params:\n\t* car - car object\n\t*/\n\tthis.checkDriveDirection = function (car) {\n\t\tif(car.controls.moveLeft) {\n\t\t\tif(!car.controls.blinkLeft) {\n\t\t\t\t//left\n\t\t\t\tcar.controls.blinkLeft = true;\n\t\t\t\tcar.controls.blinkRight = false;\n\t\t\t\tblink(car, \"left\");\n\t\t\t\tdisableBlink(car, \"right\");\n\t\t\t\t}\n\t\t} else if(car.controls.moveRight) {\n\t\t\t\tif(!car.controls.blinkRight) {\n\t\t\t\t\t//right\n\t\t\t\t\tcar.controls.blinkLeft = false;\n\t\t\t\t\tcar.controls.blinkRight = true;\n\t\t\t\t\tblink(car, \"right\");\n\t\t\t\t\tdisableBlink(car, \"left\");\n\t\t\t\t}\n\t\t} else if(car.controls.moveBackward){\n\t\t\t\tif(!car.controls.backLight) {\n\t\t\t\t\t//back\n\t\t\t\t\tcar.controls.backLight = true;\n\t\t\t\t\tenableBackLight(car);\n\t\t\t\t}\n\t\t} else {\n\t\t\t\tdisableBlink(car, \"right\");\n\t\t\t\tdisableBlink(car, \"left\");\n\t\t\t\tcar.controls.blinkLeft = false;\n\t\t\t\tcar.controls.blinkRight = false;\n\t\t}\n\t}\n\n\t/**\n\t* Creates the inlight of the car\n\t*\n\t* @params:\n\t* car - car object\n\t*/\n\tthis.addInLight = function(car) {\n\t\tvar position_x = car.mesh.position.x;\n\t\tvar position_y = car.mesh.position.y;\n\t\tvar position_z = car.mesh.position.z;\n\n\t\tvar inLight = new THREE.PointLight( 0x8a2be2, 0, 30, 2 );\n\t\tinLight.position.set( position_x + inLight.offset_x, position_y + inLight.offset_y, position_z + inLight.offset_z );\n\t\tscene.add( inLight );\n\n\t\tcar.inLight = inLight;\n\t\t\n\t}\n\n\t/**\n\t* Creates the backlight for the car\n\t*\n\t* @params:\n\t* car - car object\n\t*/\n\tthis.addBackLight = function(car) {\n\t\tvar position_x = car.mesh.position.x;\n\t\tvar position_y = car.mesh.position.y;\n\t\tvar position_z = car.mesh.position.z;\n\n var textureLoader = new THREE.TextureLoader();\n var textureFlare = textureLoader.load(\"img/textures/lensflare.png\");\n var flareColor = new THREE.Color(0xff0000);\n\n\t\t//add left and right backlight with invisibility\n\t\tvar backright_right = new THREE.LensFlare(textureFlare, 150, 0.0, THREE.AdditiveBlending, flareColor);\n\t\tbackright_right.position.set( position_x + backLight.right.right.offset_x, position_y + backLight.right.right.offset_y, position_z + backLight.right.right.offset_z );\n backright_right.visible = false;\n\t\tscene.add( backright_right );\n\n\t\tvar backright_left = new THREE.LensFlare(textureFlare, 150, 0.0, THREE.AdditiveBlending, flareColor);\n\t\tbackright_left.position.set( position_x + backLight.right.left.offset_x, position_y + backLight.right.left.offset_y, position_z + backLight.right.left.offset_z );\n backright_left.visible = false;\n\t\tscene.add( backright_left );\n\n\t\tvar backleft_left = new THREE.LensFlare(textureFlare, 150, 0.0, THREE.AdditiveBlending, flareColor);\n\t\tbackleft_left.position.set( position_x + backLight.left.left.offset_x, position_y + backLight.left.left.offset_y, position_z + backLight.left.left.offset_z );\n backleft_left.visible = false;\n\t\tscene.add( backleft_left );\n\n\t\tvar backleft_right = new THREE.LensFlare(textureFlare, 150, 0.0, THREE.AdditiveBlending, flareColor);\n\t\tbackleft_right.position.set( position_x + backLight.left.right.offset_x, position_y + backLight.left.right.offset_y, position_z + backLight.left.right.offset_z );\n backleft_right.visible = false;\n\t\tscene.add( backleft_right );\n\n\t\tcar.backLight = { left: { left: backleft_left, right: backleft_right} , right: { right: backright_right, left: backright_left}};\n\n\t}\n\n\t/**\n\t* Creates the frontlight for the car\n\t*\n\t* @params:\n\t* car - car object\n\t*/\n\tthis.addFrontLight = function(car) {\n\t\tvar position_x = car.mesh.position.x;\n\t\tvar position_y = car.mesh.position.y;\n\t\tvar position_z = car.mesh.position.z;\n\n\t\t//add cone for the frontlight\n\t\tvar cone = new THREE.SpotLight(0xffffff, 0, 700, 7*Math.PI/24, 0.5, 0.8);\n\t\tcone.position.set(position_x, position_y + frontLight.cone.offset_y, position_z + frontLight.cone.offset_z);\n\t\tcone.target.position.set(position_x, position_y + frontLight.cone.target_offset_y, position_z + frontLight.cone.target_offset_z);\n\t\tscene.add(cone.target);\n\t\tscene.add(cone);\n\n\t\t//add two side frontlights for the car\n\t\tvar leftlight = new THREE.PointLight( 0xffffff, 0, 10, 2 );\n\t\tleftlight.position.set( position_x + frontLight.side.left.offset_x , position_y - frontLight.side.left.offset_y, position_z + frontLight.side.left.offset_z );\n\t\tscene.add( leftlight );\n\t\tvar rightlight = new THREE.PointLight( 0xffffff, 0, 10, 2 );\n\t\trightlight.position.set( position_x + frontLight.side.right.offset_x, position_y - frontLight.side.right.offset_y, position_z + frontLight.side.right.offset_z );\n\t\tscene.add( rightlight );\n\n\t\tcar.frontLight = { cone: cone, left: leftlight, right: rightlight};\n\n\t}\n\n\tthis.addDayLight = function(car) {\n\t\tvar position_x = car.mesh.position.x;\n\t\tvar position_y = car.mesh.position.y;\n\t\tvar position_z = car.mesh.position.z;\n\n\t\t//add cone for the frontlight\n\t\tvar cone = new THREE.SpotLight(0xffffff, 0, 400, 7*Math.PI/24, 0.5, 2);\n\t\tcone.position.set(position_x, position_y + dayLight.cone.offset_y, position_z + dayLight.cone.offset_z);\n\t\tcone.target.position.set(position_x, position_y + dayLight.cone.target_offset_y, position_z + dayLight.cone.target_offset_z);\n\t\tscene.add(cone.target);\n\t\tscene.add(cone);\n\n\t\t//add two side frontlights for the car\n\t\tvar leftlight = new THREE.PointLight( 0xffffff, 0, 5, 2 );\n\t\tleftlight.position.set( position_x + dayLight.side.left.offset_x , position_y - dayLight.side.left.offset_y, position_z + dayLight.side.left.offset_z );\n\t\tscene.add( leftlight );\n\t\tvar rightlight = new THREE.PointLight( 0xffffff, 0, 5, 2 );\n\t\trightlight.position.set( position_x + dayLight.side.right.offset_x, position_y - dayLight.side.right.offset_y, position_z + dayLight.side.right.offset_z );\n\t\tscene.add( rightlight );\n\n\t\tcar.dayLight = { cone: cone, left: leftlight, right: rightlight};\n\t}\n\n\t/**\n\t* Updates the position of the frontlight of the car\n\t*\n\t* @params:\n\t* car - car object\n\t*/\n\tthis.updateFrontLight = function(car) {\n\t\tvar rotation = car.mesh.rotation.y;\n\n\t\t/* UPDATE CONE LIGHT */\n\t\tvar lightStandard = calcStandardPosition(car, frontLight.cone);\n\t\tvar targetStandard = calcStandardPosition(car, frontLight.cone.target);\n\n\t\tvar new_light = calcRotatedPosition(car, rotation, lightStandard);\n\t\tvar new_target = calcRotatedPosition(car, rotation, targetStandard);\n\n\t\tcar.frontLight.cone.position.set(new_light.x , new_light.y, new_light.z);\n\t\tcar.frontLight.cone.target.position.set(new_target.x, new_target.y, new_target.z);\n\n\t\t/* UPDATE LEFT AND RIGHT LIGHT */\n\t\tvar leftLightStandard = calcStandardPosition(car, frontLight.side.left);\n\t\tvar rightLightStandard = calcStandardPosition(car, frontLight.side.right);\n\n\t\tvar new_leftLight = calcRotatedPosition(car, rotation, leftLightStandard);\n\t\tvar new_rightLight = calcRotatedPosition(car, rotation, rightLightStandard);\n\n\t\tcar.frontLight.left.position.set(new_leftLight.x , new_leftLight.y, new_leftLight.z);\n\t\tcar.frontLight.right.position.set(new_rightLight.x , new_rightLight.y, new_rightLight.z);\n\n\t}\n\n\tthis.updateDayLight = function(car) {\n\t\tvar rotation = car.mesh.rotation.y;\n\n\t\t/* UPDATE CONE LIGHT */\n\t\tvar lightStandard = calcStandardPosition(car, dayLight.cone);\n\t\tvar targetStandard = calcStandardPosition(car, dayLight.cone.target);\n\n\t\tvar new_light = calcRotatedPosition(car, rotation, lightStandard);\n\t\tvar new_target = calcRotatedPosition(car, rotation, targetStandard);\n\n\t\tcar.dayLight.cone.position.set(new_light.x , new_light.y, new_light.z);\n\t\tcar.dayLight.cone.target.position.set(new_target.x, new_target.y, new_target.z);\n\n\t\t/* UPDATE LEFT AND RIGHT LIGHT */\n\t\tvar leftLightStandard = calcStandardPosition(car, dayLight.side.left);\n\t\tvar rightLightStandard = calcStandardPosition(car, dayLight.side.right);\n\n\t\tvar new_leftLight = calcRotatedPosition(car, rotation, leftLightStandard);\n\t\tvar new_rightLight = calcRotatedPosition(car, rotation, rightLightStandard);\n\n\t\tcar.dayLight.left.position.set(new_leftLight.x , new_leftLight.y, new_leftLight.z);\n\t\tcar.dayLight.right.position.set(new_rightLight.x , new_rightLight.y, new_rightLight.z);\n\t}\n\n\t/**\n\t* Updates the position of the backlight of the car\n\t*\n\t* @params:\n\t* car - car object\n\t*/\n\tthis.updateBackLight = function(car) {\n\t\tvar rotation = car.mesh.rotation.y;\n\n\t\t/* UPDATE LEFT AND RIGHT BACK LIGHT */\n\t\tvar backLeftLeftStandard = calcStandardPosition(car, backLight.left.left);\n\t\tvar backRightRightStandard = calcStandardPosition(car, backLight.right.right);\n\t\tvar backLeftRightStandard = calcStandardPosition(car, backLight.left.right);\n\t\tvar backRightLeftStandard = calcStandardPosition(car, backLight.right.left);\n\n\t\tvar new_backLeftLeft = calcRotatedPosition(car, rotation, backLeftLeftStandard);\n\t\tvar new_backRightLeft = calcRotatedPosition(car, rotation, backRightLeftStandard);\n\t\tvar new_backLeftRight = calcRotatedPosition(car, rotation, backLeftRightStandard);\n\t\tvar new_backRightRight = calcRotatedPosition(car, rotation, backRightRightStandard);\n\n\t\tcar.backLight.left.left.position.set(new_backLeftLeft.x , new_backLeftLeft.y, new_backLeftLeft.z);\n\t\tcar.backLight.right.right.position.set(new_backRightRight.x, new_backRightRight.y, new_backRightRight.z);\n\t\tcar.backLight.left.right.position.set(new_backLeftRight.x , new_backLeftRight.y, new_backLeftRight.z);\n\t\tcar.backLight.right.left.position.set(new_backRightLeft.x, new_backRightLeft.y, new_backRightLeft.z);\n\n\t}\n\n\t/**\n\t* Updates the position of the inlight of the car\n\t*\n\t* @params:\n\t* car - car object\n\t*/\n\tthis.updateInLight = function(car) {\n\t\tvar rotation = car.mesh.rotation.y;\n\n\t\t/* UPDATE IN LIGHT */\n\t\tvar inLightStandard = calcStandardPosition(car, inLight);\n\t\tvar new_inLight = calcRotatedPosition(car, rotation, inLightStandard);\n\t\tcar.inLight.position.set(new_inLight.x , new_inLight.y, new_inLight.z);\n\t}\n\n\t/**\n\t* Turns all the lights of the car on when its dark\n\t*\n\t* @params:\n\t* car - car object\n\t*/\n\tthis.turnLightsOn = function(car) {\n\t\t\tenableBackLight(car);\n\t\t\tenableFrontLight(car);\n\t\t\tenableInLight(car);\n\t}\n\n\t/**\n\t* Turns all the lights of the car off when its bright\n\t*\n\t* @params:\n\t* car - car object\n\t*/\n\tthis.turnLightsOff = function(car) {\n\t\t\tdisableBackLight(car);\n\t\t\tdisableFrontLight(car);\n\t\t\tdisableInLight(car);\n\t}\n\n\t/* PRIVATE FUNCTIONS */\n\n\t/**\n\t* Enables the backlight of the car\n\t*\n\t* @params:\n\t* car - car object\n\t*/\n\tfunction enableBackLight(car) {\n\t\tcar.backLight.left.right.visible = true;\n\t\tcar.backLight.right.left.visible = true;\n\t}\n\n\t/**\n\t* Enables the frontlight of the car\n\t*\n\t* @params:\n\t* car - car object\n\t*/\n\tfunction enableFrontLight(car) {\n\t\tcar.frontLight.left.intensity = frontLight.intensity_side;\n\t\tcar.frontLight.right.intensity = frontLight.intensity_side;\n\t\tcar.frontLight.cone.intensity = frontLight.intensity_cone;\n\n\t\tcar.dayLight.left.intensity = 0;\n\t\tcar.dayLight.right.intensity = 0;\n\t\tcar.dayLight.cone.intensity = 0;\n\t}\n\n\t/**\n\t* Enables the inlight of the car\n\t*\n\t* @params:\n\t* car - car object\n\t*/\n\tfunction enableInLight(car) {\n\t\tcar.inLight.intensity = inLight.intensity;\n\t}\n\n\t/**\n\t* Disables the frontlight of the car\n\t*\n\t* @params:\n\t* car - car object\n\t*/\n\tfunction disableFrontLight(car) {\n\t\tcar.frontLight.left.intensity = 0;\n\t\tcar.frontLight.right.intensity = 0;\n\t\tcar.frontLight.cone.intensity = 0;\n\n\t\tcar.dayLight.left.intensity = dayLight.intensity_side;\n\t\tcar.dayLight.right.intensity = dayLight.intensity_side;\n\t\tcar.dayLight.cone.intensity = dayLight.intensity_cone;\n\t}\n\n\t/**\n\t* Disables the inlight of the car\n\t*\n\t* @params:\n\t* car - car object\n\t*/\n\tfunction disableInLight(car) {\n\t\tcar.inLight.intensity = 0;\n\t}\n\n\t/**\n\t* Disables the backlight of the car\n\t*\n\t* @params:\n\t* car - car object\n\t*/\n\tfunction disableBackLight(car) {\n\t\tcar.backLight.right.left.visible = false;\n\t\tcar.backLight.left.right.visible = false;\n\t}\n\n\t/**\n\t* Creates a blinking effect\n\t*\n\t* @params:\n\t* car - car object\n\t* direction - \"left\" | \"right\" - left or right blinking\n\t*/\n\tfunction blink(car, direction) {\n\t\tif(direction == \"right\") {\n\t\t\tif(car.controls.blinkRight) {\n\t\t\t\tif(!car.backLight.right.right.visible) {\n\t\t\t\t\tenableBlinkLightRight(car);\n\t\t\t\t} else {\n\t\t\t\t\tdisableBlinkLightRight(car);\n\t\t\t\t}\n\t\t\t\tsetTimeout(function() { blink(car, direction) }, 400);\n\t\t\t}\n\t\t} else if (direction == \"left\") {\n\t\t\tif(car.controls.blinkLeft) {\n\t\t\t\tif(!car.backLight.left.left.visible) {\n\t\t\t\t\tenableBlinkLightLeft(car);\n\t\t\t\t} else {\n\t\t\t\t\tdisableBlinkLightLeft(car);\n\t\t\t\t}\n\t\t\t\tsetTimeout(function() { blink(car, direction) }, 400);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t* Disables the blinking effect\n\t*\n\t* @params:\n\t* car - car object\n\t* direction - \"left\" | \"right\" - left or right blinking\n\t*/\n\tfunction disableBlink(car, direction) {\n\t\tif(direction == \"right\") {\n\t\t\tdisableBlinkLightRight(car);\n\t\t} else if (direction == \"left\") {\n\t\t\tdisableBlinkLightLeft(car);\n\t\t}\n\t}\n\n\t/**\n\t* Enables the left blinking light\n\t*\n\t* @params:\n\t* car - car object\n\t*/\n\tfunction enableBlinkLightLeft(car) {\n\t\tcar.backLight.left.left.visible = true;\n\t}\n\n\t/**\n\t* Disables the left blinking light\n\t*\n\t* @params:\n\t* car - car object\n\t*/\n\tfunction disableBlinkLightLeft(car) {\n\t\tcar.backLight.left.left.visible = false;\n\t}\n\n\t/**\n\t* Enables the right blinking light\n\t*\n\t* @params:\n\t* car - car object\n\t*/\n\tfunction enableBlinkLightRight(car) {\n\t\tcar.backLight.right.right.visible = true;\n\t}\n\n\t/**\n\t* Disables the right blinking light\n\t*\n\t* @params:\n\t* car - car object\n\t*/\n\tfunction disableBlinkLightRight(car) {\n\t\tcar.backLight.right.right.visible = false;\n\t}\n\n\t/**\n\t* Calculates the standard position of one light when the car is not rotated\n\t*\n\t* @params:\n\t* car - car object\n\t*\t\ttype - light object e.g. backLight.left.left\n\t*/\n\tfunction calcStandardPosition(car, type) {\n\t\tvar car_x = car.mesh.position.x;\n\t\tvar car_y = car.mesh.position.y;\n\t\tvar car_z = car.mesh.position.z;\n\t\treturn {x: car_x + type.offset_x, y: car_y + type.offset_y, z: car_z + type.offset_z};\n\t}\n\n\t/**\n\t* Calculates the rotated position around the car\n\t*\n\t* @params:\n\t* car - car object\n\t*\t\trotation - current y rotation of the car\n\t*\t\told_pos - standard position of the light\n\t*/\n\tfunction calcRotatedPosition(car, rotation, old_pos) {\n\t\tvar car_x = car.mesh.position.x;\n\t\tvar car_y = car.mesh.position.y;\n\t\tvar car_z = car.mesh.position.z;\n\n\t\tvar new_pos_x = car_x + ((old_pos.x - car_x) * Math.cos(-rotation).toFixed(15) - (old_pos.z - car_z) * Math.sin(-rotation).toFixed(15));\n\t\tvar new_pos_z = car_z + ((old_pos.x - car_x) * Math.sin(-rotation).toFixed(15) + (old_pos.z - car_z) * Math.cos(-rotation).toFixed(15));\n\t\treturn {x: new_pos_x, y: old_pos.y, z: new_pos_z};\n\t}\n\n}", "title": "" }, { "docid": "541b7a16776cdb3a0a0d1bb1bbbf166a", "score": "0.62936646", "text": "requestInit(scene) {\n let self = this;\n // Key\n let key = new THREE.PointLight(0xfff, 2, 100);\n key.position.set(5, 5, 5);\n self.children.push(scene.add(key));\n // Fill\n let fill = new THREE.PointLight(0xccc, 0.6, 100);\n fill.position.set(5, -5, 4);\n self.children.push(scene.add(fill));\n // Back\n let back = new THREE.PointLight(0xffeedd, 0.4, 100);\n back.position.set(-5, 5, 3);\n self.children.push(scene.add(back));\n }", "title": "" }, { "docid": "0e5985a6c983b89ee00fc92a89c260a5", "score": "0.6280265", "text": "function pointLightRoom3() {\n const light = new THREE.PointLight(0x00F6FF, 1, 100);\n light.position.set(-60, 43, -10);\n scene.add(light);\n\n //\n const light2 = new THREE.PointLight(0xffffff, 1, 100);\n light2.position.set(-98, 4, 20);\n scene.add(light2);\n\n //\n\n const light3 = new THREE.PointLight(0xffffff, 1, 100);\n light3.position.set(-98, 4, -45);\n scene.add(light3);\n\n //\n\n const light4 = new THREE.PointLight(0xffffff, 1, 100);\n light4.position.set(-30, 4, 20);\n scene.add(light4);\n\n\n}", "title": "" }, { "docid": "1df57d6fb31108010b1be10d6556850c", "score": "0.6275381", "text": "function pointLightRoom1() {\n const light = new THREE.PointLight(0xFFC300, 0.8, 100);\n light.position.set(-60, 43, 60);\n scene.add(light);\n\n //\n\n const light2 = new THREE.PointLight(0xFFC300, 0.7, 100);\n light2.position.set(-30, 4, 95);\n scene.add(light2);\n //\n\n const light3 = new THREE.PointLight(0xFFC300, 0.7, 100);\n light3.position.set(-98, 4, 95);\n scene.add(light3);\n //\n\n const light4 = new THREE.PointLight(0xFFC300, 0.7, 100);\n light4.position.set(-98, 4, 30);\n scene.add(light4);\n\n}", "title": "" }, { "docid": "82f3a31bc9662ae76ce69c36f40d46b5", "score": "0.6272907", "text": "constructor() {\n super(new BABYLON.Vector3(-20.0, 0.0, -20.0), new BABYLON.Vector3(0.0, 0.0, 0.0), lib_1.LibUI.COLOR_ORANGE_MAYFLOWER);\n this.light1 = null;\n this.setupLights();\n this.setupGround();\n src_1.MfgInit.onInitCompleted();\n }", "title": "" }, { "docid": "37b6dc74dfea7579eed3672d9e92f89e", "score": "0.6269932", "text": "function onLoad(framework) \n{\n scene = framework.scene;\n camera = framework.camera;\n renderCamera = framework.renderCamera;\n renderer = framework.renderer;\n target = framework.target;\n gui = framework.gui;\n stats = framework.stats;\n distance = framework.distance;\n precision = framework.precision;\n\n window.addEventListener( \"resize\", onResize, false );\n\n // set camera position\n camera.position.set(6, 10, 12);\n camera.lookAt(new THREE.Vector3(0,0,0));\n\n material = new THREE.ShaderMaterial({\n uniforms: {\n // texture: { type: \"t\", value: null },\n // u_useTexture: { type: 'i', value: options.useTexture },\n // u_albedo: { type: 'v3', value: new THREE.Color(options.albedo) },\n // u_ambient: { type: 'v3', value: new THREE.Color(options.ambient) },\n // u_lightPos: { type: 'v3', value: new THREE.Vector3(30, 50, 40) },\n // u_lightCol: { type: 'v3', value: new THREE.Color(options.lightColor) },\n // u_lightIntensity: { type: 'f', value: options.lightIntensity },\n \n resolution: { type: \"v2\", value: new THREE.Vector2( window.innerWidth, window.innerHeight ) },\n camera :{ type: \"v3\", value: camera.position },\n target :{ type: \"v3\", value: target },\n time : { type: \"f\", value: 0 },\n randomSeed : { type: \"f\", value: Math.random() },\n fov : { type: \"f\", value: 45 },\n raymarchMaximumDistance:{ type: \"f\", value: distance },\n raymarchPrecision:{ type: \"f\", value: precision},\n //color0: {type: \"v3\", value: new THREE.Vector3(0.9, 0.9, 0.0) }, //yellow\n //light0: {type: \"v3\", value: new THREE.Vector3(-0.5, 0.75, -0.5) },\n //color1: {type: \"v3\", value: new THREE.Vector3(0.0, 0.2, 0.9) }, //blue\n //light1: {type: \"v3\", value: new THREE.Vector3( 0.5, -0.75, 0.5) }\n },\n vertexShader: require('./shaders/sdf-vert.glsl'),\n fragmentShader: require('./shaders/sdf-frag.glsl')\n });\n\n // add a plane that fits the whole screen for fragment shader\n var geom = new THREE.BufferGeometry();\n geom.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array([ -1,-1,0, 1,-1,0, 1,1,0, -1,-1,0, 1,1,0, -1,1,0]), 3 ) );\n mesh = new THREE.Mesh( geom, material );\n //mesh.material.side = THREE.DoubleSide;\n scene.add(mesh);\n\n walker = new Walker( material, target );\n walker.update();\n\n /*\n // edit params and listen to changes like this\n // more information here: https://workshop.chromeexperiments.com/examples/gui/#1--Basic-Usage\n gui.add(camera, 'fov', 0, 180).onChange(function(newVal) {\n camera.updateProjectionMatrix();\n });\n\n //add amplitude slider for user to adjust\n gui.add(amplitudeText, 'amplitude', 5.0, 40.0);\n */\n}", "title": "" }, { "docid": "24403c8e532d7c89d1b1e3788c17d18d", "score": "0.6264314", "text": "function drawvLight(){\n\tvlight = new THREE.Mesh(\n \t \tnew THREE.IcosahedronGeometry(vlightRadius, vlightDetail),\n \t \tnew THREE.MeshBasicMaterial({\n \t \tcolor: getNeonColor()\n \t\t })\n \t);\n\tvlight.position.y = vlighty;\n\tvlight.position.x= vlightx;\n\tvlight.position.z= vlightz;\n\tscene.add( vlight );\n}", "title": "" }, { "docid": "d288f8fee7df757b5b58f65ac371aa63", "score": "0.6263562", "text": "function init() {\n\n scene = new THREE.Scene();\n\n droneCamera = new THREE.PerspectiveCamera(50, ASPECT_RATIO, NEAR, FAR);\n droneCamera.position.z = 320;\n droneCamera.position.y = 100;\n\n renderer = new THREE.WebGLRenderer();\n renderer.setSize(window.innerWidth, window.innerHeight);\n document.body.appendChild(renderer.domElement);\n\n //Adding Lights\n /**\n * Ambient light\n * @type {THREE.AmbientLight}\n */\n var ambient = new THREE.AmbientLight(0xCCCCCC);\n scene.add(ambient);\n /**\n * Directional light\n * @type {THREE.DirectionalLight}\n */\n var directionalLight = new THREE.DirectionalLight(0xFFFFFF);\n directionalLight.position.set(1200, 3500, 1500);\n directionalLight.rotateX(Math.PI * 0.75);\n directionalLight.rotateY(Math.PI * 0.75);\n scene.add(directionalLight);\n\n /**\n * Geometry for the sky\n * @type {THREE.SphereGeometry}\n */\n var skyGeo = new THREE.SphereGeometry(40000, 25, 25);\n /**\n * Texture for the sky\n * @type {THREE.Texture}\n */\n var texture = THREE.ImageUtils.loadTexture(\"objects/skyDome.jpg\");\n\n /**\n * Material for the sky\n * @type {THREE.MeshPhongMaterial}\n */\n var material = new THREE.MeshPhongMaterial({\n map: texture,\n });\n /**\n * Mesh of for the sky\n * @type {THREE.Mesh}\n */\n var sky = new THREE.Mesh(skyGeo, material);\n sky.rotation.z = Math.PI;\n sky.material.side = THREE.BackSide;\n scene.add(sky);\n\n\n //Zeppelin\n mtlLoader.load('objects/Zeppelin.mtl', function (materials) {\n\n materials.preload();\n /**\n * Object loader to load 3D objets exported from Blender\n * @type {THREE.OBJLoader}\n */\n var objLoader = new THREE.OBJLoader();\n objLoader.setMaterials(materials);\n\n objLoader.load('objects/Zeppelin.obj', function (object) {\n\n zeppelin = object;\n zeppelin.boundingSphere;\n zeppelin.rotation.y = Math.PI * 0.5;\n zeppelin.scale.set(500, 500, 500);\n zeppelin.position.set(0, 2000, -11000);\n\n zepMarker.position.set(0, 6000, 0);\n zepMarker.add(zeppelin);\n scene.add(zepMarker);\n\n }, onProgress, onError);\n\n });\n\n //Texture As Camera\n textureCamera = new THREE.PerspectiveCamera(1, ASPECT_RATIO, NEAR, FAR * 5);\n textureCamera.position.set(11000, 3000, -3000);\n scene.add(textureCamera);\n\n screenScene = new THREE.Scene();\n screenCamera = new THREE.OrthographicCamera(\n window.innerWidth / -2, window.innerWidth / 2,\n window.innerHeight / 2, window.innerHeight / -2,\n -10000, 10000);\n screenCamera.position.set(0, 0, -1);\n screenScene.add(screenCamera);\n\n /**\n * Geometry for the first screen (that's the one the screenCamera is filming)\n * @type {THREE.PlaneGeometry}\n */\n var screenGeometry = new THREE.PlaneGeometry(window.innerWidth, window.innerHeight);\n firstRenderTarget = new THREE.WebGLRenderTarget(512, 512, {format: THREE.RGBFormat});\n /**\n * Material for the first screen\n * @type {THREE.MeshBasicMaterial}\n */\n var screenMaterial = new THREE.MeshBasicMaterial({map: firstRenderTarget.texture});\n /**\n * Mesh for the first screen\n * @type {THREE.Mesh}\n */\n var firstScreenMesh = new THREE.Mesh(screenGeometry, screenMaterial);\n //firstScreenMesh.rotation.x = Math.PI / 2;\n screenScene.add(firstScreenMesh);\n\n // final version of camera texture, used in scene.\n /**\n * Geometry for the final screen (that's the one the screenCamera is filming)\n * @type {THREE.CubeGeometry}\n */\n var screenGeometry = new THREE.CubeGeometry(4000, 2000, 1, 1);\n finalRenderTarget = new THREE.WebGLRenderTarget(512, 512, {format: THREE.RGBFormat});\n /**\n * Material for the final screen\n * @type {THREE.MeshBasicMaterial}\n */\n var screenMaterial = new THREE.MeshBasicMaterial({map: finalRenderTarget.texture});\n /**\n * Mesh for the final screen\n * @type {THREE.Mesh}\n */\n var screen = new THREE.Mesh(screenGeometry, screenMaterial);\n screen.position.set(0, 1900, -9450);\n scene.add(screen);\n\n//End Camera as Texture\n}", "title": "" }, { "docid": "ee8c18fd919c32d1bde510ffcf49132e", "score": "0.62623954", "text": "function pointLightRoom2() {\n const light = new THREE.PointLight(0xedd036, 1, 100);\n light.position.set(60, 43, 60);\n scene.add(light);\n\n //\n const light2 = new THREE.PointLight(0xcc0000, 1, 100);\n light2.position.set(30, 4, 95);\n scene.add(light2);\n\n //\n\n const light3 = new THREE.PointLight(0xcc0000, 1, 100);\n light3.position.set(98, 4, 95);\n scene.add(light3);\n\n //\n\n const light4 = new THREE.PointLight(0xcc0000, 1, 100);\n light4.position.set(98, 4, 30);\n scene.add(light4);\n\n}", "title": "" }, { "docid": "4e7be4ab0bd61606b7bdc3e49ba515c3", "score": "0.62555027", "text": "function superInit(){\n\n\t//Prevent scrolling for Mobile\n\tnoScrolling = function(event){\n\t\tevent.preventDefault();\n\t};\n\n\t// HOWLER\n\t\t// sound_forest = new Howl({\n\t\t// \turls: ['../audios/duet/nightForest.mp3'],\n\t\t// \tloop: true,\n\t\t// \tvolume: 0.2\n\t\t// });\n\n\n\ttime = Date.now();\n\n\t// THREE.JS -------------------------------------------\n\t\tclock = new THREE.Clock();\n\n\t// RENDERER\n\t\tcontainer = document.getElementById('render-canvas');\n\t\trenderer = new THREE.WebGLRenderer({antialias: true, alpha: true});\n\n\t\trenderer.setPixelRatio(window.devicePixelRatio);\n\t\t// renderer.setSize(window.innerWidth, window.innerHeight);\n\n\t\trenderer.setClearColor(0xffff00, 1);\n\t\tcontainer.appendChild(renderer.domElement);\n\n\t// VR_EFFECT\n\t\teffect = new THREE.VREffect(renderer);\n\t\teffect.setSize(window.innerWidth, window.innerHeight);\n\n\t// Create a VR manager helper to enter and exit VR mode.\n\t\tvar params = {\n\t\t hideButton: false, // Default: false.\n\t\t isUndistorted: false // Default: false.\n\t\t};\n\t\tvrmanager = new WebVRManager(renderer, effect, params);\n\n\t// SCENE\n\t\tscene = new THREE.Scene();\n\t\t// scene = new Physijs.Scene();\n\t\t// scene.setGravity(new THREE.Vector3( 0, -30, 0 ));\n\n\t// LIGHT\n\t\themiLight = new THREE.HemisphereLight( 0xf9ff91, 0x3ac5b9, 1);\n\t\themiLight.intensity = 1;\n\t\tscene.add(hemiLight);\n\n\t// CAMERA\n\t\tcamera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.1, 10000);\n\t\tcamera.position.z -= 0.6;\n\n\t// RAYCASTER!\n\t\teyerayCaster = new THREE.Raycaster();\t\n\n\t// Sinwave\n\t\tsinWave = new SinWave(timeWs[0], frequencyW, amplitudeW, offsetW);\n\n\n\tplanet = new THREE.Mesh( new THREE.SphereGeometry(5), new THREE.MeshLambertMaterial() );\n\tscene.add( planet );\n\t\n\t//////////////////////////////////////////////////////////////////////////////////////////\n\t//////////////////////////////////////////////////////////////////////////////////////////\n\t//////////////////////////////////////////////////////////////////////////////////////////\n\t/*\n\t\tSTART LOADING\t \n\t*/\n\t//////////////////////////////////////////////////////////////////////////////////////////\n\n\tloadingManger = new THREE.LoadingManager();\n\t\t// loadingManger.onProgress = function ( item, loaded, total ) {\n\t\t// console.log( item, loaded, total );\n\t\t// var loadingPercentage = Math.floor(loaded/total*100);\n\t\t// // loadingTxt.innerHTML = \"loading \" + loadingPercentage +\"%\";\n\t\t// console.log(\"loading \" + loadingPercentage +\"%\");\n\t\t// };\n\n\t\t// loadingManger.onError = function(err) {\n\t\t// \tconsole.log(err);\n\t\t// };\n\n\t\t// loadingManger.onLoad = function () {\n\t\t// // console.log( \"first step all loaded!\" );\n\t\t// CreateStars();\n\t\t// };\n\n\t// br_mat_loadingManager = new THREE.LoadingManager();\n\t// \t// after loading all the textures for BATHROOM, create bathroom\n\t// \tbr_mat_loadingManager.onLoad = function () {\n\t// \t console.log( \"Ready to load BATHROOM!\" );\n\n\t// \t\tloadModelBathroomsV2( \"models/bathroom/b_door.js\",\n\t// \t\t\t\t\t\t\t \"models/bathroom/b_sides.js\",\n\t// \t\t\t\t\t\t\t \"models/bathroom/b_floor.js\",\n\t// \t\t\t\t\t\t\t \"models/bathroom/b_smallStuff.js\",\n\t// \t\t\t\t\t\t\t \"models/bathroom/b_smallWhite.js\",\n\t// \t\t\t\t\t\t\t \"models/bathroom/paper_bottom.js\",\n\t// \t\t\t\t\t\t\t \"models/bathroom/paper_top.js\",\n\t// \t\t\t\t\t\t\t \"models/bathroom2.js\",\n\t// \t\t\t\t\t\t\t \"models/poster.js\" );\n\t// \t};\n\n\t// starLoadingManager = new THREE.LoadingManager();\n\t// \tstarLoadingManager.onLoad = function () {\n\t// \t CreateStars();\n\t// \t};\n\n\n\tstats = new Stats();\n\tstats.domElement.style.position = 'absolute';\n\tstats.domElement.style.bottom = '5px';\n\tstats.domElement.style.zIndex = 100;\n\tstats.domElement.children[ 0 ].style.background = \"transparent\";\n\tstats.domElement.children[ 0 ].children[1].style.display = \"none\";\n\tcontainer.appendChild( stats.domElement );\n\n\t// physics_stats = new Stats();\n\t// physics_stats.domElement.style.position = 'absolute';\n\t// physics_stats.domElement.style.bottom = '55px';\n\t// physics_stats.domElement.style.zIndex = 100;\n\t// physics_stats.domElement.children[ 0 ].style.background = \"transparent\";\n\t// physics_stats.domElement.children[ 0 ].children[1].style.display = \"none\";\n\t// container.appendChild( physics_stats.domElement );\n\t\n\t// EVENTS\n\twindow.addEventListener('resize', onWindowResize, false);\n\n\t// After trigger the loading functions\n\t// Connect to WebSocket!\n\t\t// connectSocket();\n\n\t//\n\tlateInit();\n}", "title": "" }, { "docid": "df17d19b80871a711b99ea71e80179ee", "score": "0.6254052", "text": "function start() {\n canvas = document.getElementById(\"glcanvas\");\n\n gl = initGL(canvas); // Initialize the GL context\n\n if (gl) {\n gl.clearColor(0.0, 0.0, 0.0, 1.0); // Set clear color to black, fully opaque\n gl.clearDepth(1.0); // Clear everything\n\n // Next, load and set up the textures we'll be using.\n initTextures();\n\n // Initialize the shaders; this is where all the lighting for the\n // vertices and so forth is established.\n initShaders();\n \n // Set up to draw the scene periodically.\n setInterval(function() {\n if (texturesLoaded) { // only draw scene and animate when textures are loaded.\n animate();\n drawScene();\n }\n }, 15);\n }\n }", "title": "" }, { "docid": "e0267fb1744716e69f2ee7a9864c334b", "score": "0.6252333", "text": "initializeScene(){\n // Add a box at the scene origin\n let box = new THREE.Mesh(\n new THREE.BoxBufferGeometry(0.1, 0.1, 0.1),\n new THREE.MeshPhongMaterial({ color: '#DDFFDD' })\n )\n box.position.set(0, 0, 0)\n this.floorGroup.add(box)\n\n // Add a few lights\n this.scene.add(new THREE.AmbientLight('#FFF', 0.2))\n let directionalLight = new THREE.DirectionalLight('#FFF', 0.6)\n directionalLight.position.set(0, 10, 0)\n this.scene.add(directionalLight)\n\n this.scene.background = null;\n \n // Create the environment map\n const path = './resources/webxr/examples/textures/Park2/'\n const format = '.jpg'\n this.envMap = new THREE.CubeTextureLoader().load([\n path + 'posx' + format, path + 'negx' + format,\n path + 'posy' + format, path + 'negy' + format,\n path + 'posz' + format, path + 'negz' + format\n ])\n this.envMap.format = THREE.RGBFormat\n //this.scene.background = this.envMap\n\n // Add the boom box\n loadGLTF('./resources/webxr/examples/models/BoomBox/glTF-pbrSpecularGlossiness/BoomBox.gltf').then(gltf => {\n gltf.scene.scale.set(15, 15, 15)\n gltf.scene.position.set(0, 1, -0.6)\n gltf.scene.quaternion.setFromAxisAngle(new THREE.Vector3(0, 1, 0), Math.PI)\n\n gltf.scene.traverse(node => {\n if (node.material && (node.material.isMeshStandardMaterial || (node.material.isShaderMaterial && node.material.envMap !== undefined))){\n node.material.envMap = this.envMap\n node.material.needsUpdate = true\n }\n })\n\n this.boomBox = gltf.scene;\n this.floorGroup.add(gltf.scene)\n }).catch((...params) =>{\n console.error('could not load gltf', ...params)\n })\n }", "title": "" }, { "docid": "526fa47ec1e50d2b320e8f7305549253", "score": "0.6248121", "text": "function initScene() {\n gScene = new THREE.Scene();\n gScene.background = new THREE.Color(0xcccccc);\n gScene.fog = new THREE.FogExp2(0xcccccc, 0.002);\n}", "title": "" }, { "docid": "7dee85cb99f941a96347d767aa72dad4", "score": "0.62466544", "text": "init() {\n // re-init the renderer with lighting shaders\n this.renderer.init({\n width: this.dimensions.width,\n height: this.dimensions.height,\n useLightingShaders: true,\n useOffscreenCanvas: true\n })\n }", "title": "" } ]
be1cb6f5f3f6f32af9d286454ff3ca9d
See the FONT.md file for an explanation of this, but basically bit 6 is the NOR of bits 5 and 7.
[ { "docid": "b28053ee6ea03f950d2bb5b54ea36138", "score": "0.0", "text": "function computeVideoBit6(value) {\n const bit5 = (value >> 5) & 1;\n const bit7 = (value >> 7) & 1;\n const bit6 = (bit5 | bit7) ^ 1;\n return (value & 0xBF) | (bit6 << 6);\n}", "title": "" } ]
[ { "docid": "caeff2b58281d042d8ce506e3ae6c366", "score": "0.6485315", "text": "function bitwiseXOR()\n{\n\t//8 decimal is equal to 1000 binary\n\t//3 decimal is equal to 0011 binary\n\t//So, the comparison below will return 1011, which it will display as an 11\n\tdocument.getElementById(\"bitXOR\").innerHTML = 8 | 3;\n}", "title": "" }, { "docid": "96efb8b948140266d9d09cb2219f6fa4", "score": "0.61536825", "text": "function bitwiseOR()\n{\n\t//5 decimal is equal to 101 binary\n\t//3 decimal is equal to 011 binary\n\t//So, the comparison below will return 111, which it will display as a 7\n\tdocument.getElementById(\"bitOR\").innerHTML = 5 | 3;\n}", "title": "" }, { "docid": "7a212a6203fbe4f19e62be428564c0dd", "score": "0.5802011", "text": "function sc_bitNot(x) {\n return ~x;\n}", "title": "" }, { "docid": "6a00c0dd562b20b750c825691a5c381e", "score": "0.57771635", "text": "function bitwiseAND()\n{\n\t//7 decimal is equal to 111 binary\n\t//5 decimal is equal to 101 binary\n\t//So, the comparison below will return 0101, which it will display as a 5\n\tdocument.getElementById(\"bitAND\").innerHTML = 7 & 5;\n}", "title": "" }, { "docid": "97b3ccb1ab5be1a467fdf3d4ccc60f97", "score": "0.5694501", "text": "function ge_neg(pub) {\n pub[31] ^= 0x80;\n}", "title": "" }, { "docid": "b3c655b80a151b3fd56465724d8204a7", "score": "0.5654434", "text": "function lowbits(n){return n&width-1;}//", "title": "" }, { "docid": "2cff3b68e0263efda1fa7948dda8f2d9", "score": "0.5630442", "text": "function NAND2(a, b) {\n return !AND(a, b)\n}", "title": "" }, { "docid": "266b4eef187b198e4b6ca396ecd64b9d", "score": "0.55691564", "text": "function NANDfromNOR(a,b) {\n return NOR(\n NOR(NOR(a,a), NOR(b,b)),\n NOR(NOR(a,a), NOR(b,b))\n )\n}", "title": "" }, { "docid": "3ddd5d96ab79eae9e578ff599382750c", "score": "0.55446905", "text": "xorReg(register) {\n regA[0] ^= register[0];\n regF[0] = regA[0] ? 0 : F_ZERO;\n return 4;\n }", "title": "" }, { "docid": "34c09aeed26c7d4a7ddc283996887e0a", "score": "0.55117893", "text": "function sc_bitOr(x, y) {\n return x | y;\n}", "title": "" }, { "docid": "3cd4b5c4428ff6230005262a8097729e", "score": "0.5458945", "text": "function or_n(n) {\n CPU.tCycles += 7;\n const a = r8.get(i8.A);\n let f = CPU.tables.orFlagsTable[(a << 8) | n];\n r8.set(i8.F, f);\n r8.set(i8.A, a | n);\n}", "title": "" }, { "docid": "ae6f84a4d51a2ca5459972e2fa022cc9", "score": "0.5458188", "text": "function isLegal(square) { return (square & 136) == 0; }", "title": "" }, { "docid": "f24eea76885588990cf1effd42cd7575", "score": "0.54142815", "text": "function toggleBit(e) {\n if (e.text() === \"0\") { e.text(1); }\n else { e.text(0); }\n}", "title": "" }, { "docid": "1bc014986d55c312b78e0c416d89bba5", "score": "0.54094386", "text": "function tagOf(w) {\n return -w & 7\n}", "title": "" }, { "docid": "9790c19bbef04fa79cbd06d5f2e25d7e", "score": "0.5390481", "text": "set zero_flag(v){ this.register_F = change_bit_position(this.register_F, 7, v); }", "title": "" }, { "docid": "295913bd9e93e15be0b247d6864c32dc", "score": "0.5360136", "text": "function xor(a, b) {\n return ( a && !b ) || ( !a && b ) ; \n }", "title": "" }, { "docid": "3607273edf8dad8027cae91b3f7823f2", "score": "0.5349456", "text": "function xor_n(n) {\n CPU.tCycles += 7;\n const a = r8.get(i8.A);\n let f = CPU.tables.xorFlagsTable[(a << 8) | n];\n r8.set(i8.F, f);\n r8.set(i8.A, a ^ n);\n}", "title": "" }, { "docid": "d87a2094b73c6c7d449dc685629ff6a7", "score": "0.5341348", "text": "function lowbits(n)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn n & (width - 1);\n\t\t\t\t\t}", "title": "" }, { "docid": "8af1c559b16f0baf27a30ef27815e555", "score": "0.5323268", "text": "function ANDfromNOR(a,b) {\n return NOR(NOR(a,a), NOR(b,b))\n}", "title": "" }, { "docid": "b6e9c046e65e78405766878a9a94b4f1", "score": "0.5301197", "text": "function lowbits(n) { return n & (width - 1); }", "title": "" }, { "docid": "b6e9c046e65e78405766878a9a94b4f1", "score": "0.5301197", "text": "function lowbits(n) { return n & (width - 1); }", "title": "" }, { "docid": "b6e9c046e65e78405766878a9a94b4f1", "score": "0.5301197", "text": "function lowbits(n) { return n & (width - 1); }", "title": "" }, { "docid": "b6e9c046e65e78405766878a9a94b4f1", "score": "0.5301197", "text": "function lowbits(n) { return n & (width - 1); }", "title": "" }, { "docid": "b6e9c046e65e78405766878a9a94b4f1", "score": "0.5301197", "text": "function lowbits(n) { return n & (width - 1); }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5301003", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "2cb47c12828ee985c471e6dd0848ec00", "score": "0.52992475", "text": "function nor(blo1, blo2) {\n let and =blo1 || blo2\n return !and\n}", "title": "" }, { "docid": "bafcc86e34cf83db31335233cc3859a2", "score": "0.5264101", "text": "function XOR(a, b) {\n return a^b ? true : false\n}", "title": "" }, { "docid": "e47e05f449a6981e158283ab286f8c1c", "score": "0.5254654", "text": "function NAND(a, b) {\n return !(a && b) ? true : false\n}", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" }, { "docid": "a72e25a37811f407a04b8455e984e6c8", "score": "0.5245235", "text": "function op_andnot(x,y) { return x&~y; }", "title": "" } ]
b13239a87fe0c5a0a2ff6efa917c1783
class StringSplosion class accepts a StringSplosion class should contain a manipulate() method which return a _sploded_ version of string passed in the order below: less than or equal to 2 letters first letter twice second letter once if more than 2 letters first letter twice second letter once then add first 3 letters then add first 4 letters then add first 5 letters
[ { "docid": "a43c8dfaf8f80aaf282f8dc5bf76a5a1", "score": "0.5750045", "text": "function StringSplosion(word) {\n this.word = word;\n}", "title": "" } ]
[ { "docid": "a0779e38f76bca172eb23d04f8f5cf27", "score": "0.67739445", "text": "function stringsplosion(s) {\n let arrayFromString = s.split('');\n let result = '';\n for (let i = 0; i < arrayFromString.length; i++) {\n result += arrayFromString.slice(0, i + 1).join('');\n\n }\n return result; \n}", "title": "" }, { "docid": "52f355d1b02ebf6739a2f5d29ba5182d", "score": "0.60906404", "text": "function stringExpansion(s) {\n let newStr = s.split('');\n let ctr = 1;\n let result = '';\n \n while(newStr.length > 0){\n let temp = newStr.splice(0,1)[0];\n \n if(+temp >= 0){\n ctr = +temp;\n } else {\n result += ctr > 0 ? generateStr(ctr, temp) : '';\n };\n };\n \n return result;\n}", "title": "" }, { "docid": "d50e06c14f73cab104b167c9ddd039b2", "score": "0.60725343", "text": "function StringReduction(str) { \nvar arr = str.split(''), i, j, length = arr.length\n\n for (j=0 ; j<length ; j++) {\n for (i=0 ; i<length ; i++) {\n if (arr[i] == 'a' && arr[i+1] == 'b') {\n arr.splice(i, 2, 'c') ;continue\n }\n if (arr[i] == 'a' && arr[i+1] == 'c') {\n arr.splice(i, 2, 'b') ;continue\n }\n if (arr[i] == 'b' && arr[i+1] == 'c') {\n arr.splice(i, 2, 'a') ;continue\n }\n if (arr[i] == 'b' && arr[i+1] == 'a') {\n arr.splice(i, 2, 'c') ;continue\n } \n if (arr[i] == 'c' && arr[i+1] == 'a') {\n arr.splice(i, 2, 'b') ;continue\n }\n if (arr[i] == 'c' && arr[i+1] == 'b') {\n arr.splice(i, 2, 'a') ;continue\n }\n } \n } \n return arr.length \n}", "title": "" }, { "docid": "8b72ef7f802aa902ec717bb67bedad8c", "score": "0.58826005", "text": "function solutionTop1(S) {\n // write your code in JavaScript (Node.js 8.9.4)\n //naive(readable) approach, will be dry with regex\n //handle edge cases \n if (typeof S !== 'string') return 'not valid input'\n // create a result arr\n const result = [];\n // create variable counter to place dashes \n let counter = 0;\n //loop over the input str\n for (let i of S) { \n //check if element is a number\n if (Number(i) || i === '0') {\n // check if counter is 3 push dash and restart counter\n if (counter === 3) {\n result.push('-');\n counter = 0;\n }\n // push into result\n result.push(i);\n //increment counter\n counter+=1;\n };\n };\n //return result as a string\n // handle edge case \n if (result[result.length-2] === '-') {\n //es6 swap\n [result[result.length-2], result[result.length-3]] = [result[result.length-3], result[result.length-2]];\n };\n return result.join('')\n}", "title": "" }, { "docid": "3576318374fca553f6b3e7a3c65e6919", "score": "0.5820646", "text": "function staggeredCase(string) {\n let split = string.split(\"\");\n let newArr = [];\n let alphanumeric = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n let counter = 0;\n \n for (let i = 0; i < split.length; i++) {\n if (!alphanumeric.includes(split[i])) {\n newArr.push(split[i]);\n continue;\n }\n \n if (counter % 2 === 0) {\n newArr.push(split[i].toUpperCase());\n counter += 1;\n } else {\n counter += 1;\n newArr.push(string[i].toLowerCase());\n } \n }\n \n console.log(newArr.join(\"\"));\n return newArr.join(\"\");\n}", "title": "" }, { "docid": "be17c5ffb08b03e7dde86841bd0ff6eb", "score": "0.57702774", "text": "function modifier(string, ...values){//aita 2 ta parameter pai string, values\n//ki pai era dakhi?\nconsole.log(string);//Output:[\" We have \", \" and \", \" in our team\", raw: Array(3)]\nconsole.log(values); //Output: [\"sakib\", \" Tamim\"]\n\nconst m = string.reduce((prev, current) => {//amr finaly 1 ta value lagbe tai reduce use korsi\nreturn prev + current + (values.length? \"Mr.\" + values.shift() : \"\"); //shift prothom sakib k niya ashbey then tamim\n}, \"\");//initiall value null dore nilam prothome\nreturn m;\n\n}", "title": "" }, { "docid": "8ee1b64f963db8b56128d12bdee1172f", "score": "0.5750286", "text": "function mutate_shrink(s) {\n\tvar splits = generate_splits(s);\n\ts=s.substring(0, splits[0]) + s.substring(splits[1])\n\treturn s;\n}", "title": "" }, { "docid": "d0b0c147f1a400420d3cdc3639ce01a2", "score": "0.5748453", "text": "function Move(string){\r\n\tlet array = [];\r\n\tlet final;\r\n\tfor(let i =0; i<string.length; i+=3 ){\r\n\t\tarray.push(string.slice(i,i+3));\r\n\t}\r\n\tfor(let i = 0; i < array.length; i++){\r\n\t\tif(array[i].length===3){\r\n\t\t\tarray[i]= array[i].charAt(1).concat(array[i].charAt(2),array[i].charAt(0))\r\n\t\t}\r\n\t}\r\n\treturn array.join(\"\");\r\n}", "title": "" }, { "docid": "6bc4ce9c91b6237a7381b9864c69e68a", "score": "0.5747151", "text": "function solve(st,a,b){\n let str= st.slice(a,b+1).split(\"\").reverse().join(\"\")\n let newSt = st.slice(0,a) + str + st.slice(b+1, st.length)\n return newSt\n}", "title": "" }, { "docid": "d75d55180ad9decc3e050e27624a2839", "score": "0.56697035", "text": "function buildString(a, b, s) {\n\n // convert string to list.\n var sList = s.split('');\n var temp = '';\n var finalTarget = '';\n var totalCost = 0;\n\n for (let i = 0; ((i < sList.length) && (finalTarget != s)); i++) {\n if (i == 0) {\n finalTarget += sList[i];\n totalCost += a;\n continue;\n }\n\n temp += sList[i];\n\n if (finalTarget.indexOf(temp) == -1) {\n\n if (temp.length > 2) {\n // append will happen.\n finalTarget += temp.substr(0, temp.length - 1);\n\n if (b < ((temp.length - 1) * a)) {\n totalCost += b;\n } else {\n totalCost += ((temp.length - 1) * a);\n }\n\n } else {\n // add will happen.\n finalTarget += temp[0];\n totalCost += a;\n\n }\n\n // Just keep the final char for the next iterations.\n temp = (temp.length > 1) ? temp[temp.length - 1] : '';\n }\n\n\n\n }\n\n\n if (temp) {\n console.log('temp: ', temp);\n if (temp.length > 1) {\n finalTarget += temp;\n totalCost += b;\n } else {\n finalTarget += temp;\n totalCost += a;\n }\n\n }\n\n // extra check.\n totalCost = (totalCost > (sList.length * a)) ? (sList.length * a) : totalCost;\n\n return totalCost;\n\n}", "title": "" }, { "docid": "50336bf138ef2472fe6c77806bf57c21", "score": "0.56506056", "text": "function splitAndMerge(str,sp){\n return str.split(\" \").join(\"\").split(\"\").join(sp)\n \n }", "title": "" }, { "docid": "09083ba5c3488432dea641b39f59f854", "score": "0.5647627", "text": "function spoonerize(words) {\n return words.replace(/^(.)(.* )(.)(.*)$/, '$3$2$1$4');\n}", "title": "" }, { "docid": "128feab35db7424bf688a9407f29dc6a", "score": "0.561052", "text": "function iPutTheFunIn(text){\n var textArray = text.split(\",\");\n var textLength = text.length;\n var halfLength = parseInt(textLength/2) -1;\n var newBuild = \"\";\n for (var i = 0; i < textLength; i++){\n newBuild += text[i];\n if (i === halfLength){\n newBuild += \"fun\";\n }\n }\n return (newBuild);\n}", "title": "" }, { "docid": "51de9a7e9faa6e6fa6568d5bb821ad23", "score": "0.5601812", "text": "function wordSplosionRecursion(str) {\n if(typeof str !== 'string') {\n return \"Please enter in a string\";\n } else {\n if (str.length === 0) return str;\n return wordSplosionRecursion(str.substring(0, str.length -1)) + str;\n }\n}", "title": "" }, { "docid": "9a9527d108e57320da6c0da139347f05", "score": "0.5592503", "text": "function spoonerize(words) {\n const wordArr = words.split(' ');\n const fWordLetter = wordArr[0].charAt(0);\n const sWordLetter = wordArr[1].charAt(0);\n\n const rearrange = (wordArr, letter) => {\n let splitWord;\n splitWord = wordArr.split('')\n splitWord.shift();\n splitWord.unshift(letter);\n return splitWord.join('')\n };\n\n return wordArr.map((arr, idx) => idx === 0 ? rearrange(arr, sWordLetter) : rearrange(arr, fWordLetter)).join(' ');\n}", "title": "" }, { "docid": "6a059641cdc8a1001b54489f8298eb74", "score": "0.55695206", "text": "function spinWords1(str) {\n return [...str.split(' ')].map((v, i) => v.length >= 5 ? v.split(\"\").reverse().join('') : v).join(' ');\n}", "title": "" }, { "docid": "b3d91727bdf41a3ad2e9f959afb745b3", "score": "0.55373085", "text": "function SpcsTo(S, L) {\r\n\t\tS += \"\" // SpcsTo is a reduction of PrfxTo\r\n\t\twhile (S.length<L) {\r\n\t\t\tS = \" \" + S;\r\n\t\t}\r\n\t\treturn S;\r\n\t}", "title": "" }, { "docid": "deb396bc7b489f30c537a0462fe36e22", "score": "0.5522815", "text": "function abbreviate(string) {\n string = string.replace(/,/g, \" ,\");\n string = string.replace(/-/g, \" - \");\n console.log(string);\n var arr = string.split(\" \");\n var arrNew = [];\n var element = \"\";\n for(i=0; i<arr.length; i++) {\n\n \tif(arr[i].length>=4) {\n \t element = arr[i].charAt(0) + (arr[i].length-2).toString() + arr[i].charAt(arr[i].length -1);\n arrNew.push(element);\n \t} else {\n \t arrNew.push(arr[i]);\n \t}\n }\n return arrNew.join(\" \").replace(/ ,/g, \",\").replace(/ - /g, \"-\");\n}", "title": "" }, { "docid": "8d05ce14f9a5ea341f853cab3069f430", "score": "0.5517758", "text": "function minSteps(n, B){\n // Complete this function\n let count = 0;\n function splicer(string){\n let arrSt = string.split('');\n for(let i = 0; i < arrSt.length; i++){\n let newString = arrSt.slice(i, i+3);\n\n if (checkArr(newString)){\n arrSt[i+2] = '1';\n count+=1;\n }\n }\n return count;\n}\n\nfunction checkArr(array){\n let stringArr = array.join('');\n if(stringArr === '010'){\n return true;\n }\n return false;\n}\nreturn splicer(B);\n}", "title": "" }, { "docid": "b9915501bc853c9b3ac809f860dbdac7", "score": "0.551559", "text": "function concateMiddle(sentences){\n var tempSentences = sentences.split(' ')\n var output = ''\n\n for(var i = 0; i < tempSentences.length; i++){\n if(tempSentences[i].length % 2 != 0 && tempSentences[i].length != 1){ // Apabila Panjang Kata Berjumlah Ganjil\n \n var tempSentence = tempSentences[i]\n var middleSentence = Math.floor(tempSentence.length / 2)\n output += tempSentence[middleSentence]\n \n }else if(tempSentences[i].length % 2 == 0 && tempSentences[i].length != 2){ // Apabila Panjang Kata Berjumlah Genap\n \n var tempSentence = tempSentences[i]\n var middleSentence = tempSentence.length / 2\n output += tempSentence[middleSentence - 1]\n output += tempSentence[middleSentence]\n\n }\n }\n\n return output\n}", "title": "" }, { "docid": "fa386fe20971ad6a067274c991cbeb9f", "score": "0.551095", "text": "function solution(str){\n let arr=[] ;\n for(let i=1;i<str.length;i+=2){\n arr.push(String(str[i-1]+str[i]));\n }\n if(str.length%2!==0)\n arr.push(String(str[str.length-1]+\"_\"));\n return arr;\n }", "title": "" }, { "docid": "b9970e1e7cb48a670bc894933c31d9c9", "score": "0.5510763", "text": "function permutations(string){\n\n let arrayString = string.split('');\n let permutation = [];\n \n // if(string.length <= 2){\n // if (string.length == 2){\n // permutation.push(string, string[1]+string[0]);\n // }else{\n // permutation += string;\n // }\n // }\n\n let posiblesPermutations = (arreglo, resultString = []) => {\n if(!arreglo.length){\n return permutation.push(resultString.join(''));\n \n }\n\n for(let i = 0 ; i < arreglo.length; i++){\n let copiaArreglo = arreglo.slice();\n let siguente = copiaArreglo.splice(i,1);\n posiblesPermutations(copiaArreglo, resultString.concat(siguente));\n }\n }\n \n posiblesPermutations(arrayString);\n\n const resultado = new Set(permutation);\n return [...resultado];\n \n}", "title": "" }, { "docid": "c4610d77f6976d7c48f6c771f2f4b387", "score": "0.54997486", "text": "function permutations(string) {\n result = [];\n const cache = {};\n console.log(string.length);\n if (string.length <= 1) {\n return string.split('');\n }\n let currentIndex = string.length - 1;\n\n function swapAround(string) {\n let currentIndex = string.length - 1;\n while (currentIndex >= 0) {\n let letter = string[currentIndex];\n //cut out the current letter\n string = string.substr(0, currentIndex) + string.substr(currentIndex + 1, string.length);\n //add that letter to the end\n string = string + letter;\n let count = string.length - 1;\n while (count >= 0) {\n //keep shifting the current letter one space to the left\n let firstHalf = string.substr(0, count);\n let secondHalf = string.substr(count, string.length);\n let fullWord = firstHalf + letter + secondHalf;\n //fullWord in the instance above still has the letter we moved, which is in\n //the second half and always the last letter and no longer needed, since its moved.\n //Therefore, the line below cuts that last letter off\n fullWord = fullWord.substr(0, string.length);\n if (!cache[fullWord]) {\n result.push(fullWord);\n cache[fullWord] = true;\n }\n count -= 1;\n }\n currentIndex -= 1;\n }\n }\n\n while (currentIndex >= 0) {\n let otherString1 = string.substr(0, currentIndex + 1);\n let otherString2 = string.substr(currentIndex + 1, string.length);\n let otherString = otherString2 + otherString1;\n swapAround(otherString);\n currentIndex -= 1;\n }\n return result;\n}", "title": "" }, { "docid": "fd3766bccd1200ace626425ba0f9bd54", "score": "0.5487158", "text": "function breakUp(str, arrayLength)\n{\n var characterArray = [];\n for (i=0;i<4;i++)\n {\n var character = str.charAt(i);\n characterArray.push(character);\n }\n addTogether(characterArray);\n\n}", "title": "" }, { "docid": "5a68dad4a90f6ab13fe59ea62ab79e5b", "score": "0.54659927", "text": "function solution(str) {\n let newArr = [];\n\n if (str.length % 2 !== 0) {\n str += '_';\n }\n let strArr = [...str];\n\n for (let i = 0; i < strArr.length; i++) {\n if (i % 2 === 0) {\n newArr.push(strArr[i] + strArr[i + 1]);\n }\n }\n\n return newArr;\n}", "title": "" }, { "docid": "3a0356ab7e7d73aa36181ad1da75de25", "score": "0.5455828", "text": "function super_reduced_string(s){\n\n for (let i = 0; i < s.length - 1; i++) {\n if (s[i] === s[i + 1]) {\n s = s.slice(0, i) + s.slice(i+2);\n i = -1;\n }\n }\n if (s.length) {\n return s;\n }\n else {\n return 'Empty String'\n }\n}", "title": "" }, { "docid": "fa8091916a71e675adca5c0470fb8d46", "score": "0.54508036", "text": "function spinWords(arr){\n var splitArr = arr.split(\" \")\n var newArr = []\n \n for(let i=0; i<splitArr.length; i++){\n \n if(splitArr[i].length <= 4){\n newArr.push(splitArr[i] )\n }\n else{\n var wordSplit = splitArr[i].split('')\n var wordReverse = wordSplit.reverse()\n var wordJoin = wordReverse.join('')\n newArr.push(wordJoin)\n // console.log(wordJoin)\n }\n }\n // console.log(splitArr)\n return(newArr.join(' '))\n }", "title": "" }, { "docid": "e962a169e5bd4977c7b8a9f34f9f1cab", "score": "0.5439778", "text": "function stringExpansion(s) {\n if (s === \"\") return \"\";\n let arr = s.match(/(\\d{1}[a-zA-Z]+)|[a-zA-Z]+/g);\n if (arr === null) return \"\";\n return arr\n .map((str) => {\n if (/\\d/.test(str[0])) {\n let number = parseInt(str.split(\"\")[0]);\n let repeat = str\n .split(\"\")\n .slice(1)\n .map((letter) => letter.repeat(number))\n .join(\"\");\n return repeat;\n } else {\n return str;\n }\n })\n .join(\"\");\n}", "title": "" }, { "docid": "91ee09a599be62b9f56f164d35e7808d", "score": "0.5429715", "text": "function basicSeparation(string) {\n\n function flush() {\n if(!builder)\n return\n tokens.push({\n type: bType == 0 ? \"string\" : \"number\",\n content: builder,\n token: true\n })\n bType = -1\n builder = \"\"\n }\n\n let bType = -1;\n let builder = \"\";\n let tokens = []\n\n while(string) {\n\n let c = string.charAt(0)\n string = string.substring(1)\n\n if(isNaN(c) && c != '.') {\n\n if(bType != 0)\n flush()\n if(bType == -1)\n bType = 0\n\n builder += c\n }\n else {\n\n if(bType != 1)\n flush()\n if(bType == -1)\n bType = 1\n\n builder += c\n }\n }\n\n if(bType != -1)\n flush()\n\n return tokens\n}", "title": "" }, { "docid": "2eeeede8030577895120d07ce509d2bb", "score": "0.5424954", "text": "function stringChop(a,b){\n var w =[];\n for (var i=0; i < a.length; i ++) {\n \n c= a.substr(i,b);\n i= i+b-1;\n w.push(c);\n }\n return w;\n \n }", "title": "" }, { "docid": "764285a72c6d3e4fab80cb7d79f49f23", "score": "0.54243475", "text": "function mutate_grow_or_shrink(s) {\n\tvar splits = generate_splits(s);\n\tvar splits2 = generate_splits(s);\n\ts=s.substring(0, splits[0]) + generateRandomCode(splits2[1]-splits2[0]) + s.substring(splits[1])\n\treturn s;\n}", "title": "" }, { "docid": "e8bfd4e4e292ea6b81307c4111bd5f1e", "score": "0.54224026", "text": "function newString(str) {\r\n let remainder = str.length % 3;\r\n let length = str.length;\r\n let new_str = '';\r\n for (let i = 1; i < length; i++) {\r\n if (i === length - remainder || (remainder === 0 && i === length - 1)) {\r\n new_str += (remainder === 0 ? str.slice(i, length) + str[i - 2] : str[i - 3] + str.slice(i, length));\r\n break;\r\n } else if (i % 3 === 0) {\r\n new_str += str[i - 3];\r\n } else {\r\n new_str += str[i];\r\n }\r\n }\r\n console.log(new_str);\r\n\r\n}", "title": "" }, { "docid": "8c64d245028a04f3de7b92c989fc5251", "score": "0.54204744", "text": "function everyOther(string){\n var newarray = [];\n for (var i = 0; i < string.length; i+=2){\n newarray.push(string[i]);\n };\n var newstring = newarray.join(\"\");\nreturn newstring;\n}", "title": "" }, { "docid": "505437deb29bddeb30cb4df3f8b81617", "score": "0.5414729", "text": "function mutate_grow(s) {\n\tvar splits = generate_splits(s);\n\ts=s.substring(0, splits[0]) + generateRandomCode(splits[1]-splits[0]) + s.substring(splits[0]);\n\treturn s;\n}", "title": "" }, { "docid": "41e3344c92918d5f4231c4ec13f6357e", "score": "0.541156", "text": "function pigIt(str){\n return str.split(' ').map((word) => {\n let first = word.split('')[0],\n rest = word.split('').slice(1).join('');\n return `${rest}${first}${'ay'}`;\n }).join(' ');\n}", "title": "" }, { "docid": "d99b579f8073a08aac0e80bd99298b97", "score": "0.5409328", "text": "function pigIt(str) {\n return str.split(' ').map(function(el) {\n return el.slice(1) + el.slice(0, 1) + 'ay';\n }).join(' ');\n}", "title": "" }, { "docid": "d56dee84796fd482f89146614044d804", "score": "0.53897303", "text": "function DashInsert(str) { \nvar strArr = str.split('')\nvar strArr2 = []\n\n for (i=0; i<strArr.length ; i++) {\n strArr2.push(strArr[i]) \n if (strArr[i]%2 !== 0 && strArr[i+1]%2 !== 0) {\n strArr2.push('-')\n }\n }\n\n return strArr2.join('')\n}", "title": "" }, { "docid": "09488b3ee9f9dee798e8928f6233d821", "score": "0.53705436", "text": "function pigIt(str) {\n let workingArray = str.split(' ');\n for (var i = 0; i < workingArray.length; i++) {\n workingArray[i] = workingArray[i].substr(1) + workingArray[i].substr(0, 1);\n }\n return workingArray.join('ay ').concat('ay');\n}", "title": "" }, { "docid": "cf0f9918a8305edd02cdf23783c4b078", "score": "0.53690976", "text": "function splitString(str, character) {\n var result = []\n var temp = ''\n for(var i = 0; i < str.length;i++){\n if(str[i] !== character){\n temp = temp + str[i]\n }else {\n result.push(temp)\n if(temp.length >= 5) {\n result.push(temp)\n }\n temp = ''\n }\n \n\n }\n if(temp.length >= 5) {\n result.push(temp)\n }\n\n return result\n}", "title": "" }, { "docid": "e84b5111a080d18fd07c3ba0c1ead971", "score": "0.5360267", "text": "function solution(str) {\n let result = [];\n let copy = str.split('');\n\n while(copy.length > 0) {\n let pairs = copy.splice(0, 2);\n result.push(pairs.join(''));\n\n if(copy.length === 1) {\n let odd = copy.pop() + '_';\n result.push(odd);\n }\n }\n\n return result;\n}", "title": "" }, { "docid": "3274632b684445f03200b72cec0e598b", "score": "0.53518295", "text": "function cutNamesSmart(spl, maxWidth) {\n\n // JOIN PARTS IF POSSIBLE\n \tvar joinFinish = true;\n \tfor(var i=1; i<spl.length; i++) {\n \t\tif (spl[i].length + spl[i-1].length <= maxWidth-1) { // -1 because a space will be added\n \t\t\tspl[i-1] = spl[i-1] + \" \" + spl[i];\n \t\t\tspl.splice(i, 1);\n \t\t\tjoinFinish = false;\n \t\t\tbreak;\n }\n }\n\n \tif (!joinFinish)\n \t\tcutNamesSmart(spl, maxWidth);\n\n // SPLIT TOO LARGE WORDS\n \tvar cutFinish = true;\n \tfor(var i=0; i<spl.length; i++) {\n \t\tif (spl[i].length > maxWidth) {\n\n \t\t\t// check if at least 4 characters could be added to the previous line\n \t\t\tif(i-1>=0 && spl[i-1].length + 4 < maxWidth) {\n \t\t\t\tvar extraSpace = maxW-2-spl[i-1].length;\n \t\t\t\tvar originalStr = spl[i];\n \t\t\t\tspl[i] = originalStr.substring(0,extraSpace) + \"-\";\n \t\t\t\tspl.splice(i+1,0,originalStr.substring(extraSpace));\n \t\t\t\tcutFinish = false;\n \t\t\t\tbreak;\n }\n \t\t\telse {\n \t\t\t\tvar originalStr = spl[i];\n \t\t\t\tspl[i] = originalStr.substring(0,maxWidth-1) + \"-\";\n \t\t\t\tspl.splice(i+1,0,originalStr.substring(maxWidth));\n \t\t\t\tcutFinish = false;\n \t\t\t\tbreak;\n }\n }\n }\n \tif (!cutFinish)\n \t\tcutNamesSmart(spl, maxWidth);\n else\n return spl\n }", "title": "" }, { "docid": "d569a1506398ba38a27eae4baf5cf5f2", "score": "0.5345022", "text": "function buildString(a, b, s) {\n /*\n * Write your code here.\n */\n let cost = a;\n let result = s[0];\n \n const findSlice = (index, res) => {\n let remain = res.length < s.length - index ? res.length : s.length - index; \n //\n let j = 2;\n let prevSlice = undefined;\n \n for(; j < remain + 1 ; j++ ){\n let slice = s.slice(index, index + j ); \n \n if ( res.indexOf(slice) === -1 ) {\n break; \n }\n prevSlice = slice;\n }\n return prevSlice; \n //return undefined;\n }\n \n const addString = ( word ) => {\n cost += a;\n result += word;\n \n }\n \n const copyString = ( string ) => {\n cost += b;\n result += string; \n \n return string.length - 1;\n }\n \n \n \n let map = []; \n \n \n const plus = ( index, res, cost, callstack ) => {\n let slice = findSlice(index, res);\n if ( undefined !== slice) { \n return { index: index + slice.length, res: res + slice, cost: cost + b};\n } else {\n return { index: index + 1, res: res + s[index], cost: cost + a};\n }\n \n }\n\n\n \n \n let minimum = Infinity;\n let resultCost = Infinity;\n const calcCost = (index, res, cost, callstack, loop = false) => { \n \n \n \n for(; index < s.length && cost < resultCost ; ) { \n \n \n let slice = findSlice(index, res);\n if (undefined !== slice) {\n let newWay1 = { index: index + slice.length, res: res + slice, cost: cost + b };\n let newWay2 = { index: index + 1, res: res + s[index], cost: cost + a };\n while (newWay1.index !== newWay2.index) {\n if (newWay1.index < newWay2.index) {\n\n newWay1 = plus(newWay1.index, newWay1.res, newWay1.cost);\n } else {\n \n newWay2 = plus(newWay2.index, newWay2.res, newWay2.cost);\n }\n }\n if (newWay1.cost < newWay2.cost) {\n \n\n index = newWay1.index;\n res = newWay1.res;\n cost = newWay1.cost;\n } else {\n \n index = newWay2.index;\n res = newWay2.res;\n cost = newWay2.cost;\n }\n \n \n } else {\n \n res = res + s[index];\n index++;\n cost = cost + a; \n \n }\n }\n if ( cost < resultCost) {\n \n resultCost = cost;\n } else if( cost > resultCost) {\n return {index: s.length, res, cost: Infinity};\n }\n return {index, res, cost};\n \n }\n \n \n \n let re = calcCost(1, result, cost);\n \n return re.cost;\n\n\n}", "title": "" }, { "docid": "28ab4bfa8957b3039399545c4d2ffb81", "score": "0.5342852", "text": "function solutions(str) {\n\n var arr = str.split('');\n if (str.length % 2 !== 0) {\n arr.push('_');\n }\n\n var arr2 = [];\n for (var i = 0; i < arr.length; i++) {\n if (i + 1 < arr.length)\n arr2.push(arr[i] + arr[i + 1]);\n i++;\n }\n return arr2\n}", "title": "" }, { "docid": "c811fd3259c9babe6e97e6090c0515d3", "score": "0.53296775", "text": "function accum(s) {\n let mumble = ''\n let arr = s.toUpperCase().split('')\n let count = 0\n for(let i = 0; i<arr.length; i++){\n if(i<arr.length - 1){\n mumble += arr[i] + arr[i].repeat(count).toLowerCase() + '-'\n count++\n }\n else{\n mumble += arr[i] + arr[i].repeat(count).toLowerCase()\n }\n }\n return mumble\n}", "title": "" }, { "docid": "21ed9587a6ee778c2af9265672b964f6", "score": "0.53194803", "text": "function permutateDistinct(str) {\n const result = [];\n let level = -1;\n\n const print = (...args) => {\n // console.log('\\t'.repeat(level), ...args);\n };\n\n /**\n Например есть строка BAA\n - из перестановки (0,1) получим ABA\n - из перестановки (0,2) получим AAB\n => Подстроки BA и AB содержат одинаковые символы и значит будут генерировать одинаковые перестановки.\n\n Чтобы этого избежать, надо игнорировать перестановки с повторяющимся символами.\n Т.е. если при попытки свапнуть arr[i] и arr[j], где i <= j между i и j найдется индекс k такой,\n что arr[k] === arr[j] то перестановку надо отменить.\n */\n const shouldSwap = (str, curr, start) => {\n print('should swap', 'start:', start, 'curr:', curr, ' [' + str.join(', ') + ']');\n for (let i = start; i < curr; i++) {\n print('i:', i, 'curr:', curr, 'str[i]', str[i], 'str[curr]', str[curr]);\n if (str[i] === str[curr]) {\n return false;\n }\n }\n return true;\n };\n /*\n\n*/\n function _permutate(arr, curr) {\n level++;\n if (curr >= arr.length) {\n result.push(arr.join(''));\n level--;\n return;\n }\n print('arr:', arr.join(', '));\n for (let i = curr; i < arr.length; i++) {\n if (shouldSwap(arr, i, curr)) {\n swap(arr, i, curr);\n _permutate(arr, curr + 1);\n swap(arr, i, curr);\n }\n }\n level--;\n }\n\n _permutate(str.split(''), 0);\n\n return result;\n}", "title": "" }, { "docid": "164f2262509e66af06bf299e7b1ef254", "score": "0.53161603", "text": "function accum(s) {\n // no matter the case of the input letter, first instane is always capital\n let letters = s.toLowerCase().split(''); //array element for each letter\n let parts = letters.map((part, index) => {\n return part.repeat(index + 1).replace(/^[a-z]/, part.toUpperCase());\n });\n\n return parts.join('-');\n}", "title": "" }, { "docid": "3b126dee7a13832d54dda52ba0165eab", "score": "0.53030664", "text": "function manipulateString(str) {\r\n if(str.length <= 20) {\r\n return str + str;\r\n } else if(str.length > 20) {\r\n return str.slice(0, str.length / 2);\r\n }\r\n}", "title": "" }, { "docid": "11c24a2bbe95cdc9c128c4270a11b250", "score": "0.52915365", "text": "function spinWords(str) {\r\n const words = str.split(\" \");\r\n const arr = [];\r\n for (let word of words) {\r\n if (word.length >= 5) {\r\n const reverseWord = word\r\n .split(\"\")\r\n .reverse()\r\n .join(\"\");\r\n arr.push(reverseWord);\r\n } else {\r\n arr.push(word);\r\n }\r\n }\r\n return arr.join(\" \");\r\n}", "title": "" }, { "docid": "36ae9063002ab0c79804fb8fc77bf23f", "score": "0.5283968", "text": "function longstringsandwich(string1, string2) {\n if (string1.length > string2.length) {\n var longer_word = string1\n var shorter_word = string2\n } else if (string2.length > string1.length) {\n var longer_word = string2\n var shorter_word = string1\n } else if (string1.length = string2.length){\n var longer_word = string1\n var shorter_word = string2\n }\n \n\n var longer_word_length = longer_word.length //get the length of the longer string\n var longer_word_half = longer_word_length/2 //get the halfway point of the longer string\n var top_bread = longer_word.slice(0,longer_word_half) //get the first half of the longer string as top_bread\n var bottom_bread = longer_word.slice(longer_word_half, longer_word_length) //get the second half as bottom bread\n console.log(top_bread + shorter_word + bottom_bread) //spit out the sandwich\n }", "title": "" }, { "docid": "3785481cadbb70bc5a2da649dae90b96", "score": "0.5281882", "text": "function front22(str) {\n if (str.length >= 2) {\n var first2 = str.slice(0, 2);\n return first2 + str + first2;\n }\n else {\n return str;\n }\n}", "title": "" }, { "docid": "e363b7d36cdf249fab577bb9737456a6", "score": "0.5267098", "text": "function presentTensed(string, removedLetters) {\n var splitString;\n\n if (string[string.length - 1] == \"d\" && string[string.length - 2] == \"e\" && string[string.length - 3] == \"i\") {\n splitString = string.split(\"\");\n string = \"\";\n splitString.splice(splitString.length - 1, 1);\n splitString.splice(splitString.length - 1, 1);\n splitString.splice(splitString.length - 1, 1);\n splitString[splitString.length] = \"y\";\n\n for (i in splitString) {\n string = string + splitString[i];\n }\n }\n else if (string[string.length - 1] == \"d\" && string[string.length - 2] == \"e\" && removedLetters == 1) {\n splitString = string.split(\"\");\n string = \"\";\n splitString.splice(splitString.length - 1, 1);\n\n for (i in splitString) {\n string = string + splitString[i];\n }\n }\n else if (string[string.length - 1] == \"d\" && string[string.length - 2] == \"e\" && removedLetters == 2) {\n splitString = string.split(\"\");\n string = \"\";\n splitString.splice(splitString.length - 1, 1);\n splitString.splice(splitString.length - 1, 1);\n\n for (i in splitString) {\n string = string + splitString[i];\n }\n }\n\n return string;\n}", "title": "" }, { "docid": "adf691bdfe4267c92da4ab6528fcc8b0", "score": "0.5261943", "text": "function solve(st,a,b){\n return st.slice(0, a) + st.slice(a , b + 1).split('').reverse().join('') + st.slice(b + 1);\n}", "title": "" }, { "docid": "aa94b8465d98d910bafd97efcde9319e", "score": "0.5261845", "text": "function solve() {\n let str = '';\n\n return {append, removeStart, removeEnd, print};\n\n function append(strToAppnd){\n str += strToAppnd;\n } \n function removeStart(n){\n str = str.substring(n);\n }\n function removeEnd(n){\n // str = str.substring(0,(str.length-n));\n str = str.slice(0, -n);\n // doesnt work: str = str.substring(-n, 0);\n }\n function print(){\n console.log(str);\n }\n}", "title": "" }, { "docid": "696d50396c52f30a3535aca27da7c116", "score": "0.5257284", "text": "function superReducedString(s) {\n // First way(Using substring string method)\n let output = s;\n for (let i = 1; i < output.length; i++) {\n if (output[i] == output[i - 1]) {\n output = output.substring(0, i - 1) + output.substring(i + 1);\n i = 0;\n }\n }\n\n return output ? output : 'Empty String';\n\n // Second way(Using Regex) -> Credit goes to Alison-P(Hackerrank)\n // let output = s;\n\n // while (true) {\n // const length = output.length;\n\n // output = output.replace(/(.)\\1/g, '');\n\n // if (output.length == length) break;\n // }\n\n // return output ? output : 'Empty String';\n\n // Third way(Traditional approach to the problem)\n // let output = '';\n // let currStr = s;\n // let count = 1;\n\n //while (true) {\n //let isReduced = true;\n //output = '';\n //count = 1;\n //for (let i = 1; i < currStr.length; i++) {\n //const isEqual = currStr[i] == currStr[i - 1];\n\n //if (isEqual) count++;\n\n //if (!isEqual) {\n //if (count % 2 != 0) output += currStr[i - 1];\n// count = 1;\n // }\n\n // if (i == currStr.length - 1) {\n // if (!isEqual || (isEqual && count % 2 != 0))\n // output += currStr[i];\n// }\n // }\n\n // // Check if the string has been reduced or not\n// for (let j = 1; j < output.length; j++) {\n // const isEqual = output[j] == output[j - 1];\n // if (isEqual) {\n// isReduced = false;\n // currStr = output;\n// break;\n // }\n// }\n\n // if (isReduced) break;\n// }\n\n// if (output[0] == output[1]) output = '';\n\n// return output ? output : 'Empty String';\n\n // Fourth way(using stack) -> credit goes to the problem setter's solution(Hackerrank)\n// let stack = [];\n\n// for (let i = 0; i < s.length; i++) {\n// if (!stack.length || s[i] != stack[stack.length - 1]) stack.push(s[i]);\n// else stack.pop();\n// }\n\n// return stack.length ? stack.join('') : 'Empty String';\n}", "title": "" }, { "docid": "282dac8618e5cc371432d1f9cb4fb802", "score": "0.52490366", "text": "function s(input) {\n\n input.forEach(element => {\n console.log(element.replace(/(\\*[A-Z]{1}([A-Za-z]+)*)(?= |\\t|$)|(\\+[0-9\\-]{10})(?= |\\t|$)|(\\![a-zA-Z0-9]+)(?= |\\t|$)|(\\_[a-zA-Z0-9]+)(?= |\\t|$)/g,\n (match) => '|'.repeat(match.length)));\n });\n}", "title": "" }, { "docid": "0e003a7cfcf655d3cd10c440033b6328", "score": "0.52473694", "text": "function solve(s) {\n\t// let nums = s.split('');\n\tlet total = 0;\n\tfor (let i = 0; i < s.length; i += 1) {\n\t\tif (s.slice(i) % 2 === 1) total += 1;\n\t\tfor (let j = 1; j < s.length - 1; j += 1) {\n\t\t\tif (s.slice(i, j).join('') % 2 === 1) total += 1;\n\t\t}\n\t}\n\treturn total;\n}", "title": "" }, { "docid": "04ac668757d5d90d6c6cb26bccff7970", "score": "0.52469933", "text": "function accum(s) {\n\tlet arr = s.split('')\n let letter = \"\"\n let word = \"\"\n let result = []\n\n for(let i = 0; i < arr.length; i++) {\n letter = arr[i].toLowerCase()\n word += letter.toUpperCase()\n\n for(let j = 1; j <= i; j++) {\n word += letter\n }\n\n result.push(word)\n word = \"\"\n }\n\n return result.join('-')\n}", "title": "" }, { "docid": "92b32adbefe1b819dadf2727c89b9899", "score": "0.52448946", "text": "function accum(s) {\n let finalString = \"\"\n for(let i = 0; i < s.length; i++)\n { \n let substring = s[i].toUpperCase()\n for(let j = 1; j < i + 1; j++){\n substring += s[i].toLowerCase()\n }\n if(i!=s.length-1)\n substring += \"-\"\n finalString += substring\n //grab letter at i , capitalize it at first instance, then go until iteration counter+1\n }\n return finalString\n }", "title": "" }, { "docid": "f9fa0879f25aee0139c03444e74f1bf2", "score": "0.52420443", "text": "function spacify(str) {\n let newStr = str.split(\"\").join(\" \"); \n console.log(newStr);\n }", "title": "" }, { "docid": "c523a52e8617f5154af9a6f32df930a0", "score": "0.52301943", "text": "function chopLength(input, length) {\n let element = \"\";\n let elementArray = [];\n for(var i=0; i<input.length; i++) {\n element = element + input[i];\n if ((i+1)%length==0) {\n elementArray.push(element);\n element = \"\";\n }\n }\n elementArray.push(element);\n return elementArray; \n}", "title": "" }, { "docid": "2c2ec316ac54cc494c725264f248baa2", "score": "0.52217233", "text": "function pigIt(str){\n let newStr = str.split(' ')\n let cutArray = newStr.map(word => word.slice(1))\n let pigLatinArr = []\n let selectedPLArr = []\n for (var i=0; i < newStr.length; i++){\n\n\t\tpigLatinArr.push(cutArray.map(cutWord => cutWord.concat(newStr[i].split('').shift())))\n\n \tselectedPLArr.push(pigLatinArr.map(arr => arr[i]))\n\n }\n\nreturn selectedPLArr.map(arr => arr.pop().concat('ay')).join(' ')\n}", "title": "" }, { "docid": "851496b6140dc75b89bee50ba35fd2ee", "score": "0.5218239", "text": "function lsd(s, sp){\n // having to special case these is silly\n if(s === sp) return [];\n if(sp === '') return lsd(s, s.slice(-1)).concat([[0, 1, '']]);\n if(s === '') return sp.split('').map((k, i) => [i, i, k]);\n\n var ops = new Levenshtein(s, sp).getSteps();\n ops.reverse()\n var actions = []\n ops.forEach(([op, a, b]) => {\n if(op == 'delete'){\n actions.push([b, b + 1, ''])\n }else if(op == 'substitute'){\n actions.push([b-1, b, sp[b-1]])\n }else if(op == 'insert'){\n actions.push([b-1, b-1, sp[b-1]])\n }\n })\n return actions;\n}", "title": "" }, { "docid": "3335021b2d95e4064f35818e2904bdea", "score": "0.521658", "text": "function loremSentence(){\r\n let newLorem=lorem.split(\".\")\r\n let resultSentence=\"\"\r\n let len=document.getElementById(\"i3\").value\r\n for(let i=0;i<len;i++){\r\n resultSentence=resultSentence+newLorem[i]+\".\"\r\n }\r\n document.getElementById(\"p4\").innerHTML=resultSentence\r\n}", "title": "" }, { "docid": "e6756416e34710fe5db60f476bf06a37", "score": "0.5215841", "text": "function processWords(input) {\n const words = input.toLowerCase().replace(/,|\\.|'|!|;|:|\\(|\\)/gi, \"\").split(\" \")\n const stringWordLength = input.split(\" \").length\n const processed = []\n\n for (i = 3; i <= stringWordLength; i++) {\n for (pos in words) {\n const slice = words.slice(pos, parseInt(i) + parseInt(pos))\n if (slice.length === i) {\n let phrase = \"\"\n slice.forEach(item => {\n phrase += \" \" + item\n })\n processed.push(phrase.trim())\n }\n }\n\n }\n\n return processed\n}", "title": "" }, { "docid": "62a966bd67321ea5d95ab03e939a1c6d", "score": "0.52031016", "text": "function substrings()\n{\n var str1=prompt(\"Enter the String\");\nvar array1 = []; \n for (var x = 0, y=1; x < str1.length; x++,y++) \n { \n array1[x]=str1.substring(x, y); \n } \nvar combi = []; \nvar temp= \"\"; \nvar slent = Math.pow(2, array1.length); \n\nfor (var i = 0; i < slent ; i++) \n{ \n temp= \"\"; \n for (var j=0;j<array1.length;j++) { \n if ((i & Math.pow(2,j))){ \n temp += array1[j]; \n } \n } \n if (temp !== \"\") \n { \n combi.push(temp); \n } \n} \n console.log(combi.join(\"\\n\")); \n}", "title": "" }, { "docid": "61c020afb1c1588e951282717351395a", "score": "0.52026737", "text": "_spliceString(str, start, length, replace) {\n const before = str.substring(0, start);\n const after = str.substring(start+length);\n return before + replace + after;\n }", "title": "" }, { "docid": "3b7445fa1a434769f5d52d0939b015e8", "score": "0.5197343", "text": "function sortMyString(S) {\n let even = S.split('').filter((v, i) => i % 2 === 0).join('')\n let odd = S.split('').filter((v, i) => i % 2 !== 0).join('')\n return even + ' ' + odd\n}", "title": "" }, { "docid": "0551f661db13ba81564b565f0375d937", "score": "0.51951444", "text": "function minRemoveToMakeValid(s) {\n const res = s.split(\"\");\n const stack = [];\n\n for (let i = 0; i < res.length; i++) {\n if (res[i] === \"(\") {\n stack.push(i);\n } else if (res[i] === \")\" && stack.length) {\n stack.pop();\n } else if (res[i] === \")\") {\n res[i] = \"\";\n }\n }\n\n while (stack.length) {\n const curIdx = stack.pop();\n res[curIdx] = \"\";\n }\n\n return res.join(\"\");\n }", "title": "" }, { "docid": "05224598de7af36d45540fe761ee1076", "score": "0.51935434", "text": "function solve(s){\n let newStr = s.split(''); \n let isValid = true;\n let ctr = 0;\n\n if(newStr.length === 0 || newStr.length % 2 !== 0){\n return -1;\n };\n \n while(isValid){\n isValid = false;\n for(let i = 0; i <= newStr.length - 1; i++){\n let opening = newStr.indexOf('(', i);\n let closing = newStr.indexOf(')',opening);\n if(opening + 1 == closing){\n newStr[opening] = '';\n newStr[closing] = '';\n isValid = true;\n };\n };\n newStr = newStr.join('').split('');\n };\n \n for(let i = 0; i <= newStr.length - 1; i += 2){\n ctr += newStr[i] === ')' ? 1 : 0;\n ctr += newStr[i + 1] === '(' ? 1 : 0;\n };\n \n return ctr;\n}", "title": "" }, { "docid": "c55a8b9c036690ae7a5943883126d1c1", "score": "0.5192178", "text": "function spinWords(str) {\n function reverseString(string) {\n return string\n .split(\"\")\n .reverse()\n .join(\"\");\n }\n function checkLength(arr, string) {\n if (string.length >= 5) return arr.indexOf(string);\n else return -1;\n }\n const strArr = str.split(\" \");\n const indexArr = strArr.map(x => checkLength(strArr, x));\n const indexToChangeArr = indexArr.filter(x => x !== -1);\n if (indexToChangeArr.length === 0) {\n return str;\n } else {\n let resultArr = [...strArr];\n indexToChangeArr.forEach(x => {\n resultArr[x] = reverseString(resultArr[x]);\n });\n return resultArr.join(\" \");\n }\n}", "title": "" }, { "docid": "fe5de61be8760701bdd65164b6d9912e", "score": "0.519168", "text": "function split(message) {\n const messageCharLimit = 160;\n const segmentLen = 5;\n const msgLen = messageCharLimit - segmentLen;\n const messages = [];\n //const msgNum = Math.ceil(message.length / msgLen);\n let startIdx = 0;\n let endIdx = startIdx + msgLen;\n if (message.length <= msgLen) {\n return [message];\n }\n\n \n // first iteration\n // for (let i = 0; i < msgNum; i++){\n // let msg = message.slice(startIdx, endIdx);\n // messages.push(msg+`(${i+1}/${msgNum})`);\n // startIdx += msgLen;\n // endIdx += msgLen;\n // }\n while (endIdx <= message.length - 1) {\n let spaceIdx = startIdx + message.slice(startIdx, endIdx + 1).lastIndexOf(' ');\n let subMessage;\n if (endIdx === spaceIdx) {\n subMessage = message.slice(startIdx, spaceIdx-1);\n spaceIdx-=1;\n } else {\n spaceIdx++;\n subMessage = message.slice(startIdx, spaceIdx);\n }\n messages.push(subMessage);\n startIdx = spaceIdx;\n endIdx = startIdx + msgLen;\n }\n\n if (startIdx < message.length - 1) {\n messages.push(message.slice(startIdx));\n }\n\n let finalMessages = messages.map((subMsg, i) => {\n return subMsg + `(${i + 1}/${messages.length})`;\n });\n\n return finalMessages;\n}", "title": "" }, { "docid": "af01a68d6199b40c050e0bd7da14d211", "score": "0.5191138", "text": "function spinWords(word){\n //TODO Have fun :)\n const words = word.split(\" \");\n for(let i=0; i< words.length; i++) {\n if(words[i].length >= 5){\n words[i] = words[i].split(\"\").reverse().join(\"\");\n }\n }\n\n return words.join(\" \")\n\n}", "title": "" }, { "docid": "14f3a9784125d7482bf68944d8ffb1da", "score": "0.5178081", "text": "function pigIt(str) {\n\tarr = str.split(' ');\n\tfor (let i = 0; i < arr.length; i++) {\n\t\tlet a = arr[i].slice(1).match(/(\\w+)/g) || '';\n\t\tlet b = arr[i].slice(0, 1) || '';\n\t\tlet c = arr[i].match(/[^\\w\\*]/) || '';\n\t\t!!arr[i].match(/[^\\w\\*]/)&&arr[i].length===1 ? arr[i]=arr[i]:arr[i] = a+b+'ay'+c\n\t\t\n\t}\n\treturn arr.join(' ');\n}", "title": "" }, { "docid": "f7bab6276f11970f673812a71638e0a8", "score": "0.5176373", "text": "function weave(strings) {\n let phrase = ('coding iz hard')\n let string = phrase.split('')\n let nth = 4;\n let replace = 'x';\n for (i = nth - 1; i < string.length; i += nth) {\n string[i] = replace;\n }\n return string.join('');\n}", "title": "" }, { "docid": "194faf889953fe908cf1da0c9dbb1b8c", "score": "0.5175054", "text": "function accum(s) {\n var s = s.toUpperCase();\n var result = \"\";\n for (i = 0; i < s.length; i++) {\n //console.log(s[i]);\n if (i != s.length - 1) {\n result = result.concat(s[i] + s[i].toLowerCase().repeat(i) + '-');\n }\n else {\n result = result.concat(s[i] + s[i].toLowerCase().repeat(i));\n }\n }\n return result;\n\n}", "title": "" }, { "docid": "cb29919bc711a590e40d9c9f18edc916", "score": "0.51732194", "text": "function removeEvenCharacters(string) {\n\n if (string === \"\") {\n return \"\";\n }\n if (string === undefined) {\n return \"missing argument\";\n }\n if (!isNaN(string)) {\n return \"argument not string\";\n }\n let outputstr = \"\";\n for (let i = 0; i < string.length; i++) {\n if (i % 2 !== 0) {\n outputstr = outputstr.concat(string[i]);\n }\n }\n return outputstr;\n}", "title": "" }, { "docid": "ac6cf1e7b377110171c751441a78c8a6", "score": "0.51686054", "text": "function DashInsert(str) { \n str = str.split(\"\");\n for(var i = 0; i < str.length; i++){\n if(parseInt(str[i]) % 2 === 1 && parseInt(str[i+1]) % 2 === 1){\n str.splice(i+1, 0, \"-\");\n }\n }\n return str.join(\"\"); \n}", "title": "" }, { "docid": "e8852baed7e3a4cc881921dd84b1724c", "score": "0.5167768", "text": "function accum(s) {\n let len = 0;\n let cab = s.split(\"\");\n let abc = [];\n cab.forEach((letter) => {\n abc.push(letter.toUpperCase() + letter.toLowerCase().repeat(len));\n len += 1;\n });\n return abc.join(\"-\");\n}", "title": "" }, { "docid": "c3585d7e118c07f8efbeb974d96938b4", "score": "0.5163836", "text": "function addExcitement(sentenceArray, punctuation, numOfTimes) {\n let builtSentence = \"\"\n for (let i = 0; i < sentenceArray.length; i++) {\n if ((i + 1) % 3 === 0) {\n builtSentence += sentenceArray[i] + punctuation.repeat(numOfTimes) + \" \"\n console.log(builtSentence);\n } else {\n builtSentence += sentenceArray[i] + \" \"\n console.log(builtSentence);\n }\n }\n}", "title": "" }, { "docid": "125b42012277be213ccc0c5ee95711dc", "score": "0.5155944", "text": "function capitalize(a) {\r\n if (a.length%2===0){\r\n // var capilizeAndLowercase = a.toLowerCase()\r\n // var capilizeAndUppercase = a.toUpperCase()\r\n var returnFirstHalf = a.slice(0, a.length/2)\r\n var capitalize = returnFirstHalf.toUpperCase()\r\n console.log(capitalize) \r\n var findMiddleIndex = a.slice(a.length/2)\r\n var lowercased = findMiddleIndex.toLowerCase()\r\n console.log(lowercased)\r\n var res = capitalize.concat(lowercased);\r\n console.log(res)\r\n }\r\n}", "title": "" }, { "docid": "36288226cf194eba4e151d84637a9ea6", "score": "0.5154306", "text": "function argh(s) {\n array = []\n for(i = 0; i < s.length; i++){\n word = s.charAt(i);\n sup = word.toUpperCase();\n sup += word.repeat(i).toLowerCase();\n array.push(sup);\n }\n return array.join('-');\n \n}", "title": "" }, { "docid": "4a22bbc341ca7d109ae2f7ed6733b53a", "score": "0.5150476", "text": "function sortByLength(str) {\r\n let strArr = str.split(' ');\r\n\tfor (var i = 0; i < strArr.length; i++) {\r\n for (var j = 0; j < strArr.length-i-1; j++) {\r\n if (strArr[j].length > strArr[j+1].length) {\r\n var newItem = strArr[j];\r\n strArr[j] = strArr[j+1];\r\n strArr[j+1] = newItem;\r\n }\r\n }\r\n }\r\n return strArr.join(' ');\r\n}", "title": "" }, { "docid": "76cd2ad50f3d2a84c74ed2b84ee50c1c", "score": "0.5142742", "text": "function findduplicateletters(string) {\n string = \"this is a Test\"\n string.toLowercase\n let array = [...string]\n for (var i=0; i<string.length; i++)\n \n}", "title": "" }, { "docid": "1918d008271508c8b2b29cea7693ab4e", "score": "0.5136878", "text": "function solve(s, n) {\n let sArr = s.split('')\n let strings = []\n for(let i = 0; i < s.length; i+=n){\n strings.push(sArr.slice(i, n+i).join(''))\n console.log(strings)\n }\n return strings\n}", "title": "" }, { "docid": "ba4de6b47aa720db99e7f8129b0cae4a", "score": "0.51367813", "text": "function front_times(str,n){\n if (str.length >= 3) {\n var result = \"\";\n var first3 = str[0] + str[1] + str[2];\n for (var i = 0; i < n; i++) {\n result += first3;\n }\n return result;\n }else{\n var result = \"\";\n for (var i = 0; i<n; i++){\n result += str;\n }\n return result;\n }\n}", "title": "" }, { "docid": "111dce089aea04f9227c9dc8ed0cbf89", "score": "0.513181", "text": "function createString(array) {\n \n function emptyStrings(arrMember) {\n var emtyString = \"\"; \n \n for(var i = 1; i <= maxWordLength - arrMember.length; i++){\n emtyString += \" \";\n }\n return emtyString; \n }\n\n var maxWordLength = 0;\n var firstAndLastString = \"\";\n\n // Deklarisanje varijable kao anonimne funkcije\n var starLength = function () {\n for(var i = 0; i < array.length; i++){\n if(array[i].length > maxWordLength){\n maxWordLength = array[i].length;\n }\n }\n return maxWordLength + 4;\n }\n\n // Kreirati string za prvi i poslednji red\n for(var j = 1; j <= starLength(); j++){\n firstAndLastString += \"*\";\n }\n\n firstAndLastString +=\"\\n\";\n\n // Deklarisanje varijable kao anonimne funkcije\n \n var midleString = function () {\n var result = \"\";\n\n for(var k = 0; k < array.length; k++){\n result += \"* \" + array[k] + emptyStrings(array[k]) + \" *\\n\";\n }\n return result; \n }\n \n // Kreirati konacan rezultat\n return console.log(firstAndLastString + midleString() + firstAndLastString);\n \n}", "title": "" }, { "docid": "7be5ea0afcf9ffa6fc8892ea96c11a63", "score": "0.5129314", "text": "function\ton_decs3(str21){\n \n \n\tvar str=new String(str21);\n\t\n var dot=str.indexOf(\".\");\n var str1;\n\t\n\tif(dot>0) \n\t\tstr1=str.slice(0,dot);\n\telse\n\t\tstr1=str;\n\t\t\n var size=str1.length;\n \n\tvar new_str='';\n var i;\n\t\n\tfor(i=size;i>0&&i>3;i-=3){\n\t \n\t new_str=str1.slice(i-3,i)+new_str;\n \t new_str=\" \"+new_str;\n\t}\n\tnew_str=str.slice(0,i)+new_str;\n\tif(dot>0)\n\t new_str=new_str+str.slice(dot);\n\treturn new_str;\n }", "title": "" }, { "docid": "e1adf880ab7e50418f75d4abbafcc7d5", "score": "0.5122701", "text": "function recreateSentence(sentence) {\n let words = sentence.split(' '); // ['BootcamP', 'JuliE', ele, ele....]\n for (let i = 0; i < words.length; i++) {\n let word = words[i]; // 'bootcamp'\n let newWord = firstLastCap(word); // 'BootcamP'\n words[i] = newWord; // assigning with new value\n\n // words[i] = firstLastCap(words[i]);\n }\n return words.join(' '); \n}", "title": "" }, { "docid": "5cbe71ff4826db668aa38bbae6745260", "score": "0.5122176", "text": "slicerMachine(origString) {\n let firstLetter = origString.slice(0, 1); // first letter\n let newString = origString.slice(1); // rest of the string\n newString += firstLetter; // put the first letter to the end of the rest\n\n // remembering to the new string for the case of PAUSE\n runText.strPaused = newString;\n console.log(newString);\n // calling the displayer method from 'string_to_display.js'\n theMain(newString);\n // calling the displayer on compare display if required\n if (this.compareDisplay) {\n this.displayOnCompare(newString.slice(0, dispSize));\n }\n return newString;\n }", "title": "" }, { "docid": "2a4fd7fb1396aef2aa2bfbfdca218bb1", "score": "0.5122158", "text": "function truncateString(str, num) {\n var strSpl = str.split('');\n var strArr = [];\n if (num >= strSpl.length){\n return str;\n }\n if(num > 3) {\n for (var i = 0; i < num - 3; i++) {\n strArr.push(strSpl[i]); \n }\n var joined = strArr.join('');\n var dots = joined + '...';\n return dots;\n }\n for (var j = 0; j < num; j++) {\n strArr.push(strSpl[j]);\n }\n var joinSmall = strArr.join('');\n var smallDot = joinSmall + '...';\n return smallDot;\n\n}", "title": "" }, { "docid": "177302a281c6f0c1c5b4cd02550b463e", "score": "0.51185733", "text": "function everyOther(str) {\n if (str.length <=1) return str\n return str[0]+everyOther(str.substring(2))\n \n}", "title": "" }, { "docid": "1e6c34090c3de12c1059c9ccd45636c1", "score": "0.51140994", "text": "function mod1(pos2) {\n if (pos1!=-1 && pos2!=-1) {\n console.log(`Frase introducida: \"${str}\"\\nDelimitador: \"${del1}\"\\nResultado: \"${str.slice(pos1, pos2).trim()}\"`);\n } else {\n console.log(\"El delimitador no está en la frase o solo está una vez.\");\n }\n}", "title": "" }, { "docid": "3bcfba498bf6552610f2660dceabc9b2", "score": "0.5112021", "text": "function powerSet (string) {\nvar results = [\"\"];\nvar counter = 0;\nvar newStr = [];\n\n//split string into array, sort the letters\n//for each letter, if it is not in new string add it\nstring = string.split(\"\").sort().forEach(function(value){\n if(newStr.indexOf(value) === -1){\n newStr.push(value);\n }\n});\n//now we have a string which is sorted\nnewStr.join(\"\");\n\nvar recurse = function (givenStr,currStr) {\n //loop through letters\n for (var i = 0; i < givenStr.length; i++){\n //push the concatenation of the currStr and the given string\n //notice when we recurse, \n //givenStr = slices one portion\n //currStr = slices remaining portion\n\n //this ensures that the concated portion includes all letters\n //in original string\n results.push(currStr + givenStr[i]);\n recurse(givenStr.slice(i+1),currStr+givenStr[i]);\n }\n};\n\n//pass sorted letters and empty string to recursion function \nrecurse(newStr,\"\");\nreturn results;\n}", "title": "" }, { "docid": "21484ec16aecb237c9f53a865af16c0c", "score": "0.5111848", "text": "function incrementString (strng) {\n let arr1 = strng.split('');\n let arr2 = [];\n let arr3 = [];\n for(let i = 0; i< arr1.length; i++){\n if(arr1[i] == 0 ||arr1[i] ==1 || arr1[i] == 2 || arr1[i] ==3 || arr1[i] == 4 || arr1[i] == 5|| arr1[i] == 6 || arr1[i] == 7 || arr1[i] == 8 || arr1[i] == 9 ){\n arr3.push(arr1[i])\n }else{\n arr2.push(arr1[i])\n }\n }\n if(arr3.length===0){\n arr3.push(0)}\n let num1 = arr3.join('')\n let num2=parseInt(num1)\n let arr4 = [];\n let arr5 = num1.split('')\n arr4.push(num2 + 1);\n if(arr4[0] > 9 && arr4[0]<=99){\n arr5.splice(arr5.length-2,2,arr4[0])\n }\n else if(arr4[0] >= 100 && arr5.length < 5){\n arr5.splice(0,arr5.length,arr4[0])\n }\n else if(arr4[0]>=1000 && arr5.length > 4){\n arr5.splice(arr5.length-4,4,arr4[0])\n }\n else{\n arr5.splice(arr5.length-1,1,arr4[0])\n }\n arr2.push(arr5.join(''))\n let res = arr2.join('')\n return res;\n}", "title": "" }, { "docid": "71ff7758654aa7e2d6454134ffaef7c2", "score": "0.5110772", "text": "function truncate(str, num) {\n let arr = [];\n let disp = str.split(\" \").forEach( (element,ind) => {\n if(ind > num -1) {\n return;\n } else {\n arr.push(element); \n }\n return arr;\n }); \n return arr.join(\" \");\n }", "title": "" }, { "docid": "fddec958e87794fa994f44056d7a0afc", "score": "0.5103928", "text": "function naiveSentenceRec(paragraph ,word){\n //current implementation:\n //split the paragraph according to commas.\n //in the list, if a variable is not a new line, concate it to the one before.\n\n var commaSplitList = paragraph.split(/\\./g);\n var sntncList = [commaSplitList[0]];\n var sntncIdx =0;\n for(var i=1 ; i<commaSplitList.length ; i++){\n\n var notNew = /^(\\W*\\w*){0,2}\\W*$/; //anything which is less than 2 words won't consider a new senetence.\n if(commaSplitList[i].match(notNew)){\n sntncList[sntncIdx] = sntncList[sntncIdx]+\".\"+commaSplitList[i];\n }\n else{\n sntncIdx++;\n sntncList[sntncIdx] = commaSplitList[i];\n }\n }\n //now we return the senetence of the word with the senetence before and after it.\n //word = word.replace(\" \",\"\\s\");\n var ctxRegex = new RegExp(\"\\\\b\"+word+\"\\\\b\");\n ctx = \"\";\n var LIMIT_CTX_LENGTH = 200;\n for(var i=0;i<sntncList.length;i++){\n\n if(ctxRegex.test(sntncList[i])){\n ctx = sntncList[i];\n if(i>0 && ctx.length<LIMIT_CTX_LENGTH && sntncList[i-1].length<LIMIT_CTX_LENGTH)\n ctx = sntncList[i-1]+\".\"+ctx;\n if(i+1<sntncList.length && ctx.length<LIMIT_CTX_LENGTH && sntncList[i+1]<LIMIT_CTX_LENGTH)\n ctx = ctx+\".\"+sntncList[i+1];\n return ctx;\n }\n }\n\n return ctx;\n}", "title": "" }, { "docid": "a62e94a049833e58b25caffc33998e0c", "score": "0.51031554", "text": "function pigIt(str) {\n let mapped = str.split(' ').map(word => word.slice(1) + word[0] + 'ay')\n\n if (str[str.length - 1] === '!' || str[str.length - 1] === '.' || str[str.length - 1] === '?') {\n var discard = mapped.pop();\n mapped.push(discard[0]);\n return mapped.join(' ');\n } else {\n return mapped.join(' ');\n }\n}", "title": "" }, { "docid": "d698d9d07d20a08c16b67967d91d2f93", "score": "0.5102626", "text": "function P(e){return e.join(S).replace(F,W).replace(z,q)}", "title": "" }, { "docid": "564f2eb29bae5b7aeea24f5b4ff76dfa", "score": "0.5098291", "text": "function spinWords(){\n //TODO Have fun :)\n return [...arguments].join('').split(' ').map(word => word.length>=5? word.split('').reverse().join(''): word).join(' ')\n }", "title": "" }, { "docid": "4c57a8753e21e59a8fb132195ebb2c3f", "score": "0.5094652", "text": "replaceSubstring(s1, s2, array){\n var result = Array();\n for (var el of array) {\n if(typeof el !== \"undefined\"){\n // Non solo la stringa deve essere contenuta, ma dato che si tratta di una sositutzione\n // dell'intero percorso fino a quella cartella mi assicuro che l'inclusione parta\n // dal primo carattere\n var eln = el;\n if(el.substring(0,s1.length).includes(s1)){\n eln = s2+el.substring(s1.length)\n }\n result.push(eln);\n }\n }\n return result;\n }", "title": "" } ]
43c559ca32b3a7abdf9df0c7b68c1d50
Copyright 2017 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Returns a function that invokes f with its arguments asynchronously as a microtask, i.e. as soon as possible after the current script returns back into browser code.
[ { "docid": "30bcffe2e39dcfcecfc74638bb5de7a1", "score": "0.7545767", "text": "function async(f) {\n return function () {\n var argsToForward = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n argsToForward[_i] = arguments[_i];\n }\n resolve(true).then(function () {\n f.apply(null, argsToForward);\n });\n };\n}", "title": "" } ]
[ { "docid": "b0d4afa613ab8cbd055861e89e170209", "score": "0.7613707", "text": "function async(f) {\r\n return function () {\r\n var argsToForward = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n argsToForward[_i] = arguments[_i];\r\n }\r\n resolve(true).then(function () {\r\n f.apply(null, argsToForward);\r\n });\r\n };\r\n}", "title": "" }, { "docid": "b0d4afa613ab8cbd055861e89e170209", "score": "0.7613707", "text": "function async(f) {\r\n return function () {\r\n var argsToForward = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n argsToForward[_i] = arguments[_i];\r\n }\r\n resolve(true).then(function () {\r\n f.apply(null, argsToForward);\r\n });\r\n };\r\n}", "title": "" }, { "docid": "0960a6e333e8d7d20a34885e195a68f5", "score": "0.7594145", "text": "function async(f) {\n return function () {\n var argsToForward = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n argsToForward[_i] = arguments[_i];\n }\n promiseimpl.resolve(true).then(function () {\n f.apply(null, argsToForward);\n });\n };\n}", "title": "" }, { "docid": "1555fa9cb1c03e59d44d88e56ebf039f", "score": "0.75685716", "text": "function async(f) {\n\t return function () {\n\t var argsToForward = [];\n\t for (var _i = 0; _i < arguments.length; _i++) {\n\t argsToForward[_i] = arguments[_i];\n\t }\n\t promiseimpl.resolve(true).then(function () {\n\t f.apply(null, argsToForward);\n\t });\n\t };\n\t}", "title": "" }, { "docid": "755ba1024d7e55b1364658145a470c80", "score": "0.7513283", "text": "function async(f) {\n return function () {\n for (var _len = arguments.length, argsToForward = Array(_len), _key = 0; _key < _len; _key++) {\n argsToForward[_key] = arguments[_key];\n }\n\n promiseimpl.resolve(true).then(function () {\n f.apply(null, argsToForward);\n });\n };\n}", "title": "" }, { "docid": "755ba1024d7e55b1364658145a470c80", "score": "0.7513283", "text": "function async(f) {\n return function () {\n for (var _len = arguments.length, argsToForward = Array(_len), _key = 0; _key < _len; _key++) {\n argsToForward[_key] = arguments[_key];\n }\n\n promiseimpl.resolve(true).then(function () {\n f.apply(null, argsToForward);\n });\n };\n}", "title": "" }, { "docid": "755ba1024d7e55b1364658145a470c80", "score": "0.7513283", "text": "function async(f) {\n return function () {\n for (var _len = arguments.length, argsToForward = Array(_len), _key = 0; _key < _len; _key++) {\n argsToForward[_key] = arguments[_key];\n }\n\n promiseimpl.resolve(true).then(function () {\n f.apply(null, argsToForward);\n });\n };\n}", "title": "" }, { "docid": "35332fdc70aa81da0584fad5056bb7c4", "score": "0.7177889", "text": "async function f() {\n return 'Hello World';\n}", "title": "" }, { "docid": "c6c19aa100e36b66c00647bcc08a5ed2", "score": "0.7138772", "text": "function async(f) {\n return function() {\n var argsToForward = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n argsToForward[_i] = arguments[_i];\n }\n __WEBPACK_IMPORTED_MODULE_0__promise_external__['b' /* resolve */](\n true\n ).then(function() {\n f.apply(null, argsToForward);\n });\n };\n }", "title": "" }, { "docid": "4978bc91f08d73e1b98ad654f11430b5", "score": "0.703048", "text": "async function f() {\n return \"Hello\";\n}", "title": "" }, { "docid": "a9f4edd1f0ff1b4dabb43bf58865b80a", "score": "0.695396", "text": "async function f() {\n return 1;\n}", "title": "" }, { "docid": "39d4afb24c17401b1ee0eff875ed9456", "score": "0.66968995", "text": "async function f1() { \n}", "title": "" }, { "docid": "56a42b1f2e6d299be83163759da51cf6", "score": "0.6524068", "text": "function async(func, args)\n{\n func.apply(null, args);\n}", "title": "" }, { "docid": "db2accf6c6fb15fd7cb255b613e87b1f", "score": "0.6517757", "text": "function runPromise(f) {\n\t\tfor (var _len4 = arguments.length, args = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n\t\t\targs[_key4 - 1] = arguments[_key4];\n\t\t}\n\n\t\treturn runResolver(runPromise$1, f, this, args, new Future());\n\t}", "title": "" }, { "docid": "f27dab568e5372485886e9f60b1f76ba", "score": "0.6212781", "text": "function delay0(@f) {return function() { return function(){ return f(); };};}", "title": "" }, { "docid": "69a719766641e53f376144b508dae566", "score": "0.6186654", "text": "async function foo() {}", "title": "" }, { "docid": "73cdc2f92edbf2502d79c686c0532e5a", "score": "0.61380523", "text": "function f1() {\r\n return __awaiter(this, void 0, Promise, function* () {\r\n });\r\n}", "title": "" }, { "docid": "93704d817f336c8128681f236a4aa115", "score": "0.6079325", "text": "async function wrapper(fn) {\n return fn;\n}", "title": "" }, { "docid": "bc057144cf8cbbce15f913473ec0c55c", "score": "0.60507536", "text": "function f2() {\r\n return __awaiter(this, void 0, Promise, function* () {\r\n });\r\n}", "title": "" }, { "docid": "93bd36921b1164fd14583909f4a0b9ca", "score": "0.6047864", "text": "function asyncify(func) {\n return async function (...args) {\n return func(...args);\n };\n}", "title": "" }, { "docid": "5c2add19c9986fdb011d0a32184ff764", "score": "0.60454315", "text": "function runAsync(fn) {\n var deferred = q.defer();\n\n fn(deferred);\n return deferred.promise;\n}", "title": "" }, { "docid": "b335a7690ffe70e1ee9cd3539d7a3f1e", "score": "0.6002243", "text": "static method(f) {\r\n return function() {\r\n var self = this; // is this necessary?\r\n var args = Array.from(arguments);\r\n return new Promish(resolve => resolve(f.apply(self, args)));\r\n };\r\n }", "title": "" }, { "docid": "56439f62b1ef3ba29ff645c6ddb66276", "score": "0.600133", "text": "async function AsyncFunctionInstance() {}", "title": "" }, { "docid": "3ed2d65b953ef3797d2da8175e05282c", "score": "0.59670615", "text": "function async(fn, onError) {\n return function () {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n LocalPromise.resolve(true).then(function () {\n fn.apply(undefined, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "3ed2d65b953ef3797d2da8175e05282c", "score": "0.59670615", "text": "function async(fn, onError) {\n return function () {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n LocalPromise.resolve(true).then(function () {\n fn.apply(undefined, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "3ed2d65b953ef3797d2da8175e05282c", "score": "0.59670615", "text": "function async(fn, onError) {\n return function () {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n LocalPromise.resolve(true).then(function () {\n fn.apply(undefined, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "b72dea5bee8deafe3e26629f1979cffb", "score": "0.59525615", "text": "function f() {}", "title": "" }, { "docid": "b72dea5bee8deafe3e26629f1979cffb", "score": "0.59525615", "text": "function f() {}", "title": "" }, { "docid": "b72dea5bee8deafe3e26629f1979cffb", "score": "0.59525615", "text": "function f() {}", "title": "" }, { "docid": "b72dea5bee8deafe3e26629f1979cffb", "score": "0.59525615", "text": "function f() {}", "title": "" }, { "docid": "b72dea5bee8deafe3e26629f1979cffb", "score": "0.59525615", "text": "function f() {}", "title": "" }, { "docid": "b72dea5bee8deafe3e26629f1979cffb", "score": "0.59525615", "text": "function f() {}", "title": "" }, { "docid": "b72dea5bee8deafe3e26629f1979cffb", "score": "0.59525615", "text": "function f() {}", "title": "" }, { "docid": "b72dea5bee8deafe3e26629f1979cffb", "score": "0.59525615", "text": "function f() {}", "title": "" }, { "docid": "b72dea5bee8deafe3e26629f1979cffb", "score": "0.59525615", "text": "function f() {}", "title": "" }, { "docid": "b72dea5bee8deafe3e26629f1979cffb", "score": "0.59525615", "text": "function f() {}", "title": "" }, { "docid": "b72dea5bee8deafe3e26629f1979cffb", "score": "0.59525615", "text": "function f() {}", "title": "" }, { "docid": "cc255e9e55637cac48bdc2ee2832149d", "score": "0.59148514", "text": "function FiberFuture(fn, context, args) {\n\tthis.fn = fn;\n\tthis.context = context;\n\tthis.args = args;\n\tthis.started = false;\n\tvar that = this;\n\tprocess.nextTick(function() {\n\t\tif (!that.started) {\n\t\t\tthat.started = true;\n\t\t\tFiber(function() {\n\t\t\t\ttry {\n\t\t\t\t\tthat.return(fn.apply(context, args));\n\t\t\t\t} catch(e) {\n\t\t\t\t\tthat.throw(e);\n\t\t\t\t}\n\t\t\t}).run();\n\t\t}\n\t});\n}", "title": "" }, { "docid": "8a80834543cd08d999afcdad1b9ec85f", "score": "0.59144163", "text": "function get(f, future) {\n\tfuture.get(f);\n}", "title": "" }, { "docid": "eb1792b22739b6263f4616bda61b46d3", "score": "0.59087896", "text": "static promisify(f) {\r\n return function() {\r\n return Promish.apply(f, arguments);\r\n };\r\n }", "title": "" }, { "docid": "382912929800bd6822ca6b89a7b83be6", "score": "0.5907394", "text": "function async(fn, onError) {\r\n\t return function () {\r\n\t var args = [];\r\n\t for (var _i = 0; _i < arguments.length; _i++) {\r\n\t args[_i] = arguments[_i];\r\n\t }\r\n\t Promise.resolve(true)\r\n\t .then(function () {\r\n\t fn.apply(void 0, args);\r\n\t })\r\n\t .catch(function (error) {\r\n\t if (onError) {\r\n\t onError(error);\r\n\t }\r\n\t });\r\n\t };\r\n\t}", "title": "" }, { "docid": "3c33ea3e82299b17d7bf621b1ebcc0ca", "score": "0.59055424", "text": "async function exampleAsyncFunction() {\n return 'Foo'\n}", "title": "" }, { "docid": "7a7492ba86f41f9e5a984b0d5e7768cf", "score": "0.59032685", "text": "function asyncInputSig(f, def){\n\tvar init = true;\n\tvar sig = new SFN();\n\tsig.category = \"asyncinput\"\n\tsig.stepSample = function(n){ \n\t if(!init && nchange(n)) { n.nochange = true; return undefined; }\n\t else {\n\t\tinit = false;\n\t\tjQuery(document).ready(function(){ f(n) });\n\t\treturn true;\n\t }\n\t}\n\tif(def !== undefined) sig.value = Just(def); \n\treturn sig;\n }", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5895186", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5895186", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5895186", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5895186", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5895186", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5895186", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5895186", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5895186", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5895186", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5895186", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5895186", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5895186", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "438759d120871f1692e95d9bd7656495", "score": "0.58941543", "text": "function Ft(t,e,n,r){return new(n||(n=Promise))((function(o,a){function i(t){try{u(r.next(t))}catch(t){a(t)}}function c(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,c)}u((r=r.apply(t,e||[])).next())}))}", "title": "" }, { "docid": "d9012335957a2d8353bec8042af43901", "score": "0.5889917", "text": "async runFn(fn) {\n if (isCallbackFunction(fn)) {\n await getPromisify(fn)();\n } else if (isAsync(fn)) {\n await fn();\n } else {\n fn();\n }\n }", "title": "" }, { "docid": "4fb87331f2fd481a3f3ce36146033053", "score": "0.5880843", "text": "function Ft(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function u(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}c((r=r.apply(t,e||[])).next())}))}", "title": "" }, { "docid": "021445c3734e5898aaf3d4192aacd51a", "score": "0.5877167", "text": "function f_arg() {\n}", "title": "" }, { "docid": "65a8d9e21511d8ae0e8c7ed6880c0abf", "score": "0.5870655", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n\n Promise.resolve(true).then(function () {\n fn.apply(void 0, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "65a8d9e21511d8ae0e8c7ed6880c0abf", "score": "0.5870655", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n\n Promise.resolve(true).then(function () {\n fn.apply(void 0, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "bc709be5cac3dda37217281c9d5ff33b", "score": "0.58594596", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true).then(function () {\n fn.apply(void 0, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "600aea1bcf2bcc16b8f6d4f95726a923", "score": "0.5854508", "text": "function f() {\r\n setTimeout(() => {console.log(\"done!\")}, 1000);\r\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5848993", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5848993", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5848993", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5848993", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5848993", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5848993", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5848993", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5848993", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5848993", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5848993", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "82261a3720cfbc08f3d44eb27786bd6a", "score": "0.5847789", "text": "function fromNode(f) {\n\t\treturn function () {\n\t\t\tfor (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n\t\t\t\targs[_key2] = arguments[_key2];\n\t\t\t}\n\n\t\t\treturn runResolver(runNode$1, f, this, args, new Future());\n\t\t};\n\t}", "title": "" }, { "docid": "604dcbabb8a094c078912060ae9a57a5", "score": "0.58425635", "text": "function asyncTask(fn) {\n setTimeout(fn, 0);\n}", "title": "" }, { "docid": "aabd865689923d352d144961b698e9f2", "score": "0.58259135", "text": "function async(fn, onError) {\n return function() {\n var args = [];\n for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i];\n Promise.resolve(true).then(function() {\n fn.apply(void 0, args);\n }).catch(function(error) {\n if (onError) onError(error);\n });\n };\n}", "title": "" }, { "docid": "21da551dbf6659f08d493daee3bec085", "score": "0.58218217", "text": "function delay(@f) {return function(@a) { return function(){ return f(a); };};}", "title": "" }, { "docid": "8a53a749d8ce40d63c77df584f37383b", "score": "0.58157355", "text": "async function helloWorld() {\n return \"hello world\";\n}", "title": "" }, { "docid": "4608138376920995bd3ef21ec5cff7e9", "score": "0.5798709", "text": "function async(fn, onError) {\n\t return function () {\n\t var args = [];\n\t for (var _i = 0; _i < arguments.length; _i++) {\n\t args[_i] = arguments[_i];\n\t }\n\t Promise.resolve(true)\n\t .then(function () {\n\t fn.apply(void 0, args);\n\t })\n\t .catch(function (error) {\n\t if (onError) {\n\t onError(error);\n\t }\n\t });\n\t };\n\t}", "title": "" }, { "docid": "f74a877f8ac3e0bbe49341a5b8ddf06e", "score": "0.5797151", "text": "async function example1() {\r\n return 'Lalala';\r\n}", "title": "" }, { "docid": "b502f2c8c3f7ab397dc3d9e8f3430272", "score": "0.57743007", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n _promise.PromiseImpl.resolve(true).then(function () {\n fn.apply(void 0, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "b502f2c8c3f7ab397dc3d9e8f3430272", "score": "0.57743007", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n _promise.PromiseImpl.resolve(true).then(function () {\n fn.apply(void 0, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "8282cf677a472e58645ef7128d207d6c", "score": "0.57715315", "text": "function runNode(f) {\n\t\tfor (var _len3 = arguments.length, args = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n\t\t\targs[_key3 - 1] = arguments[_key3];\n\t\t}\n\n\t\treturn runResolver(runNode$1, f, this, args, new Future());\n\t}", "title": "" }, { "docid": "b12c8729e9ca67bc707fab985cccf0c3", "score": "0.57508475", "text": "async function myFn() {\n //await...\n}", "title": "" }, { "docid": "61f9d38820bf8b1712e881f0f2b47fe4", "score": "0.57441473", "text": "function async(fn, onError) {\n return function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function() {\n fn.apply(void 0, args);\n })\n .catch(function(error) {\n if (onError) {\n onError(error);\n }\n });\n };\n }", "title": "" }, { "docid": "23227e9db448bae9239f4870211dd19f", "score": "0.5743101", "text": "function f() { }", "title": "" }, { "docid": "3a592fd5dc34d8c5ce54b08f3034e66e", "score": "0.57385474", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n }", "title": "" }, { "docid": "397e3051160aa51a2cae796e903a9897", "score": "0.5720132", "text": "function Async() {}", "title": "" }, { "docid": "afd14d330ff77aa4ae179e217c49714d", "score": "0.57103187", "text": "async function af1()\n{\n console.log(\"1. executing async af1 function body\");\n return \"hello\"\n}", "title": "" }, { "docid": "b0ae421366fe032dbff5a96084ceb262", "score": "0.56996214", "text": "async function a(e,t,r,a,c,l){var u;let h,d=!1,p=1e3,f=0;const g=i.S.now();let m,v;do{try{h=await e(),void 0!==v&&r(v),d=!0}catch(e){if(void 0!==l){const t=l();if(!1===t.retry){if(void 0!==t.error)throw t.error;throw e}}if(!(0,o.ms)(e))throw c.sendErrorEvent({eventName:t,retry:f,duration:i.S.now()-g},e),e;f++,m=e,p=null!==(u=(0,o.ZZ)(e))&&void 0!==u?u:Math.min(2*p,8e3),void 0===v&&(v=(0,n.Z)()),a(v,p,e),await(0,s.g)(p)}}while(!d);return f>0&&c.sendTelemetryEvent({eventName:t,retry:f,duration:i.S.now()-g},m),h}", "title": "" }, { "docid": "a4ff4ef42867cda8571b8aa35dfa99d7", "score": "0.56649387", "text": "function makeAsync(func) {\n return function () {\n const that = this\n const args = arguments\n return new Promise((resolve, reject) => {\n try {\n resolve(func.apply(that, args))\n } catch (e) {\n reject(e)\n }\n })\n }\n}", "title": "" }, { "docid": "4302e072edf237fb31f150ab2b58b15c", "score": "0.5656868", "text": "function doFunction(f){\r\n\tf();\r\n}", "title": "" }, { "docid": "cf35a30634234469e50a952242a0ebb3", "score": "0.5656054", "text": "function toAsync(fn, d) {\n return (x) => {\n return new Promise((resolve) => {\n setTimeout(() => {\n return resolve(x);\n }, (typeof d === 'function' ? d() : d));\n }).then(fn);\n };\n}", "title": "" }, { "docid": "f5c2fb7f2294ffdbb6b44a3c1754bf1a", "score": "0.56513983", "text": "function future() {\n console.log(\"there will never be flying cars\");\n}", "title": "" }, { "docid": "20c62db515d8db9cc5316218bc078773", "score": "0.5649271", "text": "modFunction(fn, delay, timer, resolve, reject) {\r\n return async() => {\r\n const runFunction = new Promise(res => {\r\n timeout(fn, delay).then(res)\r\n\r\n // Purge function if it doesn't resolve in time\r\n setTimeout(() => {\r\n const err = `Queued function timed out! (${fn.name || 'anonymous'})`\r\n this.throwOnTimeout ? reject(err) : 0\r\n res(err)\r\n }, timer)\r\n })\r\n\r\n const data = await runFunction\r\n\r\n // Trigger next function if available\r\n this.stack.shift()\r\n if (this.stack[0]) {\r\n this.executing = true\r\n resolve(data)\r\n this.stack[0]()\r\n } else {\r\n this.executing = false\r\n resolve(data)\r\n }\r\n }\r\n }", "title": "" }, { "docid": "70e202df4753be97a8e5da0cf2f17379", "score": "0.56492287", "text": "function asynchronously(fun) {\n setTimeout(fun, 1);\n }", "title": "" }, { "docid": "167e1ed45911ae43bb28a51a2c273c55", "score": "0.5642401", "text": "function invokeMe(f) {\n f();\n}", "title": "" }, { "docid": "0cb399d6246657d7152f8156ef76a394", "score": "0.56322145", "text": "async function func() {\n return \"Hello\"\n }", "title": "" }, { "docid": "a2e596171a752a52f3de57c15d3ffae4", "score": "0.56191933", "text": "function create(f) {\n\tvar pending = new Future();\n\n\ttry {\n\t\tf(set, err);\n\t} catch(e) {\n\t\terr(e);\n\t}\n\n\tfunction set(x) { become(new Fulfilled(now(), x), pending); }\n\tfunction err(x) { become(new Failed(now(), x), pending); }\n\n\treturn pending;\n}", "title": "" }, { "docid": "acea5f4156b12bd5a6dd108a486beaad", "score": "0.5618393", "text": "run(args, intermediateFunc, transferList) {\n\n this.cancel();\n if (!this.ready) {\n\n // queue up the first run if we're not quite ready yet\n this._lateRun = () => {\n\n this._worker.postMessage({ args, transferList }, transferList);\n delete this._lateRun;\n\n };\n\n } else {\n\n this._worker.postMessage({ args, transferList }, transferList);\n\n }\n\n return new Promise((resolve, reject) => {\n\n this._process = { resolve, reject, intermediateFunc };\n\n });\n\n }", "title": "" } ]
67441737da6966ab0fe9be20909e9e29
Function to validate the reservation
[ { "docid": "b94ee78e02919df6f8573606550a45f5", "score": "0.6764443", "text": "async function validateReservation(req, res, next) {\n if (!req.body.data)\n return next({ status: 400, message: \"Data Missing!\" });\n const {\n first_name,\n last_name,\n mobile_number,\n people,\n reservation_date,\n reservation_time,\n status,\n } = req.body.data;\n\n let updatedStatus = status;\n\n if (\n !first_name ||\n !last_name ||\n !mobile_number ||\n !people ||\n !reservation_date ||\n !reservation_time\n )\n return next({\n status: 400,\n message:\n \"Please complete the following: first_name, last_name, mobile_number, people, reservation_date, and reservation_time.\",\n });\n\n if (!reservation_date.match(/\\d{4}-\\d{2}-\\d{2}/))\n return next({ status: 400, message: \"reservation_date is invalid!\" });\n\n if (!reservation_time.match(/\\d{2}:\\d{2}/))\n return next({ status: 400, message: \"reservation_time is invalid!\" });\n\n if (typeof people !== \"number\")\n return next({ status: 400, message: \"people is not a number!\" });\n\n if (!status) updatedStatus = \"booked\";\n\n if (status === \"seated\")\n return next({ status: 400, message: \"reservation is already seated\" });\n\n if (status === \"finished\")\n return next({ status: 400, message: \"reservation is already finished\" });\n\n res.locals.newReservation = {\n first_name,\n last_name,\n mobile_number,\n people,\n reservation_date,\n reservation_time,\n status: updatedStatus,\n };\n\n next();\n}", "title": "" } ]
[ { "docid": "7f8d9e490f78e7d91eb7185c51202108", "score": "0.6970054", "text": "function checkReservation(evt) {\r\n\r\n let check = false;\r\n let name = document.getElementById('underName');\r\n let email = document.getElementById('email')\r\n let phone = document.getElementById('phone')\r\n let adultGuests = document.getElementById('adultGuests');\r\n let kidGuests = document.getElementById('kidGuests');\r\n let info = [name,\r\n\t\t\t\temail,\r\n\t\t\t\tphone,\r\n\t\t\t\tadultGuests,\r\n\t\t\t\tkidGuests\r\n\t\t\t ]\r\n\r\n clearWarnings()\r\n check = checkGuestsCount()\r\n for (i = 0; i < info.length; i++) {\r\n check = checkInfo(info[i]);\r\n }\r\n\r\n if (check === true) {\r\n confirmReservation()\r\n } else {\r\n evt.preventDefault();\r\n }\r\n}", "title": "" }, { "docid": "c8bae4ed624555868f9f804cba09811d", "score": "0.67375547", "text": "function seatingInputIsValid(req, res, next) {\n if (!req.body.data.reservation_id) {\n const error = new Error(\"A reservation_id is required\");\n error.status = 400;\n return next(error);\n }\n next();\n}", "title": "" }, { "docid": "35cdee113c660503575fbeeb0e7c66d9", "score": "0.6695472", "text": "function validateDate(){\n\tvar startDate\t= $(\"#confirm_test\").val();\n\tvar startTime\t= $(\"#confirm_test1\").val();\n\tvar endTime\t\t= $(\"#confirm_test3\").val();\n\tvar endDate\t\t= $(\"#confirm_test2\").val();\n\tvar sDate = new Array();\n\t\tsDate = startDate.split(\"/\");\n\tvar sTime = new Array();\n\t\tsTime = startTime.split(\":\");\n\tvar eDate = new Array();\n\t\teDate = endDate.split(\"/\");\n\tvar eTime = new Array();\n\t\teTime = endTime.split(\":\");\n\n\n\n\tvar EndStart = DateChecker( eDate[2] , eDate[0] , eDate[1] , eTime[0] , eTime[1] , eTime[2] , sDate[2] , sDate[0] , sDate[1] , sTime[0] , sTime[1] , sTime[2], 1 );\n\tif ( EndStart == 0 ) {\n\t\talert( \"Reservation end time cannot be less than reservation start time.\" );\n//\t\toutOfFocus();\t\n\t\treturn 1;\n\t} else if ( EndStart == 2 ) {\n\t\talert( \"Reservation end time cannot be equal to reservation start time.\" );\n//\t\toutOfFocus();\t\n\t\treturn 1;\n\t} else if ( EndStart == 3 ) {\n\t\talert( \"Minimum reservation time is 10 minutes. Please adjust time of reservation.\" );\n//\t\toutOfFocus();\t\n\t\treturn 1;\n\t} \n\n/*\telse {\n\t\t\t\n\t\tvar StartServer = DateChecker( sDate[2] , sDate[0] , sDate[1] , sTime[0] , sTime[1] , sTime[2] , serverYear , serverMonth , serverDay , serverHour , serverMinute , serverSecond, 0 );\n\t\tif ( StartServer != 1 && StartServer != 5 ) {\n\t\t\tvar todo1 = '';\n\t\t\t\ttodo1 += 'refreshStartTime(\"'+eDate[2]+'\",\"'+eDate[0]+'\",\"'+eDate[1]+'\",\"'+eTime[0]+'\",\"'+eTime[1]+'\",\"'+eTime[2]+'\",\"'+fromWhere+'\");';\n\n\t\t\t//alerts( \"Reservation time has already lapsed. Do you want to use the current time as the start time?\", todo1, \"prompt\" );\n\t\t\tdisplayWarning2( \"Reservation time has already lapsed. Do you want to use the current time as the start time?\", todo1);\n\t\t\treturn 1;\n\t\t} else if ( StartServer == 5) {\n\t\t\t//refreshStartTime(eDate[2],eDate[0],eDate[1],eTime[0],eTime[1],eTime[2],fromWhere);\n\t\t\t//return 1;\n\t\t }\n\n\t}\n\n*/\n\n\n}", "title": "" }, { "docid": "2d6e92ce718c2fa670368d7b47548f49", "score": "0.66024387", "text": "function ValidateReservationDates(checkin, checkout,mode) {\n var formatDate='', selectedDate='';\n var dateFrom ,dateTo;\n\n if(mode=='createTrip'){\n dateFrom= checkin;\n dateTo=checkout;\n }\n else {\n dateFrom= jQuery(checkin).val();\n dateTo=jQuery(checkout).val();\n }\n formatDate = dateFrom.replace(/-/g, '/');\n selectedDate = new Date(formatDate);\n dateFrom = new Date(selectedDate.getTime());\n\n formatDate = dateTo.replace(/-/g, '/');\n selectedDate = new Date(formatDate);\n dateTo = new Date(selectedDate.getTime());\n \n if(mode=='createTrip'){\n return (dateFrom && dateTo && dateFrom > dateTo)? false: true;\n }\n else {\n return (dateFrom && dateTo && dateFrom >= dateTo)? false: true; \n }\n \n}", "title": "" }, { "docid": "a3d5c425f29a57ed14d292a1898b8cdb", "score": "0.6488646", "text": "async validateBooking(bookingInfo, room) {\n bookingInfo.startTime = date_utils_1.stringToDate(bookingInfo.startTime);\n bookingInfo.endTime = new Date(bookingInfo.startTime.getTime() + bookingInfo.duration * 3600 * 1000);\n // check time\n // if (\n // bookingInfo.startTime < Date.now() ||\n // bookingInfo.startTime > bookingInfo.endTime\n // ) {\n // throw new HttpErrors.BadRequest('Invalid timestamps');\n // }\n // check room's capacity\n const timeFilter = constants_1.filterTimeBooking(bookingInfo.startTime, bookingInfo.endTime);\n const listBookingInTime = await this.find({\n where: timeFilter,\n });\n // console.log(bookingInfo.startTime);\n // console.log(bookingInfo.endTime);\n // console.log(listBookingInTime.length);\n if (listBookingInTime && listBookingInTime.length !== 0) {\n // Kiểm tra nếu như có người đã đặt phòng trong khoảng thời gian muốn.\n for (let booking of listBookingInTime) {\n if (booking.status === constants_1.BookingConstant.FINISH ||\n booking.status === constants_1.BookingConstant.CANCELED)\n continue;\n if (booking.numPerson + bookingInfo.numPerson >\n room.maxPerson) {\n throw new rest_1.HttpErrors.BadRequest(\"Not enough capacity.\");\n }\n }\n }\n else {\n // Nếu phòng trống, ktra số lượng người cho phép thuê\n if (bookingInfo.numPerson > room.maxPerson) {\n throw new rest_1.HttpErrors.BadRequest(\"Not enough capacity.\");\n }\n }\n // console.log(new Date(bookingInfo.startTime.toISOString()));\n return Object.assign({}, bookingInfo, {});\n }", "title": "" }, { "docid": "dea1cab7873a3a341b9acd374fdb0087", "score": "0.644131", "text": "function dateIsValid(req, res, next) {\n const { reservation_date } = req.body.data;\n const date = Date.parse(reservation_date);\n if (date && date > 0) {\n return next();\n } else {\n return next({\n status: 400,\n message: `reservation_date field formatted incorrectly: ${reservation_date}.`,\n });\n }\n}", "title": "" }, { "docid": "8b5e94890ed84b29274d8fba79954d76", "score": "0.64159274", "text": "function validateReservationInfo(form_specs) {\n var isValidReservation = true;\n var reservationInfo = {};\n \n for (var si in form_specs.sections) {\n for (var fi in form_specs.sections[si].fields) {\n var field = form_specs.sections[si].fields[fi];\n var $errorInfo = $('#reservation-form-container ' + '#' + field.id + '-container .error-info');\n \n var value = $('#reservation-form-container ' + '#' + field.id + '-container ' + '#' + field.id).val();\n reservationInfo[field.id] = value;\n \n if (field.required && field.validate) {\n var isValid = validate[field.validate];\n if (isValid(value)) {\n $errorInfo.hide();\n }\n else {\n isValidReservation = false;\n $errorInfo.show();\n }\n }\n }\n }\n \n return {isValid: isValidReservation, info: reservationInfo};\n}", "title": "" }, { "docid": "f7662998579e6fb06fe44457081ecaed", "score": "0.6346189", "text": "function validateProperties(req, res, next) {\n let date = req.body.data.reservation_date\n //function to see if the value is a date\n const isDate = (value) => {\n return (new Date(value) !== \"invalid Date\" && !isNaN(new Date(value)))\n } \n\n let time = req.body.data.reservation_time\n if(!time) {\n return next({\n status: 400,\n message: `reservation_time`\n })\n }\n let timeArray = time.split(':')\n let people = req.body.data.people\n\n //the reservation date is a date\n if(!isDate(date)){\n return next({\n status: 400,\n message: `reservation_date`\n })\n }\n //the inputted date object\n let dateObject = new Date(date)\n //todays date\n let today = new Date()\n //todays date object formatted\n let todayDateObject = today.getFullYear() + '-' + (today.getMonth()+1) + '-' + today.getDay()\n //finds what today is in a numeric form, mon = 0, tues = 1, wed =2 \n let numberDate = dateObject.getDay()\n \n //if today is tuesday were closed\n if(numberDate == 1){\n return next({\n status: 400,\n message: `closed`\n })\n }\n //if the date inputted is in the past\n if(dateObject < new Date()){\n return next({\n status: 400,\n message: `the reservation must be in the future`\n })\n }\n\n //checks if reservations time is a time\n if(timeArray.length < 2){\n return next({\n status: 400,\n message: `reservation_time must be a time`\n })\n }\n //checks if people is a number\n if(typeof people != 'number' || people === 0){\n return next({\n status: 400,\n message: `people must be a number greater than 0`\n })\n }\n\n //checks if time is available \n let hours = Number(timeArray[0])\n let minutes = Number(timeArray[1])\n if(hours <= 10){\n if(hours == 10 && minutes < 30){\n return next({\n status: 400,\n message: `the reservation is too early`\n })\n }\n if(hours < 10){\n return next({\n status: 400,\n message: `the reservation is too early`\n })\n }\n }\n\n if(hours >= 21){\n if(hours == 21 && minutes > 30){\n return next({\n status: 400,\n message: `the reservation is too late`\n })\n }\n if(hours > 21) {\n return next({\n status: 400,\n message: `the reservation is too late`\n })\n }\n }\n\n \n //if every type is valid continue down the list\n next()\n}", "title": "" }, { "docid": "0cc9ea0edc0847997c1da2dd772ae90b", "score": "0.62359923", "text": "function reservation(){\n\tconsole.log(__filename);\n\tvar oReservation = new Object;\n\toReservation.table_cross_checked = false;\n\t\n\toReservation.table_name = 'reservation';\n\toReservation.table_cols = ['rId','userId','pId','status','applyTime','trueName','phone'];\n\toReservation.condition_range = [];\n\n\toReservation.table_cross_fkey = ['pId','userId'];\t\n\toReservation.table_cross_name = ['pkproject','pkuser'];\t\n\toReservation.table_cross_cols = [['pId','pName','minSquare','maxSquare','minPrice','maxPrice',\n\t\t\t\t\t\t\t\t\t {fkey:'countryId', table: 'area', cols: ['addrId', 'name']},\n\t\t\t\t\t\t\t\t\t {fkey:'cityId', table: 'area', cols: ['addrId', 'name']},\n\t\t\t\t\t\t\t\t\t 'thumbnail'],\n\t\t\t\t\t\t\t\t\t ['userId','nickName','avatarUrl']\n\t];\t\n\toReservation.table_cross_column_as = []; \t\n\t\n\toReservation.check_table_cross = check_table_cross;\n\n if(!oReservation.table_cross_checked){\n\t\toReservation.check_table_cross();\n } \n\treturn oReservation;\n}", "title": "" }, { "docid": "a3e49bb4ba36ced7bd72e4a5f1b61dfe", "score": "0.6179005", "text": "function isEditReservation() {\n if (reservation != null) {\n if (reservation.users_id == userId.val() && reservation.movies_id == moviesDropDown.val() && reservation.reservation_date == reservationDateDropDown.val()) {\n return true;\n }\n }\n\n return false;\n}", "title": "" }, { "docid": "7b532a77ee18bd314fcb17d6530cddee", "score": "0.6145259", "text": "function verification(){\n var firstDat = new Date(document.getElementById('date1').value);\n var lastDat = new Date(document.getElementById('date2').value);\n \n var periode = (lastDat - firstDat) / (3600*1000*24);\n if(periode<1){\n alert(\"verifie la duree de reservation\");\n return false;\n }\n else{\n return true;\n }\n\n}", "title": "" }, { "docid": "652127024ae4a3387f03c352a2071525", "score": "0.6081216", "text": "function validate() {\r\n isValid = true; // Default value is set to true\r\n isValid1 = true;\r\n isValid2 = true;\r\n isValid3 = true;\r\n isValid4 = true;\r\n\r\n if (document.getElementById(\"reg\").value == \"\") { // Checks that value has data, otherwise set variable to false\r\n isValid1 = false;\r\n document.getElementById(\"regValidationError\").classList.remove(\"hide\");\r\n } else { // If Value is valid, hide error message\r\n isValid1 = true;\r\n if (!document.getElementById(\"regValidationError\").classList.contains(\"hide\"))\r\n document.getElementById(\"regValidationError\").classList.add(\"hide\");\r\n }\r\n\r\n var curRange = document.getElementById(\"curRange\").value;\r\n var maxMile = 250;\r\n if(isNaN(curRange) || curRange == \"\") { // Checks that value is numbers only\r\n isValid2 = false;\r\n document.getElementById(\"curRangeValidationError\").classList.remove(\"hide\");\r\n } else if (curRange > maxMile) {\r\n isValid2 = false;\r\n document.getElementById(\"curRangeValidationError\").classList.remove(\"hide\");\r\n } else { // If Value is valid, hide error message\r\n isValid2 = true;\r\n if (!document.getElementById(\"curRangeValidationError\").classList.contains(\"hide\"))\r\n document.getElementById(\"curRangeValidationError\").classList.add(\"hide\");\r\n }\r\n\r\n var destRange = document.getElementById(\"desMile\").value;\r\n if(isNaN(destRange) || destRange == \"\") { // Checks that value is numbers only\r\n isValid3 = false;\r\n document.getElementById(\"destValidationError\").classList.remove(\"hide\");\r\n } else if (destRange > maxMile) {\r\n isValid3 = false;\r\n document.getElementById(\"destValidationError\").classList.remove(\"hide\");\r\n } else { // If Value is valid, hide error message\r\n isValid3 = true;\r\n if (!document.getElementById(\"destValidationError\").classList.contains(\"hide\"))\r\n document.getElementById(\"destValidationError\").classList.add(\"hide\");\r\n }\r\n\r\n /*============== Checks Time Schedule ============*/\r\n var inputEle = document.getElementById('leaTime');\r\n\r\n var timeSplit = inputEle.value.split(':'), hours, minutes, meridian;\r\n hours = timeSplit[0];\r\n minutes = timeSplit[1];\r\n if (hours > 12) {\r\n meridian = 'PM';\r\n hours -= 12;\r\n } else if (hours < 12) {\r\n meridian = 'AM';\r\n if (hours == 0) {\r\n hours = 12;\r\n }\r\n } else {\r\n meridian = 'PM';\r\n }\r\n console.log(hours + ':' + minutes + ' ' + meridian);\r\n\r\n if(hours >= 12 && meridian == \"PM\" ) {\r\n isValid4 = false;\r\n document.getElementById(\"timeValidationError\").classList.remove(\"hide\");\r\n } else {\r\n isValid4 = true;\r\n if(!document.getElementById(\"timeValidationError\").classList.contains(\"hide\"))\r\n document.getElementById(\"timeValidationError\").classList.add(\"hide\");\r\n }\r\n\r\n /*================================================*/\r\n\r\n /*================= Final Results ================*/\r\n if(isValid1 == false || isValid2 == false || isValid3 == false || isValid4 == false) {\r\n isValid = False;\r\n } else {\r\n isValid = true;\r\n }\r\n /*================================================*/\r\n return isValid;\r\n}", "title": "" }, { "docid": "a452c9f4bcd4c76ea5d3688ee5f1479a", "score": "0.60682464", "text": "async function validateToSeatTable(req, res, next) {\n let table = res.locals.table;\n if (!req.body.data || !req.body.data.reservation_id) {\n return next({\n status: 400,\n message: `No reservation_id/data`,\n });\n }\n const reservationId = await reservationsService.read(\n req.body.data.reservation_id\n );\n\n if (!reservationId) {\n return next({\n status: 404,\n message: `Reservation ${req.body.data.reservation_id} does not exist`,\n });\n }\n\n if (table.reservation_id) {\n return next({\n status: 400,\n message: `Table occupied`,\n });\n }\n if (reservationId.people > table.capacity) {\n return next({\n status: 400,\n message: `Table does not have sufficient capacity`,\n });\n }\n if (reservationId.status === \"seated\") {\n return next({\n status: 400,\n message: `reservation is already seated`,\n });\n }\n next();\n}", "title": "" }, { "docid": "6a87f4999f351bfe7729aa17b860838b", "score": "0.6067912", "text": "function validar(movimiento) {\n \n\n if (movimiento.moneda_from === movimiento.moneda_to){\n alert (\"Los Symbol no pueden tener el mismo valor\")\n return false\n }\n \n if ( movimiento.moneda_from !== \"EUR\" && movimiento.cantidad_from > saldoCriptomonedas[movimiento.moneda_from]) {\n alert (\"la cantidad no puede superar el saldo actual\")\n return false\n }\n\n if (movimiento.cantidad_from === \"0\") {\n alert(\"Indique Cantidad para symbol deseado\")\n return false\n }\n \n \n \n if (movimiento.cantidad_to === \"0\") {\n alert(\"Debe solicitar valor\")\n return false\n }\n\n //if (!movimiento.esGasto && movimiento.categoria) {\n // alert(\"Un ingreso no puede tener categoria\")\n // return false\n //}\n\n //if (movimiento.cantidad <=0) {\n // alert (\"la cantidad ha de ser positiva\")\n // return false\n //}\n\n return true\n}", "title": "" }, { "docid": "aa02dac7f6cf7db0ec3fd96d23b0f411", "score": "0.60030097", "text": "function checkValidateReservation(){\n\t\n\t$.ajax({\n\t\t\n\t\ttype : \"POST\",\n\t\turl : serverPath + \"products/checkValidateReservation\",\n\t\tdataType : \"text\",\n\t\tsuccess : function(data, status, e){\n\t\t\t\n\t\t\talert(\"successful\");\n\t\t},\n\t\terror : function(e){\n\t\t\t\n\t\t\talert(\"NOT successful\");\n\t\t}\n\t});\n}", "title": "" }, { "docid": "a71669fc8b6fad8163e03e07fc544877", "score": "0.5989571", "text": "checkSchedule1DocValidity() {\n //Set Schedulec Doc complete based on Line12 entered & (Shcedule c enter value)\n if (this.scheduleCList.length.size === 0) {\n this.objInputFields.bScheduleCDocComplete = false;\n this.objInputFields.dLine12Adjusted = 0;\n\n } else if (!this.bLine3Disabled) {\n //value is entered in Line12 ShceduleC and check with Line 12 entered value & ShceduleC Line3\n this.objInputFields.dLine12Adjusted = this.dLine3Total;\n if (this.objInputFields.dLine12 === this.dLine3Total) {\n this.objInputFields.bScheduleCDocComplete = true;\n } else {\n this.objInputFields.bScheduleCDocComplete = false;;\n }\n } else if (!this.bLine29_31Disabled) {\n //value is entered in Line29/31 ShceduleC and check with Line 12 entered value & ShceduleC Line31\n this.objInputFields.dLine12Adjusted = this.dLine29Total;\n if (this.objInputFields.dLine12 === this.dLine31Total) {\n this.objInputFields.bScheduleCDocComplete = true;\n } else {\n this.objInputFields.bScheduleCDocComplete = false;;\n }\n }\n }", "title": "" }, { "docid": "f5ae80b7de4e6e2b9354e4ed84a6d4e9", "score": "0.59807193", "text": "function timeIsValid(req, res, next) {\n const { reservation_time } = req.body.data;\n const regex = new RegExp(\"([01]?[0-9]|2[0-3]):[0-5][0-9]\");\n if (regex.test(reservation_time)) {\n return next();\n } else {\n return next({\n status: 400, \n message: `reservation_time field formatted incorrectly: ${reservation_time}`,\n });\n }\n}", "title": "" }, { "docid": "18a50b22d0b96be234eadd600fc59196", "score": "0.597249", "text": "function validateAddVenue() {\n if ($scope.venue.title == undefined || $scope.venue.title == \"\") {\n toaster.pop(\"error\", \"Error\", \"Please enter title\");\n return false;\n }\n if ($scope.venue.boxOfficePhone == undefined || $scope.venue.boxOfficePhone == \"\") {\n toaster.pop(\"error\", \"Error\", \"Please enter phone number of Box office\");\n return false;\n }\n\n if ($scope.venue.boxOfficeWorkingHours == undefined || $scope.venue.boxOfficeWorkingHours == \"\") {\n toaster.pop(\"error\", \"Error\", \"Please enter working office of Box office\");\n return false;\n }\n if ($scope.venue.info == undefined || $scope.venue.info == \"\") {\n toaster.pop(\"error\", \"Error\", \"Please enter info\");\n return false;\n }\n if ($scope.venue.city == undefined || $scope.venue.city == \"\") {\n toaster.pop(\"error\", \"Error\", \"Please select city\");\n return false;\n }\n\n if ($scope.venue.address == undefined || $scope.venue.address == \"\") {\n toaster.pop(\"error\", \"Error\", \"Please enter address\");\n return false;\n }\n if ($scope.venue.zip == undefined || $scope.venue.zip == \"\") {\n toaster.pop(\"error\", \"Error\", \"Please enter zip\");\n return false;\n }\n if (!$scope.isNumber($scope.venue.zip)) {\n toaster.pop(\"error\", \"Error\", \"Please enter valid zip\");\n return false;\n }\n if ($scope.venue.description == undefined || $scope.venue.description == \"\") {\n toaster.pop(\"error\", \"Error\", \"Please enter description\");\n return false;\n }\n if ($scope.venue.directions == undefined || $scope.venue.directions == \"\") {\n toaster.pop(\"error\", \"Error\", \"Please enter directions\");\n return false;\n }\n if ($scope.venue.termsAndRules == undefined || $scope.venue.termsAndRules == \"\") {\n toaster.pop(\"error\", \"Error\", \"Please enter terms and rules\");\n return false;\n }\n if ($scope.venue.typeOfPayments.length == undefined || $scope.venue.typeOfPayments.length == 0) {\n toaster.pop(\"error\", \"Error\", \"Please select atlest one type of payment mode\");\n return false;\n }\n\n if($scope.venue.bannerImage == undefined || $scope.venue.bannerImage == \"\"){\n toaster.pop('error', \"Error\", \"Please add banner image.\");\n return false;\n }\n\n if($scope.venue.featureImage == undefined || $scope.venue.featureImage == \"\"){\n toaster.pop('error', \"Error\", \"Please add feature image.\");\n return false;\n }\n\n if($scope.venue.sittingChartImage == undefined || $scope.venue.sittingChartImage == \"\"){\n toaster.pop('error', \"Error\", \"Please add sitting chart image.\");\n return false;\n }\n return true;\n }", "title": "" }, { "docid": "705bd27e095c5373624b95f49abd6b89", "score": "0.59659725", "text": "function validateInputsBooking(container, form) {\n var isDatesValid = false;\n var isRoomValid = false;\n\n // Inputs\n var roomDropDown = container.find(\"[name=RoomID]\");\n var startDateInput = null;\n var endDateInput = null;\n\n if(container.attr(\"id\") === \"popup\") { // 'popup' is editDiv\n startDateInput = container.find(\"#editstartDateInput\");\n endDateInput = container.find(\"#editendDateInput\");\n\n }\n else {\n startDateInput = container.find(\"#startDateInput\");\n endDateInput = container.find(\"#endDateInput\");\n }\n\n // Values\n var startDateString = startDateInput.val();\n var endDateString = endDateInput.val();\n var selectedRoom = roomDropDown.val();\n\n // Validating dates\n // Check for empty field.\n if(startDateString.length < 10 && endDateString.length < 10) {\n startDateInput.css(\"background-color\", badColor);\n endDateInput.css(\"background-color\", badColor);\n showError(\"Du må sette data i begge datofeltene!\");\n }\n else {\n isDatesValid = true;\n startDateInput.css(\"background-color\", goodColor);\n endDateInput.css(\"background-color\", goodColor);\n }\n\n if(startDateString.length < 10) {\n startDateInput.css(\"background-color\", badColor);\n showError(\"Du må velge en start-dato!\");\n }\n else {\n startDateInput.css(\"background-color\", goodColor);\n }\n\n if(endDateString.length < 10) {\n endDateInput.css(\"background-color\", badColor);\n showError(\"Du må velge en slutt-dato!\")\n }\n else {\n endDateInput.css(\"background-color\", goodColor);\n }\n\n // Validating room\n // Rooms are valid no matter what\n roomDropDown.css(\"background-color\", goodColor);\n isRoomValid = true;\n\n // IF ALL INPUTS ARE VALID HERE, DO FINAL DATE CHECK.\n if(isDatesValid && isRoomValid) {\n validateInputsBookingAjaxCheckDates(startDateString, endDateString, form, startDateInput, endDateInput);\n }\n }", "title": "" }, { "docid": "0ed83904e5d31b8f75f8ceea0bfc4b9a", "score": "0.5956065", "text": "function verifyForm(data) {\n if(!$scope.startdate.getdate()) {\n throw {message: \"開始日期沒有填寫\"};\n }\n if(!$scope.enddate.getdate()) {\n throw {message: \"結束日期沒有填寫\"};\n }\n if( $scope.startdate.getdate() == $scope.enddate.getdate() ){\n throw {message: \"開始時間與結束時間相等\"};\n }\n }", "title": "" }, { "docid": "e472f88ab4388f9a883095376248a3f7", "score": "0.5949325", "text": "function validateCarEnteries(){\n\tvar year = document.getElementById(\"selectID_1_1\");\n\tvar make = document.getElementById(\"selectID_1_2\");\n\tvar model = document.getElementById(\"selectID_1_3\");\n\tvar version = document.getElementById(\"selectID_1_4\");\n\tvar variant = document.getElementById(\"selectID_1_5\");\n\tvar fuel = document.getElementById(\"selectID_1_6\");\n\tif(year.value !=0 && make.value !=0 && model.value !=0 && version.value !=0 && variant.value !=0 && fuel.value !=0){\n\t\treturn true;\n\t}else{\n\t\treturn false;\n\t}\n}", "title": "" }, { "docid": "e7eab61a3fc33e3c4f55ddcf994a0289", "score": "0.59409666", "text": "validateFields() {\n const firstName = document.querySelector(`#${this.firstNameFieldID}`);\n const lastName = document.querySelector(`#${this.lastNameFieldID}`);\n const dayPrice = document.querySelector(`#${this.dayPriceFieldID}`);\n const startDate = document.querySelector(`#${this.startDateFieldID}`);\n const endDate = document.querySelector(`#${this.endDateFieldID}`);\n\n validate(firstName, /^[a-zA-Z][^\\s]*[\\s|a-zA-Z]*?$/);\n validate(lastName, /^[a-zA-Z][^\\s]*[\\s|a-zA-Z]*?$/);\n validate(dayPrice, /^[0-9][^\\s]*$/);\n validate(startDate, /^[0-9]{4}-[0-9]{2}-[0-9]{2}/);\n validate(endDate, /^[0-9]{4}-[0-9]{2}-[0-9]{2}/);\n }", "title": "" }, { "docid": "f33dcff5a2dbdd38a1dc4e870ac32e77", "score": "0.59072393", "text": "function validateQuoteParams(slots) {\n const frequency = slots.frequency;\n const region = slots.region;\n const travelStartDate = slots.travelStartDate;\n const travelEndDate = slots.travelEndDate;\n const insuredCount = slots.insuredCount;\n const driverAge = slots.DriverAge;\n const discountType = slots.discountType;\n const coverageType = slots.coverageType;\n var suggestedRegion;\n\n\n const europeanCountries = ['russia', 'germany', 'u.k.', 'france', 'italy', 'spain', 'ukraine', 'poland',\n 'romania', 'netherlands', 'belgium', 'greece', 'czech republic', 'portugal',\n 'sweden', 'hungary', 'belarus', 'austria', 'serbia', 'switzerland', 'bulgaria',\n 'denmark', 'finland', 'slovakia', 'norway', 'ireland', 'croatia', 'moldova',\n 'bosnia & herzegovina', 'albania', 'lithuania', 'tfyr macedonia', 'slovenia',\n 'latvia', 'estonia', 'montenegro', 'luxembourg', 'malta', 'iceland', 'andorra',\n 'monaco', 'liechtenstein', 'san marino', 'holy see'];\n\n\n // select the region based on the country listed\n if (region) {\n if (region.toLowerCase != 'europe' || region.toLowerCase != 'world') {\n if (europeanCountries.indexOf(region.toLowerCase()) > -1) {\n suggestedRegion = 'europe'\n } else {\n suggestedRegion = 'world'\n }\n }\n }\n\n if (travelStartDate) {\n if (!isValidDate(travelStartDate)) {\n return buildValidationResult(false, 'travelStartDate', 'I did not understand your departure date. When are you planning to travel?');\n }\n if (new Date(travelStartDate) < new Date()) {\n return buildValidationResult(false, 'travelStartDate', 'Your travel date is in the past! Can you try a different date?');\n }\n }\n\n if (travelEndDate) {\n if (!isValidDate(travelEndDate)) {\n return buildValidationResult(false, 'travelEndDate', 'I did not understand your return date. When are you planning to return?');\n }\n }\n\n\n if (travelStartDate && travelEndDate) {\n if (new Date(travelStartDate) >= new Date(travelEndDate)) {\n return buildValidationResult(false, 'travelEndDate', 'Your return date must be after your travel date. Can you try a different return date?');\n }\n // if (getDayDifference(travelStartDate, travelEndDate) > 30) {\n // return buildValidationResult(false, 'travelEndDate', 'You cannot travel for more than 30 days. Can you try a different return date?');\n // }\n }\n\n return { isValid: true };\n\n\n}", "title": "" }, { "docid": "33f52167325d20dee3ef4f75de64778d", "score": "0.59034324", "text": "function validation(text, date, time) {\n const currentDate = new Date()\n const parsedDate = date.split(\"-\")\n const currentHour = currentDate.getHours();\n const currentMinutes = currentDate.getMinutes();\n const currentDateStruct = {\n year: parseInt(currentDate.getFullYear()),\n month: parseInt(currentDate.getMonth() + 1),\n day: parseInt(currentDate.getDate())\n }\n const inputDateStruct = {\n year: parseInt(parsedDate[0]),\n month: parseInt(parsedDate[1]),\n day: parseInt(parsedDate[2])\n }\n if (date === \"\") {\n alert(\"date cannot be empty\\nif you want to add note you must choose date\")\n return false;\n }\n if (inputDateStruct.year < currentDateStruct.year) {\n alert(\"Time cannot be in past\")\n return false;\n } else if (inputDateStruct.year === currentDateStruct.year) {\n if (inputDateStruct.month < currentDateStruct.month) {\n alert(\"month cannot be in past\")\n return false;\n } else if (inputDateStruct.month === currentDateStruct.month) {\n if (inputDateStruct.day < currentDateStruct.day) {\n alert(\"day cannot be in past\")\n return false;\n }\n }\n }\n if (text === \"\") {\n alert(\"text cannot be empty\\nPlease enter some text in the text box\")\n return false;\n }\n\n const [hour, minutes] = time.split(\":\");\n const [intHour, intMinutes] = [parseInt(hour), parseInt(minutes)];\n if (time === \"\") {\n\n } else {\n\n if (currentHour > intHour) {\n alert(`invalid hour\\nhour cannot be in past\\n${text}`)\n return false;\n } else if (currentHour == intHour) {\n if (currentMinutes > intMinutes) {\n alert(\"invalid minute \\nminute cannot be in past\")\n return false;\n }\n }\n }\n console.log(\"Validation succeeded \")\n return true;\n}", "title": "" }, { "docid": "1ddae6926d1ab03f3400b8273df11ad2", "score": "0.58997095", "text": "function validateDate(){\n \n if (($('#start_date').val() === $('#end_date').val())\n && ($('#start_time').val() > $('#end_time').val())) {\n alert(\"The end time cannot be less than the start time\");\n } else if ($('#start_date').val() > $('#end_date').val()) {\n alert(\"The end date cannot be less than the start date\");\n } else {\n return true;\n }\n\n }", "title": "" }, { "docid": "adb7e730dbb619e85f3ecd08c3524e09", "score": "0.58711153", "text": "function validateTour() {\n if (!validateTourName(vm.tourName) || !validateSelectedRoute(vm.selectedRoute)) {\n return false;\n }\n \n if (vm.selectedTourSeries) {\n if (!validateGermanDate(vm.tourSeriesStartDate)) {\n return false;\n } else if (!validateGermanDate(vm.tourSeriesEndDate)) {\n return false;\n } else if (!validateDateRange(vm.tourSeriesStartDate, vm.tourSeriesEndDate)) {\n return false;\n }\n } else {\n if (!validateGermanDate(vm.tourStartDate)) {\n return false;\n } \n }\n return true;\n }", "title": "" }, { "docid": "551c5d15bf8965740a8f69ee03c0ec7a", "score": "0.58576995", "text": "function validateAvailability() {\n console.log(\"validateAvailability()\");\n\n var cartSize = cart.size();\n $('#cart_quantity').text(cartSize);\n\n var quantity = parseInt($('#quantity').text());\n var quantityToPurchase = parseInt($('#details_container input[type=\"text\"]').val());\n var pattern = new RegExp(/^[1-9]\\d*$/);\n\n if ( !trim(quantityToPurchase) || (!pattern.test(quantityToPurchase)) ) {\n toggleConfirmation('#confirmation_container', false, invalidQuantityInput);\n return;\n }\n\n if (quantity - quantityToPurchase < 0) {\n toggleConfirmation('#confirmation_container', false, invalidQuantityAmount);\n return;\n }\n\n validateQuantityFromDB();\n}", "title": "" }, { "docid": "e4ab67b55c17edf580692125988d9346", "score": "0.58558327", "text": "function validatePlaneTrip() {\n\n for (var leg in $scope.planeLegs){\n var current = $scope.planeLegs[leg];\n // if StartDetails or EndDetails is false (no input), then the input was not filled\n // in from the autocomplete dropdown.\n if(!current.StartDetails || !current.EndDetails){\n toastr.error('Cities must be populated from the autocomplete dropdown. Please edit your plane trip.')\n return false;\n }\n }\n // If we get here, this means the form has been filled out correctly.\n return true;\n\n }", "title": "" }, { "docid": "7aca3999a659a5b0fb34f55f520d441d", "score": "0.58513653", "text": "function validationValueAccomContract(id_booking){\n if ($(\"#accom_bookingDate\").val() != \"\" && $(\"#accom_paidBy\").val() != \"\" \n && $(\"#accom_payer\").val() != 0 && $(\"#accom_payer\").val() != \"\" \n && $(\"#accom_stay\").val() != \"\" && $(\"#accom_night\").val() != \"\" \n && $(\"#accom_hotel\").val() != 0 && $(\"#accom_mealPlan\").val() != 0 \n && $(\"#accom_room\").val() != 0 && $(\"#accom_room\").val() != \"\" \n && $(\"#accom_client\").val() != 0 && $(\"#accom_client\").val() != \"\") \n {\n loadAccomContract(id_booking);\n }\n}", "title": "" }, { "docid": "978b93d6372eb2ae9d4221902d26e77e", "score": "0.58187646", "text": "function validate(){\n var result = true;\n var fieldArray = [\"title\",\"reserve\"];\n for(var x = 0; x < fieldArray.length;x++){\n\tif(validateEach(fieldArray[x]) ==false){\n\t result = false;\n\t}\n }\n return result;\n}", "title": "" }, { "docid": "5344a65cba47d0ea864675a6caee0eb2", "score": "0.58148193", "text": "validateFormFields() {\n let { vacationData } = this.state;\n this.isValidTime = true;\n let errorFields = [];\n Object.keys(vacationData).forEach((field) => {\n if (field !== 'isAllowBooking' && field !== 'isAutoCancelAppointment' && !vacationData[field] && isEmpty(vacationData[field])) {\n errorFields.push(this.errorMessages[field]);\n this.isValid = false;\n }\n });\n let errorMsg = errorFields[0];\n if (errorFields && errorFields.length > 1) {\n errorFields.forEach((errorField, index) => {\n if (index !== 0) {\n errorMsg += ', ' + errorField;\n }\n });\n toastr.error(`${errorMsg} are required`);\n return;\n } else if (errorMsg) {\n toastr.error(`${errorMsg} is required`);\n return;\n }\n if (this.isValid) {\n if (this.state.selectedVacation) {\n vacationData.startDate = (typeof vacationData.startDate === 'object') ? new Moment(vacationData.startDate).format('DD-MM-YYYY') : vacationData.startDate;\n vacationData.startTime = (typeof vacationData.startTime === 'object') ? new Moment(vacationData.startTime).format('HH:mm:ss') : vacationData.startTime;\n vacationData.endDate = (typeof vacationData.endDate === 'object') ? new Moment(vacationData.endDate).format('DD-MM-YYYY') : vacationData.endDate;\n vacationData.endTime = (typeof vacationData.endTime === 'object') ? new Moment(vacationData.endTime).format('HH:mm:ss') : vacationData.endTime;\n }\n let start = new Moment(vacationData.startDate + ' ' + vacationData.startTime, Meteor.settings.public.dateFormat);\n let end = new Moment(vacationData.endDate + ' ' + vacationData.endTime, Meteor.settings.public.dateFormat);\n this.isValidTime = new Moment(end, Meteor.settings.public.dateFormat).isSameOrAfter(new Moment(start, Meteor.settings.public.dateFormat));\n if (!this.isValidTime) {\n toastr.error('Start datetime must be less than end datetime');\n this.isValid = false;\n return;\n } else if (vacationData.startTime === vacationData.endTime) {\n toastr.error(`Start time and End time must be different `);\n this.isValid = false;\n return;\n } else {\n this.validVacationData.start = start;\n this.validVacationData.end = end;\n this.validVacationData.isActive = true;\n this.validVacationData.type = vacationData.type;\n this.validVacationData.note = vacationData.note;\n this.validVacationData.isAllowBooking = vacationData.isAllowBooking;\n this.validVacationData.isAutoCancelAppointment = vacationData.isAutoCancelAppointment;\n }\n }\n\n }", "title": "" }, { "docid": "7ce7ffaa7df941ab8c39e7054c489644", "score": "0.58052695", "text": "function validation() {\n //Course name checking\n if (!nameRegex.test(className.value)) {\n className.style.backgroundColor = \"red\";\n className.focus();\n return false;\n } else {\n className.style.backgroundColor = \"white\";\n }\n //Start date checking\n if (!dateRegex.test(startDate.value)) {\n startDate.style.backgroundColor = \"red\";\n startDate.focus();\n return false;\n } else {\n startDate.style.backgroundColor = \"white\";\n }\n //End date checking\n if (!dateRegex.test(endDate.value)) {\n endDate.style.backgroundColor = \"red\";\n endDate.focus();\n return false;\n } else {\n endDate.style.backgroundColor = \"white\";\n }\n }", "title": "" }, { "docid": "3199d43c3a085b6226b7e654517566cd", "score": "0.58044016", "text": "function validateLegal(LE_COUNTRY,LE_NAME,LE_ADDRESS,LE_IDNTI,LE_PLCREG,LE_TIN_PAN,LE_IT_TAN_NUMBER,LE_IT_TAN_CIRCLE,CR_LE_EFFDT){\n\t\n\t$('#LEG_TAN_C_ERROR').text(\"\");\n\t$('#LEG_TAN_NO_ERROR').text(\"\");\n\t$('#LEG_TINPAN_ERROR').text(\"\");\n\t$('#LEG_ADDR_ERROR').text(\"\");\n\t$('#LEG_REGNPLACE_ERROR').text(\"\");\n\t$('#LEG_IDENTIFIER_ERROR').text(\"\");\n\t$('#LEG_NAME_ERROR').text(\"\");\n\t$('#LEG_COUNTRY_ERROR').text(\"\");\n\t$('#LEG_EFFDT_ERROR').text(\"\");\n\t\n\tif(CR_LE_EFFDT===undefined || CR_LE_EFFDT===\"\" || CR_LE_EFFDT==null){\n\t\t\n\t\t$('#LEG_EFFDT_ERROR').text(\"Please select Effective Start Date.\");\n\t\treturn false;\n\t}\n\tif(LE_COUNTRY===undefined || LE_COUNTRY===\"\" || LE_COUNTRY==null){\n\t\t\n\t\t$('#LEG_COUNTRY_ERROR').text(\"Please select Country.\");\n\t\treturn false;\n\t}\n\tif(LE_NAME===undefined || LE_NAME===\"\" || LE_NAME.length>250){\n\t\t\n\t\tif(LE_NAME.length>250){\n\t\t\t$('#LEG_NAME_ERROR').text(\"Length should not exceed 250 characters.\");\n\t\t\treturn false;\n\t\t}\n\t\telse{\n\t\t\t$('#LEG_NAME_ERROR').text(\"Please enter the Name.\");\n\t\t\treturn false;\n\t\t}\n\t}\n\tif(LE_ADDRESS===undefined || LE_ADDRESS===\"\" || LE_ADDRESS==null){\n\t\t\n\t\t$('#LEG_ADDR_ERROR').text(\"Please select Legal Address.\");\n\t\treturn false;\n\t}\n\tif(LE_IDNTI===undefined || LE_IDNTI===\"\" || LE_IDNTI.length>250){\n\t\t\n\t\tif(LE_IDNTI.length>250){\n\t\t\t$('#LEG_IDENTIFIER_ERROR').text(\"Length should not exceed 250 characters.\");\n\t\t\treturn false;\n\t\t}\n\t\telse{\n\t\t\t$('#LEG_IDENTIFIER_ERROR').text(\"Please enter the Legal Entity Identifier.\");\n\t\t\treturn false;\n\t\t}\n\t}\n\tif(LE_PLCREG===undefined || LE_PLCREG===\"\" || LE_PLCREG.length>250){\n\t\t\n\t\tif(LE_PLCREG.length>250){\n\t\t\t$('#LEG_REGNPLACE_ERROR').text(\"Length should not exceed 250 characters.\");\n\t\t\treturn false;\n\t\t}\n\t\telse{\n\t\t\t$('#LEG_REGNPLACE_ERROR').text(\"Please enter the Registration Place.\");\n\t\t\treturn false;\n\t\t}\n\t}\n\tif(LE_TIN_PAN===undefined || LE_TIN_PAN===\"\" || LE_TIN_PAN.length>250){\n\t\topenTab(event,'IT_INFO');\n\t\t$('#IT_BTN').addClass(\"w3-theme\");\n\t\tif(LE_TIN_PAN.length>250){\n\t\t\t$('#LEG_TINPAN_ERROR').text(\"Length should not exceed 250 characters.\");\n\t\t\treturn false;\n\t\t}\n\t\telse{\n\t\t\t$('#LEG_TINPAN_ERROR').text(\"Please enter the TIN/PAN Number.\");\n\t\t\treturn false;\n\t\t}\n\t}\n\tif(LE_IT_TAN_NUMBER===undefined || LE_IT_TAN_NUMBER===\"\" || /^[A-Z]{4}[0-9]{5}[A-Z]{1}$/.test(LE_IT_TAN_NUMBER)==false){\n\t\topenTab(event,'IT_INFO');\n\t\t$('#IT_BTN').addClass(\"w3-theme\");\n\t\t\n\t\tif(LE_IT_TAN_NUMBER===undefined || LE_IT_TAN_NUMBER===\"\"){\n\t\t\t$('#LEG_TAN_NO_ERROR').text(\"Please enter the TAN number.\");\n\t\t\treturn false;\n\t\t}\n\t\telse{\n\t\t\t$('#LEG_TAN_NO_ERROR').text(\"Please enter the valid TAN number\");\n\t\t\treturn false;\n\t\t}\n\t}\n\tif(LE_IT_TAN_CIRCLE===undefined || LE_IT_TAN_CIRCLE===\"\" || LE_IT_TAN_CIRCLE.length>250){\n\t\topenTab(event,'IT_INFO');\n\t\t$('#IT_BTN').addClass(\"w3-theme\");\n\t\tif(LE_IT_TAN_CIRCLE.length>250){\n\t\t\t$('#LEG_TAN_C_ERROR').text(\"Length should not exceed 250 characters.\");\n\t\t\treturn false;\n\t\t}\n\t\telse{\n\t\t\t$('#LEG_TAN_C_ERROR').text(\"Please enter the TAN Circle.\");\n\t\t\treturn false;\n\t\t}\n\t}\n\t\t\n\treturn true;\n}", "title": "" }, { "docid": "77b70b651852e880f14f14efcc93d32b", "score": "0.57943404", "text": "function doValidate() {\n if (passenger.citizenship.value.id == 189)//Россия\n {\n //поездка по России\n var tripInsideRF = $scope.isTripInsideRF($scope.item);\n\n //если поездка в Украину\n var tripInsideUkraine = $scope.isInside($scope.item, [226], true);\n\n var doc_num = $elem.val();\n //console.log('doc_num', doc_num);\n doc_num = doc_num.replace(/\\s+/g, '');\n\n var isRuPassp = $scope.isCaseValid(function () {\n Validators.ruPassport(doc_num, 'err');\n });\n\n var isBirthDoc = $scope.isCaseValid(function () {\n Validators.birthPassport(doc_num, 'err');\n });\n\n //console.log('tripInsideRF', tripInsideRF, 'tripInsideUkraine', tripInsideUkraine, 'isRuPassp', isRuPassp, 'isBirthDoc', isBirthDoc);\n\n if (tripInsideRF) {\n if (isRuPassp || isBirthDoc) {\n //passenger[hideField][hideFieldName] = true;\n\n //console.log(passenger.doc_expirationDate.id);\n var $to = $(\"#\" + passenger.doc_expirationDate.id);\n $scope.tooltipControl.close($to);\n\n return;\n }\n }\n else if (tripInsideUkraine) { //если в Украине\n if (isRuPassp || isBirthDoc) {\n setTimeout(function () {\n var $to = $(\"#\" + passenger.doc_series_and_number.id);\n $scope.tooltipControl.close($to);\n $scope.tooltipControl.init($to, 'С 1 марта 2015 года граждане РФ могут въезжать<br/>на территорию Украины только по заграничному паспорту.');\n $scope.tooltipControl.open($to);\n }, 100);\n\n return;\n }\n else {\n var $to = $(\"#\" + passenger.doc_series_and_number.id);\n $scope.tooltipControl.close($to);\n }\n }\n }\n\n //passenger[hideField][hideFieldName] = false;\n return;\n }", "title": "" }, { "docid": "3985e82900ab421f9224ab0b5e0c45ee", "score": "0.57884985", "text": "verificationReservation() {\n if (sessionStorage.getItem(\"stationReserve\") != null){\n if (confirm(\"Voulez-vous reprendre votre réservation d'un velo à la station \"+sessionStorage.getItem(\"stationReserve\")+\" ?\")){\n mapLyon.addReservation();\n } else {\n sessionStorage.removeItem(\"stationReserve\");\n sessionStorage.removeItem(\"adresseReserve\");\n sessionStorage.removeItem(\"heureFinReservation\");\n };\n };\n }", "title": "" }, { "docid": "f01f0a9bfd920798c9cb63397f119a86", "score": "0.57813954", "text": "function validation(){\n \t\n\n \t let task = document.getElementById(\"task\");\n\t\t let mentor = document.getElementById(\"mentor\");\n\t\t let date = document.getElementById(\"date\");\n\n\t\t if( task.value == \"\"){\n\t\t alert(\"Task Field is Required\");\n\t\t return ;\n\t\t }\n\t\t else if(mentor.value == \"\"){\n\t\t \t \n\t\t \t alert(\"Mentor is required\");\n\t\t \t return ;\n\n\t\t }\n\t\t else if(date.value == \"\"){\n\t\t \t\n\t\t \t alert(\"date is required\");\n\t\t \t return ;\n\n\t\t }\n\n\n\t\t storeNewData();\n\n\n }", "title": "" }, { "docid": "ea2b1af8b37ad4ec64e6948aa7670248", "score": "0.57738733", "text": "function validate(data,edition){\n return new Promise((resolve,reject)=>{\n\n schema = schemaParser.matchDatatoSchema(data,edition)\n var valid = ajv.validate(schema, data);\n\n if (!valid) {\n reject(new exception.eventSenderException(stringBuilder.buildStringAJV(ajv.errors), exception.errorType.INVALID_OBJECT_CREATED));\n } else {\n resolve()\n }\n })\n}", "title": "" }, { "docid": "7f79c120cefb2f23bd72215c3c24509e", "score": "0.5772362", "text": "validateData() {\n const number = /^\\d+$/;\n if (\n !number.test(this.data.expiry) ||\n this.data.expiry.toString().length != 4 ||\n parseInt(this.data.expiry.toString().slice(0, 2)) <= 0 ||\n parseInt(this.data.expiry.toString().slice(0, 2)) > 12\n ) {\n throw new BadRequest('The expiry is invalid');\n }\n }", "title": "" }, { "docid": "31cf1aa0bd7ef9fa91dc5b1beb9f885d", "score": "0.57703507", "text": "function offer(){\n \tvar sdate=document.offerForm.startdate.value;\n \tvar enddate=document.offerForm.enddate.value;\n \t\n \tconsole.log(\"in offer\");\n \tif(sdate > enddate){\n \t\tconsole.log(\"in condition\");\n \t\talert(\"Start Date Can't be greater than expiry date\");\n \t\tevent.preventDefault();\n \t\treturn false;\n \t}\n \t\n \t /*Function end For offers Date Validation */\n }", "title": "" }, { "docid": "20f511ecedef630ac930758c1400898d", "score": "0.5759147", "text": "async function isValidDateTime(req, _, next) {\n const { reservation_date, reservation_time } = req.body.data;\n const date = new Date(reservation_date);\n let today = new Date();\n const resDate = new Date(reservation_date).toUTCString();\n\n if (resDate.includes(\"Tue\")) {\n return next({\n status: 400,\n message: \"Sorry, we are closed on Tuesdays. Please choose another day.\",\n });\n }\n\n if (\n date.valueOf() < today.valueOf() &&\n date.toUTCString().slice(0, 16) !== today.toUTCString().slice(0, 16)\n )\n return next({\n status: 400,\n message: \"Reservations must be made in the future!\",\n });\n\n if (reservation_time < \"10:30\" || reservation_time > \"21:30\") {\n return next({\n status: 400,\n message: \"Sorry, we are closed at that time. Please choose another time.\",\n });\n }\n next();\n}", "title": "" }, { "docid": "f4456e0b55467674a5633186da3befed", "score": "0.5759105", "text": "function validate( Cname, number, unitNum,streetNum,streetName,suburb,pickupTime,pickupDate,suburbD) {\r\n var state = false;\r\n //check if the argument with regular expression\r\n for(var i =0; i < arguments.length;i++){\r\n var nameReg = /^[a-zA-Z -]+$/i;\r\n var numbers = /^[0-9]+$/;\r\n var specialChar = /[!@#$%^&*()?\"{}|<>]/;\r\n\r\n //check if it is empty input except second\r\n if(arguments[i].trim()!==\"\"||i===2){\r\n//filter out special charactors\r\n if(!arguments[i].match(specialChar)){\r\n if(!Cname.match(nameReg)){\r\n alert(\"Name input incorrect\");\r\n return false;\r\n }\r\n //phone number should be number\r\n if(!number.match(numbers)){\r\n alert(\"Phone number input wrong\");\r\n return false;\r\n }\r\n if(suburb.match(numbers)){\r\n alert((\"suburb should not contain numbers\"));\r\n return false;\r\n }\r\n //suburb should not be number\r\n if(suburbD.match(numbers)){\r\n alert((\"suburb should not contain numbers\"));\r\n return false;\r\n }\r\n state = true;\r\n }else{\r\n alert(\"No special character should be used! \");\r\n }\r\n\r\n\r\n }\r\n else {\r\n alert(\"Null input are not allowed !\");\r\n return false;\r\n }\r\n }\r\n return state;\r\n}", "title": "" }, { "docid": "35a419026054ae40fede17e773ff0e17", "score": "0.57527316", "text": "function isValid(){\r\n\r\n\t//if name taken\r\n\tfor (restaurant in namesArray) {\r\n\t\tif (document.getElementById(\"addname\").value.toUpperCase().trim() == (namesArray[restaurant]).toUpperCase().trim()){\r\n\t\t\talert(\"Name already taken.\")\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\r\n\t//if fields empty\r\n\tif (document.getElementById('addname').value.trim() == \"\" || document.getElementById('addfee').value.trim() == \"\" || document.getElementById('addminorder').value.trim() == \"\") {\r\n\t\talert('One or more fields are empty.');\r\n\t\treturn;\r\n\t}\r\n\r\n\t//if minorder/delfee are not numbers\r\n\tif (isNaN(document.getElementById('addfee').value.trim()) || isNaN(document.getElementById('addminorder').value.trim())) {\r\n\t\talert(\"You cannot have text in the delivery fee and/or minimum order fields.\")\r\n\t\treturn;\r\n\t}\r\n\telse{\r\n\t\t//if it is acccetable..\r\n\t\talert(\"Success! New Restaurant submitted.\")\r\n\r\n\t\t//send to server\r\n\t\tsubmitRestaurant();\r\n\t\treturn;\r\n\t}\r\n}", "title": "" }, { "docid": "52dc2542b782f029efdee789d0adbd49", "score": "0.5741614", "text": "function _validate() {\n var title = \"Error\"\n var msg = \"Campos incompletos. Por favor verifica.\"\n var error = false\n\n if (!vm.reporte.desde || !vm.reporte.hasta) {\n error = true\n title = \"Fechas incorrectas\"\n msg = \"Verifica que has seleccionado correctamente las fechas\"\n }\n else if (vm.reporte.desde > vm.reporte.hasta) {\n error = true\n title = \"Fecha inicial incorrecta\"\n msg = \"La fecha inicial no debe ser mayor a la fecha final\"\n }\n\n if (error)\n swal(title, msg, \"error\")\n return !error\n }", "title": "" }, { "docid": "187a1dfd782b388c4ee48d1a8601cd78", "score": "0.5734884", "text": "function duringOperatingHours(req, res, next) {\n const { reservation_time } = req.body.data;\n const open = 1030;\n const close = 2130;\n const reservation = reservation_time.substring(0, 2) + reservation_time.substring(3);\n if (reservation > open && reservation < close) {\n return next();\n } else {\n return next({\n status: 400,\n message: \"Reservations are only allowed between 10:30am and 9:30pm\",\n });\n }\n}", "title": "" }, { "docid": "b45b3ad2aabdecfcc3cfbab3f5a0c961", "score": "0.5733741", "text": "function validacionFechaCompraAutoconsa(){\r\n\tvar fechaCompra = $(\"#txtfechaCompra\").val();\r\n\tvar fechaValida = validarSiEsFecha(fechaCompra);\r\n\tif(fechaValida == false){\r\n\t\talert(\"Ingrese una Fecha de Compra Correcta\");\r\n\t\treturn false;\r\n\t}else{\r\n\t\tvar fechaCompraVerificador = new Date(fechaCompra);\r\n\t\tvar fechaActual = new Date();\r\n\t\tvar diasExtras = Number(15);\r\n\t\tvar fechaDesde = fechaActual.getTime() - (86400000 * diasExtras);\r\n\t\tvar fechaHasta = fechaActual.getTime() + (86400000 * diasExtras);\r\n\t\tvar fechaDesdeValidador = new Date(fechaDesde);\r\n\t\tvar fechaHastaValidador = new Date(fechaHasta);\r\n\t\t\r\n\t\tif(fechaCompraVerificador<fechaDesdeValidador || fechaCompraVerificador>fechaHastaValidador){\r\n\t\t\talert(\"La fecha de compra debe ser 15 dias antes y 15 depues de la fecha actual\");\r\n\t\t\treturn false;\r\n\t\t}else{\r\n\t\t\tvalidacionDiaMesAutoconsa();\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "c25696a83d000cc41f155d04a198b315", "score": "0.5712954", "text": "function validate() {\n\t//validate pickup information\n\tif (validatePickup()) {\n\t\t\n\t\t//validate name and phone\n\t\tif (validateInfo()) {\n\t\t\t\n\t\t\t//validate credit card\n\t\t\tif (validateCC()) {\n\t\t\t\t\n\t\t\t\t//proceed\n\t\t\t\tcompleteOrder();\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "672bcd21be258fa9d4133f152257b3e3", "score": "0.57103693", "text": "dateValid() {\n const { date } = this.state;\n var dateParts = (!date) ? [] : date.split(\"-\");\n var validator = { isValid: false, text: \"Please fill out date\" };\n if (dateParts.length===3) {\n var year = parseInt(dateParts[0]);\n var month = parseInt(dateParts[1]);\n var day = parseInt(dateParts[2]);\n if(year<=currentYear) {\n var isCurrentYear = (year===currentYear);\n var isMonthValid = this.checkMonth(isCurrentYear,month);\n if(isMonthValid===true) {\n var isCurrentMonth = (isCurrentYear===true && month===currentMonth);\n var isDayValid = this.checkDay(isCurrentMonth,month,day);\n if(isDayValid===true) {\n validator = { isValid: true };\n }\n else {\n validator.text = (day<=months[month-1].days) ? 'Specified day is in the future' : `${months[month-1].name} only has ${months[month-1].days} days`;\n }\n }\n else {\n validator.text = `Specified month ${month<13 ? 'is in the future' : 'does not exist'}`;\n }\n }\n else {\n validator.text = \"Specified year is in the future\";\n }\n }\n return validator;\n }", "title": "" }, { "docid": "9a3954a0dc1fe370e402fab1ad24d7ed", "score": "0.5710118", "text": "function validateId2()\r\n{\r\n type = $(\"select[name='performance'] option:selected\");\r\n if (type[0].value == \"duet\")\r\n {\r\n var test = /\\d{2}[\\s\\-]?\\d{3}[\\s\\-]?\\d{4}[\\s\\-]?/.test($('#id2').val());\r\n if (!test)\r\n $('#errorid2').show();\r\n else\r\n $('#errorid2').hide();\r\n return test;\r\n }\r\n return true;\r\n}", "title": "" }, { "docid": "b5d65f8e6daa68c335e02e889fed66f3", "score": "0.5709877", "text": "function validateForm() {\n \n\n const dateValue = document.getElementById(\"geboortedatum\");\n const herhaalWachtwoord = document.getElementById(\"h-wachtwoord\");\n const wachtwoord = document.getElementById(\"wachtwoord\");\n if(dateValue.checkValidity() === false ){ /*er is ivalid invoer*/\n\n let labeltext = dateValue.id;\n foutmeldingspan.innerText= `een valid invoer is verplict bij ${labeltext}`;\n return false\n\n }\n \n if ( herhaalWachtwoord.value !== wachtwoord.value && wachtwoord.value !== \"\" && herhaalWachtwoord.value !== \"\"){ \n herhaalWachtwoord.classList.add(\"fout\");\n foutmeldingspan.innerText=\"de wachtwoord werd niet het zefde hehaald\";\n return false; \n }\n else if (herhaalWachtwoord.value === wachtwoord.value) {\n herhaalWachtwoord.classList.remove(\"fout\");\n foutmeldingspan.innerText=\"\";\n }\n\n//Validate that inputs are not empty\n let inputs = document.getElementsByTagName(\"input\");\n foutmeldingspan.innerText=\"\";\n for (var i = 0; i < 12; i++) {\n inputs[i].classList.remove('invalid-warning');\n if (inputs[i].checkValidity() === false) {\n // if(inputs[i].id[\"gewicht\"] !== null) {\n // foutmeldingspan.innerText=\"min 30 max 450\";\n // }\n // if(inputs[i].id[\"grootte\"] !== null) {\n // foutmeldingspan.innerText=\"min 80 max 250\";\n // }\n\n inputs[i].focus();\n inputs[i].classList.toggle('invalid-warning');\n return false;\n }\n }\n \n return true;\n\n//End ValidateForm \n}", "title": "" }, { "docid": "a83cc5f1113ac7eeb43415d46f8e9764", "score": "0.57070005", "text": "function valida_registroDeudor(p_nombre,p_identificacion,p_ciudad,p_valordeuda,p_tiempodeuda,p_fecha,p_Ckacepto)\r\n{\r\n\t\r\n\tif (vacio(p_nombre)&&vacio(p_identificacion)&&vacio(p_ciudad)&&vacio(p_valordeuda)&&vacio(p_tiempodeuda)&&vacio(p_fecha))\r\n\t{\t\t\r\n\t\tif (p_Ckacepto.checked)\r\n\t\t{\r\n\t\t\tif(valida_unico(p_identificacion))\r\n\t\t\t{\r\n\t\t\t\treturn true\r\n\t\t\t}else{alert(\"verificar que la identificacion no tenga puntos ni comas\");return false}\r\n\t\t}else{alert(\"por favor seleccionar la casilla Acepto\");return false}\t\t\r\n\t}\r\n\talert(\"por favor verificar que todos los campos esten llenos\");\r\n\treturn false;\r\n\t\r\n}", "title": "" }, { "docid": "3e1da5a322923f64b64a9836800472b9", "score": "0.5700229", "text": "function validate(name, date, type) {\n\n var lower_limit_date = new Date('1950-01-01');\n var upper_limit_date = new Date('1998-01-01');\n\n //check if date string is correct\n if (isNaN(Date.parse(date))) {\n bootbox.alert(\"Enter valid date!\");\n return false;\n }\n var tdate = new Date(date);\n\n if (name == '') {\n bootbox.alert(\"Enter name!\");\n return false;\n } else if (name.length < 3) {\n bootbox.alert(\"Name must have more than 2 characters!\");\n return false;\n } else if (!allLetter(name)) {\n bootbox.alert(\"Name must contains only characters!\");\n return false;\n } else if (tdate.getTime() < lower_limit_date.getTime()) {\n bootbox.alert(\"Student is too older for university! Student must born after 1950\");\n return false;\n } else if (tdate.getTime() > upper_limit_date.getTime()) {\n bootbox.alert(\"Student is too young for university! Student must born before 1998\");\n return false;\n } else {\n switch (type) {\n case 'edit':\n bootbox.alert(\"You successfully edit student!\");\n return true;\n break;\n case 'add':\n bootbox.alert(\"You successfully enter student!\");\n return true;\n break;\n }\n }\n\n }", "title": "" }, { "docid": "767c33216d9bdc8da0b79001a20dc232", "score": "0.56930184", "text": "function validateDate(minInput, hhInput, ddInput, mmInput,yyyyInput, min, hh, dd, mm,yyyy,name){\n var error = false;\n var errorMsg = \"Error \"+name+\" Date: \\n\";\n\n if(yyyyInput<yyyy){\n errorMsg += \"Year is invalid\";\n error = true;\n }\n else if(yyyyInput == yyyy){\n if (mmInput<mm){\n errorMsg += \"Month is invalid\";\n error = true;\n }\n else if(mmInput == mm){\n if(ddInput<dd){\n errorMsg += \"Day is invalid\";\n error = true;\n }\n else if(ddInput==dd){\n if(hhInput<hh){\n errorMsg += \"hour is invalid\";\n error = true;\n }\n else if(hhInput==hh){\n if(minInput <= min){\n errorMsg += \"Minute is invalid\";\n error = true;\n }\n }\n }\n \n }\n }\n\n if(error){\n errorMsg = \"Error: \" + name + \" Date must be in the future.\";\n alert(errorMsg);\n return false;\n }\n \n return true;\n }", "title": "" }, { "docid": "355742dbfd203dc993845268fb84f200", "score": "0.5675278", "text": "function validatePickup() {\n\t//get pickup elements\n\tvar hours = document.getElementById(\"hours\");\n\tvar minutes = document.getElementById(\"minutes\");\n\tvar ampm = document.getElementById(\"ampm\");\n\t\n\t//check for blank selects and alert if necessary\n\tif (hours.value != \"\" && minutes.value != \"\" && ampm.value != \"\") {\n\t\t\n\t\t//check for valid pickup hours\n\t\tif (validateTime(hours, minutes, ampm)) return true;\n\t\telse {\n\t\t\talert(\"Please select a pickup time between 10 AM and 11 PM.\");\n\t\t\treturn false;\n\t\t}\n\t} else {\n\t\talert(\"Please select a pickup time.\");\n\t}\n}", "title": "" }, { "docid": "bf4b64dc23225fd4c5b03c85e7159ee8", "score": "0.5673075", "text": "function isTaskDateValid() {\n let inputDate = document.getElementById(\"taskDate\");\n inputDate.style.backgroundColor = \"\";\n\n if (inputDate.value == \"\") {\n inputDate.style.backgroundColor = \"pink\";\n alert(\"Please add date\");\n return false;\n }\n\n let presentDate = new Date();\n let inputDateCheck = new Date(inputDate.value);\n //reduce the digit to only ten wich give you only the date whithout time\n presentDate = presentDate.toISOString().slice(0, 10);\n inputDateCheck = inputDateCheck.toISOString().slice(0, 10);\n\n if (inputDateCheck < presentDate) {\n inputDate.style.backgroundColor = \"pink\";\n alert(\"Due date has passed\");\n return false;\n }\n return true;\n}", "title": "" }, { "docid": "58a299d80f033efbb7d694a66b967530", "score": "0.56717837", "text": "function editReservation() {\r\n // Get date, start time, and end time from dateboxes and convert format\r\n var date = convertDateObjToDateString($('#search #search_date').datebox('getTheDate'));\r\n var start_time = convertDateToTime($('#search #search_start_time').datebox('getTheDate'));\r\n var end_time = convertDateToTime($('#search #search_end_time').datebox('getTheDate'));\r\n \r\n // Get reservations, seats, and types JSON from local storage\r\n var reservations = JSON.parse(localStorage.getItem(\"reservation_json\"));\r\n\r\n // Set reserve_id for new reservation by incrementing last reservation's id\r\n var reserve_id = 1;\r\n if(reservations.reservations.length != 0){\r\n reserve_id = Number(reservations.reservations[reservations.reservations.length-1].reserve_id) + 1;\r\n }\r\n\r\n var isAvailable = seatAvailable(h_reservation.seat_id, date, start_time, end_time);\r\n\r\n if(isAvailable === -1 || isAvailable === h_reservation.reserve_id){\r\n deleteReservation(h_reservation.reserve_id);\r\n\r\n reservation = { \"reserve_id\" : reserve_id, \r\n \"seat_id\" : h_reservation.seat_id, \r\n \"user_id\" : h_reservation.user_id, \r\n \"date\" : date, \r\n \"start_time\" : start_time, \r\n \"end_time\" : end_time };\r\n\r\n confirmReservation();\r\n\r\n alert(\"Reservation changed.\");\r\n // Change page\r\n $.mobile.changePage(\"#myReservationPage\");\r\n }\r\n else {\r\n alert(\"Your seat is not available at this time!\");\r\n }\r\n}", "title": "" }, { "docid": "90511b1cd084d129f4bc355f5c14deac", "score": "0.5668265", "text": "function validation() {\n\t\n\tvar startDate = $(\"#startdate\").datepicker({ dateFormat: 'MM' }).val();\n\tvar endDate = $(\"#enddate\").datepicker({ dateFormat: 'dd, MM, yyyy' }).val();\t\n\t\n\t//clear error messages and highlights\n\t$(\".fail\").remove();\n\t$(\"#startdate\").removeAttr(\"style\");\n\t$(\"#enddate\").removeAttr(\"style\");\n\t\n\n\t// validate that end date is after start date\n\tvar endBeforeStart = \"<h5 class='fail'>Course Start Date must be before Course End Date</h5>\";\n\tvar equalDates\t = \"<h5 class='fail'>Courses cannot start and end on same date</h5>\";\n\t\n\tif (startDate > endDate) {\n\t\t$(\"#form\").append(endBeforeStart);\n\t\t$(\"#startdate\").attr('style', 'border: red solid 2px');\n\t\treturn false;\n\t}\n\t\t\t\n\n\t// validate dates are not the same date\n\tif (startDate == endDate) {\n\t\t$(\"#form\").append(equalDates);\n\t\t$(\"#startdate\").attr('style', 'border: red solid 2px');\n\t\t$(\"#enddate\").attr('style', 'border: red solid 2px');\n\t\treturn false;\n\t}\n}", "title": "" }, { "docid": "2b129d4785ed67f528fbd41611b48519", "score": "0.56586105", "text": "function validateOverRangeWhenEdit(){\n\t\tif($(\"#editFabricSupplierDialog\").find(\"#txtShortName\").val().length>50 \n\t\t\t\t|| $(\"#editFabricSupplierDialog\").find(\"#txtLongName\").val().length>100 || $(\"#editFabricSupplierDialog\").find(\"#txtAddress\").val().length>200\n\t\t\t\t|| $(\"#editFabricSupplierDialog\").find(\"#txtTel\").val().length>50 || $(\"#editFabricSupplierDialog\").find(\"#txtFax\").val().length>50\n\t\t\t\t|| $(\"#editFabricSupplierDialog\").find(\"#txtTaxNo\").val().length>50)\n\t\t\treturn false;\n\t\treturn true;\n\t}", "title": "" }, { "docid": "a17e958d444af3e12a54972135676388", "score": "0.5658566", "text": "function checkDate(){\n var dateValid=true;\n var vdate = document.getElementById(\"visitdate\").value;\n var today = new Date(); \n console.log(\"Users date = \" + vdate);\n var dd = today.getDate();\n var mm = today.getMonth()+1;\n var yyyy = today.getFullYear();\n \n if (dd < 10) {\n dd = '0' + dd;\n } // need this in case day number is one digit like 6\n if (mm < 10) {\n mm = '0' + mm;\n } // need this is month number is 1 digit like 4 \n \n var td = \"\" + yyyy + \"-\" + mm + \"-\" + dd;\n console.log(\"System date = \" + td);\n \n if(vdate >= td){\n document.getElementById(\"error-visit\").innerHTML=\" Error:You cannot select today or the days after. \"; \n document.getElementById(\"visitdate\").style.borderColor=\"red\";\n document.getElementById(\"error-visit\").style.backgroundColor = 'pink';\n dateValid = false;\n }\n else {\n document.getElementById(\"error-visit\").innerHTML= \"\"; \n document.getElementById(\"visitdate\").style.border = null;\n document.getElementById(\"visitdate\").style = null;\n dateValid = true;\n }// end of else path\n console.log(\"in check date \" + dateValid);\n return (dateValid);\n}//end of function validate visitor's date to present date", "title": "" }, { "docid": "b4e9fda61ff01fe8233866d5f36313f1", "score": "0.56513625", "text": "function checkBooking(newBooking) {\n console.log(newBooking);\n if (\n newBooking.id &&\n newBooking.title &&\n newBooking.firstName &&\n newBooking.surname &&\n newBooking.email &&\n newBooking.roomId &&\n newBooking.checkInDate &&\n newBooking.checkOutDate\n ) {\n return true;\n }\n return false;\n}", "title": "" }, { "docid": "4e4893ee38b7e49bdb7c836b4dbf2c20", "score": "0.564968", "text": "function validateBookingId(){\n var bookingID = document.getElementById('bookingIdValidate').value;\n let bookingIDPatt = /^(\\d+)$/i;\n let errorOutPut = \"Error(s)<ul>\";\n\n //Valid\n if(bookingIDPatt.test(bookingID) && parseInt(bookingID)>0){\n console.log(bookingID+' Input is correct');\n errorOutPut = \"\";\n document.getElementById('bookingIdValidate').className = \"form-control is-valid\";\n //Input is valid so run the show all function\n runXHRConnection('assign',bookingID);\n //Reload the table after half a second to let server respond\n setTimeout(function(){\n runXHRConnection('view','0');\n }, 5000);\n\n }else{\n document.getElementById('bookingIdValidate').className = \"form-control is-invalid\";\n errorOutPut += \"<li>BookingID input is incorrect. Please make sure it is an integer and is more than 0</li>\";\n errorOutPut += \"</ul>\";\n document.getElementById('errorOutPut').style.color = \"#FF0000\";\n }\n\n document.getElementById('errorOutPut').innerHTML = errorOutPut;\n}", "title": "" }, { "docid": "d2273ed4239936a383c3155394204fb2", "score": "0.5647572", "text": "function ValidarEspaciosVacios() {\r\n\r\n var ID_ESTADO = document.getElementById(\"txt_Id_Estado\").value;\r\n var DESCRIPCION = document.getElementsByName(\"txt_Descripcion\")[0].value;\r\n\r\n\r\n if ((ID_ESTADO == \"\") || (DESCRIPCION == \"\")) { //COMPRUEBA CAMPOS VACIOS\r\n alert(\"Los campos no pueden quedar vacios por favor completa para continuar\");\r\n return true;\r\n }\r\n\r\n}", "title": "" }, { "docid": "813dece8ffbf57d24233a83ff69ba344", "score": "0.5643264", "text": "function validate()\r\n{\r\n var bValid = false;\r\n \r\n var input = nonnegativeNumber(\"NoOccupancy\",MESSAGES.no_occupancy_numeric,MESSAGES.no_occupancy_non_negative);\r\n if (input != null)\r\n {\r\n\t\t input = nonnegativeNumber(\"HeatGain\",MESSAGES.heat_gain_numeric,MESSAGES.heat_gain_non_negative);\r\n\t\t if(input != null){\r\n\t\t\t input = nonnegativeNumber(\"Occupants\",MESSAGES.occupants_numeric,MESSAGES.occupants_non_negative);\r\n\t\t\t if(input != null){\r\n\t\t\t\t input = nonnegativeNumber(\"Light\",MESSAGES.light_numeric,MESSAGES.light_non_negative);\r\n\t\t\t\t if(input != null){\r\n\t\t\t\t\t input = nonnegativeNumber(\"Device\",MESSAGES.device_numeric,MESSAGES.device_non_negative);\r\n\t\t\t\t\t if(input != null){\r\n\t\t\t\t\t\t bValid = true;\r\n\t\t\t\t\t }\r\n\t\t\t\t }\r\n\t\t\t }\r\n\t\t }\r\n }\r\n \r\n return bValid;\r\n}", "title": "" }, { "docid": "75c845b3e123e090aed93f39bda6504b", "score": "0.56402445", "text": "function valid(params) {\n return validID() && row.name.length > 0 && validQuantity() && validCost();\n }", "title": "" }, { "docid": "6c6999419da45259b5d9eb0738fb80cb", "score": "0.5639012", "text": "function checkQuantityValidation()\r\n { \r\n if(vm.isPickup == false) // Regular Order\r\n {\r\n if(vm.CaseQty < 1 && vm.CaseQty !=0)\r\n {\r\n alert('Please enter valid quantity.');\r\n return false;\r\n }\r\n }\r\n else\r\n {\r\n if(vm.CaseQty < 1 && vm.UnitQty < 1 && vm.CaseQty!=0 && vm.UnitQty !=0 ) // Pickup Order. Check for both Case and Unit Quantity\r\n {\r\n alert('Please enter valid quantity.');\r\n return false;\r\n }\r\n else if(vm.CaseQty > 0 && vm.UnitQty > 0)\r\n {\r\n alert('Either Case Or Unit can be entered.');\r\n return false;\r\n }\r\n }\r\n return true;\r\n }", "title": "" }, { "docid": "a6613af48ca82a7a2d03cf7a2ff2d11e", "score": "0.56246424", "text": "function validarPlan(){\n let nombrePlan=validarCampoVacio(\"nombre-plan\");\n let precio=validarCampoVacio(\"precio-plan\");\n let limiteProductos= validarCampoVacio(\"limite-productos\");\n let descripcionPlan=validarCampoVacio(\"descripcion-plan\");\n let plazo=validarCampoVacioSelect(\"plazo\",\"seleccione\");\n let tiempoPrueba=validarCampoVacioSelect(\"tiempoPrueba\",\"seleccione\");\n let diseno=validarCampoVacioSelect(\"diseno\",\"seleccione\");\n\n\n if(nombrePlan){\n document.getElementById(\"camp-vacio-nombre\").style.display=\"block\";\n document.getElementById(\"nombre-plan\").classList.add('invalid');\n }else{\n document.getElementById(\"camp-vacio-nombre\").style.display=\"none\";\n document.getElementById(\"nombre-plan\").classList.remove('invalid');\n }\n\n if(precio){\n document.getElementById(\"camp-vacio-precio\").style.display=\"block\";\n document.getElementById(\"precio-plan\").classList.add('invalid');\n }else{\n document.getElementById(\"camp-vacio-precio\").style.display=\"none\";\n document.getElementById(\"precio-plan\").classList.remove('invalid');\n }\n\n if(limiteProductos){\n document.getElementById(\"camp-vacio-limite\").style.display=\"block\";\n document.getElementById(\"limite-productos\").classList.add('invalid');\n }else{\n document.getElementById(\"camp-vacio-limite\").style.display=\"none\";\n document.getElementById(\"limite-productos\").classList.remove('invalid');\n }\n\n if(descripcionPlan){\n document.getElementById(\"camp-vacio-descripcion\").style.display=\"block\";\n document.getElementById(\"descripcion-plan\").classList.add('invalid');\n }else{\n document.getElementById(\"camp-vacio-descripcion\").style.display=\"none\";\n document.getElementById(\"descripcion-plan\").classList.remove('invalid');\n }\n\n if(plazo){\n document.getElementById(\"camp-vacio-plazo\").style.display=\"block\";\n document.getElementById(\"plazo\").classList.add('invalid');\n }else{\n document.getElementById(\"camp-vacio-plazo\").style.display=\"none\";\n document.getElementById(\"plazo\").classList.remove('invalid');\n }\n\n if(tiempoPrueba){\n document.getElementById(\"camp-vacio-tiempo\").style.display=\"block\";\n document.getElementById(\"tiempoPrueba\").classList.add('invalid');\n }else{\n document.getElementById(\"camp-vacio-tiempo\").style.display=\"none\";\n document.getElementById(\"tiempoPrueba\").classList.remove('invalid');\n }\n\n if(diseno){\n document.getElementById(\"camp-vacio-diseno\").style.display=\"block\";\n document.getElementById(\"diseno\").classList.add('invalid');\n }else{\n document.getElementById(\"camp-vacio-diseno\").style.display=\"none\";\n document.getElementById(\"diseno\").classList.remove('invalid');\n }\n\n if((nombrePlan==false)&&(precio==false)&&(limiteProductos==false)&&(descripcionPlan==false)&&(plazo==false)&&(tiempoPrueba==false)&&(diseno==false)){\n\n return true;\n }\n return false;\n}", "title": "" }, { "docid": "4682c4c80c076da647841e9fc13cf9f5", "score": "0.56185293", "text": "checkValue(){\n let error = false;\n console.log(this.state.eventId);\n\n console.log(this.state.startDate < this.state.endDate);\n\n if(this.state.startDate && this.state.endDate && this.state.eventId !== 'Please Select...'){\n if(this.state.startDate < this.state.endDate){\n /*this.state.reservations.map(reservation => {\n var partStart = reservation.start.split('.');\n var partsEnd = reservation.end.split('.');\n\n console.log(\"F1: \"+this.state.endDate < reservation.start);\n console.log(\"F2: \" +this.state.startDate > reservation.end);\n\n\n console.log(this.state.startDate.isAfter(partsEnd[2]+'-'+partsEnd[1]+'-'+partsEnd[0]) +' '+ this.state.endDate.isBefore(partStart[2]+'-'+partStart[1]+'-'+partStart[0]));\n if(this.state.startDate.isAfter(partsEnd[2]+'-'+partsEnd[1]+'-'+partsEnd[0]) || this.state.endDate.isBefore(partStart[2]+'-'+partStart[1]+'-'+partStart[0])){\n if(!error){\n console.log('no err');\n error = false\n } else{\n error = true\n }\n } else{\n console.log('error!');\n error = true;\n }\n\n\n });*/\n error = false;\n if(error){\n this.setState({\n error: true,\n message: 'An diesem Datum ist schon eine Reservation vorhanden!',\n });\n } else {\n this.setState({\n error: false,\n message: null,\n });\n }\n }else{\n this.setState({\n error: true,\n message: 'Ende muss nach dem Start sein!',\n });\n }\n }else{\n this.setState({\n error: true,\n message: 'Bitte Werte eingeben',\n });\n }\n }", "title": "" }, { "docid": "60edc6d0242244681c43cf6cf2b9d978", "score": "0.56182444", "text": "function notInPast(req, res, next) {\n const { reservation_date, reservation_time } = req.body.data;\n const reservation = new Date(`${reservation_date} PDT`).setHours(reservation_time.substring(0, 2), reservation_time.substring(3));\n const now = Date.now();\n if (reservation > now) {\n return next();\n } else {\n return next({\n status: 400,\n message: \"Reservation must be in the future.\",\n });\n }\n}", "title": "" }, { "docid": "6d1a1577aaa694b705b65a0942f186bc", "score": "0.56142086", "text": "function ValidationEvent() \n{\n\t// Storing Field Values In Variables\n\tvar h = document.getElementById(\"h\").value;\n\tvar m = document.getElementById(\"m\").value;\n\tvar am = document.getElementById(\"mer1\").checked;\n\tvar pm = document.getElementById(\"mer2\").checked;\n\t\n\n\t// Conditions\n\tif (h <= 12) \n\t{\n\t\tif (m <= 59) \n\t\t{\n\t\t\tif(am==false && pm==false) \n\t\t\t{\n \t\t\talert(\"You must select AM or PM\");\n \t\t\t\treturn false;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tstatus = checkDivStatus();\t\t\n\t\t\t\tprintAlarm(status);\n\t\t\t} \n\t\t} \n\t\telse \n\t\t{\n\t\t\talert(\"Enter valid value for minutes\");\n\t\t\treturn false;\n\t\t}\n\t} \n\telse \n\t{\n\t\talert(\"Enter valid value for hours\");\n\t\treturn false;\n\t}\n}", "title": "" }, { "docid": "d0588872e3de08833ef034277c4ac8f4", "score": "0.56087464", "text": "function validar() {\n validarCampos(nacionR, nombreR, fechNacR, calleR);\n validarDni(numDocR,inputDni);\n validarEmail(email,emailR);\n\n}", "title": "" }, { "docid": "b62a9446c047ca57d0560aa8ab17cc58", "score": "0.56023526", "text": "function isCreateDataValid(data) {\n let res = {}\n if( !data.from_c || !data.to_c || !data.rate || !data.created_at )\n res = {\n code: 0,\n message: \"Missing field!\"\n }\n else if( data.from_c.length > 5 || data.to_c.length > 5 || !isDateValid(data.created_at) )\n res = {\n code: 0,\n message: \"Invalid field!\"\n }\n else \n res = {\n code: 1,\n message: \"Valid\"\n }\n \n \n return res\n}", "title": "" }, { "docid": "1e1a899d20b4c4b912234e398ebfdab0", "score": "0.5597827", "text": "isValid() {\n this.firstName = this.validateFirstName(this.firstName)\n this.lastName = this.validateLastName(this.lastName)\n this.hireDate = this.validateHireDate(this.hireDate)\n this.role = this.validateRole(this.role)\n }", "title": "" }, { "docid": "7aded95c43b15ff3bb21cb17c0b15a31", "score": "0.55947", "text": "function validacao_horario_agendamento(data_informada,horario_informado, dia_semana_inicio, dia_semana_fim, horario_util_inicio, horario_util_fim) {\r\n\r\n\tvar data_info = data_informada;\r\n\tdata_info = data_info.split(\"/\");\r\n\tif (data_info[0].substring(0,1) == \"0\") \r\n\t\tdata_info[0] = data_info[0].substring(1,2);\r\n\tif (data_info[1].toString().substring(0,1) == \"0\") \r\n\t\tdata_info[1] = data_info[1].substring(1,2);\r\n\tvar data_info_modificada = new Date(parseInt(data_info[2]), parseInt(data_info[1])-1, parseInt(data_info[0])); \r\n\t\r\n\tif (data_info_modificada.getDay() >= dia_semana_inicio && data_info_modificada.getDay() <= dia_semana_fim && (horario_informado < horario_util_inicio || horario_informado > horario_util_fim))\r\n\t\treturn false;\r\n\telse\r\n\t\treturn true;\r\n}", "title": "" }, { "docid": "00926584de141bb89b5d509b438ab49f", "score": "0.5593444", "text": "function checkForValidLeaveDates() {\n\tvar userId = $(\"#userId\").val();\n\tvar fromDate = $(\"#fromDate\").val();\n\tvar toDate = $(\"#toDate\").val();\n\tvalidateLeaveDates.checkForValidLeaveDates(userId, fromDate, toDate,\n\t\t\tloadLeaveDatesCheck);\n}", "title": "" }, { "docid": "c814ccbabce49c6baeed4b26af9727c7", "score": "0.5592185", "text": "function validate(){ \n var mottoTime = getProperty(\"this\", \"mottoTime\")\n var year = trimString(getProperty(\"this\", \"year\"));\n var week = getCleanList(getProperty(\"this\", \"week\"));\n var monday = getCleanList(getProperty(\"this\", \"monday\"));\n var tuesday = getCleanList(getProperty(\"this\", \"tuesday\"));\n var wednesday = getCleanList(getProperty(\"this\", \"wednesday\"));\n var thursday = getCleanList(getProperty(\"this\", \"thursday\"));\n var friday = getCleanList(getProperty(\"this\", \"friday\"));\n var saturday = getCleanList(getProperty(\"this\", \"saturday\"));\n var sunday = getCleanList(getProperty(\"this\", \"sunday\"));\n var dayAfter = getCleanList(getProperty(\"this\", \"dayAfter\"));\n var holidays = getCleanList(getProperty(\"this\", \"holidays\"));\n var plan = trimString(getProperty(\"this\", \"plan\"));\n \n \n var result = [];\n \n if (mottoTime === \"\") {\n var validationResult = \"mottoTime is required\";\n logMessage(validationResult);\n result.push(validationResult);\n } else if (!exists(mottoTime)) {\n var validationResult = \"mottoTime '\" + mottoTime + \"' not found\";\n logMessage(validationResult);\n result.push(validationResult);\n }\n \n if (year === \"\") {\n var validationResult = \"year is required\";\n logMessage(validationResult);\n result.push(validationResult);\n }\n \n if (year < 2019 || year > 2050) { //Beware: this is arbitrary\n var validationResult = \"year should be >= 2019 and <= 2050\";\n logMessage(validationResult);\n result.push(validationResult);\n }\n \n if (week.length < 1) {\n var validationResult = \"at least 1 week is required\";\n logMessage(validationResult);\n result.push(validationResult);\n }\n \n for (var i = 0; i < week.length; i++){\n if (week[i] < 1 || week[i] > 53) {\n var validationResult = \"week '\" + week[i] + \"' is not a valid value\";\n logMessage(validationResult);\n result.push(validationResult);\n }\n }\n \n for (var i = 0; i < monday.length; i++){\n if (!exists(monday[i],\"trigger/motto/timeSlot\")) {\n var validationResult = \"monday timeslot '\" + monday[i] + \"' not found\";\n logMessage(validationResult);\n result.push(validationResult);\n }\n }\n\n for (var i = 0; i < tuesday.length; i++){\n if (!exists(tuesday[i],\"trigger/motto/timeSlot\")) {\n var validationResult = \"tuesday timeslot '\" + tuesday[i] + \"' not found\";\n logMessage(validationResult);\n result.push(validationResult);\n }\n }\n \n for (var i = 0; i < wednesday.length; i++){\n if (!exists(wednesday[i],\"trigger/motto/timeSlot\")) {\n var validationResult = \"wednesday timeslot '\" + wednesday[i] + \"' not found\";\n logMessage(validationResult);\n result.push(validationResult);\n }\n }\n \n for (var i = 0; i < thursday.length; i++){\n if (!exists(thursday[i],\"trigger/motto/timeSlot\")) {\n var validationResult = \"thursday timeslot '\" + thursday[i] + \"' not found\";\n logMessage(validationResult);\n result.push(validationResult);\n }\n }\n \n for (var i = 0; i < friday.length; i++){\n if (!exists(friday[i],\"trigger/motto/timeSlot\")) {\n var validationResult = \"friday timeslot '\" + friday[i] + \"' not found\";\n logMessage(validationResult);\n result.push(validationResult);\n }\n }\n \n for (var i = 0; i < saturday.length; i++){\n if (!exists(saturday[i],\"trigger/motto/timeSlot\")) {\n var validationResult = \"saturday timeslot '\" + saturday[i] + \"' not found\";\n logMessage(validationResult);\n result.push(validationResult);\n }\n }\n \n for (var i = 0; i < sunday.length; i++){\n if (!exists(sunday[i],\"trigger/motto/timeSlot\")) {\n var validationResult = \"sunday timeslot '\" + sunday[i] + \"' not found\";\n logMessage(validationResult);\n result.push(validationResult);\n }\n }\n\n for (var i = 0; i < holidays.length; i++){\n if (!exists(holidays[i],\"trigger/motto/timeSlot\")) {\n var validationResult = \"holiday timeslot '\" + holidays[i] + \"' not found\";\n logMessage(validationResult);\n result.push(validationResult);\n }\n }\n \n if (plan === \"\") {\n var validationResult = \"Scenario is required\";\n logMessage(validationResult);\n result.push(validationResult);\n }\n \n if (plan !== \"\") {\n if (!exists(plan, \"plans\")) {\n var validationResult = \"Scenario '\" + plan + \"' not found\";\n logMessage(validationResult);\n result.push(validationResult);\n }\n }\n \n if (result.length === 0) { \n setProperty(\"this\", \"validationResult\", \"OK\"); \n return true\n } else {\n setProperty(\"this\", \"validationResult\", result.join(\", \")); \n return false\n }\n}", "title": "" }, { "docid": "7992f4f439f142689bc3edad31eaa019", "score": "0.5591491", "text": "validateDate() {\n let value = this.date.value;\n let min = dayjs(this.date.min).startOf('day');\n let max = dayjs();\n let errorMessage = null;\n\n if (!this.inThisMoment) {\n if (!isEmpty(value)) {\n let date = dayjs(value, 'YYYY-MM-DD').startOf('day');\n if (date.isSameOrAfter(min)) {\n if (date.isSameOrBefore(max)) {\n this.date.isOk();\n //Se valida la hora\n if (this.setTime) {\n this.validateTime();\n }\n\n return true;\n } else {\n errorMessage = \"No se pueden agregar gastos en el futuro.\";\n }\n } else {\n errorMessage = \"La fecha debe ser mayor a la fecha del lote\";\n }\n } else {\n errorMessage = \"Se debe elegir una fecha valida\";\n }\n } else {\n return true;\n }\n\n this.date.setError(errorMessage);\n return false;\n }", "title": "" }, { "docid": "f54852410d35ea0db6ffa3685ac1b7ac", "score": "0.5582624", "text": "function validateEditForm(formObj) {\n clearNotice();\n\n var resourceName = formObj.resource_name.value\n startDate = formObj.start_date.value;\n\tstartTime = formObj.start_time.value;\n\tendDate = formObj.end_date.value;\n\tendTime = formObj.end_time.value;\n\n\tif(resourceName.length == 0) {\n addError('Please select a resource.');\n }\n\n\tif(startDate.trim().length == 0) {\n\t addError('Please enter start date.');\n\t}\n\t\n\tif(startTime.trim().length == 0) {\n addError('Please enter start time.');\n }\n\t\n\tif(endDate.trim().length == 0) {\n addError('Please enter end date.');\n }\n\t\n\tif(endTime.trim().length == 0) {\n addError('Please enter end time.');\n }\n\n\tif(startDate.trim().length != 0 && isValidDate(startDate)) {\n addError('Please enter valid start date.');\n }\n\tif(startTime.trim().length != 0 && isValidTime(startTime)) {\n addError('Please enter valid start time.');\n }\n\tif(endDate.trim().length != 0 && isValidDate(endDate)) {\n addError('Please enter valid end date.');\n }\n\tif(endTime.trim().length != 0 && isValidTime(endTime)) {\n addError('Please enter valid end time.');\n }\n\t\n\tif (Date.parse(endDate.value + \" \" + endTime.value) < Date.parse(startDate.value + \" \" + startTime.value)) {\n\t addError('End Date and time cannot be before start date and time.');\n\t}\n\t\n\tif(((Math.round(Date.parse(endDate.value+\" \"+endTime.value) - Date.parse(startDate.value+\" \"+startTime.value))/1000)/60 < 10 ) && error == 0){\n\t addError('Time difference must be greater than 10 minutes.');\n\t}\n\n\tif (hasErrorNotice()) {\n displayNotice();\n return false;\n }\n\tdisableButton();\n return true;\n}", "title": "" }, { "docid": "82ae9d686c698f8993859ac817a0c668", "score": "0.5582218", "text": "function Check_register()\n{\n\t//date of birth of the cow\n\t\tvar birth_date=document.forms['register_cow']['dob'].value;\n \t\tvar split=birth_date.split('-');\n \t\tvar year=split[0];\n \t\tvar month=split[1];\n \t\tvar date=split[2];\n\n \t\tvar x=new Date();\n\t\tx.setFullYear(year,month-1, date);\n \t\tvar today=new Date();\n\n\t\tif (x>today)\n\t\t {\n\t\t \tvar y=document.getElementById(\"form_dob\");\n \t\t\ty.innerHTML=\"Error: Invalid Date of Birth\";\n\t\t\n\t\t \treturn false;\n\t\t }\n\n\t//validate breed;\n\tvar breed=document.forms['register_cow']['breed'].value;\n\n\tif(breed==''||breed==null)\n\t{\n\t\talert('Breed Field-Value Required');\n\t\treturn false;\n\t}\n\n\n}", "title": "" }, { "docid": "a7ade7c4c95dcd7f5763b6623ecf5cfc", "score": "0.55788374", "text": "function validate()\n {\n \n if( document.paymentForm.CardName.value == \"\" )\n {\n alert( \"Please provide your name!\" );\n document.paymentForm.CardName.focus() ;\n return false;\n }\n \n if( document.paymentForm.CardType.value == \"-1\" )\n {\n alert( \"Please provide your card type!\" );\n return false;\n }\n\n if( document.paymentForm.CardNumber.value == \"\" ||\n isNaN( document.paymentForm.CardNumber.value ) ||\n document.paymentForm.CardNumber.value.length != 16 )\n {\n alert( \"Please provide your card number which is 16 digit number.\" );\n document.paymentForm.CardNumber.focus() ;\n return false;\n }\n\n if( document.paymentForm.ExpireMonth.value == \"-1\" )\n {\n alert( \"Please provide expire month!\" );\n return false;\n }\n\n if( document.paymentForm.ExpireYear.value == \"-1\" )\n {\n alert( \"Please provide expire year!\" );\n return false;\n }\n\n if( document.paymentForm.CVVNumber.value == \"\" ||\n isNaN( document.paymentForm.CVVNumber.value ) ||\n document.paymentForm.CVVNumber.value.length != 3)\n {\n alert( \"Please provide your CVV number which is 3 digit number.\" );\n document.paymentForm.CVVNumber.focus() ;\n return false;\n }\n \n return( true );\n }", "title": "" }, { "docid": "47c05338b34b8ddedb59855d23778d29", "score": "0.5574648", "text": "function timeTravel() {\n\t\tconst foundErrors = [];\n\t\tconst reservationUTC = new Date(`${formData.reservation_date} ${formData.reservation_time} GMT-0400`);\n\n\t\tconst closedTimes = formData.reservation_time;\n\t\tif (reservationUTC.getDay() === 2) {\n\t\t\tfoundErrors.push(\"Ya done goofed\");\n\t\t}\n\t\tif (reservationUTC.getTime() < Date.now()) {\n\t\t\tfoundErrors.push(\"place reservation in the future, Doc\");\n\t\t}\n\t\tif (closedTimes.localeCompare(\"10:30\") === -1) {\n\t\t\tfoundErrors.push(\"Closed at this time\")\n\t\t}\n\t\tif (closedTimes.localeCompare(\"21:30\") === 1) {\n\t\t\tfoundErrors.push(\"Closed at this time\");\n\t\t}\n\t\tif (closedTimes.localeCompare(\"21:00\") === 1) {\n\t\t\tfoundErrors.push(\"Closed at this time\");\n\t\t}\n\t\treturn foundErrors;\n\t}", "title": "" }, { "docid": "b60ea3902658e95f9d443aeabbc8bbac", "score": "0.5573273", "text": "function validate() {\n return $scope.tripReport.title !== \"\" &&\n !$scope.badDate() &&\n $scope.tripReport.body !== \"\"\n }", "title": "" }, { "docid": "89ef4b4621609cfef758be54593c1f61", "score": "0.5569929", "text": "handleScheduleApt () {\n\t\tif (this.bothFieldsFilled()) {\n\t\t\tAppointmentActions.updateAppointmentReservee(this.state.reserveeText);\n\t\t}\n\t}", "title": "" }, { "docid": "37882d620d26efc28003e5476aeb2629", "score": "0.5567594", "text": "function validateOverRangeWhenAdd(){\n\t\tif($(\"#addFabricSupplierDialog\").find(\"#txtFabricSupplierCode\").val().length>50 || $(\"#addFabricSupplierDialog\").find(\"#txtShortName\").val().length>50 \n\t\t\t\t|| $(\"#addFabricSupplierDialog\").find(\"#txtLongName\").val().length>100 || $(\"#addFabricSupplierDialog\").find(\"#txtAddress\").val().length>200\n\t\t\t\t|| $(\"#addFabricSupplierDialog\").find(\"#txtTel\").val().length>50 || $(\"#addFabricSupplierDialog\").find(\"#txtFax\").val().length>50\n\t\t\t\t|| $(\"#addFabricSupplierDialog\").find(\"#txtTaxNo\").val().length>50)\n\t\t\treturn false;\n\t\treturn true;\n\t}", "title": "" }, { "docid": "6e349456a314899af48dc891cd1baf88", "score": "0.555112", "text": "function validateStart(){\n $classStart = DOTB.util.DateUtils.parse($('#class_start').val(),cal_date_format).getTime();\n $classEnd = DOTB.util.DateUtils.parse($('#class_end').val(),cal_date_format).getTime();\n //get date start study\n $date_start = DOTB.util.DateUtils.parse($('#start_study').val(),cal_date_format);\n if($date_start==false){\n toastr.error('Invalid date');\n $('#start_study').val('');\n }else{\n $start = $date_start.getTime();\n if($start < $classStart || $start > $classEnd){\n toastr.error('Invalid date range. Please, choose another date!!')\n $('#start_study').val('');\n }\n }\n}", "title": "" }, { "docid": "f2ddb43f1ec7b8f61dd51e8c1e393881", "score": "0.5548438", "text": "validateIDRange(client, assignment, id) {\n\n if (!client.assignments || client.assignments.length == 1) return true;\n client.assignments.forEach(item => {\n if (item.firstID === null || item.firstID == \"\" || item.lastID === null || item.lastID === \"\") {\n return this.dialog.showMessage(\n \"You must enter the ID range manually with this client.\",\n \"Manual Assignment\",\n ['OK']\n ).whenClosed(response => {\n return true;\n });\n }\n })\n var valid = true;\n var x1 = parseInt(assignment.firstID);\n var x2 = parseInt(assignment.lastID);\n for (var i = 0; i < client.assignments.length - 1; i++) {\n // if(this.existingRequest && client.assignments[i].assignment == id){\n var y1 = parseInt(client.assignments[i].firstID);\n var y2 = parseInt(client.assignments[i].lastID);\n if (x1 === y1 && x2 === y2) {\n continue;\n } else {\n if (!(x2 < y1 || x1 > y2)) valid = false;\n }\n }\n return valid;\n }", "title": "" }, { "docid": "8d0617e29f7d33296c762edb43de7f47", "score": "0.5546889", "text": "function schedulesConfigValidate(frmId){\n\n var txtFieldIdArr = new Array();\n txtFieldIdArr[0] = \"tf1_scheduleName,Please enter valid Schedule Name\";\n txtFieldIdArr[1] = \"tf1_dateTimePickerStartValue,Please enter valid Start Time \";\n txtFieldIdArr[2] = \"tf1_dateTimePickerEndValue,Please enter valid End Time \";\n\n if (txtFieldArrayCheck(txtFieldIdArr) == false) \n\t\t\treturn false;\n\n /* added check for not allowing space as first character starts */\n var scheduleObj = document.getElementById('tf1_scheduleName');\n if ( scheduleObj.value.charAt(0) == ' ' )\n {\n alert(\"Schedule Name cannot start with space character\");\n scheduleObj.focus();\n return false;\n }\n /* added check for not allowing space as first character ends */\n\n var usrObj = document.getElementById('tf1_scheduleName');\n if ( validScheduleName(usrObj.value) == false ) {\n\t\t\talert(\"Schedule Name cannot have special characters\");\n\t\t\tusrObj.focus();\n\t\t\treturn false;\n }\n\n if(compareTimes(\"tf1_dateTimePickerStartValue\", \"tf1_dateTimePickerEndValue\") == false)\n\t\treturn false;\n\t\t\n setHiddenChks(frmId); \n return true;\n}", "title": "" }, { "docid": "e3d8bc88935e5bbeb51d7b8822e6813a", "score": "0.5545193", "text": "function validar_campos_vacio(campo_vacio){\n if(campo_vacio==\"\"){\n /////////////////LOS CAMPOS ESTAN VACIOS DEBES COMPLETAR///////////\n /////////////////LOS CAMPOS ESTAN VACIOS DEBES COMPLETAR///////////\n /////////////////LOS CAMPOS ESTAN VACIOS DEBES COMPLETAR///////////\n return false;\n\n }else{\n return true;\n }\n }", "title": "" }, { "docid": "1fb6b128e42d277ce56cf09c885af2ce", "score": "0.55451024", "text": "function validateStartIsBeforeEndDate() {\n if (moment(endDate).isBefore(startDate)) {\n alert('Error: The Start Date must be before the End Date.');\n $startDate.addClass('is-invalid');\n $endDate.addClass('is-invalid');\n allInputsAreValid = false;\n } else {\n $startDate.removeClass('is-invalid');\n $endDate.removeClass('is-invalid');\n }\n }", "title": "" }, { "docid": "4c1be7105b731d98e7557da08396eb0f", "score": "0.55413246", "text": "function validarDeducibleRC() {\t\r\n\tvar valorDeducibleRC = Number($('#deducible_rc').val());\r\n\tvar valorDeducibleRCDefecto = Number($('#deducible_rc_defecto').val());\r\n\tif (valorDeducibleRC < valorDeducibleRCDefecto) {\r\n\t\talert('El Porcentaje del deducible de RC debe ser mayor o igual a: ' + valorDeducibleRCDefecto);\r\n\t}\r\n}", "title": "" }, { "docid": "6d95abf504924c2042ef6df4bf0f711c", "score": "0.55390114", "text": "function validateEnd(){\n $classStart = DOTB.util.DateUtils.parse($('#class_start').val(),cal_date_format).getTime();\n $classEnd = DOTB.util.DateUtils.parse($('#class_end').val(),cal_date_format).getTime();\n //get date start study\n $date_end = DOTB.util.DateUtils.parse($('#end_study').val(),cal_date_format);\n if($date_end==false){\n toastr.error('Invalid date');\n $('#end_study').val('');\n }else{\n $end = $date_end.getTime();\n if($end < $classStart || $end > $classEnd){\n toastr.error('Invalid date range. Please, choose another date!!')\n }\n }\n}", "title": "" }, { "docid": "8fb0d4694b6f1338f2473b7c59ce3e7a", "score": "0.5535249", "text": "function seatAvailable(seat_id, date, start_time, end_time, user_id){\r\n // Get reservations, seats, and types JSON from local storage\r\n var reservations = JSON.parse(localStorage.getItem(\"reservation_json\"));\r\n reservations = reservations.reservations;\r\n\r\n // Loop through reservations and add taken seats to reserved_seats\r\n for(var i = 0; i < reservations.length; i++){\r\n // If the date matches and the time's overlap, add the seat to reserved_seats\r\n if(reservations[i].date === date && \r\n ((reservations[i].end_time < end_time && reservations[i].end_time > start_time) || \r\n (reservations[i].start_time > start_time && reservations[i].start_time < end_time) ||\r\n (reservations[i].start_time <= start_time && reservations[i].end_time >= end_time) ||\r\n (reservations[i].start_time === start_time && reservations[i].end_time === end_time))){\r\n\r\n // If you already have a reservation at this time, return -2\r\n if(reservations[i].user_id === user_id){\r\n return -2;\r\n }\r\n // Otherwise, if the seat is the same, return the reserve_id \r\n else if(reservations[i].seat_id === seat_id) {\r\n return reservations[i].reserve_id;\r\n }\r\n }\r\n }\r\n \r\n return -1;\r\n}", "title": "" }, { "docid": "3aa3843ee9d95e804417aa7b4d2a2224", "score": "0.5530536", "text": "function venueValidation(req, res, next) {\n req.check('venueName', 'Invalid name').notEmpty();\n req.check('venueAddress', 'Invalid address').notEmpty();\n req.check('venueLatitude', 'Invalid coordinates for latitude').isFloat();\n req.check('venueLongitude', 'Invalid coordinates for longitude').isFloat();\n var validationErrors = req.validationErrors(true);\n if (validationErrors) {\n res.status(config.http.BAD_RESPONSE_CODE).send(config.responses.BAD_VENUE_DETAILS);\n } else {\n next();\n }\n}", "title": "" }, { "docid": "70ab68f907073c22dc96ec342de22e9c", "score": "0.55291027", "text": "function isInventoryFormValid(){\n\t\t\t return(FirstNameField.isValid() && LastNameField.isValid() && DeptField.isValid() && BuildingField.isValid() && RoomField.isValid() && TagField.isValid()\n\t\t\t&& PurchaseDateField.isValid() && PurchaseByField.isValid() && MakeField.isValid() && ModelField.isValid() && SerialField.isValid() && LocationField.isValid()\n\t\t\t&& OperatingSystemField.isValid() && MacAddressField.isValid() && WirelessMacAddressField.isValid() && PrinterField.isValid() && NotesField.isValid());\n\t\t }", "title": "" }, { "docid": "1f1d8ebea3386362faa6266719f96e2d", "score": "0.55228543", "text": "validate(startDate) {\n let validDate = startDate === \"\" || /^\\d{4}-\\d{2}-\\d{2}$/.test(startDate);\n return validDate;\n }", "title": "" }, { "docid": "e2731f4935f7d8066f016e06e213d00d", "score": "0.5522138", "text": "function validarFormulario(){\n var txtDesc = document.getElementById('memodetDesc').value;\n var txtNumOcChc = document.getElementById('memodetNumOcChc').value;\n var txtCdp = document.getElementById('memodetCdp').value;\n var txtNumOcMan = document.getElementById('memodetNumOcMan').value;\n var txtNumFact = document.getElementById('memodetNumFact').value;\n var txtFechFact = document.getElementById('memodetFechFact').value;\n var txtMonTotal = document.getElementById('memodetMonTotal').value;\n var txtObs = document.getElementById('memodetObs').value;\n //Test campo obligatorio\n if(txtDesc == null || txtDesc.length == 0 || /^\\s+$/.test(txtDesc)){\n alert('ERROR: El campo no debe ir vacío o con espacios en blanco');\n document.getElementById('memodetDesc').focus();\n return false;\n }\n if(txtNumOcChc == null || txtNumOcChc.length == 0 || /^\\s+$/.test(txtNumOcChc)){\n alert('ERROR: El campo no debe ir vacío o con espacios en blanco');\n document.getElementById('memodetNumOcChc').focus();\n return false;\n }\n if(txtCdp == null || txtCdp.length == 0 || /^\\s+$/.test(txtCdp)){\n alert('ERROR: El campo no debe ir vacío o con espacios en blanco');\n document.getElementById('memodetCdp').focus();\n return false;\n }\n if(txtNumOcMan == null || txtNumOcMan.length == 0 || /^\\s+$/.test(txtNumOcMan)){\n alert('ERROR: El campo no debe ir vacío o con espacios en blanco');\n document.getElementById('memodetNumOcMan').focus();\n return false;\n }\n if(txtNumFact == null || txtNumFact.length == 0 || /^\\s+$/.test(txtNumFact)){\n alert('ERROR: El campo no debe ir vacío o con espacios en blanco');\n document.getElementById('memodetNumFact').focus();\n return false;\n }\n if(txtFechFact == null || txtFechFact.length == 0 || /^\\s+$/.test(txtFechFact)){\n alert('ERROR: El campo no debe ir vacío o con espacios en blanco');\n document.getElementById('memodetFechFact').focus();\n return false;\n }\n if(txtMonTotal == null || txtMonTotal.length == 0 || /^\\s+$/.test(txtMonTotal)){\n alert('ERROR: El campo no debe ir vacío o con espacios en blanco');\n document.getElementById('memodetMonTotal').focus();\n return false;\n }\n if(txtObs == null || txtObs.length == 0 || /^\\s+$/.test(txtObs)){\n alert('ERROR: El campo no debe ir vacío o con espacios en blanco');\n document.getElementById('memodetObs').focus();\n return false;\n } \n return true;\n }", "title": "" }, { "docid": "1d678e40079884f1e760d7f14c4ecdae", "score": "0.5515671", "text": "function isValidData(data) {\n debug('validating data');\n\n var name = data.name;\n var phone = data.phone;\n var date = getDate();\n var partySize = data.party;\n var time = data.time;\n var valid = true;\n\n if (!time || time === 0) {\n addAlert('time', 'Time selected is invalid.');\n valid = false;\n }\n\n if (isNaN(date)) {\n addAlert('date', 'Date is an invalid format.');\n valid = false;\n }\n\n if (!date) {\n addAlert('date', 'You must select a date.');\n valid = false;\n }\n\n if (date.valueOf() < midnight(new Date()).valueOf()) {\n addAlert('date', 'Date selected is in the past.');\n valid = false;\n }\n\n if (!name || name.length < 1 || name.length > 50) {\n addAlert('name', 'Name must be between 1 and 50 characters.');\n valid = false;\n }\n\n if (!phone || isNaN(phone) || phone < 1000000000 || phone > 9999999999) {\n addAlert('phone', 'Phone number must be in the format ########## and 10 digits.');\n valid = false;\n }\n\n if (!partySize || isNaN(partySize) || partySize < 1 || partySize > 99) {\n addAlert('partySize', 'Party Size must be between 1 and 99 people.');\n valid = false;\n }\n\n return valid;\n}", "title": "" }, { "docid": "4dbb763dd070f6e75a97d0ba02dc595f", "score": "0.5503929", "text": "async function validateSeat(req, res, next) {\n if (res.locals.course.status === \"occupied\") {\n return next({ status: 400, message: \"the course you selected is currently occupied\" });\n }\n\n if (res.locals.student.status === \"seated\") {\n return next({ status: 400, message: \"the student you selected is already seated\" });\n }\n\n if (res.locals.course.capacity < res.locals.student.people) {\n return next({ status: 400, message: `the course you selected does not have enough capacity to seat ${res.locals.student.people} people` });\n }\n\n next();\n}", "title": "" }, { "docid": "830cf19f695f9b600dff6d050b98184a", "score": "0.5499349", "text": "function validar () {\r\n\t/*******************************************************************************\r\n\t Se obtienen los elementos del html\r\n\t*******************************************************************************/\r\n\t\t/*Elemento de cantidad de articulo */\r\n var eltxtCantidad = document.querySelector('#txtCantidad');\r\n\t/*******************************************************************************\r\n\t Se obtienen los valores de los elementos del html\r\n\t*******************************************************************************/\r\n\t\t/*Valor de articulo*/\r\n\tvar svelcbxArticulo\t=\telcbxArticulo.value;\r\n\t\t/*Valor de tipo articulo */\r\n\tvar svelcbxTipoArticulo\t=\telcbxTipoArticulo.value;\r\n\t\t/*Valor de cantidad*/\r\n\tvar sveltxtCantidad\t=\teltxtCantidad.value;\r\n\r\n\t/*******************************************************************************\r\n\t Se ejecuta la funcion para registrar la lsita\r\n\t*******************************************************************************/\r\n\tagregarArticulo(svelcbxArticulo, svelcbxTipoArticulo, sveltxtCantidad);\r\n\t\t/*Se returna false para evitar la recarga de la pagina */\r\n\treturn false;\r\n}", "title": "" }, { "docid": "6ed7a8d7a7e8aba95dd41f76d71d0d66", "score": "0.5495802", "text": "function validar_vacio(input, valor){\r\n\t if(valor==input || input ==\"\"){\r\n\t return false;\r\n\t }\r\n\t else return true;\r\n\t}", "title": "" }, { "docid": "113738a7c6ba5ff26f03d8607e5926aa", "score": "0.5488267", "text": "function validateEvent() {\n var name = validIntro(document.forms.add_event_form.event_name.value);\n var intro = validIntro(document.forms.add_event_form.event_intro.value);\n var loc = validName(document.forms.add_event_form.event_loc.value);\n //var date = validIntro(document.forms.add_event_form.event_name.value);\n if (!name) {\n showError(\"event_error_message\", \"Please enter a valid name.\");\n }\n if (!intro) {\n showError(\"event_error_message\", \"Please enter a valid introduction between 0 ~ 1000 characters!\");\n }\n if (!loc) {\n showError(\"event_error_message\", \"Please enter a valid location!\");\n }\n var isValidEvent = name && intro && loc;\n if (isValidEvent) {\n showError(\"event_error_message\", \"Event Added!\");\n }\n return isValidEvent;\n}", "title": "" }, { "docid": "ee0fb48d99cb72c89c44018c74a1a952", "score": "0.5481579", "text": "static validateTenure(tenure) {\n this.validationResult = { \"status\": true };\n\n if(tenure === \"\") {\n this.validationResult[\"status\"] = false;\n this.validationResult[\"message\"] = \"Tenure is required.\";\n } else if(isNaN(tenure)) {\n this.validationResult[\"status\"] = false;\n this.validationResult[\"message\"] = \"Tenure should be a numeric value.\";\n } else if(tenure < 1 || tenure > 12) {\n this.validationResult[\"status\"] = false;\n this.validationResult[\"message\"] = \"Tenure should be between 1 and 12 months only.\";\n }\n\n return this.validationResult;\n }", "title": "" } ]
1c1ceccfdc1ec6494627b9bfcaf8bf33
fire a dom event reliably:
[ { "docid": "30d66420e6603400f0c9b8c8523780f6", "score": "0.57655126", "text": "function eventFire(el, etype){\n if (el.fireEvent) {\n (el.fireEvent('on' + etype));\n } else {\n var evObj = document.createEvent('Events');\n evObj.initEvent(etype, true, false);\n el.dispatchEvent(evObj);\n }\n}", "title": "" } ]
[ { "docid": "5960c25ab9a936f7927e7059d8734418", "score": "0.68008816", "text": "function pretend(elem, ev) {\r\n\tdocument.querySelector(elem).dispatchEvent(new Event(ev));\r\n}", "title": "" }, { "docid": "39c1b9397c7838b696089e619419d697", "score": "0.64866173", "text": "function fireEvent(element, event){\nif (document.createEventObject) {\n// dispatch for IE\nvar evt = document.createEventObject();\nreturn element.fireEvent('on'+event,evt);\n}\nelse{\n// dispatch for firefox + others\nvar evt = document.createEvent(\"HTMLEvents\");\nevt.initEvent(event, true, true ); // event type,bubbling,cancelable\nreturn !element.dispatchEvent(evt);\n}\n}", "title": "" }, { "docid": "0f00ead2af1ff7628cd6945bf31138ed", "score": "0.6467542", "text": "function fireOnchange(targetElement) {\n var myEvent = document.createEvent('HTMLEvents');\n myEvent.initEvent('change', true, false);\n targetElement.dispatchEvent(myEvent);\n }", "title": "" }, { "docid": "81f4f8c437f9df2fe64ce50f5b296fee", "score": "0.63053083", "text": "function handleDomEvent () {\n\t\tthis._ractive.binding.handleChange();\n\t}", "title": "" }, { "docid": "2bd1f1fda7ce1a8b4887a830b0fb82e6", "score": "0.62757015", "text": "dispatch(eventName: string, element: HTMLElement, instruction: LifeCycleStrategy): void {\n let suppressEvents = instruction ? instruction.suppressEvents : false;\n if (!suppressEvents) {\n return triggerDOMEvent(eventName, element);\n }\n }", "title": "" }, { "docid": "85c001ea845773ef7430426469e9b308", "score": "0.6266469", "text": "function fireEvent(node, eventName) {\r\n // Make sure we use the ownerDocument from the provided node to avoid cross-window problems\r\n var doc;\r\n if (node.ownerDocument) {\r\n doc = node.ownerDocument;\r\n } else if (node.nodeType == 9){\r\n // the node may be the document itself, nodeType 9 = DOCUMENT_NODE\r\n doc = node;\r\n } else {\r\n throw new Error(\"Invalid node passed to fireEvent: \" + node.id);\r\n }\r\n\r\n if (node.dispatchEvent) {\r\n // Gecko-style approach (now the standard) takes more work\r\n var eventClass = \"\";\r\n\r\n // Different events have different event classes.\r\n // If this switch statement can't map an eventName to an eventClass,\r\n // the event firing is going to fail.\r\n switch (eventName) {\r\n case \"click\": // Dispatching of 'click' appears to not work correctly in Safari. Use 'mousedown' or 'mouseup' instead.\r\n case \"mousedown\":\r\n case \"mouseup\":\r\n eventClass = \"MouseEvents\";\r\n break;\r\n\r\n case \"focus\":\r\n case \"change\":\r\n case \"blur\":\r\n case \"select\":\r\n eventClass = \"HTMLEvents\";\r\n break;\r\n\r\n default:\r\n throw \"fireEvent: Couldn't find an event class for event '\" + eventName + \"'.\";\r\n break;\r\n }\r\n var event = doc.createEvent(eventClass);\r\n event.initEvent(eventName, true, true); // All events created as bubbling and cancelable.\r\n\r\n event.synthetic = true; // allow detection of synthetic events\r\n // The second parameter says go ahead with the default action\r\n node.dispatchEvent(event, true);\r\n } else if (node.fireEvent) {\r\n // IE-old school style, you can drop this if you don't need to support IE8 and lower\r\n var event = doc.createEventObject();\r\n event.synthetic = true; // allow detection of synthetic events\r\n node.fireEvent(\"on\" + eventName, event);\r\n }\r\n}", "title": "" }, { "docid": "395859aef6122511a6da491d553f05c5", "score": "0.6239871", "text": "function do_click(element) {var evt = document.createEvent(\"HTMLEvents\"); evt.initEvent(\"click\", true, true); element.dispatchEvent(evt);}", "title": "" }, { "docid": "0294510e8d1b6d60ee674b91613b8d09", "score": "0.6237151", "text": "function fireEvent(element,event){\r\n if (document.createEventObject){\r\n // dispatch for IE\r\n var evt = document.createEventObject();\r\n return element.fireEvent('on'+event,evt)\r\n }\r\n else{\r\n // dispatch for firefox + others\r\n var evt = document.createEvent(\"HTMLEvents\");\r\n evt.initEvent(event, true, true ); // event type,bubbling,cancelable\r\n return !element.dispatchEvent(evt);\r\n }\r\n}", "title": "" }, { "docid": "9c124ad55b47d779ec414b2e79d4194e", "score": "0.618063", "text": "function dispatchEvent() {\n\t\t$(this.element).trigger('gumby.onInsert');\n\t}", "title": "" }, { "docid": "e8a96cc476153b75832dc6756e43be82", "score": "0.61732066", "text": "static triggerEvent(eventName) {\n if (!eventName) return;\n\n let event;\n event = document.createEvent('HTMLEvents');\n event.initEvent(eventName, true, true);\n document.dispatchEvent(event);\n }", "title": "" }, { "docid": "af3effdf5d51ccc27c248a8d4134b066", "score": "0.6140844", "text": "function _trigger (type,element){\n //to-do , cross IE < 9\n var event = document.createEvent('MouseEvents');\n event.initEvent(type,true,true);\n element.dispatchEvent(event);\n }", "title": "" }, { "docid": "af6c0092c4786effd814a12dbb488524", "score": "0.6131344", "text": "function fireEvent(element, event) {\n var evt;\n if (document.createEventObject) {\n // dispatch for IE\n evt = document.createEventObject();\n return element.fireEvent('on' + event, evt);\n }\n // otherwise, dispatch for Firefox, Chrome + others\n evt = document.createEvent('HTMLEvents');\n evt.initEvent(event, true, true); // event type,bubbling,cancelable\n return !element.dispatchEvent(evt);\n }", "title": "" }, { "docid": "af6c0092c4786effd814a12dbb488524", "score": "0.6131344", "text": "function fireEvent(element, event) {\n var evt;\n if (document.createEventObject) {\n // dispatch for IE\n evt = document.createEventObject();\n return element.fireEvent('on' + event, evt);\n }\n // otherwise, dispatch for Firefox, Chrome + others\n evt = document.createEvent('HTMLEvents');\n evt.initEvent(event, true, true); // event type,bubbling,cancelable\n return !element.dispatchEvent(evt);\n }", "title": "" }, { "docid": "55235e2ea4d572412c0dcb4d53afbd86", "score": "0.6114277", "text": "DOMChanged(root) {}", "title": "" }, { "docid": "c7f9f509488d276763c628585bfaac79", "score": "0.61088896", "text": "function fireEvent(element, event) {\n if (document.createEventObject) {\n\t\t// dispatch for IE\n\t\tvar evt = document.createEventObject();\n\t\treturn element.fireEvent('on'+event,evt)\n } else {\n\t\t// dispatch for firefox + others\n\t\tvar evt = document.createEvent(\"HTMLEvents\");\n\t\tevt.initEvent(event, true, true ); // event type,bubbling,cancelable\n\t\treturn !element.dispatchEvent(evt);\n }\n}", "title": "" }, { "docid": "58820b6c1933836662d8e35678c1892d", "score": "0.6092111", "text": "function fireDOMOperation() {\n if ( !fireDOMOperation.hasBeenRun ) {\n fireDOMOperation.hasBeenRun = true;\n domOperation();\n }\n }", "title": "" }, { "docid": "b71048ffe0748910dc4ced0a4d41d8e1", "score": "0.60784954", "text": "dispatchEvent( event_in ){\n this.container.dispatchEvent( event_in )\n }", "title": "" }, { "docid": "b3d6215a0493320fbfd3612804faf5d2", "score": "0.6068697", "text": "_insertTestValue_imitateEvent(el) {\n el.dispatchEvent(new Event('change'));\n }", "title": "" }, { "docid": "0c0320995b819b3dba6a517bbcd3e324", "score": "0.60521835", "text": "function fireDOMOperation() {\n if (!fireDOMOperation.hasBeenRun) {\n fireDOMOperation.hasBeenRun = true;\n domOperation();\n }\n }", "title": "" }, { "docid": "ace830cd4bc7804c5d439cecff135d56", "score": "0.6051299", "text": "function triggerEvent( elem, type, event ) {\n\tif ( jQuery.browser.mozilla || jQuery.browser.opera ) {\n\t\tevent = document.createEvent(\"MouseEvents\");\n\t\tevent.initMouseEvent(type, true, true, elem.ownerDocument.defaultView,\n\t\t\t0, 0, 0, 0, 0, false, false, false, false, 0, null);\n\t\telem.dispatchEvent( event );\n\t} else if ( jQuery.browser.msie ) {\n\t\telem.fireEvent(\"on\"+type);\n\t}\n}", "title": "" }, { "docid": "d655b25ecca2d477f6f641cd85174874", "score": "0.60494053", "text": "function handleDomEvent() {\n this._ractive.binding.handleChange();\n}", "title": "" }, { "docid": "35fd762a4339e2f185f92a5c39ea6fb6", "score": "0.602916", "text": "function fire(element, eventName, memo, bubble) {\n element = $(element);\n\n if (Object.isUndefined(bubble))\n bubble = true;\n\n if (element == document && document.createEvent && !element.dispatchEvent)\n element = document.documentElement;\n\n var event;\n if (document.createEvent) {\n event = document.createEvent('HTMLEvents');\n event.initEvent('dataavailable', bubble, true);\n } else {\n event = document.createEventObject();\n event.eventType = bubble ? 'ondataavailable' : 'onlosecapture';\n }\n\n event.eventName = eventName;\n event.memo = memo || { };\n\n if (document.createEvent)\n element.dispatchEvent(event);\n else\n element.fireEvent(event.eventType, event);\n\n return Event.extend(event);\n }", "title": "" }, { "docid": "62c81c2d6a17697720211c362974124e", "score": "0.59876597", "text": "function trigger(id, event) {\r\n var evt = document.createEvent(\"HTMLEvents\");\r\n evt.initEvent(event, true, false);\r\n\r\n if (evt) document.getElementById(id).dispatchEvent(evt);\r\n }", "title": "" }, { "docid": "7d3e41f9b0e18932725808d0c9e1f869", "score": "0.5964154", "text": "function triggerEvent(el, type) {\n let e = document.createEvent('HTMLEvents');\n e.initEvent(type, false, true);\n el.dispatchEvent(e);\n}", "title": "" }, { "docid": "83d4221b9fa18d24aa54bdc3e71ab464", "score": "0.5961255", "text": "_insertTestValue_imitateEvent(el) {\n $(el).trigger('click');\n }", "title": "" }, { "docid": "bf077953081aa1a43491cbc4bcfa6460", "score": "0.5954517", "text": "function fireEvent(document, nodeId, type, event, domChanges, params) {\n var el = document.getRef(nodeId);\n if (el) {\n return document.fireEvent(el, type, event, domChanges, params);\n }\n return new Error('invalid element reference \"' + nodeId + '\"');\n }", "title": "" }, { "docid": "c134ce869343a962e6dc174ec9041aa2", "score": "0.59410495", "text": "eventFire(el, etype){\n\t if (el.fireEvent) {\n\t el.fireEvent('on' + etype);\n\t } else {\n\t var evObj = document.createEvent('Events');\n\t evObj.initEvent(etype, true, false);\n\t el.dispatchEvent(evObj);\n\t }\n\t}", "title": "" }, { "docid": "b0a3f8fa20739bf4e05d958687d51bbc", "score": "0.5933026", "text": "function attachOrFire(){\n\t\tvar fireNow = false;\n\t\tvar fn;\n\t\t\n\t\tif(document.readyState){\n\t\t\tif(document.readyState == 'complete'){\n\t\t\t\tfireNow = true;\n\t\t\t}\n\t\t}\n\t\t\n\t\tfn = function(){\n\t\t\tbeginTest(quickBait, false);\n\t\t}\n\t\t\n\t\tif(fireNow){\n\t\t\tfn();\n\t\t}\n\t\telse{\n\t\t\tattachEventListener(win, 'load', fn);\n\t\t}\n\t}", "title": "" }, { "docid": "167fe8cedfb6d4088d3c93e11e268946", "score": "0.5932646", "text": "function click(elm){\r\n var evt = document.createEvent('MouseEvents');\r\n evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);\r\n elm.dispatchEvent(evt);\r\n}", "title": "" }, { "docid": "584c3a8da2b143eaed89bbb2b39c8a41", "score": "0.59122944", "text": "function fireDOMOperation() {\n if(!fireDOMOperation.hasBeenRun) {\n fireDOMOperation.hasBeenRun = true;\n domOperation();\n }\n }", "title": "" }, { "docid": "584c3a8da2b143eaed89bbb2b39c8a41", "score": "0.59122944", "text": "function fireDOMOperation() {\n if(!fireDOMOperation.hasBeenRun) {\n fireDOMOperation.hasBeenRun = true;\n domOperation();\n }\n }", "title": "" }, { "docid": "584c3a8da2b143eaed89bbb2b39c8a41", "score": "0.59122944", "text": "function fireDOMOperation() {\n if(!fireDOMOperation.hasBeenRun) {\n fireDOMOperation.hasBeenRun = true;\n domOperation();\n }\n }", "title": "" }, { "docid": "584c3a8da2b143eaed89bbb2b39c8a41", "score": "0.59122944", "text": "function fireDOMOperation() {\n if(!fireDOMOperation.hasBeenRun) {\n fireDOMOperation.hasBeenRun = true;\n domOperation();\n }\n }", "title": "" }, { "docid": "584c3a8da2b143eaed89bbb2b39c8a41", "score": "0.59122944", "text": "function fireDOMOperation() {\n if(!fireDOMOperation.hasBeenRun) {\n fireDOMOperation.hasBeenRun = true;\n domOperation();\n }\n }", "title": "" }, { "docid": "584c3a8da2b143eaed89bbb2b39c8a41", "score": "0.59122944", "text": "function fireDOMOperation() {\n if(!fireDOMOperation.hasBeenRun) {\n fireDOMOperation.hasBeenRun = true;\n domOperation();\n }\n }", "title": "" }, { "docid": "584c3a8da2b143eaed89bbb2b39c8a41", "score": "0.59122944", "text": "function fireDOMOperation() {\n if(!fireDOMOperation.hasBeenRun) {\n fireDOMOperation.hasBeenRun = true;\n domOperation();\n }\n }", "title": "" }, { "docid": "ff314815e86a7d09d50c2f1bff75cb4b", "score": "0.59068364", "text": "function eventFire(el, etype)\n{\n if (el.fireEvent)\n {\n el.fireEvent('on' + etype);\n }\n else\n {\n var evObj = document.createEvent('Events');\n evObj.initEvent(etype, true, false);\n el.dispatchEvent(evObj);\n }\n}", "title": "" }, { "docid": "fc133cc5873ef8a52e2c054b11a8853e", "score": "0.5904655", "text": "function fireDOMOperation() {\n if (!fireDOMOperation.hasBeenRun) {\n fireDOMOperation.hasBeenRun = true;\n domOperation();\n }\n }", "title": "" }, { "docid": "fc133cc5873ef8a52e2c054b11a8853e", "score": "0.5904655", "text": "function fireDOMOperation() {\n if (!fireDOMOperation.hasBeenRun) {\n fireDOMOperation.hasBeenRun = true;\n domOperation();\n }\n }", "title": "" }, { "docid": "fc133cc5873ef8a52e2c054b11a8853e", "score": "0.5904655", "text": "function fireDOMOperation() {\n if (!fireDOMOperation.hasBeenRun) {\n fireDOMOperation.hasBeenRun = true;\n domOperation();\n }\n }", "title": "" }, { "docid": "fc133cc5873ef8a52e2c054b11a8853e", "score": "0.5904655", "text": "function fireDOMOperation() {\n if (!fireDOMOperation.hasBeenRun) {\n fireDOMOperation.hasBeenRun = true;\n domOperation();\n }\n }", "title": "" }, { "docid": "fc133cc5873ef8a52e2c054b11a8853e", "score": "0.5904655", "text": "function fireDOMOperation() {\n if (!fireDOMOperation.hasBeenRun) {\n fireDOMOperation.hasBeenRun = true;\n domOperation();\n }\n }", "title": "" }, { "docid": "329bda0cbfd0ecd7d6b1a053e9a733c1", "score": "0.5896386", "text": "function dispatchEventToDOM(windows_xml)\r\n{\r\n var elm = window.content.document.getElementById(\"container\");\r\n elm.setAttribute(\"windowsXmlString\", windows_xml);\r\n var evt = window.content.document.createEvent(\"Events\");\r\n evt.initEvent(\"myevent\", true, false);\r\n elm.dispatchEvent(evt);\r\n}", "title": "" }, { "docid": "f98ed77cda932d3aa2e16ce11f1b40fd", "score": "0.58782995", "text": "function fireDOMOperation() {\n if (!fireDOMOperation.hasBeenRun) {\n fireDOMOperation.hasBeenRun = true;\n domOperation();\n }\n }", "title": "" }, { "docid": "24df003059e840278ee8894a6bed26ac", "score": "0.5877863", "text": "function emitEvent(el, eventName) {\n\t let evt = document.createEvent('Events');\n\t evt.initEvent(eventName, true, false);\n\t el.dispatchEvent(evt);\n\t}", "title": "" }, { "docid": "f0672d3d17c477b7cef095d6e405a948", "score": "0.5877138", "text": "function eventFire(el, etype) {\n console.log(el);\n if (el.fireEvent) {\n el.fireEvent('on' + etype);\n } else {\n var evObj = document.createEvent('Events');\n evObj.initEvent(etype, true, false);\n el.dispatchEvent(evObj);\n }\n}", "title": "" }, { "docid": "65cbe6dc5541c730be3444a76e71c599", "score": "0.58770156", "text": "function trigger (target, event, process) {\n\t var e = document.createEvent('HTMLEvents')\n\t e.initEvent(event, true, true)\n\t if (process) process(e)\n\t target.dispatchEvent(e)\n\t return e\n\t}", "title": "" }, { "docid": "fcc098dd762aad464444107ca88411b4", "score": "0.5873067", "text": "function fireEvent(e, o) {\n // IE Workaround\n var event = document.createEvent(\"CustomEvent\");\n event.initCustomEvent(e, true, false, o);\n\n document.dispatchEvent(event);\n //document.dispatchEvent(new CustomEvent(e, {'detail': o}));\n }", "title": "" }, { "docid": "066c1e387f652d6fedf909373e065c0d", "score": "0.5860512", "text": "function fireTrigger(element, eventType) {\n if (document.createEvent) {\n var event = document.createEvent('HTMLEvents');\n event.initEvent(eventType, true, false);\n element.dispatchEvent(event);\n } else {\n element.fireEvent('on' + eventType);\n }\n }", "title": "" }, { "docid": "f1ea23b95e6b791453d7ecb2329cd251", "score": "0.58412194", "text": "function eventFire(el, etype){\n if (el.fireEvent) {\n el.fireEvent('on' + etype);\n } \n else {\n var evObj = document.createEvent('Events');\n evObj.initEvent(etype, true, false);\n el.dispatchEvent(evObj);\n }\n}", "title": "" }, { "docid": "3ba4d02dff6cd4bd357ed0fdaeced6e9", "score": "0.58392745", "text": "fire(selector, eventName, callback) {\n assert(this.window, 'No window open');\n const target = this.query(selector);\n assert(target && target.dispatchEvent, 'No target element (note: call with selector/element, event name and callback)');\n\n const eventType = ~MOUSE_EVENT_NAMES.indexOf(eventName) ? 'MouseEvents' : 'HTMLEvents';\n const event = this.document.createEvent(eventType);\n event.initEvent(eventName, true, true);\n target.dispatchEvent(event);\n if (selector.tagName === 'BUTTON' || selector.tagName == 'INPUT') selector._click(event);\n return this._wait(null, callback);\n }", "title": "" }, { "docid": "f0448b2798d0b7f9f0a767747299906c", "score": "0.58337075", "text": "function click(elm) {\r\n var evt = document.createEvent('MouseEvents');\r\n evt.initMouseEvent('click', true, true, window, 0, 1, 1, 1, 1, false, false, false, false, 0, null);\r\n elm.dispatchEvent(evt);\r\n}", "title": "" }, { "docid": "0781c39b09fd25ae53b217d6684a0271", "score": "0.5802486", "text": "function emitEvent(elem, detail) {\n // Create a new event\n let event = new CustomEvent(\"render\", {\n bubbles: true,\n cancelable: true,\n detail: detail || {},\n });\n\n // Dispatch the event\n elem.dispatchEvent(event);\n}", "title": "" }, { "docid": "6df521a1b7478c5844e5cc30fde19de5", "score": "0.5790591", "text": "function invokeAttachedDOMEvent(elm,callback){\n\tvar eventFunction = elm.attr('onchange') ? elm.attr('onchange') : elm.attr('onclick');\n\tif ( eventFunction ) {\n\t\teventFunction.call();\n\t}\n\tif ( callback && typeof callback == 'function' ) callback.call();\n}", "title": "" }, { "docid": "63b29f34fc3c6a9363ab73dc66d8e7d1", "score": "0.57834274", "text": "function eventFire(el, etype){\n if (el.fireEvent) {\n el.fireEvent('on' + etype);\n } else {\n var evObj = document.createEvent('Events');\n evObj.initEvent(etype, true, false);\n el.dispatchEvent(evObj);\n }\n}", "title": "" }, { "docid": "63b29f34fc3c6a9363ab73dc66d8e7d1", "score": "0.57834274", "text": "function eventFire(el, etype){\n if (el.fireEvent) {\n el.fireEvent('on' + etype);\n } else {\n var evObj = document.createEvent('Events');\n evObj.initEvent(etype, true, false);\n el.dispatchEvent(evObj);\n }\n}", "title": "" }, { "docid": "5b6fc35f063a6aaf09fb4db822975d3d", "score": "0.57809085", "text": "function fireevent(oEle,strEvent, strParams)\r\n{\r\n\tswitch(strEvent)\r\n\t{\r\n\t\tcase \"click\":\r\n\t\t\tif(isIE)oEle.click(strParams)\r\n\t\t\telse oEle.onclick(strParams);\r\n\t\t\tbreak;\r\n\t\tcase \"dblclick\":\r\n\t\t\tif(isIE)oEle.dblclick(strParams)\r\n\t\t\telse oEle.ondblclick(strParams);\r\n\t\t\tbreak;\r\n\t\tcase \"mouseover\":\r\n\t\t\tif(isIE)oEle.mouseover(strParams)\r\n\t\t\telse oEle.onmouseover(strParams);\r\n\t\t\tbreak;\r\n\t\tcase \"mouseout\":\r\n\t\t\tif(isIE)oEle.mouseout(strParams)\r\n\t\t\telse oEle.onmouseout(strParams);\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\talert(\"portal.control.js-fireevent : Unhandled element event(\" + strEvent + \").\")\r\n\t}\r\n}", "title": "" }, { "docid": "28bbaeaac89cab2b09846bfa5a9032db", "score": "0.57770884", "text": "function onData(data) {\n\tif (data.eventType === \"click\" || data.eventType === \"mousemove\" || data.eventType === \"mousedown\" || data.eventType === \"mouseup\" || data.eventType === \"touchmove\" || data.eventType === \"touchstart\" || data.eventType === \"touchend\") {\n\t\t//var url = domain + data.message;\n\t\t//load_page(url);\n\t\t\n if (!myclick) {\n\t\t\tmyclick = true;\n\t\t\tvar target = data.target;\n\t\t\tvar posX = data.posX - window.pageXOffset;\n\t\t\tvar posY = data.posY - window.pageYOffset; \n\t\t\tvar elem = document.elementFromPoint(posX, posY);\n\t\t\t\n\t\t\tif (elem === null) {\n\t\t\t\tvar items = document.getElementsByTagName(\"*\");\n\t\t\t\tfor (var i = items.length; i--;) {\n\t\t\t\t var temp_elem = items[i];\n\t\t\t\t var rect = temp_elem.getBoundingClientRect();\n\t\t\t\t var rect_width = rect.right - rect.left;\n\t\t\t\t var rect_height = rect.bottom - rect.top;\n\t\t\t\t if (Math.abs(posX - rect.left) <= rect_width && Math.abs(posY - rect.top) <= rect_height && temp_elem.nodeName === target) {\n\t\t\t\t \telem = temp_elem;\t \t\t\n\t\t\t\t }\n\t\t\t\t}\n\t\t\t} \n\n console.log(\"Propagated event found for \" + elem.nodeType);\n\t\t\tvar clickevt = document.createEvent(\"MouseEvents\");\n\t\t\tclickevt.initMouseEvent(data.eventType, true, true, window, 1, posX, posY, posX, posY, false, false, false, false, 0, null);\n\t\t\telem.dispatchEvent(clickevt); \n\t\t} else {\n\n\t\t\tmyclick = false;\n\t\t}\n\t}\n\tif (data.eventType == \"scroll\") {\n\t\t$(window).scroll();\n\t}\n}", "title": "" }, { "docid": "3a0286a662d55276bbda478df9396d4c", "score": "0.57627946", "text": "function fireonchange(element) {\n\n if (document.createEvent) { // Firefox etc.\n var evt = document.createEvent(\"HTMLEvents\");\n evt.initEvent(\"change\", true, true);\n element.dispatchEvent(evt);\n }\n else {// IE\n element.fireEvent(\"onchange\");\n }\n\n}", "title": "" }, { "docid": "072f5dce557192161eca320f3cfc9763", "score": "0.5760923", "text": "function simulingOnClick(id, ev) {\n\tconsole.log(\"simulingOnClick --> call of me!!\\t\\tid: \"+ id +\"\\tev: \"+ ev);\n\tvar param= {\n\t\tview: window,\n\t\tbubbles: true,\n\t\tcancelable: true,\n\t\tclientX: 0.5,\n\t\tclientY: 0.5\n\t}\n\tvar event= new MouseEvent(ev, param);\n\tdocument.getElementById(id).dispatchEvent(event);\n}", "title": "" }, { "docid": "6ee13087e0a54edf254fc25f701c63a2", "score": "0.5758941", "text": "function eventFire(element, eventType) {\n if (element.fireEvent) {\n element.fireEvent('on' + eventType);\n }\n else {\n var eventObject = document.createEvent('Events');\n eventObject.initEvent(eventType, true, false);\n element.dispatchEvent(eventObject);\n }\n }", "title": "" }, { "docid": "6ee13087e0a54edf254fc25f701c63a2", "score": "0.5758941", "text": "function eventFire(element, eventType) {\n if (element.fireEvent) {\n element.fireEvent('on' + eventType);\n }\n else {\n var eventObject = document.createEvent('Events');\n eventObject.initEvent(eventType, true, false);\n element.dispatchEvent(eventObject);\n }\n }", "title": "" }, { "docid": "1d19511d5e84b1e624d8a9ae361e9cce", "score": "0.5756689", "text": "function triggerEvent (eventName, target) {\n\tvar fakeEvent = document.createEvent(\"Event\");\n\tfakeEvent.initEvent(eventName, true, true);\n\ttarget.dispatchEvent(fakeEvent);\n}", "title": "" }, { "docid": "dc543b25b007904811bce5a80c8fd364", "score": "0.57480526", "text": "function click(elm) {\r\n\tvar evt = document.createEvent('MouseEvents');\r\n\tevt.initEvent('click', true, true);\r\n\telm.dispatchEvent(evt);\r\n}", "title": "" }, { "docid": "b49d60fc3305bcd04ad2e447dbbdf2d5", "score": "0.5746785", "text": "function triggerEvent(el, eventName) {\n var evt;\n if (document.createEvent) {\n evt = document.createEvent('HTMLEvents');\n evt.initEvent(eventName, true, true);\n } else if (document.createEventObject) {// IE < 9\n evt = document.createEventObject();\n evt.eventType = eventName;\n }\n evt.eventName = eventName;\n evt.simulated = true;\n if (el.dispatchEvent) {\n el.dispatchEvent(evt);\n } else if (el.fireEvent && htmlEvents['on' + eventName]) {// IE < 9\n el.fireEvent('on' + evt.eventType, evt);// can trigger only real event (e.g. 'click')\n } else if (el[eventName]) {\n el[eventName]();\n } else if (el['on' + eventName]) {\n el['on' + eventName]();\n }\n}", "title": "" }, { "docid": "473d5c4fdb63999c385ef96929040de6", "score": "0.5744591", "text": "simulateDomEvent(ev) {\n var _a, _b;\n try {\n // check if event has been replayed, if so skip it\n if (params_1.RingerParams.params.replay.cascadeCheck && this.checkReplayed(ev)) {\n this.log.debug(\"skipping event: \" + ev.type);\n this.incrementIndex();\n this.setNextTimeout();\n this.updateStatus(ReplayState.REPLAYING);\n return;\n }\n const meta = ev.meta;\n this.log.log(\"background replay:\", meta.id, ev);\n const replayPort = this.getMatchingPort(ev);\n if (!replayPort) {\n // it may be that the target tab just isn't ready yet, hasn't been added\n // to our mappings yet. may need to try again in a moment.\n // if no matching port, getMatchingPort wiill try again later\n return;\n }\n // we have a replay port, which also means we know which tab it's going to\n // let's make the tab be the active/visible tab so we can see what's\n // happening\n if ((_b = (_a = replayPort.sender) === null || _a === void 0 ? void 0 : _a.tab) === null || _b === void 0 ? void 0 : _b.id) {\n chrome.tabs.update(replayPort.sender.tab.id, { selected: true });\n }\n // sometimes we use special no-op events to make sure that a page has gone\n // through our alignment process without actually executing a dom event\n if (ev.data.type === \"noop\") {\n this.incrementIndex();\n this.setNextTimeout(0);\n }\n // if there is a trigger, then check if trigger was observed\n const triggerEvent = this.getEvent(ev.timing.triggerEvent);\n if (triggerEvent) {\n const recordEvents = this.record.events;\n let matchedEvent = null;\n for (var i = recordEvents.length - 1; i >= 0; --i) {\n const otherEvent = recordEvents[i];\n if (otherEvent.type == triggerEvent.type &&\n otherEvent.data.type == triggerEvent.data.type &&\n utils_1.Utilities.matchUrls(otherEvent.data.url, triggerEvent.data.url, 0.9)) {\n matchedEvent = otherEvent;\n break;\n }\n }\n if (!matchedEvent) {\n this.setNextTimeout(params_1.RingerParams.params.replay.defaultWait);\n return;\n }\n }\n // we hopefully found a matching port, lets dispatch to that port\n const type = ev.data.type;\n // console.log(\"this.getStatus()\", this.getStatus());\n try {\n if (this.getStatus() === ReplayState.REPLAYING) {\n // clear ack\n this.ack = null;\n this.ackPort = replayPort.name;\n // group atomic events\n let eventGroup = [];\n const endEvent = meta.endEventId;\n if (params_1.RingerParams.params.replay.atomic && endEvent) {\n let t = this.index;\n const events = this.events;\n let curEvent = events[t];\n while (t < events.length &&\n curEvent.meta.pageEventId &&\n endEvent >= curEvent.meta.pageEventId &&\n ev.frame.port == curEvent.frame.port) {\n eventGroup.push(curEvent);\n t++;\n curEvent = events[t];\n }\n }\n else {\n eventGroup = [ev];\n }\n replayPort.postMessage({ type: \"dom\", value: eventGroup });\n this.updateStatus(ReplayState.ACK);\n this.firstEventReplayed = true;\n this.log.log(\"sent message\", eventGroup);\n this.log.log(\"start waiting for replay ack\");\n this.setNextTimeout(0);\n }\n else {\n throw \"unknown replay state\";\n }\n }\n catch (err) {\n this.log.error(\"error:\", err.message, err);\n // a disconnected port generally means that the page has been\n // navigated away from\n if (err.message === \"Attempting to use a disconnected port object\") {\n const strategy = params_1.RingerParams.params.replay.brokenPortStrategy;\n //console.log(\"using broken port strategy: \", strategy);\n if (strategy === params_1.BrokenPortStrategy.RETRY) {\n if (ev.data.cascading) {\n // skip the rest of the events\n this.incrementIndex();\n this.setNextTimeout(0);\n }\n else {\n // remove the mapping and try again\n delete this.portMapping[ev.frame.port];\n this.setNextTimeout(0);\n }\n }\n else {\n throw \"unknown broken port strategy\";\n }\n }\n else {\n err.printStackTrace();\n throw err;\n }\n }\n }\n catch (err) {\n this.log.error(\"error:\", err.message, err);\n this.finish();\n }\n }", "title": "" }, { "docid": "cc6830d4106d851744c63669057b3bc5", "score": "0.57391286", "text": "addDomListener() {}", "title": "" }, { "docid": "b6c3f60ec93d6698394a54c497874ba8", "score": "0.57188934", "text": "function fireReady() {\n if (!isDomReady) {\n isDomReady = true;\n each(domWaiters, function(fn) {\n one(fn);\n });\n }\n }", "title": "" }, { "docid": "e4662f44e1dc28c3e0cc39f6277ac151", "score": "0.57097846", "text": "onDOMUpdatedNotification(domContainerElement, eventObj) {\n\t}", "title": "" }, { "docid": "103cceb43fd14b718de6b68dc55c8d34", "score": "0.568975", "text": "function click(el){\n var ev = document.createEvent(\"MouseEvent\");\n ev.initMouseEvent(\n \"click\",\n true, true,\n window, null,\n 0, 0, 0, 0,\n false, false, false, false,\n 0, null\n );\n el.dispatchEvent(ev);\n}", "title": "" }, { "docid": "37071e7f4274e2b8a04f6d2febf07b96", "score": "0.5668292", "text": "function fireClickEvent(targetNode) {\r\n\tvar iNode = $ref(targetNode);\r\n\tif (iNode) {\r\n\t\tvar evtObj = document.createEvent(\"Event\");\r\n\t\tevtObj.initEvent(\"click\", true, true);\r\n\t\treturn iNode.dispatchEvent(evtObj);\r\n\t}\r\n\telse {\r\n\t\treturn null;\r\n\t}\r\n}", "title": "" }, { "docid": "37071e7f4274e2b8a04f6d2febf07b96", "score": "0.5668292", "text": "function fireClickEvent(targetNode) {\r\n\tvar iNode = $ref(targetNode);\r\n\tif (iNode) {\r\n\t\tvar evtObj = document.createEvent(\"Event\");\r\n\t\tevtObj.initEvent(\"click\", true, true);\r\n\t\treturn iNode.dispatchEvent(evtObj);\r\n\t}\r\n\telse {\r\n\t\treturn null;\r\n\t}\r\n}", "title": "" }, { "docid": "9ef94836fca0d61bfd0f18852b758f6c", "score": "0.56485856", "text": "function _trigger(el, eventName)\n\t{\n\t\tvar evt, opts = {\n\t\t\tbubbles: false, \n\t\t\tcancelable: true,\n\t\t\tview: window,\n\t\t\tctrlKey:false, altKey:false,\n\t\t\tshiftKey:false, metaKey:false,\n\t\t\tdetail:0, button:0,\n\t\t\tscreenX:0, screenY:0, clientX:0, clientY:0,\n\t\t\trelatedTarget: undefined,\n\t\t\ttrigger: true\n\t\t};\n\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\tif (EZ.MSIE || EZ.isIEw3c)\t\t//OLD COMMENT: does not work (may have applied to chrome)...\n\t\t{\t\t\t\t\t\t\t\t//...perhaps document.body.parentNode --> el.parentNode ??\n\t\t\t//http://marcgrabanski.com/simulating-mouse-click-events-in-javascript/\n\t\t\tvar args = [eventName,\n\t\t\t\topts.bubbles, opts.cancelable, opts.view, opts.detail,\n\t\t\t\topts.screenX, opts.screenY, opts.clientX, opts.clientY,\n\t\t\t\topts.ctrlKey, opts.altKey, opts.shiftKey, opts.metaKey,\n\t\t\t\topts.button, document.body.parentNode\n\t\t\t]\n\t\t\tevt = eventName.startsWith('mouse') ? document.createEvent('MouseEvents')\n\t\t\t\t: eventName.startsWith('key') ? document.createEvent('KeyBoardEvents')\t//??\n\t\t\t\t: document.createEvent('Events');\t\t\t\t\t\t\t\t\t\t//??\n\t\t\teventName.startsWith('mouse') ? evt.initMouseEvent.apply(el, args) :\n\t\t\teventName.startsWith('key') ? evt.initKeyboardEvent.apply(el, args) :\n\t\t\t\t\t\t\t\t\t\t\tevt.initEvent.apply(el, args);\n\t\t}\n\t\telse\t\t\t\t\t\t\t//08-13-2016:\n\t\t{\n\t\t\t//https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Creating_and_triggering_events\n\t\t\tevt = eventName.startsWith('mouse') ? new window.MouseEvent(eventName, opts)\n\t\t\t\t: eventName.startsWith('key') ? new window.KeyboardEvent(eventName, opts)\n\t\t\t\t: new Event(eventName, opts);\t\t\t\t\t\t\t\t\n\t\t}\n\t\ttry\n\t\t{\n\t\t\tel.dispatchEvent ? el.dispatchEvent(evt) \n\t\t\t\t\t\t\t : el.fireEvent('on' + eventName, evt);\n\t\t\tvoid(0);\n\t\t}\n\t\tcatch (e)\t\t//TODO: need wrapper to catch\n\t\t{\n\t\t\tEZ.oops('exception in event: ' + eventName, e);\n\t\t}\n\t}", "title": "" }, { "docid": "e21128bbb9a9ea3395478e51c894f9f0", "score": "0.5636562", "text": "function eventer(element, event, execute) {\n document.getElementById(element).addEventListener(event, execute)\n}", "title": "" }, { "docid": "555f746713b2f4d516595e88434b7ad3", "score": "0.56252915", "text": "dispatchEvent(_event) {\n throw new Error(\"This is a stub dispatchEvent implementation that should not be used. It only exists for type-checking purposes.\");\n }", "title": "" }, { "docid": "e8b45a55944011f5dc0f402867344046", "score": "0.55788016", "text": "function triggerDOMRefresh(view) {\n\t if (view._isShown && view._isRendered && isInDOM(view)) {\n\t if (_.isFunction(view.triggerMethod)) {\n\t view.triggerMethod('dom:refresh');\n\t }\n\t }\n\t }", "title": "" }, { "docid": "ce4db5c9ea5d94a5e26d05e84021f988", "score": "0.5572345", "text": "function click(id) {\n var el = document.getElementById(id);\n eventFire(el, 'click');\n}", "title": "" }, { "docid": "474198bb8bf4cc4bd1b684586c36230a", "score": "0.55548096", "text": "function testEvent(type, inputElement) {\r\n var el;\r\n var received = false;\r\n\r\n loadHtml(\"/jasmine-ui/test/ui/jasmine-uiSpec.html\", function(frame) {\r\n if (inputElement) {\r\n frame.$(\"body\").append('<input id=\"si1\" type=\"text\"></input>');\r\n } else {\r\n frame.$(\"body\").append('<div id=\"si1\"></div>');\r\n }\r\n });\r\n runs(function() {\r\n el = testframe().$('#si1')[0];\r\n if (el.addEventListener) {\r\n el.addEventListener(type, function() {\r\n received = true;\r\n }, false);\r\n } else if (el.attachEvent) {\r\n // IE case\r\n el.attachEvent('on' + type, function() {\r\n received = true;\r\n });\r\n }\r\n jasmine.ui.simulate(el, type);\r\n expect(received).toEqual(true);\r\n });\r\n }", "title": "" }, { "docid": "2bbf24dc84bd55c9455c54f1736d9d18", "score": "0.5530123", "text": "function trigger(el, eventName){\r\n\t\tvar event;\r\n\t\tif(document.createEvent){\r\n\t\t\tevent = document.createEvent('HTMLEvents');\r\n\t\t\tevent.initEvent(eventName,true,true);\r\n\t\t}else if(document.createEventObject){// IE < 9\r\n\t\t\tevent = document.createEventObject();\r\n\t\t\tevent.eventType = eventName;\r\n\t\t}\r\n\t\tevent.eventName = eventName;\r\n\t\tif(el.dispatchEvent){\r\n\t\t\tel.dispatchEvent(event);\r\n\t\t}else if(el.fireEvent && htmlEvents['on'+eventName]){// IE < 9\r\n\t\t\tel.fireEvent('on'+event.eventType,event); // can trigger only real event (e.g. 'click')\r\n\t\t}else if(el[eventName]){\r\n\t\t\tel[eventName]();\r\n\t\t}else if(el['on'+eventName]){\r\n\t\t\tel['on'+eventName]();\r\n\t\t}\r\n\t}", "title": "" }, { "docid": "53ed68a27605551f9e92816a34b7664e", "score": "0.5526685", "text": "blur() { this.dispatchEvent(new DOMEvent('blur')); }", "title": "" }, { "docid": "64c7438da7bb16460325113d1f1edcb4", "score": "0.5505937", "text": "function click(node) {\n try {\n node.dispatchEvent(new MouseEvent('click'));\n }\n catch (e) {\n var evt = document.createEvent('MouseEvents');\n evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null);\n node.dispatchEvent(evt);\n }\n}", "title": "" }, { "docid": "f4988d6a342e8d41d9efadc3b51d00f3", "score": "0.5491374", "text": "function _fires(name) {\n return function () {\n var doc = ripple('emulatorBridge').document(),\n evt = doc.createEvent(\"Events\");\n\n evt.initEvent(name, true, false);\n doc.dispatchEvent(evt);\n };\n}", "title": "" }, { "docid": "f022524385a15fbe3ccecaef2350cc24", "score": "0.54895425", "text": "function mouse_io_fire(raw, element, uid, enter) {\n var event = new Event(raw);\n event.type = enter === true ? 'mouseenter' : 'mouseleave';\n event.bubbles = false;\n event.stopped = true;\n event.target = wrap(element);\n\n // replacing the #find method so that UJS didn't\n // get broke with trying to find nested elements\n event.find = function(css_rule) {\n return $$(css_rule, true)\n .indexOf(this.target._) === -1 ?\n undefined : this.target;\n };\n\n event.target.fire(event);\n current_Document.fire(event);\n}", "title": "" }, { "docid": "74c407b2e766a3aab94c1d7bff4eb23c", "score": "0.54831207", "text": "function next() {\n triggerDom(e, el.parentNode, false, true);\n }", "title": "" }, { "docid": "ba646b165cc84412cac0f5e4bafe8d5b", "score": "0.54726946", "text": "function simulateClick(el) {\n document.body.appendChild(el);\n el.click();\n document.body.removeChild(el);\n }", "title": "" }, { "docid": "6051d3f0fec5fa9ee4c3975f3b8a4b77", "score": "0.5471852", "text": "function triggerDOMRefresh(view) {\n if (view._isShown && view._isRendered && isInDOM(view)) {\n if (_.isFunction(view.triggerMethod)) {\n view.triggerMethod('dom:refresh');\n }\n }\n }", "title": "" }, { "docid": "6051d3f0fec5fa9ee4c3975f3b8a4b77", "score": "0.5471852", "text": "function triggerDOMRefresh(view) {\n if (view._isShown && view._isRendered && isInDOM(view)) {\n if (_.isFunction(view.triggerMethod)) {\n view.triggerMethod('dom:refresh');\n }\n }\n }", "title": "" }, { "docid": "762b4aee5946e64b51b7432ea901fdbb", "score": "0.54696256", "text": "dispatchEvent(selector, event) {\n assert(this.window, 'No window open');\n const target = this.query(selector);\n return target.dispatchEvent(event);\n }", "title": "" }, { "docid": "eea52d66266ed3c2fca48e1024e028fa", "score": "0.54651296", "text": "static triggerChangeEvent(selector) {\n let event = document.createEvent('Event');\n event.initEvent('change', true, true);\n document.querySelector(selector).dispatchEvent(event);\n }", "title": "" }, { "docid": "28d7bc6b5e6dc94083aa07a1fdb327ea", "score": "0.54437953", "text": "function fakeClickEvent(element) {\n var fakeEvent;\n if (element && element.onclick && doc.createEvent) {\n fakeEvent = doc.createEvent('Events');\n fakeEvent.initEvent('click', true, false);\n element.onclick(fakeEvent);\n }\n}", "title": "" }, { "docid": "5affb2014512b8e82f37d6574a36b8da", "score": "0.5437632", "text": "function _triggerCallback(callback, element)\n {\n if( callback ) callback(element);\n }", "title": "" }, { "docid": "7621f08e45daf547bf67e9d48beacf29", "score": "0.5426842", "text": "function triggerEvent(element, name, data) {\n var event = document.createEvent('Event');\n\n event.initEvent(name, true, true); //can bubble, and is cancellable\n event.data = data;\n element.dispatchEvent(event);\n}", "title": "" }, { "docid": "eae23eef9b455a2707e6c3854cdd9946", "score": "0.5424222", "text": "function clickElement(el) {\n var ev = doc.createEvent(\"MouseEvent\");\n ev.initMouseEvent(\n \"click\",\n true /* bubble */, true /* cancelable */,\n window, null,\n 0, 0, 0, 0, /* coordinates */\n false, false, false, false, /* modifier keys */\n 0 /*left*/, null\n );\n el.dispatchEvent(ev);\n }", "title": "" }, { "docid": "6a78923b97e1896d9d3b401485a27837", "score": "0.54170805", "text": "function dispatch(){\n var event = new CustomEvent('stateChange', {\n detail: state\n })\n document.dispatchEvent(event)\n}", "title": "" }, { "docid": "7462495257829d94088f1e55b6589d99", "score": "0.5414217", "text": "fireEvent (...args) {\n let eventType = null;\n let i;\n let j;\n let k;\n let l;\n let event;\n\n const einstellungen = {\n \"pointerX\": 0,\n \"pointerY\": 0,\n \"button\": 0,\n \"ctrlKey\": false,\n \"altKey\": false,\n \"shiftKey\": false,\n \"metaKey\": false,\n \"bubbles\": true,\n \"cancelable\": true\n };\n\n const moeglicheEvents = [\n [\"HTMLEvents\", [\"load\", \"unload\", \"abort\", \"error\", \"select\", \"change\", \"submit\", \"reset\", \"focus\", \"blur\", \"resize\", \"scroll\"]],\n [\"MouseEvents\", [\"click\", \"dblclick\", \"mousedown\", \"mouseup\", \"mouseover\", \"mousemove\", \"mouseout\"]]\n ];\n\n for (i = 0, j = moeglicheEvents.length; i < j; ++i) {\n for (k = 0, l = moeglicheEvents[i][1].length; k < l; ++k) {\n if (args[1] === moeglicheEvents[i][1][k]) {\n eventType = moeglicheEvents[i][0];\n i = j;\n k = l;\n }\n }\n }\n\n if (args.length > 2) {\n if ((typeof args[2]) === \"object\") {\n this.change(einstellungen, args[2]);\n }\n }\n\n if (eventType === null) {\n throw new SyntaxError(`Event type ${args[1]} is not implemented!`);\n }\n\n if (document.createEvent) {\n event = document.createEvent(eventType);\n if (eventType === \"HTMLEvents\") {\n event.initEvent(args[1], einstellungen.bubbles, einstellungen.cancalable);\n } else {\n event.initMouseEvent(args[1], einstellungen.bubbles, einstellungen.cancelable, document.defaultView,\n einstellungen.button, einstellungen.pointerX, einstellungen.pointerY, einstellungen.pointerX, einstellungen.pointerY,\n einstellungen.ctrlKey, einstellungen.altKey, einstellungen.shiftKey, einstellungen.metaKey, einstellungen.button, args[0]);\n }\n\n args[0].dispatchEvent(event);\n } else {\n einstellungen.clientX = einstellungen.pointerX;\n einstellungen.clientY = einstellungen.pointerY;\n event = document.createEventObject();\n event = extend(event, einstellungen);\n args[0].fireEvent(`on${args[1]}`, event);\n }\n }", "title": "" }, { "docid": "804b8c259adc972a6979f339fc54ad7c", "score": "0.5412871", "text": "function triggerAndReturn(context, eventName, data) {\n //todo: Fire off some events\n //var event = $.Event(eventName)\n //$(context).trigger(event, data)\n return true; //!event.defaultPrevented\n } // trigger an Ajax \"global\" event", "title": "" }, { "docid": "b00b1011aaaa81ffb15e834006de0868", "score": "0.5410588", "text": "updateDOM(dom) { return false; }", "title": "" }, { "docid": "05f806f079506b10f9f036bb51ca7c8c", "score": "0.54074097", "text": "triggerEvent(eventName, detail) {\n const event = new window.CustomEvent(eventName, { detail });\n this.componentElem.dispatchEvent(event);\n }", "title": "" }, { "docid": "d2d69c287bd9bcc383cf705f19376ef0", "score": "0.5405871", "text": "static triggerEvent(eventName, payload) {\n if (!eventName) return;\n\n let event;\n event = document.createEvent('CustomEvent');\n event.initCustomEvent(eventName, true, true, payload);\n document.dispatchEvent(event);\n }", "title": "" }, { "docid": "852f21c11acec95f0ad6fdc898e30029", "score": "0.5405043", "text": "function triggerClick(element) {\n var event = document.createEvent('MouseEvents'); // Create a new mouse event\n\n event.initEvent('click', true, true); // Initialize a click event\n\n element.dispatchEvent(event); // Dispatch the event\n}", "title": "" } ]
76bae7a4f699bba9000cd802a31e789f
update the board position after the piece snap for castling, en passant, pawn promotion
[ { "docid": "d4ba4a84b18d97b7fe90310a2ab7ed8d", "score": "0.68827546", "text": "function onSnapEnd() {\n\n //console.log( game.fen() ); \n board.position(game.fen())\n halfMoves++;\n sendMove()\n }", "title": "" } ]
[ { "docid": "25250d5ea1cf2d38d87eebbdd416c1c0", "score": "0.7438704", "text": "function onSnapEnd() {\r\n board.position(game.fen());\r\n}", "title": "" }, { "docid": "3366e1c04c7930c0eeb164a7f47c9a98", "score": "0.73936445", "text": "function onSnapEnd () {\n board.position(game.fen())\n //\n}", "title": "" }, { "docid": "2d776d80176f96aae8beec7aba869dee", "score": "0.7365312", "text": "function onSnapEnd () {\n board.position(game.fen())\n}", "title": "" }, { "docid": "2d776d80176f96aae8beec7aba869dee", "score": "0.7365312", "text": "function onSnapEnd () {\n board.position(game.fen())\n}", "title": "" }, { "docid": "73833fc84dff1ca76ea08d1a1a32ea2e", "score": "0.7362217", "text": "function onSnapEnd() {\r\n board.position(game.fen())\r\n}", "title": "" }, { "docid": "229d75f09a111f6f65239d3bc9a1bddb", "score": "0.7353717", "text": "function onSnapEnd() {\n board.position(game.fen())\n }", "title": "" }, { "docid": "eafc31e1075f076becaf150ee172d7ee", "score": "0.7326416", "text": "function onSnapEnd() {\n board.position(game.fen())\n}", "title": "" }, { "docid": "516ab450bf0d024528f21f07e8f0ccd9", "score": "0.732145", "text": "function onSnapEnd() {\n board.position(game.fen())\n}", "title": "" }, { "docid": "8cd3c75a505a3102a940318d1dfaef8c", "score": "0.73132217", "text": "function onSnapEnd () {\n board1.position(game.fen())\n}", "title": "" }, { "docid": "e2a716c55dc742ef4016a697aad086d0", "score": "0.7299979", "text": "function onSnapEnd () {\n //myboard.position(game.fen())\n}", "title": "" }, { "docid": "c713ee71b34d467a9ad0cddbba01c08b", "score": "0.72857046", "text": "function onSnapEnd2() {\n board.position(game.fen())\n}", "title": "" }, { "docid": "f8e3b4eeb6bd15efc16b74541d9d303a", "score": "0.707985", "text": "move(start,end) {\n let model = this.modelMove(start,end);\n if (! model[0]) return;\n\n // Create a chess notation representation of the move\n let note = '' \n if (! model[2]) {\n note = this.basicNotation(start,end);\n }\n\n // Update the board, whose turn it is, and other information if needed\n // Sends updates to the view\n this.board = model[3];\n this.update({event: 'empty', id: start});\n this.update({\n event: 'setValue', \n id: end, \n value: this.getSquare(end).value,\n color: this.getSquare(end).color,\n });\n\n \n // If a pawn reached rank 8, update the view about promotion and return\n if (this.getSquare(end).value === 'p') {\n if ((end[1] === '1' && this.turn === 'b') || (end[1] === '8' && this.turn === 'w')) {\n this.update({event: 'promote', id: end, color: this.turn});\n this.inpromotion = end;\n return;\n }\n }\n \n // Performs an additional update if an en-passant capture occured\n if (model[1]) {\n this.update({event: 'empty', id: end[0]+start[1]});\n }\n // Updates the en-passant value\n if (this.getSquare(end).value === 'p' && Math.abs(parseInt(start[1])-parseInt(end[1]))>1) {\n this.enpassant = end;\n } else {\n this.enpassant = '';\n }\n\n // Updates the view and notation if castling was performed\n if (model[2]) {\n this.canCastleKing[this.turn] = false;\n this.canCastleQueen[this.turn] = false;\n note = end[0] === 'g' ? 'O-O' : 'O-O-O'\n this.update({event: 'empty', id: (end[0] === 'g' ? 'h' : 'a')+end[1]});\n this.update({\n event: 'setValue',\n id: (end[0] === 'g' ? 'f' : 'd')+end[1],\n value: 'R',\n color: this.turn,\n });\n }\n \n // Update castling information and the notation if the king or rook moved\n if (this.canCastleKing[this.turn]) {\n if (start === (this.turn === 'w' ? 'e1' : 'e8') || start === (this.turn === 'w' ? 'h1' : 'h8')) {\n this.canCastleKing[this.turn] = false;\n }\n } else if (this.canCastleQueen[this.turn]) {\n if (start === (this.turn === 'w' ? 'e1' : 'e8') || start === (this.turn === 'w' ? 'a1' : 'a8')) {\n this.canCastleQueen[this.turn] = false;\n }\n }\n\n // Updates the turn\n this.turn = this.turn === 'w' ? 'b' : 'w';\n\n // Test for mate and check\n note = this.testChecks(note);\n // Log the notation on at the end\n this.log.push(note);\n console.log(this.log);\n }", "title": "" }, { "docid": "f4ccc3d6af25aea493d7e4ecff290be8", "score": "0.7049393", "text": "onSnapEnd() {\n console.log('onSnapEnd')\n this.board.position(this.game.fen())\n }", "title": "" }, { "docid": "c3f9d197d1d10b9a6c75b1101c4d53dd", "score": "0.7001083", "text": "function movePiece() {\n var userClick = b.cell(this).where();\n if (bindMoveLocs.indexOf(userClick)) {\n b.cell(userClick).place(bindMovePiece);\n resetBoard();\n }\n }", "title": "" }, { "docid": "0557c6277e0bc190092b7dbe04d2b7e5", "score": "0.6759829", "text": "movePiece(piece, [i, j]) {\n const opposingColor = piece.color === 'white' ? 'black' : 'white'\n const pieces = this.data.pieces\n const index = pieces.indexOf(piece)\n const initialPosition = piece.position\n\n\n // update position of piece\n this.cursor.set(['pieces', index, 'position'], [i, j])\n\n // remove any captured piece\n const capturedPieceIndex = pieces.findIndex(({position}) => {\n const [ii, jj] = position\n return i === ii && j === jj\n })\n if (capturedPieceIndex >= 0) {\n this.cursor.splice(['pieces'], capturedPieceIndex, 1)\n }\n\n // if a pawn has moved to the last row, promote it to a queen\n const advanceRow = piece.color === 'white' ? 0 : 7\n if (piece.type === 'pawn' && i === advanceRow) {\n this.cursor.set(['pieces', index, 'type'], 'queen')\n }\n\n // update current turn\n this.cursor.set('currentTurn', opposingColor)\n\n // post a message\n const from = this.labelFor(initialPosition)\n const to = this.labelFor([i, j])\n this.cursor.push('messages', {\n sender: null,\n text: `${piece.color} moved ${piece.type} from ${from} to ${to}`\n })\n }", "title": "" }, { "docid": "4947f40a94ba1892e94ca4ce8abf1055", "score": "0.6718265", "text": "function onSnapEnd () {\n board.position(game.fen().split(' ')[0])\n\n}", "title": "" }, { "docid": "7d519671cc44f7e92c685cb9dbd5ae46", "score": "0.6706316", "text": "move(piecePos, move) {\n let legalMoves = this.generateAllLegalMoves(this.currentState[0].player);\n let pieceObj = legalMoves.find(piece => this.posComparator(piecePos, piece.position));\n\n if (pieceObj.name === 'king' && Math.abs(piecePos[1] - move[1]) === 2) {\n this.handleCastle(pieceObj, move)\n } else {\n let validMove = pieceObj.moves.find(legalMove => {\n return this.posComparator(legalMove, move)\n })\n\n if (validMove !== undefined) {\n if (this.board.getSquare(move[0], move[1]).getPiece() !== null) {\n this.currentState[1].pieceTotal -= this.board.getSquare(validMove[0], validMove[1]).getPiece().value;\n this.board.getSquare(validMove[0], validMove[1]).removePiece(); //try removing later\n this.board.getSquare(validMove[0], validMove[1]).setPiece(pieceObj);\n this.board.getSquare(validMove[0], validMove[1]).getPiece().setPosition([validMove[0], validMove[1]])\n this.board.getSquare(piecePos[0], piecePos[1]).removePiece();\n this.currentState.reverse();\n\n if (pieceObj.name === 'king'\n || pieceObj.name === 'rook'\n || pieceObj.name === 'pawn') {\n pieceObj.hasMoved();\n }\n } else {\n if (pieceObj.name === 'pawn') {\n if (pieceObj.position[0] === 1 || pieceObj.position[0] === 6) {\n if (validMove[0] === 3 || validMove[0] === 4) {\n this.currentState[1].enPass = pieceObj;\n } else {\n this.currentState[1].enPass = null;\n }\n }\n if (pieceObj.position[0] === 3 || pieceObj.position[0] === 4) {\n if (validMove[1] === pieceObj.position[1] + 1 || validMove[1] === pieceObj.position[1] - 1) {\n let [rank, file] = this.currentState[0].enPass.position\n this.board.getSquare(rank, file).removePiece()\n }\n }\n }\n this.board.getSquare(validMove[0], validMove[1]).setPiece(pieceObj);\n this.board.getSquare(piecePos[0], piecePos[1]).removePiece();\n this.board.getSquare(validMove[0], validMove[1]).getPiece().setPosition([validMove[0], validMove[1]])\n this.currentState.reverse();\n\n if (pieceObj.name === 'king'\n || pieceObj.name === 'rook'\n || pieceObj.name === 'pawn') {\n pieceObj.hasMoved();\n }\n }\n }\n }\n }", "title": "" }, { "docid": "4ea7efca5b9989300a1078c6faeca642", "score": "0.66053873", "text": "function p4_make_move(state, s, e, promotion){\n var board = state.board;\n var S = board[s];\n var E = board[e];\n board[e] = S;\n board[s] = 0;\n var piece = S & 14;\n var moved_colour = S & 1;\n var end_piece = S; /* can differ from S in queening*/\n //now some stuff to handle queening, castling\n var rs = 0, re, rook;\n var ep_taken = 0, ep_position;\n var ep = 0;\n if(piece == P4_PAWN){\n if((60 - e) * (60 - e) > 900){\n /*got to end; replace the pawn on board and in pieces cache.*/\n promotion |= moved_colour;\n board[e] = promotion;\n end_piece = promotion;\n }\n else if (((s ^ e) & 1) && E == 0){\n /*this is a diagonal move, but the end spot is empty, so we surmise enpassant */\n ep_position = e - 10 + 20 * moved_colour;\n ep_taken = board[ep_position];\n board[ep_position] = 0;\n }\n else if ((s - e) * (s - e) == 400){\n /*delta is 20 --> two row jump at start*/\n ep = (s + e) >> 1;\n }\n }\n else if (piece == P4_KING && ((s - e) * (s - e) == 4)){ //castling - move rook too\n rs = s - 4 + (s < e) * 7;\n re = (s + e) >> 1; //avg of s,e=rook's spot\n rook = moved_colour + P4_ROOK;\n board[rs] = 0;\n board[re] = rook;\n //piece_locations.push([rook, re]);\n }\n\n var old_castle_state = state.castles;\n if (old_castle_state){\n var mask = 0;\n var shift = moved_colour * 2;\n var side = moved_colour * 70;\n var s2 = s - side;\n var e2 = e + side;\n //wipe both our sides if king moves\n if (s2 == 25)\n mask |= 3 << shift;\n //wipe one side on any move from rook points\n else if (s2 == 21)\n mask |= 1 << shift;\n else if (s2 == 28)\n mask |= 2 << shift;\n //or on any move *to* opposition corners\n if (e2 == 91)\n mask |= 4 >> shift;\n else if (e2 == 98)\n mask |= 8 >> shift;\n state.castles &= ~mask;\n }\n\n var old_pieces = state.pieces.concat();\n var our_pieces = old_pieces[moved_colour];\n var dest = state.pieces[moved_colour] = [];\n for (var i = 0; i < our_pieces.length; i++){\n var x = our_pieces[i];\n var pp = x[0];\n var ps = x[1];\n if (ps != s && ps != rs){\n dest.push(x);\n }\n }\n dest.push([end_piece, e]);\n if (rook)\n dest.push([rook, re]);\n\n if (E || ep_taken){\n var their_pieces = old_pieces[1 - moved_colour];\n dest = state.pieces[1 - moved_colour] = [];\n var gone = ep_taken ? ep_position : e;\n for (i = 0; i < their_pieces.length; i++){\n var x = their_pieces[i];\n if (x[1] != gone){\n dest.push(x);\n }\n }\n }\n\n return {\n /*some of these (e.g. rook) could be recalculated during\n * unmake, possibly more cheaply. */\n s: s,\n e: e,\n S: S,\n E: E,\n ep: ep,\n castles: old_castle_state,\n rs: rs,\n re: re,\n rook: rook,\n ep_position: ep_position,\n ep_taken: ep_taken,\n pieces: old_pieces\n };\n}", "title": "" }, { "docid": "cdc4b7072b81378ddada3f0d1da90b23", "score": "0.65603775", "text": "squareClicked(row, col) {\r\n const board = this.getCurrBoard();\r\n const piece = board.pieceAt(row, col);\r\n const playerKing = this.getCurrKing();\r\n const oppPieces = this.getOppPieces();\r\n const players = this.state.players;\r\n\r\n // code for player to select a piece to move\r\n if (!this.isPossibleMove(row, col)) {\r\n /* return if box without pieces has been clicked or player color does\r\n not match chosen piece's color or if game has been won*/\r\n if (!piece || this.wrongColor(piece) || this.state.gameInfo.isWin())\r\n return;\r\n\r\n // create a list of possible moves for the piece\r\n const moves = piece.filteredMoves(board, playerKing, oppPieces);\r\n\r\n this.setState({\r\n possibleMoves: moves,\r\n selectedPiece: piece\r\n });\r\n }\r\n\r\n // code for player to move selected piece\r\n else {\r\n const possibleMoves = this.state.possibleMoves;\r\n const selectedPiece = this.state.selectedPiece;\r\n let newBoard;\r\n let newPlayers;\r\n\r\n for (const move of possibleMoves) {\r\n // continue if player does not choose among possible moves\r\n if (!Helper.moveMatchesIndex(move, row, col)) continue;\r\n // king-side castling picked\r\n if (ChessLogic.isKCastle(board, selectedPiece, oppPieces, move)) {\r\n newPlayers = board.removeCapturedCastle(selectedPiece, true, players);\r\n newBoard = board.updateBoardCastle(selectedPiece, true);\r\n Piece.Piece.updatePiecesCastle(board, selectedPiece, true);\r\n }\r\n // queen-side castling picked\r\n else if (ChessLogic.isQCastle(board, selectedPiece, oppPieces, move)) {\r\n newPlayers = board.removeCapturedCastle(\r\n selectedPiece,\r\n false,\r\n players\r\n );\r\n newBoard = board.updateBoardCastle(selectedPiece, false);\r\n Piece.Piece.updatePiecesCastle(board, selectedPiece, false);\r\n }\r\n // regular single-piece update\r\n else {\r\n newPlayers = board.removeCapturedPiece(selectedPiece, move, players);\r\n newBoard = board.updateBoardPiece(selectedPiece, move);\r\n Piece.Piece.updatePiece(selectedPiece, move);\r\n }\r\n\r\n const history = this.updateHistory(newBoard);\r\n\r\n // update game info\r\n this.state.gameInfo.updateGameInfo(\r\n newBoard,\r\n newPlayers[0].getInPlay(),\r\n newPlayers[0].getKing(),\r\n newPlayers[1].getInPlay(),\r\n newPlayers[1].getKing()\r\n );\r\n\r\n this.setState(\r\n {\r\n history: history,\r\n historyIndex: this.state.historyIndex + 1,\r\n possibleMoves: [],\r\n gameInfo: this.state.gameInfo,\r\n players: newPlayers\r\n },\r\n\r\n function() {\r\n if (this.state.gameInfo.isCPUTurn()) {\r\n this.AIClick();\r\n }\r\n }\r\n );\r\n\r\n break;\r\n }\r\n return;\r\n }\r\n }", "title": "" }, { "docid": "ef4e7613f0c43b8e993ffdfd7ef1f635", "score": "0.6524876", "text": "function movePiece() {\n var userClick = b.cell(this).where();\n if (bindMoveLocs.indexOf(userClick)) {\n b.cell(userClick).place(bindMovePiece);\n killDeadPieces(userClick, getTaflPieceAtLoc(userClick));\n resetBoard();\n if (isWhitesTurn) {\n enableBlack();\n } else {\n enableWhite();\n }\n checkForGameOver();\n }\n}", "title": "" }, { "docid": "8ba92240ee86f1bbd010346a9739b482", "score": "0.64659756", "text": "function movePiece(t_row, t_col) {\n $(\"[row=\" + t_row + \"][col=\" + t_col + \"]\").attr(\"piece\", currentPieceSel.piece)\n $(\"[row=\" + t_row + \"][col=\" + t_col + \"]\").attr(\"player\", currentPieceSel.player)\n $(\"[row=\" + t_row + \"][col=\" + t_col + \"]\").css(\"background\", \"url(./Pieces/\" + currentPieceSel.player + \"/\" + currentPieceSel.piece + \".png)\")\n if (currentPieceSel.piece == \"pawn\") {\n var size = \"65px\"\n } else {\n var size = \"74px\"\n }\n let color = $(\"[row=\" + t_row + \"][col=\" + t_col + \"]\").css(\"background-color\")\n $(\"[row=\" + t_row + \"][col=\" + t_col + \"]\").css(\"background-size\", size)\n $(\"[row=\" + t_row + \"][col=\" + t_col + \"]\").css(\"background-position\", \"center\")\n $(\"[row=\" + t_row + \"][col=\" + t_col + \"]\").css(\"background-repeat\", \"no-repeat\")\n $(\"[row=\" + t_row + \"][col=\" + t_col + \"]\").css(\"background-color\", color)\n\n $(\"[row=\" + currentPieceSel.row + \"][col=\" + currentPieceSel.col + \"]\").attr(\"piece\", \"\")\n $(\"[row=\" + currentPieceSel.row + \"][col=\" + currentPieceSel.col + \"]\").attr(\"player\", \"\")\n $(\"[row=\" + currentPieceSel.row + \"][col=\" + currentPieceSel.col + \"]\").css(\"background\", \"none\")\n if ($(\"[row=\" + currentPieceSel.row + \"][col=\" + currentPieceSel.col + \"]\").hasClass(\"square-white\")) {\n color = \"white\"\n } else {\n color = \"#5e2129\"\n }\n $(\"[row= \" + currentPieceSel.row + \"][col = \" + currentPieceSel.col + \"]\").css(\"background-color\", color)\n\n currentPieceSel = {\n player: \"\",\n piece: \"\",\n row: \"\",\n col: \"\"\n }\n if (turn == \"white\") {\n turn = \"black\"\n } else {\n turn = \"white\"\n }\n }", "title": "" }, { "docid": "960c1c174a57f3dcf7132d8c47ff0e32", "score": "0.6459685", "text": "function updateStateFromMove() {\n queenLocs = getQueenLocations(b);\n stateCache.push(getStateString(b));\n displayMoveCount();\n queenConflicts = getConflictCountsByQueen(queenLocs);\n displayConflictScore();\n debugLog(); //should remove this eventually\n resetBoard();\n}", "title": "" }, { "docid": "af96bb215ba5d33ae3a846cb49c1faae", "score": "0.6404394", "text": "function prepareBoard() {\n //create board\n for (var boardRow = 0; boardRow < ttlRows; boardRow++) {\n for (var boardCol = 0; boardCol < ttlCols; boardCol++) {\n var boardSq = $('<div>').attr({\n class: 'boardSquare droppable',\n 'data-xCoord': boardCol,\n \"data-yCoord\": boardRow\n });\n mainBoard.append(boardSq);\n }\n }\n //add droppable listener for the board squares\n $('.droppable').droppable({\n //when mouse pointer overlaps droppable element\n tolerance: \"pointer\",\n // revert: false,\n drop: function(event, ui) {\n //retrieve filled squares of piece\n var piece = $('.pcSquare.filled.' + currPlayer);\n var pcColor = piece.first().css('background-color');\n //get ending coordinates\n getEndingCoord($(this));\n\n var clickedXCoord = endingCoord[0];\n var clickedYCoord = endingCoord[1];\n //check validity of move\n getDifference();\n var isValid = isValidMove(piece);\n\n if (isValid) {\n piece.each(function() {\n // color board squares based on piece squares\n var corrX = $(this).data('xcoord') + diffCoords[0];\n var corrY = $(this).data('ycoord') + diffCoords[1];\n\n $('.boardSquare[data-xcoord=' + corrX + '][data-ycoord=' + corrY + ']').addClass('filled').css(\"background-color\", pcColor);\n });\n ui.helper.remove();\n generateNewPiece(currPlayer);\n\n //updates score if player completes row/col\n var turnScore = horzFillCheck() + vertFillCheck();\n if (turnScore > 0) {\n if (currPlayer === \"p1\") {\n p1Score += turnScore;\n $('.player1').text(\"Score: \" + p1Score);\n } else {\n p2Score += turnScore;\n $('.player2').text(\"Score: \" + p2Score);\n }\n }\n switchTurn();\n } else {\n $('.pieceContainer').css({\n left: 20,\n top: 30\n });\n }\n\n console.log(\"curr turn: \" + currPlayer);\n }\n });\n //add clickable listener for cover on\n $('.coverOn').on('click', function() {\n // alert(\"Sorry, it isin't your turn yet!\");\n swal({\n title: 'Not your turn yet!',\n confirmButtonText: 'Darn, alright',\n width: 300,\n timer: 2000\n });\n });\n }", "title": "" }, { "docid": "d6657b5876c421d1f61338d54d82f09d", "score": "0.6393938", "text": "function positionPieces() {\n board = {}\n\n var columns = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];\n for (var rank = 1; rank <= 8; rank++)\n for (var file = 0; file < 8; file++)\n board[columns[file] + rank] = undefined;\n\n board['a1'] = game.black.rooks[0].moveTo('a1');\n board['b1'] = game.black.knights[0].moveTo('b1');\n board['c1'] = game.black.bishops[0].moveTo('c1');\n board['d1'] = game.black.queen.moveTo('d1');\n board['e1'] = game.black.king.moveTo('e1');\n board['f1'] = game.black.bishops[1].moveTo('f1');\n board['g1'] = game.black.knights[1].moveTo('g1');\n board['h1'] = game.black.rooks[1].moveTo('h1');\n\n for (var i = 0; i < game.black.pawns.length; i++) {\n pawn = game.black.pawns[i];\n pawn.moveTo(columns[i] + '2');\n board[columns[i] + '2'] = pawn;\n };\n\n // rotacionado todas as peças pretas para ficarem de frente para a camera\n _.invoke(_.flatten(ChessPlayer.game().black), 'rotate', [0, 180, 0]);\n game.black.king.rotate([0, 90, 0]);\n\n board['a8'] = game.white.rooks[0].moveTo('a8');\n board['b8'] = game.white.knights[0].moveTo('b8');\n board['c8'] = game.white.bishops[0].moveTo('c8');\n board['d8'] = game.white.queen.moveTo('d8');\n board['e8'] = game.white.king.moveTo('e8').rotate([0, 90, 0]);\n board['f8'] = game.white.bishops[1].moveTo('f8');\n board['g8'] = game.white.knights[1].moveTo('g8');\n board['h8'] = game.white.rooks[1].moveTo('h8');\n\n for (var i = 0; i < game.white.pawns.length; i++) {\n pawn = game.white.pawns[i];\n pawn.moveTo(columns[i] + '7');\n board[columns[i] + '7'] = pawn;\n }\n }", "title": "" }, { "docid": "b7b1ff756a8ac0896d1291d1459b2ea2", "score": "0.63718617", "text": "update(click){\n\t\tlet pos = click.target.getAttribute('data-position')\n\t\tif(this.state.board[pos] === \"\" && !this.state.endInWin){\n\t\t\tlet curSymbol = this.state[this.state.turn]\n\t\t\tlet newBoard = this.state.board.slice()\t\t\t\t\t\t\t\t\t\t\t\t\t//copy board to avoid mutating state directly\n\t\t\t\t\t\t\n\t\t\tnewBoard[pos] = curSymbol\n\t\t\tthis.checkWinner(newBoard)\n\t\t\tthis.setState({\n\t\t\tboard:newBoard,\n\t\t\tturn:this.state.turn === \"PLAYER_1\" ? \"PLAYER_2\" : \"PLAYER_1\"\n\t\t\t})\n\t\t}else if(this.state.endInWin){\n\t\t}\n\t\t\t\n\t}", "title": "" }, { "docid": "8df83387f50ac1173a1646558ff60ad2", "score": "0.6367594", "text": "function placePiece() {\n if (currentPiece) {\n $.each(currentPieceCoords, function (key, value) {\n\n if ((value[0] + currentPieceY) >= 0){\n board[value[0] + currentPieceY][value[1] + currentPieceX] = value[2];\n }\n\n });\n\n currentPiece = false;\n }\n }", "title": "" }, { "docid": "ad5918927f7508edb94a1be853e9725f", "score": "0.63604915", "text": "function updatePosition() {\n\n // These are the boundaries of the grid \n const x = snakePosition % width\n const y = Math.floor(snakePosition / width)\n\n // Move the position if it conforms to the following conditions:\n // 1) What is the direction it wants to go to next?\n // 2) Is it within the grid boundaries?\n // 3) Is that cell already taken by the snake (which is contained in renderArray)?\n if (currentDirection == 39 && x < width - 1 && !renderArray.includes(snakePosition + 1)) { // Go right\n snakePosition++\n } else if (currentDirection == 37 && x > 0 && !renderArray.includes(snakePosition - 1)) { // Go left \n snakePosition--\n } else if (currentDirection == 38 && y > 0 && !renderArray.includes(snakePosition - width)) { // Go up \n snakePosition -= width\n } else if (currentDirection == 40 && y < width - 1 && !renderArray.includes(snakePosition + width)) { // Go down \n snakePosition += width\n } else { // Otherwise, end the game\n\n currentDirection = 0\n\n gridWrapper.setAttribute('style', 'z-index: 1') // Hide the grid\n end.setAttribute('style', 'z-index: 30') // Show the game over splash screen\n\n document.getElementById('end').play() // Play the game over sound\n sleep(3000)\n // Reload the page to start playing again\n window.location.reload()\n }\n\n }", "title": "" }, { "docid": "8c81513aa066b06edf11a45642e6d08e", "score": "0.6308053", "text": "update() {\n let row = int(this.destCoords[0]/this.size);\n let col = int(this.destCoords[1]/this.size);\n\n if (!this.talking && this.x == row && this.y == col) {\n // at destination\n this.moving = false;\n this.thinking = true;\n }\n }", "title": "" }, { "docid": "7bcedb4165ebeed6bf5887617df08318", "score": "0.6292257", "text": "moved(...param) {\n\t\tthis.data.board.resetSquares(); // reset possible squares ui\n\t\tthis.data.board.setMovedSquare(...param);\n\t\tthis.changeTurn(); // whem player moves, change turn player\n\t\tthis.notify(); // update, alert and prompt\n\t\tthis.isMate(); // check if mate\n\t\tthis.updatePlayers(); // update players\n\t\tthis.insertToMatchHistory(...param); // insert into match history\n\t}", "title": "" }, { "docid": "9b29730c28bf7b2138f4c6c53325c3de", "score": "0.62824607", "text": "function movePiece() {\n\t//if red king,\n\tif (checkerBoardArray[initialRow][initialCol] === 'rk') {\n\t\t//adding class for destination position\n\t\t$(`.play-checker-tile[row=${destRow}][col=${destCol}]`).addClass('redking');\n\t\t//removing class for initial position\n\t\t$(`.play-checker-tile[row=${initialRow}][col=${initialCol}]`).removeClass('redking');\n\t\t//updating javascript array\n\t\tcheckerBoardArray[destRow][destCol] = 'rk';\n\t\tcheckerBoardArray[initialRow][initialCol] = ' ';\n\t}\n\t//if black king, (doing the same funcionality as - if red king)\n\tif (checkerBoardArray[initialRow][initialCol] === 'bk') {\n\t\t$(`.play-checker-tile[row=${destRow}][col=${destCol}]`).addClass('blackking');\n\t\t$(`.play-checker-tile[row=${initialRow}][col=${initialCol}]`).removeClass('blackking');\n\t\tcheckerBoardArray[destRow][destCol] = 'bk';\n\t\tcheckerBoardArray[initialRow][initialCol] = ' ';\n\t}\n\t//if red checker,\n\tif (checkerBoardArray[initialRow][initialCol] === 'r') {\n\t\t//adding class for destination position\n\t\t$(`.play-checker-tile[row=${destRow}][col=${destCol}]`).addClass('red-checker');\n\t\t//removing class for initial position\n\t\t$(`.play-checker-tile[row=${initialRow}][col=${initialCol}]`).removeClass('red-checker');\n\t\t//updating javascript array\n\t\tcheckerBoardArray[destRow][destCol] = 'r';\n\t\tcheckerBoardArray[initialRow][initialCol] = ' ';\n\t\t//if red checker reaches the bottom of the board,\n\t\tif (destRow === 7) {\n\t\t\t//git it a class of red king\n\t\t\t$(`.play-checker-tile[row=${destRow}][col=${destCol}]`).addClass('redking').removeClass('red-checker');\n\t\t\tcheckerBoardArray[destRow][destCol] = 'rk';\n\t\t}\n\t\t//if black checker, (doing the same funcionality as - if red checker)\n\t} else if (checkerBoardArray[initialRow][initialCol] === 'b') {\n\t\t$(`.play-checker-tile[row=${destRow}][col=${destCol}]`).addClass('black-checker');\n\t\t$(`.play-checker-tile[row=${initialRow}][col=${initialCol}]`).removeClass('black-checker');\n\t\tcheckerBoardArray[destRow][destCol] = 'b';\n\t\tcheckerBoardArray[initialRow][initialCol] = ' ';\n\t\tif (destRow === 0) {\n\t\t\t$(`.play-checker-tile[row=${destRow}][col=${destCol}]`).addClass('blackking').removeClass('black-checker');\n\t\t\tcheckerBoardArray[destRow][destCol] = 'bk';\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f98c0dae2f60bf31bc0756668adc34c3", "score": "0.6261796", "text": "function performMove(data) {\n const move = game.move({\n from: data.source,\n to: data.target,\n promotion: data.pawn_promotion\n })\n if (move === null) return 'snapback';\n\n updateStatus();\n board.position(game.fen())\n}", "title": "" }, { "docid": "be6638365802d5b2a4ef4d44b3a98362", "score": "0.62406886", "text": "moveChecker(start, end){\n //return coordinates as an array\n let startMovePiece = start.split('')\n let endMovePiece = end.split('')\n console.log(startMovePiece)\n console.log(endMovePiece)\n //similar to change player turn sets the endMovePiece x and y indices = to beginMovePiece x and y indices thus moving piece\n this.board.grid[ endMovePiece[0] ][endMovePiece [1] ] = this.board.grid [ startMovePiece [0]] [startMovePiece[1] ]\n //clears out the startMovePiece x and y indices\n this.board.grid[startMovePiece [0]] [startMovePiece [1] ] = null\n }", "title": "" }, { "docid": "f1f22f6df6728df34da376bce836ac43", "score": "0.62219423", "text": "function pawnClicked(){\n /*making sure it's the corrent turn*/\n if ($(this).hasClass(\"movable\")){\n /*lastClicked = tile\n as classArray = lastClicked classes, i get the coordinates of the image*/\n lastClicked = $(this).closest(\"div\");\n console.log(\"pawn clicked!\");\n /*go to pieceClicked for more info on this function*/\n pieceClicked();\n \n /*pawns bio:\n √ at the start, they have the opportunity to move two blocks instead of one\n √ other than that exception, they can only move one block at a time\n √ unlike other pieces, they can't eat the opposition piece when they're in the pawns path\n √ however, this gives them the special move to eat if the opposition piece is **diagonally in front of them**\n √ they can only move forward\n - however, once they reach to the other end of the board, they can get promoted to either a knight, rook or queen\n yeah, they have a lot of conditions.\n\n approach:\n since white pawns and black pawns goes the opposite direction:\n normalBPawn/normalWPawn = identifies the coordinates of the block they can move\n eatableBPawn/eatableWPawn = identifies the coordinates of the block they can eat\n - (normal/eatable)BPawn = exclusively for black pawns, vice versa*/\n var normalBPawn = \".\"+yCoordinates[yCoordinates.indexOf(classArray[1]) + 1]+\".\"+classArray[2];\n var normalWPawn = \".\"+yCoordinates[yCoordinates.indexOf(classArray[1]) - 1]+\".\"+classArray[2];\n var eatableBPawn = [\".\"+yCoordinates[yCoordinates.indexOf(classArray[1]) + 1]+\".\"+(parseInt(classArray[2])+1), \".\"+yCoordinates[yCoordinates.indexOf(classArray[1]) + 1]+\".\"+(parseInt(classArray[2])-1)];\n var eatableWPawn = [\".\"+yCoordinates[yCoordinates.indexOf(classArray[1]) - 1]+\".\"+(parseInt(classArray[2])+1), \".\"+yCoordinates[yCoordinates.indexOf(classArray[1]) - 1]+\".\"+(parseInt(classArray[2])-1)];\n \n /*SPECIAL INITIAL MOVES: black pawns\n if it's on row B and is a black piece... (see first point of pawn bio)*/\n if (classArray[1] == \"B\" && $(this).hasClass(\"blackPiece\") ){\n for(var z=0;z<2;z++){\n currentMoves = $(\".\"+yCoordinates[z+2]+\".\"+classArray[2]);\n /*approach: if they can't see another piece, they can move.\n this is so that they are restricted and can't mess the board by sharing one space with another piece. \n (remember that this applies to white pieces too, check third point of pawns bio)*/\n if ($(currentMoves).find(\"img\").length == 0){\n currentMoves.addClass(\"special\");\n }\n }\n }\n /*SPECIAL MOVES: white pawns\n if it's on row G and is a white piece... (see first point of pawn bio)*/\n else if (classArray[1] == \"G\" && $(this).hasClass(\"whitePiece\") ){\n for(var z=0;z<2;z++){\n /*in terms of board positions, they're on the 6th y-coordinate\n to move 2 steps forward, you have to target rows 4 and 5*/\n currentMoves = $(\".\"+yCoordinates[z+4]+\".\"+ classArray[2]);\n /*approach: if they can't see another piece, they can move.\n this is so that they are restricted and can't mess the board by sharing one space with another piece. \n (remember that this applies to white pieces too, check third point of pawns bio)*/\n if ($(currentMoves).find(\"img\").length == 0){\n currentMoves.addClass(\"special\");\n }\n }\n }\n /*NORMAL MOVES: black pawns\n if it's not on row B, is a black piece...*/\n else if($(this).hasClass(\"blackPiece\")){\n /*and if there are no pieces blocking its path... highlight the coordinates it can move to*/\n if ($(normalBPawn).find('img').length==0){\n $(normalBPawn).addClass(\"special\");\n }\n }\n /*NORMAL MOVES: white pawns\n if it's not on row G, is a white piece...*/\n else if ($(this).hasClass(\"whitePiece\")){\n /*and if there are no pieces blocking its path... highlight the coordinates it can move to*/\n if ($(normalWPawn).find('img').length==0){\n $(normalWPawn).addClass(\"special\");\n }\n }\n \n /*SPECIAL EATING MOVE\n since there are two possible coordinates that this condition can activate at once...*/\n for (var i=0;i<2;i++) {\n /*if it's a white pawn and spots a blackPiece class in an eatable condition from the white pawn*/\n if ($(this).hasClass(\"whitePiece\") && $(eatableWPawn[i]).find(\".blackPiece\").length == 1) {\n $(eatableWPawn[i]).addClass(\"eat\");\n }\n /*if it's a black pawn and spots a whitePiece class in an eatable condition from the black pawn*/\n else if ($(this).hasClass(\"blackPiece\") && $(eatableBPawn[i]).find(\".whitePiece\").length == 1) {\n $(eatableBPawn[i]).addClass(\"eat\");\n }\n }\n /*PROMOTION*/\n\n /*END*/\n }\n}", "title": "" }, { "docid": "4f21a868768db8c0f610193e6178a950", "score": "0.6219553", "text": "function movePieces(cell, piece, promotion) {\n var position = document.getElementById(cell), selectedPiece = getPieceName(game.selectedGamePiece);\n position.style.backgroundRepeat = \"no-repeat\";\n // if we have a promotion enter the new value in the promotion\n if(promotion){\n position.style.backgroundImage = game.img[promotion];\n }else{\n position.style.backgroundImage = game.img[selectedPiece];\n }\n\n // we set the array to the value of the new piece to the selected piece\n var rank1 = game.rank.indexOf(position.id[0]);\n // if we have a promotion we need to set the new piece in the array\n if(promotion){\n game.board[position.id[1] - 1][rank1] = translatePiece(promotion);\n }else{\n game.board[position.id[1] - 1][rank1] = piece;\n }\n\n\n //change the old position to the old color\n position = document.getElementById(game.selectedPieceLocation);\n position.style.backgroundImage = '';\n position.className = game.selectedCellCss;\n\n\n // we need to set the old position in the array to 0\n rank1 = game.rank.indexOf(game.selectedPieceLocation[0]);\n game.board[game.selectedPieceLocation[1] - 1][rank1] = 0;\n // clear out all of the selected values to null\n game.selectedPieceLocation = null;\n game.selectedGamePiece = null;\n game.selectedCellCss = null;\n game.lastColorMove = selectedPiece[0];\n\n console.log(game.board.forEach(logArrayElements));\n}", "title": "" }, { "docid": "151333f9833209d448c39320aab970c7", "score": "0.62150127", "text": "applyPosition() {\n let row = parseInt(this.getAttribute('r'));\n let column = parseInt(this.getAttribute('c'));\n\n let x = column * 75 - 50;\n let y = ((row * 100) - 50) + (column * 50);\n\n this.setAttribute('style', `transform: translate(${x - this.board.pieceOffsetX}%, ${y - this.board.pieceOffsetY}%);`);\n }", "title": "" }, { "docid": "be54c41abbc2d22c42a0510aa88195e3", "score": "0.6189145", "text": "async botMovePiece(reply) {\n if(this.timer.counting==false || this.phase == 'gameOver' || this.busy)\n return;\n let response = JSON.parse(reply.target.response);\n this.boards.push(this.board_state);\n this.board_state = translatePLtoJSboard(response.argA);\n let move = JSON.parse(response.argB.replace(/\\//g,','));\n\n let pieces;\n let piecePushed;\n if(this.player == 'w')\n pieces = this.whitePieces;\n else\n pieces = this.blackPieces;\n //Check if there was any piece pushed\n if(Array.isArray(move[0])) {\n piecePushed = move[1];\n move = move[0];\n this.moves.push([move,piecePushed])\n } else {\n this.moves.push(move);\n }\n\n if(piecePushed != undefined && piecePushed.length != 0) {\n //If one was, move it either to:\n let enemyPieces;\n if(this.player == 'w')\n enemyPieces = this.blackPieces;\n else\n enemyPieces = this.whitePieces;\n if(piecePushed.length == 4) {\n //Another position in the board\n for (let i = 0; i < enemyPieces.length; i++) {\n if(enemyPieces[i].position[0] == piecePushed[1] && enemyPieces[i].position[1] == piecePushed[0]) {\n enemyPieces[i].position[0] = piecePushed[3];\n enemyPieces[i].position[1] = piecePushed[2];\n if(enemyPieces[i].animation != null)\n mat4.translate(enemyPieces[i].transformation, enemyPieces[i].transformation, [enemyPieces[i].animation.x, enemyPieces[i].animation.y, enemyPieces[i].animation.z]);\n enemyPieces[i].animation = new PieceMoveAnimation(this.scene, piecePushed[3]-piecePushed[1], piecePushed[2]-piecePushed[0]);\n }\n }\n } else if (piecePushed.length == 2){\n //The captured pieces pile\n if(enemyPieces == this.blackPieces)\n this.scores[Math.floor(piecePushed[1]/this.boardSize)][Math.floor(piecePushed[0]/this.boardSize)][0]-=1;\n else\n this.scores[Math.floor(piecePushed[1]/this.boardSize)][Math.floor(piecePushed[0]/this.boardSize)][1]-=1;\n for (let i = 0; i < enemyPieces.length; i++) {\n if(enemyPieces[i].position[0] == piecePushed[1] && enemyPieces[i].position[1] == piecePushed[0]) {\n if(enemyPieces[i].animation != null)\n mat4.translate(enemyPieces[i].transformation, enemyPieces[i].transformation, [enemyPieces[i].animation.x, enemyPieces[i].animation.y, enemyPieces[i].animation.z]);\n enemyPieces[i].animation = new PieceCaptureAnimation(this.scene, enemyPieces[i].position[0], enemyPieces[i].position[1], this.pileHeight, this.boardSize, this.boardSpacing);\n enemyPieces[i].position[0] = -1;\n enemyPieces[i].position[1] = -1;\n this.piecePile.push(enemyPieces[i]);\n this.pileHeight += 0.1;\n }\n }\n }\n }\n //Move the actual piece\n for (let i = 0; i < pieces.length; i++) {\n if(pieces[i].position[0] == move[1] && pieces[i].position[1] == move[0]) {\n pieces[i].position[0] = move[3];\n pieces[i].position[1] = move[2];\n if(pieces[i].animation != null)\n mat4.translate(pieces[i].transformation, pieces[i].transformation, [pieces[i].animation.x, pieces[i].animation.y, pieces[i].animation.z]);\n pieces[i].animation = new PieceMoveAnimation(this.scene, move[3]-move[1], move[2]-move[0]);\n }\n }\n\n await new Promise(r => setTimeout(r, 500));\n\n //Ready next turn\n if(this.turn==1) {\n this.turn=2;\n this.lastMoveStartX = move[1];\n this.lastMoveStartY = move[0];\n this.lastMoveEndX = move[3];\n this.lastMoveEndY = move[2];\n this.checkGameOver();\n if(this.phase == \"gameOver\")\n return;\n postGameRequest(\"[bot_move,\" + translateJStoPLboard(this.board_state) + \",\" + this.difficulty + \",\" + this.player + \",\" + this.turn + \",[\" + move[0] + \"/\" + move[1] + \",\" + move[2] + \"/\" + move[3]+\"]]\", this.botMovePiece.bind(this));\n } else {\n this.timer.resetCount();\n this.turn=1;\n if(this.player=='w')\n this.player='b';\n else this.player='w';\n this.checkGameOver();\n if(this.phase == \"gameOver\")\n return;\n await new Promise(r => setTimeout(r, 500));\n this.gameCameraRotation += Math.PI;\n await new Promise(r => setTimeout(r, 250));\n if(!this.isHumanPlaying())\n postGameRequest(\"[bot_move,\" + translateJStoPLboard(this.board_state) + \",\" + this.difficulty + \",\" + this.player + \",\" + this.turn + \"]\", this.botMovePiece.bind(this));\n }\n console.log('Bot move successful');\n }", "title": "" }, { "docid": "787c7c6f48d30474dcf49106c0220383", "score": "0.61768776", "text": "function upgradePawnLogic(startSquare, targetSquare) {\n if (targetSquare > -1 && targetSquare < 8 && board[startSquare] == wPawn) {\n board[startSquare] = wQueen;\n } else if (targetSquare > 55 && targetSquare < 64 && board[startSquare] == bPawn) {\n board[startSquare] = bQueen;\n }\n}", "title": "" }, { "docid": "d69f108bc94116a3c0bf9ae1350a359e", "score": "0.6154176", "text": "function movePiece(){\r\n\tmovePieceNumber = last_selected;\r\n\tpieces[movePieceNumber].x = selectionLocation.x;\r\n\tpieces[movePieceNumber].y = selectionLocation.y;\r\n\t//reset selection pieces - 32 is the number of piece to use for no piece\r\n\tsquares[pieces[movePieceNumber].x][pieces[movePieceNumber].y].piece = 32;\r\n\tcvs3PieceMoveX.setAttribute(pieces[movePieceNumber].centreX, $setXYToScreenXY(selectionLocation.x), 1000);\r\n\tcvs3PieceMoveY.setAttribute(pieces[movePieceNumber].centreY, $setXYToScreenXY(selectionLocation.y), 1000);\r\n\tlast_selected = 32;\r\n\tselection = 32;\r\n\tresetSelection();\r\n\tanimate();\r\n}", "title": "" }, { "docid": "9c269c80c27af0d9aa40c303d3c9384e", "score": "0.6152078", "text": "move() {\n // if the sprite has no next cell and no trailing cell on the board and the sprite has already moved\n if (!this.type.$nextCell && !this.type.$trailingCell && !this.type.firstMove) {\n // then it's time to delete the sprite, so we set its offBoard property so that a later method can remove it\n this.offBoard = true;\n }\n // swapCells method does the actual moving of the sprite's divs\n this.swapCells();\n // updateObject method sets the new column numbers of the sprite, then...\n this.updateObject();\n // ...we update the cellsTakenUp array to hold the new divs\n this.cellsTakenUp = this.getCellElems();\n // also set the firstMove property to false, because the sprite just went through a move\n this.type.firstMove = false;\n }", "title": "" }, { "docid": "5811cd410fbd8c68ba4cd3667fe9393e", "score": "0.61482525", "text": "function processMove(oldSpace, newSpace) {\n\n\tlet oldCoord = s2aChess(oldSpace);\n\tlet newCoord = s2aChess(newSpace);\n\n\tlet oldboard = copyBoard(board);\n\n\n\n\tboard = mockBoard(oldSpace, newSpace, board); // make board the mock board because we are committing board changes\n\n\t// process an en passant\n\t// we know the old coordinates and the new coordinates\n\t// custom function to process an en passant using those 2 data points\n\t// checking for enpassant before board changes will be made. therefore the board\n\t// changes will simply execute the legal move anyway\n\tconsole.log(isEnpassant(oldCoord, newCoord, oldboard) + ' ' + (oldCoord) + ' to ' + (newCoord) + ' passing ' + s2aChess(enpassant));\n\tif (isEnpassant(oldCoord, newCoord, oldboard)) {\n\t\tlet enPawn = s2aChess(enpassant);\n\t\toldboard[enPawn[0]][enPawn[1]] = 0; // previous pawn has been captured\n\t\tboard[enPawn[0]][enPawn[1]] = 0; // previous pawn has been captured\n\t}\n\tenpassant = ''; // clear out enpassant string so no repeat captures can be made there\n\n\n\t// did a pawn move 2 (assumably for the first time)? add it to enpassant\n\tif ((oldboard[oldCoord[0]][oldCoord[1]])%10 === 1 && Math.abs(oldCoord[0] - newCoord[0]) >= 2) {\n\t\tenpassant = newSpace; // adding the space it moved to, to store which pawn can be enpassanted\n\t}\n\n\t// push the captured piece to the records\n\tif (oldboard[newCoord[0]][newCoord[1]] !== 0) {\n\t\tcaptured.push(oldboard[newCoord[0]][newCoord[1]]);\n\t}\n\n\thtmlBoard(board); // when we process the move we show the board\n}", "title": "" }, { "docid": "f3ac4be223c58bf3dadc45458e2ec927", "score": "0.6145815", "text": "function playerTurn(board, x, y) {\n\tvar column = Math.floor(x / LENGTH);\t\t// find out the intersection of the row and column using the coordinates of where the player clicked\n\tvar row = Math.floor(y / LENGTH);\n\tvar highlightedTile = null; \t\t\t\t// not null if tile selected is highlighted in someway, ie. can the piece be moved there\n\n\t//check if selected tile is highlighted\n\thighlightedTiles.forEach(function(action) {\n\t\tif (action.row == row && action.column == column) {\n\t\t\thighlightedTile = action;\n\t\t\tobjLogData.action = action;\n\t\t}\n\t});\n\t//console.log('prev. coords ' + lastRowSelected + ' ' + lastColumnSelected);\n\n\t//deal with piece movement (including attacking) - piece selected last turn; time to move!\n\tif (highlightedTile) {\t\t\n\t\tobjLogData.previousRow = lastSelectedTile.row;\n\t\tobjLogData.previousColumn = lastSelectedTile.column;\n\t\t\n\t\t// enPassantHandler(highlightedTile);\n\t\t\n\t\tif (pawnThatMovedTwoLastTurn !== null)\n\t\t\tpawnThatMovedTwoLastTurn = null;\n\t\t// check if pawn moved 2 ranks\n\t\tif (lastSelectedTile !== null && lastSelectedTile.piece.type == \"Pawn\") {\n\t\t\tif (Math.abs(lastSelectedTile.row - row) == 2) {\n\t\t\t\tpawnThatMovedTwoLastTurn = lastSelectedTile.piece;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// handle special cases of piece movement\n\t\tif (highlightedTile.actionType == ActionType.ENPASSANT)\n\t\t\tenPassantHandler(highlightedTile);\n\t\tcastlingHandler(lastSelectedTile, highlightedTile);\n\t\t\n\t\t//move the piece corresponding to that highlighted pattern to the selected location \n\t\tboard.movePiece(lastSelectedTile.row, lastSelectedTile.column, row, column);\n\t\tdraw(board);\n\t\t\n\t\t// check if it's in a promotion tile; only works for white pieces\n\t\t// NOTE CPU (black) will move before the piece to upgrade to is selected\n\t\tif (lastSelectedTile.piece.isWhite && lastSelectedTile.piece.type === 'Pawn') {\n\t\t\tif (row == 0) {\n\t\t\t\t//call promotion fn\n\t\t\t\t$('#promotion')\n\t\t\t\t\t.data( {isWhite: true, row: row, column: column} )\t// 2nd 'row' is the variable\n\t\t\t\t\t.dialog({\n\t\t\t\t\t\tdialogClass: \"no-close\",\t\t\t\t\t\t// remove close button\n\t\t\t\t\t\tmodal: true,\n\t\t\t\t\t\ttitle: \"Promote piece\"\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\t\n\t\t// update check status for opponent\n\t\tinCheck(board, !playerIsWhite);\n\t\t\n\t\t//update tracking variables\n\t\thighlightedTile = null;\n\t\thighlightedTiles = []; \t\t\t\t\t\t\t\t\t\t\t\t// reset which tiles are hightlighted each time this runs\n\t\tisWhiteTurn = (lastSelectedTile.piece.isWhite) ? false : true;\t\t// toggle game turn after a piece has moved\n\t}\n\t/* logic used when a piece is first selected - before anything is highlighted for the player\n\t * check if player clicked on their own piece and highlight the appropriate tiles in response\n\t */\n\telse if (lastSelectedTile = getBoardTileWithCoords(board, x, y)) {\n\t\tvar lastSelectedPiece = lastSelectedTile.piece;\n\t\tvar legalMoves = [];\t\t\t// all moves which don't place the acting side's King in check\n\t\tvar potentialMoves = [];\t\t// all moves\n\t\tvar isPlayerTurn;\n\t\tvar selectedKingTile;\t\t\t// the King belonging to the player\n\t\thighlightedTiles = [];\n\t\t\n\t\t// DEBUG currently lets you select any piece\n\t\t// only allow interaction with pieces of the correct colour\n\t\tif (lastSelectedTile !== undefined)\n\t\t\tisPlayerTurn = lastSelectedTile.piece.isWhite === lastSelectedTile.piece.isWhite; \n\t\t\n\t\t// only allow King to be selected if King is in check\n\t\t// NOTE need to test with other enemy pieces of all types\n\t\tselectedKingTile = (lastSelectedTile.piece.isWhite) ? board.whiteKingTile : board.blackKingTile;\t\t//(playerIsWhite)\n\t\t\n\t\t// opens the possibility of moving the other side's pieces if the player's side King is in check\n\t\tif (selectedKingTile !== undefined && inCheck(board, selectedKingTile.piece.isWhite)) { \t\t\n\t\t\tif (lastSelectedPiece.type == 'King') {\n\t\t\t\tpotentialMoves = lastSelectedPiece.getStandardMoves(board, false, lastSelectedTile.row, lastSelectedTile.column);\n\t\t\t\n\t\t\t\t//only highlight moves that will get the King out of check. Could alternatively avoid potential checks by ensuring the king in check doesn't move into any of the movement tiles listed in potential moves. This would work for all pieces whose movement options are the same as their attack options.\n\t\t\t\tpotentialMoves.forEach(function(action) {\n\t\t\t\t\tlet futureBoardState = new Board(board);\n\t\t\t\t\tfutureBoardState.movePiece(lastSelectedTile.row, lastSelectedTile.column, action.row, action.column);\n\t\t\t\t\tif (!inCheck(futureBoardState, selectedKingTile.piece.isWhite)) {\n\t\t\t\t\t\tlet actionColour;\n\t\t\t\t\t\tif (action.actionType == ActionType.MOVE) {\n\t\t\t\t\t\t\tactionColour = MELLOW_YELLOW;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (action.actionType == ActionType.ATTACK) {\n\t\t\t\t\t\t\tactionColour = LIGHT_RED;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfill(ctxHighlight, actionColour, action);\n\t\t\t\t\t\tlegalMoves.push(action);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} \n\t\t\t// allow selection of pieces that can get the King out of check\n\t\t\t// TODO doesn't work if you block the checkingPiece's path to the king\n\t\t\telse {\n\t\t\t\tlet potentialMovesForPiece;\n\t\t\t\tlet movesOfCheckingPiece; \n\t\t\t\tif (lastSelectedPiece.isWhite == selectedKingTile.piece.isWhite) {\t\t\t\n\t\t\t\t\tpotentialMovesForPiece = lastSelectedTile.piece.getStandardMoves(board, false, lastSelectedTile.row, lastSelectedTile.column);\n\t\t\t\t\tmovesOfCheckingPiece = board.tileOfCheckingPiece.piece.getStandardMoves(board, false, board.tileOfCheckingPiece.row, board.tileOfCheckingPiece.column);\n\t\t\t\t\t\n\t\t\t\t\tfor (let i = 0; i < potentialMovesForPiece.length; i++) {\n\t\t\t\t\t\tlet action = potentialMovesForPiece[i];\n\t\t\t\t\t\t// if the selected piece can attack the checking piece\n\t\t\t\t\t\tif (action.actionType == ActionType.ATTACK && action.row == board.tileOfCheckingPiece.row && action.column == board.tileOfCheckingPiece.column) {\n\t\t\t\t\t\t\tlegalMoves.push(action);\n\t\t\t\t\t\t\tfill(ctxHighlight, LIGHT_RED, action); // consider doing this outside the loop separately\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// if the selected piece can block the checking piece and prevent it from capturing the King next move\n\t\t\t\t\t\telse if (action.agent.type !== 'Knight') {\n\t\t\t\t\t\t\tfor (let j = 0; j < movesOfCheckingPiece.length; j++) {\n\t\t\t\t\t\t\t\tif (potentialMovesForPiece[i].row == movesOfCheckingPiece[j].row && potentialMovesForPiece[i].column == movesOfCheckingPiece[j].column) {\n\t\t\t\t\t\t\t\t\tif (movesOfCheckingPiece[j].row == 5 && movesOfCheckingPiece[j].column == 6)\n\t\t\t\t\t\t\t\t\t\tconsole.log();\n\t\t\t\t\t\t\t\t\t// vert and horz cap if row != and col !=\n\t\t\t\t\t\t\t\t\t// vert cap if row ==\n\t\t\t\t\t\t\t\t\tif (board.tileOfCheckingPiece.row == selectedKingTile.row) {\n\t\t\t\t\t\t\t\t\t\tif (Math.abs(potentialMovesForPiece[i].column - selectedKingTile.column) < Math.abs(board.tileOfCheckingPiece.column - selectedKingTile.column)) {\n\t\t\t\t\t\t\t\t\t\t\tlegalMoves.push(potentialMovesForPiece[i]);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t// horz cap if col ==\n\t\t\t\t\t\t\t\t\telse if (board.tileOfCheckingPiece.column == selectedKingTile.column) {\n\t\t\t\t\t\t\t\t\t\tif (Math.abs(potentialMovesForPiece[i].row - selectedKingTile.row) < Math.abs(board.tileOfCheckingPiece.row - selectedKingTile.row)) {\n\t\t\t\t\t\t\t\t\t\t\tlegalMoves.push(potentialMovesForPiece[i]);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tif (Math.abs(potentialMovesForPiece[i].row - selectedKingTile.row) < Math.abs(board.tileOfCheckingPiece.row - selectedKingTile.row) \n\t\t\t\t\t\t\t\t\t\t\t&& Math.abs(potentialMovesForPiece[i].column - selectedKingTile.column) < Math.abs(board.tileOfCheckingPiece.column - selectedKingTile.column))\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tlegalMoves.push(potentialMovesForPiece[i]);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tlegalMoves.forEach(function(action) {\n\t\t\t\t\t\tlet actionColour;\n\t\t\t\t\t\tif (action.actionType == ActionType.MOVE) {\n\t\t\t\t\t\t\tactionColour = MELLOW_YELLOW;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (action.actionType == ActionType.ATTACK) {\n\t\t\t\t\t\t\tactionColour = LIGHT_RED;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfill(ctxHighlight, actionColour, action);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// highlight the appropriate tiles\n\t\telse {\t\n\t\t\tlet potentialMoves = lastSelectedPiece.getStandardMoves(board, false, lastSelectedTile.row, lastSelectedTile.column); \n\t\t\t\n\t\t\tif (lastSelectedPiece.type == 'Pawn')\n\t\t\t\tpotentialMoves = potentialMoves.concat(getEnPassantMoves(board, false, lastSelectedTile));\n\t\t\telse if (lastSelectedPiece.type == 'King') {\n\t\t\t\t// castling options\n\t\t\t\t// check right\n\t\t\t\tlet castlingRookTile = board.getTile(lastSelectedTile.row, 7);\n\t\t\t\tif (castlingRookTile !== null && canCastle(lastSelectedTile, castlingRookTile)) {\t\t\n\t\t\t\t\tlegalMoves.push(new Action(this, ActionType.MOVE, lastSelectedTile.row, lastSelectedTile.column + 2));\t// can push to legal moves as canCastle checks for move legality inherently\n\t\t\t\t}\n\t\t\t\t// check left\n\t\t\t\tcastlingRookTile = board.getTile(lastSelectedTile.row, 0);\n\t\t\t\tif (castlingRookTile !== null && canCastle(lastSelectedTile, castlingRookTile))\t{\n\t\t\t\t\tlegalMoves.push(new Action(this, ActionType.MOVE, lastSelectedTile.row, lastSelectedTile.column - 2));\n\t\t\t\t}\n\t\t\t}\n\t\t\t// only allow actions that won't place the King in check\n\t\t\tpotentialMoves.forEach(function(action) {\n\t\t\t\tlet futureBoardState = new Board(board);\n\t\t\t\tfutureBoardState.movePiece(lastSelectedTile.row, lastSelectedTile.column, action.row, action.column);\n\t\t\t\tif (!inCheck(futureBoardState, lastSelectedPiece.isWhite)) {\n\t\t\t\t\tlegalMoves.push(action);\n\t\t\t\t}\n\t\t\t});\n\t\t\t\t\n\t\t\t// highlight legal moves\n\t\t\tlegalMoves.forEach(function(action) {\n\t\t\t\tlet actionColour;\n\t\t\t\tif (action.actionType == ActionType.MOVE) {\n\t\t\t\t\tactionColour = MELLOW_YELLOW;\n\t\t\t\t}\n\t\t\t\telse if (action.actionType == ActionType.ATTACK) {\n\t\t\t\t\tactionColour = LIGHT_RED;\n\t\t\t\t}\n\t\t\t\tfill(ctxHighlight, actionColour, action);\n\t\t\t});\n\t\t}\n\t} \n\t// player clicked off the piece\n\telse {\t\n\t\thighlightedTiles = [];\n\t\thighlightedTile = false;\n\t}\n}", "title": "" }, { "docid": "860fa3d526d693e63dc03c39323a5870", "score": "0.6144071", "text": "movePieceLeft(){\n this.mobile.left();\n this.undoIfConflict();\n }", "title": "" }, { "docid": "1804705b8835c98678ffba39d32a20ca", "score": "0.61420566", "text": "function testMove(board, row1, col1, row2, col2) {\n\tboard[row2][col2] = board[row1][col1];\n\tboard[row1][col1] = \"0\"; \n\n\t// queens pawn if necessary\n\tif (board[row2][col2] == \"whpawn\") {\n\t\tif (perspective == 0) {\n\t\t\tif (row2 == 7) {\n\t\t\t\tboard[row2][col2] = \"whqueen\";\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif (row2 == 0) {\n\t\t\t\tboard[row2][col2] = \"whqueen\";\n\t\t\t}\n\t\t}\n\t}\n\tif (board[row2][col2] == \"blpawn\") {\n\t\tif (perspective == 0) {\n\t\t\tif (row2 == 0) {\n\t\t\t\tboard[row2][col2] = \"blqueen\";\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif (row2 == 7) {\n\t\t\t\tboard[row2][col2] = \"blqueen\";\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "41a791a2bf2f8fa11037e21558829507", "score": "0.6140197", "text": "function completeMove() {\n // this is the cell that we are moving to, the cell we click on\n var cellToMoveTo = {};\n cellToMoveTo.id = this.id;\n // update the cell to move toos color and type\n cellToMoveTo.color = userColor;\n\n var kingSpaces = [\"01\", \"03\", \"05\", \"07\", \"70\", \"72\", \"74\", \"76\"];\n // if not -1, then it is a king space\n if (kingSpaces.indexOf(cellToMoveTo.id) != -1) {\n cellToMoveTo.type = \"king\";\n } else {\n cellToMoveTo.type = cellSelected.type;\n }\n\n // determine the image to place in the new space\n urlString = findImageName(userColor, cellToMoveTo.type);\n\n // UPDATE NEW CELL UI and VALUES to send to SERVER\n if (urlString) {\n document.getElementById(cellToMoveTo.id).innerHTML = \"<img src='/images/checkerPieces/\" + urlString + \"'></img>\";\n }\n\n // UPDATE ORIGINAL CELL UI and VALUES to send to SERVER\n unHighlight(cellSelected.id);\n document.getElementById(cellSelected.id).innerHTML = \"\";\n // update the cell we are moving from\n cellSelected.color = \"none\";\n cellSelected.type = \"none\";\n\n // DETECT IF WE JUMPED OVER A PIECE by using the id of our new cell to detect a cell we jumped over\n var cellCaptured = cellJumpedOver[cellToMoveTo.id]; \n \n var cellsUpdated = [];\n // edits the cell object, adds it to the jail, removee from board\n if (cellCaptured != undefined) {\n document.getElementById(cellCaptured.id).innerHTML = \"\";\n\n // add captured piece to jail\n var color = \"\";\n if (userColor == \"black\") {\n color = \"red\";\n } else {\n color = \"black\";\n }\n\n /* add cell to the opponentsJail */\n var opponentJail = document.getElementById(color+\"Jail\");\n var elem = document.createElement(\"img\");\n var imageName = findImageName(color,\"regular\");\n elem.setAttribute(\"src\", \"/images/checkerPieces/\"+ imageName);\n opponentJail.appendChild(elem);\n\n //update the cell with the capture piece\n cellCaptured.color = \"none\";\n cellCaptured.type = \"none\";\n \n // update the number of pieces that we have captures\n captureCount++;\n\n // list of updated cells for the server to update in endTurnXML\n // includes the cell we moved from, the one we moved to, and cell we jumped over\n var cellsUpdated = { _0: cellSelected, _1: cellToMoveTo, _2: cellCaptured};\n }\n else {\n // list of updated cells for the server to update in endTurnXML\n // includes the cell we moved from, the one we moved to.\n // we did not jump over a cell in this case\n var cellsUpdated = { _0: cellSelected, _1: cellToMoveTo, _2: {}};\n }\n \n for(cell of posMoveArr){\n unHighlight(cell.id);\n }\n\n disablePieces(posMoveArr, \"click\", completeMove);\n disablePieces(myPieces, \"click\", possibleMovements);\n disablePieces(myPieces, \"mouseenter\", enter);\n disablePieces(myPieces, \"mouseleave\", exit);\n \n // ends turn\n endTurnXML(cellsUpdated);\n }", "title": "" }, { "docid": "c092965ff759ab2863a91d3bd1474d85", "score": "0.61366314", "text": "movePieceRight(){\n this.mobile.right();\n this.undoIfConflict();\n }", "title": "" }, { "docid": "67b711e0d60684f9a6a7282dea3735c3", "score": "0.6123282", "text": "function movePiece(board, oldC, oldR, newC, newR) {\n\tif (board[oldC][oldR].color != turn) {\n\t\treturn;\n\t}\n\n\tif (board[newC][newR] != null && board[newC][newR].type == \"king\") {\n\t\talert(\"the \" + board[newC][newR].color + \" king is dead!\");\n\t}\n\tboard[newC][newR] = board[oldC][oldR];\n\tboard[oldC][oldR] = null;\n\tboard[newC][newR].c = newC;\n\tboard[newC][newR].r = newR;\n\n\t// make pawns into queens\n\tif (board[newC][newR].type == \"pawn\") {\n\t\tif (whiteOnTop) {\n\t\t\tif (board[newC][newR].r == 7 && board[newC][newR].color == \"white\") {\n\t\t\t\tboard[newC][newR] = new piece(\"queen\", newC, newR, \"white\");\n\t\t\t} else if (board[newC][newR].r == 0 && board[newC][newR].color == \"black\") {\n\t\t\t\tboard[newC][newR] = new piece(\"queen\", newC, newR, \"black\");\n\t\t\t}\n\t\t} else {\n\t\t\tif (board[newC][newR].r == 0 && board[newC][newR].color == \"white\") {\n\t\t\t\tboard[newC][newR] = new piece(\"queen\", newC, newR, \"white\");\n\t\t\t} else if (board[newC][newR].r == 7 && board[newC][newR].color == \"black\") {\n\t\t\t\tboard[newC][newR] = new piece(\"queen\", newC, newR, \"black\");\n\t\t\t}\n\t\t}\n\t}\n\n\t//drawBoard(board);\n\n\tredraw(board, oldC, oldR, newC, newR);\n\n\tchangeTurn();\n\treturn board;\n}", "title": "" }, { "docid": "1e459664543683a44abeb7fb45ba11f4", "score": "0.6109961", "text": "finalMove(piece, tile, RocketBoost) {\n if(!tile) return;\n let x = tile.x, y = tile.y; // destination coords\n let px = piece.tile.x, py = piece.tile.y; // origin coords\n let dx = x-px, dy = y-py; // difference\n let ox = this.selected_orig.x, oy = this.selected_orig.y, o = this.selected_orig, bs = this.boardState; // first coords\n if(Math.abs(dx) + Math.abs(dy) != 1) return; // only adjacent moves\n this.moves.push(new MyGameMove(bs, o, tile, piece));\n\n let onValid = function(data) {\n if(data.target.status == 200) {\n if(data.target.response) {\n this.boardState = JSON.parse(data.target.response);\n this.checkGameOver();\n console.log((this.player_turn == 1 ? '🟡 Player A' : '🟢 Player B') +\n ' made move: ' + ox + ',' + oy +\n ' » '+ x + ',' + y);\n if(!RocketBoost) this.switchTurn();\n }\n }\n }.bind(this);\n let onReply = function(data) {\n if(data.target.status == 200) {\n if(data.target.response == 1) { // valid move\n server.makeMove_req(this.boardState, ox, oy, x, y, onValid);\n } else { // invalid move go back\n if(!piece.animations[0].chained) piece.animations[0].chain = function() { this.undo(true); }.bind(this);\n }\n }\n }.bind(this);\n\n // move piece animation\n let chain = function() {\n piece.move(tile);\n this.deselectPiece(piece);\n piece.moves_left = piece.type;\n server.validMove_req(this.boardState, ox, oy, x, y, this.player_turn, onReply);\n }.bind(this);\n piece.animations[1] = new MyPieceAnimation(this.scene, 0.5, dy, 0, dx, chain);\n this.unhighlightTiles();\n }", "title": "" }, { "docid": "4d0338e6749127853e72ca768ce2ce46", "score": "0.609787", "text": "function onSnapEnd(source=null, target=null, piece=null){\n\n\t\t//\tGet current board positions\n\t\tvar boardPositions = board.position()\n\n\t\t//\tUpdate positions text object\n\t\tpositionText.text(\"Positions:\\t\" + JSON.stringify(boardPositions).replace(/\\\"/g,'').replace(/\\{/g,'').replace(/\\}/g,'').replace(/\\,/g,', '))\n\n\t\t//\tPOST to python and receive values\n\t\t$.post( \"/postmethod\", board.fen(), function(err, req, resp){\n\n\t\t\t//\tReceive piece values dictionary\n\t\t\tvar pieceValues = resp.responseJSON\n\t\t\tconsole.log(pieceValues)\n\t\t\t//\tRound values for display in valueText object\n\t\t\tvar roundedValues = pieceValues\n\t\t\tfor (i in roundedValues)\n\t\t\t\troundedValues[i] = roundedValues[i].toFixed(2)\n\t\t\tvalueText.text(\"Values:\\t\" + JSON.stringify(roundedValues).replace(/\\\"/g,'').replace(/\\{/g,'').replace(/\\}/g,'').replace(/\\,/g,', '))\n\n\t\t\t//\tLoop over piece values and draw colors in appropriate squares\n\t\t\tfor (var s in pieceValues) {\n\t\t\t\t$('#myBoard .square-' + s).css('background', color(pieceValues[s]))\n\t\t\t}\n\t\t\t\n\t\t\t//\tMake list of black and white pieces and values\n\t\t\tpieces = boardPositions;\n\t\t\twhitePieces = [];\n\t\t\twhiteValues = [];\n\t\t\tblackPieces = [];\n\t\t\tblackValues = [];\n\t\t\tfor (var key in pieces) {\n\t\t\t\tif (pieces[key].charAt(0) == 'w') {\n\t\t\t\t\twhitePieces.push(pieces[key] + ' ' + key);\n\t\t\t\t\twhiteValues.push(pieceValues[key]);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (pieces[key].charAt(0) == 'b') {\n\t\t\t\t\t\tblackPieces.push(pieces[key] + ' ' + key);\n\t\t\t\t\t\tblackValues.push(pieceValues[key]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//\tget bar chart contexts\n\t\t\tvar ctW = document.getElementById(whiteCanvas).getContext('2d');\n\t\t\tvar ctB = document.getElementById(blackCanvas).getContext('2d');\n\t\t\t\n\t\t\t//\tClear chart history if exists\n\t\t\tif (whiteChart != undefined)\n\t\t\t\tclearChart(whiteChart, whiteCanvas)\n\t\t\tif (blackChart != undefined) \n\t\t\t\tclearChart(blackChart, blackCanvas)\n\t\t\t\n\t\t\t//\tMake white chart\n\t\t\twhiteChart = new Chart(ctW, {\n\t\t\t\t// The type of chart we want to create\n\t\t\t\ttype: 'bar',\n\n\t\t\t\t// The data for our dataset\n\t\t\t\tdata: {\n\t\t\t\t labels: whitePieces,\n\t\t\t\t datasets: [{\n\t\t\t\t\t label: 'White Piece Values',\n\t\t\t\t\t backgroundColor: 'rgb(255, 99, 132)',\n\t\t\t\t\t borderColor: 'rgb(255, 99, 132)',\n\t\t\t\t\t data: whiteValues\n\t\t\t\t }]\n\t\t\t\t},\n\t\t\t\t\n\t\t\t\t// Configuration options go here\n\t\t\t\toptions: {\n\t\t\t\t\tanimation: false\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t//\tmake black chart\n\t\t\tblackChart = new Chart(ctB, {\n\t\t\t\t// The type of chart we want to create\n\t\t\t\ttype: 'bar',\n\n\t\t\t\t// The data for our dataset\n\t\t\t\tdata: {\n\t\t\t\t labels: blackPieces,\n\t\t\t\t datasets: [{\n\t\t\t\t\t label: 'Black Piece Values',\n\t\t\t\t\t backgroundColor: 'rgb(0, 0, 0)',\n\t\t\t\t\t borderColor: 'rgb(0, 0, 0)',\n\t\t\t\t\t data: blackValues\n\t\t\t\t }]\n\t\t\t\t},\n\t\t\t\t\n\t\t\t\t// Configuration options go here\n\t\t\t\toptions: {\n\t\t\t\t\tanimation: false\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\n\t\t//\tIf piece isn't added from spare pieces and source isn't null, clear source square\n\t\t//\tsource is only null in manual run of function below, to initialize the values\n\t\tif (source != null && source != 'spare') {\n\t\t\tclearSquare(source)\n\t\t}\n\n\t}", "title": "" }, { "docid": "2aa440823f8c3deff608159fe042cc82", "score": "0.60938746", "text": "function emptyPieceSwap(piece){ \n\n\t\tif (testForAvailableMove(piece.style.left, piece.style.top)){\n\n\t\t\t//temporary variables for swapping coordinates of empty slot and piece being moved\n\t\t\tvar tempX = piece.style.left;\n\t\t\tvar tempY = piece.style.top;\n\n\t\t\t//giving the piece to me moved a new set of coordinates\n\t\t\tpiece.style.left = emptyX + \"px\";\n\t\t\tpiece.style.top = emptyY + \"px\";\n\n\t\t\t//updating the new empty spot on the board with suitable coordinates\n\t\t\temptyX = parseInt(tempX);\n\t\t\temptyY = parseInt(tempY);\n\n\t\t}\n\t}", "title": "" }, { "docid": "e7cfadb29f2ecafb9e99665593e9cb54", "score": "0.6091948", "text": "static drawBoard(state){\n if(state.piece){\n var newBoard = this.getNewBoard();\n var landed = state.landed;\n var piece = state.piece;\n \n //draw landed\n for (let row = 0; row < landed.length; row++) {\n for (let col = 0; col < landed[row].length; col++) {\n if (landed[row][col] !== 0) {\n //draw piece at position corresponding to row and col\n newBoard[row][col] = 1;\n }\n }\n }\n \n //draw current piece\n for (let row = 0; row < piece.shape.length; row++) {\n for (let col = 0; col < piece.shape[row].length; col++) {\n if (piece.shape[row][col] !== 0) {\n //draw piece on board\n newBoard[row + piece.pos_y][col + piece.pos_x] = piece.shape[row][col];\n }\n }\n }\n return newBoard;\n }\n }", "title": "" }, { "docid": "b13162a35942b01f2ee5433e95c56917", "score": "0.6082404", "text": "updateAfterMove() {\n var tmp;\n // var boardStr = \"\";\n for(var i = 0; i < this.numOrbs; i++){\n tmp = \"#orb\" + i;\n this.square[i].orb.setColor(convertSrc($(tmp).attr(\"src\")));\n // boardStr += convertOrbToText(convertSrc($(tmp).attr(\"src\")));\n }\n // if(boardStr != \"000000000000000000000000000000\"){\n // printBoardStr(boardStr);\n // }\n }", "title": "" }, { "docid": "85a93013da81f4de1b70dcc185f606c3", "score": "0.6076611", "text": "_flushPieces() {\n // see /diary/wierd variable scoping issue.png\n this.pieces.map(piece => {\n const { x, y } = piece.position\n\n // update the `matrix.coordinates` to update their pieces\n this[x][y].piece = piece\n piece.board = this\n })\n }", "title": "" }, { "docid": "49cebcdc1269dd8d15689f2299370f36", "score": "0.60741717", "text": "function onSnapEnd(orientation) {\r\n\r\n if ((orientation === 'white' && piece.search(/^w/) === -1) ||\r\n (orientation === 'black' && piece.search(/^b/) === -1)) {\r\n return false\r\n }\r\n board.position(game.fen())\r\n }", "title": "" }, { "docid": "ad623d9d6547f456b6fb6bb812b57b33", "score": "0.6073853", "text": "function evaluateBoard(move, prevSum, color) \n {\n var from = [8 - parseInt(move.from[1]), move.from.charCodeAt(0) - 'a'.charCodeAt(0)];\n var to = [8 - parseInt(move.to[1]), move.to.charCodeAt(0) - 'a'.charCodeAt(0)];\n\n // Change endgame behavior for kings\n if (prevSum < -1500)\n {\n if (move.piece === 'k') {move.piece = 'k_e'}\n else if (move.captured === 'k') {move.captured = 'k_e'}\n }\n\n if ('captured' in move)\n {\n // Opponent piece was captured (good for us)\n if (move.color === color)\n {\n prevSum += (weights[move.captured] + pstOpponent[move.color][move.captured][to[0]][to[1]]);\n }\n // Our piece was captured (bad for us)\n else\n {\n prevSum -= (weights[move.captured] + pstSelf[move.color][move.captured][to[0]][to[1]]);\n }\n }\n\n if (move.flags.includes('p'))\n {\n // NOTE: promote to queen for simplicity\n move.promotion = 'q';\n\n // Our piece was promoted (good for us)\n if (move.color === color)\n {\n prevSum -= (weights[move.piece] + pstSelf[move.color][move.piece][from[0]][from[1]]);\n prevSum += (weights[move.promotion] + pstSelf[move.color][move.promotion][to[0]][to[1]]);\n }\n // Opponent piece was promoted (bad for us)\n else\n {\n prevSum += (weights[move.piece] + pstSelf[move.color][move.piece][from[0]][from[1]]);\n prevSum -= (weights[move.promotion] + pstSelf[move.color][move.promotion][to[0]][to[1]]);\n }\n }\n else\n {\n // The moved piece still exists on the updated board, so we only need to update the position value\n if (move.color !== color)\n {\n prevSum += pstSelf[move.color][move.piece][from[0]][from[1]];\n prevSum -= pstSelf[move.color][move.piece][to[0]][to[1]];\n }\n else\n {\n prevSum -= pstSelf[move.color][move.piece][from[0]][from[1]];\n prevSum += pstSelf[move.color][move.piece][to[0]][to[1]];\n }\n }\n \n return prevSum;\n }", "title": "" }, { "docid": "bd2bcfca6ee71469f439d2457de031e4", "score": "0.60531634", "text": "function movePieceAuto(fromLoc, toLoc) {\n let piecesInPlay = document.querySelectorAll(\"div[class*=pieceID]\");\n for (pc of Array.from(piecesInPlay)) {\n if (!locInequality(b.cell(pc.parentNode).where(), fromLoc)) {\n bindMovePiece = pc\n break\n }\n }\n if (bindMovePiece !== undefined) {\n b.cell(toLoc).place(bindMovePiece);\n updateStateFromMove()\n }\n}", "title": "" }, { "docid": "3ca753ae71fe7aa4ba94729d8e563745", "score": "0.6047597", "text": "function chooseBoardSetupForCenter(){\r\n if(move2 === s1){\r\n corrnerS1();\r\n move2 = X; \r\n }\r\n if(move2 === s2){\r\n corrnerS1();\r\n move2 = eC1;\r\n }\r\n if(move2 === s3){\r\n corrnerS3();\r\n move2 = X;\r\n }\r\n if(move2 === s6){\r\n corrnerS3();\r\n move2 = eC1;\r\n }\r\n if(move2 === s7){\r\n corrnerS7();\r\n move2 = X;\r\n }\r\n if(move2 === s4){\r\n corrnerS7();\r\n move2 = eC1; \r\n }\r\n if(move2 === s9){\r\n corrnerS9();\r\n move2 = X;\r\n }\r\n if(move2 === s8){\r\n corrnerS9();\r\n move2 = eC1;\r\n }\r\n}", "title": "" }, { "docid": "e11d9117fb3355fcb07332b9218d7e95", "score": "0.60468847", "text": "function draw(e){\n var coord = gridLookup(e);\n if(boardState[coord.x][coord.y] == \"empty\"){\n boardState[coord.x][coord.y] = turn;\n activePieces.push({player:turn,coordinate:coord});\n fallingPieces.push([{player:turn,coordinate:coord},activePieces.length-1]);\n switchPlayer();\n window.requestAnimationFrame(update);\n }\n \n}", "title": "" }, { "docid": "c9182ba215a48049d4bd4d5558afe185", "score": "0.603934", "text": "updatePiece(newpiece) {\r\n this.piece = newpiece;\r\n }", "title": "" }, { "docid": "14dea362d381d1e12c4c86b560b3f552", "score": "0.6038638", "text": "canMove(piece, toRow, toColumn, boardArray) {\n console.log( 'Checking movement of ' + piece.color + ' ' + piece.type + ' from ' + piece.row + ',' + piece.column + ' to ' + toRow + ',' + toColumn );\n\n let piecesArray = (boardArray === undefined ? this.state.pieces : boardArray);\n let targetOccupied = piecesArray[toRow][toColumn];\n\n let rowDiff = piece.row - toRow;\n let colDiff = piece.column - toColumn;\n let moveUp = rowDiff > 0;\n let moveLeft = colDiff > 0;\n\n rowDiff = Math.abs(rowDiff);\n colDiff = Math.abs(colDiff);\n\n switch(piece.type) {\n case PIECE_TYPES.PAWN:\n if (piece.hasMoved) {\n if ( targetOccupied ) {\n // Diagonally forward\n if ( piece.color === PIECE_COLORS.LIGHT ) {\n return moveUp && rowDiff === 1 && colDiff === 1;\n } else {\n return !moveUp && rowDiff === 1 && colDiff === 1;; \n }\n } else {\n // No need to check for other pieces in the path\n if ( piece.color === PIECE_COLORS.LIGHT ) {\n return moveUp && rowDiff === 1 && colDiff === 0;\n } else {\n return !moveUp && rowDiff === 1 && colDiff === 0;\n }\n } \n } else {\n if ( targetOccupied ) {\n if ( piece.color === PIECE_COLORS.LIGHT ) {\n return moveUp && rowDiff === 1 && colDiff === 1;\n } else {\n return !moveUp && rowDiff === 1 && colDiff === 1;; \n }\n } else {\n if ( piece.color === PIECE_COLORS.LIGHT ) {\n if ( moveUp && rowDiff <= 2 && colDiff === 0 ) {\n // Check for anything in the path \n return !( rowDiff === 2 && piecesArray[piece.row-1][piece.column] !== null );\n } \n } else {\n if ( !moveUp && rowDiff <= 2 && colDiff === 0 ) {\n return !( rowDiff === 2 && piecesArray[piece.row+1][piece.column] !== null );\n } \n }\n }\n }\n break;\n case PIECE_TYPES.ROOK:\n if ( rowDiff > 0 && colDiff > 0 ) {\n return false;\n } \n // Anything in the way? \n return this.testStraight(piece, moveUp, moveLeft, rowDiff, colDiff, toRow, toColumn, piecesArray);\n case PIECE_TYPES.KNIGHT:\n return ( rowDiff === 2 && colDiff === 1 ) || (rowDiff === 1 && colDiff === 2);\n case PIECE_TYPES.BISHOP:\n if ( rowDiff === colDiff ) {\n return this.testDiagonal(piece, moveUp, moveLeft, toRow, toColumn, piecesArray);\n }\n return false;\n case PIECE_TYPES.QUEEN:\n if ( rowDiff === colDiff ) {\n return this.testDiagonal(piece, moveUp, moveLeft, toRow, toColumn, piecesArray); \n } else if ( (rowDiff > 0 && colDiff === 0) || (rowDiff === 0 && colDiff > 0) ) {\n return this.testStraight(piece, moveUp, moveLeft, rowDiff, colDiff, toRow, toColumn, piecesArray);\n }\n break;\n case PIECE_TYPES.KING:\n return ( rowDiff <= 1 && colDiff <= 1 );\n default:\n console.log('Move called with invalid piece type: ' + piece.type );\n return false;\n } \n }", "title": "" }, { "docid": "fe538434840a9d94374b76b8722ccb54", "score": "0.60383075", "text": "function executeCastling(startSquare, targetSquare) {\n if (board[startSquare].charAt(1) == \"k\") //only perform the check if the moved piece is a king\n {\n var diff = targetSquare - startSquare; //check how much did the piece move\n if (diff == directionOffsets[2] * 2) //if the piece was moved 2 squares to the right\n {\n var moveTarget = targetSquare + directionOffsets[3];\n if (board[startSquare] == wKing) { //check which king is it\n board[63] = \"\"; //move the rook at the start to the left of the king\n board[moveTarget] = wRook;\n } else {\n board[7] = \"\";\n board[moveTarget] = bRook;\n }\n } else if (diff == directionOffsets[3] * 2) //if the piece was moved 2 squares to the left\n {\n var moveTarget = targetSquare + directionOffsets[2];\n if (board[startSquare] == wKing) {\n board[56] = \"\"; //move the rook at the start to the right of the king\n board[moveTarget] = wRook;\n } else {\n board[0] = \"\";\n board[moveTarget] = bRook;\n }\n }\n }\n}", "title": "" }, { "docid": "f011efe99cb9803d8b2dcea77e80ee6a", "score": "0.60291594", "text": "function evaluateBoard (move, prevSum, color) {\n var from = [8 - parseInt(move.from[1]), move.from.charCodeAt(0) - 'a'.charCodeAt(0)];\n var to = [8 - parseInt(move.to[1]), move.to.charCodeAt(0) - 'a'.charCodeAt(0)];\n\n // Change endgame behavior for kings\n if (prevSum < -1500)\n {\n if (move.piece === 'k') {move.piece = 'k_e'}\n else if (move.captured === 'k') {move.captured = 'k_e'}\n }\n\n if ('captured' in move)\n {\n // Opponent piece was captured (good for us)\n if (move.color === color)\n {\n prevSum += (weights[move.captured] + pstOpponent[move.color][move.captured][to[0]][to[1]]);\n }\n // Our piece was captured (bad for us)\n else\n {\n prevSum -= (weights[move.captured] + pstSelf[move.color][move.captured][to[0]][to[1]]);\n }\n }\n\n if (move.flags.includes('p'))\n {\n // NOTE: promote to queen for simplicity\n move.promotion = 'q';\n\n // Our piece was promoted (good for us)\n if (move.color === color)\n {\n prevSum -= (weights[move.piece] + pstSelf[move.color][move.piece][from[0]][from[1]]);\n prevSum += (weights[move.promotion] + pstSelf[move.color][move.promotion][to[0]][to[1]]);\n }\n // Opponent piece was promoted (bad for us)\n else\n {\n prevSum += (weights[move.piece] + pstSelf[move.color][move.piece][from[0]][from[1]]);\n prevSum -= (weights[move.promotion] + pstSelf[move.color][move.promotion][to[0]][to[1]]);\n }\n }\n else\n {\n // The moved piece still exists on the updated board, so we only need to update the position value\n if (move.color !== color)\n {\n prevSum += pstSelf[move.color][move.piece][from[0]][from[1]];\n prevSum -= pstSelf[move.color][move.piece][to[0]][to[1]];\n }\n else\n {\n prevSum -= pstSelf[move.color][move.piece][from[0]][from[1]];\n prevSum += pstSelf[move.color][move.piece][to[0]][to[1]];\n }\n }\n \n return prevSum;\n}", "title": "" }, { "docid": "51b67f053c79ae8606bbac3076f82b91", "score": "0.6020782", "text": "function generateNewPositionFromMove(position, move) {\n\t\n\tvar piece = position . piecePositions[move[0]];\n\t\n\tvar newPiecePositions = \n\t\tbasicPositionStringMove(position . piecePositions, move);\n\t\n\tvar newWhiteToMove = !position . whiteToMove;\n\t\n\tvar newMoveNumber = \n\t\tposition . moveNumber + (position . whiteToMove ? 0 : 1);\n\t\n\tvar newFiftyMoveCounter = position . fiftyMoveCounter + 1;\n\t\n\t// the following is for castling rules\n\tif(piece . toUpperCase() == 'K') {\n\t\t\n\t\tfor(var i = 0; i < 4; i++) {\n\t\t\tif(\n\t\t\t\tcastlingKingMoves[i][0] == move[0]\n\t\t\t\t&&\n\t\t\t\tcastlingKingMoves[i][1] == move[1]\n\t\t\t){\n\t\t\t\tnewPiecePositions = basicPositionStringMove(\n\t\t\t\t\tnewPiecePositions, castlingRookMoves[i]\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\t\n\t// position will copy the values without being the same array\n\tvar newWhichCornersCanCastle = [];\n\tfor(var i = 0; i < 4; i++) {\n\t\tnewWhichCornersCanCastle[i] = \n\t\t\tposition . whichCornersCanCastle[i];\n\t}\n\t\n\t// the rooks and kings\n\tswitch(move[0]) {\n\t\tcase 0:\n\t\t\tnewWhichCornersCanCastle[0] = false;\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\tnewWhichCornersCanCastle[1] = false;\n\t\t\tbreak;\n\t\tcase 56:\n\t\t\tnewWhichCornersCanCastle[2] = false;\n\t\t\tbreak;\n\t\tcase 63:\n\t\t\tnewWhichCornersCanCastle[3] = false;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tnewWhichCornersCanCastle[0] = false;\n\t\t\tnewWhichCornersCanCastle[1] = false;\n\t\t\tbreak;\n\t\tcase 60:\n\t\t\tnewWhichCornersCanCastle[2] = false;\n\t\t\tnewWhichCornersCanCastle[3] = false;\n\t\t\tbreak;\n\t}\n\t\n\t\n\tvar newEnPassantFile = 9;\n\t\n\t// if a pawn is being moved\n\tif(\n\t\tpiece . toUpperCase() == 'P'\n\t){\n\t\tnewFiftyMoveCounter = 0;\n\t\t// if it is being moved two squares\n\t\tif(Math . abs(move[0] - move[1]) == 16) {\n\t\t\tnewEnPassantFile = getCartesianPosition(move[0]).x;\n\t\t// if it is performing a capture\n\t\t}else if(Math . abs(move[0] - move[1]) != 8) {\n\t\t\t// if position is en passant\n\t\t\tif(position . piecePositions[move[1]] == ' ') {\n\t\t\t\tvar squareToEmpty = \n\t\t\t\t\tgetSquareToEmptyEnPassant(move[1]);\n\t\t\t\t\n\t\t\t\tnewPiecePositions =\n\t\t\t\t\tnewPiecePositions.substring(0,squareToEmpty)\n\t\t\t\t\t+\n\t\t\t\t\t' '\n\t\t\t\t\t+\n\t\t\t\t\tnewPiecePositions.substring(\n\t\t\t\t\t\tsquareToEmpty + 1, 64\n\t\t\t\t\t)\n\t\t\t\t;\n\t\t\t}\n\t\t}\n\t}\n\t\n\t// if the last move was a capture\n\tif(position . piecePositions[move[1]] != ' ') {\n\t\tnewFiftyMoveCounter = 0;\n\t}\n\t\n\t\n\treturn(new Position(\n\t\tnewPiecePositions, newWhiteToMove, newEnPassantFile,\n\t\tnewWhichCornersCanCastle, newMoveNumber,\n\t\tnewFiftyMoveCounter\n\t));\n}", "title": "" }, { "docid": "ce49d27511972dd236995cf5684c2fd9", "score": "0.6010235", "text": "function processTurn (turn, turns, pieces) {\n for (const piece of pieces) {\n delete (piece.coordinateBefore)\n delete (piece.moveSteps)\n }\n const previousPieces = JSON.stringify(pieces)\n if (turn.queenSideCastling || turn.kingSideCastling) {\n const moveKingAmount = turn.queenSideCastling ? -2 : 2\n const moveRookAmount = turn.queenSideCastling ? 3 : -2\n const rookColumn = turn.queenSideCastling ? 'a' : 'h'\n if (turn.color === 'w') {\n const whiteKing = pieces.filter(obj => obj.type === 'K' && obj.color === 'w').pop()\n whiteKing.coordinateBefore = whiteKing.coordinate\n whiteKing.coordinate = addColumn(whiteKing.coordinate, moveKingAmount)\n whiteKing.moveSteps = [whiteKing.coordinateBefore, whiteKing.coordinate]\n const whiteQueenSideRook = pieces.filter(obj => obj.type === 'R' && obj.start.startsWith(rookColumn) && obj.color === 'w').pop()\n whiteQueenSideRook.coordinateBefore = whiteQueenSideRook.coordinate\n whiteQueenSideRook.coordinate = addColumn(whiteQueenSideRook.coordinate, moveRookAmount)\n whiteQueenSideRook.moveSteps = [whiteQueenSideRook.coordinateBefore, whiteQueenSideRook.coordinate]\n } else {\n const blackKing = pieces.filter(obj => obj.type === 'K' && obj.color === 'b').pop()\n blackKing.coordinateBefore = blackKing.coordinate\n blackKing.coordinate = addColumn(blackKing.coordinate, moveKingAmount)\n blackKing.moveSteps = [blackKing.coordinateBefore, blackKing.coordinate]\n const blackQueenSideRook = pieces.filter(obj => obj.type === 'R' && obj.start.startsWith(rookColumn) && obj.color === 'b').pop()\n blackQueenSideRook.coordinateBefore = blackQueenSideRook.coordinate\n blackQueenSideRook.coordinate = addColumn(blackQueenSideRook.coordinate, moveRookAmount)\n blackQueenSideRook.moveSteps = [blackQueenSideRook.coordinateBefore, blackQueenSideRook.coordinate]\n }\n } else {\n const movingPiece = findMovingPiece(turn, pieces)\n movingPiece.coordinateBefore = movingPiece.coordinate\n movingPiece.coordinate = turn.to\n if (turn.promoted) {\n movingPiece.type = turn.promotedTo\n }\n if (turn.capturing) {\n for (const piece of pieces) {\n if (piece.coordinate === movingPiece.coordinate && piece !== movingPiece) {\n pieces.splice(pieces.indexOf(piece), 1)\n break\n }\n }\n }\n }\n if (turn.siblings && turn.siblings.length) {\n for (const sibling of turn.siblings) {\n const piecesFork = JSON.parse(previousPieces)\n for (const turn of sibling) {\n processTurn(turn, turns, piecesFork)\n }\n }\n }\n turn.previousPieces = JSON.parse(previousPieces)\n turn.pieces = JSON.parse(JSON.stringify(pieces))\n turn.fen = toFen(pieces, turn, turns)\n }", "title": "" }, { "docid": "4b0ad04572c1f5b7253446ee7db556e3", "score": "0.60080653", "text": "function game(){\nlet initialPiecePositions = [\n { x: 1, y: 0 },\n { x: 3, y: 0 },\n { x: 5, y: 0 },\n { x: 7, y: 0 },\n { x: 0, y: 1 },\n { x: 2, y: 1 },\n { x: 4, y: 1 },\n { x: 6, y: 1 },\n { x: 1, y: 2 },\n { x: 3, y: 2 },\n { x: 5, y: 2 },\n { x: 7, y: 2 },\n { x: 0, y: 5 },\n { x: 2, y: 5 },\n { x: 4, y: 5 },\n { x: 6, y: 5 },\n { x: 1, y: 6 },\n { x: 3, y: 6 },\n { x: 5, y: 6 },\n { x: 7, y: 6 },\n { x: 0, y: 7 },\n { x: 2, y: 7 },\n { x: 4, y: 7 },\n { x: 6, y: 7 }\n];\n// Generar el tablero\nfor (let row = 0; row < boardSize; row++) {\n for (let col = 0; col < boardSize; col++) {\n const cell = document.createElement('div');\n cell.classList.add('cell');\n cell.setAttribute('data-x', col);\n cell.setAttribute('data-y', row);\n if ((row + col) % 2 === 0) {\n cell.classList.add('light');\n } else {\n cell.classList.add('dark');\n }\n if(currentPlayer == 'black'){\n container.style.color = 'white';\n container.style.backgroundColor = 'black';\n }else{\n container.style.color = 'black';\n container.style.backgroundColor = 'white';\n }\n cell.addEventListener('click', () => {\n if (cell.classList.contains(currentPlayer)|| cell.classList.contains(`${currentPlayer}-queen`)) {\n if (selectedCell && selectedCell !== cell) {\n selectedCell.classList.remove('clicked');\n clearHighlightMoves();\n selectedCell = cell;\n selectedCell.classList.add('clicked');\n const pieceColor = cell.classList.contains('black') ? 'black' : 'white';\n if(cell.classList.contains(`${currentPlayer}-queen`)){\n const queenColor = cell.classList.contains('black-queen') ? 'black-queen' : 'white-queen';\n const queenMoves = determinePossibleQueenMoves(col, row, queenColor);\n const queenEatable = determineQueenEatable(col, row, queenColor);\n highlightAllowedMoves(queenMoves);\n highlightEatableMoves(queenEatable);\n }else {\n const possibleMoves = determinePossibleMoves(col, row, pieceColor);\n const eatableMoves = determineEatableMoves(col, row, pieceColor);\n highlightAllowedMoves(possibleMoves);\n highlightEatableMoves(eatableMoves);\n }\n } else if (selectedCell === cell) {\n selectedCell.classList.remove('clicked');\n clearHighlightMoves();\n selectedCell = null;\n } else {\n selectedCell = cell;\n selectedCell.classList.add('clicked');\n const pieceColor = cell.classList.contains('black') ? 'black' : 'white';\n if(cell.classList.contains(`${currentPlayer}-queen`)){\n const queenColor = cell.classList.contains('black-queen') ? 'black-queen' : 'white-queen';\n const queenMoves = determinePossibleQueenMoves(col, row, queenColor);\n const queenEatable = determineQueenEatable(col, row, queenColor);\n highlightAllowedMoves(queenMoves);\n highlightEatableMoves(queenEatable);\n }else {\n const possibleMoves = determinePossibleMoves(col, row, pieceColor);\n const eatableMoves = determineEatableMoves(col, row, pieceColor);\n highlightAllowedMoves(possibleMoves);\n highlightEatableMoves(eatableMoves);\n }\n }\n } else if (cell.classList.contains('allowed')) {\n if(selectedCell.classList.contains('black-queen')||selectedCell.classList.contains('white-queen')){\n const selectedQueenColor = selectedCell.classList.contains('black-queen') ? 'black-queen' : 'white-queen';\n movePiece(selectedCell, cell, selectedQueenColor);\n } else{\n const selectedPieceColor = selectedCell.classList.contains('black') ? 'black' : 'white';\n movePiece(selectedCell, cell, selectedPieceColor);\n }\n } else if (cell.classList.contains('eatable')) {\n if(selectedCell.classList.contains('black-queen')||selectedCell.classList.contains('white-queen')){\n const selectedQueenColor = selectedCell.classList.contains('black-queen') ? 'black-queen' : 'white-queen';\n movePiece(selectedCell, cell, selectedQueenColor);\n const newQueen = determineQueenEatable(col,row,selectedQueenColor);\n clearHighlightMoves();\n if(newQueen.length==0){\n updatePieceCount(); // Actualizar la información de la cantidad de fichas\n changeTurn(); // Cambiar el turno después de mover la pieza\n }\n } else {\n const selectedPieceColor = selectedCell.classList.contains('black') ? 'black' : 'white';\n movePiece(selectedCell, cell, selectedPieceColor); \n const newEatable = determineEatableMoves(col, row, selectedPieceColor);\n clearHighlightMoves();\n if(newEatable.length==0){\n updatePieceCount(); // Actualizar la información de la cantidad de fichas\n changeTurn(); // Cambiar el turno después de mover la pieza\n }\n } \n }\n if(currentPlayer == 'black'){\n container.style.color = 'white';\n container.style.backgroundColor = 'black';\n }else{\n container.style.color = 'black';\n container.style.backgroundColor = 'white';\n }\n });\n const isInitialPiece = initialPiecePositions.some(position => position.x === col && position.y === row);\n if (isInitialPiece) {\n const pieceColor = (row < 3) ? 'black' : 'white';\n cell.classList.add(pieceColor);\n }\n board.appendChild(cell);\n \n }\n}\n}", "title": "" }, { "docid": "0cffdec6972c7b0d4e5004016024246a", "score": "0.5997894", "text": "move(move) {\n var x = move%this.cells[0].length\n move = Math.floor(move/this.cells[0].length)\n var y = move%this.cells.length\n var z = Math.floor(move/this.cells.length)\n \n this.cells[y][x][z] = this.state\n this.pieces[this.state-1][z] --;\n \n this.state = this.state%4+1\n\n this.turn = this.fourPlayers ? this.state : (this.state-1)%2+1\n \n this.checkVictory()\n //this.findLegalMoves()\n\n // skip turn if player can't move\n var i=0;\n while (this.legalMoves.length === 0 && i<4) {\n this.state = this.state%4+1\n this.turn = this.fourPlayers ? this.state : (this.state-1)%2+1\n this.checkVictory()\n\n i++\n }\n }", "title": "" }, { "docid": "8212f508f04aaf5a185220897d2d321b", "score": "0.5995728", "text": "getPotentialMovesFrom([x, y]) {\n if (this.movesCount <= 3) {\n // Setup stage\n const move = this.doClick([x, y]);\n return (!move ? [] : [move]);\n }\n let moves = super.getPotentialMovesFrom([x, y]);\n const initialPiece = this.getPiece(x, y);\n const color = this.turn;\n if (\n ((color == 'w' && x == 7) || (color == \"b\" && x == 0)) &&\n V.AUGMENTED_PIECES.includes(this.board[x][y][1])\n ) {\n const newPiece = this.getExtraPiece(this.board[x][y][1]);\n moves.forEach(m => {\n m.appear[0].p = initialPiece;\n m.appear.push(\n new PiPo({\n p: newPiece,\n c: color,\n x: x,\n y: y\n })\n );\n });\n moves.forEach(m => {\n if (m.vanish.length <= 1) return;\n const [vx, vy] = [m.vanish[1].x, m.vanish[1].y];\n if (\n m.appear.length >= 2 && //3 if the king was also augmented\n m.vanish.length == 2 &&\n m.vanish[1].c == color &&\n V.AUGMENTED_PIECES.includes(this.board[vx][vy][1])\n ) {\n // Castle, rook is an \"augmented piece\"\n m.appear[1].p = V.ROOK;\n m.appear.push(\n new PiPo({\n p: this.getExtraPiece(this.board[vx][vy][1]),\n c: color,\n x: vx,\n y: vy\n })\n );\n }\n });\n }\n return moves;\n }", "title": "" }, { "docid": "d826430f9786a3b55dad787aa3f9820f", "score": "0.59913886", "text": "async movePiece(reply) {\n let response = JSON.parse(reply.target.response);\n if(response.message == \"Invalid move\")\n console.log(\"Invalid move\");\n else {\n this.boards.push(this.board_state);\n this.board_state = translatePLtoJSboard(response.argA);\n //Check if there was any piece pushed\n if(response.argB[0] != \"_\") {\n //If one was, move it either to:\n let piecePushed = JSON.parse(response.argB.replace(/\\//g,','));\n this.moves.push([[this.selectedPieceY,this.selectedPieceX,this.selectedTileY,this.selectedTileX],piecePushed]);\n let enemyPieces;\n if(this.player == 'w')\n enemyPieces = this.blackPieces;\n else\n enemyPieces = this.whitePieces;\n if(piecePushed.length == 4) {\n //Another position in the board\n for (let i = 0; i < enemyPieces.length; i++) {\n if(enemyPieces[i].position[0] == piecePushed[1] && enemyPieces[i].position[1] == piecePushed[0]) {\n enemyPieces[i].position[0] = this.selectedTileX;\n enemyPieces[i].position[1] = this.selectedTileY;\n if(enemyPieces[i].animation != null)\n mat4.translate(enemyPieces[i].transformation, enemyPieces[i].transformation, [enemyPieces[i].animation.x, enemyPieces[i].animation.y, enemyPieces[i].animation.z]);\n enemyPieces[i].animation = new PieceMoveAnimation(this.scene, piecePushed[3]-piecePushed[1], piecePushed[2]-piecePushed[0]);\n }\n }\n } else if (piecePushed.length == 2) {\n //The captured piece pile\n if(enemyPieces == this.blackPieces)\n this.scores[Math.floor(piecePushed[1]/this.boardSize)][Math.floor(piecePushed[0]/this.boardSize)][0]-=1;\n else\n this.scores[Math.floor(piecePushed[1]/this.boardSize)][Math.floor(piecePushed[0]/this.boardSize)][1]-=1;\n for (let i = 0; i < enemyPieces.length; i++) {\n if(enemyPieces[i].position[0] == piecePushed[1] && enemyPieces[i].position[1] == piecePushed[0]) {\n if(enemyPieces[i].animation != null)\n mat4.translate(enemyPieces[i].transformation, enemyPieces[i].transformation, [enemyPieces[i].animation.x, enemyPieces[i].animation.y, enemyPieces[i].animation.z]);\n enemyPieces[i].animation = new PieceCaptureAnimation(this.scene, enemyPieces[i].position[0], enemyPieces[i].position[1], this.pileHeight, this.boardSize, this.boardSpacing);\n enemyPieces[i].position[0] = -1;\n enemyPieces[i].position[1] = -1;\n this.piecePile.push(enemyPieces[i]);\n this.pileHeight += 0.1;\n }\n }\n }\n } else this.moves.push([this.selectedPieceY,this.selectedPieceX,this.selectedTileY,this.selectedTileX]);\n\n //Move actual piece selected\n let pieces;\n if(this.player == 'w')\n pieces = this.whitePieces;\n else\n pieces = this.blackPieces;\n for (let i = 0; i < pieces.length; i++) {\n if(pieces[i].position[0] == this.selectedPieceX && pieces[i].position[1] == this.selectedPieceY) {\n pieces[i].position[0] = this.selectedTileX;\n pieces[i].position[1] = this.selectedTileY;\n if(pieces[i].animation != null)\n mat4.translate(pieces[i].transformation, pieces[i].transformation, [pieces[i].animation.x, pieces[i].animation.y, pieces[i].animation.z]);\n pieces[i].animation = new PieceMoveAnimation(this.scene, this.selectedTileX-this.selectedPieceX, this.selectedTileY-this.selectedPieceY);\n }\n }\n //Check if game is over\n this.checkGameOver();\n if(this.phase == \"gameOver\")\n return;\n\n //Ready next turn\n if(this.turn==1) {\n this.turn=2;\n //Save last move (important for turn 2 possible moves)\n this.lastMoveStartX = this.selectedPieceX;\n this.lastMoveStartY = this.selectedPieceY;\n this.lastMoveEndX = this.selectedTileX;\n this.lastMoveEndY = this.selectedTileY;\n } else {\n this.timer.resetCount();\n await new Promise(r => setTimeout(r, 500));\n this.gameCameraRotation += Math.PI;\n this.turn=1;\n if(this.player=='w')\n this.player='b';\n else this.player='w';\n //If next player isn't human, send move request to bot\n if(!this.isHumanPlaying())\n postGameRequest(\"[bot_move,\" + translateJStoPLboard(this.board_state) + \",\" + this.difficulty + \",\" + this.player + \",\" + this.turn + \"]\", this.botMovePiece.bind(this));\n }\n console.log(\"Move successful\");\n }\n }", "title": "" }, { "docid": "0c0ca7228efd66f4999654402a4e032d", "score": "0.5989619", "text": "function chessSet( position ) {\r\n\t// position is 8 strings of 8 chars for board,\r\n\t// KQRBNPMCE for white pieces, kqrbnpmce for black, other for blank\r\n\t// K = King / M = king (player to move)\r\n\t// Q = Queen\r\n\t// R = Rook / C = rook with castling rights not yet forfeited\r\n\t// B = Bishop\r\n\t// N = kNight\r\n\t// P - Pawn / E = EnPassant pawn - has just made double move\r\n\tif ( !position ) position = defaultPosition;\r\n\tvar board = new chessBoard( position[ 0 ].length , position.length -\r\n\t\t\t\t ( ( position.last().length == position[ 0 ].length ) ? 0 : 1 ) );\r\n\tvar squares = board.squares;\r\n\tthis.board = board;\r\n// \tthis.pieces = new Array\r\n\tthis.toPlay = 0;\r\n\tthis.pawnDoubleMoved = null;\r\n\tthis.castlingRights = [ [ 0 , 0 ] , [ 0 , 0 ] ];\r\n\tvar posRow;\r\n\tfor (var j=0; j<board.n; j++) {\r\n\t posRow = position[ j ];\r\n\t for (var i=0; i<board.m; i++) {\r\n\t\tvar c = posRow.charAt( i );\r\n\t\tif ( c && \"PpBbNnRrKkQqMmCcEe\".indexOf( c ) > -1 ) {\r\n\t\t var nam = c.toUpperCase();\r\n\t\t var team = ( nam == c ) ? 0 : 1;\r\n\t\t if ( nam == \"M\" ) this.toPlay = team;\r\n\t\t var piece = newChessPiece( this , i , board.n-1 - j , nam , team );\r\n\t\t if ( nam == \"E\" ) this.pawnDoubleMoved = piece;\r\n\t\t if ( nam == \"C\" ) this.castlingRights[ team ][ i>0 ? 0 : 1 ] = 1;\r\n\t\t}\r\n\t }\r\n\t}\r\n\tboard.it.style[ 'borderColor' ] = [ 'white','black' ][ this.toPlay ];\r\n\tchessSetSetTargets( this );\r\n}", "title": "" }, { "docid": "f9579fbf516ce06129fa40683137ad70", "score": "0.59892344", "text": "move (x, y) {\n\t\t// Convert the input coords to array coords\n\t\tvar arr_x = Math.floor((x)/70);\n\t\tvar arr_y = Math.floor((y)/70);\n\t\tvar new_square = this.board.get_square(arr_x, arr_y);\n\n\t\t// Check to see if the square clicked is 1 space up, down, left, or right.\n\t\tif(Math.abs(arr_x - this.square.arr_x) <= 1 && Math.abs(arr_y - this.square.arr_y) <= 1 && \n\t\t\t\t\tMath.abs(arr_x - this.square.arr_x)+Math.abs(arr_y - this.square.arr_y) <= 1 && !(new_square.has_pawn))\n\t\t{\n\t\t\tconsole.log(\"Valid move\");\n\t\t\t// Check to see if the current square is block in the direction of the new square\n\t\t\t// if it isn't blocked, set the new square to this pawn's current square\n\n\t\t\t// Checking for moving up\n\t\t\tif(arr_y < this.square.arr_y)\n\t\t\t{\n\t\t\t\tif(!(this.square.blocked(0)))\n\t\t\t\t{\t\n\t\t\t\t\tthis.square.has_pawn = false;\n\t\t\t\t\tthis.square = new_square;\n\t\t\t\t\tthis.arr_x = new_square.arr_x;\n\t\t\t\t\tthis.arr_y = new_square.arr_y;\n\t\t\t\t\tthis.x = new_square.x;\n\t\t\t\t\tthis.y = new_square.y;\n\t\t\t\t\tthis.square.has_pawn = true;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Checking for moving down\n\t\t\telse if (arr_y > this.square.arr_y)\n\t\t\t{\n\t\t\t\tif(!(this.square.blocked(1)))\n\t\t\t\t{\n\t\t\t\t\tthis.square.has_pawn = false;\n\t\t\t\t\tthis.square = new_square;\n\t\t\t\t\tthis.square.has_pawn = true;\n\t\t\t\t\tthis.arr_x = new_square.arr_x;\n\t\t\t\t\tthis.arr_y = new_square.arr_y;\n\t\t\t\t\tthis.x = new_square.x;\n\t\t\t\t\tthis.y = new_square.y;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Checking for moving left\n\t\t\telse if (arr_x < this.square.arr_x)\n\t\t\t{\n\t\t\t\tif(!(this.square.blocked(2)))\n\t\t\t\t{\n\t\t\t\t\tthis.square.has_pawn = false;\n\t\t\t\t\tthis.square = new_square;\n\t\t\t\t\tthis.square.has_pawn = true;\n\t\t\t\t\tthis.arr_x = new_square.arr_x;\n\t\t\t\t\tthis.arr_y = new_square.arr_y;\n\t\t\t\t\tthis.x = new_square.x;\n\t\t\t\t\tthis.y = new_square.y;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Checking for moving right\n\t\t\telse if (arr_x > this.square.arr_x)\n\t\t\t{\n\t\t\t\tif(!(this.square.blocked(3)))\n\t\t\t\t{\n\t\t\t\t\tthis.square.has_pawn = false;\n\t\t\t\t\tthis.square = new_square;\n\t\t\t\t\tthis.square.has_pawn = true;\n\t\t\t\t\tthis.arr_x = new_square.arr_x;\n\t\t\t\t\tthis.arr_y = new_square.arr_y;\n\t\t\t\t\tthis.x = new_square.x;\n\t\t\t\t\tthis.y = new_square.y;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\t\n\t\t}\n\t}", "title": "" }, { "docid": "0a0b6391f045cbfbe2d0a420bdabb471", "score": "0.5989092", "text": "updateBoard(board) {\n this.board = board;\n this.drawCurrentBoard();\n }", "title": "" }, { "docid": "39c887b08e31c4d07125c543d1cfc4a7", "score": "0.5986909", "text": "initBoardThenUpdate() {\n let newState = this.state;\n newState.playerOneSkel = this.emptySkel(true);\n newState.playerTwoSkel = this.emptySkel(false);\n this.setState(newState);\n this.update(); // poll for updates from server\n }", "title": "" }, { "docid": "06857d2a7e07ed0295d09c4dd2b5f7f3", "score": "0.5983589", "text": "function resetBoard() {\n if (bindMoveLocs === undefined) {\n return\n }\n bindMoveLocs.forEach(function(loc) {\n b.cell(loc).removeOn(\"click\", movePieceByUser);\n b.cell(loc).style(revertColor(loc))\n }\n );\n}", "title": "" }, { "docid": "3feef89cd67b4650833c96b63f64e41d", "score": "0.5971697", "text": "click(event) {\n let otherPlayer = this.player === 1 ? 2 : 1;\n if (this.state.currentPlayer === otherPlayer) return;\n\n let playerState = this.state.getPlayerState(this.player);\n let otherPlayerState = this.state.getPlayerState(otherPlayer);\n let selectedPiece = document.querySelector(`.selected[player=\"${this.player}\"]`);\n\n if (selectedPiece) {\n this.board.deselectAll();\n if (selectedPiece === this) {\n this.board.cleanUpHighlights();\n return;\n }\n }\n\n // Starting point of the game.\n if (\n playerState === 'emptyBoard' &&\n otherPlayerState === 'emptyBoard'\n ) {\n this.state.transition(this.player, 'attachPiece', {\n piece: this,\n row: 0,\n column: 0\n });\n }\n\n // First turn of player 2.\n else if (\n playerState === 'emptyBoard' &&\n otherPlayerState !== 'emptyBoard'\n ) {\n this.board.deselectAll();\n this.select();\n this.board.setHighlights(this.board.getSwarmNeighbouringTiles(), (clickedHighlight) => {\n this.state.transition(this.player, 'attachPiece', {\n piece: this,\n row: clickedHighlight.row,\n column: clickedHighlight.column\n });\n });\n }\n\n // Other turns.\n else if (\n ['attachPiece', 'movePiece'].includes(playerState) &&\n ['attachPiece', 'movePiece'].includes(otherPlayerState)\n ) {\n // New piece to attach.\n if (this.parentNode !== this.board) {\n this.board.deselectAll();\n this.select();\n this.board.highlightAttachTiles((clickedHighlight) => {\n this.state.transition(this.player, 'attachPiece', {\n piece: this,\n row: clickedHighlight.row,\n column: clickedHighlight.column\n });\n });\n }\n\n // Change a position of a piece.\n else {\n this.board.deselectAll();\n this.select();\n this.board.setHighlights(this.getHighlights(), (clickedHighlight) => {\n this.state.transition(this.player, 'movePiece', {\n piece: this,\n row: clickedHighlight.row,\n column: clickedHighlight.column\n });\n });\n }\n }\n }", "title": "" }, { "docid": "2472aaedfe7fffb6ca58fb2bf83b634c", "score": "0.5970176", "text": "function processPawnPromotion(square, newPiece){\n\tvar coords = getCoordinatesFromString(square);\n\tpawnPromotion(coords, newPiece);\n\tnotifyStatusLog(\"Pawn promotion: \" + getColorFromPlayerId(currentTurn) + \"'s pawn on \" + square + \" promoted to a \" + newPiece);\n\n}", "title": "" }, { "docid": "56a6494aed2353babba48ad24ecf0c37", "score": "0.5965313", "text": "function pawn(cell, piece, newCell) {\n\n var pos, oldPos, rightJumpRank, leftJumpRank, rightJumpFile, leftJumpFile,\n forwardFileStart, forwardRankStart, forwardFile, forwardRank;\n\n pos = translateCell(newCell);\n oldPos = translateCell(cell);\n\n switch (piece[0]) {\n case 'b':\n forwardFileStart = (parseInt(oldPos[0], 10) - 2);\n forwardRankStart = (parseInt(oldPos[2], 10));\n forwardFile = (parseInt(oldPos[0], 10) - 1);\n forwardRank = (parseInt(oldPos[2], 10));\n leftJumpFile = (parseInt(oldPos[0], 10) - 1);\n leftJumpRank = (parseInt(oldPos[2], 10) - 1);\n rightJumpFile = (parseInt(oldPos[0], 10) - 1);\n rightJumpRank = (parseInt(oldPos[2], 10) + 1);\n break;\n case 'w':\n forwardFileStart = (parseInt(oldPos[0], 10) + 2);\n forwardRankStart = (parseInt(oldPos[2], 10));\n forwardFile = (parseInt(oldPos[0], 10) + 1);\n forwardRank = (parseInt(oldPos[2], 10));\n leftJumpFile = (parseInt(oldPos[0], 10) + 1);\n leftJumpRank = (parseInt(oldPos[2], 10) - 1);\n rightJumpFile = (parseInt(oldPos[0], 10) + 1);\n rightJumpRank = (parseInt(oldPos[2], 10) + 1);\n break;\n }\n\n\n if(piece[0] === 'w'){\n // we do not capture kings. so if that's the new position\n // you can't capture it\n if(getPieceFromBoard(pos) === 'bK') return;\n // if we start at rank 1 (acutally rank 2 but since the array is zero based we go with 1)\n if (parseInt(oldPos[0], 10) === 1) {\n //if we go up two rows from where we are and stay in the same file it's a legal move\n // row two up two\n if ((forwardFileStart === parseInt(pos[0], 10)) && (forwardRankStart === parseInt(pos[2], 10))) {\n if (isSpaceEmpty(pos)) {\n return true;\n }\n }\n }\n /*************************************\n * Pawn Promotion\n * if piece is white and the row is the 7th row and it's empty we promote\n **************************************/\n //\n if(parseInt(pos[0], 10) === 7 && isSpaceEmpty(pos)){\n return true;\n }else if(parseInt(pos[0], 10) === 7 && !isSpaceEmpty(pos) && !isSameColor(piece, getPieceFromBoard(pos))){\n // this allows for capturing another piece\n return true;\n }\n\n }else if(piece[0] === 'b'){\n\n if(getPieceFromBoard(pos) === 'wK') return;\n // first we check to see if the next row is equal to the selected row\n // pawn can move forward so we add - 2 to the row and leave actual pawn position the same\n if (parseInt(oldPos[0], 10) === 6) {\n if ((forwardFileStart === parseInt(pos[0], 10)) && (forwardRankStart === parseInt(pos[2], 10))) {\n if (isSpaceEmpty(pos)) {\n return true;\n }\n }\n }\n /*************************************\n * Pawn Promotion\n * if piece is black and the row is the 0th row and it's empty we promote\n **************************************/\n if(parseInt(pos[0], 10) === 0 && isSpaceEmpty(pos)){\n return true;\n }else if(parseInt(pos[0], 10) === 0 && !isSpaceEmpty(pos) && !isSameColor(piece, getPieceFromBoard(pos))){\n // this allows for capturing another piece\n return true;\n }\n }\n\n if ((forwardFile === parseInt(pos[0], 10)) && (forwardRank === parseInt(pos[2], 10))) {\n // once again we check to see if the next row is equal to the selected row\n // pawn can move forward so we add +1 to the row and leave actual pawn position the same\n if (isSpaceEmpty(pos)) {\n return true;\n }\n }\n\n /**********************\n * JUMPING RULES ARE HIGHLIGHTED IN THE SWITCH STATEMENT\n * I didn't want a ton of else if so we determine what color is the piece and\n * we can perform the JUMP\n ***********************/\n if ((leftJumpFile === parseInt(pos[0], 10)) && (leftJumpRank === parseInt(pos[2], 10))) {\n if (!isSpaceEmpty(pos) && !isSameColor(piece, getPieceFromBoard(pos))) {\n return true;\n }\n } else if ((rightJumpFile === parseInt(pos[0], 10)) && (rightJumpRank === parseInt(pos[2], 10))) {\n if (!isSpaceEmpty(pos) && !isSameColor(piece, getPieceFromBoard(pos))) {\n return true;\n }\n }\n\n return false;\n\n}", "title": "" }, { "docid": "131ff7b60941dc8afb7267aa5ba043b2", "score": "0.5950992", "text": "function moveBot(move) {\n console.log(\"moveBot: \" + move)\n let mvFrom = move.substring(0,2);\n let mvTo = move.substring(2,4);\n\n //get elements with id's of sqfrom and sqto\n let sqFrom = document.getElementById(mvFrom);\n let sqTo = document.getElementById(mvTo);\n let mvPiece = sqFrom.firstChild;\n\n //get positions of those elements\n let startPos = sqFrom.getBoundingClientRect();\n let endPos = sqTo.getBoundingClientRect();\n\n //set element zIndex to 1\n mvPiece.style.zIndex = 1;\n\n //calculate angle between elements\n let diffX = endPos.x - startPos.x;\n let diffY = endPos.y - startPos.y;\n let angle = Math.atan(diffY / diffX);\n //account for opposite directions\n if (diffX < 0 || (diffX < 0 && diffY < 0)) {\n angle = Math.PI - angle * -1;\n }\n\n //animate piece\n let id = setInterval(frame, 15);\n let speed = 30;\n let posX = 0;\n let posY = 0;\n\n function frame() {\n if (((diffX < 0) && posX + speed <= diffX) || ((diffX > 0) && posX + speed >= diffX) || \n ((diffY < 0) && posY + speed <= diffY) || ((diffY > 0) && posY + speed >= diffY)) {\n mvPiece.style.left = diffX + 'px';\n mvPiece.style.top = diffY + 'px';\n clearInterval(id);\n checkCapture(sqTo, mvPiece);\n resetPosition(mvPiece);\n //FIXME: add promotion parameter to checkSpecialMoves()\n let tempMove = null;\n if (move.length === 5) {\n tempMove = chess.move({from: mvFrom, to: mvTo, promotion: 'q'});\n }\n else {\n tempMove = chess.move({from: mvFrom, to: mvTo});\n }\n checkSpecialMoves(mvFrom, tempMove, mvTo, mvPiece);\n checkEndGame();\n } else {\n posX += speed * Math.cos(angle);\n posY += speed * Math.sin(angle);\n mvPiece.style.left = posX + 'px';\n mvPiece.style.top = posY + 'px';\n }\n }\n\n document.getElementById('thinking').classList.remove('lds-grid');\n}", "title": "" }, { "docid": "5cf22bd6602771484851305dcbde7a2c", "score": "0.5946446", "text": "function update() {\n\n\t\tif( playGame ) {\t\t\n\t\t\tcurrentPiece.y ++;\n\t\t\t\n\t\t\tif( hasLandedOnBottom( currentPiece ) || hasCollidedWithBlocks( currentPiece )) {\n\t\t\t\tcurrentPiece.y--; // shift back up\n\n\t\t\t\t// dump all blocks into gameGrid\n\t\t\t\tfor( var j = 0; j<currentPiece.shapeMatrix.length; j++ ) {\n\t\t\t\t\tgameGrid.push( new block( currentPiece.x + currentPiece.shapeMatrix[ j ], currentPiece.y + currentPiece.shapeMatrix[ j+1 ], currentPiece.colour ));\n\t\t\t\t\tj++; // already done the y value\n\t\t\t\t}\n\t\t\t\tisGameOver()\n\t\t\t\tcheckForFullRows();\n\t\t\t\tnewPiece();\n\t\t\t};\n\t\t};\n\n\t\tif( softDrop ) {\n\t\t\tupdateTimer = setTimeout( update, 100 );\n\t\t} else {\n\t\t\tupdateTimer = setTimeout( update, currentSpeed );\n\t\t}\n\t}", "title": "" }, { "docid": "3e02a016178c871c99b3dbd759fc1d35", "score": "0.5946057", "text": "normalMove(piece, tile) {\n if(tile.piece) return;\n let x = tile.x, y = tile.y; // destination coords\n let px = piece.tile.x, py = piece.tile.y; // origin coords\n let dx = x-px, dy = y-py; // difference\n if(Math.abs(dx) + Math.abs(dy) != 1) return; // only adjacent moves\n\n // move piece animation\n let chain = function() {\n piece.move(tile);\n piece.moves_left--;\n this.highlightTiles(x,y); // highlight new moves\n }.bind(this);\n piece.animations[1] = new MyPieceAnimation(this.scene, 0.5, dy, 0, dx, chain);\n this.unhighlightTiles();\n }", "title": "" }, { "docid": "153f83f3f8ffc94870f0917ed7f63c14", "score": "0.594288", "text": "placePiece() {\n\t\t\t$(\".cell[temp]\").removeAttr(\"temp\");\n\t\t\tvar newPiece = JSON.parse(JSON.stringify(this.place_piece));\n\t\t\tthis.board[this.place_location] = newPiece;\n\t\t\tconsole.log(this.board, this.place_location, this.place_piece);\n\t\t}", "title": "" }, { "docid": "061cb6ad17c6128b03cc6b4dffaef520", "score": "0.59402263", "text": "function movePiece(event){\n\n\t\t//run emptyPieceSwap to make the actual move\n\t\temptyPieceSwap(this);\n\n\t\t//test for win conditions using winningState array\n\n\t\tvar pass = 0;\n\n\t\tfor (var i = 0; i < puzzlepiece.length; i++) {\n\n\t\t\tif (puzzlepiece[i].style.left + puzzlepiece[i].style.top == winningState[i]){\n\n\t\t\t\t//pass state remains as true\n\t\t\t} else {\n\n\t\t\t\t//pass state changes to false\n\t\t\t\tpass++;\n\t\t\t}\n\t\t}\n\n\t\tif (pass == 0){\n\t\t\t//if the puzzle is in it's winning state, then...\n\t\t\t//change header text to notify user of the win\n\t\t\t//change it's font, colour, and background colour\n\t\t\t//also change the board so that all borders are red and all text is green\n\t\t\t//this is similar to the indication given when a puzzle piece is highlighted as a movable piece\n\n\t\t\tvar temp = document.getElementsByTagName(\"h1\")[0];\n\n\t\t\ttemp.textContent = \"BING BING BING !!! CONGRATULATIONS !!!\";\n\t\t\ttemp.style.color = \"#006600\";\n\t\t\ttemp.style.backgroundColor = \"red\";\n\t\t\ttemp.style.fontFamily = \"Comic Sans MS\";\n\n\t\t\tfor (var i = 0; i < puzzlepiece.length; i++) {\n\n\t\t\t\tpuzzlepiece[i].style.border = \"2px solid red\";\n\t\t\t\tpuzzlepiece[i].style.color = \"#006600\";\n\t\t\t\tpuzzlepiece[i].style.textDecoration = \"underline\";\n\t\t\t}\n\t\t}\n\n\t}", "title": "" }, { "docid": "7ec8a0273d48032f52b6a3060c0aebc5", "score": "0.5935858", "text": "handleEnterCastle(history, sourceRow, sourceCol, destCol) {\n const current = history[history.length - 1];\n const squares = this.cloneSquares(current.squares);\n const [whitePieces, blackPieces] = this.populatePieces(squares);\n const middleSpace = squares[sourceRow][sourceCol].getPathToDest([sourceRow, destCol])[0];\n if (squares[sourceRow][sourceCol] instanceof King) { //just to be sure it's a king\n if (squares[sourceRow][sourceCol].hasMoved) {\n this.setState({\n status: 'Cannot enter castle because king has been moved before. Select again',\n sourceRow: -1,\n sourceCol: -1,\n });\n } else if (current.checkMater) {\n this.setState({\n status: 'Cannot enter castle because king is being checkmated. Select again',\n sourceRow: -1,\n sourceCol: -1,\n });\n } else if (this.kingInDanger(current, [sourceRow, sourceCol], middleSpace)) {\n this.setState({\n status: 'Cannot enter castle because the middle space is endangered. Select again',\n sourceRow: -1,\n sourceCol: -1,\n });\n } else {\n let curPlayer = current.curPlayer;\n let whiteKingPos = current.whiteKingPos;\n let blackKingPos = current.blackKingPos;\n let rookSourceCol, rookDestCol;\n\n if (destCol > sourceCol) {\n rookSourceCol = destCol + 1;\n rookDestCol = destCol - 1;\n } else {\n rookSourceCol = destCol - 2;\n rookDestCol = destCol + 1;\n }\n let piece = squares[sourceRow][rookSourceCol];\n if (piece instanceof Rook) {\n if (!piece.hasMoved) {\n if (this.isPathEmpty(squares, piece, [sourceRow, rookDestCol])) {\n //move the king\n squares[sourceRow][destCol] = squares[sourceRow][sourceCol];\n squares[sourceRow][destCol].currentPos = [sourceRow, destCol];\n squares[sourceRow][destCol].hasMoved = true;\n squares[sourceRow][sourceCol] = null;\n curPlayer === 'white' ?\n whiteKingPos = [sourceRow, destCol] : blackKingPos = [sourceRow, destCol];\n\n //move the rook\n squares[sourceRow][rookDestCol] = piece;\n piece.currentPos = [sourceRow, rookDestCol];\n piece.hasMoved = true;\n squares[sourceRow][rookSourceCol] = null;\n\n //check if any piece checkmate opponent king. For this case, we can safely use the state's\n //black or white pieces because no pieces are added or deleted from the set by enter castle\n let pieces = (curPlayer === 'white' ? current.whitePieces : current.blackPieces);\n let checkMater = this.kingCheckMated(current, pieces);\n let status = checkMater ? 'Checkmated. Please resolve' : '';\n\n this.setState({\n history: history.concat({\n squares: squares,\n whiteFallenSoldiers: current.whiteFallenSoldiers.slice(),\n blackFallenSoldiers: current.blackFallenSoldiers.slice(),\n whitePieces: whitePieces,\n blackPieces: blackPieces,\n whiteKingPos: whiteKingPos,\n blackKingPos: blackKingPos,\n checkMater: checkMater,\n curPlayer: curPlayer === 'white' ? 'black' : 'white',\n evolvePawnRow: -1,\n evolvePawnCol: -1,\n lastMove: [[sourceRow, sourceCol], [sourceRow, destCol]],\n }),\n status: status,\n sourceRow: -1,\n sourceCol: -1,\n stepNumber: this.state.stepNumber + 1,\n });\n } else {\n this.setState({\n status: 'Cannot enter castle because rook src->dest is not empty. Select again',\n sourceRow: -1,\n sourceCol: -1,\n });\n }\n } else {\n this.setState({\n status: 'Cannot enter castle because rook has been moved before. Select again',\n sourceRow: -1,\n sourceCol: -1,\n });\n }\n } else {\n this.setState({\n status: 'The corresponding piece is not a rook. Select again',\n sourceRow: -1,\n sourceCol: -1,\n });\n }\n }\n }\n }", "title": "" }, { "docid": "d613f416f28826fd3ecda91e6547508f", "score": "0.59286135", "text": "var moves;\n switch(piece.type) {\n //example piece moves for international chess\n // case \"knight\":\n // return this.generatePositions(piece.positionCoord, [[-2,1],[-1,2],[1,2],[2,1],[2,-1],[1,-2],[-1,-2],[-2,-1]], \"singular\", myOccupiedSquares, opponentOccupiedSquares, [-1,8,-1,8]);\n // case \"rook\":\n // return this.generatePositions(piece.positionCoord, [[-1,0],[0,1],[1,0],[0,-1]], \"plural\", myOccupiedSquares, opponentOccupiedSquares, [-1,8,-1,8]);\n case \"#\":\n return this.generatePositions(piece.positionCoord, [[#, #],[#, #]], \"#\", myOccupiedSquares, opponentOccupiedSquares, [#,#,#,#]);\n case \"#\":\n return this.generatePositions(piece.positionCoord, [[#, #],[#, #]], \"#\", myOccupiedSquares, opponentOccupiedSquares, [#,#,#,#]);\n //repeat until each piece has moving rules associated with it\n }", "title": "" }, { "docid": "d3549464470c110fda0acd826c770e50", "score": "0.5926242", "text": "move(position) {\n const self = this;\n\n // get active player\n const player = this.state.players[this.activePlayer];\n\n // The player moved from its current cell!\n let moved = false;\n\n if (player) {\n // get the cell the player landed on\n const next = self.grid.cellContent(position);\n\n // checks if the player landed on a weapon\n if (next && next.type === 'weapon') {\n // check if player has any weapon\n if (player.currentWeapon) {\n // save current weapon\n player.saveWeapon();\n }\n\n // remove the current weapon from the grid\n self.grid.removeWeapon(next);\n\n // remove the current weapon from the UI\n self.actuator.removeWeapon(next);\n\n // sets player current weapon\n player.currentWeapon = next;\n }\n\n // update active player current position\n player.savePosition();\n\n // change active player position on the grid\n self.movePlayer(player, position);\n\n // renders player new position to the UI\n self.actuator.movePlayer(player);\n\n // The player moved from its current cell!\n moved = true;\n\n // remove highlighted path from active player\n self.removeHighlightedPath(player);\n\n // renders player weapon to the UI\n self.updatePlayerWeapon(player);\n\n // update player in state object\n self.state.players[self.activePlayer] = player;\n }\n\n // checks if the player moved from it current cell\n if (moved) {\n // checks if players are close to each other\n if (self.isPlayersClose()) {\n // set active player to player 1\n this.activePlayer = 0;\n\n // set fight to begin combat mode\n this.fight = true;\n\n // update stats\n self.actuate();\n } else {\n // update stats\n self.actuate();\n // switch to next player\n self.highlightNextPlayer();\n }\n }\n }", "title": "" }, { "docid": "d22d128b037c1e7e07ff17bbc7997707", "score": "0.5923932", "text": "function movePiece(srank, sfile, drank, dfile) {\n\tvar sourceSqr = sqr64to120(sqr64(srank, sfile));\n\tvar destinationSqr = sqr64to120(sqr64(drank, dfile));\n\tvar valid = validMove(sourceSqr, destinationSqr);\n\tupdateRookStatus(sourceSqr);\n\tif (valid) {\n\t\tcBoard[destinationSqr] = cBoard[sourceSqr];\n\t\tcBoard[sourceSqr] = PIECES.EMPTY;\n\t\tif (valid == MOVES.CASTLE_L) {\n\t\t\tif (currentTurn == COLOR.WHITE) { // White left castle\n\t\t\t\tcBoard[94] = PIECES.wR;\n\t\t\t\tcBoard[91] = PIECES.EMPTY;\n\t\t\t\twhiteKingMoved = true;\n\t\t\t\twhiteRookAMoved = true;\n\t\t\t} else { // Black left castle\n\t\t\t\tcBoard[24] = PIECES.bR;\n\t\t\t\tcBoard[21] = PIECES.EMPTY;\n\t\t\t\tblackKingMoved = true;\n\t\t\t\tblackRookAMoved = true;\n\t\t\t}\n\t\t}\n\n\t\tif (valid == MOVES.CASTLE_R) {\n\t\t\tif (currentTurn == COLOR.WHITE) { // White right castle\n\t\t\t\tcBoard[96] = PIECES.wR;\n\t\t\t\tcBoard[98] = PIECES.EMPTY;\n\t\t\t\twhiteKingMoved = true;\n\t\t\t\twhiteRookHMoved = true;\n\t\t\t} else { // Black riht castle\n\t\t\t\tcBoard[26] = PIECES.bR;\n\t\t\t\tcBoard[28] = PIECES.EMPTY;\n\t\t\t\tblackKingMoved = true;\n\t\t\t\tblackRookHMoved = true;\n\t\t\t}\n\t\t}\n\n\t\tcurrentTurn ^= 1; // changing turn\n\t\tsetupBoard(); //Reset the GUI after each move\n\t}\n}", "title": "" }, { "docid": "65ba86cbb1d5598239c8e7c6aa0b2469", "score": "0.5921789", "text": "function movePiece () {\n currentTime--\n timeLeft.textContent = currentTime\n autoMoveCars()\n autoMoveLogs()\n moveWithLogLeft()\n moveWithLogRight()\n lose()\n}", "title": "" }, { "docid": "4880544c1755f140091d2961140ac80e", "score": "0.591576", "text": "moveTile (clicked, empty, direction) {\n let d = 'x';\n if (direction == 'v') {\n d = 'y';\n }\n \n if (Math.abs(clicked.canvasPosition[d] - empty.canvasPosition[d]) <= PIXELS_MOVE) {\n clicked.canvasPosition[d] = empty.canvasPosition[d];\n }\n else if ((clicked.canvasPosition[d] - empty.canvasPosition[d]) < PIXELS_MOVE) {\n clicked.canvasPosition[d] += PIXELS_MOVE;\n }\n else if ((clicked.canvasPosition[d] - empty.canvasPosition[d]) > PIXELS_MOVE){\n clicked.canvasPosition[d] -= PIXELS_MOVE;\n }\n \n }", "title": "" }, { "docid": "7e0af666adf87156f08008ad63d45baa", "score": "0.59055436", "text": "directMove(si,sj, ei,ej) {\n let sCell = this.cells[si][sj];\n let eCell = this.cells[ei][ej];\n let atePiece = sCell.movePieceTo(eCell,false)\n // \n if (!atePiece || !eCell.hasEatMove()) {\n this.swapPlayers();\n }\n }", "title": "" }, { "docid": "9dc6542e312391e11f3fab7bb7a581e1", "score": "0.58941674", "text": "function umpire(player, tile, position){\n if(winner == ''){\n if (position == 'first') {\n $$(tile).children(\"svg[class='cell-x']\").addClass('animated awesome-x').css({display: 'block', visibility: 'visible'});\n $$('.moves').html(\"<span><b>O</b> Turn</span>\");\n }else{\n $$(tile).children(\"svg[class='cell-o']\").addClass('animated awesome-o').css({display: 'block', visibility: 'visible'});\n $$('.moves').html(\"<span><b>X</b> Turn</span>\");\n }\n }\n\n function check(win){\n if (gamesPlayed.indexOf(win[0]) != -1 && gamesPlayed.indexOf(win[1]) != -1 && gamesPlayed.indexOf(win[2]) != -1) {\n return true;\n }\n }\n\n if (level == 'Easy' || level == 'Medium' || level == 'Hard'){\n if(player == 'H'){\n if(humanWins.filter(check)[0] != undefined){\n /*--- Strokes for winning indicator -- */\n winingStrokes((humanWins.filter(check)[0]).toString(), human);\n beantech.alert('Player wins!');\n\n //update human scores in localstorage and score board\n localStorage.setItem('hScore', ++hScore);\n (human == \"first\") ? x_scores.text(hScore) : o_scores.text(hScore);\n (human == \"first\") ? $$('.moves').html(\"<span><b>X</b> Wins</span>\") : $$('.moves').html(\"<span><b>O</b> Wins</span>\");\n winner = 'H';\n return;\n }\n }\n if(player == 'C'){\n if(computerWins.filter(check)[0] != undefined){\n /*--- Strokes for winning indicator -- */\n winingStrokes((computerWins.filter(check)[0]).toString(), ai);\n beantech.alert('Computer wins!');\n\n //update computer scores in localstorage and score board\n localStorage.setItem('cScore', ++cScore);\n (ai == \"first\") ? x_scores.text(cScore) : o_scores.text(cScore);\n (ai == \"first\") ? $$('.moves').html(\"<span><b>X</b> Wins</span>\") : $$('.moves').html(\"<span><b>O</b> Wins</span>\");\n winner = 'C';\n return;\n }\n }\n if(gamesPlayed.length >= 9 && winner == ''){\n beantech.alert('Draw');\n }\n }\n if (level == 'Draw wins [Easy]' || level == 'Draw wins [Medium]' || level == 'Draw wins [Hard]') {\n if(player == 'H'){\n if(humanWins.filter(check)[0] != undefined){\n beantech.alert('Computer wins! You connected winning cells.');\n //update computer scores in localstorage and score board\n localStorage.setItem('cScore', ++cScore);\n (ai == \"first\") ? x_scores.text(cScore) : o_scores.text(cScore);\n (ai == \"first\") ? $$('.moves').html(\"<span><b>X</b> Wins</span>\") : $$('.moves').html(\"<span><b>O</b> Wins</span>\");\n winner = 'C';\n return;\n }\n }\n if(player == 'C'){\n if(computerWins.filter(check)[0] != undefined){\n beantech.alert('Computer wins! Computer connected winning cells.');\n //update computer scores in localstorage and score board\n localStorage.setItem('cScore', ++cScore);\n (ai == \"first\") ? x_scores.text(cScore) : o_scores.text(cScore);\n (ai == \"first\") ? $$('.moves').html(\"<span><b>X</b> Wins</span>\") : $$('.moves').html(\"<span><b>O</b> Wins</span>\");\n winner = 'C';\n return;\n }\n }\n if(gamesPlayed.length >= 9 && winner == ''){\n beantech.alert('Player wins! You achieved a draw.');\n //update human scores in localstorage and score board\n localStorage.setItem('hScore', ++hScore);\n (human == \"first\") ? x_scores.text(hScore) : o_scores.text(hScore);\n (human == \"first\") ? $$('.moves').html(\"<span><b>X</b> Wins</span>\") : $$('.moves').html(\"<span><b>O</b> Wins</span>\");\n winner = 'H';\n return;\n }\n }\n }", "title": "" }, { "docid": "20bf11998441090c721fc89db0c096aa", "score": "0.5879234", "text": "testMove(piece, square) {\n\t\tconst board = this.data.board;\n\t\tpiece = board.filterPiece(this, piece); // filter piece\n\t\tsquare = board.filterSquare(square); // filter square\n\n\t\tif (!piece || !square) return false;\n\t\tconst backup = { square: piece.square, piece: square.piece }; // back up current data\n\t\tlet player = backup.piece ? backup.piece.player : null;\n\t\tlet pieces = backup.piece ? player.data.pieces : null;\n\t\tlet index = backup.piece ? pieces.indexOf(backup.piece) : null; // if there's piece inside store\n\t\tlet status = false;\n\n\t\t// if there is piece, remove it from the board\n\t\tindex && pieces.splice(index, 1);\n\n\t\t// then move the piece\n\t\tpiece.silentMove(square);\n\n\t\t// then check how the board, react and possibilities\n\t\tstatus = this.data.board.analyze(); // will return false, if you are checked\n\n\t\t// move back again the piece in it's position\n\t\tpiece.silentMove(backup.square);\n\n\t\t// place the piece in to it'square\n\t\tsquare.piece = backup.piece;\n\n\t\t// and place again in to the board\n\t\tindex && pieces.splice(index, 0, backup.piece);\n\n\t\treturn status;\n\t}", "title": "" }, { "docid": "70bc27afdb0a7ebd62bd9a235a6e9e71", "score": "0.587654", "text": "function BoardManager() {\n this.validMoves = undefined;\n this.board = undefined;\n\n this.resetValidMoves = function(){\n this.validMoves = [];\n }\n\n this.initialize = function() {//base board configuration\n this.board = [\n 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 1, 2, 0, 0, 0,\n 0, 0, 0, 2, 1, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0]; \n };\n //0 = top left, 63 = bottom right\n\n/* board for checking winning\n this.board = [\n 0, 2, 1, 1, 1, 1, 1, 1,\n 1, 1, 1, 1, 1, 1, 1, 1,\n 1, 1, 1, 1, 1, 1, 1, 1,\n 1, 1, 1, 1, 1, 1, 1, 1,\n 1, 1, 1, 1, 1, 1, 1, 1,\n 1, 1, 1, 1, 1, 1, 1, 1,\n 1, 1, 1, 1, 1, 1, 1, 1,\n 1, 1, 1, 1, 1, 1, 1, 1,];\n \n */\n\n\n this.textToColor = function(color){\n if(color == \"WHITE\") return 1;\n else if(color == \"BLUE\") return 2;\n else return color; //if neither, it might already be 1 or 2!\n };\n this.colorToText = function(color){\n if(color == 1) return \"WHITE\";\n else if(color == 2) return \"BLUE\";\n else return color; //if neither, it might already be 1 or 2!\n };\n\n this.placePiece = function(position, color, delay) {\n //console.log(position + \" \" + color); //logs where piece was placed and which color.\n //if(this.board[position] != 0) return; //return if not empty\n //clear valid moves if there are any\n if(this.validMoves != undefined && this.validMoves.length > 0){\n this.clearMoves();\n }\n\n this.board[position] = this.textToColor(color);\n setTimeout(this.updateVisualColor, delay, position, this.colorToText(color))\n \n //switch off the UI element by adding the 'disabled' class name (defined in game.css) \n };\n\n this.updateVisualColor = function(position, color){\n document.getElementById(position).className = \"grid-item-\" + color;\n }\n\n this.clearMoves = function(){\n for(let i = 0; i < this.validMoves.length; i++){\n document.getElementById(this.validMoves[i]).className = \"grid-item\";\n }\n this.resetValidMoves();\n }\n\n //get count in board that match the id //1 for white, 2 for blue, 0 for unfilled\n this.getPieceCount = function(id){\n let count = 0;\n for(let i = 0; i < this.board.length; i++){\n if(this.board[i] == id) count++;\n }\n return count;\n };\n\n this.isValidMove = function(coordinate){\n if(this.validMoves == undefined) \n return false;\n for(let i = 0; i < this.validMoves.length; i++){\n if(this.validMoves[i] == coordinate) return true;\n }\n return false;\n };\n \n //calculate valid moves for a specific color\n //color should be int 1 or 2\n this.determineValidMoves = function(color){\n color = this.textToColor(color);\n\n this.resetValidMoves();\n for(let i = 0; i < this.board.length; i++){\n if(this.board[i] != 0) continue; // skip all filled in slots\n\n if(this.validDirections(i, color, true).length > 0){//if this spot has at least one valid direction, this is a valid move\n this.validMoves.push(i); //add to list in this case.\n document.getElementById(i).className = \"grid-item-valid\";//update UI\n }\n }\n };\n\n //returns list of valid directions you could traverse from one point to get the other points.\n //directions it return will be a single integer as given by getDirection function\n //color should be int 1 or 2, coordinate should be a single integer for array based board\n this.validDirections = function(coordinate, color, needOne) {\n color = this.textToColor(color);\n coordinate = +coordinate; //make sure that coordinate is a number\n let validDirectionsList = [];\n\n for(let x = -1; x <= 1; x++){\n for(let y = -1; y <= 1; y++){\n if(x == 0 && y == 0) continue;//we dont need this direction\n\n let position = coordinate; // already move once in the direction. the while loop assumes the current spot is the opposite color.\n let count = 0; //keep track of the enemy colors we have seen\n do{\n if(x > 0 && position % 8 == 7) //if going to the right, but this slot is the first in a row, break.\n break;\n if(x < 0 && position % 8 == 0) //if going to the left, but this slot is the last in a row, break.\n break;\n position += this.getDirection(x, y);\n\n \n if(position > 63 || position < 0 || this.board[position] == 0) //if we find a gap, or exceed the board limitation break out of loop.\n break;\n\n if(this.board[position] != color) \n count++;\n else if(count > 0){ //we found a spot with the same color as given argument, thus valid direction\n validDirectionsList.push(this.getDirection(x, y));\n if(needOne) return validDirectionsList; //if we only need to know IF this coordinate has a valid direction, we could return now to save time.\n }\n\n } while(this.board[position] != color && this.board[position] != 0);\n\n\n }\n }\n return validDirectionsList;\n };\n\n //get direction for array based map\n this.getDirection = function(x, y){\n return x + 8 * y;\n };\n this.leftOrRight = function(dir){\n if(dir == 1 || dir == -7 || dir == 9) return 1;\n if(dir == -1 || dir == -9 || dir == 7) return -1;\n return 0;\n }\n\n //change neighbouring pieces\n //color should be int 1 or 2, coordinate should be a single integer for array based board\n this.changePieces = function(coordinate, color) {\n let pieceAmount = 0;\n coordinate = +coordinate; //make sure coordinate is a number\n \n color = this.textToColor(color);\n let validDirs = this.validDirections(coordinate, color, false); //get list of valid directions\n\n for(let i = 0; i < validDirs.length; i++){\n position = coordinate + validDirs[i];\n\n while(this.board[position] != color && this.board[position] != 0){\n let delay = pieceAmount * 50;\n this.placePiece(position, color, delay);\n\n setTimeout(this.AnimatePiece, delay, position, color, this);\n\n position += validDirs[i];\n pieceAmount++;\n if(position > 63 || position < 0) break;\n if(this.leftOrRight(validDirs[i]) > 0 && position % 8 == 7) //if going to the right, but this slot is the first in a row, break.\n break;\n if(this.leftOrRight(validDirs[i]) < 0 && position % 8 == 0) //if going to the left, but this slot is the last in a row, break.\n break;\n }\n } \n };\n\n this.AnimatePiece = function(position, color, obj){//set css animation tag\n let el = document.getElementById(position);\n el.style.animationName = color == 2 ? \"WhiteToBlue\" : \"BlueToWhite\";//get other animation \n }\n}", "title": "" }, { "docid": "6f06e4ff5e8a48c58fe0ce1ee234e066", "score": "0.5871839", "text": "react(game, pieceThatTriggeredReaction, tilePieceMovedFrom)\n {\n if (this.owner == pieceThatTriggeredReaction.owner && this.isActive)\n {\n var north = {colDelta: 0, rowDelta: -1}\n var south = {colDelta: 0, rowDelta: 1}\n var east = {colDelta: 1, rowDelta: 0}\n var west = {colDelta: -1, rowDelta: 0}\n var piecesCurrentTile = pieceThatTriggeredReaction.getCurrentTile(game)\n \n if (piecesCurrentTile.col < tilePieceMovedFrom.col)\n var direction = west\n else if (piecesCurrentTile.col > tilePieceMovedFrom.col)\n var direction = east\n else if (piecesCurrentTile.row < tilePieceMovedFrom.row)\n var direction = north\n else\n var direction = south\n\n var path = []\n var spacesToMove = 3\n while (spacesToMove > 0 && piecesCurrentTile.col + direction.colDelta >= 0 && piecesCurrentTile.col + direction.colDelta < constants.boardWidth && piecesCurrentTile.row + direction.rowDelta >= 0 && piecesCurrentTile.row + direction.rowDelta < constants.boardLength)\n {\n var tileToAddToPath = game.board[piecesCurrentTile.col + direction.colDelta][piecesCurrentTile.row + direction.rowDelta]\n if (tileToAddToPath.piece != null)\n {\n pieceThatTriggeredReaction.moveWithoutExpendingMovement(game, path)\n return \"stop movement\"\n }\n else\n {\n path.push(tileToAddToPath)\n piecesCurrentTile = tileToAddToPath\n spacesToMove --\n }\n }\n pieceThatTriggeredReaction.moveWithoutExpendingMovement(game, path)\n return \"stop movement\"\n }\n return \"continue movement\"\n }", "title": "" }, { "docid": "cf4d6772e02c5cfd6bc7730df742fdbb", "score": "0.58712447", "text": "updateTurn() {\n if (this.funcState != this.state.MOVIE && this.selectedPiece != null) {\n this.selectedPiece.updateState('On Board')\n this.scene.graph.clearHighlightedCells()\n }\n\n if (this.currPlayer == this.blackPlayer) {\n this.blackPlayer.stopTimer()\n this.currPlayer = this.redPlayer\n }\n else if (this.currPlayer == this.redPlayer) {\n this.redPlayer.stopTimer()\n this.currPlayer = this.blackPlayer\n }\n this.currPlayer.startTimer()\n\n this.updateCamera()\n }", "title": "" }, { "docid": "5883f038f348f3ed8fa5a087a2afe2aa", "score": "0.586747", "text": "normalisePiecePositions() {\n for (let i = 0; i < this.data.length; i++) {\n this.pos[i][0] = this.setupData.home[i][0];\n this.pos[i][1] = this.setupData.home[i][1];\n }\n }", "title": "" }, { "docid": "3bf71538e69215bb58001780d7e00e50", "score": "0.58614874", "text": "function init_pieces() {\n var row_index,\n col_index,\n pawn,\n \n white_king_index = [7, 4],\n black_king_index = [0, 4],\n \n white_queen_index = [7, 3],\n black_queen_index = [0, 3],\n\n white_bishop_1_index = [7, 2],\n black_bishop_1_index = [0, 2],\n white_bishop_2_index = [7, 5],\n black_bishop_2_index = [0, 5],\n\n white_knight_1_index = [7, 1],\n black_knight_1_index = [0, 1],\n white_knight_2_index = [7, 6],\n black_knight_2_index = [0, 6],\n\n white_rook_1_index = [7, 0],\n black_rook_1_index = [0, 0],\n white_rook_2_index = [7, 7],\n black_rook_2_index = [0, 7],\n\n piece;\n\n // Init black pawns\n row_index = 1;\n pawn = piece_factory(CONSTANTS.PIECES.PAWN, CONSTANTS.COLOURS.BLACK);\n for (col_index = 0; col_index < 8; col_index++) {\n piece = $(pawn).clone();\n $('[data-row_index=\"' + row_index + '\"][data-col_index=\"' + col_index + '\"]').append(piece);\n make_piece_draggable(piece);\n }\n\n // Init white pawns\n row_index = 6;\n pawn = piece_factory(CONSTANTS.PIECES.PAWN, CONSTANTS.COLOURS.WHITE);\n for (col_index = 0; col_index < 8; col_index++) {\n piece = $(pawn).clone();\n $('[data-row_index=\"' + row_index + '\"][data-col_index=\"' + col_index + '\"]').append(piece);\n make_piece_draggable(piece);\n }\n\n // Init Kings\n piece = piece_factory(CONSTANTS.PIECES.KING, CONSTANTS.COLOURS.WHITE);\n $(SQUARE.get_square_at(white_king_index[0], white_king_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.KING, CONSTANTS.COLOURS.BLACK);\n $(SQUARE.get_square_at(black_king_index[0], black_king_index[1])).append(piece);\n make_piece_draggable(piece);\n\n // Init Queens\n piece = piece_factory(CONSTANTS.PIECES.QUEEN, CONSTANTS.COLOURS.WHITE);\n $(SQUARE.get_square_at(white_queen_index[0], white_queen_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.QUEEN, CONSTANTS.COLOURS.BLACK);\n $(SQUARE.get_square_at(black_queen_index[0], black_queen_index[1])).append(piece);\n make_piece_draggable(piece);\n\n // Init Bishops\n piece = piece_factory(CONSTANTS.PIECES.BISHOP, CONSTANTS.COLOURS.WHITE);\n $(SQUARE.get_square_at(white_bishop_1_index[0], white_bishop_1_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.BISHOP, CONSTANTS.COLOURS.BLACK);\n $(SQUARE.get_square_at(black_bishop_1_index[0], black_bishop_1_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.BISHOP, CONSTANTS.COLOURS.WHITE);\n $(SQUARE.get_square_at(white_bishop_2_index[0], white_bishop_2_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.BISHOP, CONSTANTS.COLOURS.BLACK);\n $(SQUARE.get_square_at(black_bishop_2_index[0], black_bishop_2_index[1])).append(piece);\n make_piece_draggable(piece);\n\n // Init Knights\n piece = piece_factory(CONSTANTS.PIECES.KNIGHT, CONSTANTS.COLOURS.WHITE);\n $(SQUARE.get_square_at(white_knight_1_index[0], white_knight_1_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.KNIGHT, CONSTANTS.COLOURS.BLACK);\n $(SQUARE.get_square_at(black_knight_1_index[0], black_knight_1_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.KNIGHT, CONSTANTS.COLOURS.WHITE);\n $(SQUARE.get_square_at(white_knight_2_index[0], white_knight_2_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.KNIGHT, CONSTANTS.COLOURS.BLACK);\n $(SQUARE.get_square_at(black_knight_2_index[0], black_knight_2_index[1])).append(piece);\n make_piece_draggable(piece);\n\n // Init Rooks\n piece = piece_factory(CONSTANTS.PIECES.ROOK, CONSTANTS.COLOURS.WHITE);\n $(SQUARE.get_square_at(white_rook_1_index[0], white_rook_1_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.ROOK, CONSTANTS.COLOURS.BLACK);\n $(SQUARE.get_square_at(black_rook_1_index[0], black_rook_1_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.ROOK, CONSTANTS.COLOURS.WHITE);\n $(SQUARE.get_square_at(white_rook_2_index[0], white_rook_2_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.ROOK, CONSTANTS.COLOURS.BLACK);\n $(SQUARE.get_square_at(black_rook_2_index[0], black_rook_2_index[1])).append(piece);\n make_piece_draggable(piece);\n}", "title": "" }, { "docid": "9772f0cd233423e90c74b8388f33fe16", "score": "0.58598244", "text": "moveSnake() {\n const { direction, snakeCoords, board, snakeLength } = this.state;\n\n let newBoard = board.map(r => r.slice());\n\n let currSnakeUnitX = snakeCoords[0][0];\n let currSnakeUnitY = snakeCoords[0][1];\n let currDirection = direction;\n let i = 0;\n while (i < snakeLength) {\n if (currDirection === 'right') {\n\n newBoard = this.moveUnitRight(\n newBoard,\n currSnakeUnitX + 1,\n currSnakeUnitY);\n\n currSnakeUnitX--;\n\n } else if (currDirection === 'left') {\n newBoard = this.moveUnitLeft(\n newBoard,\n currSnakeUnitX - 1,\n currSnakeUnitY)\n currSnakeUnitX++;\n } else if (currDirection === 'up') {\n newBoard = this.moveUnitUp(\n newBoard,\n currSnakeUnitX,\n currSnakeUnitY + 1)\n currSnakeUnitY--;\n } else if (currDirection === 'down') {\n newBoard = this.moveUnitDown(\n newBoard,\n currSnakeUnitX,\n currSnakeUnitY - 1)\n currSnakeUnitY++;\n }\n i++;\n }\n\n this.setState(state =>({\n ...state,\n board: newBoard,\n }));\n }", "title": "" }, { "docid": "f0d50b27d53d9896450c951e7d05e8fa", "score": "0.58581", "text": "showRandomMove() {\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n this.drawGameboard();\n\n const i = Math.floor(this.matchingMoves.length * Math.random());\n const move = this.matchingMoves[i];\n const { gem1, gem2 } = move;\n console.log(\n `swap gem1 at (col ${gem1.col()}, row ${gem1.row()}) with gem2 at (col ${gem2.col()}, row ${gem2.row()})`\n );\n\n const xGem1 = this.squareWidth * gem1.col();\n const yGem1 = this.squareHeight * gem1.row();\n const quad = 0.25 * this.squareWidth;\n let xStart, yStart;\n\n this.context.save();\n\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n this.drawGameboard();\n\n this.context.strokeStyle = \"black\";\n const moveDir = this.gameboard.relativePosition(gem1, gem2);\n\n if (moveDir === \"right\") {\n xStart = 1.2 * this.squareWidth + xGem1;\n yStart = -0.5 * this.squareHeight + yGem1;\n this.context.beginPath();\n this.context.moveTo(xStart, yStart);\n this.context.lineTo(xStart - quad, yStart - quad);\n this.context.lineTo(xStart - quad, yStart + quad);\n this.context.fill();\n this.context.rect(-2 * quad + xStart, -0.5 * quad + yStart, quad, quad);\n this.context.fill();\n this.context.closePath();\n } else if (moveDir === \"left\") {\n xStart = -0.25 * this.squareWidth + xGem1;\n yStart = -0.5 * this.squareHeight + yGem1;\n this.context.beginPath();\n this.context.moveTo(xStart, yStart);\n this.context.lineTo(xStart + quad, yStart + quad);\n this.context.lineTo(xStart + quad, yStart - quad);\n this.context.fill();\n this.context.rect(quad + xStart, -0.5 * quad + yStart, quad, quad);\n this.context.fill();\n this.context.closePath();\n } else if (moveDir === \"down\") {\n xStart = 0.5 * this.squareWidth + xGem1;\n yStart = 0.25 * this.squareHeight + yGem1;\n this.context.beginPath();\n this.context.moveTo(xStart, yStart);\n this.context.lineTo(xStart + quad, yStart - quad);\n this.context.lineTo(xStart - quad, yStart - quad);\n this.context.fill();\n this.context.rect(-0.5 * quad + xStart, -2 * quad + yStart, quad, quad);\n this.context.fill();\n this.context.closePath();\n } else if (moveDir === \"up\") {\n xStart = 0.5 * this.squareWidth + xGem1;\n yStart = -1.2 * this.squareHeight + yGem1;\n this.context.beginPath();\n this.context.moveTo(xStart, yStart);\n this.context.lineTo(xStart - quad, yStart + quad);\n this.context.lineTo(xStart + quad, yStart + quad);\n this.context.fill();\n this.context.rect(-0.5 * quad + xStart, quad + yStart, quad, quad);\n this.context.fill();\n this.context.closePath();\n }\n\n this.context.restore();\n }", "title": "" }, { "docid": "b8b902a56f005521492d1641cfcf78af", "score": "0.58575916", "text": "function completeMove(prevSquare, nextSquare, player, squareNum) {\r\n // MOVE YOUR PIECE TO NEW SQUARE, REMOVE OLD PIECE\r\n let squareIndex = player.squares.indexOf(selectedPiece);\r\n let currentPieceClass = player.pieceClasses[squareIndex];\r\n let newLocation = player.squares[squareIndex] = squareNum;\r\n \r\n prevSquare.classList.remove(currentPieceClass);\r\n nextSquare.classList.add(currentPieceClass); \r\n kingMeMaybe(player, newLocation, nextSquare);\r\n return newLocation;\r\n}", "title": "" }, { "docid": "bdb2c732aa9c72e666d3d820a34b5b7a", "score": "0.5856212", "text": "function checkMoves(event) {\n //is a piece selected\n if (SelectedPiece) {\n CurrentBoardPosition = $(event.currentTarget).attr('class');\n var originPositionX = SelectedPiece.positionX;\n var originPositionY = SelectedPiece.positionY;\n var targetPositionX = CurrentBoardPosition.substring(0,1);\n var targetPositionY = parseInt(CurrentBoardPosition.substring(1,2));\n //is your turn\n if (SelectedPiece.color == WhoseTurn) {\n //check if piece can do this move\n if (validMove(targetPositionX, targetPositionY, SelectedPiece)) {\n //check if piece kill another\n var found = isOccupied(targetPositionX, targetPositionY);\n if (found) {\n var deletePiece;\n $('.' + found.positionX + found.positionY).contents().remove();\n $.each(Game.pieces, function(index, element) {\n if (found.id == element.id) {\n deletePiece = index;\n }\n });\n Game.pieces.splice(deletePiece, 1);\n }\n SelectedPiece.positionX = targetPositionX;\n SelectedPiece.positionY = targetPositionY;\n //is your king in Check after move\n if (isInCheck(SelectedPiece)) {\n $('.info').text('Cannot move there...You would be in check.');\n SelectedPiece.positionX = originPositionX;\n SelectedPiece.positionY = originPositionY;\n //move piece to new position\n } else {\n $('.info').text('Move ' + SelectedPiece.color + ' ' + SelectedPiece.name + ' to ' + targetPositionX + targetPositionY);\n $(event.currentTarget).append(PieceImg);\n $('.row div').each(function(index, element) {\n if ($(element).hasClass('pickUp')) {\n $(element).removeClass('pickUp');\n $(element).contents().remove();\n }\n });\n //change turn\n if (WhoseTurn == 'white') {\n WhoseTurn = 'black';\n } else {\n WhoseTurn = 'white';\n }\n }\n //wrong move\n } else {\n $('.info').text('Illegal move..Please try again.');\n }\n //not your turn\n } else {\n $('.info').text('It is ' + WhoseTurn + ' turn.');\n }\n $(ShineCell).removeClass('pickUp');\n PieceImg = null;\n SelectedPiece = null;\n //there is no selected piece\n } else {\n //is a piece's image in the selected cell\n if ($(event.currentTarget).children().is('img')) {\n //change info-text when piece selected\n if ($('.info').text() == 'Pick up a piece please.') {\n $('.info').text('');\n }\n CurrentBoardPosition = $(event.currentTarget).attr('class');\n PieceImg = $(event.currentTarget).find('img').clone();\n $('.row div').each(function(index, element) {\n if ($(element).hasClass('pickUp')) {\n $(element).removeClass('pickUp');\n }\n ShineCell = event.currentTarget;\n $(ShineCell).addClass('pickUp');\n });\n $.each(Game.pieces, function(index, element) {\n if (CurrentBoardPosition == element.positionX + element.positionY) {\n SelectedPiece = element;\n }\n });\n //change info-text if there is not piece and cell is empty\n } else {\n $('.info').text('Pick up a piece please.');\n }\n }\n}", "title": "" }, { "docid": "39d7f3c6cdf8d4cdedd753351768496a", "score": "0.5853558", "text": "function moveAndBackToNormal() {\n chess.move(square, to);\n image.classList.remove(\"select\");\n squareLocation.classList.remove(\"highlight\");\n for (move of potentialMoves) {\n let squareLocation = document.getElementById(\n `row${move.row}`)\n .children[move.col];\n squareLocation.classList.remove(\"highlight\");\n };\n chess.refresh();\n }", "title": "" }, { "docid": "3fac8c3b53a62b38cc1f83cdf38baa1b", "score": "0.58521557", "text": "updateBoard(loc, player) {\n // if a tile is clicked and equals x or o or if there is a winner it is not valid play. prevents clicking on same tile.\n if(this.state.gameBoard[loc] === 'x' || this.state.gameBoard[loc] === 'o' || this.state.winner){\n // invalid move so return.\n return;\n }\n\n let currentGameBoard = this.state.gameBoard;\n // splice in players move at the location it was clicked, we return a single element\n currentGameBoard.splice(loc, 1, this.state.turn);\n // sets state of valid move on gameBoard\n this.setState({gameBoard: currentGameBoard});\n\n let topRow = this.state.gameBoard[0] + this.state.gameBoard[1] + this.state.gameBoard[2];\n // if top row matches three x or o\n if (topRow.match(/xxx|ooo/)) {\n // then there's a winner\n this.setState({winner: this.state.turn});\n return;\n }\n let middleRow = this.state.gameBoard[3] + this.state.gameBoard[4] + this.state.gameBoard[5];\n if (middleRow.match(/xxx|ooo/)) {\n this.setState({winner: this.state.turn});\n return;\n }\n let bottomRow = this.state.gameBoard[6] + this.state.gameBoard[7] + this.state.gameBoard[8];\n if (bottomRow.match(/xxx|ooo/)) {\n this.setState({winner: this.state.turn});\n return;\n }\n let leftCol = this.state.gameBoard[0] + this.state.gameBoard[3] + this.state.gameBoard[6];\n if (leftCol.match(/xxx|ooo/)) {\n this.setState({winner: this.state.turn});\n return;\n }\n let middleCol = this.state.gameBoard[1] + this.state.gameBoard[4] + this.state.gameBoard[7];\n if (middleCol.match(/xxx|ooo/)) {\n this.setState({winner: this.state.turn});\n return;\n }\n let rightCol = this.state.gameBoard[2] + this.state.gameBoard[5] + this.state.gameBoard[8];\n if (rightCol.match(/xxx|ooo/)) {\n this.setState({winner: this.state.turn});\n return;\n }\n let leftDiag = this.state.gameBoard[0] + this.state.gameBoard[4] + this.state.gameBoard[8];\n if (leftDiag.match(/xxx|ooo/)) {\n this.setState({winner: this.state.turn});\n return;\n }\n let rightDiag = this.state.gameBoard[2] + this.state.gameBoard[4] + this.state.gameBoard[6];\n if (rightDiag.match(/xxx|ooo/)) {\n this.setState({winner: this.state.turn});\n return;\n }\n // join together all elements in the array and replace empty space with nothing. g defined in regex is a modifier used to find all matches rather than stopping after first match.\n let moves = this.state.gameBoard.join(' ').replace(/ /g, '');\n // if there are 9 moves, then set state of winner to draw\n if(moves.lengths === 9) {\n this.setState({winner: 'draw'});\n }\n // if player places x, then o turn, vice versa\n this.setState({turn: (this.state.turn === 'x') ? 'o' : 'x'});\n }", "title": "" } ]
fbb05f856c748025273535337068cf2e
A (x) = (x0 ^ x1) || x3 || x2 || x1
[ { "docid": "f454c8abffe999ead80707fbe6d747be", "score": "0.0", "text": "function A(d) {\n const a = new Uint8Array(8)\n\n for (let j = 0; j < 8; j++) {\n a[j] = (d[j] ^ d[j + 8])\n }\n\n arraycopy(d, 8, d, 0, 24)\n arraycopy(a, 0, d, 24, 8)\n\n return d\n }", "title": "" } ]
[ { "docid": "0da788010e5363a35186bf3c132f1f33", "score": "0.6082153", "text": "function checkXOR(a) {\n let somme;\n for (i = 0; i < a.length; i++) {\n somme = Number(a[i]) ^ somme;\n }\n return somme;\n}", "title": "" }, { "docid": "30094bbcaf0d89806b91298f706bd1b7", "score": "0.6072245", "text": "function G1(a, b, c, d, x) {\n a = (a + b + x) | 0;\n d = rotr(d ^ a, 16);\n c = (c + d) | 0;\n b = rotr(b ^ c, 12);\n return { a, b, c, d };\n}", "title": "" }, { "docid": "577ac3fbcec3fedd4e2f2bca65430ff8", "score": "0.6048029", "text": "function cas_exponent(a){\n var t;\n for(var i=0; i<a.length; i++){\n t=a[i][0];\n if(t.type==\"op\" && t.value==\"^\" && t.a[1].type==\"int\"){\n a[i][1]*=t.a[1].value;\n a[i][0]=t.a[0];\n }\n }\n}", "title": "" }, { "docid": "f88354de9c00a198d49be00911264aa9", "score": "0.6008748", "text": "function xor() {\n var values = [], len = arguments.length;\n while ( len-- ) values[ len ] = arguments[ len ];\n\n return !!( reduce( flatten(values), function (a,b) {\n if (b) {\n return a+1\n }\n return a\n }, 0) & 1)\n }", "title": "" }, { "docid": "47b483e5029aab7d51ad996dbbec929b", "score": "0.599831", "text": "function getMissingNo($a, $n) \n{ \n // For xor of all the \n // elements in array \n $x1 = $a[0]; \n \n // For xor of all the \n // elements from 1 to n + 1 \n $x2 = 1; \n \n for ($i = 1; $i < $n; $i++) {\n console.log('Old X1 =' , $x1)\n console.log('Old $a[$i] =' , $a[$i])\n $x1 = $x1 ^ $a[$i]; \n console.log('New X1 =' , $x1)\n\n }\n \n for ($i = 2; $i <= $n + 1; $i++) \n {\n console.log('Old X2 =' , $x2)\n console.log('Old $i =' , $i)\n $x2 = $x2 ^ $i; \n console.log('New X2 =' , $x2)\n\n }\n \n console.log($x1,'x1')\n console.log($x2,'x2')\n return ($x1 ^ $x2); \n}", "title": "" }, { "docid": "7116e18dc2225fb372d390748f26cfd7", "score": "0.59974754", "text": "function am1(i,x,w,j,c,n){while(--n>=0){var v=x*this[i++]+w[j]+c;c=Math.floor(v/0x4000000);w[j++]=v&0x3ffffff;}return c;}// am2 avoids a big mult-and-extract completely.", "title": "" }, { "docid": "518dda230d0b90135d6cdeec96e6bd0c", "score": "0.5915249", "text": "function cas_coefficient(a){\n var t;\n for(var i=0; i<a.length; i++){\n t=a[i][0];\n if(t.type==\"op\" && t.value==\"*\" && t.a[0].type==\"int\"){\n a[i][1]*=t.a[0].value;\n a[i][0]=t.a[1];\n }\n }\n}", "title": "" }, { "docid": "d7a058197ab92533af224e2f6c3bb984", "score": "0.58890617", "text": "xor (a, b) { return new instr_pre(0x73, this, [a, b]) }", "title": "" }, { "docid": "248c9fe80479a58dc566708a03b69842", "score": "0.5887971", "text": "function sha1Function2_4(arrAux){\r\n return bXor(bXor(arrAux[1],arrAux[2]),arrAux[3]);\r\n}", "title": "" }, { "docid": "80ee3c044cff8f775f8295948cc9afbc", "score": "0.5841006", "text": "function andXorOr(a) {\n const stack = [a[0]];\n let last, next, max = Number.MIN_VALUE;\n\n for (let i =1; i < a.length; i++) {\n while (stack.length) {\n last = stack[stack.length - 1];\n next = last ^ a[i];\n max = Math.max(next, max);\n if (last > a[i]) stack.pop();\n else break;\n }\n stack.push(a[i]);\n }\n return max;\n}", "title": "" }, { "docid": "be3e7f97ef3657e52a76f943decff151", "score": "0.58320576", "text": "function pair1(a, b) {\n return 2 ** a * 3 ** b\n}", "title": "" }, { "docid": "d201137a1441e509287a3042830a3525", "score": "0.58070815", "text": "function f(s, x, y, z) {\n switch(s){\n case 0:\n return x & y ^ ~x & z;\n case 1:\n return x ^ y ^ z;\n case 2:\n return x & y ^ x & z ^ y & z;\n case 3:\n return x ^ y ^ z;\n }\n}", "title": "" }, { "docid": "7e50154c31cd2419d4a27ccb9666f7bb", "score": "0.57990056", "text": "function modulate(x, a, buffer) {\n if (buffer === void 0) { buffer = expression_1.value(0.01); }\n return shape(function (p) {\n var offset = expression_1.expression(p + \" + \" + x + \" * 0.5\");\n var index = expression_1.expression(\"floor(\" + offset + \" / \" + x + \")\");\n var center = expression_1.expression(index + \" * \" + x);\n var local = expression_1.expression(p + \" - \" + center);\n var mask = shape(function (p) {\n var a = expression_1.expression(buffer + \" + \" + x + \" * 0.5 - abs(\" + p + \")\");\n return expression_1.expression(\"min(min(\" + a + \".x, \" + a + \".y), \" + a + \".z)\");\n });\n return union(mask, a(index))\n .call(local);\n });\n}", "title": "" }, { "docid": "bde58bd848d5a6f09ee1ed3f69e9ea08", "score": "0.5793542", "text": "function XOR(x, y) {\n return (x ? 1 : 0) ^ (y ? 1 : 0)\n}", "title": "" }, { "docid": "4424de15cce9e73cff786d31c098157e", "score": "0.578548", "text": "tseitin_xor(bs) {\n assert(bs.length == 2)\n var x = this.gensym('XOR');\n var a = bs[0];\n var b = bs[1];\n this.addClause([not(x), a, b])\n this.addClause([not(x), not(a), not(b)])\n this.addClause([x, a, not(b)])\n this.addClause([x, not(a), b])\n return x}", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "9c07fffebebf5df907dd86ae4961b8ee", "score": "0.5783626", "text": "function op_xor(x,y) { return x^y; }", "title": "" }, { "docid": "fbf75bd631e85c005449a73387d5b475", "score": "0.5779136", "text": "xor (a, b) { return new instr_pre(0x85, this, [a, b]) }", "title": "" }, { "docid": "3993164c60f366bb8b9e48f02caeaa96", "score": "0.5773263", "text": "function twistX(x, a) {\n return shape(function (p) {\n return rotateX(expression_1.expression(\"vec3(\" + p + \".x * \" + x + \".x)\"), a).call(p);\n });\n}", "title": "" }, { "docid": "fc8a2ec226a080fb3e0a1754ddc673a9", "score": "0.5764897", "text": "function f(s, x, y, z) {\n switch (s) {\n case 0: return (x & y) ^ (~x & z);\n case 1: return x ^ y ^ z;\n case 2: return (x & y) ^ (x & z) ^ (y & z);\n case 3: return x ^ y ^ z;\n }\n}", "title": "" }, { "docid": "fc8a2ec226a080fb3e0a1754ddc673a9", "score": "0.5764897", "text": "function f(s, x, y, z) {\n switch (s) {\n case 0: return (x & y) ^ (~x & z);\n case 1: return x ^ y ^ z;\n case 2: return (x & y) ^ (x & z) ^ (y & z);\n case 3: return x ^ y ^ z;\n }\n}", "title": "" }, { "docid": "fc8a2ec226a080fb3e0a1754ddc673a9", "score": "0.5764897", "text": "function f(s, x, y, z) {\n switch (s) {\n case 0: return (x & y) ^ (~x & z);\n case 1: return x ^ y ^ z;\n case 2: return (x & y) ^ (x & z) ^ (y & z);\n case 3: return x ^ y ^ z;\n }\n}", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "b4edd67018933825f9cec8c9089529aa", "score": "0.57461107", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" }, { "docid": "627405daa0eb34bb1a7c17b015cd585f", "score": "0.57401925", "text": "function am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this[i++]+w[j]+c;\n c = Math.floor(v/0x4000000);\n w[j++] = v&0x3ffffff;\n }\n return c;\n }", "title": "" } ]
b30223aae0525d734efccd71bd90f251
llama servicio de guardar investigaciones de semilleros
[ { "docid": "81a772993ceec7a2101b24e3e8e7e8bf", "score": "0.0", "text": "function guardarIS(is) {\n var deferred = $q.defer();\n $http.post(appConstant.LOCAL_SERVICE_ENDPOINT+\"/guardarIS\", is).then(function (res) {\n deferred.resolve(res);\n }, function (err) {\n deferred.reject(err);\n console.log(err);\n });\n return deferred.promise;\n }", "title": "" } ]
[ { "docid": "b06355e887c741f3ef005d5c81edf7f7", "score": "0.5899866", "text": "async function validate(objPedidoConsolidado) \n{\n let performance = logger.start(\"Starting Reserva Stock\"); \n /*\n objPedidoConsolidado.posiciones.forEach(objPedidoConsolidadoPosicion => {\n objPedidoConsolidadoPosicion.unidadesPorAtender = \"0\";\n });\n */\n logger.stop('Completed Reserva Stock', performance); \n\n return objPedidoConsolidado;\n}", "title": "" }, { "docid": "515db3a0acce3ad7cdb5df03000b6ca5", "score": "0.5862319", "text": "function GuardarGestionDiscador(idInteraccion, idcrm, idResultadoGestionExterno) {\n\n\n try {\n\n \n //=========================================================\n // LIMPIAR LOG \n //=========================================================\n LIMPIAR_LOG();\n\n\n //=========================================================\n // DECLARACION DE VARIABLES \n //=========================================================\n var FechaHoraActual_I;\n var FechaHoraActual_F;\n var Calculo;\n\n\n\n //=========================================================\n // COLGAR \n //=========================================================\n ColgarApi(idInteraccion);\n LOG_API(\"GUARDAR GESTION DE LLAMADA...\")\n\n\n //=========================================================\n // ENVIAR UNA PAUSA\n //=========================================================\n FechaHoraActual_I = new Date();\n LOG_API(\"DELAY PAUSA COLGAR...\")\n sleep(200);\n\n FechaHoraActual_F = new Date();\n Calculo = (FechaHoraActual_F - FechaHoraActual_I);\n LOG_API(\"DELAY ESPERA COLGAR MILISEGUNDOS...\" + Calculo)\n\n \n\n\n //=========================================================\n // GUARDAR GESTION \n //=========================================================\n GuardarGestionMitrol(idInteraccion, idcrm, idResultadoGestionExterno);\n\n\n //=========================================================\n // ENVIAR UNA PAUSA\n //=========================================================\n FechaHoraActual_I = new Date();\n LOG_API(\"DELAY PAUSA GUARDAR GESTION...\")\n sleep(200);\n\n FechaHoraActual_F = new Date();\n Calculo = (FechaHoraActual_F - FechaHoraActual_I);\n LOG_API(\"DELAY ESPERA GUARDAR GESTION MILISEGUNDOS...\" + Calculo)\n\n \n\n\n //=========================================================\n // CERRAR \n //=========================================================\n CerrarApi(idInteraccion);\n\n //=========================================================\n // ENVIAR UNA PAUSA\n //=========================================================\n FechaHoraActual_I = new Date();\n LOG_API(\"DELAY PAUSA CERRAR...\")\n sleep(200);\n\n FechaHoraActual_F = new Date();\n Calculo = (FechaHoraActual_F - FechaHoraActual_I);\n LOG_API(\"DELAY ESPERA CERRAR MILISEGUNDOS...\" + Calculo)\n \n\n //=========================================================\n // ESTADO \n //=========================================================\n EstadoIPPAD(1);\n\n\n\n }\n catch (err) {\n \n LOG_API(\"ERROR, \" + err.message);\n }\n\n}", "title": "" }, { "docid": "ef9e7b294e117a3e779abeb98c9b6233", "score": "0.5861243", "text": "addNewReport(month) {\r\n try {\r\n var query = this.ExpenseReportModel.findOne({ month: month });\r\n var request = this.request;\r\n console.log(\"ADD nEW 1 \", month);\r\n query.then(function (expensereport) {\r\n console.log(\"ADD nEW 2\");\r\n if (expensereport) {\r\n console.log(\"ADD nEW 3\");\r\n expensereport.totalexpense = parseInt(expensereport.totalexpense) + parseInt(request.amount);\r\n expensereport.expensedetails.push(request);\r\n console.log(\"ADD nEW 4\");\r\n return expensereport.save();\r\n }\r\n }).then(doc => {\r\n handlers.HandleResponse(doc, this.response);\r\n }).catch(err => { HandleError(err, this.response) });\r\n } catch (e) {\r\n console.log(\"Error \",e);\r\n handlers.HandleInternalError(e, this.response);\r\n }\r\n }", "title": "" }, { "docid": "edd8c544e6a4f3151f2e314da1c6435a", "score": "0.58302283", "text": "function GuardarGestionDiscadorTra(idInteraccion, idcrm, idResultadoGestionExterno,Valor) {\n\n\n try {\n\n\n //=========================================================\n // LIMPIAR LOG \n //=========================================================\n LIMPIAR_LOG();\n LOG_API(\"TRANSFIRIENDO LLAMADA...\")\n\n //=========================================================\n // DECLARACION DE VARIABLES \n //=========================================================\n var FechaHoraActual_I;\n var FechaHoraActual_F;\n var Calculo;\n\n\n \n\n\n //=========================================================\n // GUARDAR GESTION \n //=========================================================\n GuardarGestionMitrol(idInteraccion, idcrm, idResultadoGestionExterno);\n\n\n //=========================================================\n // ENVIAR UNA PAUSA\n //=========================================================\n FechaHoraActual_I = new Date();\n LOG_API(\"DELAY PAUSA GUARDAR GESTION...\")\n sleep(100);\n\n FechaHoraActual_F = new Date();\n Calculo = (FechaHoraActual_F - FechaHoraActual_I);\n LOG_API(\"DELAY ESPERA GUARDAR GESTION MILISEGUNDOS...\" + Calculo)\n\n\n\n\n \n //=========================================================\n // LLAMAR\n //=========================================================\n document.getElementById(\"HF_Id_InteraccionTra\").value = \"0\";\n LlamarApiTra(\"\", \"\", Valor, \"\", \"\");\n\n \n\n\n //=========================================================\n // ONTENER ID INTERACCION \n //=========================================================\n var idInteraccionDestino = document.getElementById(\"HF_Id_InteraccionTra\").value;\n LOG_API(\"idInteraccion :\" + idInteraccion + \" idInteraccionDestino :\" + idInteraccionDestino);\n\n\n //=========================================================\n // TRANSFERENCIA \n //=========================================================\n TransferirAInteraccion(idInteraccion, idInteraccionDestino)\n\n\n //=========================================================\n // ENVIAR UNA PAUSA\n //=========================================================\n FechaHoraActual_I = new Date();\n LOG_API(\"DELAY PAUSA TRANSFERENCIA API...\")\n sleep(100);\n\n FechaHoraActual_F = new Date();\n Calculo = (FechaHoraActual_F - FechaHoraActual_I);\n LOG_API(\"DELAY TRANSFERENCIA MILISEGUNDOS...\" + Calculo)\n\n\n\n }\n catch (err) {\n\n LOG_API(\"ERROR, \" + err.message);\n }\n\n}", "title": "" }, { "docid": "430b414c0070af205860b1ce8d385093", "score": "0.57618856", "text": "async run(events = []){\n\n this.day++;\n\n let runPromise = this._run(events).then(async res=>{\n // if store is defined, then save\n if(this.store){\n try {\n await this.store.details.save({\n _id: this.simulation + \"-day-\" + this.day,\n simulation: this.simulation,\n day: this.day,\n events,\n results: res.reduce((r, v) => {\n let {status, age, final, stats} = v;\n\n // final\n if (final) {\n r.final++;\n }\n // status\n if (!r[status]) {\n r[status] = 1;\n } else {\n r[status]++;\n }\n\n r.age += age / res.length;\n\n // stats\n Object.keys(stats).forEach(e => {\n if (!r.stats) {\n r.stats = {};\n }\n if (!r.stats[e]) {\n r.stats[e] = 0;\n }\n r.stats[e] += stats[e].level / res.length;\n });\n\n return r;\n }, {final: 0, age: 0})\n });\n }catch (err){\n console.error(\"Error saving agents' day\",err);\n }\n }\n\n return res;\n }).catch(err=>console.error(\"Error run\",err));\n\n return Promise.allSettled([\n // wait for the clock to finish\n this._tillTomorrow(),\n runPromise\n ]).then(async res=>{\n let summary = res.reduce((p,{status,value})=>{\n if(status !== \"fulfilled\"){return p;}\n if(value === \"tomorrow\"){return p;}\n return value;\n });\n if(!summary){\n throw new Error(\"Error: no summary of the day\");\n }\n // console.log(\"summary\",summary);\n return summary;\n })\n\n }", "title": "" }, { "docid": "aafc0136d981fa7703e8f1ba67eca4f7", "score": "0.5631756", "text": "async Salvar ( { request } ) {\n var data = await request.raw();\n data = JSON.parse(data)\n\n var Periodos = data.listadeHorarios; \n var Codigo = data.codigo;\n \n try{\n if (await DwSession.validarToken(data[\"token\"])){ \n if(!Boolean(Codigo)) { \n var codJornada = await numSeqJornada.consulta();\n \n await Database.table('jornada')\n .insert({\n \"CodJornada\":codJornada,\n \"Nome\":data.nome, \n \"DataInicio\":\"2020-03-22 00:00:00\", \n \"TipoEscala\": 1, \n \"Historica\": 0, \n \"CargaHoraria\": 0\n })\n\n await numSeqJornada.atualiza();\n\n \n var IdLinha = await numSeqLista.consulta()+1;\n\n var LinhasJornada = Periodos.map((prop, key) => {\n if(prop === 0) Periodos[key] = 1\n return {\n \"CodLinhaJornada\":IdLinha+key,\n \"CodJornada\":codJornada === 0 ? 1 : codJornada, \n \"Dia\":key+1, \n \"TipoDia\": prop === 0 ? 5 : 1, \n \"CodHorario\": prop === 0 ? 1 : prop, \n }\n })\n\n await Database.table('linhajornada')\n .insert(LinhasJornada)\n \n await numSeqLista.atualiza() \n \n\n } \n else{\n await Database.table('jornada')\n .where(\"CodJornada\", Codigo)\n .update({\"Nome\":data.nome})\n\n await Database.table('linhajornada')\n .where(\"CodJornada\", '=', Codigo)\n .delete()\n\n var IdLinha = await numSeqLista.consulta()+1;\n\n var LinhasJornada = {};\n\n LinhasJornada = Periodos.map((prop, key) => { \n if(prop != null){\n return ({\n \"CodLinhaJornada\":IdLinha+key,\n \"CodJornada\":Codigo, \n \"Dia\":key+1, \n \"TipoDia\": prop == 0 ? 5 : 1, \n \"CodHorario\": prop == 0 ? 1 : prop, \n }) \n }\n\n })\n\n await Database.table('linhajornada')\n .insert(LinhasJornada)\n \n await numSeqLista.atualiza() \n }\n\n var reposta ={\n retorno: true, \n }\n }\n }\n catch(error){\n var reposta ={\n error: error.message,\n retorno: false, \n }\n } \n return JSON.stringify(reposta); \n }", "title": "" }, { "docid": "20b101a2aedd736d6a3c9ada9d341380", "score": "0.5574809", "text": "function guardarReservas() {\n\n pool.collection(\"Reservas\").add({\n fecha: fecha.value,\n hora: hora.value,\n comensales: comensales.value,\n nombre: nombre.value,\n correo: correo.value,\n numeroT: numeroT.value,\n mensaje: mensaje.value\n \n\n })\n .then(function(docRef) {\n console.log(\"Documento guardado: \", docRef.id);\n listarReservas();\n })\n .catch(function(error) {\n console.error(\"Error: \", error);\n });\n console.log(guardarReservas);\n\n}", "title": "" }, { "docid": "d6ea03532c7fd2eaba90164f5eef79e6", "score": "0.5556673", "text": "function registrarEstudiante() {\n\t\t\t\tvar name = document.getElementById(\"account\").value;\n\t\t\t\tvar password = document.getElementById(\"pss\").value;\n\t\t\t\tvar accountStudent;\n\n\t\t\t\tswitch (environment) {\n\t\t\t\t\tcase TESTNET:\n\t\t\t\t\t\taccountStudent = web3.eth.personal.newAccount(password).then(console.log);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault: //En este caso tirará de Ganache y Alastria\n\t\t\t\t\t\taccountStudent = accounts[indexAccount];\n\t\t\t\t\t\tindexAccount += 1;\n\t\t\t\t\t\tlocalStorage.setItem('indexAccount', indexAccount);\n\t\t\t\t}\n\n\t\t\t\tlocalStorage.setItem('accountStudent', accountStudent);\n\t\t\t\tlocalStorage.setItem('pps', password);\n\n\t\t\t\t//Desbloqueamos la cuenta\n\t\t\t\treturn web3.eth.personal.unlockAccount(accountStudent, password, 100)\n\t\t\t\t\t.then(function () {\n\t\t\t\t\t\tconsole.log('Cuenta desbloqueada!');\n\t\t\t\t\t\t//Desplegamos un nuevo SC de Student\n\t\t\t\t\t\tlet SCStudent;\n\t\t\t\t\t\treturn deployContract('Student', accountStudent, ABI_Student, DATA_Student,\n\t\t\t\t\t\t\t[name]).then(v => {\n\t\t\t\t\t\t\t\tSCStudent = v;\n\t\t\t\t\t\t\t\taccountSCStudent = SCStudent._address;\n\t\t\t\t\t\t\t\tlocalStorage.setItem('accountSCStudent', accountSCStudent);\n\t\t\t\t\t\t\t\tconsole.log(`Desplegado el smart contract para el estudiante: ${accountSCStudent}`);\n\n\t\t\t\t\t\t\t\t//Llamamos a la plataforma para registrar al estudiante\n\t\t\t\t\t\t\t\treturn SCPlataforma.methods.registerStudent(accountStudent, accountSCStudent).send({\n\t\t\t\t\t\t\t\t\tgas: 3000000,\n\t\t\t\t\t\t\t\t\tfrom: accountPlataforma\n\t\t\t\t\t\t\t\t}).on('receipt', function (receipt) {\n\t\t\t\t\t\t\t\t\tconsole.log(`Registrado estudiante ${name} con cuenta ${accountStudent} y smartcontract asociado ${accountSCStudent}`);\n\t\t\t\t\t\t\t\t\tconsole.log(receipt);\n\t\t\t\t\t\t\t\t}).on('error', function (error, receipt) { // If the transaction was rejected by the network with a receipt, the second parameter will be the receipt.\n\t\t\t\t\t\t\t\t\tconsole.error(\"ERROR CREANDO AL ESTUDIANTE\");\n\t\t\t\t\t\t\t\t\tconsole.error(\"Error: \" + error);\n\t\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t\t}).then(function () {\n\t\t\t\t\t\t\t\t\t//Bloqueamos nuevamente la cuenta\n\t\t\t\t\t\t\t\t\tcloseStudentSession();\n\t\t\t\t\t\t\t\t\treturn [accountStudent, password];\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t}).catch(err => {\n\t\t\t\t\t\t//Bloqueamos nuevamente la cuenta\n\t\t\t\t\t\tcloseStudentSession();\n\t\t\t\t\t\tconsole.error(\"ERROR REGISTERSTUDENT:\" + err);\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t});\n\t\t\t}", "title": "" }, { "docid": "66d340b160aad9ce94e8d0abb572e1e8", "score": "0.5554113", "text": "async AgregarEntradaResi (context, values) {\n const result = await controller.AddIngresoResi(values)\n if (result.data) {\n // console.log(values)\n // console.log(result)\n context.commit('AddIngResidentUpdated', values)\n } else {\n alert('No se ha podido actualizar el dato a la base: ')\n console.error('Error al subir el dato a la base : ', result.error)\n }\n }", "title": "" }, { "docid": "ef1569e4007d639fbe8f2acf6c5f4504", "score": "0.5520949", "text": "function emitirTokens(){\n var cantidad = document.getElementById(\"cantidadTokens\").value;\n var address_to = document.getElementById(\"empleadoReceptor\").value;\n var address_from = localStorage.getItem(\"accountEmpresa\");\n\n \tvar saldo = plataforma.balanceOf.call(address_from, {from: address_from, gas:30000});\n\t\tconsole.log(\"Vigilando tu saldo. Tienes \" + saldo + \" e intentas transferir \" + cantidad);\n \tif(parseInt(saldo) < cantidad){\n \t\talert(\"¡Vaya! No tienes suficientes tokens\");\n \t}else{\n \t\tplataforma.emitirTokens.sendTransaction(address_to, cantidad, {from: address_from, gas:200000},\n \t\t\tfunction (error,result){\n \t\t\t\tif (!error){\n \t\t\t\t\tvar event = plataforma.TokensEmitidos({},{fromBlock:'latest', toBlock:'latest'},\n \t\t\t\t\t\tfunction(error, result){\n \t\t\t\t\t\t\tif (!error){\n \t\t\t\t\t\t\t\tvar msg = \"OK! La empresa \" + result.args._from + \" ha emitido \" + result.args._n + \" tokens al empleado \" + result.args._to;\n \t\t\t\t\t\t imprimir(msg);\n \t\t\t\t\t\t\t}else{\n \t\t\t\t\t\t\t\tconsole.log(\"Error\" + error);\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t});\n \t\t\t\t} else {\n \t\t\t\t\tconsole.error(\"Error\" + error);\n \t\t\t\t}\n \t\t\t}\n \t\t);\n \t}\n }", "title": "" }, { "docid": "f44ea9ad1b1ffe8de6dc884029f71f4d", "score": "0.5399539", "text": "function obtiene_semanas() {\n\tvar par = `[{\"fechaini\":\"${fechaInic}\", \"fechaFin\":\"${fechaFinl}\"}]`;\n\tobtiene_datos('listaSemanas', pone_periodos, par);\n}", "title": "" }, { "docid": "6b8040a45723e20f46f705a2da0cf3b4", "score": "0.53455484", "text": "function createPharms(name, origin, destination){\n\n // var x = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate());\n //x = new Date(x.getTime()+departureTimeHour*60*60*1000+departureTimeMinute*60*1000); // + );\n\n let pharms = [];\n const bnDef = bnUtil.connection.getBusinessNetwork();\n const factory = bnDef.getFactory();\n\n var ctr = 0 ;\n const iterations = 4;\n for(var i=0; i < iterations; i++){\n // Flight scheduled every 3rd day starting from today\n //let sched = new Date(x.getTime()+(i+1)*frequency*24*60*60*1000);\n \n let transaction = factory.newTransaction(pharmaNamespace,transactionType);\n transaction.setPropertyValue('Name',name);\n transaction.setPropertyValue('Origin', origin);\n transaction.setPropertyValue('Destination' , destination);\n transaction.setPropertyValue('Schedule' , sched);\n pharms.push(transaction);\n bnUtil.connection.submitTransaction(transaction).then(()=>{\n console.log('Added Pharma : ',name,ctr);\n ctr++;\n }).catch((error)=>{\n console.log(error);\n bnUtil.connection.disconnect();\n })\n }\n}", "title": "" }, { "docid": "9664536b50338da87432056ff15811a2", "score": "0.5311275", "text": "registrarMantenimiento() {\n if (!this.editando) {\n const f = new Date();\n const fecha_actual = f.getFullYear() + \"-\" + (f.getMonth() + 1) + \"-\" + f.getDate();\n\n this.mantenimiento.fecha = fecha_actual;\n this.mantenimiento.trabajos_realizados = \"Ninguno\"\n this.mantenimiento.horas_invertidas = 0;\n const token = this.token\n axios.post(URL + \"mantenimientos\", this.mantenimiento, { headers: { token } }).then(res => {\n axios.put(URL + \"actualizarEstadoMoto/\" + this.mantenimiento.placa, { estado: \"En mantenimiento\" }, { headers: { token } }).then(res => {\n console.log(res);\n alert(\"Mantenimiento registrado\")\n this.recargarPagina();\n }).catch(error => {\n console.log(error.response.data.detail);\n });\n console.log(res);\n }).catch(error => {\n alert(\"El mantenimiento de esta moto ya ha sido asignado aa este mecánico\")\n });\n\n }\n }", "title": "" }, { "docid": "a30d55eff5b8efa401ae749fbce21eb3", "score": "0.5308822", "text": "function processExecutor(movimientos, errcb, cb){\n console.log('PRCESS EXECUTOR BEGIN ********* [%s]', movimientos && movimientos.length);\n let today = new Date();\n let outerCount = 0;\n let shoudBeAltaCount = 0;\n let notCovidCount = 0;\n\n let contador = {\n noconfirmado: 0,\n laboratorio: 0,\n nexo: 0,\n clinica: 0,\n descartado: 0,\n }\n\n movimientos.forEach(asis => {\n //if(outerCount > 500 ) return;\n \n let infection = asis.infeccion;\n if(infection){\n reviewInfection(asis, infection);\n processInfection(asis, infection);\n\n if(shouldBeAltaEpidemiologica(asis, infection, today)) {\n shoudBeAltaCount += 1;\n let report = `TIENE CONDICIONES DE ALTA: ${asis.ndoc}: ${infection.mdiagnostico} actualState: ${infection.actualState} avance: ${infection.avance} `;\n console.log(report);\n }\n\n updateAsisprevencionInfection(asis, infection);\n contador[infection.mdiagnostico] += 1;\n outerCount += 1;\n\n }else {\n notCovidCount += 1;\n }\n\n });\n\n console.log('PROCESO CONCLUIDO: [%s]', outerCount);\n console.log('No procesados: [%s]', notCovidCount);\n console.log('En condiciones de ALTA EPIDEMIOL: [%s]', shoudBeAltaCount);\n console.dir(contador);\n}", "title": "" }, { "docid": "25fb7d225f6ec7b7bf2fdbc73d263bf0", "score": "0.52952", "text": "function canjearTokensVacaciones(){\n var address_from = document.getElementById(\"addressEmpleado\").innerHTML;\n\tvar saldo = plataforma.balanceOf.call(address_from, {from: address_from, gas:30000});\n\tconsole.log(\"Vigilando tu saldo. Tienes \" + saldo + \" e intentas transferir 10\");\n\tif(parseInt(saldo) < 10){\n\t\talert(\"¡Vaya! No tienes suficientes tokens\");\n\t}else{\n\t\tplataforma.canjearTokens.sendTransaction(10, {from: address_from, gas:200000},\n\t\t\tfunction (error,result){\n\t\t\t\t\tif (!error){\n\t\t\t\t\t\tvar event = plataforma.TokensEmitidos({},{fromBlock:'latest', toBlock:'latest'},\n\t\t\t\t\t\t\tfunction(error, result){\n\t\t\t\t\t\t\t\tif (!error){\n\t\t\t\t\t\t\t \t\timprimir(\"OK! El empleado \" + result.args._from + \" ha canjeado 10 tokens a cambio de un dia de vacaciones\");\n\t\t\t\t\t\t\t\t\tvar nuevoSaldo = plataforma.balanceOf.call(address_from, {from: address_from, gas:30000});\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tokensEmpleado\").innerHTML = nuevoSaldo;\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\tconsole.log(\"Error\" + error);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.error(\"Error\" + error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t }\n }", "title": "" }, { "docid": "d3536fa4f5b45e507a6eddd7da27ad47", "score": "0.52930915", "text": "function consultarSaldo(){\n\t\tvar cuentaEmpresa = localStorage.getItem(\"accountEmpresa\");\n\t\tvar saldo = plataforma.balanceOf.call(cuentaEmpresa, {from: cuentaEmpresa, gas:30000});\n\t\tvar msg = \"Ok! Se ha procesado tu consulta. Tu saldo en tokens (GPI): \" + saldo;\n\t\timprimir(msg);\n\t}", "title": "" }, { "docid": "d41101f179e1d81ba61950d04045812c", "score": "0.5285571", "text": "function ExecLlamar(llamada,ent){\n var name=llamada.Id+\"$\"\n var resul=[]\n for(var params of llamada.Param){\n var val=evaluar(params,ent)\n \n resul.push(val)\n }\n var temporal=ent\n var simbol=null\n while(temporal!=null){\n if(temporal.Simbolos.has(name)){\n simbol=temporal.Simbolos.get(name)\n break\n }\n temporal=temporal.anterior\n }\n if(!simbol){\n console.log(\"No se encontro la funcion: \",llamada.Id,\" con los parametros indicados\")\n errores+=\"No se encontro la funcion: \",llamada.Id,\" con los parametros indicados\\n\"\n return NuevoSimbolo(\"@error@\",\"error\")\n }\n pilaFun.push(llamada.Id)\n var nuevito=Entorno(Global)\n var indice=0\n for(var creacion of simbol.Param){\n creacion.Exp=resul[indice]\n ExecCrear(creacion,nuevito)\n indice++\n }\n var retorno=NuevoSimbolo(\"@error@\",\"error\")\n var result=EjectBloque(simbol.Area,nuevito)\n if(result){\n if(result.Tipo==\"void\"){\n if(simbol.Tipo!=\"void\"){\n console.log(\"No se espera un retorno\")\n errores+=\"No se espera un retorno\"\n \n }else{\n retorno=NuevoSimbolo(\"@void@\",\"void\")\n\n }\n }else{\n var expresion=evaluar(result,nuevito)\n if(expresion.Tipo!=simbol.Tipo){\n console.log(\"El tipo a retornar no coindice con el indicado\")\n errores+=\"El tipo a retornar no coindice con el indicado\\n\"\n retorno=NuevoSimbolo(\"@error@\",\"error\")\n }else{\n retorno=expresion\n }\n }\n }else{\n if(simbol.Tipo!=\"void\"){\n console.log(\"Se espera algo a retornar\")\n errores+=\"Se espera algo a retornar\\n\"\n retorno=NuevoSimbolo(\"@error@\",\"error\")\n\n }else{\n retorno=NuevoSimbolo(\"@void@\",\"void\")\n }\n }\n pilaFun.pop()\n return retorno\n }", "title": "" }, { "docid": "e54f7f49f54a29bdb15cdbbd63dd2248", "score": "0.5250876", "text": "importaNegociacoes() {\n\n //O Promise é assincrono, então a ordem de execução dos métodos se perdem.\n //Para contornar este problema é utilizado o Promise.all() que recebe como parâmetro\n //uma lista de promises e a execução é realizada na ordem em que foram colocados,\n //além disso, os erros dos métodos são tratados em apenas um lugar, no 'catch'\n let service = new NegociacaoServicePromise();\n \n service.obterNegociacoes()\n .then(negociacoes => {\n\n negociacoes.forEach(negociacao => this._listaNegociacoes.adiciona(negociacao));\n\n this._mensagem.texto = 'Negociações importadas com sucesso!';\n })\n .catch(erro => this._mensagem.texto = erro);\n\n //Removendo a responsabilidade da classe em tratar o Promisse.all e passando para a classe de serviço\n // Promise\n // .all([service.obterNegociacoesDaSemana(), \n // service.obterNegociacoesDaSemanaAnterior(), \n // service.obterNegociacoesDaSemanaRetrasada()])\n // .then(negociacoes => {\n // negociacoes\n // //Negociacoes é um array de 2 dimensões. Para transforma-lo em um array\n // //de uma dimensão pode-se usar o método reduce. Depois um forEach para adicionar\n // //as negociacoes\n // .reduce((compacto, array) => compacto.concat(array), [])\n // .forEach(negociacao => this._listaNegociacoes.adiciona(negociacao));\n\n // this._mensagem.texto = 'Negociações importadas com sucesso!';\n // })\n // .catch(erro => this._mensagem.texto = erro);\n \n\n\n //Utilizaçaõ do padrão de projeto Promise do ES6.\n //Para o ES5 utilizar o CALLBACK\n // let service = new NegociacaoServicePromise();\n\n // service.obterNegociacoesDaSemana()\n // .then(negociacoes => {\n // negociacoes.forEach(negociacao => {\n \n // this._listaNegociacoes.adiciona(negociacao);\n // });\n\n // this._mensagem.texto = 'Negociações importadas com sucesso!';\n // })\n // .catch(erro => this._mensagem.texto = erro);\n\n // service.obterNegociacoesDaSemanaAnterior()\n // .then(negociacoes => {\n // negociacoes.forEach(negociacao => {\n \n // this._listaNegociacoes.adiciona(negociacao);\n // });\n\n // this._mensagem.texto = 'Negociações importadas com sucesso!';\n // })\n // .catch(erro => this._mensagem.texto = erro); \n\n // service.obterNegociacoesDaSemanaRetrasada()\n // .then(negociacoes => {\n // negociacoes.forEach(negociacao => {\n \n // this._listaNegociacoes.adiciona(negociacao);\n // });\n\n // this._mensagem.texto = 'Negociações importadas com sucesso!';\n // })\n // .catch(erro => this._mensagem.texto = erro);\n\n\n //let service = new NegociacaoServicePro();\n\n /*//Utilizando a estratégia do Error-First (primeiro parâmetro é o erro)\n service.obterNegociacoesDaSemana((erro, negociacoes) => {\n\n if(erro) {\n\n this._mensagem.texto = erro;\n return;\n }\n\n negociacoes.forEach(negociacao => {\n\n this._listaNegociacoes.adiciona(negociacao);\n });\n\n\n //Aqui iriam vir as chamadas dos métodos 'obterNegociacoesDaSemanaAnterior' e 'obterNegociacoesDaSemanaRetrasada'\n //de forma aninhado pois são requisições assincronas, matendo então a ordem de obtençao dos dados.\n //O problema de ficar chamando esses métodos dentro de métodos (para fuções assincronas) é chamado de\n //Callback Hell: 'Ocorre quando temos requisições assíncronas executadas em determinada ordem, que chama vários callbacks seguidos.'\n //A estrutura de código fica parecendo uma pirâmide e é chamada de Pyramid of Doom.\n service.obterNegociacoesDaSemanaAnterior((erro, negociacoes) => {\n\n if(erro) {\n \n this._mensagem.texto = erro;\n return;\n }\n \n negociacoes.forEach(negociacao => {\n \n this._listaNegociacoes.adiciona(negociacao);\n });\n\n service.obterNegociacoesDaSemanaRetrasada((erro, negociacoes) => {\n\n if(erro) {\n \n this._mensagem.texto = erro;\n return;\n }\n \n negociacoes.forEach(negociacao => {\n \n this._listaNegociacoes.adiciona(negociacao);\n });\n\n this._mensagem.texto = 'Negociações importadas com sucesso';\n \n });\n }); \n });*/\n }", "title": "" }, { "docid": "216c46431fe8a18bf83576d3dbcded41", "score": "0.52220345", "text": "static save(alunos) {\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n if (failSave > 1) {\n window.localStorage.setItem(\"alunos\", JSON.stringify(alunos));\n resolve();\n } else {\n reject();\n failSave++;\n }\n }, 2000);\n\n });\n }", "title": "" }, { "docid": "afaf904f0d91cca2681f65656f964716", "score": "0.5208975", "text": "function writeToServices(id) {\n var pCompany, pAccount, pActivity;\n var p, item, coll;\n\n // start by getting the current onboarding rec\n p = component({name:'onboarding',action:'item',id:id});\n p.then(function(coll) {\n item = coll[0]||{};\n \n // define company write\n pCompany = new Promise(function(resolve,reject) {\n var params = {\n host: \"localhost\",\n port: 8484,\n method: \"POST\",\n path: \"/\",\n headers: {\"content-type\" : \"application/json\"}\n }; \n var body = {\n id : item.companyId||\"\",\n companyName : item.companyName||\"\",\n email : item.email||\"\",\n streetAddress : item.streetAddress||\"\",\n city : item.city||\"\",\n stateProvince : item.stateProvince||\"\",\n postalCode : item.postalCode||\"\",\n country : item.country||\"\",\n telephone : item.telephone||\"\",\n status : \"active\"\n }\n // commit the write\n utils.httpRequest(params,JSON.stringify(body));\n });\n\n // define account write \n pAccount = new Promise(function(resolve,reject) {\n var params = {\n port: 8282,\n host: \"localhost\",\n method: \"POST\",\n path: \"/\",\n headers: {\"content-type\" : \"application/json\"}\n }; \n var body = {\n id : item.accountId||\"\",\n companyId : item.companyId||\"\",\n division : item.division||\"\",\n spendingLimit : item.spendingLimit||\"\",\n discountPercentage : item.discountPercentage||\"\",\n status : \"active\"\n };\n // commit the write\n utils.httpRequest(params, JSON.stringify(body));\n });\n\n // define activity write\n pActivity = new Promise(function(resolve,reject) {\n var params = {\n port: 8686,\n host: \"localhost\",\n method: \"POST\",\n path: \"/\",\n headers: {\"content-type\" : \"application/json\"}\n }; \n var body = {\n companyId : item.companyId||\"\",\n accountId : item.accountId||\"\",\n activityType : item.activityType||\"\",\n dateScheduled : item.dateScheduled||\"\",\n notes : item.notes||\"\",\n status : \"active\"\n };\n // commit the write\n utils.httpRequest(params, JSON.stringify(body));\n });\n\n // execute the requests in parallel\n return Promise.all([pCompany, pAccount, pActivity]);\n });\n\n}", "title": "" }, { "docid": "1c93b312a86eebffa82ea2b18fde1b3d", "score": "0.5199794", "text": "function enregistreElemCom(x, commande) {\r\n console.log(commande);\r\n var boissons=commande.commande.boissons;\r\n var plats =commande.commande.plats;\r\n console.log(boissons);\r\n console.log(plats);\r\n\r\n for(var i in boissons)\r\n {\r\n var recordBoissons = {IdBoisson: boissons[i][\"Id\"]+'',IdVente: x , Quantite: boissons[i][\"Quantite\"]};\r\n mySqlClient.query('INSERT INTO pronto.boissons_ventes SET ?', recordBoissons, function (err, res) {\r\n if (err) throw err;\r\n\r\n console.log('enregistrement boisson OK');\r\n });\r\n }\r\n\r\n for(var j in plats)\r\n {\r\n var recordPlats = {IdVente: x, IdPlat: plats[j][\"Id\"], Quantite: plats[j][\"Quantite\"]};\r\n mySqlClient.query('INSERT INTO pronto.plats_ventes SET ?', recordPlats, function (err, res) {\r\n if (err) throw err;\r\n\r\n console.log('enregistrement plat OK');\r\n });\r\n\r\n }\r\n\r\n\r\n //deleteRecord(commande.idCommande);\r\n}", "title": "" }, { "docid": "477863ca62952987bcd55f30f65cd783", "score": "0.51864034", "text": "async salva_carregamento_sqlite({ ID, Unidade, Placa, Dia, Prioridade }){\n\n const Atualizado = module.exports.agora();\n\n // Procura um item igual no sqlite\n const db_caminhao = await connection('fCarregamento')\n .select('*')\n .where(\"ID\",\"=\", ID );\n\n // Se não existir esses caminhões no sqlite ainda, criar um novo\n if ( db_caminhao.length === 0 ) {\n\n await connection('fCarregamento')\n .insert({\n ID,\n Placa,\n Dia,\n Prioridade,\n Status: 'Aguardando chegada do veículo',\n Assinaturas: JSON.stringify([]),\n Unidade,\n Atualizado,\n });\n\n // Caso seja a primeira aparição dessa caminhão, inserir seu status na tabela de status\n module.exports.on_status_change({\n ID,\n Status: 'Aguardando chegada do veículo',\n Unidade,\n Placa,\n Dia,\n });\n\n };\n }", "title": "" }, { "docid": "81b3ad964d4306893713d4e21702d898", "score": "0.5179753", "text": "function guardarAdeudo(){\n $('.loader-back').show();\n var fecha = $('#fecha').val()\n var fecha_vencimiento = $('#fecha_vencimiento').val()\n var monto = $('#monto').val()\n var concepto = $('#concepto').val()\n if($('#clasificacion').val() == 'otro'){\n var clasificacion = $('#clasificacion-otro').val()\n }else{\n var clasificacion = $('#clasificacion').val()\n }\n if($('#destino').val() == 'otro'){\n var destino = $('#destino-otro').val()\n }else{\n var destino = $('#destino').val()\n }\n estado_cuenta.push({\n fecha: fecha,\n fecha_vencimiento: fecha_vencimiento,\n cargo : monto,\n concepto : concepto,\n clasificacion : clasificacion,\n destino : destino,\n status : 'Adeudo pendiente',\n tipo : 'Adeudo'\n }) \n $('#adeudo-form').hide()\n cargarDatosCuenta()\n M.toast({html: 'Adeudo registrado!', classes: 'rounded'}); \n}", "title": "" }, { "docid": "1098458c6bafa9ef9487de2b16be4ece", "score": "0.5178412", "text": "GuardarPlanContable(req, res) {\n return __awaiter(this, void 0, void 0, function* () {\n var planContable = new planContable_model_1.PlanContableModel();\n var body = req.body;\n planContable.Id_PlanContable = null;\n planContable.Codigo_PlanCuenta = body.Codigo_PlanCuenta;\n planContable.Nombre_PlanCuenta = body.Nombre_PlanCuenta;\n planContable.DebeApertura = body.DebeApertura;\n planContable.HaberApertura = body.HaberApertura;\n planContable.DebeMovimientoAnual = body.DebeMovimientoAnual;\n planContable.HaberMovimientoAnual = body.HaberMovimientoAnual;\n planContable.DeudorSaldos = body.DeudorSaldos;\n planContable.AcreedorSaldos = body.AcreedorSaldos;\n planContable.DeudorSaldosAjustados = body.DeudorSaldosAjustados;\n planContable.AcreedorSaldosAjustados = body.AcreedorSaldosAjustados;\n planContable.ActivoBG = body.ActivoBG;\n planContable.PasivoBG = body.PasivoBG;\n planContable.PerdidaFuncion = body.PerdidaFuncion;\n planContable.GananciaFuncion = body.GananciaFuncion;\n planContable.PerdidaNaturaleza = body.PerdidaNaturaleza;\n planContable.GananciaNaturaleza = body.GananciaNaturaleza;\n planContable.Movimiento = body.Movimiento;\n planContable.CuentaActiva = body.CuentaActiva;\n planContable.Codigo_Proyecto = body.Codigo_Proyecto;\n planContable.Ano = body.Ano;\n yield database_1.default.query('INSERT INTO PlanContable set ?', planContable, (err, resp) => {\n if (err) {\n return res.status(400).json({\n ok: false,\n mensaje: 'Error al crear Auxiliar',\n errors: err,\n });\n }\n planContable.Id_PlanContable = resp.insertId;\n res.status(201).json({\n ok: true,\n PlanContable: planContable,\n });\n });\n });\n }", "title": "" }, { "docid": "fbe2b3ef89f5bc18fb32257f60185f07", "score": "0.5166686", "text": "flush() {\n this._alarms = [];\n this.saveData();\n }", "title": "" }, { "docid": "40618963efed97d10d5d5c0d8a84409d", "score": "0.5156899", "text": "function saveEntireAmtState2() {\r\n console.log('Fetching all Intel AMT state, this may take a few minutes...');\r\n var transport = require('amt-wsman-duk');\r\n var wsman = require('amt-wsman');\r\n var amt = require('amt');\r\n wsstack = new wsman(transport, settings.hostname, settings.tls ? 16993 : 16992, settings.username, settings.password, settings.tls);\r\n amtstack = new amt(wsstack);\r\n amtstack.onProcessChanged = onWsmanProcessChanged;\r\n //var AllWsman = \"AMT_GeneralSystemDefenseCapabilities\".split(',');\r\n var AllWsman = \"AMT_8021xCredentialContext,AMT_8021XProfile,AMT_ActiveFilterStatistics,AMT_AgentPresenceCapabilities,AMT_AgentPresenceInterfacePolicy,AMT_AgentPresenceService,AMT_AgentPresenceWatchdog,AMT_AgentPresenceWatchdogAction,AMT_AlarmClockService,IPS_AlarmClockOccurrence,AMT_AssetTable,AMT_AssetTableService,AMT_AuditLog,AMT_AuditPolicyRule,AMT_AuthorizationService,AMT_BootCapabilities,AMT_BootSettingData,AMT_ComplexFilterEntryBase,AMT_CRL,AMT_CryptographicCapabilities,AMT_EACCredentialContext,AMT_EndpointAccessControlService,AMT_EnvironmentDetectionInterfacePolicy,AMT_EnvironmentDetectionSettingData,AMT_EthernetPortSettings,AMT_EventLogEntry,AMT_EventManagerService,AMT_EventSubscriber,AMT_FilterEntryBase,AMT_FilterInSystemDefensePolicy,AMT_GeneralSettings,AMT_GeneralSystemDefenseCapabilities,AMT_Hdr8021Filter,AMT_HeuristicPacketFilterInterfacePolicy,AMT_HeuristicPacketFilterSettings,AMT_HeuristicPacketFilterStatistics,AMT_InterfacePolicy,AMT_IPHeadersFilter,AMT_KerberosSettingData,AMT_ManagementPresenceRemoteSAP,AMT_MessageLog,AMT_MPSUsernamePassword,AMT_NetworkFilter,AMT_NetworkPortDefaultSystemDefensePolicy,AMT_NetworkPortSystemDefenseCapabilities,AMT_NetworkPortSystemDefensePolicy,AMT_PCIDevice,AMT_PETCapabilities,AMT_PETFilterForTarget,AMT_PETFilterSetting,AMT_ProvisioningCertificateHash,AMT_PublicKeyCertificate,AMT_PublicKeyManagementCapabilities,AMT_PublicKeyManagementService,AMT_PublicPrivateKeyPair,AMT_RedirectionService,AMT_RemoteAccessCapabilities,AMT_RemoteAccessCredentialContext,AMT_RemoteAccessPolicyAppliesToMPS,AMT_RemoteAccessPolicyRule,AMT_RemoteAccessService,AMT_SetupAndConfigurationService,AMT_SNMPEventSubscriber,AMT_StateTransitionCondition,AMT_SystemDefensePolicy,AMT_SystemDefensePolicyInService,AMT_SystemDefenseService,AMT_SystemPowerScheme,AMT_ThirdPartyDataStorageAdministrationService,AMT_ThirdPartyDataStorageService,AMT_TimeSynchronizationService,AMT_TLSCredentialContext,AMT_TLSProtocolEndpoint,AMT_TLSProtocolEndpointCollection,AMT_TLSSettingData,AMT_TrapTargetForService,AMT_UserInitiatedConnectionService,AMT_WebUIService,AMT_WiFiPortConfigurationService,CIM_AbstractIndicationSubscription,CIM_Account,CIM_AccountManagementCapabilities,CIM_AccountManagementService,CIM_AccountOnSystem,CIM_AdminDomain,CIM_AlertIndication,CIM_AssignedIdentity,CIM_AssociatedPowerManagementService,CIM_AuthenticationService,CIM_AuthorizationService,CIM_BIOSElement,CIM_BIOSFeature,CIM_BIOSFeatureBIOSElements,CIM_BootConfigSetting,CIM_BootService,CIM_BootSettingData,CIM_BootSourceSetting,CIM_Capabilities,CIM_Card,CIM_Chassis,CIM_Chip,CIM_Collection,CIM_Component,CIM_ComputerSystem,CIM_ComputerSystemPackage,CIM_ConcreteComponent,CIM_ConcreteDependency,CIM_Controller,CIM_CoolingDevice,CIM_Credential,CIM_CredentialContext,CIM_CredentialManagementService,CIM_Dependency,CIM_DeviceSAPImplementation,CIM_ElementCapabilities,CIM_ElementConformsToProfile,CIM_ElementLocation,CIM_ElementSettingData,CIM_ElementSoftwareIdentity,CIM_ElementStatisticalData,CIM_EnabledLogicalElement,CIM_EnabledLogicalElementCapabilities,CIM_EthernetPort,CIM_Fan,CIM_FilterCollection,CIM_FilterCollectionSubscription,CIM_HostedAccessPoint,CIM_HostedDependency,CIM_HostedService,CIM_Identity,CIM_IEEE8021xCapabilities,CIM_IEEE8021xSettings,CIM_Indication,CIM_IndicationService,CIM_InstalledSoftwareIdentity,CIM_KVMRedirectionSAP,CIM_LANEndpoint,CIM_ListenerDestination,CIM_ListenerDestinationWSManagement,CIM_Location,CIM_Log,CIM_LogEntry,CIM_LogicalDevice,CIM_LogicalElement,CIM_LogicalPort,CIM_LogicalPortCapabilities,CIM_LogManagesRecord,CIM_ManagedCredential,CIM_ManagedElement,CIM_ManagedSystemElement,CIM_MediaAccessDevice,CIM_MemberOfCollection,CIM_Memory,CIM_MessageLog,CIM_NetworkPort,CIM_NetworkPortCapabilities,CIM_NetworkPortConfigurationService,CIM_OrderedComponent,CIM_OwningCollectionElement,CIM_OwningJobElement,CIM_PCIController,CIM_PhysicalComponent,CIM_PhysicalElement,CIM_PhysicalElementLocation,CIM_PhysicalFrame,CIM_PhysicalMemory,CIM_PhysicalPackage,CIM_Policy,CIM_PolicyAction,CIM_PolicyCondition,CIM_PolicyInSystem,CIM_PolicyRule,CIM_PolicyRuleInSystem,CIM_PolicySet,CIM_PolicySetAppliesToElement,CIM_PolicySetInSystem,CIM_PowerManagementCapabilities,CIM_PowerManagementService,CIM_PowerSupply,CIM_Privilege,CIM_PrivilegeManagementCapabilities,CIM_PrivilegeManagementService,CIM_ProcessIndication,CIM_Processor,CIM_ProtocolEndpoint,CIM_ProvidesServiceToElement,CIM_Realizes,CIM_RecordForLog,CIM_RecordLog,CIM_RedirectionService,CIM_ReferencedProfile,CIM_RegisteredProfile,CIM_RemoteAccessAvailableToElement,CIM_RemoteIdentity,CIM_RemotePort,CIM_RemoteServiceAccessPoint,CIM_Role,CIM_RoleBasedAuthorizationService,CIM_RoleBasedManagementCapabilities,CIM_RoleLimitedToTarget,CIM_SAPAvailableForElement,CIM_SecurityService,CIM_Sensor,CIM_Service,CIM_ServiceAccessBySAP,CIM_ServiceAccessPoint,CIM_ServiceAffectsElement,CIM_ServiceAvailableToElement,CIM_ServiceSAPDependency,CIM_ServiceServiceDependency,CIM_SettingData,CIM_SharedCredential,CIM_SoftwareElement,CIM_SoftwareFeature,CIM_SoftwareFeatureSoftwareElements,CIM_SoftwareIdentity,CIM_StatisticalData,CIM_StorageExtent,CIM_System,CIM_SystemBIOS,CIM_SystemComponent,CIM_SystemDevice,CIM_SystemPackaging,CIM_UseOfLog,CIM_Watchdog,CIM_WiFiEndpoint,CIM_WiFiEndpointCapabilities,CIM_WiFiEndpointSettings,CIM_WiFiPort,CIM_WiFiPortCapabilities,IPS_AdminProvisioningRecord,IPS_ClientProvisioningRecord,IPS_HostBasedSetupService,IPS_HostIPSettings,IPS_IderSessionUsingPort,IPS_IPv6PortSettings,IPS_KVMRedirectionSettingData,IPS_KvmSessionUsingPort,IPS_ManualProvisioningRecord,IPS_OptInService,IPS_ProvisioningAuditRecord,IPS_ProvisioningRecordLog,IPS_RasSessionUsingPort,IPS_ScreenSettingData,IPS_SecIOService,IPS_SessionUsingPort,IPS_SolSessionUsingPort,IPS_TLSProvisioningRecord\".split(',');\r\n IntelAmtEntireStateProgress = 101;\r\n IntelAmtEntireStateCalls = 3;\r\n IntelAmtEntireState = { 'localtime': Date(), 'utctime': new Date().toUTCString(), 'isotime': new Date().toISOString() };\r\n amtstack.BatchEnum(null, AllWsman, saveEntireAmtStateOk2, null, true);\r\n amtstack.GetAuditLog(saveEntireAmtStateOk3);\r\n amtstack.GetMessageLog(saveEntireAmtStateOk4);\r\n\r\n}", "title": "" }, { "docid": "1686456db40a4a1c3a9ba4186efbb712", "score": "0.51554346", "text": "function queuelogClasificado(queuelog, uniqueid, campo) {\n\n // Registro vacio\n let seleccionada = [{\n\n id: '',\n time: '00:00:00',\n callid: '',\n queuename: '',\n agent: '',\n event: '',\n data: '',\n data1: '',\n data2: '',\n data3: '',\n data4: '',\n data5: '',\n created: ''\n }];\n\n //console.log('valido')\n\n // Validar de la respuesta no sea undefined en caso de no existir\n // if ((queuelog.filter(queue => (queue.callid == uniqueid)).push(seleccionada)).length * 1 != 0) {\n // eslint-disable-next-line no-constant-condition\n if (true) {\n //console.log('si hay');\n\n // IVROPTION\n if (campo == 'IVROPTION' && queuelog.filter(queue => (queue.callid == uniqueid && queue.event == 'IVROPTION')).push(seleccionada) > 1) {\n let fecha_hora = (new Date((queuelog.filter(queue => (queue.callid == uniqueid && queue.event == 'IVROPTION'))[0].time)));\n return (fechas.standardDate(parseInt((new Date(fecha_hora).getTime() / 1000).toFixed(0))));\n }\n\n // ENTERQUEUE\n if (campo == 'ENTERQUEUE' && queuelog.filter(queue => (queue.callid == uniqueid && queue.event == 'ENTERQUEUE')).push(seleccionada) > 1) {\n let fecha_hora = (new Date((queuelog.filter(queue => (queue.callid == uniqueid && queue.event == 'ENTERQUEUE'))[0].time)));\n return (fechas.standardDate(parseInt((new Date(fecha_hora).getTime() / 1000).toFixed(0))));\n }\n\n\n // CONNECT\n if (campo == 'CONNECT' && queuelog.filter(queue => (queue.callid == uniqueid && queue.event == 'CONNECT')).push(seleccionada) > 1) {\n let fecha_hora = (new Date((queuelog.filter(queue => (queue.callid == uniqueid && queue.event == 'CONNECT'))[0].time)));\n return (fechas.standardDate(parseInt((new Date(fecha_hora).getTime() / 1000).toFixed(0))));\n }\n\n // COMPLETECALLER\n if (campo == 'COMPLETECALLER' && queuelog.filter(queue => (queue.callid == uniqueid && queue.event == 'COMPLETECALLER')).push(seleccionada) > 1) {\n let fecha_hora = (new Date((queuelog.filter(queue => (queue.callid == uniqueid && queue.event == 'COMPLETECALLER'))[0].time)));\n return (fechas.standardDate(parseInt((new Date(fecha_hora).getTime() / 1000).toFixed(0))));\n }\n\n // COMPLETEAGENT\n if (campo == 'COMPLETEAGENT' && queuelog.filter(queue => (queue.callid == uniqueid && queue.event == 'COMPLETEAGENT')).push(seleccionada) > 1) {\n let fecha_hora = (new Date((queuelog.filter(queue => (queue.callid == uniqueid && queue.event == 'COMPLETEAGENT'))[0].time)));\n return (fechas.standardDate(parseInt((new Date(fecha_hora).getTime() / 1000).toFixed(0))));\n }\n\n // ABANDON\n if (campo == 'ABANDON' && queuelog.filter(queue => (queue.callid == uniqueid && queue.event == 'ABANDON')).push(seleccionada) > 1) {\n let fecha_hora = (new Date((queuelog.filter(queue => (queue.callid == uniqueid && queue.event == 'ABANDON'))[0].time)));\n return (fechas.standardDate(parseInt((new Date(fecha_hora).getTime() / 1000).toFixed(0))));\n }\n\n\n } else {\n // console.log('no aplica');\n return seleccionada.time;\n\n }\n}", "title": "" }, { "docid": "5b417422d2eea394c167971ac578f3bf", "score": "0.5141582", "text": "function VerificarPrestamo() {\n var mensaje = '';\n var nuevo_prestamo = Object.create(prestamo);\n var prestamos = [];\n if (localStorage.prestamos != null) prestamos = JSON.parse(localStorage.prestamos);\n var libro_id = parseInt(localStorage.prestar_libro);\n var usuario_index = localStorage.user_logeado;\n var usuarios = JSON.parse(localStorage.usuarios);\n if (usuarios[usuario_index].estado != '1') mensaje += '\\n- Usuario moroso';\n var cantidad_prestamos = CantidadPrestamosUsuario(usuarios[usuario_index].id);\n if (cantidad_prestamos>=10) mensaje += '\\n- Ya tiene ' + cantidad_prestamos + ' libros prestados, el maximo permitido es 10';\n if (usuarios[usuario_index].estado != 1) mensaje += '\\n- Usuario moroso, solvente su deuda para poder prestar mas libros';\n if (mensaje == ''){\n var libro_index = ObtenerLibroIndex(libro_id);\n Libros[libro_index].disponibles--;\n if (prestamos.length == 0) nuevo_prestamo.prestamo_id = 1;\n else nuevo_prestamo.prestamo_id = prestamos[prestamos.length - 1].prestamo_id + 1;\n nuevo_prestamo.libro_id = libro_id;\n nuevo_prestamo.usuario_id = usuarios[usuario_index].id;\n nuevo_prestamo.fecha_prestamo = $('#td_libro_prestamo').html();\n nuevo_prestamo.fecha_devolucion = $('#td_libro_devolucion').html();\n //nuevo_prestamo.fecha_prestamo = \"10/4/2018\";\n //nuevo_prestamo.fecha_devolucion = \"15/4/2018\";\n nuevo_prestamo.token = GenerarToken();\n nuevo_prestamo.estado = 1;\n prestamos.push(nuevo_prestamo);\n localStorage.setItem('prestamos', JSON.stringify(prestamos));\n GuardarLibros();\n alert('Libro prestado');\n window.location.href = 'usuarios_libros.html';\n }else {\n alert(mensaje);\n window.location.href = 'usuarios_libros.html';\n }\n\n}", "title": "" }, { "docid": "be135c8943823da0978f62d303346b5a", "score": "0.5139742", "text": "async store(request, response) {\r\n let motorista = await Carona.find({ tipo: 'Motorista' });\r\n let passageiro = await Carona.find({ tipo: 'Passageiro' });\r\n let reserva, verificador;\r\n\r\n //Procura por motorista e passageiro com msm origem, destino e data. Caso exista add no banco.\r\n for (let i = 0; i < motorista.length; i++) {\r\n for (let j = 0; j < passageiro.length; j++) {\r\n if (motorista[i].origem == passageiro[j].origem) {\r\n if (motorista[i].destino == passageiro[j].destino) {\r\n //Verifica se a carona já foi aceita.\r\n if (motorista[i].data == passageiro[j].data) {\r\n verificador = await Concedida.findOne({\r\n passageiro: passageiro[j].nome\r\n });\r\n //Caso não tenha sido aceita é criada a possivel carona no banco.\r\n if(!verificador){\r\n reserva = await Reserva.create({\r\n motorista: motorista[i].nome,\r\n passageiro: passageiro[j].nome,\r\n origem: motorista[i].origem,\r\n destino: motorista[i].destino,\r\n data: motorista[i].data,\r\n id_passageiro: passageiro[i]._id, \r\n });\r\n return response.json(reserva);\r\n } \r\n }\r\n }\r\n }\r\n } \r\n }\r\n }", "title": "" }, { "docid": "f9ab1d49ca025119b4cb7e050dbe9fbd", "score": "0.5136141", "text": "function Empacado_Regis(req,callback){\n\n Produccion.findById(req.body.proc)\n .populate(\"prod\")\n .exec(function(err,produccion){\n if(err){ res.redirect(\"/app\"); return; }\n\n var elaborado = parseInt(req.body.empacado) + parseInt(req.body.averias);\n var PrediferenciaPor = produccion.diferenciaPor * produccion.turno;\n var PreaveriasPor = produccion.averiasPor * produccion.turno;\n var Prediferencia = produccion.diferencia;\n var venc = req.body.fecha_ven.replace(/-/g, '\\/');\n var fecha_ven = dateFormat(venc, \"d/m/yyyy\");\n\n produccion.turno = produccion.turno + 1;\n produccion.empacado = produccion.empacado + parseInt(req.body.empacado);\n produccion.averias = produccion.averias + parseInt(req.body.averias);\n produccion.diferencia = produccion.diferencia == 0 ? parseInt(produccion.cantidad) - elaborado : parseInt(produccion.diferencia) - elaborado ;\n // produccion.empacado = req.body.empacado;\n // produccion.averias = req.body.averias;\n // produccion.averiasPor = 0;\n // produccion.diferencia = 0;\n // produccion.diferenciaPor = 0;\n // produccion.turno = 0;\n // produccion.fecha_ven = \"vacio\";\n produccion.averiasPor = Prediferencia == 0 ? Number(((req.body.averias / produccion.cantidad)* 100).toFixed(1)) : ((req.body.averias / Prediferencia)* 100 ).toFixed(1);\n produccion.diferenciaPor = Prediferencia == 0 ? Number(((produccion.diferencia / produccion.cantidad)* 100).toFixed(1)) : ((produccion.diferencia / Prediferencia)* 100 ).toFixed(1);\n produccion.fecha_ven = fecha_ven;\n if(produccion.diferencia >= 0 && produccion.turno <= 3){\n var now = Date.now();\n var date = dateFormat(now, \"d/m/yyyy\");\n var hora = dateFormat(now, \"d/m/yyyy, h:MM:ss TT\");\n\n var data = {\n fecha: date,\n hora: hora,\n fecha_ven: fecha_ven,\n empacado: req.body.empacado,\n averias: req.body.averias,\n averiasPor: produccion.averiasPor,\n diferencia: produccion.diferencia,\n diferenciaPor: produccion.diferenciaPor,\n turno : produccion.turno,\n proc: req.body.proc,\n prod: produccion.prod._id\n }\n var elaborado = new Elaborado(data);\n elaborado.save(function(err){\n if(!err){\n produccion.averiasPor = Number(((produccion.averiasPor + PreaveriasPor) / produccion.turno).toFixed(1));\n produccion.diferenciaPor = Number(((produccion.diferenciaPor + PrediferenciaPor) / produccion.turno).toFixed(1));\n produccion.save(function(err){\n if(!err){\n return callback(true);\n }\n });\n }\n else{ console.log(err); }\n });\n }\n else{\n return callback(false);\n }\n });\n}", "title": "" }, { "docid": "d32b611361a2b32a398ca90e7ab232d3", "score": "0.5133631", "text": "function saveEntireAmtState2()\r\n{\r\n console.log('Fetching all Intel AMT state, this may take a few minutes...');\r\n var transport = require('amt-wsman-duk');\r\n var wsman = require('amt-wsman');\r\n var amt = require('amt');\r\n wsstack = new wsman(transport, settings.hostname, settings.tls ? 16993 : 16992, settings.username, settings.password, settings.tls);\r\n amtstack = new amt(wsstack);\r\n amtstack.onProcessChanged = onWsmanProcessChanged;\r\n //var AllWsman = \"AMT_GeneralSystemDefenseCapabilities\".split(',');\r\n var AllWsman = \"AMT_8021xCredentialContext,AMT_8021XProfile,AMT_ActiveFilterStatistics,AMT_AgentPresenceCapabilities,AMT_AgentPresenceInterfacePolicy,AMT_AgentPresenceService,AMT_AgentPresenceWatchdog,AMT_AgentPresenceWatchdogAction,AMT_AlarmClockService,IPS_AlarmClockOccurrence,AMT_AssetTable,AMT_AssetTableService,AMT_AuditLog,AMT_AuditPolicyRule,AMT_AuthorizationService,AMT_BootCapabilities,AMT_BootSettingData,AMT_ComplexFilterEntryBase,AMT_CRL,AMT_CryptographicCapabilities,AMT_EACCredentialContext,AMT_EndpointAccessControlService,AMT_EnvironmentDetectionInterfacePolicy,AMT_EnvironmentDetectionSettingData,AMT_EthernetPortSettings,AMT_EventLogEntry,AMT_EventManagerService,AMT_EventSubscriber,AMT_FilterEntryBase,AMT_FilterInSystemDefensePolicy,AMT_GeneralSettings,AMT_GeneralSystemDefenseCapabilities,AMT_Hdr8021Filter,AMT_HeuristicPacketFilterInterfacePolicy,AMT_HeuristicPacketFilterSettings,AMT_HeuristicPacketFilterStatistics,AMT_InterfacePolicy,AMT_IPHeadersFilter,AMT_KerberosSettingData,AMT_ManagementPresenceRemoteSAP,AMT_MessageLog,AMT_MPSUsernamePassword,AMT_NetworkFilter,AMT_NetworkPortDefaultSystemDefensePolicy,AMT_NetworkPortSystemDefenseCapabilities,AMT_NetworkPortSystemDefensePolicy,AMT_PCIDevice,AMT_PETCapabilities,AMT_PETFilterForTarget,AMT_PETFilterSetting,AMT_ProvisioningCertificateHash,AMT_PublicKeyCertificate,AMT_PublicKeyManagementCapabilities,AMT_PublicKeyManagementService,AMT_PublicPrivateKeyPair,AMT_RedirectionService,AMT_RemoteAccessCapabilities,AMT_RemoteAccessCredentialContext,AMT_RemoteAccessPolicyAppliesToMPS,AMT_RemoteAccessPolicyRule,AMT_RemoteAccessService,AMT_SetupAndConfigurationService,AMT_SNMPEventSubscriber,AMT_StateTransitionCondition,AMT_SystemDefensePolicy,AMT_SystemDefensePolicyInService,AMT_SystemDefenseService,AMT_SystemPowerScheme,AMT_ThirdPartyDataStorageAdministrationService,AMT_ThirdPartyDataStorageService,AMT_TimeSynchronizationService,AMT_TLSCredentialContext,AMT_TLSProtocolEndpoint,AMT_TLSProtocolEndpointCollection,AMT_TLSSettingData,AMT_TrapTargetForService,AMT_UserInitiatedConnectionService,AMT_WebUIService,AMT_WiFiPortConfigurationService,CIM_AbstractIndicationSubscription,CIM_Account,CIM_AccountManagementCapabilities,CIM_AccountManagementService,CIM_AccountOnSystem,CIM_AdminDomain,CIM_AlertIndication,CIM_AssignedIdentity,CIM_AssociatedPowerManagementService,CIM_AuthenticationService,CIM_AuthorizationService,CIM_BIOSElement,CIM_BIOSFeature,CIM_BIOSFeatureBIOSElements,CIM_BootConfigSetting,CIM_BootService,CIM_BootSettingData,CIM_BootSourceSetting,CIM_Capabilities,CIM_Card,CIM_Chassis,CIM_Chip,CIM_Collection,CIM_Component,CIM_ComputerSystem,CIM_ComputerSystemPackage,CIM_ConcreteComponent,CIM_ConcreteDependency,CIM_Controller,CIM_CoolingDevice,CIM_Credential,CIM_CredentialContext,CIM_CredentialManagementService,CIM_Dependency,CIM_DeviceSAPImplementation,CIM_ElementCapabilities,CIM_ElementConformsToProfile,CIM_ElementLocation,CIM_ElementSettingData,CIM_ElementSoftwareIdentity,CIM_ElementStatisticalData,CIM_EnabledLogicalElement,CIM_EnabledLogicalElementCapabilities,CIM_EthernetPort,CIM_Fan,CIM_FilterCollection,CIM_FilterCollectionSubscription,CIM_HostedAccessPoint,CIM_HostedDependency,CIM_HostedService,CIM_Identity,CIM_IEEE8021xCapabilities,CIM_IEEE8021xSettings,CIM_Indication,CIM_IndicationService,CIM_InstalledSoftwareIdentity,CIM_KVMRedirectionSAP,CIM_LANEndpoint,CIM_ListenerDestination,CIM_ListenerDestinationWSManagement,CIM_Location,CIM_Log,CIM_LogEntry,CIM_LogicalDevice,CIM_LogicalElement,CIM_LogicalPort,CIM_LogicalPortCapabilities,CIM_LogManagesRecord,CIM_ManagedCredential,CIM_ManagedElement,CIM_ManagedSystemElement,CIM_MediaAccessDevice,CIM_MemberOfCollection,CIM_Memory,CIM_MessageLog,CIM_NetworkPort,CIM_NetworkPortCapabilities,CIM_NetworkPortConfigurationService,CIM_OrderedComponent,CIM_OwningCollectionElement,CIM_OwningJobElement,CIM_PCIController,CIM_PhysicalComponent,CIM_PhysicalElement,CIM_PhysicalElementLocation,CIM_PhysicalFrame,CIM_PhysicalMemory,CIM_PhysicalPackage,CIM_Policy,CIM_PolicyAction,CIM_PolicyCondition,CIM_PolicyInSystem,CIM_PolicyRule,CIM_PolicyRuleInSystem,CIM_PolicySet,CIM_PolicySetAppliesToElement,CIM_PolicySetInSystem,CIM_PowerManagementCapabilities,CIM_PowerManagementService,CIM_PowerSupply,CIM_Privilege,CIM_PrivilegeManagementCapabilities,CIM_PrivilegeManagementService,CIM_ProcessIndication,CIM_Processor,CIM_ProtocolEndpoint,CIM_ProvidesServiceToElement,CIM_Realizes,CIM_RecordForLog,CIM_RecordLog,CIM_RedirectionService,CIM_ReferencedProfile,CIM_RegisteredProfile,CIM_RemoteAccessAvailableToElement,CIM_RemoteIdentity,CIM_RemotePort,CIM_RemoteServiceAccessPoint,CIM_Role,CIM_RoleBasedAuthorizationService,CIM_RoleBasedManagementCapabilities,CIM_RoleLimitedToTarget,CIM_SAPAvailableForElement,CIM_SecurityService,CIM_Sensor,CIM_Service,CIM_ServiceAccessBySAP,CIM_ServiceAccessPoint,CIM_ServiceAffectsElement,CIM_ServiceAvailableToElement,CIM_ServiceSAPDependency,CIM_ServiceServiceDependency,CIM_SettingData,CIM_SharedCredential,CIM_SoftwareElement,CIM_SoftwareFeature,CIM_SoftwareFeatureSoftwareElements,CIM_SoftwareIdentity,CIM_StatisticalData,CIM_StorageExtent,CIM_System,CIM_SystemBIOS,CIM_SystemComponent,CIM_SystemDevice,CIM_SystemPackaging,CIM_UseOfLog,CIM_Watchdog,CIM_WiFiEndpoint,CIM_WiFiEndpointCapabilities,CIM_WiFiEndpointSettings,CIM_WiFiPort,CIM_WiFiPortCapabilities,IPS_AdminProvisioningRecord,IPS_ClientProvisioningRecord,IPS_HostBasedSetupService,IPS_HostIPSettings,IPS_IderSessionUsingPort,IPS_IPv6PortSettings,IPS_KVMRedirectionSettingData,IPS_KvmSessionUsingPort,IPS_ManualProvisioningRecord,IPS_OptInService,IPS_ProvisioningAuditRecord,IPS_ProvisioningRecordLog,IPS_RasSessionUsingPort,IPS_ScreenSettingData,IPS_SecIOService,IPS_SessionUsingPort,IPS_SolSessionUsingPort,IPS_TLSProvisioningRecord\".split(',');\r\n IntelAmtEntireStateProgress = 101;\r\n IntelAmtEntireStateCalls = 3;\r\n IntelAmtEntireState = { 'localtime': Date(), 'utctime': new Date().toUTCString(), 'isotime': new Date().toISOString() };\r\n amtstack.BatchEnum(null, AllWsman, saveEntireAmtStateOk2, null, true);\r\n amtstack.GetAuditLog(saveEntireAmtStateOk3);\r\n amtstack.GetMessageLog(saveEntireAmtStateOk4);\r\n\r\n}", "title": "" }, { "docid": "365b2a4e35fdb1183de3382586d6b906", "score": "0.5116696", "text": "saveLocks() {\n DataStorage.SaveLocks(locks)\n .then(() => console.log(\"Locks Saved\"))\n .catch(ex => {\n const { code, message, details } = ex;\n console.log(\"saveLocks Exception:\", code, message, details);\n });\n }", "title": "" }, { "docid": "a330664cd27ea658e032fa7e12f52205", "score": "0.51158154", "text": "function addProgress(user, diet) {\n\n // create a transaction\n return models.sequelize.transaction(function () {\n // in the transaction, save promises in this empty array\n var promises = [];\n // for 28 iterations, \n for (var i = 0; i < 28; i++) {\n // create one of the 28 progress reports, saving it as a promise\n var newPromise = models.DietProgress.create({\n q1: \"How's your mood?\",\n a1: getRandomAnswer(),\n q2: \"How's your energy?\",\n a2: getRandomAnswer(),\n q3: \"What was your weight today?\",\n a3: getRandomWeight(),\n reportDay: (Date.now() - (86400000 * 10) + (86400000 * i)),\n reportNum: (i+1)\n // ^^^ the current day, minus 10 days, plus one day times the value of i\n })\n // then, with the dietProg passed,\n .then(function(dietProg){\n // set the user to the user argument of addProgress\n return dietProg.setUser(user)\n // then, \n .then(function(){\n // set the diet to the diet argument of addProgress\n return dietProg.setDiet(diet)\n })\n })\n // push each promise to the newPromise array\n promises.push(newPromise);\n }\n // then, fulfill each sequelize promise,\n // or, in other words, create all 28 notifications\n return Promise.all(promises).then(function(result){console.log(result)});\n })\n}", "title": "" }, { "docid": "75d851daae5217463ebce0280feab06c", "score": "0.51131773", "text": "function pedirInformacion() {\n const falla = Math.random() * 100;\n //defino la variable usuario aqui afuera porque sino no podria devolverla en el bloque finally\n let usuario;\n //mensajes de error\n const NetworkError = \"Hubo un problema en la conexion de internet\";\n const InternalError = \"Hubo un error interno en el el servidor\";\n const AlienError = \"Una anomalia intercepto la informacion\";\n try {\n //intento buscar un usuario\n usuario = pedirUsuario();\n } catch (error) {\n //si atrapa un error debido a que el usuario era el 00000 disparo un nuevo error\n //y le paso el mensaje\n throw new Error(error.message);\n } finally {\n \n //calculo si salio en el 28% de error\n if (falla > 28 && falla <= 53) {\n throw new Error(NetworkError);\n }\n //calculo si salio en el 18% el error\n if (falla > 10 && falla <= 28) {\n throw new Error(InternalError);\n }\n //calculo si salio en el 10% el error\n if (falla <= 10) {\n throw new Error(AlienError);\n }\n //si no se disparo ningun error chequeo que usuario exista\n if (usuario) {\n //si usuario tiene algo lo muestro por consola\n return console.log(usuario);\n }\n }\n }", "title": "" }, { "docid": "2571f78bd31bcb7334b2721db484e265", "score": "0.509683", "text": "save_group_status(to, status){\n return new Promise((resolve, reject)=>{\n client.del(\"status\"+to)\n client.rpush(\"status\"+to, status)\n client.lrange(\"status\"+to , 0, -1,\n (err,data) => {\n if(err){\n resolve(console.log(err))\n }else{\n resolve(data[0])\n \n }\n})\n})\n}", "title": "" }, { "docid": "d4ab7078a4eaadf3cb0acd2b0cd09490", "score": "0.5091481", "text": "function transferirToken(){\n var cantidad = document.getElementById(\"cantidadTokensEmpleado\").value;\n var address_to = document.getElementById(\"empleadoSelect\").value;\n var address_from = localStorage.getItem(\"accountEmpleado\");\n\n \tvar saldo = plataforma.balanceOf.call(address_from, {from: address_from, gas:30000});\n\t\tconsole.log(\"Vigilando tu saldo. Tienes \" + saldo + \" e intentas transferir \" + cantidad);\n \tif(parseInt(saldo) < cantidad){\n \t\talert(\"¡Vaya! No tienes suficientes tokens\");\n \t}else{\n\n \t\tplataforma.transferirTokens.sendTransaction(address_to, cantidad, {from: address_from, gas:200000},\n \t\t\tfunction (error,result){\n \t\t\t\tif (!error){\n \t\t\t\t\tvar event = plataforma.TokensEmitidos({},{fromBlock:'latest', toBlock:'latest'},\n \t\t\t\t\t\tfunction(error, result){\n \t\t\t\t\t\t\tif (!error){\n \t\t\t\t\t\t\t\tvar msg = \"OK! El empleado \" + result.args._from + \" ha emitido \" + result.args._n + \" tokens al empleado \" + result.args._to;\n \t\t\t\t\t\t \t\timprimir(msg);\n \t\t\t\t\t\t\t\tvar nuevoSaldo = plataforma.balanceOf.call(address_from, {from: address_from, gas:30000});\n \t\t\t\t\t\t\t\tdocument.getElementById(\"tokensEmpleado\").innerHTML = nuevoSaldo;\n \t\t\t\t\t\t\t}else{\n \t\t\t\t\t\t\t\tconsole.log(\"Error\" + error);\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t});\n \t\t\t\t} else {\n \t\t\t\t\tconsole.error(\"Error\" + error);\n \t\t\t\t}\n \t\t\t}\n \t\t);\n\t }\n }", "title": "" }, { "docid": "b6b0e9193d55fb993a1a2f680a565f89", "score": "0.50863105", "text": "function addProgress(user, diet, queryInterface) {\n\n // create a transaction\n return models.sequelize.transaction(function () {\n // in the transaction, save promises in this empty array\n var promises = [];\n // for 28 iterations, \n for (var i = 0; i < 28; i++) {\n // create one of the 28 progress reports, saving it as a promise\n var newPromise = models.DietProgress.create({\n q1: \"How's your mood?\",\n a1: getRandomAnswer(),\n q2: \"How's your energy?\",\n a2: getRandomAnswer(),\n q3: \"What was your weight today?\",\n a3: getRandomWeight(),\n reportDay: (Date.now() - (86400000 * 10) + (86400000 * i)),\n reportNum: (i+1)\n // ^^^ the current day, minus 28 days, plus one day times the value of i\n })\n // then, with the dietProg passed,\n .then(function(dietProg){\n // set the user to the user argument of addProgress\n return dietProg.setUser(user)\n // then, \n .then(function(){\n // set the diet to the diet argument of addProgress\n return dietProg.setDiet(diet)\n })\n })\n // push each promise to the newPromise array\n promises.push(newPromise);\n }\n // then, fulfill each sequelize promise,\n // or, in other words, create all 28 notifications\n return Promise.all(promises)\n .then(function(){\n insertCheck++;\n if (insertCheck === 4){\n return queryInterface.sequelize.query(\"INSERT INTO SequelizeMeta VALUES('20160712221045-bulkInsert2.js');\");\n }\n });\n })\n}", "title": "" }, { "docid": "508a28bc194fe149902099d41dc1489b", "score": "0.5080585", "text": "function updateStockTable(dbName, tbStock) {\n let allWerte;\n // Alle Aktienwerte fuer den letzten Monat holen\n getExtremeSharePrice_1.getSharePriceExtremeMonate(getExtremeSharePrice_1.eZeitraum.Monat1)\n .then((werte) => {\n allWerte = werte;\n // das letzte Datum aus der Tabelle holen\n return db.getMaxOf(dbName, tbStock, \"date\");\n })\n .then((lastDate) => {\n // wenn die Tabelle noch leer ist, dann ist das Datum ungültig\n let maxdate = moment(lastDate);\n if (!maxdate.isValid())\n maxdate = moment(\"1900-01-01\");\n console.log(\"letztes Datum in Tabelle \" + tbStock + \": \" + maxdate.format(\"LLLL\"));\n // alle Aktienwerte herausfiltern, deren Datum größer als maxDatum ist:\n const neueAktienWerte = allWerte.filter((record) => {\n return moment(record.date) > maxdate;\n });\n console.log(\"Anzahl geholt: \" + allWerte.length);\n console.log(\"Anzahl übrig: \" + neueAktienWerte.length);\n // nun kann ich die neuen Werte eintragen\n if (neueAktienWerte.length > 0) {\n Promise.all(db.insertArrayOfRecords(dbName, tbStock, classes_1.clStock, neueAktienWerte))\n .then(() => console.log(\"Erfolgreich\"))\n .catch(err => console.log(\"nicht erfolgreich: \" + err.message));\n }\n else {\n console.log(\"Keine neuen Aktienkurse für Extreme!\");\n }\n })\n .catch(reason => console.log(\"Fehler in updateDatenbank: \" + reason));\n}", "title": "" }, { "docid": "43a6dacb9bcf2359e75e4e7370b11aac", "score": "0.5079367", "text": "async store ({ request, response }) {\n let { service_delivery,total_amount } = request.only(['service_delivery','total_amount'])\n await User\n .query()\n .where('scope', 'Delivery')\n .where('id',service_delivery)\n .firstOrFail()\n try {\n let cashout=await CashOut.create({\n service_delivery,\n total_amount\n })\n return response.status(201).json(cashout)\n } catch (error) {\n console.log(error)\n return response.status(400).send(error);\n }\n }", "title": "" }, { "docid": "31dd1aad8d28fc7a82aac82b09f2da46", "score": "0.50678706", "text": "function importarCAMPANAS ( fecha_inicio, fecha_final ) {\n\n console.log('Calculando indicadores....');\n\n /************************************************************************************************************\n * CONSTRUIR LOS QUERIES\n */\n\n // @crear queries con datos basicos\n\n // const campaign_callcenter =\n // `SELECT * FROM campaign_entry`;\n\n // const colas_reports =\n // `SELECT * FROM inv_colas`;\n\n // const campanas_reports =\n // `SELECT * FROM inv_campanas`;\n\n\n\n /*************************************************************************************************************\n * EJECUTAR LAS PROMESAS\n */\n /*\n\n */\n\n\n Promise.all([\n cam_read_data.readCAMPAIGN_callcenter(),\n cam_read_data.readCOLAS_reports(),\n // cam_read_data.readCAMPANAS_reports(),\n\n\n ])\n .then(function (res) {\n\n let campaign_callcenter = res[0];\n let colas_reports = res[1];\n // let campanas_reports = res[2];\n\n\n console.log('campaign_callcenter', campaign_callcenter.length);\n console.log('colas_reports', colas_reports.length);\n // console.log('campanas_reports', campanas_reports.length);\n\n\n //@TODO: validar que hay datos\n if( campaign_callcenter ){\n cam_write_data.guardarCAMPANAS( campaign_callcenter, colas_reports /*, campanas_reports */)\n .then(function(indicadoresResult){\n\n });\n }\n\n })\n .catch(error => {\n console.log(error);\n });\n\n\n}", "title": "" }, { "docid": "f21339b56e2345ef322a043a564bdf9d", "score": "0.5067851", "text": "submitAddSalesQuery() {}", "title": "" }, { "docid": "284d3c82a38b1e13384993b292c403e5", "score": "0.506606", "text": "async function totalupInvestorPortfolio (entity_id) {\n let foundInvestor = await iraSQL.getEntityById(entity_id);\n let investments = await iraSQL.getOwnershipForInvestor(entity_id);\n\n if (investments.length > 0) {\n console.log(\"In calc/TUIP, got \"+investments.length+ \" investments: \"+JSON.stringify(investments,null,4)+\"\\n\\n\");\n let portfolioDeals = [] //empty array - add only if its a deal\n let totalPortfolioValue = 0;\n let totalInvestmentValue = 0;\n let totalDistributions = 0;\n\n for (let index = 0; index < investments.length; index++) {\n let expandDeal = {}\n //if its a deal\n if (investments[index].deal_id) {\n let dealFinancials = await iraSQL.getDealById(investments[index].deal_id);\n expandDeal = calculateDeal(dealFinancials)\n //if its an entity\n } else {\n let investmentEntity = await iraSQL.getEntityById(investments[index].investment_id)\n console.log(\"Going from Own to Entity, the entity is: \"+JSON.stringify(investmentEntity,null,4))\n console.log(\"Because \"+investments[index].investment_name+\" is not a DEAL, went to Entity to get \"+formatCurrency(investmentEntity.implied_value));\n // if its an ENTITY - not a deal -- do it here\n //if you want to get fancy, calculate implied_value on th fly here\n //adding a stand-in expandDeal\n expandDeal = {\n \"id\": investments[index].id,\n \"name\": investments[index].investment_name,\n \"aggregate_value\": 0,\n \"cash_assets\": 0,\n \"aggregate_debt\": 0,\n \"deal_debt\": 0,\n \"notes\": \"\",\n \"deal_equity_value\": investmentEntity.implied_value, //yes! get this from implied_value\n \"total_assets\": 0, //component of EV\n \"total_debt\": 0 //component of EV\n\n };\n\n } //else for entity_id\n\n //this is common to both DEAL and ENTITY\n //console.log (\"\\n\"+index+\") Investment in ENTITY_ID :\"+investments[index].investment_id+\" \"+investments[index].investment_name+\" is not a DEAL \\n\")\n let transactionsForEntity = await iraSQL.getTransactionsForInvestorAndEntity(investments[index].investor_id, investments[index].investment_id,[1,3,5,6,7,8]);\n //console.log (\"TUIP - got \"+transactionsForEntity.length+\" transactions for entity \"+investments[index].investment_name+\" : \"+JSON.stringify(transactionsForEntity, null, 4)+\"\\n\")\n\n //now newPortfolioDeal\n let newPortfolioDeal = investments[index];\n newPortfolioDeal.expandDeal = expandDeal;\n console.log(\"\\n\\n*> Adding portfolio contribution from \"+newPortfolioDeal.expandDeal.name+\" and using Equity Value of \"+formatCurrency(newPortfolioDeal.expandDeal.deal_equity_value));\n let result = await totalupCashInDeal(transactionsForEntity);\n\n newPortfolioDeal.transactionsForDeal = result[0];\n newPortfolioDeal.totalCashInDeal = result[1];\n newPortfolioDeal.dealDistributions = result[2];\n newPortfolioDeal.totalInvestments_noRollover = result[3];\n newPortfolioDeal.rolloverTransactions = result[4];\n newPortfolioDeal.investor_equity_value = newPortfolioDeal.expandDeal.deal_equity_value*(newPortfolioDeal.capital_pct/100);\n console.log(\"We have a newPortfolioDeal : \"+JSON.stringify(newPortfolioDeal,null,4));\n console.log( \"So with \"+newPortfolioDeal.capital_pct/100+\"% stake, \"+newPortfolioDeal.investment_name+ \" contributed \"+formatCurrency(newPortfolioDeal.investor_equity_value)+\" to \"+foundInvestor.name+\"s portfolio (TUIP)\");\n //add the sums\n totalPortfolioValue += newPortfolioDeal.investor_equity_value //save this as implied_value\n //this is already a total for that deal - how to exude 7's\n //need to change this.\n totalInvestmentValue += newPortfolioDeal.totalInvestments_noRollover;\n totalDistributions += newPortfolioDeal.dealDistributions;\n portfolioDeals.push(newPortfolioDeal);\n\n\n } //for\n\n console.log(\"\\nPortfolio for \"+foundInvestor.name+\" is ready - in TUI - implied Ent Value is \"+formatCurrency(totalPortfolioValue));\n return [portfolioDeals, totalInvestmentValue, totalPortfolioValue, totalDistributions];\n\n } else { //if no investors\n return [ [], null, null, null];\n }\n\n\n // } catch (err) {\n // console.log(\"Err: No Ownership in TUIP problem: \"+err);\n // return [ [], null, null, null];\n // }\n\n } //function totalupInvestorPortfolio", "title": "" }, { "docid": "805e237a0bf455c84be05b84628f63f3", "score": "0.5065296", "text": "async function asfReuireDest(){\t \n \n const transaction = {\n \"TransactionType\": \"AccountSet\" ,\n \"Account\": Address,\n \"Fee\": \"12000\",\n \"Flags\": 0,\n \"SetFlag\": 1\n\n };\n \n api.connect().then(() => {\n console.log('Connected...');\n return api.prepareTransaction( transaction).then(prepared => { \n console.log('Set Require Destination Tag prepared...');\n const {signedTransaction} = api.sign(prepared.txJSON, secret);\n console.log('Set Require Destination Tag signed...');\n api.submit(signedTransaction).then(quit, fail);\n });\n }).catch(fail);\n }", "title": "" }, { "docid": "3dac832c3612fd11c92b08cbf3e7594d", "score": "0.50469047", "text": "function canjearTokensEvento(){\n var address_from = document.getElementById(\"addressEmpleado\").innerHTML;\n\n var saldo = plataforma.balanceOf.call(address_from, {from: address_from, gas:30000});\n\t\tconsole.log(\"Vigilando tu saldo. Tienes \" + saldo + \" e intentas transferir 3\");\n if(parseInt(saldo) < 3){\n alert(\"¡Vaya! No tienes suficientes tokens\");\n }else{\n plataforma.canjearTokens.sendTransaction(3, {from: address_from, gas:200000},\n\t\t\t function (error,result){\n\t\t\t\t\tif (!error){\n\t\t\t\t\t\tvar event = plataforma.TokensEmitidos({},{fromBlock:'latest', toBlock:'latest'},\n\t\t\t\t\t\t\tfunction(error, result){\n\t\t\t\t\t\t\t\tif (!error){\n\t\t\t\t\t\t\t \t\timprimir(\"OK! El empleado \" + result.args._from + \" ha canjeado 3 tokens a cambio de una entrada a un evento\");\n\t\t\t\t\t\t\t\t\tvar nuevoSaldo = plataforma.balanceOf.call(address_from, {from: address_from, gas:30000});\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tokensEmpleado\").innerHTML = nuevoSaldo;\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\tconsole.log(\"Error\" + error);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.error(\"Error\" + error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t }\n }", "title": "" }, { "docid": "78a358c4c99d5eacfa0cb5757619a70e", "score": "0.5046558", "text": "async store ({ request, response }){\n const dataBody = request.only([\"nameProduct\",\"productionDate\",\"manufacturer\",\"trackerProgress\"])\n return OchainX.save(\n dataBody.nameProduct,\n dataBody.productionDate,\n dataBody.manufacturer,\n dataBody.trackerProgress)\n }", "title": "" }, { "docid": "b1fe74ad94b12cb5f7a936113f88b17d", "score": "0.50461745", "text": "create (req, res) {\n // Validate request\n let subasta = req.body.subasta;\n let cliente = req.body.cliente;\n let itemCatalogo = req.body.itemCatalogo;\n let importe = req.body.importe;\n let categoria = req.body.categoria;\n Asistentes.findAll({ where:{\n cliente: cliente,\n },\n }).then((asistente)=>{\n console.log(\"\\n\\n\\n=== asistente ===\",asistente);\n const values=[]\n asistente.forEach(id=>values.push(id.dataValues.subasta))\n console.log(\"\\n\\n\\n=== values ===\",values);\n subastas.findAll({\n where:{identificador: { [Op.in]:values },\n estado:\"abierta\"\n }\n }).then((subastas)=>{\n console.log(\"\\n\\n\\n=== asistente ===\",subastas);\n if ((subastas.length==0) || ((subastas.length==1) && (subastas[0].dataValues.identificador==subasta))){\n Asistentes.findOrCreate({ where:{\n cliente: cliente,\n subasta: subasta,},\n defaults:{\n numeroPostor: cliente}\n }).then((data) => {\n let asistente = data[0].dataValues.identificador;\n Pujas.findAll({ where:{\n item: itemCatalogo,\n },order:[['identificador', 'DESC']],\n }).then(lastPuja => {\n if (lastPuja.length==0){ var importeLastPuja=0} else{ var importeLastPuja=lastPuja[0].dataValues.importe} \n if ( ((categoria in [\"oro\",\"platino\"]) || (importe < (importeLastPuja)*1.20)) && !(importe==importeLastPuja) || (importeLastPuja==0) ){\n Pujas.create({ \n asistente: asistente,\n item: itemCatalogo,\n importe:importe\n })\n .then(puja => {\n res.send(puja);\n })\n .catch(err => {\n res.status(500).send({\n message:\n err.message || \"Error occurred while creating the Puja.\"\n });\n });\n }else {\n res.status(500).send({\n message:\n \"Importe supera el 20% de la puja previa o es igual a la ultima puja\"\n });\n }\n })\n .catch(err => {\n res.status(500).send({\n message:\n err.message || \"Could not find puja previa\"\n });\n });\n })\n .catch(err => {\n res.status(500).send({\n message:\n err.message || \"Some error occurred while retrieving Asistente.\"\n });\n });\n }\n else\n {\n res.status(500).send({\n message:\n \"Ya esta participando de una subasta activa\"\n });\n }\n })\n .catch(err => {\n res.status(500).send({\n message:\n err.message || \"Could not find puja previa\"\n });\n });\n\n })\n .catch(err => {\n res.status(500).send({\n message:\n err.message || \"Some error occurred while retrieving All Asistente.\"\n });\n });\n }", "title": "" }, { "docid": "53727f7841be535cc65cf1dd44142eb4", "score": "0.50380534", "text": "async function execute(week, startBlock, toBlock, _reward) {\n lastUpdateTime = startBlock\n reward = toBN(toWei(_reward))\n rewardRate = reward.div(toBN(toBlock - startBlock))\n\n // # of DUSD contributed in ILMO == # of bpt received\n const dusd = new web3.eth.Contract(DUSD, '0x5BC25f649fc4e26069dDF4cF4010F9f706c23831')\n let events = (await dusd.getPastEvents('Transfer', { filter: { to: ilmoStakeContract }, fromBlock: ilmoStarted, toBlock: ilmoEnded }))\n .sort((a, b) => a.blockNumber - b.blockNumber)\n\n for (let i = 0; i < events.length; i++) {\n credit(events[i].returnValues.from, events[i])\n }\n\n events = await getPastEvents(ilmoEnded, toBlock)\n console.log(events.length)\n for (let i = 0; i < events.length; i++) {\n const event = events[i]\n if (event.blockNumber > startBlock) {\n updateGlobalReward(event.blockNumber)\n }\n if (event.returnValues.from == ilmoStakeContract) {\n debit(event.returnValues.to, event)\n } else if (event.returnValues.to == ilmoStakeContract) {\n // 7.1M BPT were transferred from ILMO pool to staking contract - needs to be ignored\n if (event.returnValues.from != '0xD8E9690eFf99E21a2de25E0b148ffaf47F47C972') { // ILMO pool\n credit(event.returnValues.from, event)\n }\n }\n }\n\n // Finally update the reward at the end of period\n updateGlobalReward(toBlock)\n\n Object.keys(rewards)\n .forEach(account => {\n updateReward(account) // updates rewards[account]\n rewards[account] = parseFloat(fromWei(rewards[account]))\n })\n\n const final = {}\n let total = 0\n Object.keys(rewards)\n // .sort()\n .sort((a, b) => rewards[a] - rewards[b])\n .forEach(account => {\n if (rewards[account] > 0) {\n final[account] = rewards[account]\n total += final[account]\n }\n })\n\n console.log(final, total)\n // assert.ok(total <= parseFloat(fromWei(reward)))\n fs.writeFileSync(\n `${process.cwd()}/week_${week}_${startBlock}-${toBlock}.json`,\n JSON.stringify(final, null, 2)\n )\n}", "title": "" }, { "docid": "50c2ef6fed2e786583932cf2eb471b9d", "score": "0.50368494", "text": "addTransaction(newTrasaction) {\r\n const { addFinananceItem } = this.context\r\n ApiFinancesService.addTransaction(newTrasaction)\r\n .then(trx => addFinananceItem(trx))\r\n .catch(error => new Error(error))\r\n }", "title": "" }, { "docid": "f98b64ec7c9d223c8bbd5782d9da7914", "score": "0.50310296", "text": "async cargarData_EntradaResi (context) {\n const data_EntradaResi = await controller.list_entrada_resi()\n context.commit('createLista_EntradaResi', data_EntradaResi)\n }", "title": "" }, { "docid": "7b97cd464d8d50cd4b1244db47aaac9b", "score": "0.50281847", "text": "async function hodl_SFI(user, amount) {\n let lp_tokens_before = await contracts.lp_token.balanceOf(user);\n await contracts.sfi.approve(contracts.team_hodl.address, amount, {from: user});\n let result = await contracts.team_hodl.hodl_SFI(amount, {from: user});\n let lp_tokens_after = await contracts.lp_token.balanceOf(user);\n\n assert(lp_tokens_before.lt(lp_tokens_after), \"lp tokens have not increased\");\n console.log(user + \" was minted \" + lp_tokens_after.sub(lp_tokens_before).toString() + \" LP tokens\");\n let logs = result.logs;\n console.log(dmpBN(getEvent(\"HodlSFI\", logs)));\n }", "title": "" }, { "docid": "d5e492aa5c4fb6d9ae90172e9cccff2a", "score": "0.5025276", "text": "async function buildLeoReport(){\n\n const VWAPdata = await requestVWAP();\n const userInfo = await getUserInfo();\n const accountSummary = await getSummaryData();\n const userName = userInfo[2];\n const userId = userInfo[0];\n const leoSummary = accountSummary[9]\n let balanceSnap\n let usdtEquiv\n let dataToAdd = {}\n let leoTable = []\n let usdtEquivSum = 0\n let usdtEquivAverage = 0\n\n try{\n for(let i = 0; i < 30; i++) {\n let timeStamp = VWAPdata[i][0]\n let leoSnapPrice = VWAPdata[i][1]\n let dateObject = new Date(timeStamp)\n let date = dateObject.toUTCString()\n let leoData = await getLeoSnapshotsData(timeStamp)\n if(leoData.length === 0)\n {\n balanceSnap = 0\n usdtEquiv = 0\n dataToAdd = {\"Timestamp\": timeStamp, \"Date\": date, \"VWAP\": leoSnapPrice, \"Balance Snapshot\": balanceSnap, \"USDt Equivalent\": usdtEquiv}\n leoTable.push(dataToAdd)\n } \n else {\n balanceSnap = leoData[0][6]\n usdtEquiv = balanceSnap * leoSnapPrice\n dataToAdd = {\"Timestamp\": timeStamp, \"Date\": date, \"VWAP\": leoSnapPrice, \"Balance Snapshot\": balanceSnap, \"USDt Equivalent\": usdtEquiv}\n usdtEquivSum = usdtEquivSum + usdtEquiv\n leoTable.push(dataToAdd)\n }\n }\n }\n catch (err) {\n console.log(err)\n }\n\n usdtEquivAverage = usdtEquivSum / 30\n console.log(leoTable)\n console.log(`Username: ${userName} UserID: ${userId}`)\n console.log(\"LEO Summary Data: \", leoSummary)\n console.log(`Sum of USDt Equivalents: ${usdtEquivSum}`)\n console.log(`30 Day Average USDT Equivalent: ${usdtEquivAverage}`)\n}", "title": "" }, { "docid": "3ebf936ad392e0023f524f0677c07a69", "score": "0.5022691", "text": "function canjearTokensCasquitos(){\n var address_from = document.getElementById(\"addressEmpleado\").innerHTML;\n var saldo = plataforma.balanceOf.call(address_from, {from: address_from, gas:30000});\n\t\tconsole.log(\"Vigilando tu saldo. Tienes \" + saldo + \" e intentas transferir 1\");\n if(parseInt(saldo) < 1){\n\t\t alert(\"¡Vaya! No tienes suficientes tokens\");\n }else{\n\t\t plataforma.canjearTokens.sendTransaction(1, {from: address_from, gas:200000},\n \t\t\tfunction (error,result){\n \t\t\t\t\tif (!error){\n \t\t\t\t\t\tvar event = plataforma.TokensEmitidos({},{fromBlock:'latest', toBlock:'latest'},\n \t\t\t\t\t\t\tfunction(error, result){\n \t\t\t\t\t\t\t\tif (!error){\n imprimir(\"OK! El empleado \" + result.args._from + \" ha canjeado 1 token a cambio de unos casquitos\");\n \t\t\t\t\t\t\t\t\tvar nuevoSaldo = plataforma.balanceOf.call(address_from, {from: address_from, gas:30000});\n \t\t\t\t\t\t\t\t\tdocument.getElementById(\"tokensEmpleado\").innerHTML = nuevoSaldo;\n \t\t\t\t\t\t\t\t}else{\n \t\t\t\t\t\t\t\t\tconsole.log(\"Error\" + error);\n \t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t});\n } else {\n console.error(\"Error\" + error);\n }\n });\n }\n }", "title": "" }, { "docid": "3bb0b41daa369862f83565d96acffe17", "score": "0.50172114", "text": "function ActualizarEstadoPrestamo() {\n var prestamos;\n if (localStorage.prestamos != null) prestamos = JSON.parse(localStorage.prestamos);\n else return;\n $.each(prestamos, function (index, prestamo) {\n var diff = ObtenerDiferenciaDias(ObtenerFechaFormatoUSA(prestamo.fecha_devolucion), ObtenerFechaFormatoUSA(ObtenerFechaHoy()));\n if(diff > 0 && prestamo.estado == 1)prestamo.estado = 2;\n if(diff < 0 && prestamo.estado == 1)prestamo.dias_restantes = Math.abs(diff);\n });\n localStorage.setItem('prestamos', JSON.stringify(prestamos));\n}", "title": "" }, { "docid": "3ff986b7e0df0d08b38b07af88f3e5ee", "score": "0.5016301", "text": "function reservasHechas(reserva) {\n \n let getStorage = localStorage.getItem(\"cantidadReservas\")\n\n if(getStorage !== null){\n cantidadReservas = JSON.parse(localStorage.getItem(\"cantidadReservas\"))\n \n }\n\n cantidadReservas.push(reserva) \n localStorage.setItem(\"cantidadReservas\", JSON.stringify(cantidadReservas))\n\n}", "title": "" }, { "docid": "de1ab65d317b065de86c6d8a31445f88", "score": "0.5014089", "text": "function atualizaPrazoFornecedor(diasSemanas, diasCorridos) {\n\n if ($scope.arrayPrazoSemana.length > 0 && diasSemanas) {\n\n apiService.post('/api/fornecedor/inserirprazosemana', $scope.arrayPrazoSemana,\n inserirPrazoSemanaSucesso,\n inserirPrazoSemanaFalha);\n\n function inserirPrazoSemanaSucesso(response) {\n\n carregaRegiaoPrazo($scope.novoFornecedor.Id);\n limpaPrazoSemanal();\n SweetAlert.swal(\"Sucesso!\", \"Prazo de entrega por dia da semana atualizado com sucesso!\", \"success\");\n\n }\n\n function inserirPrazoSemanaFalha(response) {\n console.log(response);\n if (response.status === '400')\n for (var i = 0; i < response.data.length; i++) {\n notificationService.displayInfo(response.data[i]);\n }\n\n else if (response.status == '412') {\n notificationService.displayError('Nenhuma cidade cadastrada para a Região selecionada.');\n }\n else {\n notificationService.displayError(response.statusText);\n }\n }\n\n }\n\n if (diasCorridos) {\n\n $scope.novoPrazoFornecedor = {};\n\n if ($scope.novoPrazoForn.RegiaoId == undefined) {\n $scope.novoPrazoForn.RegiaoId = 0;\n }\n\n $scope.novoPrazoFornecedor.fornecedorId = $scope.novoFornecedor.Id;\n $scope.novoPrazoFornecedor.regiaoId = $scope.novoPrazoForn.RegiaoId;\n $scope.novoPrazoFornecedor.cidadeId = $scope.novoPrazoForn.CidadeId;\n $scope.novoPrazoFornecedor.Prazo = $scope.novoPrazoForn.Prazo;\n\n apiService.post('/api/fornecedor/atualizaprazo', $scope.novoPrazoFornecedor,\n atualizaPrazoFornecedorSucesso,\n atualizaPrazoFornecedorFalha);\n\n function atualizaPrazoFornecedorSucesso(response) {\n\n $scope.regioesForn = response.data;\n $scope.allReg = false;\n SweetAlert.swal(\"Sucesso!\", \"Prazo de entrega por dias corridos atualizados com sucesso!\", \"success\");\n limpaPrazoSemanal();\n carregaRegiaoPrazo($scope.novoFornecedor.Id);\n }\n\n function atualizaPrazoFornecedorFalha(response) {\n console.log(response);\n if (response.status === '400')\n for (var i = 0; i < response.data.length; i++) {\n notificationService.displayInfo(response.data[i]);\n }\n\n else if (response.status == '412') {\n notificationService.displayError('Nenhuma cidade cadastrada para a Região selecionada.')\n }\n else {\n notificationService.displayError(response.statusText);\n }\n }\n\n\n }\n }", "title": "" }, { "docid": "5fd0daf21703614ff3e7c9555efaef01", "score": "0.5012176", "text": "MPprovisionalInvoiceGeneration_GST(month,year,financialYear,discomVar,signatureJson,FortumVar,CleanSolarVar,FocalPhotovoltaicVar,JMRseiSitara,JMRseiVolta,SEAaccounting){\r\n var discomAddress = Discom.find({discom_state: discomVar}).fetch();\r\n var addressJson = {\r\n invoice_raised_to : discomAddress[0].invoice_raised_to,\r\n discom_name: discomAddress[0].nameof_buyingutility,\r\n discom_short_name: discomAddress[0].discom_short_name,\r\n address: discomAddress[0].discom_address,\r\n address_line_two:discomAddress[0].discom_address_line_two,\r\n city: discomAddress[0].discom_city,\r\n state: 'Madhya Pradesh',\r\n pin: discomAddress[0].discom_pin,\r\n amendmentDate1: discomAddress[0].date_of_amendment_one,\r\n amendmentDate2: discomAddress[0].date_of_amendment_two,\r\n fax: discomAddress[0].discom_fax,\r\n name: signatureJson.name,\r\n designation: signatureJson.designation,\r\n full_form:signatureJson.full_form,\r\n phone:signatureJson.phone\r\n };\r\n var dateArr = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];\r\n var fromDateMonth = getArray(dateArr, Number(month));\r\n var period = fromDateMonth + \"'\" + year;\r\n var periodForInvoice = fromDateMonth.toUpperCase() + \"'\" + year;;\r\n\r\n var currentDate = new Date();\r\n var dateToInsert = moment(currentDate).format('DD-MM-YYYY');\r\n var dateToView = moment(currentDate).format(\"DD MMMM YYYY\");\r\n var myDate = moment().add(30, 'days');\r\n var dueDateToInsert = myDate.format('DD-MM-YYYY');\r\n var dueDateToView = myDate.format('DD MMMM YYYY');\r\n\r\n var numberOfGeneration = 1;\r\n var checkData = EnergyInvoiceDetails.find({discom_state:discomVar,month:month,year:year,financial_year:financialYear,type:'Provisional_Invoice', delete_status:false},{sort: {$natural: -1},limit: 1}).fetch();\r\n if(checkData.length > 0){\r\n if(checkData[0].month == month && checkData[0].year == year && checkData[0].financial_year == financialYear){\r\n numberOfGeneration = (Number(checkData[0].numberOfGeneration) + Number(1));\r\n }\r\n }\r\n var referenceNumber = 'SECI/PS/'+discomAddress[0].discom_short_name+'/'+year+\"/\"+fromDateMonth.toUpperCase()+\"/\"+ numberOfGeneration;\r\n var invoiceNumberSEIsitara = 'SECI/INTRA/'+discomAddress[0].discom_short_name+'/'+\"SEI SITARA\"+'/'+periodForInvoice+'/'+numberOfGeneration;\r\n var invoiceNumberSEIvolta= 'SECI/INTRA/'+discomAddress[0].discom_short_name+'/'+\"SEI L'VOLTA\"+'/'+periodForInvoice+'/'+numberOfGeneration;\r\n var invoiceNumberFINNsurya= 'SECI/INTRA/'+discomAddress[0].discom_short_name+'/'+\"FINNSURYA\"+'/'+periodForInvoice+'/'+numberOfGeneration;\r\n var invoiceNumberCLEANsolar= 'SECI/INTRA/'+discomAddress[0].discom_short_name+'/'+\"CLEAN SOLAR\"+'/'+periodForInvoice+'/'+numberOfGeneration;\r\n var invoiceNumberFOCALphoto= 'SECI/INTRA/'+discomAddress[0].discom_short_name+'/'+\"FOCAL PHOTO\"+'/'+periodForInvoice+'/'+numberOfGeneration;\r\n\r\n var energyInvoiceRate = InvoiceCharges.find({state:discomVar,invoice_type:'Energy_Invoice',financial_year:financialYear}).fetch();\r\n if(energyInvoiceRate.length > 0){\r\n var rate = Number(energyInvoiceRate[0].rate).toFixed(2);\r\n }else{\r\n var rate = Number(1).toFixed(2);\r\n }\r\n\r\n var jmrTotal = Number(JMRseiSitara) + Number(JMRseiVolta);\r\n var plantContributionSitra = Number(Number(JMRseiSitara)/jmrTotal * 100).toFixed(6);\r\n var plantContributionVolta = Number(Number(JMRseiVolta)/jmrTotal * 100).toFixed(6);\r\n\r\n var bifurcationOfSEAenergySitra = Number(Number(SEAaccounting) * Number(plantContributionSitra) / 100).toFixed(0);\r\n var bifurcationOfSEAenergyVolta = Number(Number(SEAaccounting) * Number(plantContributionVolta) /100).toFixed(0);\r\n var bifurcationOfSEATotal = Number(bifurcationOfSEAenergySitra) + Number(bifurcationOfSEAenergyVolta);\r\n\r\n var sitraBifurcationJson = {jmrValue:JMRseiSitara, plantContribution:plantContributionSitra, seaAccounting:SEAaccounting, bifurcationOfSEA:bifurcationOfSEAenergySitra};\r\n var voltaBifurcationJson = {jmrValue:JMRseiVolta, plantContribution:plantContributionVolta, seaAccounting:SEAaccounting, bifurcationOfSEA:bifurcationOfSEAenergyVolta};\r\n var bifurcationJson = {sitaraJson:sitraBifurcationJson, voltaJson:voltaBifurcationJson,jmr_total:jmrTotal, bifurcationOfSEATotal:bifurcationOfSEATotal};\r\n\r\n var seiSitaraTotal = Number(Number(bifurcationOfSEAenergySitra) * rate).toFixed(2);\r\n var seiSitaraTotalInComman = amountInComman(seiSitaraTotal);\r\n var seiSitaraTotalInWords = amountInWords(seiSitaraTotal);\r\n\r\n var SEIVoltaTotal = Number(Number(bifurcationOfSEAenergyVolta) * rate).toFixed(2);\r\n var SEIVoltaTotalInComman = amountInComman(SEIVoltaTotal);\r\n var SEIVoltaTotalInWords = amountInWords(SEIVoltaTotal);\r\n\r\n var FortumTotal = Number(FortumVar * rate).toFixed(2);\r\n var FortumTotalInComman = amountInComman(FortumTotal);\r\n var FortumTotalInWords = amountInWords(FortumTotal);\r\n\r\n var CleanSolarTotal = Number(CleanSolarVar * rate).toFixed(2);\r\n var CleanSolarTotalInComman = amountInComman(CleanSolarTotal);\r\n var CleanSolarTotalInWords = amountInWords(CleanSolarTotal);\r\n\r\n var FocalPhotovoltaicTotal = Number(FocalPhotovoltaicVar * rate).toFixed(2);\r\n var FocalPhotovoltaicTotalInComman = amountInComman(FocalPhotovoltaicTotal);\r\n var FocalTotalInWords = amountInWords(FocalPhotovoltaicTotal);\r\n\r\n var totalEnergy = Number(Number(bifurcationOfSEAenergySitra) + Number(bifurcationOfSEAenergyVolta) + Number(FortumVar) + Number(CleanSolarVar) + Number(FocalPhotovoltaicVar));\r\n var fianlTotal = Number(Number(seiSitaraTotal) + Number(SEIVoltaTotal) + Number(FortumTotal) + Number(CleanSolarTotal) +Number(FocalPhotovoltaicTotal)).toFixed(2);\r\n var fianlTotalInComman = amountInComman(fianlTotal);\r\n var fianlTotalInWords = amountInWords(fianlTotal);\r\n // getting spd id on the basis of array place\r\n var seiFocalIdVar = discomAddress[0].spdIds[0].spdId;\r\n var seiCleanDharIdVar = discomAddress[0].spdIds[3].spdId;\r\n var seiFortumIdVar = discomAddress[0].spdIds[4].spdId;\r\n var seiSitaraIdVar = discomAddress[0].spdIds[5].spdId;\r\n var seiVoltaIdVar = discomAddress[0].spdIds[6].spdId;\r\n\r\n var seiSitaraJson = {invoiceNumber:invoiceNumberSEIsitara, energy:bifurcationOfSEAenergySitra, spdname:'SEI Sitara Pvt. Ltd.', rate:rate, period:period, total_amount:seiSitaraTotalInComman, amount_inword:seiSitaraTotalInWords};\r\n var seiVoltaJson = {invoiceNumber:invoiceNumberSEIvolta, energy:bifurcationOfSEAenergyVolta, spdname:\"SEI L'Volta Pvt. Ltd.\", rate:rate, period:period, total_amount:SEIVoltaTotalInComman, amount_inword:SEIVoltaTotalInWords};\r\n var finnSuryaJson = {invoiceNumber:invoiceNumberFINNsurya, energy:FortumVar, spdname:'Fortum FinnSurya Energy Pvt. Ltd.', rate:rate, period:period, total_amount:FortumTotalInComman, amount_inword:FortumTotalInWords};\r\n var cleanSolarJson = {invoiceNumber:invoiceNumberCLEANsolar, energy:CleanSolarVar, spdname:'Clean Solar Power (Dhar) Pvt. LTd.', rate:rate, period:period, total_amount:CleanSolarTotalInComman, amount_inword:CleanSolarTotalInWords};\r\n var focalPhotoJson = {invoiceNumber:invoiceNumberFOCALphoto, energy:FocalPhotovoltaicVar, spdname:'Focal Photovoltaic India Pvt. Ltd.', rate:rate, period:period, total_amount:FocalPhotovoltaicTotalInComman, amount_inword:FocalTotalInWords};\r\n\r\n var invoiceCoverJson = {\r\n referenceNumber:referenceNumber,\r\n dateToView:dateToView,\r\n due_date:dueDateToView,\r\n period:period,\r\n addressJson:addressJson,\r\n seiSitaraJson:seiSitaraJson,\r\n seiVoltaJson:seiVoltaJson,\r\n finnSuryaJson:finnSuryaJson,\r\n cleanSolarJson:cleanSolarJson,\r\n focalPhotoJson:focalPhotoJson,\r\n bifurcationJson:bifurcationJson,\r\n total_amount:fianlTotalInComman,\r\n amount_inwords:fianlTotalInWords\r\n };\r\n var jsonToInsert = {\r\n reference_number: referenceNumber,\r\n invoice_number: referenceNumber,\r\n discom_id: discomAddress[0]._id,\r\n discom_name: discomAddress[0].nameof_buyingutility,\r\n discom_short_name:discomAddress[0].discom_short_name,\r\n discom_state: discomVar,\r\n energy_invoice_generation_date:dateToInsert,\r\n energy_invoice_due_date: dueDateToInsert,\r\n year: year,\r\n month: month,\r\n financial_year:financialYear,\r\n rate_per_unit:rate,\r\n total_energy:totalEnergy,\r\n total_amount:fianlTotal,\r\n numberOfGeneration: numberOfGeneration,\r\n type:'Provisional_Invoice',\r\n typeOfInvoice:'Provisional Invoice',\r\n delete_status:false,\r\n seiSitaraJson:{spdId:seiSitaraIdVar,invoice_number:invoiceNumberSEIsitara,total_energy:bifurcationOfSEAenergySitra,rate_per_unit:rate,period:period, total_amount:seiSitaraTotal},\r\n seiVoltaJson : {spdId:seiVoltaIdVar,invoice_number:invoiceNumberSEIvolta, total_energy:bifurcationOfSEAenergyVolta,rate_per_unit:rate, period:period, total_amount:SEIVoltaTotal},\r\n finnSuryaJson : {spdId:seiFortumIdVar,invoice_number:invoiceNumberFINNsurya,total_energy:FortumVar,rate_per_unit:rate, period:period, total_amount:FortumTotal},\r\n cleanSolarJson : {spdId:seiCleanDharIdVar,invoice_number:invoiceNumberCLEANsolar, total_energy:CleanSolarVar, rate_per_unit:rate, period:period, total_amount:CleanSolarTotal},\r\n focalPhotoJson : {spdId:seiFocalIdVar,invoice_number:invoiceNumberFOCALphoto, total_energy:FocalPhotovoltaicVar,rate_per_unit:rate, period:period, total_amount:FocalPhotovoltaicTotal},\r\n timestamp: new Date()\r\n };\r\n var returnJson = {invoiceCoverJson:invoiceCoverJson,jsonToInsert:jsonToInsert};\r\n\r\n var TodayDateVar = moment().format('DD-MM-YYYY');\r\n var random = Math.floor((Math.random() * 10000) + 1).toString();\r\n var pdfFileName = 'MP_Provisional_'+'_'+TodayDateVar+'_'+random;\r\n Meteor.call('GST_generatingMPProvisionalEnergyInvoicePDF',invoiceCoverJson, pdfFileName);\r\n var path = \"/upload/Invoices/InvoiceForRestAll/\"+pdfFileName+\".pdf\";\r\n var pathDocx = \"/upload/Invoices/InvoiceForRestAll/\"+pdfFileName+\".docx\";\r\n jsonToInsert.file_path = path;\r\n jsonToInsert.file_path_docx = pathDocx;\r\n // Insert Query For Rajasthan Provisional Invoice\r\n EnergyInvoiceDetails.insert(jsonToInsert);\r\n var ip = this.connection.httpHeaders['x-forwarded-for'];\r\n var ipArr = ip.split(',');\r\n var logJson = {\r\n ip_address : ipArr,\r\n log_type: 'MP Provisional Energy Invoice Generated',\r\n template_name: 'generateInvoice',\r\n event_name: 'energyBtnView',\r\n state:discomVar,\r\n json:jsonToInsert\r\n }\r\n // Send Json To insert Log Details by using insertJsonForInvoiceLog method\r\n var invoiceLog = insertJsonForInvoiceLog(logJson);\r\n return returnSuccess('Provisional Invoice Generated for '+discomVar+' for the month of '+month+\"'\"+year, path);\r\n }", "title": "" }, { "docid": "86f5c01a13b0c7cbb0950e87cfb406f9", "score": "0.50079364", "text": "function registrarEmpleado(){\n var nombre = document.getElementById(\"nombreEmpleado\").value;\n var pss = document.getElementById(\"pssEmpleado\").value;\n var nEmpleado = document.getElementById(\"numEmpleado\").value;\n var cuentaEmpresa = localStorage.getItem(\"accountEmpresa\");\n\n // En la testnet local de Alastria\n //var address = web3.personal.newAccount(pss);\n // En ganache y el nodo de la UNIR debe ponerse un indice para una cuenta disponible\n var address = accounts[2];\n\n web3.personal.unlockAccount(address, pss, 0);\n\n\t\tconsole.log(\"Cuenta empresa \" + cuentaEmpresa);\n\t\tplataforma.registrarEmpleado.sendTransaction(address, nombre, nEmpleado, {from: cuentaEmpresa, gas:200000},\n\t\t\tfunction (error,result){\n\t\t\t\tif (!error){\n\t\t\t\t\tvar event = plataforma.EmpleadoRegistrado({},{fromBlock:'latest', toBlock:'latest'},\n\t\t\t\t\t\tfunction(error, result){\n\t\t\t\t\t\t\tif (!error){\n\t\t\t\t\t\t\t\tvar msg = \"OK! Se ha creado correctamente la cuenta \" + result.args._cuenta + \" para \" +\n\t\t\t\t\t\t\t\t\tresult.args._nombre + \" con numero de empleado \" + result.args._numEmpleado + \" con contraseña \" + pss;\n\t\t\t\t\t\t imprimir(msg);\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\tconsole.log(\"Error\" + error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t \t\t\t} else {\n\t\t\t\t\tconsole.error(\"Error\" + error);\n\t\t\t\t}\n\t\t\t});\n\tweb3.personal.lockAccount(address, pss);\n }", "title": "" }, { "docid": "a4d460ee889c5861f41ea9e2b1c5cb66", "score": "0.50075626", "text": "function getSellDatas(req,res,next){ \n //le parametre de temps: MONTH (par defaut), WEEK, REPW ou REPH\n let title = \"Evolution au cours des 30 derniers jours\";\n let value = \"MONTH\";\n let type = \"DATE\";//le type de coords Y \n\n let join = \"date_trunc('day',date_retrait)=date_trunc('day',serie)\";\n let serie = `generate_series(\n now()-interval '30 days',\n now(),\n '1 day') as serie`; //par defaut, le mois en cours \n\n if(req.query.period){\n switch(req.query.period){\n case \"YEAR\":{\n serie = `generate_series(\n now()-interval '12 months',\n now(),\n '1 month') as serie`;\n join = \"date_trunc('month',date_retrait)=date_trunc('month',serie)\";\n title=\"Evolution au cours des 12 derniers mois\";\n type = \"MONTH\";\n value = \"YEAR\"\n break;\n }\n case 'WEEK':\n {\n //modifie uniquement serie \n serie = `generate_series(\n now()-interval '7 days',\n now(),\n '1 day') as serie`;\n title=\"Evolution au cours des 7 derniers jours\";\n type = \"DATE\";\n value = \"WEEK\"\n break;\n }\n case 'REPW':\n {\n join = \"extract(dow from date_retrait)=serie\";\n serie = `generate_series(\n 0,\n 6) as serie`;\n title=\"Répartition des ventes par jour de la semaine\";\n value = \"REPW\";\n type = \"DAY\";\n\n break;\n }\n case 'REPH':\n {\n join = \"extract(hour from date_retrait)=serie\";\n serie = `generate_series(\n 12,\n 23) as serie`;\n title=\"Répartition des ventes par heure de la journée\";\n value = \"REPH\";\n type = \"HOUR\";\n break;\n }\n default:break;//rien \n }\n }\n\n\n SEQ.query(`select serie, count(id)\n from commandes\n right outer join ${serie}\n on (${join})\n group by serie\n order by serie;`).then (dt=>{\n req._graph_title = title;\n req._graph_value = value;\n req._graph_type = type;\n req._sell_datas = dt[0];\n next();\n\n }).catch(err=>next(err));\n}", "title": "" }, { "docid": "4900ddab8aef7a438b0b030b9584089b", "score": "0.49975932", "text": "_restorTradeLogs() {\n this.getTrades()\n .then((items) => {\n items.forEach((item) => {\n this.logTrade({\n marketId: item.ui_id,\n price: item.ui_price * 100,\n classId: item.i_classid,\n instanceId: item.i_instanceid\n });\n });\n }).catch((error) => {\n console.error('_restorTradeLogs', error)\n });\n }", "title": "" }, { "docid": "c3b411281a992fbc7d5fa4a5f22c60e3", "score": "0.49913064", "text": "async function cadastrarAtualizarPedido(tipoRequisicao, identificacao) {\r\n let aux = true, condicaoComItens = false, condicaoSemQuantidade = true;\r\n\r\n for (let item of VETORDEITENSCLASSEPEDIDO) {\r\n if (!validaDadosCampo(['#quantidade' + item._id]) || !validaValoresCampo(['#quantidade' + item._id])) {\r\n condicaoSemQuantidade = false;\r\n mostrarCamposIncorrreto(['quantidade' + item._id]);\r\n }\r\n }\r\n\r\n try {\r\n let vetorItemSelecionadosPedido = []\r\n let json = JSON.parse(`{\r\n \"identification\":${parseInt(identificacao)},\r\n \"items\":[],\r\n \"note\":\"Nenhuma.\"\r\n }`)\r\n\r\n for (let item of VETORDEITENSCLASSEPEDIDO) {\r\n vetorItemSelecionadosPedido.push(JSON.parse(`{\"product\":\"${item._id}\",\"quantity\":${parseInt($('#quantidade' + item._id).val())},\"courtesy\":${document.getElementById('checkbox' + item._id).checked ? true : false}}`))\r\n }\r\n\r\n if (validaDadosCampo(['#observacao'])) {\r\n json.note = ($('#observacao').val()).toString()\r\n }\r\n\r\n json.items = vetorItemSelecionadosPedido\r\n\r\n if (tipoRequisicao == 'cadastrar') {\r\n if (vetorItemSelecionadosPedido[0] && condicaoSemQuantidade) {\r\n await aguardeCarregamento(true)\r\n let result = await requisicaoPOST(`orders`, json, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } });\r\n await aguardeCarregamento(false)\r\n\r\n let newOrder = JSON.parse(`{\r\n \"identification\":${result.data.order.identification},\r\n \"oldItems\": [],\r\n \"type\":true\r\n }`)\r\n\r\n await aguardeCarregamento(true)\r\n await requisicaoPOST(`printer`, newOrder, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } });\r\n await aguardeCarregamento(false)\r\n\r\n await mensagemDeAviso(\"Pedido cadastrado com sucesso!\");\r\n try {\r\n if (result.data.stockAlert[0]) {\r\n await mensagemEstoque(`O estoque referente ao (s) produto(s) (${result.data.stockAlert.join()}), está acabando, verifique o estoque!`);\r\n }\r\n } catch (error) { }\r\n await buscarPedido(identificacao);\r\n await setTimeout(function () { menuPedido(); }, 1500)\r\n\r\n } else if (vetorItemSelecionadosPedido[0]) {\r\n mensagemDeErro('Não cadastrado, item com quantidade inválida!')\r\n } else {\r\n mensagemDeErro('Não cadastrado, pedido sem item!')\r\n }\r\n\r\n } else {\r\n\r\n if (vetorItemSelecionadosPedido[0] && condicaoSemQuantidade) {\r\n\r\n await aguardeCarregamento(true)\r\n\r\n let jsonDid = await requisicaoGET(`orders/${identificacao}`, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } });\r\n let json2 = json, vetorDeItensAtualizarPedido = [];\r\n\r\n delete json2.identification\r\n\r\n let result = await requisicaoPUT(`orders/${identificacao}`, json2, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } });\r\n\r\n await aguardeCarregamento(false)\r\n\r\n for (let item of jsonDid.data.items) {\r\n vetorDeItensAtualizarPedido.push(JSON.parse(`{\r\n \"product\":\"${item.product._id}\",\r\n \"quantity\":${item.quantity},\r\n \"courtesy\":${document.getElementById('checkbox' + item.product._id).checked ? true : false}\r\n }`))\r\n }\r\n\r\n let updateOrder = JSON.parse(`{\r\n \"identification\":${identificacao},\r\n \"oldItems\": [],\r\n \"type\":false\r\n }`)\r\n\r\n updateOrder.oldItems = vetorDeItensAtualizarPedido\r\n\r\n await aguardeCarregamento(true)\r\n await requisicaoPOST(`printer`, updateOrder, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } });\r\n await aguardeCarregamento(false)\r\n\r\n try {\r\n if (result.data.stockAlert[0]) {\r\n await mensagemEstoque(`O estoque referente ao (s) produto(s) (${result.data.stockAlert.join()}), está acabando, verifique o estoque!`);\r\n }\r\n } catch (error) { }\r\n await mensagemDeAviso(\"Pedido atualizado com sucesso!\");\r\n await buscarPedido(identificacao);\r\n await setTimeout(function () { menuPedido(); }, 1500)\r\n\r\n } else if (condicaoComItens) {\r\n mensagemDeErro('Não atualizado, item com quantidade inválida!')\r\n } else {\r\n mensagemDeErro('Não atualizado, pedido sem item!')\r\n }\r\n }\r\n\r\n } catch (error) {\r\n if (tipoRequisicao == 'cadastrar') {\r\n mensagemDeAviso('Não foi possível cadastrar o pedido!');\r\n } else {\r\n mensagemDeErro('Não foi possível atualizar o pedido!')\r\n }\r\n }\r\n}", "title": "" }, { "docid": "e928aa1cc2865de74a72632d34eca0c6", "score": "0.49899858", "text": "function saveTask(){\n if($('#tema').val() !== '' && $('#descricao').val() !== '' ){\n const task = new Task(randomInt( 1, 2000) + tasks.length,false,$('#tema').val(),$('#descricao').val(),$('#startDate').val(),$('#endDate').val());\n tasks.push(task);\n localStorage.setItem('tarefas', JSON.stringify(tasks));\n this.loadList().then(response => {\n this.backToList();\n });\n }\n}", "title": "" }, { "docid": "69c081f967a8417e775bfec56548d422", "score": "0.49759996", "text": "function createEntities() {\n for (let index = 0; index < 5; index++) {\n let deadLine = new Date();\n deadLine.setDate(deadLine.getDate() + index);\n const task = {\n id: uuid(),\n title: `Title #${index + 1} (${REDIS_PREFIX})`,\n description: `That's a description for the task #${index + 1}`,\n responsible: `rcouto+${REDIS_PREFIX}${index}@ciandt.com`,\n deadLine: deadLine.toISOString().split(\"T\")[0],\n };\n redisClient.setex(task.id, 3600, JSON.stringify(task));\n }\n }", "title": "" }, { "docid": "77ae131d035567ec765fe3fbf2a4f740", "score": "0.4974487", "text": "async action(crypto, dataPeriods, currentBitcoinPrice) {\n /*\n let stopped = this.stopLoss(this.stopLossRatio);\n if (stopped) return;\n\n stopped = this.takeProfit(this.takeProfitRatio);\n if (stopped) return;\n */\n\n // calculate sma indicator\n try {\n\n if (!this.isInTrade()) {\n // BUY everytime\n return this.buy();\n } else {\n return this.hold();\n }\n } catch (e) {\n console.error(\"Err: \" + e.stack);\n process.exit(-1);\n }\n }", "title": "" }, { "docid": "66869e79179bc97292534a94c7309e49", "score": "0.4970953", "text": "share({ crystals }) {\n this.CONTRACT\n .share\n .sendTransaction(\n crystals,\n {\n \"from\": MYWeb3.getAccount(),\n \"gas\": MYWeb3.toHex(400000)\n },\n function (err, result) {}\n );\n }", "title": "" }, { "docid": "41b8dd8e3cbdb8e8da7811f9d5dff71d", "score": "0.49664044", "text": "function informacion() { \n const promiseDatos = traerDatos(1);\n\n promiseDatos.then(\n result => totalDatos().then( result => paginador(), error => console.log(error)),\n error => console.log(error)\n\n ).finally(\n /* finaly => console.log() */\n \n );\n \n }", "title": "" }, { "docid": "c88836d76c8f05bf0a104cbf21dc632e", "score": "0.49628618", "text": "function cargaEstadisticas()\n {\n \n if (!localStorage.PC_visitas) //Si no hay nada\n {\n contador_visitas = 0;\n tiempo_inicio = new Date();\n tiempo_acumulado = 0\n }\n else //There are data in localstorage\n {\n contador_visitas = JSON.parse(localStorage.PC_visitas);\n tiempo_inicio = new Date((Number(JSON.parse(localStorage.PC_tiempo))));\n tiempo_acumulado = (Number(JSON.parse(localStorage.PC_tiempo_acumulado)));\n }\n }", "title": "" }, { "docid": "c4fb3c1c7f75d32b299d6eefe3e58f3e", "score": "0.49621946", "text": "function submitStockMovementRequest() {\n fetch(`http://localhost:8080/api/reports/stock-movement/${startDate}/${endDate}`, {\n method: 'GET',\n headers: {\n 'Authorization': `bearer ${localStorage.getItem('access_token')}`\n }})\n .catch(console.error());\n alert('The report has been emailed to the manager emaail address.');\n }", "title": "" }, { "docid": "1ddce404177534f6ff64e2e84cfd5c60", "score": "0.49620917", "text": "function populate(saveCallback){\n\n let fromMAR = moment(\"10/03/2020\",\"DD/MM/YYYY\");\n for(let i=0; i < 10; i++){\n //Make 5 standard duration tasks\n //console.log(\"save?\");\n let fakeTask = new Task(\"less_done_from_MAR\");\n fakeTask.startDate = moment(fromMAR.add(1, \"d\"));\n //console.log(fakeTask.startDate);\n saveCallback(fakeTask)\n }\n\n let fromFEB = moment(\"01/02/2020\",\"DD/MM/YYYY\");\n let increasingDensityCounter = 0;\n for(let i=0; i < 60; i++){\n //Make 5 standard< duration tasks\n let fakeTask = new Task(\"almost_from_feb\");\n fakeTask.startDate = moment(fromFEB.add(1, \"d\"));\n saveCallback(fakeTask);\n increasingDensityCounter++;\n if(increasingDensityCounter === 3){\n for(let j = 0 ; j < 5; j++){\n saveCallback(fakeTask);\n }\n increasingDensityCounter = 0;\n }\n }\n\n let fromGEN = moment(\"01/01/2020\",\"DD/MM/YYYY\");\n for(let i=0; i < 260; i++){\n //Make 5 standard< duration tasks\n let fakeTask = new Task(\"most_done_from_GEN\");\n fakeTask.startDate = moment(fromGEN.add(1, \"d\"));\n saveCallback(fakeTask)\n }\n\n\n for(let i=0; i < 30; i++){\n //Make 5 standard< duration tasks\n let fakeTask = new Task(\"meanly_done_from_NOW\");\n fakeTask.startDate = moment();\n saveCallback(fakeTask)\n }\n \n}", "title": "" }, { "docid": "bfe0059f0475936b4a6eb85dc6c8aea6", "score": "0.49600416", "text": "async function dbTransfer(){\n console.log(\"running task \" + new Date())\n \n try{\n //let i = 0;\n var date = new Date();\n /* MOCK DATE */\n //var timestamp = new Date(\"2019-05-31T07:00:00.458Z\")\n //var userTimezoneOffset = timestamp.getTimezoneOffset() * 60000;\n //var date = new Date(timestamp.getTime() - userTimezoneOffset);\n /*************/\n\n var currentDate = getFormattedDate(date)\n var oneHourBackDate = getOneHourBackDate(date);\n \n\n const misurazioni = await mongodb.collection('misurazioni_aria').find({\"timestamp\": { $gte: oneHourBackDate, $lt: currentDate } }).toArray();\n console.log(misurazioni);\n //{ \"timestamp\": { $gte: oneHourBackDate, $lt: currentDate } }\n //const misurazioni = await mongodb.collection('misurazioni').find().toArray();\n //const misurazioni = [];\n //console.log(misurazioni.length)\n if(misurazioni.length != 0 && checkpoint) {\n checkpoint=false;\n for(let m of misurazioni) {\n\n var persona = await pool.query('SELECT * FROM persona WHERE persona.email = ?', m.userID)\n\n /***********************DISPOSITIVO************************/\n\n var dispositivo = await pool.query('SELECT * FROM dispositivo WHERE nome_dispositivo=?', m.source)\n\n if(dispositivo.length == 0) { //dispositivo non esiste\n var dispositivo = await pool.query('INSERT INTO dispositivo (nome_dispositivo) VALUES (?)', m.source)\n var owner = await pool.query('INSERT INTO persona_has_dispositivo (persona_idpersona, dispositivo_iddispositivo) VALUES (?,?)', [persona[0].idpersona, dispositivo.insertId])\n \n } else { //dispositivo esiste\n var owner = await pool.query('INSERT INTO persona_has_dispositivo (persona_idpersona, dispositivo_iddispositivo) VALUES (?,?)', [persona[0].idpersona, dispositivo[0].id_dispositivo])\n }\n\n /***********************GPS************************/\n var gps = await pool.query('SELECT * FROM misurazione_gps WHERE latitudine=? AND longitudine=?',[m.latitude, m.longitude])\n if(gps.length == 0) { //coord gps non esistono\n gps = await pool.query('INSERT INTO misurazione_gps (latitudine,longitudine) VALUES(?,?)',[m.latitude, m.longitude])\n gps = await pool.query('SELECT * FROM misurazione_gps WHERE latitudine=? AND longitudine=?',[m.latitude, m.longitude])\n }\n /***********************REPORT************************/\n var dispositivo_estrazione = await pool.query('SELECT * FROM dispositivo WHERE nome_dispositivo=?', m.source)\n\n var report = await pool.query('INSERT INTO report (data_report, misurazione_gps_idmisurazione_gps, persona_idpersona, dispositivo_iddispositivo) VALUES (?, ?, ?, ?)', [getSQLDate(m.timestamp), gps[0].idmisurazione_gps, persona[0].idpersona, dispositivo_estrazione[0].id_dispositivo])\n\n /***********************MISURE************************/\n var unit_measure_pm = await pool.query('SELECT * FROM unita_misura WHERE unita_misura.nome = ?',[m.PM1.unitMeasure])\n var unit_measure_temp = await pool.query('SELECT * FROM unita_misura WHERE unita_misura.nome = ?',[m.temperature.unitMeasure])\n var unit_measure_hum = await pool.query('SELECT * FROM unita_misura WHERE unita_misura.nome = ?',[m.relative_humidity.unitMeasure])\n\n /***********************PM************************/\n if(unit_measure_pm.length == 0) { //unita di misura non esiste\n unit_measure_pm = await pool.query('INSERT INTO unita_misura (nome) VALUES (?)', m.PM1.unitMeasure)\n unit_measure_pm = await pool.query('SELECT * FROM unita_misura WHERE unita_misura.nome=?', m.PM1.unitMeasure)\n }\n\n var pm1_measure = await pool.query('INSERT INTO misurazione_pm (valore, pm_type, unita_misura_idunita_misura, report_idreport, valore_max, valore_min) VALUES (?, ?, ?, ?, ?, ?)', [m.PM1.value, 'PM1', unit_measure_pm[0].idunita_misura, report.insertId, m.PM1.max_value, m.PM1.min_value])\n var pm25_measure = await pool.query('INSERT INTO misurazione_pm (valore, pm_type, unita_misura_idunita_misura, report_idreport, valore_max, valore_min) VALUES (?, ?, ?, ?, ?, ?)', [m.PM2_5.value, 'PM2.5', unit_measure_pm[0].idunita_misura, report.insertId, m.PM2_5.max_value, m.PM2_5.min_value])\n var pm10_measure = await pool.query('INSERT INTO misurazione_pm (valore, pm_type, unita_misura_idunita_misura, report_idreport, valore_max, valore_min) VALUES (?, ?, ?, ?, ?, ?)', [m.PM10.value, 'PM10', unit_measure_pm[0].idunita_misura, report.insertId, m.PM10.max_value, m.PM10.min_value])\n \n /***********************TEMPERATURE************************/\n if(unit_measure_temp.length == 0) { //unita di misura non esiste\n unit_measure_temp = await pool.query('INSERT INTO unita_misura (nome) VALUES (?)', m.temperature.unitMeasure)\n unit_measure_temp = await pool.query('SELECT * FROM unita_misura WHERE unita_misura.nome=?', m.temperature.unitMeasure)\n }\n\n var temperature_measure = await pool.query('INSERT INTO misurazione_temperatura (valore, unita_misura_idunita_misura, report_idreport, valore_max, valore_min) VALUES (?, ?, ?, ?, ?)', [m.temperature.value, unit_measure_temp[0].idunita_misura, report.insertId, m.temperature.max_value, m.temperature.min_value])\n \n /***********************HUMIDITY************************/\n if(unit_measure_hum.length == 0) { //unita di misura non esiste\n unit_measure_hum = await pool.query('INSERT INTO unita_misura (nome) VALUES (?)', m.relative_humidity.unitMeasure)\n unit_measure_hum = await pool.query('SELECT * FROM unita_misura WHERE unita_misura.nome=?', m.relative_humidity.unitMeasure)\n }\n\n var humidity_measure = await pool.query('INSERT INTO misurazione_umidità (valore, unita_misura_idunita_misura, report_idreport, valore_max, valore_min) VALUES (?, ?, ?, ?, ?)', [m.relative_humidity.value, unit_measure_hum[0].idunita_misura, report.insertId, m.relative_humidity.max_value, m.relative_humidity.min_value])\n \n }\n }\n \n checkpoint = true;\n } catch (err){\n console.log(err)\n }\n\n //console.log(\"finish\")\n }", "title": "" }, { "docid": "fe73b747f62174b85bca379dfefbdc11", "score": "0.4958074", "text": "function _0001485874468074_Reservations_Convert_to_Purchase_Cash_Payment()\n{\ntry{\n Log.AppendFolder(\"_0001485874468074_Reservations_Convert_to_Purchase_Cash_Payment\");\n InitializationEnviornment.initiliaze();\n AppLoginLogout.login();\n placeReservationOrderForMinimumPayment();\n convertReservationsToPurchase(defaultGroupName,\"Cash\");\n AppLoginLogout.logout(); \n } catch (e) {\n\t merlinLogError(\"Oops! There's some glitch in the script: \" + e.message);\t \n }\n finally { \n\t Log.PopLogFolder();\n } \n}", "title": "" }, { "docid": "86243b14f37efa22086dc5e6b99c5024", "score": "0.49518853", "text": "function processSubmit_stress() {\n // console.log('test');\n\n //var ticker = document.getElementsByClassName('token-input-token')[0].innerText.split(\",\")replace('×', '').replace('\\n', '').trim();\n var ticker = document.getElementsByClassName('token-input-token')[0].innerText.split(\",\")[0].trim()\n var daterange = document.getElementsByClassName('drp-selected')[0].innerText.split(\" - \")\n var start_split_date = daterange[0].split(\"/\")\n var startdate = `${start_split_date[2]}-${start_split_date[0]}-${start_split_date[1]}`\n\n var end_split_date = daterange[1].split(\"/\")\n var enddate = `${end_split_date[2]}-${end_split_date[0]}-${end_split_date[1]}`\n\n var amount = document.getElementById('val-number').value\n console.log(amount)\n\n gold_stress(ticker, String(startdate), String(enddate), amount)\n // console.log(`ProcessSubmit is running`)\n Invest(ticker, String(startdate), String(enddate), amount)\n falling_stress(ticker, String(startdate), String(enddate), amount)\n rising_stress(ticker, String(startdate), String(enddate), amount)\n gain_stress(ticker, String(startdate), String(enddate), amount)\n\n\n}", "title": "" }, { "docid": "81ba57bb5a6b08ca0f13fa8cf742a69c", "score": "0.4951045", "text": "function saveExpoTradeData(name, email, address, phone, products, weight, tonage, value, district, region, countryFROM, countryTO, date) {\n var newExpoTradeFlowRef = expoTradeFlowRef.push()\n\n // setting the new trade flow object\n newExpoTradeFlowRef.set({\n name: name,\n email: email,\n address: address,\n phone: phone,\n products: products,\n weight: weight,\n tonage: tonage,\n value: value,\n district: district,\n region: region,\n countryFROM: countryFROM,\n countryTO: countryTO,\n date: date\n\n });\n}", "title": "" }, { "docid": "510aa906b8d947ca168ae12d21683568", "score": "0.49499702", "text": "actualizarMantenimiento() {\n\n const fecha = this.mantenimiento.fecha.slice(0, 10);\n const mantenimiento = {\n id_mecanico: this.mantenimiento.id_mecanico,\n fecha,\n placa: this.mantenimiento.placa,\n trabajos_realizados: this.mantenimiento.trabajos_realizados,\n horas_invertidas: this.mantenimiento.horas_invertidas,\n id: this.mecanico_id_edit,\n }\n\n console.log(mantenimiento);\n const token = this.token\n axios.put(URL + \"mantenimientos/\", mantenimiento, { headers: { token } }).then(res => {\n console.log(res);\n if (this.usuario.rol == \"1\") {\n axios.put(URL + \"actualizarEstadoMoto/\" + mantenimiento.placa, { estado: \"Mantenimiento Realizado\" }, { headers: { token } }).then(res => {\n console.log(res);\n alert(\"Mantenimiento Actualizado\")\n this.recargarPagina();\n }).catch(error => {\n console.log(error);\n });\n }\n }).catch(error => {\n console.log(error);\n });\n }", "title": "" }, { "docid": "e822c8d93db2186923af2c0969d67293", "score": "0.49467707", "text": "async handle(data) {\n console.log('========== FinishTournament-job started ==========');\n\n try {\n const tournament = await Tournament.query()\n .where('uuid', data.tournament.uuid)\n .with('prizes')\n .with('matches', builder => {\n builder.where('round_number', data.last_round)\n .with('home')\n .with('away')\n .with('scores')\n })\n .first();\n\n tournament.finished_at = new Date();\n await tournament.save();\n\n // Dizi olarak geliyor ama final olduğu için tek maç olacak\n const matches = tournament.getRelated('matches').first();\n\n const approvedScore = matches.getRelated('scores').toJSON().find(n => n.is_approved);\n\n // TODO: Onaylanmış skor yoksa?\n\n let promises = [];\n\n if (approvedScore.home !== approvedScore.away) {\n promises.push(\n tournament.competitors().pivotQuery()\n .where('user_id', matches.getRelated('home').first().toJSON().id)\n .update({rank: approvedScore.home > approvedScore.away ? 1 : 2})\n );\n\n promises.push(\n tournament.competitors().pivotQuery()\n .where('user_id', matches.getRelated('away').first().toJSON().id)\n .update({rank: approvedScore.home > approvedScore.away ? 2 : 1})\n );\n } else {\n // TODO: Final maçı ise ne yapılacak\n }\n\n await Promise.all(promises);\n\n this.currency = await Currency.findByOrFail('code', 'EUR');\n this.balanceType = await TransactionType.findByOrFail('slug', 'balance-add');\n this.bonusBalanceType = await TransactionType.findByOrFail('slug', 'bonus-balance-add');\n\n this.prizePromises = [];\n\n const competitors = (await tournament.competitors().fetch()).toJSON();\n const prizes = await tournament.getRelated('prizes').toJSON();\n for (let prize of prizes) {\n await this.prizeDistribution(prize, competitors);\n }\n\n await Promise.all(this.prizePromises);\n\n console.log('========== Turnuva tamamlandı [' + data.tournament.uuid + '] ==========');\n\n } catch (e) {\n console.log(e);\n }\n }", "title": "" }, { "docid": "81a79893e89216804901e52a5ef85fb1", "score": "0.49456522", "text": "function inserirReparoInjetor(botao) {\n radios(qtd)\n busca(qtd , \" Reparo Injetor\", botao)\n}", "title": "" }, { "docid": "be776382ed0ce4509b68f314f8a466ce", "score": "0.49439058", "text": "function saveEntireAmtState()\r\n{\r\n // See if MicroLMS needs to be started\r\n if ((settings.hostname == '127.0.0.1') || (settings.hostname.toLowerCase() == 'localhost'))\r\n {\r\n settings.noconsole = true;\r\n startLms().then(saveEntireAmtState2);\r\n }\r\n else\r\n {\r\n saveEntireAmtState2();\r\n }\r\n}", "title": "" }, { "docid": "8e3e00c817d09060d5bf0205cb8cc78f", "score": "0.4937918", "text": "function guardar(puntero){\n\teliminar(puntero, TEMPORAL);\n\t// 1.Guardar el elemento en la base de datos\n\t$.post('getpost/guardaEvento.jsp', {\n\t\t'marcador':puntero.marcador,\n\t\t'tipo':puntero.tipo,\n\t\t'cantidad':puntero.cantidad,\n\t\t'nombre':puntero.nombre,\n\t\t'descripcion':puntero.descripcion,\n\t\t'info':puntero.info,\n\t\t'latitud':puntero.latitud,\n\t\t'longitud':puntero.longitud,\n\t\t'direccion':puntero.direccion,\n\t\t'size':puntero.size,\n\t\t'traffic':puntero.traffic,\n\t\t'planta':puntero.planta,\n\t\t'estado':puntero.estado,\n\t\t'idAssigned':puntero.idAssigned,\n\t\t'fecha':puntero.fecha,\n\t\t'usuario':puntero.usuario\n\t}, function(data){\n\t\tpuntero.id = $.parseJSON(data).id;\n\t\tfor(var i = 0; i < emergenciasAsociadas.length; i++){\n\t\t\tif(emergenciasAsociadas[i].valor == true){\n\t\t\t\t$.post('getpost/update.jsp', {\n\t\t\t\t\t'accion':'asociar',\n\t\t\t\t\t'fecha':puntero.fecha,\n\t\t\t\t\t'id_emergencia':emergenciasAsociadas[i].id\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\t/*for(i = 0; i < sintomas.length; i++){\n\t\t\tif(sintomas[i].valor == true){\n\t\t\t\t$.post('getpost/update.jsp', {\n\t\t\t\t\t'accion':'annadirSintoma',\n\t\t\t\t\t'fecha':puntero.fecha,\n\t\t\t\t\t'tipo_sintoma':sintomas[i].tipo\n\t\t\t\t});\n\t\t\t}\n\t\t}*/\n\t\tif(PROYECTO == 'caronte'){\n\t\t\tescribirMensaje(puntero, 'crear', 1);\n\t\t\tregistrarHistorial(userName, puntero.marcador, puntero.tipo, puntero.fecha, 'crear');\n\t\t\tlimpiar = true;\n\t\t\tlimpiarLateral(puntero.marcador);\n\t\t}\n\t});\n\n\t// 2.Borrar el elemento del mapa y la matriz temporal\n\tdelete marcadores_temporales[puntero.id];\n\n\t// 3.Recargar el mapa para que aparezca el elemento nuevo\n\t// actualizar(); // esto adelanta el timeOut a ahora mismo\n}", "title": "" }, { "docid": "6cb34a138499666f21fb15a22d5f3b8b", "score": "0.49350855", "text": "async function insertIntoDatabase(){\n return new Promise(async (resolve,reject)=>{\n //Truncate the table PowerBI.resourceID from database\n await truncateDataFromTable().then((response)=>{\n var request = new sql.Request();\n console.log(\"length\",resultantArray.length) // lenth od resultant Array\n for(let i=0;i< resultantArray.length;i+=1000){ // insert 1000 rows in a single shot\n //format the resultant array [[],[]] into ((),()) for sql query\n query = format(process.env.insertQueryPricing ,resultantArray.slice(i,i+1000));\n console.log(query)\n //Insert pricing data into database\n request.query(query, async function (err, recordset){\n if(err){\n console.log(err)\n reject(err)\n }else {\n resolve({\"status\":\"success\"})\n }\n })\n }\n\n }).catch(err=>{\n console.log(\"Error in Truncate-->\")\n reject(err)\n })\n\n})\n\n\n }", "title": "" }, { "docid": "471d1b90a1b45a24fe57af896331044c", "score": "0.49336106", "text": "async sellAllCompanyStocks(company){\n var spyPosition;\n try{\n const currentData = await this.alpaca.getPosition('SPY');\n spyPosition = currentData[\"qty\"];\n }\n catch(err){\n spyPosition = 0;\n }\n await this.submitOrder(spyPosition,company,\"sell\");\n console.log(\"***** All of \" + company + \" stocks have been sold *****\");\n }", "title": "" }, { "docid": "d929f3f5d794c03ea326b0cca6e88e26", "score": "0.4933366", "text": "async getSalesSummary(dates, filterType) {\n try{\n // CREAR UN ARRAY AUX DE TODAS LAS SUCURSALES\n\n let branchs = ( this.state.branchsData < 1 ) ? await this.fetchData() : null\n branchs = this.state.branchsData\n\n let auxPaymentsData = []\n let branchSummaryElement = {}\n\n let res = null // aca se almacena un Promise devuelto del Request a la API\n let branchSummary = null // Promise convertido a formato JSON\n\n // iniciar el ciclo de procesamiento de estadisticas para cada sucursal ...\n await Promise.all (branchs.map(\n async (branch, index) => {\n\n // OBTIENE EL RESUMEN DE VENTAS DEL DIA\n res = await api.getFinDiaFechas(dates, branch.APIKEY)\n branchSummary = await res.json()\n\n branchSummaryElement = {\n name: branch.negocio,\n\n orders: branchSummary.totales.num_cuentas,\n subtotal: branchSummary.totales.subtotal,\n itemDiscount: branchSummary.totales.item_dis,\n checkDiscount: branchSummary.totales.check_disc,\n tax: branchSummary.totales.tax,\n total: branchSummary.totales.total,\n cashPaid: branchSummary.totales.cash_paid,\n cardPaid: branchSummary.totales.card_paid,\n otherPaid: branchSummary.totales.other_paid,\n partialCreditNoteCount: branchSummary.totales.cant_nota_cred_parc,\n partialCreditNote: branchSummary.totales.nota_cred_parciales,\n creditNoteCount: branchSummary.totales.cant_nota_cred,\n creditNote: branchSummary.totales.nota_cred,\n cashIncome: branchSummary.totales.ingreso_caja,\n cashOut: branchSummary.totales.retiro_caja,\n openedOrdersCount: branchSummary.totales.cant_ord_abiertas,\n deletedOrdersCount: branchSummary.totales.cant_ord_eliminadas,\n\n }\n\n auxPaymentsData.push(branchSummaryElement)\n // return null\n } )\n )\n this.setState({paymentsData: auxPaymentsData})\n this.totalesAcumulados(auxPaymentsData, filterType);\n }catch(err){\n alert(err)\n }\n\n}", "title": "" }, { "docid": "edb365dd89c6f47ce48aff2c3e0c1769", "score": "0.49324882", "text": "function inserirCalibInjServico(botao) {\n radios(qtd)\n busca(qtd, \" Calibragem Injetor\", botao)\n}", "title": "" }, { "docid": "cdda236b7da8ad6611dc9db5ec522ef0", "score": "0.49317217", "text": "function callAVANEW(agent) { \n return new Promise((resolve, reject) => {\n \n \n let strRicerca='';\n \n let sessionId = agent.sessionId /*.split('/').pop()*/;\n console.log('dentro call ava il mio session id '+sessionId);\n //questo lo tengo perchè mi serve per recuperare parametro comando proveniente dall'agente\n var str= utf8.encode(agent.parameters.Command); \n if (str) {\n strRicerca=querystring.escape(str); //lo tengo comunque\n // options.path+=strRicerca+'&user=&pwd=&ava='+bot;\n \n console.log('il comando da passare : '+ strRicerca);\n } \n //DATA RICHIESTA: PARAM PER ELENCARE EVENTI E PER INSERIRE LA DATA DI INSERIMENTO APPUNTAMENTO\n //IN CASO DI INSERT, MI INTERESSA SOLOA LA PRIMA PARTE \t2019-04-08T15:43:45+02:00\n //FINO AL PRIMO T\n var dataRichiesta=agent.parameters.date;\n var strOutput=agent.fulfillmentText; //è la risposta statica da DF messa da Roberto\n //03/04/2019 per inserimento appuntamento\n var titoloApp=agent.parameters.any;\n //QUANDO VIENE FISSATO APPUNTAMENTO ad esempio in formato \t2019-04-06T13:00:00+02:00\n // mi interessa solo la parte dopo il T \n var dateTimeStart=agent.parameters.time; \n console.log('strOutput agente prima di EsseTre :' + strOutput + ' e con dateTimeStart '+dateTimeStart);\n //***************** /09/04/2019 PER MODIFICA, RECUPERO DATE_UPDATE E TIME_UPDATE ossia la nuova data*/\n var dateStart2=agent.parameters.date_update;\n var oraStart2=agent.parameters.time_update;\n console.log('Ho i dati per la modifica: dateStart2 '+dateStart2 + ', e oraStart2 '+oraStart2);\n /************************************** */\n \n //05/04/2019 per eliminazione: recupero il contesto per avere la data richiesta \n var ctx=agent.context.get('delappointment-followup');\n var dataDaEliminare ='';\n var titoloAppDaEliminare='';\n var startOraStartDaEliminare='';\n if (ctx){\n dataDaEliminare = ctx.parameters.date;\n titoloAppDaEliminare=ctx.parameters.any;\n oraStartDaEliminare=ctx.parameters.time;\n console.log('in contesto delappointment-followup elimino eventi in data '+dataDaEliminare +', titoloDaElim '+titoloAppDaEliminare + ', ora evento da elim '+ oraStartDaEliminare);\n \n }\n \n //IN BASE AL COMANDO ASSOCIATO ALL'INTENT ESEGUO AZIONE SU ESSETRE\n switch (strRicerca) {\n case 'getAppuntamenti':\n console.log('sono nel getAppuntamenti con data richiesta '+ dataRichiesta);\n \n var strTemp='';\n cld.listEvents(dataRichiesta).then((events)=>{\n //if (Array.isArray(events)){\n if (events.length){\n // strTemp='Il giorno '+ new Date(dataRichiesta).toDateString()+ ' hai questi appuntamenti:\\n';\n for(var i=0; i<events.length; i++){\n var start=cld.getLocaleDateString(new Date(events[i].start.dateTime));\n \n console.log('----- con toLocaleString '+ start);\n \n strTemp+= events[i].summary +' alle ore ' + cld.getLocaleTimeString(new Date(events[i].start.dateTime)) +'\\n';\n console.log('strTemp ' + strTemp);\n }\n } // fine if\n else{\n\n strTemp='Non ho trovato eventi per la data ' +new Date(dataRichiesta).toDateString();\n }\n var str=strOutput;\n str=str.replace(/(@)/gi, strTemp);\n strOutput=str;\n agent.add(strOutput);\n console.log('strOutput con replace '+ strOutput);\n //agent.add(strTemp);\n resolve(agent);\n }).catch((error) => {\n console.log('Si è verificato errore in listEvents: ' +error);\n\n });\n //listAppointment(agent);\n break;\n //03/04/2019\n case 'creaAppuntamento':\n console.log('sono nel creaAppuntamento con data richiesta '+ dataRichiesta + ', titolo '+ titoloApp + ' e con dateTimeStart '+dateTimeStart);\n //data richiesta 2019-04-05T12:00:00+02:00, titolo Marco e con orario 2019-04-05T09:00:00+02:00\n var strTemp='';\n var titolo=utf8.encode(titoloApp);\n // console.log('Il tipo di dateTimeStart =' +typeof dateTimeStart); //è una stringa\n \n \n //return new Date(new Date(dateObj).setHours(dateObj.getHours() + hoursToAdd));\n //console.log('*********dateTimeStart '+dateTimeStart);\n cld.createAppointment(dataRichiesta,dateTimeStart,titolo).then((event)=>{\n console.log('ho inserito appuntamento in calendario con id ' +event.data.id); // -> da event.eventId a event.id o event.data.id\n\n strTemp= event.data.id;\n var str=strOutput;\n str=str.replace(/(@)/gi, strTemp);\n strOutput=str;\n agent.add(strOutput);\n console.log('strOutput con replace '+ strOutput);\n \n resolve(agent);\n\n }).catch((error) => {\n console.log('Si è verificato errore in creaAppuntamento: ' +error);\n agent.add('Ops...' +error);\n resolve(agent);\n });\n break;\n //05/04/2019 eliminare evento\n case 'deleteAppointment':\n //recupero la lista degli eventi per la data richiesta\n //la recupero dal contesto\n \n console.log('sono in deleteAppointment');\n if (titoloAppDaEliminare && oraStartDaEliminare){\n console.log('ELIMINAZIONE SINGOLA: titolo '+ titoloAppDaEliminare + ', data da eliminare '+ oraStartDaEliminare);\n cld.getEventByIdEdit(dataDaEliminare,oraStartDaEliminare,titoloAppDaEliminare).then((event)=>{\n if (event.length){\n console.log('event è un array...')\n var id=[]; //deve essere un array di stringhe\n id[0]=event[0].id;\n \n console.log('ho recuperato evento con id PER ELIMINAZIONE SINGOLA: ' +id[0]);\n \n \n cld.deleteEvents(id).then((strId)=>{ \n \n \n agent.add('Ho eliminato evento con id '+id); //\n resolve(agent);\n\n }).catch((error) => {\n console.log('Si è verificato errore in deleteAppointment: ' +error);\n agent.add('Ops...' +error);\n resolve(agent);\n });\n \n } \n });\n }else{ //ELIMINAZIONE BATCH \n cld.getEventsForDelete(dataDaEliminare).then((arIDs)=>{\n console.log('sono in getEventsForDelete (BATCH) con dataDaEliminare '+ dataDaEliminare);\n //elimino effettivamente gli eventi tramite id\n if (arIDs.length){\n console.log('sto per eliminare evt e arIDs.length = ' +arIDs.length);\n //commentato in data 18/04/2019\n /* for (var i=0;i<arIDs.length;i++){\n console.log('sto eliminando id evento : ' +arIDs[i]);\n \n calendar.events.delete({\n auth: serviceAccountAuth,\n calendarId: calendarId,\n eventId:arIDs[i]\n });*/\n cld.deleteEvents(arIDs).then((strId)=>{ \n \n \n agent.add('Eliminato tutti gli eventi, cosa vuoi fare ora?'); \n resolve(agent);\n \n }).catch((error) => {\n console.log('Si è verificato errore in (BATCH) deleteAppointment: ' +error);\n agent.add('Ops...' +error);\n resolve(agent);\n });\n // }//chiudo for\n }//chiudo if\n\n else {\n console.log('arIDs non pervenuto ');\n \n }\n /*console.log('eliminazione avvenuta');\n agent.add('eliminazione avvenuta. Cosa vuoi fare ora?');\n resolve(agent);*/\n\n }).catch((error) => {\n console.log('Si è verificato errore in deleteAppointment: ' +error);\n agent.add('Ops...' +error);\n resolve(agent);\n });\n }\n \n \n\n break;\n //28/01/2019 AGGIUNTO ANCHE LO STOP\n //08/04/2019 UPDATE MODIFICA APPUNTAMENTO PER ID EVENTO\n //prima recupero id e poi faccio update\n case 'updateAppuntamento':\n console.log('sono in updateAppuntamento');\n\n var options={\n weekday: 'long', month: 'long', hour12: false, day: 'numeric', timeZone: 'Europe/Rome' , timeZoneOffset:'+02:00',\n }\n\n cld.getEventByIdEdit(dataRichiesta,dateTimeStart,titoloApp).then((event)=>{\n if (event.length){\n var id=event[0].id;\n console.log('ho recuperato evento con id ' +id); \n cld.getUpdate(id, dateStart2,oraStart2,titoloApp).then((strId)=>{\n \n //agent.add('ok spostato appuntamento ' +titoloApp +' in DATA ' + new Date(dateStart2).toLocaleDateString('it-IT') +', alle ORE '+nndata);\n agent.add(strOutput);\n resolve(agent);\n\n }).catch((error) => {\n console.log('Si è verificato errore in getUpdate: ' +error);\n agent.add('Ops...' +error);\n resolve(agent);\n });\n \n }\n \n\n //questo ok\n \n \n }).catch((error) => {\n console.log('Si è verificato errore in updateAppuntamento: ' +error);\n agent.add('Ops...' +error);\n resolve(agent);\n });\n\n\n break;\n case 'STOP':\n if (agent.requestSource==\"ACTIONS_ON_GOOGLE\"){\n \n \n\n let conv = agent.conv();\n \n console.log(' ---- la conversazione PRIMA ----- ' + JSON.stringify(conv));\n \n conv.close(strOutput);\n console.log(' ---- la conversazione DOPO CHIUSURA ----- ' + JSON.stringify(conv));\n \n agent.add(conv);\n //altrimenti ritorna la strOutput\n } else{\n agent.add(strOutput);\n }\n resolve(agent);\n break;\n \n default:\n //console.log('nel default ho solo strOutput :' +responseFromPlq.strOutput);\n console.log('nel default ');\n agent.add('sono nel default');\n resolve(agent);\n break;\n } //fine switch\n \n /* agent.add('il comando è '+ tmp[0]);\n resolve(agent);*/\n \n }).catch((error) => {\n \n console.log('errore '+ error);\n \n }); \n // });\n \n}", "title": "" }, { "docid": "322ebf6e0c24a6c78f87ff634cd77472", "score": "0.4926286", "text": "function simulate() {\n //document.getElementById(\"loader\").style.cursor = \"progress\";\n sims = sims + 1; \n document.getElementById(\"simcount\").innerText = sims;\n var mau = document.getElementById(\"mau\");//monthly active users\n var cps = document.getElementById(\"cps\");//cost per sms\n var res = document.getElementById(\"res\");//possible result\n var grt = document.getElementById(\"grt\");//growth rate\n var scpu = document.getElementById(\"scpu\");//possible result\n\n var ttra = document.getElementById(\"ttra\");//total transaction in ₦\n var yfore = document.getElementById(\"yfore\");//revenue prediction for the year in ₦\n var rev = document.getElementById(\"rev\");//revenue in ₦\n var peru = document.getElementById(\"peru\");//average transaction per user in ₦\n var nuse = document.getElementById(\"nuse\");//Number of users\n var grb = document.getElementById(\"grb\");//budget for growth activities ₦\n var ttra2 = document.getElementById(\"ttra2\");//total transaction in $\n var yfore2 = document.getElementById(\"yfore2\");//revenue prediction for the year in $\n var rev2 = document.getElementById(\"rev2\");//revenue in $\n var peru2 = document.getElementById(\"peru2\");//average transaction per user in $\n var nuse2 = document.getElementById(\"nuse2\");//Number of users\n var grb2 = document.getElementById(\"grb2\");//budget for growth activities $\n\n if (mau.value == \"\"){\n mau.value = 1;\n }\n if (cps.value == \"\"){\n cps.value = 4;\n }\n if (grt.value == \"\"){\n grt.value = 100;\n }\n\n //Input\n var users = parseInt(mau.value);\n var smscost = parseInt(cps.value);\n var posres = res.value;\n var noftra;\n var losstra;\n var totalamount;\n var revenue;\n\n transactions(users, smscost, posres, noftra, losstra, totalamount, revenue);\n mau.value = Math.ceil((1+parseFloat((grt.value/100))) * users);\n}", "title": "" }, { "docid": "f10ea915b79f5ef6dd27bef50a4172c4", "score": "0.49236903", "text": "async function approveInvoice(addressSale, index) {\n let id = await web3.eth.net.getId();\n let deployedNetwork = PoolRBAC.networks[id];\n let pool = new web3.eth.Contract(PoolRBAC.abi, deployedNetwork.address);\n let accounts = await web3.eth.getAccounts();\n let gasLimit = await pool.methods.approve(addressSale).estimateGas({from: accounts[index]});\n console.log(await pool.methods.approve(addressSale).send({from: accounts[index], gas: gasLimit})); \n}", "title": "" }, { "docid": "01528f99899e861e37c8e4d8cbab08f5", "score": "0.49212274", "text": "function ordenOut() {\n\tvar today = formatDate(new Date());\n\tdb.any('select * from orden where idestado = 4')\n\t.then(function (ordenes) {\n\t\tfor (i=0; i<ordenes.length; i++) {\n\t\t\tordenes[i].f_estimada = formatDate(new Date(ordenes[i].f_estimada));\n\t\t\tif (ordenes[i].f_estimada == today ) {\n\t\t\t\tdb.none('update orden set idestado=2 where gid=$1', ordenes[i].gid)\n\t\t\t}\n\t\t}\n\t})\n\t.catch(function(error) {next(error);});\n}", "title": "" }, { "docid": "64546155042320b0b5053a195b954fc8", "score": "0.4921029", "text": "function GuardarGestionMitrol(idInteraccion, idcrm, idResultadoGestionExterno) {\n\n\n\n\n //=============================================================\n // MENSAJE \n //=============================================================\n var MENSAJE = \" (GUARDANDO GESTIÓN DISCADOR...) \";\n\n\n\n\n //=============================================================\n // PARAMETROS DE FUNCION URL \n //=============================================================\n var PARAMETROS = {\n idInteraccion: encodeURIComponent(idInteraccion),\n idResultadoGestionExterno: encodeURIComponent(idResultadoGestionExterno),\n IdCRM: encodeURIComponent(idcrm)\n };\n\n //=============================================================\n // URL \n //=============================================================\n var URL = 'http://127.0.0.1:8546/api/setGestion?format=json';\n\n\n //=============================================================\n // LLAMADA AJAX A SERVICIO DEBE POSEER UN DIV LLAMADO RESULTADO \n // PARA MOSTRA AVANCES \n //=============================================================\n $.ajax({\n data: PARAMETROS,\n url: URL,\n dataType: \"json\",\n type: 'GET',\n async: false\n\n\n\n //=========================================================\n //=========================================================\n , beforeSend: function () {\n LOG_API(\"PROCESANDO, \" + MENSAJE);\n }\n //=========================================================\n // PROCESO DE TERMINADO\n //=========================================================\n , success: function (response) {\n\n LOG_API(\"REALIZADO, \" + MENSAJE);\n\n }\n //=========================================================\n // ERROR\n //=========================================================\n , error: function (xhr, textStatus, thrownError) {\n\n\n\n //=====================================================\n //=====================================================\n if (xhr.status === 0) {\n\n LOG_API(MENSAJE + \" NO EXISTE CONECCIÓN VERIFIQUE DIRECCION URL\");\n return;\n }\n //=====================================================\n //=====================================================\n if (xhr.status === 404) {\n\n LOG_API(MENSAJE + \" NO EXISTE REFERENCIA DE LA URL\");\n return;\n }\n //=====================================================\n //=====================================================\n if (xhr.status === 500) {\n\n LOG_API(MENSAJE + \" ERROR INTERNO DE SERVIDOR\");\n return;\n }\n //=====================================================\n //=====================================================\n if (textStatus === 'parsererror') {\n\n LOG_API(MENSAJE + \" FALLAS REQUEST JSON\");\n return;\n }\n //=====================================================\n //=====================================================\n if (textStatus === 'timeout') {\n\n LOG_API(MENSAJE + \" TIME OUT\");\n return;\n }\n //=====================================================\n //=====================================================\n if (textStatus === 'abort') {\n LOG_API(MENSAJE + \" AJAX REQUEST ABORTADO\");\n return;\n }\n\n\n\n LOG_API(MENSAJE + \" ERROR NO CONTROLADO\");\n }\n\n });\n}", "title": "" }, { "docid": "bd0c22f939e00fb785a0768a3efc207a", "score": "0.49209392", "text": "async function testScriptPersistingStep(\n orderedCustoMRules,\n idShop,\n idScript,\n put_request,\n snapShop_Shop_Param,\n locale,\n formats\n) {\n /* **************************************** */\n /* ********** Chunk Management ***********/\n /* **************************************** */\n\n // Counting the number of cards concerned by this script\n\n // Getting all info to build the SQL request\n\n /* FORMAT FILTER */\n //Building format dictionnary as a hashmap\n const formatDictionnary = await utils.getFormatsAndReturnHashtable();\n\n let formatFilter = {};\n\n for (let i = 0; i < formats.length; i++) {\n formatFilter[\"isLegal\" + formatDictionnary[formats[i]]] = 1;\n }\n\n /* KEYWORDS FILTER */\n const allKeywordsUsed = await db.snapshot_keyword.findAll({\n where: {\n PUT_Request_id: put_request.dataValues.id,\n },\n });\n\n const filteredKeywords = allKeywordsUsed.map((keyword) => keyword.name);\n\n /* RARITY FILTER */\n const allRaritiesUsed = await db.snapshot_rarity.findAll({\n where: {\n PUT_Request_id: put_request.dataValues.id,\n },\n });\n\n let organizedRarities = [];\n for (let i = 0; i < allRaritiesUsed.length; i++) {\n organizedRarities = [...organizedRarities, allRaritiesUsed[i].name];\n }\n\n /* EXPANSION FILTER */\n const allExpansionsUsed = await db.snapshot_expansion.findAll({\n where: {\n PUT_Request_id: put_request.dataValues.id,\n },\n });\n\n const expansionList = allExpansionsUsed.map((expansion) => expansion.name);\n\n // Are we targeting, avoiding, or ignoring keywords ?\n const put_request_keyword_behaviour = put_request.dataValues.keywordBehaviour;\n\n // Defining on which price is based the put request\n const pricedBasedOn = put_request.dataValues.hasPriceBasedOn;\n\n // Relevant Sequelize request is built\n const relevantRequest = generateRelevantRequest(\n idShop,\n db,\n Op,\n formatFilter,\n put_request_keyword_behaviour,\n filteredKeywords,\n organizedRarities,\n expansionList\n );\n\n const numberOfCardsToHandle = await db.MkmProduct.findAndCountAll(\n relevantRequest,\n {}\n );\n\n const shopData = await retrieveAsAdmin(\n `${process.env.REACT_APP_MTGAPI_URL}/shops/${idShop}`,\n \"get\"\n );\n\n // Saving by chunks\n const chunkSize = 100;\n const numberOfIterations = Math.ceil(numberOfCardsToHandle.count / chunkSize);\n\n // console.log(\n // `--------with a chunk of ${chunkSize}, we will iterate ${numberOfIterations} times, because we are handling ${numberOfCardsToHandle.count} cards.`\n // );\n\n /* Shortcut to end the script */\n if (numberOfCardsToHandle.count === 0) {\n console.log(\"No MKM Product on this test script.\");\n\n // Marking PUT Request as successful\n await db.PUT_Request.markAsFinishedWith0MKMProducts(\n put_request.dataValues.id\n );\n\n // Marking Script as available\n await db.Script.markAsNotRunning(idScript);\n\n await PDFGeneration.generatePDFFromPutRequest(\n put_request.dataValues.id,\n idScript,\n locale,\n false\n );\n\n await sendEmail(\n \"testScriptHad0card\",\n idShop,\n shopData.data.email,\n { idScript },\n locale\n );\n\n return;\n }\n\n //We are getting all MKM Priceguide Definition to be able to know which mkm price the user chose.\n const mkmPricesDefinitions = await db.PriceGuideDefinitions.findAll();\n\n //We transform the array into a dictionnary (hashmap) to browse it in constant time\n const mkmPricesGuideDictionnary = utils.transformArrayIntoDictionnaryWithKey(\n mkmPricesDefinitions.map((definition) => definition.dataValues)\n );\n\n for (let i = 0; i < numberOfIterations; i++) {\n //choper les 100 premières cartes (en ajusant offset à chaque iteration )\n const chunkOfCards = await db.MkmProduct.findAll(relevantRequest, {\n offset: i * chunkSize,\n limit: chunkSize,\n });\n\n //Morphing the rules into an array of array with prices sorted, to make them browsable in log(n)\n const arrayOfSortedRulesRegular = customRulesController.transformCustomRulesIntoBrowsableArray(\n orderedCustoMRules.regular\n );\n const arrayOfSortedRulesFoil = customRulesController.transformCustomRulesIntoBrowsableArray(\n orderedCustoMRules.foil\n );\n\n let action;\n //For each card, we will process the price, check if we update it or not\n for (let j = 0; j < chunkOfCards.length; j++) {\n const card = chunkOfCards[j].dataValues;\n\n // If the card is Signed / Altered / Signed, we skip it.\n if (card.isSigned === 1 || card.isAltered === 1 || card.isPlayset === 1) {\n let reasonForExcluding;\n if (card.isSigned === 1) {\n reasonForExcluding = \"Excluded - Signed\";\n } else if (card.isAltered === 1) {\n reasonForExcluding = \"Excluded - Altered\";\n } else if (card.isPlayset === 1) {\n reasonForExcluding = \"Excluded - Playset\";\n }\n\n await db.put_memory.create({\n idScript: idScript,\n idProduct: card.idProduct,\n idArticle: card.idArticle,\n cardName: card.englishName,\n priceShieldBlocked: 0,\n oldPrice: card.price,\n newPrice: card.price,\n condition: transformConditionStringIntoInteger(card.condition),\n lang: card.language,\n isFoil: card.isFoil,\n isSigned: card.isSigned,\n isPlayset: card.isPlayset,\n amount: card.amount,\n behaviourChosen: reasonForExcluding,\n idCustomRuleUsed: 0,\n PUT_Request_id: put_request.dataValues.id,\n });\n continue;\n }\n\n // console.log(\"size of our card : \", sizeof(chunkOfCards[j]));\n\n const priceguide = await db.priceguide.findOne({\n where: {\n idProduct: card.idProduct,\n },\n });\n\n if (priceguide === null) {\n await db.put_memory.create({\n idScript: idScript,\n idProduct: card.idProduct,\n idArticle: card.idArticle,\n cardName: card.englishName,\n priceShieldBlocked: 0,\n oldPrice: card.price,\n newPrice: card.price,\n condition: transformConditionStringIntoInteger(card.condition),\n lang: card.language,\n isFoil: card.isFoil,\n isSigned: card.isSigned,\n isPlayset: 0,\n amount: card.amount,\n behaviourChosen: \"No Priceguide for this productLegality\",\n idCustomRuleUsed: action.idSnapShotCustomRule,\n PUT_Request_id: put_request.dataValues.id,\n });\n continue;\n }\n\n const pricedBasedOn = put_request.dataValues.hasPriceBasedOn;\n\n let relevantTrend =\n card.isFoil === 0\n ? priceguide.dataValues.trendPrice\n : priceguide.dataValues.foilTrend;\n\n // Relevant price can be either MKM trend chosen (foil or regular), or the former price\n let numberBaseToFindRelevantRule;\n if (pricedBasedOn === \"mkmTrends\") {\n numberBaseToFindRelevantRule = relevantTrend;\n } else if (pricedBasedOn === \"oldPrices\") {\n numberBaseToFindRelevantRule = card.price;\n } else {\n console.error(\n \"Coulnt find a relevant pricedBasedOn value. Currently contains :\",\n pricedBasedOn\n );\n }\n\n if (card.isFoil === 0) {\n action = priceUpdateAPI.findTheRightPriceRange(\n arrayOfSortedRulesRegular,\n numberBaseToFindRelevantRule\n );\n } else if (card.isFoil === 1) {\n action = priceUpdateAPI.findTheRightPriceRange(\n arrayOfSortedRulesFoil,\n numberBaseToFindRelevantRule\n );\n } else {\n throw new Error(\"A card was missing the isFoil prop.\");\n }\n\n // console.log(\"reminder of the card\", card);\n // console.log(\"action for that card\", action);\n\n if (action === -2) {\n //Price is not updated : we just write it\n // console.log(\"we are in action : -2\");\n await db.put_memory.create({\n idScript: idScript,\n idProduct: card.idProduct,\n idArticle: card.idArticle,\n cardName: card.englishName,\n priceShieldBlocked: 0,\n oldPrice: card.price,\n newPrice: card.price,\n condition: transformConditionStringIntoInteger(card.condition),\n lang: card.language,\n isFoil: card.isFoil,\n isSigned: card.isSigned,\n isPlayset: 0,\n amount: card.amount,\n behaviourChosen: \"No corresponding Custom Rule\",\n idCustomRuleUsed: action.idSnapShotCustomRule,\n PUT_Request_id: put_request.dataValues.id,\n });\n } else if (typeof action === \"object\") {\n if (action.ruleTypeId === 1) {\n // console.log(\"we are in ruletype 1\");\n // set value behaviour\n // get the price guide for this card\n\n let newPrice = action.priceRangeValueToSet;\n\n // MKM Trends price particularity\n // On old price, this coefficient has already been applied\n if (pricedBasedOn === \"mkmTrends\") {\n // We update the price depending on condition and language of the card, with shop params\n newPrice = priceUpdateAPI.calculatePriceWithLanguageAndConditionSpecifics(\n newPrice,\n card.language,\n card.condition,\n card.isFoil,\n snapShop_Shop_Param.dataValues\n );\n }\n\n /* MKM minimum selling price is 0.02€. */\n if (newPrice < 0.02) {\n newPrice = 0.02;\n }\n\n //After price was defined, we pass it into the price shield\n const priceShieldTest = priceUpdateAPI.priceShieldAllows(\n card.price,\n newPrice,\n relevantTrend,\n card.condition\n );\n\n // priceshield\n if (priceShieldTest.result) {\n // Price Shield allows the rule\n //PUT memory with change\n await db.put_memory.create({\n idScript: idScript,\n idProduct: card.idProduct,\n idArticle: card.idArticle,\n cardName: card.englishName,\n oldPrice: card.price,\n newPrice: newPrice,\n priceShieldBlocked: 0,\n regularCardsTrend: card.isFoil === 0 ? relevantTrend : null,\n foilCardsTrend: card.isFoil === 0 ? null : relevantTrend,\n condition: transformConditionStringIntoInteger(card.condition),\n lang: card.language,\n isFoil: card.isFoil,\n isSigned: card.isSigned,\n amount: card.amount,\n isPlayset: 0,\n behaviourChosen: \"Set Value\",\n idCustomRuleUsed: action.idSnapShotCustomRule,\n PUT_Request_id: put_request.dataValues.id,\n });\n } else {\n // Price Shield blocked the rule\n await db.put_memory.create({\n idScript: idScript,\n idProduct: card.idProduct,\n idArticle: card.idArticle,\n cardName: card.englishName,\n regularCardsTrend: card.isFoil === 0 ? relevantTrend : null,\n foilCardsTrend: card.isFoil === 0 ? null : relevantTrend,\n oldPrice: card.price,\n newPrice: newPrice,\n priceShieldBlocked: 1,\n priceShieldReason: priceShieldTest.reason,\n condition: transformConditionStringIntoInteger(card.condition),\n lang: card.language,\n isFoil: card.isFoil,\n isSigned: card.isSigned,\n isPlayset: 0,\n amount: card.amount,\n behaviourChosen: \"Price Shield Blocked Set Value\",\n idCustomRuleUsed: action.idSnapShotCustomRule,\n PUT_Request_id: put_request.dataValues.id,\n });\n }\n } else if (action.ruleTypeId === 2) {\n // operations based action\n\n const actionName =\n action.customRule_behaviour_definition.dataValues.name;\n const actionType =\n action.customRule_behaviour_definition.dataValues.type;\n const actionSense =\n action.customRule_behaviour_definition.dataValues.sense;\n const actionCoefficient =\n action.customRule_behaviour_definition.dataValues.coefficient;\n\n let newPrice;\n let priceguideRefUsedByUser =\n priceguide?.dataValues?.[\n mkmPricesGuideDictionnary?.[action?.mkmPriceGuideReference]?.name\n ];\n\n // Here we check if we base our calculus on MKM or shop existing prices.\n let numberBaseToWorkOn;\n if (pricedBasedOn === \"mkmTrends\") {\n numberBaseToWorkOn = priceguideRefUsedByUser;\n } else if (pricedBasedOn === \"oldPrices\") {\n numberBaseToWorkOn = card.price;\n } else {\n console.error(\n \"Coulnt find a relevant pricedBasedOn value. Currently contains :\",\n pricedBasedOn\n );\n }\n\n //We check if this number to work on exists (price guide is sometimes empty, or old card price couln't be read) before trying to work with it.\n if (!numberBaseToWorkOn) {\n await db.put_memory.create({\n idScript: idScript,\n idProduct: card.idProduct,\n idArticle: card.idArticle,\n cardName: card.englishName,\n priceShieldBlocked: 0,\n oldPrice: card.price,\n newPrice: card.price,\n condition: transformConditionStringIntoInteger(card.condition),\n lang: card.language,\n isFoil: card.isFoil,\n isSigned: card.isSigned,\n isPlayset: 0,\n amount: card.amount,\n behaviourChosen: \"No Base number to work on\",\n idCustomRuleUsed: action.idSnapShotCustomRule,\n PUT_Request_id: put_request.dataValues.id,\n });\n continue;\n }\n\n if (actionType === \"percent\") {\n //Browsing data on the rule to choose the right price to apply to the card\n\n if (actionSense === \"up\") {\n //Round up in % the number chosen in reference\n newPrice = priceUpdateAPI.roundUpPercent(\n numberBaseToWorkOn,\n actionCoefficient\n );\n } else if (actionSense === \"down\") {\n //arrondir down %\n newPrice = priceUpdateAPI.roundDownPercent(\n numberBaseToWorkOn,\n actionCoefficient\n );\n } else {\n throw new Error(\"No action sense (up or down) were precised.\");\n }\n } else if (actionType === \"number\") {\n if (actionSense === \"up\") {\n //modulo up\n newPrice = priceUpdateAPI.roundUpNumber(\n numberBaseToWorkOn,\n actionCoefficient\n );\n } else if (actionSense === \"down\") {\n //modulo down\n newPrice = priceUpdateAPI.roundDownNumber(\n numberBaseToWorkOn,\n actionCoefficient\n );\n } else {\n throw new Error(\"No action sense (up or down) were precised.\");\n }\n } else {\n throw new Error(\n \"Action type wasn't precised on behaviour in custom rule.\"\n );\n }\n\n // MKM Trends price particularity\n // On old price, this coefficient has already been applied\n if (pricedBasedOn === \"mkmTrends\") {\n // We update the price depending on condition and language of the card, with shop params\n newPrice = priceUpdateAPI.calculatePriceWithLanguageAndConditionSpecifics(\n newPrice,\n card.language,\n card.condition,\n card.isFoil,\n snapShop_Shop_Param.dataValues\n );\n }\n\n /* MKM minimum selling price is 0.02€. */\n if (newPrice < 0.02) {\n newPrice = 0.02;\n }\n\n //After price was defined, we pass it into the price shield\n\n const priceShieldTest = priceUpdateAPI.priceShieldAllows(\n card.price,\n newPrice,\n priceguideRefUsedByUser,\n card.condition\n );\n if (priceShieldTest.result) {\n // console.log(\"new price:\", newPrice);\n //PUT memory with change\n //Save with new price\n await db.put_memory.create({\n idScript: idScript,\n idProduct: card.idProduct,\n idArticle: card.idArticle,\n cardName: card.englishName,\n regularCardsTrend: card.isFoil === 0 ? relevantTrend : null,\n foilCardsTrend: card.isFoil === 0 ? null : relevantTrend,\n oldPrice: card.price,\n newPrice: newPrice,\n numberUserChoseToUse: numberBaseToWorkOn,\n priceShieldBlocked: 0,\n priceShieldReason: null,\n condition: transformConditionStringIntoInteger(card.condition),\n lang: card.language,\n isFoil: card.isFoil,\n isSigned: card.isSigned,\n isPlayset: 0,\n amount: card.amount,\n behaviourChosen: actionName,\n idCustomRuleUsed: action.idSnapShotCustomRule,\n PUT_Request_id: put_request.dataValues.id,\n });\n } else {\n //PUT memory explaining why it didnt go for it\n await db.put_memory.create({\n idScript: idScript,\n idProduct: card.idProduct,\n idArticle: card.idArticle,\n cardName: card.englishName,\n regularCardsTrend: card.isFoil === 0 ? relevantTrend : null,\n foilCardsTrend: card.isFoil === 0 ? null : relevantTrend,\n oldPrice: card.price,\n newPrice: newPrice,\n numberUserChoseToUse: numberBaseToWorkOn,\n priceShieldBlocked: 1,\n priceShieldReason: priceShieldTest.reason,\n condition: transformConditionStringIntoInteger(card.condition),\n lang: card.language,\n isFoil: card.isFoil,\n isSigned: card.isSigned,\n isPlayset: 0,\n amount: card.amount,\n behaviourChosen: \"Price Shield Blocked \" + actionName,\n idCustomRuleUsed: action.idSnapShotCustomRule,\n PUT_Request_id: put_request.dataValues.id,\n });\n }\n } else if (action.ruleTypeId === 3) {\n // exclude\n await db.put_memory.create({\n idScript: idScript,\n idProduct: card.idProduct,\n idArticle: card.idArticle,\n cardName: card.englishName,\n regularCardsTrend: card.isFoil === 0 ? relevantTrend : null,\n foilCardsTrend: card.isFoil === 0 ? null : relevantTrend,\n priceShieldBlocked: 0,\n oldPrice: card.price,\n newPrice: card.price,\n condition: transformConditionStringIntoInteger(card.condition),\n lang: card.language,\n isFoil: card.isFoil,\n isSigned: card.isSigned,\n isPlayset: 0,\n amount: card.amount,\n behaviourChosen: \"Excluded\",\n idCustomRuleUsed: action.idSnapShotCustomRule,\n PUT_Request_id: put_request.dataValues.id,\n });\n }\n } else {\n throw new Error(\"No adapted behaviour found for the current card.\");\n }\n }\n\n // Step End of Loop, nearly end of script\n\n // Marking PUT Request as successful\n await db.PUT_Request.markAsFinishedSuccessfully(put_request.dataValues.id);\n\n if (pricedBasedOn === \"oldPrices\") {\n const updateUser = await db.User.passStockAsShouldBeRefreshed(idShop);\n }\n\n // Marking Script as available\n await db.Script.markAsNotRunning(idScript);\n\n await PDFGeneration.generatePDFFromPutRequest(\n put_request.dataValues.id,\n idScript,\n locale,\n true\n );\n\n await sendEmail(\n \"summaryTestScript\",\n idShop,\n shopData.data.email,\n { idScript },\n locale\n );\n }\n}", "title": "" }, { "docid": "683fd949ae5e4a1e6fa6b0be9f86114b", "score": "0.49190965", "text": "async crearFacturaExport(factexport) {\n let query = `INSERT INTO public.facturaexportacion( facnumero, compradorid, vendedorid, facfecha, facpuertoembarque, facpuertodestino, facvapor, facsubtotal12, facsubtotal0, facsubtotalsiniva, facsubtotalivaexcento, facsubtotalsinimpuestos, factotaldesc, facice, faciva12, facirbpn, facvalortotal, facformapago, facplazo, factiempo, facdae, facpesoneto, facpesobruto, faclote, faccontenedor, facsemana, facfechazarpe, facmarca, faccertificaciones)\n VALUES (${factexport.facnumero},\n ${factexport.compradorid}, \n ${factexport.vendedorid}, \n '${factexport.facfecha}', \n '${factexport.facpuertoembarque}', \n '${factexport.facpuertodestino}', \n '${factexport.facvapor}', \n ${factexport.facsubtotal12}, \n ${factexport.facsubtotal0},\n ${factexport.facsubtotalsiniva},\n ${factexport.facsubtotalivaexcento},\n ${factexport.facsubtotalsinimpuestos},\n ${factexport.factotaldesc},\n ${factexport.facice},\n ${factexport.faciva12},\n ${factexport.facirbpn}, \n ${factexport.facvalortotal}, \n '${factexport.facformapago}', \n ${factexport.facplazo}, \n '${factexport.factiempo}', \n '${factexport.facdae}', \n ${factexport.facpesoneto}, \n ${factexport.facpesobruto}, \n '${factexport.faclote}', \n '${factexport.faccontenedor}', \n ${factexport.facsemana}, \n '${factexport.facfechazarpe}', \n '${factexport.facmarca}', \n '${factexport.faccertificaciones}')RETURNING facturaexportacionid ;`\n //console.log(query);\n let result = await pool.query(query);\n if (result.rows) {\n const newdetalleFacturaExport = factexport.detalle.map(det => {\n return [\n det.detcodigoprincipal,\n det.detcantidad,\n det.detdescripcion,\n det.detpreciounitario,\n det.detporcentajedesc,\n det.detpreciototal,\n result.rows[0].facturaexportacionid\n ]\n })\n query = format('INSERT INTO detallefacturaexportacion (detcodigoprincipal, detcantidad, detdescripcion, detpreciounitario, detporcentajedesc, detpreciototal, facturaexportacionid) VALUES %L', newdetalleFacturaExport);\n result = await pool.query(query);\n }\n return factexport;\n }", "title": "" }, { "docid": "7496f10a4987915beb206833a2819646", "score": "0.49175018", "text": "function inserirReparo(botao) {\n radios(qtd)\n busca(qtd , \" Reparo Bomba Alta\", botao)\n}", "title": "" }, { "docid": "96069060d86902fbd98e5263d120cf7d", "score": "0.49151516", "text": "async function saveService(req, res) {\n let body = req.body;\n\n let serv = {\n name: body.name,\n description: body.description,\n icon: body.icon,\n status: body.status || true,\n visibility: body.visibility || false,\n typeId: body.typeId,\n specialityId: body.specialityId,\n organizationId: body.organizationId\n }\n try {\n const service = await Service.create(serv)\n saveBitacora('Service', service.id, service.description, 'create', req.user.id);\n req.params.id = service.id;\n var serviceRatingArray = [];\n body.RatingTypes.forEach((item) => {\n var result = {\n ratingTypeId: item.id,\n serviceId: service.id\n }\n serviceRatingArray.push(result);\n });\n const serviceRatingTypes = await ServiceRatingType.bulkCreate(serviceRatingArray)\n saveBitacora('ServiceRatingType', service.id, service.name, 'add rating type to service', req.user.id);\n\n serviceRatingTypes ?\n successMsg(res, 200, `Servicio ${service.name} creado exitosamente.`, service) :\n `Servicio ${service.name} creado exitosamente`\n\n } catch (err) {\n res.status(500).json({\n ok: false,\n message: 'Ha ocurrido un error',\n error: err.message\n });\n }\n\n}", "title": "" }, { "docid": "db85be1e4e6a08da3ead52f9f43053c2", "score": "0.4912647", "text": "saveReports(result) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n let maxPerimeter = Math.max.apply(Math, result.map((i) => {\n return i.perimeter;\n }));\n let rainyDay = result.find(i => i.perimeter === maxPerimeter);\n (rainyDay !== undefined) ? rainyDay.maximumRain = true : false;\n let finalReport = yield result.map((report) => __awaiter(this, void 0, void 0, function* () {\n if (report.perimeter === maxPerimeter) {\n report.setHeavyRain();\n }\n }));\n weatherReportService_1.default.saveAll(result).catch((err) => {\n return err;\n });\n reportGenerator_1.default.createFinalReport(result);\n }\n catch (err) {\n throw new Error(\"Error at saving reports\");\n }\n });\n }", "title": "" }, { "docid": "521ce1c694cee0906bd76379ea7c8fc4", "score": "0.49120143", "text": "adiciona(atendimento, res){\n const dataCriacao = moment().format('YYYY-MM-DD HH:MM:SS')\n \n /*FAZ A CONVERSÃO DO PADRÃO DE DATA INFORMADO PELO USUÁRIO PARA O QUE VAI SER SALVO NO BANCO DE DADOS */\n const data = moment(atendimento.data, 'DD/MM/YYYY').format('YYYY-MM-DD HH:MM:SS') \n\n const dataEhValida = moment(data).isSameOrAfter(dataCriacao) /*RETORNA UM TRUE OU FALSE */\n\n const clienteEhValido = atendimento.cliente.length >= 3 /*RETORNA UM TRUE OU FALSE */\n\n /* FUNÇÃO DE ARRAY QUE RETORNA AS VALIDAÇÕES DE ERRO TRATADAS */\n const validacoes = [\n {\n nome: 'data',\n valido: dataEhValida,\n mensagem: 'Data deve ser maior ou igual a data atual'\n },\n {\n nome:'cliente',\n valido: clienteEhValido,\n mensagem:'Cliente deve ter pelo menos 3 caracteres'\n }\n ]\n\n /* RETORNA O ERRO SE VERIFICADO QUE NÃO FOR VALIDO A INFORMAÇÃO NO CAMPO, E SALVA DENTRO DOS ERROS */\n const erros = validacoes.filter(campo => !campo.valido)\n\n /*SE ERROS.LENGTH FOR = 0 É FALSE */\n const existemErros = erros.length\n\n if (existemErros) {\n res.status(400).json(erros)\n } else {\n\n const atendimentoDatado = {...atendimento, dataCriacao, data}\n \n const sql = 'INSERT INTO Atendimentos SET ?' /* ? = SIGNIFICA QUE IRÁ SER INSERIDO QUALQUER OBJETO NA TABELA ATENDIMENTOS*/\n\n conection.query(sql, atendimentoDatado, (erro, resultados) => { /* dentro de QUERY pode ser passado varios parametros */\n if(erro){\n res.status(400).json(erro)\n } else{\n res.status(201).json(atendimento)\n }\n\n })\n }\n\n }", "title": "" }, { "docid": "6ce2dbdc8af30356405cf4dc4ff1ed5e", "score": "0.49074346", "text": "function ExecuteGasto(){\n //Tomar una copia del State Actual:\n const presupuesto = { ...Presupuesto };\n let {Gastos}= presupuesto;\n //Agregado una llave identificadora al gasto:\n Gastos[`Gasto${Date.now()}`] = Gasto;\n\n presupuesto.Gastos= Gastos;\n //Agregar el gasto al State:\n SetPresupuesto(presupuesto);\n\n //Reducir el presupuesto:\n RestarPresupuesto(Gasto.Valor);\n }", "title": "" }, { "docid": "17cffac5030b538f4ab12330adcf190c", "score": "0.48979515", "text": "General_Updates() {\n const now = new Date()\n const ONE_DAY_MILLISECONDS = 1000 * 60 * 60 * 24\n const yesterday = new Date(now.getTime() - ONE_DAY_MILLISECONDS)\n\n const transactions = backend.transactions(yesterday, now)\n .then(transactions => transactions.filter(transaction => transaction.amount > 0) )\n .then(mapIncomingTransactionsToString)\n\n const balance = backend.balance()\n\n Promise.all([balance, transactions])\n .then(([amount, income]) => {\n this.emit(':tell', `${income}Your balance is ${amount} kroner. There are 3 unpaid invoices, for a total of 1042 kroner.`)\n })\n .catch(defaultErrorHandler(this))\n }", "title": "" }, { "docid": "966c40b75996ec37d1a075a071dcca80", "score": "0.48959696", "text": "function onExisteReservaUtente(eventstore, utente, dataInicio, dataFim, obra, idStream, esbHost, geQueryHost, publishCallback) {\n\n console.log(`onExisteReservaUtente called with $utente: ${utente}, $dataInicio: ${dataInicio}, $dataFim: ${dataFim}, $obra: ${obra}, $idStream: ${idStream}`);\n\n eventstore.getEventStream(idStream, function (errorGetEventStream, stream) {\n\n if (errorGetEventStream) {\n\n console.log(`Failed to get stream due to: ${errorGetEventStream}`);\n\n } else {\n\n console.log('Got event stream');\n\n stream.addEvent({ existe_reserva_utente: obra });\n\n stream.commit(function (errorStreamCommit, _) {\n\n if (errorStreamCommit) {\n\n console.log(`Failed to commit`);\n\n } else {\n\n console.log('Successfully added event');\n\n }\n\n });\n\n const events = foldArrayToObject(stream.events.map((event => event.payload)));\n\n if (events.utente_autorizado) {\n var obrasAutorizadas = events.utente_autorizado;\n getObrasSemEmprestimo(esbHost, geQueryHost, obra, dataInicio, dataFim).then(function (obrasSemEmprestimo) {\n\n if (obrasAutorizadas != undefined && obrasAutorizadas.includes(obra)) {\n if (obrasSemEmprestimo != undefined && obrasSemEmprestimo.length != 0)\n if (obrasSemEmprestimo.includes(obra)) {\n // TODO - É preciso alterar o estado da reserva para em espera \n publishCallback('emprestimo_aceite', {\n utente: utente,\n dataInicio: dataInicio,\n dataFim: dataFim,\n obra: obra,\n id_stream: idStream\n });\n } else {\n // TODO - Tinha reserva mas já não está autorizado a levar aquele exemplar, por isso vamos emprestar outro\n // TODO - É preciso alterar o estado da reserva para cancelado \n obrasAutorizadasSemEmprestimo = obrasAutorizadas.filter(obra => obrasSemEmprestimo.includes(obra))\n if (obrasAutorizadasSemEmprestimo != undefined && obrasAutorizadasSemEmprestimo.length != 0) {\n publishCallback('emprestimo_aceite', {\n utente: utente,\n dataInicio: dataInicio,\n dataFim: dataFim,\n obra: obra,\n id_stream: idStream\n });\n }\n }\n }\n });\n }\n }\n });\n}", "title": "" }, { "docid": "1138f08734addc9646832373867c2584", "score": "0.4895402", "text": "function procedureHandler(e){\n \n var indice = Manager.getIndice(); \n //console.debug(indice);\n //Si llego un finalizado incrementa indice\n Recorder.refresh();\n Manager.incrementIndice(); \n Manager.executeNextTaskWithTimer(); \n\nconsole.log(\n \"Ejecuto esta tarea y la da como finalizada \"+e.currentTarget.nodeName+\", \"\n +e.detail.id+\": \"+e.detail.message\n );\n //refresco la consola\n \n}", "title": "" }, { "docid": "3901de6737fdb4199631fc72ff7f01a1", "score": "0.48896053", "text": "async store(req, res) {\n const info_user = await require('../helper/retornaInfoOperador')(req.user.oid);\n\n const addDispositivos = await Dispositivoes.create({\n Descricao: req.body.descricao,\n Id_empresa: info_user.Id_empresa,\n Deleted: 0,\n Dta_hora_cadastro: new Date(Date.now()).toISOString(),\n Dta_hora_ultimo_acesso: new Date(Date.now()).toISOString(),\n Desc_tipo_sistema_versao: req.body.desc_tipo_sistema_versao,\n Id_licenca: req.body.id_licenca,\n Serial: req.body.serial\n\n })\n\n if (!addDispositivos) {\n return res.json({ status: false, message: 'Nao foi posivel fazer a adição do dispositivo' }).status(200)\n }\n return res.redirect('dispositivos');\n\n }", "title": "" }, { "docid": "ef22ae66b103ea6cd8d17238a9082821", "score": "0.4885883", "text": "async function buscaHorasUteis() {\n let response = await fetch(`${config.urlRoot}buscaHorasUteis`, {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n terapeutaId:terapeutaId\n })\n\n });\n //obtem resposta do controller\n let json = await response.json();\n if (json === 'error') {\n console.log('error');\n } else {\n // //persistencia dos dados para utilizar na aplicação\n await AsyncStorage.setItem('horasUteisData', JSON.stringify(json));//json é a resposta\n \n let response = await AsyncStorage.getItem('horasUteisData');\n const jsonNovo2 = JSON.parse(response);\n let l=jsonNovo2;\n let tam=l.length\n let newArr=[];\n if(tam>1){\n for(let i=0;i<tam;i++){\n newArr.push(l[i].hora);\n \n }\n setHoraArray(newArr);\n }\n if (execucao2 < 2) {\n setExecucao2(2);\n }\n }\n}", "title": "" }, { "docid": "6d5543c8702f7cdeef4c3bc2c169ecbd", "score": "0.48801196", "text": "async function proveedorGuardar(proveedor){\n return await model.proveedorGuardar(proveedor);\n}", "title": "" }, { "docid": "223cd4aee6a1321bd87fe8d984d7869a", "score": "0.48791662", "text": "async function getCurveSUSDTransactVol() {\n try {\n const tokenAddresses={};\n let volumeInUSD=0;\n const latest = await web3.eth.getBlockNumber();\n const result = await curveSUsd.getPastEvents('TokenExchange', { fromBlock: latest-10000, toBlock: latest});\n const now = new Date().valueOf();\n const yesterday = now - (24*60*60*1000);\n for(const evt of result) {\n // console.log(evt);\n const { buyer, sold_id, tokens_sold } = evt.returnValues;\n const block = await web3.eth.getBlock(evt.blockHash);\n const blockDate = block.timestamp*1000; \n // console.log(new Date(blockDate)); \n if(blockDate>=yesterday && blockDate<=now) { \n const id = await instaList.methods.accountID(buyer).call();\n if(id!=0) {\n if(!tokenAddresses[sold_id]) \n tokenAddresses[sold_id] = await curveSUsd.methods.coins(sold_id).call();\n const sold_token = tokenAddresses[sold_id];\n if(!tokenPricesInUSD[sold_token]) {\n if(sold_token==='0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE')\n tokenPricesInUSD[sold_token] = await getEthPriceInUSD();\n else\n tokenPricesInUSD[sold_token] = await getExchangePrice(sold_token.toLowerCase(),'usd'); \n } \n const divFactor = tokenDecimals[sold_token]==undefined ? 18 : tokenDecimals[sold_token]\n volumeInUSD+=(tokens_sold/Math.pow(10,divFactor))*tokenPricesInUSD[sold_token];\n }\n }\n }\n const ethPriceInUSD = tokenPricesInUSD['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'] ? tokenPricesInUSD['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'] : await getEthPriceInUSD();\n const volumeInEth=volumeInUSD/ethPriceInUSD;\n // console.log({usd:volumeInUSD, eth:volumeInEth});\n return { usd: volumeInUSD, eth: volumeInEth };\n }\n catch(err) {\n console.log(err);\n }\n}", "title": "" }, { "docid": "bf4caeb1992d20e2fbe9f15869be54ed", "score": "0.48771915", "text": "function buscarVinculosS() {\n var deferred = $q.defer();\n $http.post(appConstant.LOCAL_SERVICE_ENDPOINT+\"/buscarVinculosS\").then(function (res) {\n deferred.resolve(res.data);\n }, function (err) {\n deferred.reject(err);\n console.log(err);\n });\n return deferred.promise;\n }", "title": "" } ]
c2b7376827d143f1ba9028197e0db9a9
Lam moi lai danh sach
[ { "docid": "1aeb7a557e3de59f95a263c89dd2c394", "score": "0.0", "text": "function refreshGrid(d) {\n\t\t\tvar grid = vm.ProposalEvaluation;\n\t\t\tif (grid) {\n\t\t\t\tgrid.dataSource.data(d);\n\t\t\t\tgrid.refresh();\n\t\t\t}\n\t\t}", "title": "" } ]
[ { "docid": "1db62d9c8e88ffed8833e2bbbdcda895", "score": "0.7048877", "text": "function hitungLuasSegiEmpat(sisi){\n //tidak ada nilai balik\n var luas = sisi * sisi;\n return luas;\n}", "title": "" }, { "docid": "afd1c288fbc644bc35abf480f36214cf", "score": "0.68893725", "text": "function hitungLuasLingkaran(jariJari){\n var luas = 3.14 * jariJari * jariJari;\n return luas;\n}", "title": "" }, { "docid": "6309a9f63fae7102a50494731b08a816", "score": "0.6819995", "text": "function hitungLuasSegitiga(alas,tinggi){\n var luas = 0.5 * alas * tinggi;\n return luas;\n}", "title": "" }, { "docid": "59331c8ffb131f71f3580a3b712b1514", "score": "0.6509752", "text": "function hitungLuasPersegiPanjang(panjang,lebar){\n //tidak memiliki nilai balik\n var luas = panjang * lebar;\n return luas;\n}", "title": "" }, { "docid": "54bd9c9c7570eafcd3a083c90aa1d4d4", "score": "0.6502763", "text": "function pavadinimas (){ // pavadinimose galima naudoti tik _ arba \n // visas mazasias raides ir kiekviena sudurtini \n} // zodi rasyti Didziaja raide ", "title": "" }, { "docid": "47964978c999fa63ca7e21b089655711", "score": "0.62660784", "text": "function luasSegitiga(alas, tinggi) {\n\tlet luas = (alas * tinggi) / 2;\n\treturn luas;\n}", "title": "" }, { "docid": "bc12afe81a839e67edb0fdc0a8e370ac", "score": "0.6077331", "text": "function HitungLuasLingkaran(radius) {\n const pi = 22/7;\n const luas = (r) => pi * r * r; //fungsi\n const lebar = (r) => 2 * pi *r //fungsi\n console.log(`Luas: ${luas(radius)}`)\n console.log(`Lebar: ${lebar(radius)}`)\n}", "title": "" }, { "docid": "03b4594cc1b83ccba0b432b490f3cb30", "score": "0.6015059", "text": "function judul(kalimat){\n​\n function awalAkhir(kalimat, karakter){\n let awal = `${karakter} ${kalimat} ${karakter}`;\n return awal;\n }\n​\n let kata = awalAkhir(kalimat, \"<h1>\");\n let hasil = kata.toUpperCase();\n return hasil;\n}", "title": "" }, { "docid": "73fa300d87d915c851797255b0e8ef2c", "score": "0.5981266", "text": "function duokObuoli(){\n vienaVieninteli = 'Imk Obuoli'; //aprasome kintamaji\n return vienaVieninteli //atidejimas - grazinam kintamaji kai isvieciame\n}", "title": "" }, { "docid": "be16d5ae2ab94e64a892c6428460f955", "score": "0.5959961", "text": "function perkalian3 (angka5, angka6){\n const jumlah = angka5 * angka6\n return jumlah\n}", "title": "" }, { "docid": "e1c65478a732ceb7c3f9187bee88d482", "score": "0.58805346", "text": "function percepatanRataRata(x, y, t) {\r\n \r\n // var a menampung hasil sari parameter y - x;\r\n var a = y - x;\r\n \r\n //var haisl menampung a /t;\r\n var haisl = a / t;\r\n \r\n //Menampilkan hasil dari proses di atas yang di tampung oleh parameter haisl\r\n console.log(`hasil =` + haisl + \" m/s\");\r\n\r\n}", "title": "" }, { "docid": "26eaada8ff7fdca6ecdeac3f6e43330b", "score": "0.5872235", "text": "function calcStichprobenumfang() {\r\n\r\n\t}", "title": "" }, { "docid": "a6f5060960f3ee92c3782fe926f8ff6e", "score": "0.58057415", "text": "function metr(l) {\n return l/100\n}//console.log(metr(2000),\"so'mga shokolad qimmat\")", "title": "" }, { "docid": "9f1610cc8eb4774b5bc463f206305d7c", "score": "0.57987607", "text": "function berechneSchaltjahr() {\n \n}", "title": "" }, { "docid": "26c9ff198d453cf55325212f620f58fd", "score": "0.57943416", "text": "function areaCuadrado(lado){\r\n return lado * lado;\r\n}", "title": "" }, { "docid": "15c53782e5ab6468f0d9e637eb2e80bc", "score": "0.5766997", "text": "function areaCuadrada(lado) {\n return lado * lado;\n}", "title": "" }, { "docid": "d8245d962a443135aa92bfeb3bfecf3e", "score": "0.5758886", "text": "function areaCuadrado(lado) {\n return lado * lado;\n\n}", "title": "" }, { "docid": "4c153eaf38ed50d6a7e0437350eae511", "score": "0.5741642", "text": "function t(e,t,a,n){var i={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return n?i[a][0]:i[a][1]}", "title": "" }, { "docid": "df534d45828a36975c32ff34f4db59be", "score": "0.5738233", "text": "function prediksiBulanke(L,T,S,h,m,Ypred){\n var w=1;\n var k=Ypred.length;\n //wBayangan ini menggantikan seasonal saat seasonal sudah melebihi dari w =12\n let wBayangan=1;\n for (var index = k; index < k+h; index++) {\n if (w>12) {\n \n Ypred[index]=Math.floor((L[k-1]+w*T[k-1])*wBayangan)\n console.log(\"uy\",w)\n wBayangan++;\n }else{\n\n Ypred[index]=Math.floor((L[k-1]+w*T[k-1])*S[index-m])\n }\n w+=1; \n console.log(\"ini index : \",index,\"ini L[k-1] : \",L[k-1],\"ini w : \",w,\"ini T[k-1] : \",T[k-1],\"ini S[index-m] : \",S[index-m],\"ini m : \",m)\n }\n for (var index = 0; index < Ypred.length; index++) {\n //pemberian angka nol pada index 0 - 12\n if ( index <= m) {\n Ypred[index]=0\n } \n console.log(Ypred[index],\"ini Ypred[index]\")\n }\n return Ypred\n }", "title": "" }, { "docid": "9b5e13cbb9708c87fbb885534c05fa74", "score": "0.5732091", "text": "function printMetinisPajamuDydis() {\n let suma = 12 * atlyginimas;\n console.log(\"12 meneisu atlyginimas\", suma);\n}", "title": "" }, { "docid": "7ebd987c40f3e6beede823acc741f65c", "score": "0.57221663", "text": "function salam(){\n // yang diisi dengan variabel nama const nama diatas\n return \"Hallo \" + nama;\n}", "title": "" }, { "docid": "482d7ec1f3fecf24f35d87e29fb64705", "score": "0.57218444", "text": "function processSentence(nama, umur, alamat, hobi) {\n var kalimatLengkap = \"Nama saya \" + nama + \", umur saya \" + umur + \" tahun, alamat saya di \" + alamat + \", dan saya punya hobby yaitu \" + hobi + \"!\";\n return kalimatLengkap;\n}", "title": "" }, { "docid": "71769ab63467add000f2332f61460714", "score": "0.5718489", "text": "function t(e,t,n,a){var i={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return a?i[n][0]:i[n][1]}", "title": "" }, { "docid": "71769ab63467add000f2332f61460714", "score": "0.5718489", "text": "function t(e,t,n,a){var i={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return a?i[n][0]:i[n][1]}", "title": "" }, { "docid": "71769ab63467add000f2332f61460714", "score": "0.5718489", "text": "function t(e,t,n,a){var i={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return a?i[n][0]:i[n][1]}", "title": "" }, { "docid": "71769ab63467add000f2332f61460714", "score": "0.5718489", "text": "function t(e,t,n,a){var i={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return a?i[n][0]:i[n][1]}", "title": "" }, { "docid": "04fc162ea15fc6d32de473c7afc0254b", "score": "0.57140636", "text": "function perimetroCuadrado(lado) {\n return lado *4 ;\n}", "title": "" }, { "docid": "54d000d16aa5a3116a564ccb6812fd00", "score": "0.5713516", "text": "function tambah(x, y ) {\n return x + kaliDua(y);\n}", "title": "" }, { "docid": "fc705d16a79847e06539e74ad790fca1", "score": "0.5701574", "text": "function t(e,t,a,o){var i={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return o?i[a][0]:i[a][1]}", "title": "" }, { "docid": "cebaf39cb7cbbe3d6753029e6e3028cb", "score": "0.5694465", "text": "function hasil(kriteria, alternatif) {\n let sumOfBobot = getTotalBobot(kriteria);\n let prioritas = getPrioritas(kriteria, sumOfBobot);\n let vektorSi = hitungVectorSi(alternatif, prioritas);\n let sumVectorSi = countSumSiPerAlternatif(vektorSi);\n let totalVectorSi = countTotalVectorSi(sumVectorSi);\n let vectorVi = countVectorVi2(sumVectorSi, totalVectorSi);\n // console.log(vectorVi)\n\n // let score_fin = getMaxAlt(vectorVi[1])\n // let coba = [Max,score_fin];\n return vectorVi;\n}", "title": "" }, { "docid": "bdbbe91de51b5a55292cddb91adad0e4", "score": "0.5667238", "text": "function PerkalianV2 (a, b) {\n // local variable\n let hasil = a * b\n console.log(hasil)\n\n // give return value => supaya value dari hasil bisa dipakai diluar fungsi\n return hasil\n}", "title": "" }, { "docid": "3bfed778e9a864024b170f4c3c5a03f2", "score": "0.56615484", "text": "function r(o,l,u,f){var p={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[o+\" sekondamni\",o+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[o+\" mintamni\",o+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[o+\" voramni\",o+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[o+\" disamni\",o+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[o+\" mhoineamni\",o+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[o+\" vorsamni\",o+\" vorsam\"]};return f?p[u][0]:p[u][1]}", "title": "" }, { "docid": "d5077b7b6220e56280478f30f3305a4b", "score": "0.564564", "text": "function laske1() {\n\t// etsitään kaikki maanantaille syötetyt luvut ja tehdään siitä array\n\t\tvar arr = document.getElementsByClassName('eka');\n\t\t// alustetaan muuttuja yht (yhteensä)\n\t\tvar yht = 0;\n\t\t\n\t\t// haetaan for-loopilla arrayn pituus ja haetaan arrayn arvot\n\t\tfor (var i=0; i<arr.length; i++){\n\t\t\tif(parseInt(arr[i].value))\n\t\t\t\tyht += parseInt(arr[i].value);\n\t\t\t\n\t\t}\n\t\t// sijoitetaan muuttuja 'yht' 'ma'-nimiseen HTML-elementtiin\n\t\tdocument.getElementById('ma').innerHTML = yht;\n\t\t}", "title": "" }, { "docid": "883eb0a3780e6ba0a126a20c2d74d856", "score": "0.5623887", "text": "function areaCuadrado(lado) {\n return lado * lado;\n}", "title": "" }, { "docid": "883eb0a3780e6ba0a126a20c2d74d856", "score": "0.5623887", "text": "function areaCuadrado(lado) {\n return lado * lado;\n}", "title": "" }, { "docid": "883eb0a3780e6ba0a126a20c2d74d856", "score": "0.5623887", "text": "function areaCuadrado(lado) {\n return lado * lado;\n}", "title": "" }, { "docid": "98a0f755c780ff50f3122b25fd34443f", "score": "0.5619968", "text": "function Mahasiswa (nama, energi){\n \n this.nama = nama;\n this.energi = energi;\n this.makan = function (nasi){\n this.energi += nasi;\n // ini sama dengan this.energi = this.energi + nasi;\n console.log(`${this.nama} sudah makan`);\n }\n \n}", "title": "" }, { "docid": "a3c232c24528ad1b0a72e30deab0969f", "score": "0.5615825", "text": "function t(e,t,n,i){var a={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return i?a[n][0]:a[n][1]}", "title": "" }, { "docid": "a3c232c24528ad1b0a72e30deab0969f", "score": "0.5615825", "text": "function t(e,t,n,i){var a={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return i?a[n][0]:a[n][1]}", "title": "" }, { "docid": "a3c232c24528ad1b0a72e30deab0969f", "score": "0.5615825", "text": "function t(e,t,n,i){var a={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return i?a[n][0]:a[n][1]}", "title": "" }, { "docid": "a3c232c24528ad1b0a72e30deab0969f", "score": "0.5615825", "text": "function t(e,t,n,i){var a={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return i?a[n][0]:a[n][1]}", "title": "" }, { "docid": "16b89b9b935bb48aa13b7bce4f509a82", "score": "0.5612461", "text": "pris() {\n return this.masse * this.kilopris;\n }", "title": "" }, { "docid": "e8a50a69537946100e1c23c029c41d45", "score": "0.56117296", "text": "function mnozniki(params) {\r\n\r\n stawkaAktualna = stawkaPojedyncza * params;\r\n\r\n\r\n}", "title": "" }, { "docid": "6b4d054b1cc97942fdf472abcbd8a348", "score": "0.5608348", "text": "function katilimSaati(dersSayisi, dersSuresi) {\n const katilim = dersSayisi * dersSuresi;\n if (isNaN(katilim)){\n console.log(\"lutfen sayiya cevirilebilecek bir arguman giriniz.\")\n \n }else{\n \n switch (dersSayisi){\n case undefined:\n console.log(\"lutfen sayiya cevirilebilecek bir arguman giriniz.\");\n break;\n case null:\n console.log(\"lutfen sayiya cevirilebilecek bir arguman giriniz.\");\n break;\n case '':\n console.log(\"lutfen sayiya cevirilebilecek bir arguman giriniz.\");\n break;\n case true:\n console.log(\"lutfen sayiya cevirilebilecek bir arguman giriniz.\");\n break;\n case false:\n console.log(\"lutfen sayiya cevirilebilecek bir arguman giriniz.\");\n break;\n default:\n switch (dersSuresi){\n case undefined:\n console.log(\"lutfen sayiya cevirilebilecek bir arguman giriniz.\");\n break;\n case null:\n console.log(\"lutfen sayiya cevirilebilecek bir arguman giriniz.\");\n break;\n case '':\n console.log(\"lutfen sayiya cevirilebilecek bir arguman giriniz.\");\n break;\n case true:\n console.log(\"lutfen sayiya cevirilebilecek bir arguman giriniz.\");\n break;\n case false:\n console.log(\"lutfen sayiya cevirilebilecek bir arguman giriniz.\");\n break;\n default:\n console.log(`Toplam katildiginiz ders saati: ${katilim}` );\n } \n break;\n }\n }\n}", "title": "" }, { "docid": "44544dfd7c3539024ea0706836bc3fad", "score": "0.5602019", "text": "function areaCuadrado(lado){\n return lado * lado;\n}", "title": "" }, { "docid": "9d733c5ef57b6f486ed52640964c5357", "score": "0.5600565", "text": "function jalanSatu()\n{\n console.log(\"Jalan Satu\");\n}", "title": "" }, { "docid": "b541f5bd88f5b246e92bced989811bd4", "score": "0.55999863", "text": "function tidakRekomendasi(alfa){\r\n\t\tif(alfa > 0 && alfa < 1){\r\n\t\t\treturn (80 - (alfa * 40));\r\n\t\t}else if(alfa == 1){\r\n\t\t\treturn 40;\r\n\t\t}else{\r\n\t\t\treturn 80;\r\n\t\t}\r\n\t}", "title": "" }, { "docid": "92bae36da1e14bf19af6ec772d5d6828", "score": "0.55906093", "text": "function la(){}", "title": "" }, { "docid": "9153685306515f942beb00d31bd6f1f3", "score": "0.5575541", "text": "static GetLahiriAyanamsa(d)\n\t{\n\t\tvar h = [ 2415259.000000,22.475,\n\t\t\t2433486.000000,23.16472,\n\t\t\t2451791.000000,23.870277778,\n\t\t\t2455437.000000,24.001111111,\n\t\t\t2469979.000000,24.558055556,\n\t\t\t2488234.000000,25.258055556 ]\n\n\t\tif (d > h[10])\n\t\t{\n\t\t\treturn (d - h[10]) * ((h[11] - h[9]) / (h[10] - h[8])) + h[11];\n\t\t}\n\t\telse if (d > h[8])\n\t\t{\n\t\t\treturn (d - h[8]) * ((h[11] - h[9]) / (h[10] - h[8])) + h[9];\n\t\t}\n\t\telse if (d > h[6])\n\t\t{\n\t\t\treturn (d - h[6]) * ((h[9] - h[7]) / (h[8] - h[6])) + h[7];\n\t\t}\n\t\telse if (d > h[4])\n\t\t{\n\t\t\treturn (d - h[4]) * ((h[7] - h[5]) / (h[6] - h[4])) + h[5];\n\t\t}\n\t\telse if (d > h[2])\n\t\t{\n\t\t\treturn (d - h[2]) * ((h[5] - h[3]) / (h[4] - h[2])) + h[3];\n\t\t}\n\t\telse if (d > h[0])\n\t\t{\n\t\t\treturn (d - h[0]) * ((h[3] - h[1]) / (h[2] - h[0])) + h[1];\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn (d - h[0]) * ((h[3] - h[1]) / (h[2] - h[0])) + h[1];\n\t\t}\n\t}", "title": "" }, { "docid": "57b74bdcaa0c00a7063ff984ec009eff", "score": "0.5569936", "text": "function areaCuadrado(lado){\n return lado * lado\n}", "title": "" }, { "docid": "57b74bdcaa0c00a7063ff984ec009eff", "score": "0.5569936", "text": "function areaCuadrado(lado){\n return lado * lado\n}", "title": "" }, { "docid": "8e431fc6170eb0cd6adc160bbaa832af", "score": "0.5568621", "text": "function mahasiswa(nama, energi) {\n // let mahasiswa = {};\n this.nama = nama;\n this.energi = energi;\n\n this.makan = function (porsi) {\n this.energi += porsi;\n console.log(`halo ${this.nama}, selamat makan`);\n }\n this.main = function (jam) {\n this.energi -= jam;\n console.log(`halo ${this.nama}, selamat bermain`);\n }\n // return mahasiswa\n}", "title": "" }, { "docid": "31ea9293fa00ae9a83c2c56b327d21b8", "score": "0.556774", "text": "function perimetroCuadrado(lado){\r\n return lado * 4;\r\n}", "title": "" }, { "docid": "46a5d5da03dbe180ce16f6881741c729", "score": "0.55660033", "text": "function t(e,t,o,n){var i={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return n?i[o][0]:i[o][1]}", "title": "" }, { "docid": "a050c8480f48092c97db2fa6267d45bd", "score": "0.55602026", "text": "perimetro(lado) {\n //this faz referencia a todo o objeto\n return this.lados * lado;\n }", "title": "" }, { "docid": "22cc9932ec78e54276f3df14206b729d", "score": "0.55590916", "text": "function t(e,t,a,n){var i={m:[\"eng Minutt\",\"enger Minutt\"],h:[\"eng Stonn\",\"enger Stonn\"],d:[\"een Dag\",\"engem Dag\"],M:[\"ee Mount\",\"engem Mount\"],y:[\"ee Joer\",\"engem Joer\"]};return t?i[a][0]:i[a][1]}", "title": "" }, { "docid": "3141a1021d7f6b2ac5cf8c196b638870", "score": "0.55583507", "text": "function t(e,t,s,a){var n={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return a?n[s][0]:n[s][1]}", "title": "" }, { "docid": "ec1a034c2fe5c3814f10e6a69e8db6aa", "score": "0.5558042", "text": "function oi(e,t,n,i){var a={m:[\"eng Minutt\",\"enger Minutt\"],h:[\"eng Stonn\",\"enger Stonn\"],d:[\"een Dag\",\"engem Dag\"],M:[\"ee Mount\",\"engem Mount\"],y:[\"ee Joer\",\"engem Joer\"]};return t?a[n][0]:a[n][1]}", "title": "" }, { "docid": "c1200d35913becac5cfc4ad6a455bcf6", "score": "0.5557508", "text": "Asv(){\r\n return this.rebar(this.stirrupSize).A * this.stirrupLegs \r\n }", "title": "" }, { "docid": "87c3ddb6cfcd8e0bf0ceeb44acfd57e5", "score": "0.55553776", "text": "function t(e,t,n,a){var o={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return a?o[n][0]:o[n][1]}", "title": "" }, { "docid": "be0b49c195b347c0c363f622b61aae50", "score": "0.5549844", "text": "function t(e,t,n,o){var i={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return o?i[n][0]:i[n][1]}", "title": "" }, { "docid": "00a10e6df67c087630253573e6e66390", "score": "0.5548324", "text": "llevaMartillo(){ return this._martillo; }", "title": "" }, { "docid": "a16078a0ee3099e6bb8d8fd3dd67aba6", "score": "0.55483085", "text": "function GetNimiLyhyt(){\n\treturn this.nimiLyhyt;\n}", "title": "" }, { "docid": "159d82dd15b137a3d00f2a20696377f4", "score": "0.5548255", "text": "function t(e,t,n,a){var s={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return a?s[n][0]:s[n][1]}", "title": "" }, { "docid": "b82ed7c0cf77a6da3f0161afdd4a3553", "score": "0.5546222", "text": "function e(t,e,i,n){var a={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[t+\" sekondamni\",t+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[t+\" mintamni\",t+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[t+\" voramni\",t+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[t+\" disamni\",t+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[t+\" mhoineamni\",t+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[t+\" vorsamni\",t+\" vorsam\"]};return n?a[i][0]:a[i][1]}", "title": "" }, { "docid": "ed8ab636524d37731e84f232e70bd9af", "score": "0.55452996", "text": "function mokinioAnketa (vardas,pavarde,kelintokas,matematikosPazimiai) {\n this.vardas = vardas;\n this.pavarde = pavarde;\n this.kelintokas = kelintokas;\n this.matematikosPazimiai = matematikosPazimiai;\n this.begu = function () {\n console.log(\"begu, begu\");\n };\n}", "title": "" }, { "docid": "4a934df4d398688b43489ef4479abfe6", "score": "0.55420434", "text": "function perimetroCuadrado(lado){\n return lado * 4;\n\n}", "title": "" }, { "docid": "ee95d7f4dd6bdf91ed2ad22377401cc3", "score": "0.55418897", "text": "function areaCuadrada(lado) {\n return lado*lado;\n}", "title": "" }, { "docid": "7ab4817989f900ef3c4f3bb3e50a716f", "score": "0.55408305", "text": "function laskePisteet(rastit) {\n\n //lasketaan pisteet vain, jos joukkueella on leimattuja rasteja\n if (rastit === undefined || rastit.length === 0) {\n return 0;\n }\n\n //lasketaan rastien pisteiden yhteissumma\n let summa = 0;\n\n /* Laskee rastin pisteet rastikoodin ensimmäisen merkin perusteella.\n * Palauttaa 0 jos ensimmäinen merkki ei ole numero.\n */\n function laskeRastinPisteet(rasti) {\n let pisteet = parseInt(rasti.koodi[0]);\n\n if (isNaN(pisteet)) {\n return 0;\n }\n\n return pisteet;\n }\n\n rastit.forEach(rasti => {\n summa += laskeRastinPisteet(rasti);\n });\n\n return summa;\n}", "title": "" }, { "docid": "1ee38d485f7afd1976ce674fb5de3514", "score": "0.5539163", "text": "function t(e,t,a,o){var i={m:[\"eng Minutt\",\"enger Minutt\"],h:[\"eng Stonn\",\"enger Stonn\"],d:[\"een Dag\",\"engem Dag\"],M:[\"ee Mount\",\"engem Mount\"],y:[\"ee Joer\",\"engem Joer\"]};return t?i[a][0]:i[a][1]}", "title": "" }, { "docid": "0ca6b4b1c784707f0b47e0e5c16b9b72", "score": "0.5537267", "text": "function t(e,t,n,i){var o={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return i?o[n][0]:o[n][1]}", "title": "" }, { "docid": "0ca6b4b1c784707f0b47e0e5c16b9b72", "score": "0.5537267", "text": "function t(e,t,n,i){var o={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return i?o[n][0]:o[n][1]}", "title": "" }, { "docid": "aaf6cf042ac84359bf2451c6d684cc2a", "score": "0.55368036", "text": "function hapusAwalanPertama(inputKata){\n var huruf_awalan_4=inputKata.substr(0,4).toLowerCase();\n var huruf_awalan_3=inputKata.substr(0,3).toLowerCase();\n var huruf_awalan_2=inputKata.substr(0,2).toLowerCase();\n var huruf_vokal='aiueo';//inisialisasi huruf vokal\n if(huruf_awalan_4=='meng' || huruf_awalan_4=='meny' || huruf_awalan_4=='peng' || huruf_awalan_4=='peny'){\n if(huruf_awalan_4=='peny' || huruf_awalan_4=='meny'){\n inputKata=inputKata.slice(4,inputKata.length); //buang partikel 4 karakter pertama\n inputKata=\"s\"+inputKata;//awalan diganti dengan s * contoh : menyapu = sapu\n return inputKata;\n }else{\n inputKata=inputKata.slice(4,inputKata.length); //buang partikel 4 karakter pertama\n return inputKata;\n }\n }else if(huruf_awalan_3=='men' || huruf_awalan_3=='mem' || huruf_awalan_3=='pen' || huruf_awalan_3=='pem' || huruf_awalan_3=='ter'){\n var tempAwalan=inputKata.slice(3,inputKata.length);//memotong input dan disimpan di temporary variable\n var hurufAwal=tempAwalan.substr(0,1);//cek huruf awal setelah dipotong\n if((huruf_awalan_3=='mem' && huruf_vokal.indexOf(hurufAwal)!==-1) || (huruf_awalan_3=='pem' && huruf_vokal.indexOf(hurufAwal)!==-1)){//cek jika setelah awalan mem dan pem merupakan huruf vokal\n inputKata=inputKata.slice(3,inputKata.length); //buang partikel 3 karakter pertama\n inputKata=\"p\"+inputKata;//awalan diganti dengan p * contoh : memukul = pukul\n return inputKata;\n }else if((huruf_awalan_3=='men' && huruf_vokal.indexOf(hurufAwal)!==-1) || (huruf_awalan_3=='pen' && huruf_vokal.indexOf(hurufAwal)!==-1)){\n inputKata=inputKata.slice(3,inputKata.length); //buang partikel 3 karakter pertama\n inputKata=\"t\"+inputKata;//awalan diganti dengan p * contoh : memukul = pukul\n return inputKata;\n }else{\n inputKata=inputKata.slice(3,inputKata.length); //buang partikel 3 karakter pertama\n return inputKata; \n }\n }else if(huruf_awalan_2=='di' || huruf_awalan_2=='ke' || huruf_awalan_2=='me'){\n inputKata=inputKata.slice(2,inputKata.length); //buang partikel 2 karakter pertama\n return inputKata;\n }else{\n return inputKata;//jika tidak masuk aturan, maka lanjutkan\n }\n }", "title": "" }, { "docid": "7e9c6fcf4581f64f401838cde2b0b533", "score": "0.5535629", "text": "function pazymiuVidurkis2(vardas, x1 ,x2, x3, x4, x5) {\n let vidurkis = ((x1 + x2 + x3 + x4 + x5) /5);\nconsole.log(vardas +\" \" + \"vidurkis yra \" + vidurkis);\ndocument.write(vardas +\" \" + \"vidurkis yra \" + vidurkis);\n}", "title": "" }, { "docid": "3b03c19c2bee53f6aceb02a42742ca12", "score": "0.5531822", "text": "static formula_ST(evo,st) {\n return evo[st].b*(1+(this._lv-1) * db.evo.hp.r) + (db.evo.hp.f*(this._lv-1))\n }", "title": "" }, { "docid": "7b37851c3848b04aad6fd337a885bdd9", "score": "0.55294824", "text": "function ki(){}", "title": "" }, { "docid": "8f82dd05b7e4482f225a72d1b53f0c49", "score": "0.5528528", "text": "function t(e,t,a,n){var r={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return n?r[a][0]:r[a][1]}", "title": "" }, { "docid": "8f82dd05b7e4482f225a72d1b53f0c49", "score": "0.5528528", "text": "function t(e,t,a,n){var r={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return n?r[a][0]:r[a][1]}", "title": "" }, { "docid": "651cd0c7d956e0b7d1c187e69174c187", "score": "0.5528001", "text": "function jumlahVolumDuaBuahKubus (a,b) {\n return a * a * a + b * b * b ;\n}", "title": "" }, { "docid": "c04b6b3f9c594cc7b82abe3e19c8d536", "score": "0.5517966", "text": "function luiersPerJaar (luiers, dagen){\r\n var aantalLuiers = [3, 4, 5] ;\r\n var aantalDagen = 365;\r\n luiers = aantalLuiers[0];\r\n /*Eerste waarde wordt uit de array gehaald, een array begint met tellen bij 0*/\r\n dagen = aantalDagen;\r\n var jaar = luiers * dagen;\r\n document.querySelector('h3').textContent = \"Per jaar heeft een baby minimaal \" + jaar + \" luiers nodig.\";\r\n}", "title": "" }, { "docid": "b3ddebbb8ba5217ae39a156349c75507", "score": "0.55172807", "text": "function t(e,t,n,i){var s={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return i?s[n][0]:s[n][1]}", "title": "" }, { "docid": "122e54d704c275a52b4531833b47c094", "score": "0.55127573", "text": "function juh(kapan, siapa) {\n return \"Selamat \" + kapan + \" \" + siapa;\n}", "title": "" }, { "docid": "13fe5e6b9896c48dd5bc28e67181ccaa", "score": "0.5511083", "text": "vitesse_moy_trajet(trajet) {}", "title": "" }, { "docid": "658e03bed5d955285ee377298090f353", "score": "0.5507426", "text": "function i(t,i,e,n){var s={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[t+\" sekondamni\",t+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[t+\" mintamni\",t+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[t+\" voramni\",t+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[t+\" disamni\",t+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[t+\" mhoineamni\",t+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[t+\" vorsamni\",t+\" vorsam\"]};return n?s[e][0]:s[e][1]}", "title": "" }, { "docid": "ebe0288f73da84e6a2278a2d7a10574c", "score": "0.55036974", "text": "function t(e,t,i,n){var r={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return n?r[i][0]:r[i][1]}", "title": "" }, { "docid": "ebe0288f73da84e6a2278a2d7a10574c", "score": "0.55036974", "text": "function t(e,t,i,n){var r={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return n?r[i][0]:r[i][1]}", "title": "" }, { "docid": "ebe0288f73da84e6a2278a2d7a10574c", "score": "0.55036974", "text": "function t(e,t,i,n){var r={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return n?r[i][0]:r[i][1]}", "title": "" }, { "docid": "12750319ab59c91621c3fb854e136331", "score": "0.5501469", "text": "function malam() {\n return \"Selamat Malam\";\n}", "title": "" }, { "docid": "86943afa11492cb4b569a9476f7c245a", "score": "0.5499644", "text": "function igual(){\n this.resultado()\n operacao = false\n soma = false\n multi = false\n dividi = false\n subtrai = false\n \n}", "title": "" }, { "docid": "8d1ff8b418cecd48e6a49bb2ff397217", "score": "0.5498683", "text": "function hitung (){\n console.log(`gaul ${nama}`)\n}", "title": "" }, { "docid": "acba28315ec88126fd774b96aa7e92b1", "score": "0.54976547", "text": "function pazymiuVidurkis(x) {\n let x1 = 10;\n let x2 = 10;\n let x3 = 10;\n let x4 = 10;\n let x5 = 5;\n let vidurkis = ((x1 + x2 + x3 + x4 + x5) /5);\n\ndocument.write(\"vidurkis yra \" + vidurkis);\n}", "title": "" }, { "docid": "85379e5335bee996d605e62451609515", "score": "0.5496002", "text": "function t(e, t, a, n) {\n var r = {\n m: [\"eng Minutt\", \"enger Minutt\"],\n h: [\"eng Stonn\", \"enger Stonn\"],\n d: [\"een Dag\", \"engem Dag\"],\n M: [\"ee Mount\", \"engem Mount\"],\n y: [\"ee Joer\", \"engem Joer\"]\n };\n return t ? r[a][0] : r[a][1]\n }", "title": "" }, { "docid": "fd2ef530e3e067dc131c0b03182b97a4", "score": "0.5493207", "text": "function t(e,t,n,a){var r={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return a?r[n][0]:r[n][1]}", "title": "" }, { "docid": "fd2ef530e3e067dc131c0b03182b97a4", "score": "0.5493207", "text": "function t(e,t,n,a){var r={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return a?r[n][0]:r[n][1]}", "title": "" }, { "docid": "fd2ef530e3e067dc131c0b03182b97a4", "score": "0.5493207", "text": "function t(e,t,n,a){var r={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return a?r[n][0]:r[n][1]}", "title": "" }, { "docid": "fd2ef530e3e067dc131c0b03182b97a4", "score": "0.5493207", "text": "function t(e,t,n,a){var r={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return a?r[n][0]:r[n][1]}", "title": "" }, { "docid": "fd2ef530e3e067dc131c0b03182b97a4", "score": "0.5493207", "text": "function t(e,t,n,a){var r={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return a?r[n][0]:r[n][1]}", "title": "" }, { "docid": "fd2ef530e3e067dc131c0b03182b97a4", "score": "0.5493207", "text": "function t(e,t,n,a){var r={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return a?r[n][0]:r[n][1]}", "title": "" }, { "docid": "fd2ef530e3e067dc131c0b03182b97a4", "score": "0.5493207", "text": "function t(e,t,n,a){var r={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return a?r[n][0]:r[n][1]}", "title": "" }, { "docid": "fd2ef530e3e067dc131c0b03182b97a4", "score": "0.5493207", "text": "function t(e,t,n,a){var r={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return a?r[n][0]:r[n][1]}", "title": "" }, { "docid": "fd2ef530e3e067dc131c0b03182b97a4", "score": "0.5493207", "text": "function t(e,t,n,a){var r={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[e+\" sekondamni\",e+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[e+\" mintamni\",e+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[e+\" voramni\",e+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[e+\" disamni\",e+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[e+\" mhoineamni\",e+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[e+\" vorsamni\",e+\" vorsam\"]};return a?r[n][0]:r[n][1]}", "title": "" } ]
a3c286e19a023d8faa7379a59bc03c40
Function to show the modal errors !
[ { "docid": "7b14c0f999e63141aa0183ab13363b8d", "score": "0.7823413", "text": "function campaign_error_display_modal(id, title, errors){\n\tdocument.getElementById(id).innerHTML\t= errors;\n\t$( \"#\"+id ).dialog({\n\t\tresizable: false,\n\t\tdraggable: false,\n\t\theight:300,\n\t\twidth: 500,\n\t\tmodal: true,\n\t\ttitle: title,\n\t\tbuttons: {\n\t\t\t\"Fermer\": function(){\n\t\t\t\t$( this ).dialog( \"close\" );\n\t\t\t},\n\t\t\t/*\"Non\": function(){\n\t\t\t\t$( this ).dialog( \"close\" );\n\t\t\t}*/\n\t\t},\n\t\tshow: {\n\t\t\teffect: \"fade\",\n\t\t\tduration: 300\n\t\t},\n\t\thide: {\n\t\t\teffect: \"puff\",\n\t\t\tduration: 220\n\t\t}\n });\n}", "title": "" } ]
[ { "docid": "be9e53d1307e8724e5f6a54e44c7e647", "score": "0.80710334", "text": "function showErrorModal(error) {\n $('#error').modal('show');\n }", "title": "" }, { "docid": "2c9fa57fce6388b2ea5dc4074e7170fb", "score": "0.8018944", "text": "function showErrorModal(data) {\n if ('message' in data) {\n var html = '<p>' + data.message.toString() + '<p>';\n $('#errorBody').append(html);\n }\n if ('errors' in data) {\n for (var key in data.errors) {\n var value = data.errors[key];\n var html = '<p>' + key.toString() + ': ' + value.toString() + '<p>';\n $('#errorBody').append(html);\n }\n\n }\n\n $('#errorModal').modal('show');\n\n }", "title": "" }, { "docid": "160b9e4a10c779a302a82af6a2074f7d", "score": "0.79435176", "text": "function show_error_modal() {\n $('#error_window').modal(\"show\");\n}", "title": "" }, { "docid": "96b5529b6e8671d7b311eae20c0c1546", "score": "0.7789955", "text": "function showError(textVal){\r\n setText('errorText2', textVal);\r\n modal.style.display = 'block';\r\n}", "title": "" }, { "docid": "3647aee3f86fd73ac014bcc07a7fff13", "score": "0.7612593", "text": "function error(text) {\n $(\"#errorModalText\").text(text);\n $(\"#errorModal\").modal();\n}", "title": "" }, { "docid": "067d576002646e7e5aa6a22b04328de4", "score": "0.75771207", "text": "function error() {\n Modal.error({\n title: 'Sorry you have not specified area involved in this Alert',\n content: (\n <div>\n <p>\n Inorder to Specify an area involved in this Alert kindly use the draw\n controls to Draw an area involved in this alert\n </p>\n </div>\n ),\n onOk() {},\n });\n}", "title": "" }, { "docid": "11adf1577fe3a0f99ac2fc1d7b6154ca", "score": "0.7495711", "text": "function displayError() {\n $(\"#errorMessage\").text(errorString);\n $(\"#myModal\").modal(\"show\");\n errorString = \"\";\n inputValid = true;\n $(\"tbody\").empty();\n}", "title": "" }, { "docid": "02fd186a82100bd70b34f01bfa954d53", "score": "0.7265034", "text": "function throwError(error) {\n $('#errorValue').append(error);\n $('#modalError').modal('show');\n}", "title": "" }, { "docid": "02fd186a82100bd70b34f01bfa954d53", "score": "0.7265034", "text": "function throwError(error) {\n $('#errorValue').append(error);\n $('#modalError').modal('show');\n}", "title": "" }, { "docid": "b836bc63e77a0c9af68eeeb8794ef251", "score": "0.72427523", "text": "function showError() {\n\n }", "title": "" }, { "docid": "fa5b6bf30ebc80a4329108cf3ddc02ae", "score": "0.7204758", "text": "function set_error_modal_message(error){\n $('#modal_body_error_message').text(error);\n}", "title": "" }, { "docid": "314c00fcfb670299b9f4177cc83f00e5", "score": "0.716633", "text": "show() {\n this.el.html(`\n <p class=\"popupGallery__error\">\n <i class=\"fas fa-exclamation-circle\"></i>\n ${this.error}\n </p>`);\n }", "title": "" }, { "docid": "cc3c4e6a9d2857dcbeea883d8e669090", "score": "0.71629125", "text": "function displayErrors() {\n resetBackground(nameInput, validateName());\n toggleView(errorMessageContainer[0], !validateName());\n resetBackground(emailInput, validateEmail());\n toggleView(errorMessageContainer[1], !validateEmail());\n toggleView(errorMessageContainer[2], !validateActivities());\n if (!FormGlobal['isCreditCardValid'] ||\n !FormGlobal['isZipCodeValid'] ||\n !FormGlobal['isCVVValid']) \n {\n toggleView(errorMessageContainer[3], true);\n setCreditCardErrorMessage(\"Please correct you credit card information\");\n resetBackground(ccInputs[0], FormGlobal['isCreditCardValid']);\n resetBackground(ccInputs[1], FormGlobal['isZipCodeValid']);\n resetBackground(ccInputs[2], FormGlobal['isCVVValid']);\n }\n \n }", "title": "" }, { "docid": "7eb51a20e9ec500a087a2d1878ff2c2e", "score": "0.71472967", "text": "function errorDisplay() {\n Swal.swalErrorInform();\n }", "title": "" }, { "docid": "b2eaae94e42ce9dcbfc00504d68fd8ec", "score": "0.71337384", "text": "function googleError() {\n $('#myModal').modal('show');\n}", "title": "" }, { "docid": "59d07888f525d68ba138ae5b7be468d1", "score": "0.7124258", "text": "function showErrorMessage()\n{\n $('#serverError').dialog({\n resizable: false,\n modal: true,\n buttons:\n {\n OK: function ()\n {\n $(this).dialog(\"close\");\n }\n }\n });\n}", "title": "" }, { "docid": "0a14682112836348f6deef03b3e29e98", "score": "0.70876545", "text": "function error(config) {\n const errorModal = document.getElementById('error-modal');\n errorModal.classList.add('open');\n populateDyn(config, errorModal);\n const errorClose = document.getElementById('error-close');\n errorClose.addEventListener('click', event => {\n errorModal.classList.remove('open');\n })\n}", "title": "" }, { "docid": "3d93db998abe9c4b8631f3c689ee7ebf", "score": "0.7034225", "text": "function errorModal (err) {\n if (err && err instanceof Error) errors.push(err)\n if (errors.length === 0) {\n if (document.getElementById('error')) document.getElementById('error').outerHTML = ''\n return parseZIPFiles('Looking for another ZIP file to parse after successfully displaying an error.')\n } else {\n const error = errors.splice(0, 1)[0] // Remove from storage.\n console.error(error)\n if (document.getElementById('loader')) document.getElementById('loader').outerHTML = ''\n document.getElementById('modals').appendChild(html`\n <div class=\"modal is-active\" id=\"error\">\n <div class=\"modal-background\" onclick=\"${errorModal}\"></div>\n <div class=\"modal-card\">\n <header class=\"modal-card-head has-background-danger\">\n <p class=\"modal-card-title has-text-white\">${error.name}</p>\n </header>\n <div class=\"modal-card-body\">\n <p>${error.message}</p>\n ${error.stack ? html`<strong>(${error.stack.match(/[<\\w.]+[\\w>]+:[0-9:]+/g).join(', ')}) Error stack:</strong><pre>${error.stack.replace(/Users\\/[\\w]+/g, '...')}</pre>` : undefined}\n </div>\n </div>\n <a class=\"modal-close\" onclick=\"${errorModal}\"></a>\n </div>\n `)\n }\n}", "title": "" }, { "docid": "e1599c0f20a38dd68c9b6f7cc9d025bd", "score": "0.70333195", "text": "function showErrorMessage(message) {\n dialogScope.error_title = \"Error\";\n dialogScope.error_detail = message;\n\n $uibModal.open({\n templateUrl: '../_p/ui/query/ui-current/password_dialog/qw_query_error_dialog.html',\n scope: dialogScope\n });\n }", "title": "" }, { "docid": "a2e12950b20dee2513f82abbf05475b0", "score": "0.70006424", "text": "function showErrorPromoCodeForm() {\n $promoCodeForm_Error.html('Возникла ошибка.<br>Повторите попытку позже.');\n $promoCodeForm.addClass('error-show');\n\n setTimeout(function () {\n $promoCodeForm.removeClass('error-show');\n }, 3000);\n }", "title": "" }, { "docid": "4913cfc19b2fac1c0853906cfce9e820", "score": "0.6996242", "text": "function handleError(){\n\t\t$form = $('<div class=\"errorBox\" style=\"height:100;width:300px;\">'+\n\t\t\t'<p>Congratulations, you broke the site!<br/>Please reload the page.</p></div>');\n\t\t$form.bPopup({\n\t\t\tescClose: false,\n\t\t\tmodalClose: false\n\t }); \n\t}", "title": "" }, { "docid": "8146a93b3eef4cd3828eb499d52e46a5", "score": "0.69924533", "text": "showErrorBox(title, content) {\r\n eltr.dialog.showErrorBox(title, content);\r\n }", "title": "" }, { "docid": "9e6412a06034a41adc12088e71028f21", "score": "0.69870764", "text": "function error(){\n $( \".error\").show();\n}", "title": "" }, { "docid": "9017505e9f3788e41db9116cb86f7684", "score": "0.69635683", "text": "function ajax_error($modal, $form, error) {\n response = error.responseJSON;\n $modal.find('.alert').remove();\n $('.modal-body', $modal).prepend('<div class=\"alert alert-danger alert-dismissable fade show\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>' + response.message + '</div>');\n}", "title": "" }, { "docid": "4609bb3cb0a9df4bc33299c5b7e300a7", "score": "0.69432336", "text": "function showError() {\n \n if(tipo.validity.valueMissing) {\n tipoError.textContent = 'Selecione o tipo de veículo';\n tipoError.className = 'error active';\n }\n\n else if(marca.validity.valueMissing) {\n marcaError.textContent = 'Selecione a marca do veículo';\n marcaError.className = 'error active';\n }\n}", "title": "" }, { "docid": "a4b18f1b4a60e6638f3da026545ce535", "score": "0.6901803", "text": "function modalError(err, confirmation) {\n reviewForm.style.visibility = 'hidden';\n console.log('Modal error - ', err);\n confirmation.innerHTML = `<p>Sorry there was an error. Please again try later.</p>`;\n modal.appendChild(confirmation);\n setTimeout(() => {\n modalClose();\n }, 4000)\n}", "title": "" }, { "docid": "60d54432d0de3ff718b1cf4bfe7c50d3", "score": "0.6885268", "text": "function openModalOnError(id) {\n id = '#'+id;\n var $errorMessages = $(id + ' .alert.alert-danger');\n var $helpBlocks = $(id + ' .help-block');\n\n if ($errorMessages.length || $helpBlocks.length) {\n $(id).modal();\n }\n}", "title": "" }, { "docid": "b9fd60ce0c7a4d0cec2fdc34929ffe97", "score": "0.6843112", "text": "function _errorModal( message, title, details ){\n // create and return the modal, adding details button only if needed\n Galaxy.modal.show({\n title : title,\n body : message,\n closing_events : true,\n buttons : { Ok: function(){ Galaxy.modal.hide(); } },\n });\n Galaxy.modal.$el.addClass( 'error-modal' );\n\n if( details ){\n Galaxy.modal.$( '.error-details' ).add( Galaxy.modal.$( 'button:contains(\"Details\")' ) ).remove();\n $( '<div/>' ).addClass( 'error-details' )\n .hide().appendTo( Galaxy.modal.$( '.modal-content' ) )\n .append([\n $( '<p/>' ).text( DETAILS_MSG ),\n $( '<pre/>' ).text( JSON.stringify( details, null, ' ' ) )\n ]);\n\n $( '<button id=\"button-1\" class=\"pull-left\">' + _l( 'Details' ) + '</button>' )\n .appendTo( Galaxy.modal.$( '.buttons' ) )\n .click( function(){ Galaxy.modal.$( '.error-details' ).toggle(); });\n }\n return Galaxy.modal;\n}", "title": "" }, { "docid": "c762d4e400e9f2325c10720450335625", "score": "0.6841445", "text": "showError(message) {\n this.overlay.show({\n id: IDS.ERROR,\n image: error_default,\n title: message,\n dissmisable: false\n });\n }", "title": "" }, { "docid": "c8f4a173a9fa3258fe30955ab510b83b", "score": "0.6825155", "text": "function errBox(func, param, msg) {\n\t\tvar errMsg = \"<b>Error in function</b><br/>\" + func + \"<br/>\" +\n\t\t\t\"<b>Parameter</b><br/>\" + param + \"<br/>\" +\n\t\t\t\"<b>Message</b><br/>\" + msg + \"<br/><br/>\" +\n\t\t\t\"<span onmouseover='this.style.cursor=\\\"hand\\\";' onmouseout='this.style.cursor=\\\"inherit\\\";' style='width=100%;text-align:right;'>Click to continue</span></div>\";\n\t\tmodalBox(errMsg);\n\t} // End of function errBox", "title": "" }, { "docid": "683e6ab0fc4593383382ee8ac7c77881", "score": "0.67928904", "text": "function error_modal(heading, msg) {\n var errorModal =\n $('<div class=\"bootstrap modal hide fade\">' +\n '<div class=\"modal-dialog\">' +\n '<div class=\"modal-content\">' +\n '<div class=\"modal-header\">' +\n '<a class=\"close\" data-dismiss=\"modal\" >&times;</a>' +\n '<h4>' + heading + '</h4>' +\n '</div>' +\n '<div class=\"modal-body\">' +\n '<p>' + msg + '</p>' +\n '</div>' +\n '<div class=\"modal-footer\">' +\n '<a href=\"#\" id=\"error_modal_right_button\" class=\"btn btn-default\">' +\n error_continue_msg +\n '</a>' +\n '</div>' +\n '</div>' +\n '</div>' +\n '</div>');\n errorModal.find('#error_modal_right_button').click(function () {\n errorModal.modal('hide');\n });\n errorModal.modal('show');\n}", "title": "" }, { "docid": "968796374e11eacb44a0fb0be26f1f22", "score": "0.6792544", "text": "function badGatewayErrorModal(){\n return errorModal(\n _l( 'Galaxy is currently unreachable. Please try again in a few minutes.' ) + ' ' + CONTACT_MSG,\n _l( 'Cannot connect to Galaxy' )\n );\n}", "title": "" }, { "docid": "4fb97ef7f691bd90dd1135039c514360", "score": "0.67920995", "text": "function setErrorMessage(text, title) {\n $(\"#msgbox_title\").text(title);\n $(\"#msgbox_text\").text(text);\n $(\"#msgbox\").modal(\"show\");\n}", "title": "" }, { "docid": "1d7b99fb76852e207bbd38ff51ba3d30", "score": "0.67859286", "text": "function showError(errorCode) {\n var error = translateError(errorCode);\n \n document.getElementById(\"error_popup\").innerHTML = \"<div class='error_content'>\"+error+\"</div>\";\n document.getElementById(\"error_popup\").style.display = \"block\";\n \n}", "title": "" }, { "docid": "011edfd0e304583efc78cc7c7d0562e4", "score": "0.6740413", "text": "function error() {\n $(\"#locationInp\").show();\n $(\".searchButton\").show();\n }", "title": "" }, { "docid": "e3f284748c74ca8407dc312e211f5fd3", "score": "0.6737151", "text": "function errorModal( message, title, details ){\n if( !message ){ return; }\n\n message = _l( message );\n title = _l( title ) || _l( 'Error:' );\n if( window.Galaxy && Galaxy.modal ){\n return _errorModal( message, title, details );\n }\n\n alert( title + '\\n\\n' + message );\n console.log( 'error details:', JSON.stringify( details ) );\n}", "title": "" }, { "docid": "e8657c318710c55013dcf5ec54bcf3b3", "score": "0.6736061", "text": "function showError(message) {\n errorBox.text(message);\n errorBox.show();\n }", "title": "" }, { "docid": "c685b4b11c1c3cb8cc7f6552afacbd82", "score": "0.67295843", "text": "showError(e) {\n //$(\".modal\").css({ display: \"none\" }); \n var data = JSON.parse(e.responseText);\n swal({\n type: 'error',\n title: 'Oops...',\n text: 'Algo no está bien (' + data.code + '): ' + data.msg,\n footer: '<a href>Contacte a Soporte Técnico</a>',\n })\n }", "title": "" }, { "docid": "c685b4b11c1c3cb8cc7f6552afacbd82", "score": "0.67295843", "text": "showError(e) {\n //$(\".modal\").css({ display: \"none\" }); \n var data = JSON.parse(e.responseText);\n swal({\n type: 'error',\n title: 'Oops...',\n text: 'Algo no está bien (' + data.code + '): ' + data.msg,\n footer: '<a href>Contacte a Soporte Técnico</a>',\n })\n }", "title": "" }, { "docid": "e30bf63cdf42fa35f5ce519b223a1f76", "score": "0.6720963", "text": "function showLoginError(msg) {\n const errMsg = { name : \"loginError\", text : msg };\n showFormError([\n { div : \"emailDiv\", input : \"email\", msg : errMsg }\n , { div : \"passDiv\", input : \"password\", msg : errMsg }\n ]);\n}", "title": "" }, { "docid": "9daddbe067617c2c8dec5d04e3cdf6a5", "score": "0.67131215", "text": "function errorDisplay() {\n $('#errorMsg').fadeIn(10);\n $('#errorMsg').html(\"WRONG !\");\n $('#errorMsg').fadeOut(900);\n}", "title": "" }, { "docid": "e2cc4d7fdeb938e7a6602a4e473a2224", "score": "0.66969824", "text": "function alertError() {\n swal({\n title: \"Action completed!\",\n text: \"Error occurred, please try again!\",\n icon: \"error\",\n button: {\n text: \"OK\",\n closeModal: true,\n visible: true,\n className: \"btn btn-danger btn-lg\"\n }\n });\n }", "title": "" }, { "docid": "e40b6bb84688b90141476880398f914d", "score": "0.66871506", "text": "error() {\n $(\".content\").html(\"<h3 class='text-center my-5'>Er is iets fout gegaan!</h3>\")\n }", "title": "" }, { "docid": "6effa19ae12fcf9c8eac58562941896e", "score": "0.66807395", "text": "function showErrorDialog(capturedError){return true;}", "title": "" }, { "docid": "6effa19ae12fcf9c8eac58562941896e", "score": "0.66807395", "text": "function showErrorDialog(capturedError){return true;}", "title": "" }, { "docid": "6effa19ae12fcf9c8eac58562941896e", "score": "0.66807395", "text": "function showErrorDialog(capturedError){return true;}", "title": "" }, { "docid": "6effa19ae12fcf9c8eac58562941896e", "score": "0.66807395", "text": "function showErrorDialog(capturedError){return true;}", "title": "" }, { "docid": "6effa19ae12fcf9c8eac58562941896e", "score": "0.66807395", "text": "function showErrorDialog(capturedError){return true;}", "title": "" }, { "docid": "6effa19ae12fcf9c8eac58562941896e", "score": "0.66807395", "text": "function showErrorDialog(capturedError){return true;}", "title": "" }, { "docid": "6effa19ae12fcf9c8eac58562941896e", "score": "0.66807395", "text": "function showErrorDialog(capturedError){return true;}", "title": "" }, { "docid": "c7ca84a7792a1b941f8c096e308e1287", "score": "0.66791445", "text": "function error(message) {\n $('#error-content').text(message);\n $('<a href=\"#error\" data-rel=\"dialog\" />').click();\n}", "title": "" }, { "docid": "3ecee60f16e6972e6d191f1350d185e5", "score": "0.66748077", "text": "showErrors(errors) {\n\t\t\t\tconst errorList = Object.values(errors);\n\t\t\t\tthis.showError(errorList[0].toString());\n\t\t\t}", "title": "" }, { "docid": "f4f7e9d709caa7db4b23becf54b7c647", "score": "0.6668916", "text": "function erroAlerta() {\n return Swal.fire({\n title: 'Ops!',\n text: 'Algo errado com {}! Informe a SUINF!',\n icon: 'warning',\n confirmButtonText: 'Continuar'\n });\n }", "title": "" }, { "docid": "ff41a4be79e97a34dc2da8a53bcef570", "score": "0.66674185", "text": "function offlineErrorModal(){\n return errorModal(\n _l( 'You appear to be offline. Please check your connection and try again.' ),\n _l( 'Offline?' )\n );\n}", "title": "" }, { "docid": "5103f193d538b10befb514856baccab3", "score": "0.6665572", "text": "_validateModal(){\n\t\t// If the modal body would be invalid, don't show the modal\n\t\tif(this.modalContent === null){\n\t\t\tthrow \"Specified content for modal body appears invalid.\";\n\t\t}\n\n\t\t// Only show one modal at a time\n\t\tif(document.getElementsByClassName('legend-modal-overlay').length > 0){\n\t\t\tthrow \"Another LegendModal is currently being displayed!\";\n\t\t}\n\t}", "title": "" }, { "docid": "b1c900e480ec344ee3bd22d2e8a65d54", "score": "0.6664131", "text": "function showErrorDialog(boundary,errorInfo){return true;}", "title": "" }, { "docid": "b1c900e480ec344ee3bd22d2e8a65d54", "score": "0.6664131", "text": "function showErrorDialog(boundary,errorInfo){return true;}", "title": "" }, { "docid": "02a34298a88453607594e19d34bd292b", "score": "0.66565865", "text": "function displayError() {\n app.el.$departureTimes.empty();\n $('#routeTitle').html('Sorry, no information availible for this stop.')\n $('#travelTime').html(`:(`);\n const departTimer = $('<li>')\n .addClass('departureTime')\n .html(`--:-- <i class=\"fa fa-question\" aria-hidden=\"true\"></i>`)\n .appendTo(app.el.$departureTimes\n );\n app.modals.display(app.modals.viewRouteDetails);\n }", "title": "" }, { "docid": "a28d62aa83c29bdac1486393debcc847", "score": "0.6646629", "text": "function _showErrorMessage(message) {\n showProgressBar();\n var $popup = editor.popups.get('image.insert');\n var $layer = $popup.find('.fr-image-progress-bar-layer');\n $layer.addClass('fr-error');\n var $message_header = $layer.find('h3');\n $message_header.text(message);\n editor.events.disableBlur();\n $message_header.focus();\n }", "title": "" }, { "docid": "f87f1503d968826792f1bd8f08830247", "score": "0.6638002", "text": "function showErrorDialog(message) {\n var subdirectory = '/ui-current';\n\n var dialogScope = $rootScope.$new(true);\n dialogScope.error_title = \"Error\";\n dialogScope.error_detail = message;\n\n $uibModal.open({\n templateUrl: '../_p/ui/query' + subdirectory + '/password_dialog/qw_query_error_dialog.html',\n scope: dialogScope\n });\n }", "title": "" }, { "docid": "7ee918f0c6e8ea2a17bc0444b819a0bf", "score": "0.6636533", "text": "function showErrorDirect(errorMessage){\r\n\t$('#error_box').html('');\r\n\t$('#error_box').show();\r\n\t$('#error_box').html('<p><strong>失败:</strong>'+errorMessage+'</p>');\r\n}", "title": "" }, { "docid": "dbd948523694ac0b4b8d2667abce6042", "score": "0.66039693", "text": "showError(err) {\n }", "title": "" }, { "docid": "e1a45580372b3a5bb0a42e172ee7e716", "score": "0.66014206", "text": "function showErrorDialog(errorMessage, args) {\n if (typeof args !== 'undefined') {\n var key;\n for (key in args) {\n if (args.hasOwnProperty(key)) {\n errorMessage = errorMessage.replace(\"_\" + key + \"_\", args[key]);\n }\n }\n }\n\n var errorDialogTemplate = require(\"text!templates/error-dialog.html\");\n var compiledTemplate = Mustache.render(errorDialogTemplate, {\n title: Strings.ERROR_TITLE,\n error: errorMessage,\n Strings: Strings\n });\n\n Dialogs.showModalDialogUsingTemplate(compiledTemplate).done(function (buttonId) {\n if (buttonId === \"settings\") {\n CommandManager.execute(GFT_SETTINGS_CMD_ID);\n }\n });\n\n endGoFmt();\n }", "title": "" }, { "docid": "b3cce4c8af14b77bfc6221516bed3462", "score": "0.65940267", "text": "function api_errors(rejection){\n $( \"#alert\" ).fadeIn( \"fast\", function() {\n $( this ).html(rejection.data);\n $( \"#alert\" ).fadeOut( 5000 );\n });\n}", "title": "" }, { "docid": "f9db6e8332127f9b61f26a550170e051", "score": "0.6587209", "text": "errorMode() {\n\t\t\tparent.setAttribute(\"bsod\", \"\");\n\t\t\tpublic.show();\n\t\t}", "title": "" }, { "docid": "420f4edf8a6cd0a05d61c1e0dd85aae8", "score": "0.658571", "text": "function uploadFailure() {\n modal2.style.display = \"block\";\n }", "title": "" }, { "docid": "be2fe098a970c9db4755c95bd915e6e8", "score": "0.6578715", "text": "function _showErrorMessage(message) {\n showProgressBar();\n var $popup = editor.popups.get('video.insert');\n var $layer = $popup.find('.fr-video-progress-bar-layer');\n $layer.addClass('fr-error');\n var $message_header = $layer.find('h3');\n $message_header.text(message);\n editor.events.disableBlur();\n $message_header.focus();\n }", "title": "" }, { "docid": "7d56a57bceafd91e95509fd93c290f55", "score": "0.6573735", "text": "function renderError() {\n if (typeof errorMessage === 'string') {\n return (\n // JSX to create the modal\n <ErrorModal message={errorMessage}/>\n )\n }\n }", "title": "" }, { "docid": "9ad908e0e895d2a9cec5bfaae77985c6", "score": "0.65690297", "text": "function displayError(errMsg) {\n $(\"#error-msg\").html(errMsg);\n $(\"#error-alert\").show();\n}", "title": "" }, { "docid": "834a401edce67d6fb4bc807c838464ec", "score": "0.6565724", "text": "function errorMsg(err){\n Swal.fire({\n icon: 'error',\n title: 'Well this is embarrassing ...',\n text: `${err}`,\n footer: \"<p>Let's try that again shall we?</p>\"\n });\n}", "title": "" }, { "docid": "a8142d92d824a2f6b3933e69d2d461da", "score": "0.6564631", "text": "function accessibleError(title, message) {\n accessible_modal(\n \"#accessible-error-modal #confirm_open_button\",\n \"#accessible-error-modal .close-modal\",\n \"#accessible-error-modal\",\n \".content-wrapper\"\n );\n $(\"#accessible-error-modal #confirm_open_button\").click();\n $(\"#accessible-error-modal .message-title\").html(message);\n $('#accessible-error-modal #acessible-error-title').html(title);\n $(\"#accessible-error-modal .ok-button\")\n .html(gettext(\"OK\"))\n .off('click.closeModal')\n .on('click.closeModal', function(){\n $(\"#accessible-error-modal .close-modal\").click();\n });\n }", "title": "" }, { "docid": "6f07767b88cf006cec1a13fec3123c43", "score": "0.65606165", "text": "function displayErrorMsg(flag, msg) {\n //$(\"#divrunning\").\n console.log(\"========\",currentValidationName);\n let row = $('#errorContainer').remove().clone();\n $('#div'+currentValidationName).after(row);\n var errorMsg = $(\"#errorDiv\").find(\"#errorStr\");\n //console.log(\"====================flag=\",flag);\n\n if(errorMsg)\n {\n errorMsg.html(msg +\", please provide valid data for the highlighted rows.\");\n if(document.getElementById(\"mydiv\"))\n document.getElementById(\"mydiv\").style.display = !flag ? \"none\" : \"block\";\n if(document.getElementById(\"errorDiv\"))\n document.getElementById(\"errorDiv\").style.display = !flag ? \"none\" : \"block\";\n if(document.getElementById(\"buttonDivProceed\"))\n document.getElementById(\"buttonDivProceed\").style.display = !flag ? \"none\" : \"block\";\n }\n}", "title": "" }, { "docid": "4a218e3753748b15e6b97d3e9339b425", "score": "0.6554597", "text": "function displayFailModal() {\n isReload = false;\n document.getElementById('failModal').style.display = 'block';\n}", "title": "" }, { "docid": "cd756e3e2854b5391982d7d21bbde6ac", "score": "0.6551804", "text": "showErrorMesage() {\n this.metaElement.innerHTML = '<div class=\"alert alert-danger\" role=\"alert\">Error retrieving data</div>';\n }", "title": "" }, { "docid": "43dfc612e128d31a06c53bbd3d192176", "score": "0.6545131", "text": "function showError(message) {\n appendText($(\"error\"),message);\n $(\"error\").show();\n}", "title": "" }, { "docid": "c9ea0c32fe2a9efd596bf97644e44e64", "score": "0.65420747", "text": "function errorModal(errcode, manualtext) {\n\tswitch (errcode) {\n\t\tcase \"timeout\":\n\t\t\tvar dialogTxt = locale.modal.error.timeout;\n\t\t\tbreak;\n\t\tcase 403:\n\t\t\tvar dialogTxt = locale.modal.error.http_code_403;\n\t\t\tbreak;\n\t\tcase 404:\n\t\t\tvar dialogTxt = locale.modal.error.http_code_404;\n\t\t\tbreak;\n\t\tcase 408:\n\t\t\tvar dialogTxt = locale.modal.error.http_code_408;\n\t\t\tbreak;\n\t\tcase 500:\n\t\t\tvar dialogTxt = locale.modal.error.http_code_500;\n\t\t\tbreak;\n\t\tcase \"manual\":\n\t\t\tif (typeof manualtext !== 'undefined') {\n\t\t\t\tvar dialogTxt = manualtext;\n\t\t\t\tbreak;\n\t\t\t}\n\t\tdefault:\n\t\t\tvar dialogTxt = locale.modal.error.catchall;\n\t\t\tbreak;\n\t}\n\tvar modalContent = [\n\t\t'<i id=\"modal-close\" class=\"fa fa-times\" title=\"'+ locale.general.close +'\" onclick=\"modalToggle(\\'off\\');\"></i>',\n\t\t'<div class=\"row modal-window-wrapper-top\">',\n\t\t'\t<p>'+ dialogTxt +'</p>',\n\t\t'</div>',\n\t\t'<div class=\"row modal-window-wrapper-bottom\">',\n\t\t'\t<button type=\"button\" class=\"button color green large\" aria-label=\"'+ locale.general.continue +'\" onclick=\"modalToggle(\\'off\\');\">'+ locale.general.continue +'</button>',\n\t\t'\t<button type=\"button\" class=\"button color cyan large\" aria-label=\"'+ locale.general.reload +'\" onclick=\"window.location.reload();\">'+ locale.general.reload +'</button>',\n\t\t'</div>'\n\t].join(\"\\n\");\n\t$('#modal-window').empty().append(modalContent);\n\tmodalToggle(\"on\");\n\tuserControl(\"open\");\n\tstatusIndicator(\"error\");\n}", "title": "" }, { "docid": "56b48aa81e7e50b6b6c71239dbbb0e4e", "score": "0.6541402", "text": "function showClientSideErrorNotification(message) {\r\n if (!message) {\r\n message = getMessage(kradVariables.MESSAGE_FORM_CONTAINS_ERRORS);\r\n }\r\n\r\n showLightboxContent(message);\r\n}", "title": "" }, { "docid": "e363feb31b80fb889ec96a7d4f6fd67a", "score": "0.6539382", "text": "function showError () {\n\n console.log('MSW api request unsuccessful');\n\n // Before rendering the error message, check which surf guide // is currently open and make sure it matches the API request.\n // This ensures that an api request that takes time to\n // download isn't injected into another surf guide if the user\n // changes surf guides during the api request processing\n if ($currentSurfGuide === breakName) {\n\n // Create error elems\n var errorFrame = '<div class=\"col-xs-12 error-frame\"></div>',\n errorElem = '<div class=\"error-container\"></div>',\n errorMsg = '<p class=\"conditions-error\">' + breakName + ' ' + \"conditions unavailable =(\" + '</p>',\n errorCloseButton = '<button type=\"button\" class=\"btn error-close-button\">✖</button>';\n\n // Insert a frame to hold the error container\n $surfGuideHeader.after(errorFrame);\n\n // Create a DOM ref to the error frame\n var $errorFrame = $('.error-frame');\n\n // Insert the error container\n $errorFrame.append(errorElem);\n\n // Create a DOM ref to the error container\n var $errorContainer = $('.error-container');\n\n // Insert the error message\n $errorContainer.append(errorMsg);\n\n // Add a button for closing the error window\n $errorContainer.prepend(errorCloseButton);\n\n // Create a DOM ref to the error close button\n var $errorCloseButton = $('.error-close-button');\n\n // When the conditions close button is clicked remove the\n // error message\n $errorCloseButton.on('click', function(e) {\n\n // Remove conditions row from DOM\n $errorFrame.remove();\n\n // Remove the close conditions button\n $closeConditionsButton.remove();\n\n // Make visible the show surf conditions button\n $conditionsBtn.toggle();\n });\n\n } else {\n\n return;\n }\n }", "title": "" }, { "docid": "ee2270c3cee554fc79199c4f2b3bebd8", "score": "0.65376246", "text": "showErrorModal(opts = {}) {\n opts = Object.assign({}, {\n\n }, opts)\n const refresh_btn = `\n <button type=\"button\" class=\"btn btn-warning\" data-dismiss=\"modal\" x-view=\"${this.id}\">retry</button>\n `\n const div = $(`\n <div class=\"modal fade modal-error\" tabindex=\"-1\" role=\"dialog\" data-backdrop=\"static\">\n <div class=\"modal-dialog modal-dialog-centerxed\" role=\"document\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <h5 class=\"modal-title w-100 text-danger text-center position-relative\">\n <i class=\"fa fa-times-circle-o\"></i>\n <br>${opts.title}\n <div class=\"text-white text-center subtitle\">${opts.subtitle}</div>\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n </h5>\n </div>\n <div class=\"modal-body\">\n ${opts.message}\n </div>\n <div class=\"modal-footer\">\n ${opts.refresh_btn ? refresh_btn : \"\"}\n <button type=\"button\" class=\"btn ${opts.btn_class || \"btn-secondary\"}\" data-dismiss=\"modal\">${opts.btn_text || \"Dismiss\"}</button>\n </div>\n </div>\n </div>\n </div>\n `)\n $(\"body\").prepend(div)\n div.on(\"hidden.bs.modal\", ev => {\n div.modal(\"dispose\").remove()\n })\n div.modal(\"show\")\n }", "title": "" }, { "docid": "3793b5d8912b6b5d2d85caf0d13afc69", "score": "0.65330815", "text": "function wlsmDisplayFormErrors(response, formId) {\n\t\t\tif(response.data && $.isPlainObject(response.data)) {\n\t\t\t\t$(formId + ' :input').each(function() {\n\t\t\t\t\tvar input = this;\n\t\t\t\t\t$(input).removeClass('wlsm-is-invalid');\n\t\t\t\t\tif(response.data[input.name]) {\n\t\t\t\t\t\tvar errorSpan = '<div class=\"wlsm-text-danger wlsm-mt-1\">' + response.data[input.name] + '</div>';\n\t\t\t\t\t\t$(input).addClass('wlsm-is-invalid');\n\t\t\t\t\t\t$(errorSpan).insertAfter(input);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tvar errorSpan = '<div class=\"wlsm-text-danger wlsm-mt-3\">' + response.data + '<hr></div>';\n\t\t\t\t$(errorSpan).insertBefore(formId);\n\t\t\t\ttoastr.error(response.data);\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "ad92b890510c5ec7c6c5bd4cdd3786a4", "score": "0.65297383", "text": "function showError(){\n\n\n // hide result:\n document.getElementById(\"results\").style.display = \"none\";\n // hide loader:\n document.getElementById(\"loading\").style.display = \"none\";\n\n // create a div(karon amra error dekhate chaitesi bootstrap alert class er maddome ar ei alert class ti div er under ei thake tai div create korte hobe)\n const errorDiv = document.createElement(\"div\")\n //jehetu ami error message ta card e dakhabo tai card select kora laagbe and jehetu ami ta heading er age dekhabo tai heading soho select kora laagbe!\n const card = document.querySelector(\".card\") \n const heading = document.querySelector(\".heading\")\n\n errorDiv.className = \"alert alert-danger\"\n errorDiv.textContent = \"Please check your numbers\"\n\n // inser error message befor heading:\n card.insertBefore(errorDiv,heading)\n // card.insertBefore(errorDiv,heading) er means holo je heading er age jate amar error message ta show kore!\n\n // Clear error after 2 seconds(2000 milliseconds):\n // nicher setTimeout()ekti build in function eti 2 ti parameter ney and er kaaj hocce je error message ti jate amar 3 sec screen e show kore!\n setTimeout(function clearError(){\n\n document.querySelector(\".alert\").remove()\n\n\n },2000)\n\n\n \n}", "title": "" }, { "docid": "3e7ab9780a2cc7650f4759f00224d70f", "score": "0.6528054", "text": "function showCreateInputError(msg) {\n showFormError([{ div : \"titleDiv\", input : \"title\"\n , msg : { name : \"titleError\", text : msg } }]\n );\n}", "title": "" }, { "docid": "909fcaed1d788948098bc93ab481f4d7", "score": "0.65278906", "text": "function ajaxErrorModal( model, xhr, options, message, title ){\n message = message || DEFAULT_AJAX_ERR_MSG;\n message += ' ' + CONTACT_MSG;\n title = title || _l( 'An error occurred' );\n var details = _ajaxDetails( model, xhr, options );\n return errorModal( message, title, details );\n}", "title": "" }, { "docid": "05bd6f81c073fd383618f02f6b9550f9", "score": "0.6522111", "text": "function showError() {\n ctrl.isShowError = true;\n ctrl.isShowSpinner = false;\n }", "title": "" }, { "docid": "306650ad571a48963d5a08a3cef0f2ac", "score": "0.6520476", "text": "function ShowErrorMessagePopUp(msg, isError) {\n if (isError == true || isError == undefined)\n jQuery(\"#alertMessage\").addClass(\"text-danger\")\n else\n jQuery(\"#alertMessage\").removeClass(\"text-danger\")\n jQuery(\"#alertMessage\").html(msg);\n jQuery(\"#confirmModal\").dialog({\n modal: true,\n buttons: [\n {\n text: languageResource.resMsg_BtnOK,\n click: function () {\n jQuery(\"#confirmModal\").dialog(\"close\");\n }\n }\n ]\n });\n}", "title": "" }, { "docid": "3d7b3b516a7ff0976adc68db147efa3f", "score": "0.651588", "text": "function errorMessage(message) {\n \"use strict\";\n $('#alert').html('<div class=\"ui-state-error ui-corner-all\"><p class=\"state-title\"><span class=\"ui-icon ui-icon-alert state-title-icon\"></span>Sorry! Something went wrong..</p><p class=\"state-content\">' + message + '</p></div>').dialog({\n draggable: false,\n title: 'Alert',\n resizable: false,\n width: 400,\n modal: true,\n buttons: {\n Ok: function () {\n $(this).dialog(\"close\");\n }\n }\n });\n}", "title": "" }, { "docid": "8896271a6fc8fd0895ca5673bcc6348f", "score": "0.6514386", "text": "function _showErrorMessage(message) {\n showProgressBar();\n var $popup = editor.popups.get('file.insert');\n var $layer = $popup.find('.fr-file-progress-bar-layer');\n $layer.addClass('fr-error');\n var $message_header = $layer.find('h3');\n $message_header.text(message);\n editor.events.disableBlur();\n $message_header.focus();\n }", "title": "" }, { "docid": "c99438c467412a8aa29c886b007d2fe1", "score": "0.6511551", "text": "function showErrorDialog(capturedError) {\r\n return true\r\n }", "title": "" }, { "docid": "358990d433a0537f5c99698501e968f3", "score": "0.65114903", "text": "function displayError(){\n\n\t\t$('#displayError').text('enter city name or zip code')\n\n\t}", "title": "" }, { "docid": "eb728051c834eb5813d648a512ef424e", "score": "0.6502992", "text": "display_errors() {\r\n //\r\n //create a div where to append the errors with an id of errors \r\n const div = document.createElement('div');\r\n div.setAttribute(\"id\", \"errors\");\r\n //\r\n //add the title of this error reportin as this partial name has count no\r\n // of error\r\n const title = document.createElement('h2');\r\n title.textContent = `<u><b>This shema ${this.partial_name} has ${this.errors.length} not compliant \n with the mutall framework </u></b>`;\r\n div.appendChild(title);\r\n //\r\n //loop through each of the errors appending their text content to the div \r\n this.errors.forEach(function (error) {\r\n //\r\n const msg = document.createElement(\"label\");\r\n msg.textContent = error.message;\r\n div.appendChild(msg);\r\n });\r\n //\r\n return div;\r\n }", "title": "" }, { "docid": "ac8f3d7d5375bbf25f481a449549e377", "score": "0.6502525", "text": "getErrorModal() {\n return(\n <Modal show={this.state.displayErrorsModal} onHide={() => this.setState({displayErrorsModal: false})} centered>\n <Modal.Header closeButton>\n <Modal.Title>Error</Modal.Title>\n </Modal.Header>\n <Modal.Body>\n <div>\n {this.state.errorMessage}\n </div>\n </Modal.Body>\n <Modal.Footer>\n <Button variant=\"secondary\" onClick={() => this.setState({displayErrorsModal: false})}>\n Close\n </Button>\n </Modal.Footer>\n </Modal>\n );\n }", "title": "" }, { "docid": "d688e382bda7c0a6dba562c2487642f2", "score": "0.6499141", "text": "function showError(error){ alert(error); }", "title": "" }, { "docid": "20a12778de7d8d3498cbbe492bd2a964", "score": "0.6483292", "text": "function err(text)\n{\n\tsetText('jsAlertMessage',text);\n\tshowPopup('alert',1);\n\t// the following turns on alert elements specific to errors and turns off the default (message) controls\n\tobj('errorTitle').style.display = 'inline';\n\tobj('errorControls').style.display = 'inline';\n\tobj('messageControls').style.display = 'none';\n\t\n\twindow.scroll(0,0);\n}", "title": "" }, { "docid": "c6052914e0461e3206a99093dc6974ba", "score": "0.6481209", "text": "function showErrorDialog(boundary, errorInfo) {\n return true;\n }", "title": "" }, { "docid": "f9eede860e627d92e06b889c8754695f", "score": "0.64777654", "text": "function exibirMensagemModal(data) {\n if (data.erro) {\n document.getElementById('mensagem').textContent = 'Não foi possível concluir a operação.'\n document.getElementById('mensagem').setAttribute('class', 'alert alert-danger')\n\n var divMensagemErro\n var erros = data.erro\n $('#mensagemErros').empty()\n for (var i = 0; i < erros.length; i++) {\n $('#mensagemErros').append(\"<div class='alert alert-danger'>\" + erros[i] + \"</div>\" + \"<br/>\")\n console.log(erros[i])\n }\n\n $('#mensagemModal').modal('show')\n } else {\n document.getElementById('mensagem').textContent = 'Cadastro realizado com sucesso.'\n document.getElementById('mensagem').setAttribute('class', 'alert alert-success')\n $('#mensagemErros').empty()\n $('#mensagemModal').modal('show')\n $('input').val('')\n $(\"input[type=text]\").val('')\n $('select').val('0')\n }\n}", "title": "" }, { "docid": "29b6dfbd449f3249110e7c8aafeda61e", "score": "0.64748174", "text": "function showInvalidMoveModal(){\n $(\"#invalidMoveModal\").modal(\"show\");\n}", "title": "" }, { "docid": "cc6304b667a8c9d303f021bb6cd0cefd", "score": "0.64680296", "text": "function showModal(modalTitle, modalBody) {\n $(\"#modal-title\").html(modalTitle);\n $(\"#modal-body\").html(modalBody);\n $(\"#error-modal\").modal(\"toggle\");\n }", "title": "" }, { "docid": "f186f7196addff95e34934a204a7aeaa", "score": "0.6466087", "text": "function showError(msg) {\n showMessage(msg);\n}", "title": "" }, { "docid": "216d63397ab382dc174afdcd1cd21acc", "score": "0.6462067", "text": "function showErrorMessage(msg) {\n // Toggle the display of the error message\n $('#errorMessageText').html(msg);\n $('#errorMessage').show();\n}", "title": "" }, { "docid": "d0fd54d8c9ac0ee8b83a4ab690e53515", "score": "0.6459875", "text": "function showErrors(name, msg) {\n var error = document.querySelector(\"#error\");\n error.innerHTML = name + \"<br>\" + msg;\n }", "title": "" } ]
550866e1b9deda4bd5db6882095b7bfc
IE 11 has an annoying issue where you can't move focus into the editor by clicking on the white area HTML element. We used to be able to to fix this with the fixCaretSelectionOfDocumentElementOnIe fix. But since M$ removed the selection object it's not possible anymore. So we need to hack in a ungly CSS to force the body to be at least 150px. If the user clicks the HTML element out side this 150px region we simply move the focus into the first paragraph. Not ideal since you loose the positioning of the caret but goot enough for most cases.
[ { "docid": "c2e6026d5a63f362f4226740040f9c26", "score": "0.58113265", "text": "function bodyHeight() {\n\t\t\tif (!editor.inline) {\n\t\t\t\teditor.contentStyles.push('body {min-height: 150px}');\n\t\t\t\teditor.on('click', function(e) {\n\t\t\t\t\tvar rng;\n\n\t\t\t\t\tif (e.target.nodeName == 'HTML') {\n\t\t\t\t\t\t// Edge seems to only need focus if we set the range\n\t\t\t\t\t\t// the caret will become invisible and moved out of the iframe!!\n\t\t\t\t\t\tif (Env.ie > 11) {\n\t\t\t\t\t\t\teditor.getBody().focus();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Need to store away non collapsed ranges since the focus call will mess that up see #7382\n\t\t\t\t\t\trng = editor.selection.getRng();\n\t\t\t\t\t\teditor.getBody().focus();\n\t\t\t\t\t\teditor.selection.setRng(rng);\n\t\t\t\t\t\teditor.selection.normalize();\n\t\t\t\t\t\teditor.nodeChanged();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}", "title": "" } ]
[ { "docid": "695245a38c8ae4d79d4b786fa1941055", "score": "0.7430222", "text": "function fixCaretSelectionOfDocumentElementOnIe() {\n var doc = dom.doc, body = doc.body, started, startRng, htmlElm;\n\n // Return range from point or null if it failed\n function rngFromPoint(x, y) {\n var rng = body.createTextRange();\n\n try {\n rng.moveToPoint(x, y);\n } catch (ex) {\n // IE sometimes throws and exception, so lets just ignore it\n rng = null;\n }\n\n return rng;\n }\n\n // Fires while the selection is changing\n function selectionChange(e) {\n var pointRng;\n\n // Check if the button is down or not\n if (e.button) {\n // Create range from mouse position\n pointRng = rngFromPoint(e.x, e.y);\n\n if (pointRng) {\n // Check if pointRange is before/after selection then change the endPoint\n if (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n pointRng.setEndPoint('StartToStart', startRng);\n } else {\n pointRng.setEndPoint('EndToEnd', startRng);\n }\n\n pointRng.select();\n }\n } else {\n endSelection();\n }\n }\n\n // Removes listeners\n function endSelection() {\n var rng = doc.selection.createRange();\n\n // If the range is collapsed then use the last start range\n if (startRng && !rng.item && rng.compareEndPoints('StartToEnd', rng) === 0) {\n startRng.select();\n }\n\n dom.unbind(doc, 'mouseup', endSelection);\n dom.unbind(doc, 'mousemove', selectionChange);\n startRng = started = 0;\n }\n\n // Make HTML element unselectable since we are going to handle selection by hand\n doc.documentElement.unselectable = true;\n\n // Detect when user selects outside BODY\n dom.bind(doc, 'mousedown contextmenu', function (e) {\n if (e.target.nodeName === 'HTML') {\n if (started) {\n endSelection();\n }\n\n // Detect vertical scrollbar, since IE will fire a mousedown on the scrollbar and have target set as HTML\n htmlElm = doc.documentElement;\n if (htmlElm.scrollHeight > htmlElm.clientHeight) {\n return;\n }\n\n started = 1;\n // Setup start position\n startRng = rngFromPoint(e.x, e.y);\n if (startRng) {\n // Listen for selection change events\n dom.bind(doc, 'mouseup', endSelection);\n dom.bind(doc, 'mousemove', selectionChange);\n\n dom.getRoot().focus();\n startRng.select();\n }\n }\n });\n }", "title": "" }, { "docid": "695245a38c8ae4d79d4b786fa1941055", "score": "0.7430222", "text": "function fixCaretSelectionOfDocumentElementOnIe() {\n var doc = dom.doc, body = doc.body, started, startRng, htmlElm;\n\n // Return range from point or null if it failed\n function rngFromPoint(x, y) {\n var rng = body.createTextRange();\n\n try {\n rng.moveToPoint(x, y);\n } catch (ex) {\n // IE sometimes throws and exception, so lets just ignore it\n rng = null;\n }\n\n return rng;\n }\n\n // Fires while the selection is changing\n function selectionChange(e) {\n var pointRng;\n\n // Check if the button is down or not\n if (e.button) {\n // Create range from mouse position\n pointRng = rngFromPoint(e.x, e.y);\n\n if (pointRng) {\n // Check if pointRange is before/after selection then change the endPoint\n if (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n pointRng.setEndPoint('StartToStart', startRng);\n } else {\n pointRng.setEndPoint('EndToEnd', startRng);\n }\n\n pointRng.select();\n }\n } else {\n endSelection();\n }\n }\n\n // Removes listeners\n function endSelection() {\n var rng = doc.selection.createRange();\n\n // If the range is collapsed then use the last start range\n if (startRng && !rng.item && rng.compareEndPoints('StartToEnd', rng) === 0) {\n startRng.select();\n }\n\n dom.unbind(doc, 'mouseup', endSelection);\n dom.unbind(doc, 'mousemove', selectionChange);\n startRng = started = 0;\n }\n\n // Make HTML element unselectable since we are going to handle selection by hand\n doc.documentElement.unselectable = true;\n\n // Detect when user selects outside BODY\n dom.bind(doc, 'mousedown contextmenu', function (e) {\n if (e.target.nodeName === 'HTML') {\n if (started) {\n endSelection();\n }\n\n // Detect vertical scrollbar, since IE will fire a mousedown on the scrollbar and have target set as HTML\n htmlElm = doc.documentElement;\n if (htmlElm.scrollHeight > htmlElm.clientHeight) {\n return;\n }\n\n started = 1;\n // Setup start position\n startRng = rngFromPoint(e.x, e.y);\n if (startRng) {\n // Listen for selection change events\n dom.bind(doc, 'mouseup', endSelection);\n dom.bind(doc, 'mousemove', selectionChange);\n\n dom.getRoot().focus();\n startRng.select();\n }\n }\n });\n }", "title": "" }, { "docid": "40beaeb25e8900c5bbaa3e2f996991f4", "score": "0.7158401", "text": "function fixCaretSelectionOfDocumentElementOnIe() {\n\t\t\tvar doc = dom.doc, body = doc.body, started, startRng, htmlElm;\n\n\t\t\t// Return range from point or null if it failed\n\t\t\tfunction rngFromPoint(x, y) {\n\t\t\t\tvar rng = body.createTextRange();\n\n\t\t\t\ttry {\n\t\t\t\t\trng.moveToPoint(x, y);\n\t\t\t\t} catch (ex) {\n\t\t\t\t\t// IE sometimes throws and exception, so lets just ignore it\n\t\t\t\t\trng = null;\n\t\t\t\t}\n\n\t\t\t\treturn rng;\n\t\t\t}\n\n\t\t\t// Fires while the selection is changing\n\t\t\tfunction selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tendSelection();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Removes listeners\n\t\t\tfunction endSelection() {\n\t\t\t\tvar rng = doc.selection.createRange();\n\n\t\t\t\t// If the range is collapsed then use the last start range\n\t\t\t\tif (startRng && !rng.item && rng.compareEndPoints('StartToEnd', rng) === 0) {\n\t\t\t\t\tstartRng.select();\n\t\t\t\t}\n\n\t\t\t\tdom.unbind(doc, 'mouseup', endSelection);\n\t\t\t\tdom.unbind(doc, 'mousemove', selectionChange);\n\t\t\t\tstartRng = started = 0;\n\t\t\t}\n\n\t\t\t// Make HTML element unselectable since we are going to handle selection by hand\n\t\t\tdoc.documentElement.unselectable = true;\n\n\t\t\t// Detect when user selects outside BODY\n\t\t\tdom.bind(doc, 'mousedown contextmenu', function(e) {\n\t\t\t\tif (e.target.nodeName === 'HTML') {\n\t\t\t\t\tif (started) {\n\t\t\t\t\t\tendSelection();\n\t\t\t\t\t}\n\n\t\t\t\t\t// Detect vertical scrollbar, since IE will fire a mousedown on the scrollbar and have target set as HTML\n\t\t\t\t\thtmlElm = doc.documentElement;\n\t\t\t\t\tif (htmlElm.scrollHeight > htmlElm.clientHeight) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tstarted = 1;\n\t\t\t\t\t// Setup start position\n\t\t\t\t\tstartRng = rngFromPoint(e.x, e.y);\n\t\t\t\t\tif (startRng) {\n\t\t\t\t\t\t// Listen for selection change events\n\t\t\t\t\t\tdom.bind(doc, 'mouseup', endSelection);\n\t\t\t\t\t\tdom.bind(doc, 'mousemove', selectionChange);\n\n\t\t\t\t\t\tdom.getRoot().focus();\n\t\t\t\t\t\tstartRng.select();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}", "title": "" }, { "docid": "40beaeb25e8900c5bbaa3e2f996991f4", "score": "0.7158401", "text": "function fixCaretSelectionOfDocumentElementOnIe() {\n\t\t\tvar doc = dom.doc, body = doc.body, started, startRng, htmlElm;\n\n\t\t\t// Return range from point or null if it failed\n\t\t\tfunction rngFromPoint(x, y) {\n\t\t\t\tvar rng = body.createTextRange();\n\n\t\t\t\ttry {\n\t\t\t\t\trng.moveToPoint(x, y);\n\t\t\t\t} catch (ex) {\n\t\t\t\t\t// IE sometimes throws and exception, so lets just ignore it\n\t\t\t\t\trng = null;\n\t\t\t\t}\n\n\t\t\t\treturn rng;\n\t\t\t}\n\n\t\t\t// Fires while the selection is changing\n\t\t\tfunction selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tendSelection();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Removes listeners\n\t\t\tfunction endSelection() {\n\t\t\t\tvar rng = doc.selection.createRange();\n\n\t\t\t\t// If the range is collapsed then use the last start range\n\t\t\t\tif (startRng && !rng.item && rng.compareEndPoints('StartToEnd', rng) === 0) {\n\t\t\t\t\tstartRng.select();\n\t\t\t\t}\n\n\t\t\t\tdom.unbind(doc, 'mouseup', endSelection);\n\t\t\t\tdom.unbind(doc, 'mousemove', selectionChange);\n\t\t\t\tstartRng = started = 0;\n\t\t\t}\n\n\t\t\t// Make HTML element unselectable since we are going to handle selection by hand\n\t\t\tdoc.documentElement.unselectable = true;\n\n\t\t\t// Detect when user selects outside BODY\n\t\t\tdom.bind(doc, 'mousedown contextmenu', function(e) {\n\t\t\t\tif (e.target.nodeName === 'HTML') {\n\t\t\t\t\tif (started) {\n\t\t\t\t\t\tendSelection();\n\t\t\t\t\t}\n\n\t\t\t\t\t// Detect vertical scrollbar, since IE will fire a mousedown on the scrollbar and have target set as HTML\n\t\t\t\t\thtmlElm = doc.documentElement;\n\t\t\t\t\tif (htmlElm.scrollHeight > htmlElm.clientHeight) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tstarted = 1;\n\t\t\t\t\t// Setup start position\n\t\t\t\t\tstartRng = rngFromPoint(e.x, e.y);\n\t\t\t\t\tif (startRng) {\n\t\t\t\t\t\t// Listen for selection change events\n\t\t\t\t\t\tdom.bind(doc, 'mouseup', endSelection);\n\t\t\t\t\t\tdom.bind(doc, 'mousemove', selectionChange);\n\n\t\t\t\t\t\tdom.getRoot().focus();\n\t\t\t\t\t\tstartRng.select();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}", "title": "" }, { "docid": "40beaeb25e8900c5bbaa3e2f996991f4", "score": "0.7158401", "text": "function fixCaretSelectionOfDocumentElementOnIe() {\n\t\t\tvar doc = dom.doc, body = doc.body, started, startRng, htmlElm;\n\n\t\t\t// Return range from point or null if it failed\n\t\t\tfunction rngFromPoint(x, y) {\n\t\t\t\tvar rng = body.createTextRange();\n\n\t\t\t\ttry {\n\t\t\t\t\trng.moveToPoint(x, y);\n\t\t\t\t} catch (ex) {\n\t\t\t\t\t// IE sometimes throws and exception, so lets just ignore it\n\t\t\t\t\trng = null;\n\t\t\t\t}\n\n\t\t\t\treturn rng;\n\t\t\t}\n\n\t\t\t// Fires while the selection is changing\n\t\t\tfunction selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tendSelection();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Removes listeners\n\t\t\tfunction endSelection() {\n\t\t\t\tvar rng = doc.selection.createRange();\n\n\t\t\t\t// If the range is collapsed then use the last start range\n\t\t\t\tif (startRng && !rng.item && rng.compareEndPoints('StartToEnd', rng) === 0) {\n\t\t\t\t\tstartRng.select();\n\t\t\t\t}\n\n\t\t\t\tdom.unbind(doc, 'mouseup', endSelection);\n\t\t\t\tdom.unbind(doc, 'mousemove', selectionChange);\n\t\t\t\tstartRng = started = 0;\n\t\t\t}\n\n\t\t\t// Make HTML element unselectable since we are going to handle selection by hand\n\t\t\tdoc.documentElement.unselectable = true;\n\n\t\t\t// Detect when user selects outside BODY\n\t\t\tdom.bind(doc, 'mousedown contextmenu', function(e) {\n\t\t\t\tif (e.target.nodeName === 'HTML') {\n\t\t\t\t\tif (started) {\n\t\t\t\t\t\tendSelection();\n\t\t\t\t\t}\n\n\t\t\t\t\t// Detect vertical scrollbar, since IE will fire a mousedown on the scrollbar and have target set as HTML\n\t\t\t\t\thtmlElm = doc.documentElement;\n\t\t\t\t\tif (htmlElm.scrollHeight > htmlElm.clientHeight) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tstarted = 1;\n\t\t\t\t\t// Setup start position\n\t\t\t\t\tstartRng = rngFromPoint(e.x, e.y);\n\t\t\t\t\tif (startRng) {\n\t\t\t\t\t\t// Listen for selection change events\n\t\t\t\t\t\tdom.bind(doc, 'mouseup', endSelection);\n\t\t\t\t\t\tdom.bind(doc, 'mousemove', selectionChange);\n\n\t\t\t\t\t\tdom.getRoot().focus();\n\t\t\t\t\t\tstartRng.select();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}", "title": "" }, { "docid": "40beaeb25e8900c5bbaa3e2f996991f4", "score": "0.7158401", "text": "function fixCaretSelectionOfDocumentElementOnIe() {\n\t\t\tvar doc = dom.doc, body = doc.body, started, startRng, htmlElm;\n\n\t\t\t// Return range from point or null if it failed\n\t\t\tfunction rngFromPoint(x, y) {\n\t\t\t\tvar rng = body.createTextRange();\n\n\t\t\t\ttry {\n\t\t\t\t\trng.moveToPoint(x, y);\n\t\t\t\t} catch (ex) {\n\t\t\t\t\t// IE sometimes throws and exception, so lets just ignore it\n\t\t\t\t\trng = null;\n\t\t\t\t}\n\n\t\t\t\treturn rng;\n\t\t\t}\n\n\t\t\t// Fires while the selection is changing\n\t\t\tfunction selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tendSelection();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Removes listeners\n\t\t\tfunction endSelection() {\n\t\t\t\tvar rng = doc.selection.createRange();\n\n\t\t\t\t// If the range is collapsed then use the last start range\n\t\t\t\tif (startRng && !rng.item && rng.compareEndPoints('StartToEnd', rng) === 0) {\n\t\t\t\t\tstartRng.select();\n\t\t\t\t}\n\n\t\t\t\tdom.unbind(doc, 'mouseup', endSelection);\n\t\t\t\tdom.unbind(doc, 'mousemove', selectionChange);\n\t\t\t\tstartRng = started = 0;\n\t\t\t}\n\n\t\t\t// Make HTML element unselectable since we are going to handle selection by hand\n\t\t\tdoc.documentElement.unselectable = true;\n\n\t\t\t// Detect when user selects outside BODY\n\t\t\tdom.bind(doc, 'mousedown contextmenu', function(e) {\n\t\t\t\tif (e.target.nodeName === 'HTML') {\n\t\t\t\t\tif (started) {\n\t\t\t\t\t\tendSelection();\n\t\t\t\t\t}\n\n\t\t\t\t\t// Detect vertical scrollbar, since IE will fire a mousedown on the scrollbar and have target set as HTML\n\t\t\t\t\thtmlElm = doc.documentElement;\n\t\t\t\t\tif (htmlElm.scrollHeight > htmlElm.clientHeight) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tstarted = 1;\n\t\t\t\t\t// Setup start position\n\t\t\t\t\tstartRng = rngFromPoint(e.x, e.y);\n\t\t\t\t\tif (startRng) {\n\t\t\t\t\t\t// Listen for selection change events\n\t\t\t\t\t\tdom.bind(doc, 'mouseup', endSelection);\n\t\t\t\t\t\tdom.bind(doc, 'mousemove', selectionChange);\n\n\t\t\t\t\t\tdom.getRoot().focus();\n\t\t\t\t\t\tstartRng.select();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}", "title": "" }, { "docid": "b603d705c0b5c8d9a03c0976c2fba40c", "score": "0.70786154", "text": "function fixCaretSelectionOfDocumentElementOnIe(){\n// Return range from point or null if it failed\nfunction rngFromPoint(A,e){var n=t.createTextRange();try{n.moveToPoint(A,e)}catch(A){\n// IE sometimes throws and exception, so lets just ignore it\nn=null}return n}\n// Fires while the selection is changing\nfunction selectionChange(A){var t;\n// Check if the button is down or not\nA.button?(\n// Create range from mouse position\nt=rngFromPoint(A.x,A.y),t&&(\n// Check if pointRange is before/after selection then change the endPoint\nt.compareEndPoints(\"StartToStart\",n)>0?t.setEndPoint(\"StartToStart\",n):t.setEndPoint(\"EndToEnd\",n),t.select())):endSelection()}\n// Removes listeners\nfunction endSelection(){var t=A.selection.createRange();\n// If the range is collapsed then use the last start range\nn&&!t.item&&0===t.compareEndPoints(\"StartToEnd\",t)&&n.select(),d.unbind(A,\"mouseup\",endSelection),d.unbind(A,\"mousemove\",selectionChange),n=e=0}var A=d.doc,t=A.body,e,n,i;\n// Make HTML element unselectable since we are going to handle selection by hand\nA.documentElement.unselectable=!0,\n// Detect when user selects outside BODY\nd.bind(A,\"mousedown contextmenu\",function(t){if(\"HTML\"===t.target.nodeName){if(e&&endSelection(),\n// Detect vertical scrollbar, since IE will fire a mousedown on the scrollbar and have target set as HTML\ni=A.documentElement,i.scrollHeight>i.clientHeight)return;e=1,\n// Setup start position\nn=rngFromPoint(t.x,t.y),n&&(\n// Listen for selection change events\nd.bind(A,\"mouseup\",endSelection),d.bind(A,\"mousemove\",selectionChange),d.getRoot().focus(),n.select())}})}", "title": "" }, { "docid": "75f66873cd30b8e5efa545403d6e776c", "score": "0.6838226", "text": "function focusBody(){\n// Fix for a focus bug in FF 3.x where the body element\n// wouldn't get proper focus if the user clicked on the HTML element\nwindow.Range.prototype.getClientRects||// Detect getClientRects got introduced in FF 4\nI.on(\"mousedown\",function(A){if(!isDefaultPrevented(A)&&\"HTML\"===A.target.nodeName){var t=I.getBody();\n// Blur the body it's focused but not correctly focused\nt.blur(),\n// Refocus the body after a little while\na.setEditorTimeout(I,function(){t.focus()})}})}", "title": "" }, { "docid": "e348977c4c15be845eef1fef4d7b4d63", "score": "0.6802089", "text": "function focusBody() {\n // Fix for a focus bug in FF 3.x where the body element\n // wouldn't get proper focus if the user clicked on the HTML element\n if (!window.Range.prototype.getClientRects) { // Detect getClientRects got introduced in FF 4\n editor.on('mousedown', function (e) {\n if (!isDefaultPrevented(e) && e.target.nodeName === \"HTML\") {\n var body = editor.getBody();\n\n // Blur the body it's focused but not correctly focused\n body.blur();\n\n // Refocus the body after a little while\n Delay.setEditorTimeout(editor, function () {\n body.focus();\n });\n }\n });\n }\n }", "title": "" }, { "docid": "e348977c4c15be845eef1fef4d7b4d63", "score": "0.6802089", "text": "function focusBody() {\n // Fix for a focus bug in FF 3.x where the body element\n // wouldn't get proper focus if the user clicked on the HTML element\n if (!window.Range.prototype.getClientRects) { // Detect getClientRects got introduced in FF 4\n editor.on('mousedown', function (e) {\n if (!isDefaultPrevented(e) && e.target.nodeName === \"HTML\") {\n var body = editor.getBody();\n\n // Blur the body it's focused but not correctly focused\n body.blur();\n\n // Refocus the body after a little while\n Delay.setEditorTimeout(editor, function () {\n body.focus();\n });\n }\n });\n }\n }", "title": "" }, { "docid": "0d497eb753289c9167628f3f5cad522b", "score": "0.67752796", "text": "function focusEditor() {\n // handle a closed editor\n if (editor === null) return;\n \n editor.focus();\n var elem = window.getSelection().baseNode;\n if (elem.nodeType === 3) {\n for (elem = elem.parentNode; elem.nodeType === 3; elem = elem.parentElement) {}\n }\n elem.scrollIntoView(true);\n}", "title": "" }, { "docid": "3cf6b6315c28b84fee4d73945ff3dc06", "score": "0.6753021", "text": "function focusBody() {\n\t\t\t// Fix for a focus bug in FF 3.x where the body element\n\t\t\t// wouldn't get proper focus if the user clicked on the HTML element\n\t\t\tif (!window.Range.prototype.getClientRects) { // Detect getClientRects got introduced in FF 4\n\t\t\t\teditor.on('mousedown', function(e) {\n\t\t\t\t\tif (!isDefaultPrevented(e) && e.target.nodeName === \"HTML\") {\n\t\t\t\t\t\tvar body = editor.getBody();\n\n\t\t\t\t\t\t// Blur the body it's focused but not correctly focused\n\t\t\t\t\t\tbody.blur();\n\n\t\t\t\t\t\t// Refocus the body after a little while\n\t\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\t\tbody.focus();\n\t\t\t\t\t\t}, 0);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "bcb48e60ad395927f35f79d8ea4d5288", "score": "0.6747682", "text": "function focusBody() {\n\t\t\t// Fix for a focus bug in FF 3.x where the body element\n\t\t\t// wouldn't get proper focus if the user clicked on the HTML element\n\t\t\tif (!window.Range.prototype.getClientRects) { // Detect getClientRects got introduced in FF 4\n\t\t\t\teditor.on('mousedown', function(e) {\n\t\t\t\t\tif (!isDefaultPrevented(e) && e.target.nodeName === \"HTML\") {\n\t\t\t\t\t\tvar body = editor.getBody();\n\n\t\t\t\t\t\t// Blur the body it's focused but not correctly focused\n\t\t\t\t\t\tbody.blur();\n\n\t\t\t\t\t\t// Refocus the body after a little while\n\t\t\t\t\t\tDelay.setEditorTimeout(editor, function() {\n\t\t\t\t\t\t\tbody.focus();\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "bcb48e60ad395927f35f79d8ea4d5288", "score": "0.6747682", "text": "function focusBody() {\n\t\t\t// Fix for a focus bug in FF 3.x where the body element\n\t\t\t// wouldn't get proper focus if the user clicked on the HTML element\n\t\t\tif (!window.Range.prototype.getClientRects) { // Detect getClientRects got introduced in FF 4\n\t\t\t\teditor.on('mousedown', function(e) {\n\t\t\t\t\tif (!isDefaultPrevented(e) && e.target.nodeName === \"HTML\") {\n\t\t\t\t\t\tvar body = editor.getBody();\n\n\t\t\t\t\t\t// Blur the body it's focused but not correctly focused\n\t\t\t\t\t\tbody.blur();\n\n\t\t\t\t\t\t// Refocus the body after a little while\n\t\t\t\t\t\tDelay.setEditorTimeout(editor, function() {\n\t\t\t\t\t\t\tbody.focus();\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "bcb48e60ad395927f35f79d8ea4d5288", "score": "0.6747682", "text": "function focusBody() {\n\t\t\t// Fix for a focus bug in FF 3.x where the body element\n\t\t\t// wouldn't get proper focus if the user clicked on the HTML element\n\t\t\tif (!window.Range.prototype.getClientRects) { // Detect getClientRects got introduced in FF 4\n\t\t\t\teditor.on('mousedown', function(e) {\n\t\t\t\t\tif (!isDefaultPrevented(e) && e.target.nodeName === \"HTML\") {\n\t\t\t\t\t\tvar body = editor.getBody();\n\n\t\t\t\t\t\t// Blur the body it's focused but not correctly focused\n\t\t\t\t\t\tbody.blur();\n\n\t\t\t\t\t\t// Refocus the body after a little while\n\t\t\t\t\t\tDelay.setEditorTimeout(editor, function() {\n\t\t\t\t\t\t\tbody.focus();\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "a9fb867208085c883cdd8da00fd5f0ae", "score": "0.6358322", "text": "function restoreBodyRelativeSelection()\n{\n var sel = CURRENT_SEL;\n CURRENT_SEL = null;\n \n if (sel)\n {\n var dom = dw.getDocumentDOM();\n \n var bodyOffset = dom.nodeToOffsets(dom.body);\n \n sel[0] = sel[0] + bodyOffset[0];\n sel[1] = sel[1] + bodyOffset[0];\n \n if(dom.getView('code'))\n dom.source.setSelection(sel[0], sel[1]);\n else\n dom.setSelection(sel[0], sel[1]);\n }\n}", "title": "" }, { "docid": "6ee414cf5e9ad85558826ffca2a5c049", "score": "0.62179035", "text": "function focusEditor(e)\n{\n let key = e.which || e.keyCode;//what key was pressed?\n \n // key = 'i', move focus to the editor\n if(key === 73)\n {\n console.log(key);\n\n let element = document.getElementById('editor')//editor's div element\n\n setTimeout(function(){ element.focus(); }, 0);//Put focus in editor's div element. Timing issues\n focused = true;//mark the editor as focused\n\n /*** Once focused, move the caret to the end of any content inside of the editor ***/\n // var inputSize = element.innerHTML.length;//number of characters in editor\n // console.log(\"Input Size: \" + inputSize);\n // if(inputSize)\n // {\n // let selection = window.getSelection();//create Selection object\n // setTimeout(function(){ selection.collapse(element.firstChild, inputSize); },\n // 0);//move caret to the end of the content. Timing issues\n // }\n }\n\n // key = 'esc', move focus to the shell\n if(key === 27)\n {\n console.log(key);\n\n document.getElementById(\"editor\").blur();//remove focus from editor\n focused = false;//mark the editor as unfocused\n document.getElementById(\"shell\").focus();//focus on shell\n }\n\n\n}", "title": "" }, { "docid": "de1dd45eaaca82fe6350248ca8c5d187", "score": "0.61917585", "text": "function moveCursorToStart(contentEditableElement) {\n var range, selection;\n if (document.createRange)//Firefox, Chrome, Opera, Safari, IE 9+\n {\n range = document.createRange();//Create a range (a range is a like the selection but invisible)\n range.selectNodeContents(contentEditableElement);//Select the entire contents of the element with the range\n range.collapse(true);//collapse the range to the end point. false means collapse to end rather than the start\n selection = window.getSelection();//get the selection object (allows you to change selection)\n selection.removeAllRanges();//remove any selections already made\n selection.addRange(range);//make the range you have just created the visible selection\n }\n else if (document.selection)//IE 8 and lower\n {\n range = document.body.createTextRange();//Create a range (a range is a like the selection but invisible)\n range.moveToElementText(contentEditableElement);//Select the entire contents of the element with the range\n range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start\n range.select();//Select the range (make it the visible selection\n }\n }", "title": "" }, { "docid": "0c3e013c30aee6f6ba45240067a372b3", "score": "0.61712325", "text": "function editor_focus(editor_obj) {\r\n\r\n // check editor mode\r\n if (editor_obj.tagName.toLowerCase() == 'textarea') { // textarea\r\n var myfunc = function() { editor_obj.focus(); };\r\n setTimeout(myfunc,100); // doesn't work all the time without delay\r\n }\r\n\r\n else { // wysiwyg\r\n var editdoc = editor_obj.contentWindow.document; // get iframe editor document object\r\n var editorRange = editdoc.body.createTextRange(); // editor range\r\n var curRange = editdoc.selection.createRange(); // selection range\r\n\r\n if (curRange.length == null && // make sure it's not a controlRange\r\n !editorRange.inRange(curRange)) { // is selection in editor range\r\n editorRange.collapse(); // move to start of range\r\n editorRange.select(); // select\r\n curRange = editorRange;\r\n }\r\n }\r\n\r\n}", "title": "" }, { "docid": "c8d72ee9248af4d94b5d446124332ebe", "score": "0.61704487", "text": "function focusBody(ed) {\n\t\t// Fix for a focus bug in FF 3.x where the body element\n\t\t// wouldn't get proper focus if the user clicked on the HTML element\n\t\tif (!Range.prototype.getClientRects) { // Detect getClientRects got introduced in FF 4\n\t\t\ted.onMouseDown.add(function(ed, e) {\n\t\t\t\tif (e.target.nodeName === \"HTML\") {\n\t\t\t\t\tvar body = ed.getBody();\n\n\t\t\t\t\t// Blur the body it's focused but not correctly focused\n\t\t\t\t\tbody.blur();\n\n\t\t\t\t\t// Refocus the body after a little while\n\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\tbody.focus();\n\t\t\t\t\t}, 0);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}", "title": "" }, { "docid": "218a14f1fb197a600622828551507839", "score": "0.61417466", "text": "function inputMethodFocus(){I.settings.content_editable||\n// Case 1 IME doesn't initialize if you focus the document\n// Disabled since it was interferring with the cE=false logic\n// Also coultn't reproduce the issue on Safari 9\n/*dom.bind(editor.getDoc(), 'focusin', function() {\n\t\t\t\t\tselection.setRng(selection.getRng());\n\t\t\t\t});*/\n// Case 2 IME doesn't initialize if you click the documentElement it also doesn't properly fire the focusin event\n// Needs to be both down/up due to weird rendering bug on Chrome Windows\nd.bind(I.getDoc(),\"mousedown mouseup\",function(A){var t;if(A.target==I.getDoc().documentElement)if(t=C.getRng(),I.getBody().focus(),\"mousedown\"==A.type){if(M.isCaretContainer(t.startContainer))return;\n// Edge case for mousedown, drag select and mousedown again within selection on Chrome Windows to render caret\nC.placeCaretAt(A.clientX,A.clientY)}else C.setRng(t)})}", "title": "" }, { "docid": "68d736f0a2e15aafb30967a1a6034c8c", "score": "0.61412376", "text": "function inputMethodFocus() {\n if (!editor.settings.content_editable) {\n // Case 1 IME doesn't initialize if you focus the document\n // Disabled since it was interferring with the cE=false logic\n // Also coultn't reproduce the issue on Safari 9\n /*dom.bind(editor.getDoc(), 'focusin', function() {\n selection.setRng(selection.getRng());\n });*/\n\n // Case 2 IME doesn't initialize if you click the documentElement it also doesn't properly fire the focusin event\n // Needs to be both down/up due to weird rendering bug on Chrome Windows\n dom.bind(editor.getDoc(), 'mousedown mouseup', function (e) {\n var rng;\n\n if (e.target == editor.getDoc().documentElement) {\n rng = selection.getRng();\n editor.getBody().focus();\n\n if (e.type == 'mousedown') {\n if (CaretContainer.isCaretContainer(rng.startContainer)) {\n return;\n }\n\n // Edge case for mousedown, drag select and mousedown again within selection on Chrome Windows to render caret\n selection.placeCaretAt(e.clientX, e.clientY);\n } else {\n selection.setRng(rng);\n }\n }\n });\n }\n }", "title": "" }, { "docid": "68d736f0a2e15aafb30967a1a6034c8c", "score": "0.61412376", "text": "function inputMethodFocus() {\n if (!editor.settings.content_editable) {\n // Case 1 IME doesn't initialize if you focus the document\n // Disabled since it was interferring with the cE=false logic\n // Also coultn't reproduce the issue on Safari 9\n /*dom.bind(editor.getDoc(), 'focusin', function() {\n selection.setRng(selection.getRng());\n });*/\n\n // Case 2 IME doesn't initialize if you click the documentElement it also doesn't properly fire the focusin event\n // Needs to be both down/up due to weird rendering bug on Chrome Windows\n dom.bind(editor.getDoc(), 'mousedown mouseup', function (e) {\n var rng;\n\n if (e.target == editor.getDoc().documentElement) {\n rng = selection.getRng();\n editor.getBody().focus();\n\n if (e.type == 'mousedown') {\n if (CaretContainer.isCaretContainer(rng.startContainer)) {\n return;\n }\n\n // Edge case for mousedown, drag select and mousedown again within selection on Chrome Windows to render caret\n selection.placeCaretAt(e.clientX, e.clientY);\n } else {\n selection.setRng(rng);\n }\n }\n });\n }\n }", "title": "" }, { "docid": "f9d247e2fb0f38c393f49cc0c3b99963", "score": "0.6114492", "text": "function setCaret(n) {\n var el = document.getElementById(\"contenteditableeditor\");\n var range = document.createRange();\n var sel = window.getSelection();\n range.setStart(el.childNodes[3], n);\n range.collapse(true);\n sel.removeAllRanges();\n sel.addRange(range);\n el.focus();\n //alert (\"and end\");\n}", "title": "" }, { "docid": "ca261e3dcc2d3b3995820d071ce95f87", "score": "0.60834956", "text": "function focusBody()\r\n\t{\r\n\t\tdocument.activeElement = document.body;\r\n\t}", "title": "" }, { "docid": "f4c730c1a0951be6b81276b3fecca5c4", "score": "0.6064271", "text": "_ensureFocus() {\n if (!this.editor.hasFocus()) {\n this.editor.focus();\n }\n }", "title": "" }, { "docid": "a61d3591ff69748cdc124ff4aeda591f", "score": "0.60404867", "text": "function input_focus_handler()\n{\n // Based on http://jsfiddle.net/rudiedirkx/MgASG/1/ .\n requestAnimationFrame((function()\n {\n let range = document.createRange();\n range.selectNodeContents(this);\n let sel = window.getSelection();\n sel.removeAllRanges();\n sel.addRange(range);\n }).bind(this));\n}", "title": "" }, { "docid": "f3cd9c08fbef3e06c87038f60fb1b0f5", "score": "0.6014516", "text": "function scroll_to_cursor() {\r\n textarea_element.blur();\r\n textarea_element.focus();\r\n}", "title": "" }, { "docid": "3b9bc911397ecc440773728b0e896167", "score": "0.60016596", "text": "function inputMethodFocus() {\n\t\t\tif (!editor.settings.content_editable) {\n\t\t\t\t// Case 1 IME doesn't initialize if you focus the document\n\t\t\t\t// Disabled since it was interferring with the cE=false logic\n\t\t\t\t// Also coultn't reproduce the issue on Safari 9\n\t\t\t\t/*dom.bind(editor.getDoc(), 'focusin', function() {\n\t\t\t\t\tselection.setRng(selection.getRng());\n\t\t\t\t});*/\n\n\t\t\t\t// Case 2 IME doesn't initialize if you click the documentElement it also doesn't properly fire the focusin event\n\t\t\t\t// Needs to be both down/up due to weird rendering bug on Chrome Windows\n\t\t\t\tdom.bind(editor.getDoc(), 'mousedown mouseup', function(e) {\n\t\t\t\t\tvar rng;\n\n\t\t\t\t\tif (e.target == editor.getDoc().documentElement) {\n\t\t\t\t\t\trng = selection.getRng();\n\t\t\t\t\t\teditor.getBody().focus();\n\n\t\t\t\t\t\tif (e.type == 'mousedown') {\n\t\t\t\t\t\t\tif (CaretContainer.isCaretContainer(rng.startContainer)) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Edge case for mousedown, drag select and mousedown again within selection on Chrome Windows to render caret\n\t\t\t\t\t\t\tselection.placeCaretAt(e.clientX, e.clientY);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tselection.setRng(rng);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "3b9bc911397ecc440773728b0e896167", "score": "0.60016596", "text": "function inputMethodFocus() {\n\t\t\tif (!editor.settings.content_editable) {\n\t\t\t\t// Case 1 IME doesn't initialize if you focus the document\n\t\t\t\t// Disabled since it was interferring with the cE=false logic\n\t\t\t\t// Also coultn't reproduce the issue on Safari 9\n\t\t\t\t/*dom.bind(editor.getDoc(), 'focusin', function() {\n\t\t\t\t\tselection.setRng(selection.getRng());\n\t\t\t\t});*/\n\n\t\t\t\t// Case 2 IME doesn't initialize if you click the documentElement it also doesn't properly fire the focusin event\n\t\t\t\t// Needs to be both down/up due to weird rendering bug on Chrome Windows\n\t\t\t\tdom.bind(editor.getDoc(), 'mousedown mouseup', function(e) {\n\t\t\t\t\tvar rng;\n\n\t\t\t\t\tif (e.target == editor.getDoc().documentElement) {\n\t\t\t\t\t\trng = selection.getRng();\n\t\t\t\t\t\teditor.getBody().focus();\n\n\t\t\t\t\t\tif (e.type == 'mousedown') {\n\t\t\t\t\t\t\tif (CaretContainer.isCaretContainer(rng.startContainer)) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Edge case for mousedown, drag select and mousedown again within selection on Chrome Windows to render caret\n\t\t\t\t\t\t\tselection.placeCaretAt(e.clientX, e.clientY);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tselection.setRng(rng);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "3b9bc911397ecc440773728b0e896167", "score": "0.60016596", "text": "function inputMethodFocus() {\n\t\t\tif (!editor.settings.content_editable) {\n\t\t\t\t// Case 1 IME doesn't initialize if you focus the document\n\t\t\t\t// Disabled since it was interferring with the cE=false logic\n\t\t\t\t// Also coultn't reproduce the issue on Safari 9\n\t\t\t\t/*dom.bind(editor.getDoc(), 'focusin', function() {\n\t\t\t\t\tselection.setRng(selection.getRng());\n\t\t\t\t});*/\n\n\t\t\t\t// Case 2 IME doesn't initialize if you click the documentElement it also doesn't properly fire the focusin event\n\t\t\t\t// Needs to be both down/up due to weird rendering bug on Chrome Windows\n\t\t\t\tdom.bind(editor.getDoc(), 'mousedown mouseup', function(e) {\n\t\t\t\t\tvar rng;\n\n\t\t\t\t\tif (e.target == editor.getDoc().documentElement) {\n\t\t\t\t\t\trng = selection.getRng();\n\t\t\t\t\t\teditor.getBody().focus();\n\n\t\t\t\t\t\tif (e.type == 'mousedown') {\n\t\t\t\t\t\t\tif (CaretContainer.isCaretContainer(rng.startContainer)) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Edge case for mousedown, drag select and mousedown again within selection on Chrome Windows to render caret\n\t\t\t\t\t\t\tselection.placeCaretAt(e.clientX, e.clientY);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tselection.setRng(rng);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "00741d749c1bc1143b97cbe7d5ecbef3", "score": "0.59642005", "text": "focus() {\n this._editor.focus();\n }", "title": "" }, { "docid": "ff6601906a0e6aee08f22992598d270f", "score": "0.5953921", "text": "function storeCaret(textEl) {\r\n\tif (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();\r\n}", "title": "" }, { "docid": "ff6601906a0e6aee08f22992598d270f", "score": "0.5953921", "text": "function storeCaret(textEl) {\r\n\tif (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();\r\n}", "title": "" }, { "docid": "ff6601906a0e6aee08f22992598d270f", "score": "0.5953921", "text": "function storeCaret(textEl) {\r\n\tif (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();\r\n}", "title": "" }, { "docid": "ad3eee3c4dd6218b8547ad3b5428efc7", "score": "0.59479505", "text": "function fixTableCaretPos(){g.on(\"KeyDown SetContent VisualAid\",function(){var A;\n// Skip empty text nodes from the end\nfor(A=g.getBody().lastChild;A;A=A.previousSibling)if(3==A.nodeType){if(A.nodeValue.length>0)break}else if(1==A.nodeType&&(\"BR\"==A.tagName||!A.getAttribute(\"data-mce-bogus\")))break;A&&\"TABLE\"==A.nodeName&&(g.settings.forced_root_block?g.dom.add(g.getBody(),g.settings.forced_root_block,g.settings.forced_root_block_attrs,e.ie&&e.ie<10?\"&nbsp;\":'<br data-mce-bogus=\"1\" />'):g.dom.add(g.getBody(),\"br\",{\"data-mce-bogus\":\"1\"}))}),g.on(\"PreProcess\",function(A){var t=A.node.lastChild;t&&(\"BR\"==t.nodeName||1==t.childNodes.length&&(\"BR\"==t.firstChild.nodeName||\" \"==t.firstChild.nodeValue))&&t.previousSibling&&\"TABLE\"==t.previousSibling.nodeName&&g.dom.remove(t)})}", "title": "" }, { "docid": "b410192ff927e50d8c15d41b36c81f65", "score": "0.59270203", "text": "focus() {\n this.$('.Composer-content :input:enabled:visible, .TextEditor-editor').first().focus();\n }", "title": "" }, { "docid": "e10fa7aaf6b312af75b61e7ab192a7be", "score": "0.5925783", "text": "function storeCaret(txtarea) {\n if (txtarea.createTextRange) {\n txtarea.caretPos = document.selection.createRange().duplicate();\n }\n}", "title": "" }, { "docid": "6ed6676fa91bb5f638e2df9d2f5b1cc4", "score": "0.5902305", "text": "function adjustSelectionToVisibleSelection() {\n function findSelectionEnd(start, end) {\n var walker = new TreeWalker(end);\n for (node = walker.prev2(); node; node = walker.prev2()) {\n if (node.nodeType == 3 && node.data.length > 0) {\n return node;\n }\n\n if (node.childNodes.length > 1 || node == start || node.tagName == 'BR') {\n return node;\n }\n }\n }\n\n // Adjust selection so that a end container with a end offset of zero is not included in the selection\n // as this isn't visible to the user.\n var rng = ed.selection.getRng();\n var start = rng.startContainer;\n var end = rng.endContainer;\n\n if (start != end && rng.endOffset === 0) {\n var newEnd = findSelectionEnd(start, end);\n var endOffset = newEnd.nodeType == 3 ? newEnd.data.length : newEnd.childNodes.length;\n\n rng.setEnd(newEnd, endOffset);\n }\n\n return rng;\n }", "title": "" }, { "docid": "667972429a24cc4c0a4d775d15c707dd", "score": "0.5894828", "text": "function bodyHeight() {\n if (!editor.inline) {\n editor.contentStyles.push('body {min-height: 150px}');\n editor.on('click', function (e) {\n var rng;\n\n if (e.target.nodeName == 'HTML') {\n // Edge seems to only need focus if we set the range\n // the caret will become invisible and moved out of the iframe!!\n if (Env.ie > 11) {\n editor.getBody().focus();\n return;\n }\n\n // Need to store away non collapsed ranges since the focus call will mess that up see #7382\n rng = editor.selection.getRng();\n editor.getBody().focus();\n editor.selection.setRng(rng);\n editor.selection.normalize();\n editor.nodeChanged();\n }\n });\n }\n }", "title": "" }, { "docid": "667972429a24cc4c0a4d775d15c707dd", "score": "0.5894828", "text": "function bodyHeight() {\n if (!editor.inline) {\n editor.contentStyles.push('body {min-height: 150px}');\n editor.on('click', function (e) {\n var rng;\n\n if (e.target.nodeName == 'HTML') {\n // Edge seems to only need focus if we set the range\n // the caret will become invisible and moved out of the iframe!!\n if (Env.ie > 11) {\n editor.getBody().focus();\n return;\n }\n\n // Need to store away non collapsed ranges since the focus call will mess that up see #7382\n rng = editor.selection.getRng();\n editor.getBody().focus();\n editor.selection.setRng(rng);\n editor.selection.normalize();\n editor.nodeChanged();\n }\n });\n }\n }", "title": "" }, { "docid": "1538a8158e7f53a1a9c295e9247a4a6f", "score": "0.589083", "text": "function get_IE_selection(t) {\n var d = document, div, range, stored_range, elem, scrollTop, relative_top, line_start, line_nb, range_start,\n range_end, tab;\n if (t && t.focused) {\n if (!t.ea_line_height) {\t// calculate the lineHeight\n div = d.createElement(\"div\");\n div.style.fontFamily = get_css_property(t, \"font-family\");\n div.style.fontSize = get_css_property(t, \"font-size\");\n div.style.visibility = \"hidden\";\n div.innerHTML = \"0\";\n d.body.appendChild(div);\n t.ea_line_height = div.offsetHeight;\n d.body.removeChild(div);\n }\n //t.focus();\n range = d.selection.createRange();\n try {\n stored_range = range.duplicate();\n stored_range.moveToElementText(t);\n stored_range.setEndPoint('EndToEnd', range);\n if (stored_range.parentElement() == t) {\n // the range don't take care of empty lines in the end of the selection\n elem = t;\n scrollTop = 0;\n while (elem.parentNode) {\n scrollTop += elem.scrollTop;\n elem = elem.parentNode;\n }\n\n //\tvar scrollTop= t.scrollTop + document.body.scrollTop;\n\n //\tvar relative_top= range.offsetTop - calculeOffsetTop(t) + scrollTop;\n relative_top = range.offsetTop - calculeOffsetTop(t) + scrollTop;\n //\talert(\"rangeoffset: \"+ range.offsetTop +\"\\ncalcoffsetTop: \"+ calculeOffsetTop(t) +\"\\nrelativeTop: \"+ relative_top);\n line_start = Math.round((relative_top / t.ea_line_height) + 1);\n\n line_nb = Math.round(range.boundingHeight / t.ea_line_height);\n\n range_start = stored_range.text.length - range.text.length;\n tab = t.value.substr(0, range_start).split(\"\\n\");\n range_start += (line_start - tab.length) * 2;\t\t// add missing empty lines to the selection\n t.selectionStart = range_start;\n\n range_end = t.selectionStart + range.text.length;\n tab = t.value.substr(0, range_start + range.text.length).split(\"\\n\");\n range_end += (line_start + line_nb - 1 - tab.length) * 2;\n t.selectionEnd = range_end;\n }\n }\n catch (e) {\n }\n }\n if (t && t.id) {\n setTimeout(\"get_IE_selection(document.getElementById('\" + t.id + \"'));\", 50);\n }\n}", "title": "" }, { "docid": "6a7bf16329a6b5cfd4e7e3e51d4a6c83", "score": "0.58902967", "text": "function restoreFocusOnKeyDown() {\n if (!editor.inline) {\n editor.on('keydown', function () {\n if (document.activeElement == document.body) {\n editor.getWin().focus();\n }\n });\n }\n }", "title": "" }, { "docid": "6a7bf16329a6b5cfd4e7e3e51d4a6c83", "score": "0.58902967", "text": "function restoreFocusOnKeyDown() {\n if (!editor.inline) {\n editor.on('keydown', function () {\n if (document.activeElement == document.body) {\n editor.getWin().focus();\n }\n });\n }\n }", "title": "" }, { "docid": "5f75c6c8ec31828833878fbc93d60db7", "score": "0.58638513", "text": "function moveCaret(win, charCount) {\n\t var sel, range;\n\t if (win.getSelection) {\n\t sel = win.getSelection();\n sel.collapseToEnd();\n\t // if (sel.rangeCount > 0) {\n\t // var editor_content_len = $(\"#editor1\").text().length;\n\t // var textNode = sel.focusNode;\n\t // var newOffset = editor_content_len;\n\t // // sel.collapse(textNode, Math.min(textNode.length, newOffset));\n\t // sel.collapseToEnd();\n\t // }\n\t } else if ( (sel = win.document.selection) ) {\n\t if (sel.type != \"Control\") {\n\t range = sel.createRange();\n\t range.move(\"character\", charCount);\n\t range.select();\n\t }\n\t }\n}", "title": "" }, { "docid": "729fc47b98eda98bb5af277f0897355e", "score": "0.58455795", "text": "function inputMethodFocus() {\n\t\t\tif (!editor.settings.content_editable) {\n\t\t\t\t// Case 1 IME doesn't initialize if you focus the document\n\t\t\t\tdom.bind(editor.getDoc(), 'focusin', function() {\n\t\t\t\t\tselection.setRng(selection.getRng());\n\t\t\t\t});\n\n\t\t\t\t// Case 2 IME doesn't initialize if you click the documentElement it also doesn't properly fire the focusin event\n\t\t\t\tdom.bind(editor.getDoc(), 'mousedown', function(e) {\n\t\t\t\t\tif (e.target == editor.getDoc().documentElement) {\n\t\t\t\t\t\teditor.getBody().focus();\n\t\t\t\t\t\tselection.setRng(selection.getRng());\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "0cee6b80f986d02e974a7cf50908f7c0", "score": "0.5835026", "text": "_scrollToCaretPosition(textarea) {\n const { selectionStart, selectionEnd } = textarea;\n const document = this._getDocument();\n // IE will throw an \"Unspecified error\" if we try to set the selection range after the\n // element has been removed from the DOM. Assert that the directive hasn't been destroyed\n // between the time we requested the animation frame and when it was executed.\n // Also note that we have to assert that the textarea is focused before we set the\n // selection range. Setting the selection range on a non-focused textarea will cause\n // it to receive focus on IE and Edge.\n if (!this._destroyed.isStopped && document.activeElement === textarea) {\n textarea.setSelectionRange(selectionStart, selectionEnd);\n }\n }", "title": "" }, { "docid": "0cee6b80f986d02e974a7cf50908f7c0", "score": "0.5835026", "text": "_scrollToCaretPosition(textarea) {\n const { selectionStart, selectionEnd } = textarea;\n const document = this._getDocument();\n // IE will throw an \"Unspecified error\" if we try to set the selection range after the\n // element has been removed from the DOM. Assert that the directive hasn't been destroyed\n // between the time we requested the animation frame and when it was executed.\n // Also note that we have to assert that the textarea is focused before we set the\n // selection range. Setting the selection range on a non-focused textarea will cause\n // it to receive focus on IE and Edge.\n if (!this._destroyed.isStopped && document.activeElement === textarea) {\n textarea.setSelectionRange(selectionStart, selectionEnd);\n }\n }", "title": "" }, { "docid": "c01e0a888ff7c278842eb22b7b0e284e", "score": "0.58254755", "text": "_scrollToCaretPosition(textarea) {\n const { selectionStart, selectionEnd } = textarea;\n const document = this._getDocument();\n // IE will throw an \"Unspecified error\" if we try to set the selection range after the\n // element has been removed from the DOM. Assert that the directive hasn't been destroyed\n // between the time we requested the animation frame and when it was executed.\n // Also note that we have to assert that the textarea is focused before we set the\n // selection range. Setting the selection range on a non-focused textarea will cause\n // it to receive focus on IE and Edge.\n if (!this._destroyed.isStopped && document.activeElement === textarea) {\n textarea.setSelectionRange(selectionStart, selectionEnd);\n }\n }", "title": "" }, { "docid": "1c429485215e1db3e6b27ecfe57c0a95", "score": "0.58169615", "text": "function moveToCaretPosition(t){function firstNonWhiteSpaceNodeSibling(A){for(;A;){if(1==A.nodeType||3==A.nodeType&&A.data&&/[\\r\\n\\s]/.test(A.data))return A;A=A.nextSibling}}var e,i,o,a=t,M;if(t){if(\n// Old IE versions doesn't properly render blocks with br elements in them\n// For example <p><br></p> wont be rendered correctly in a contentEditable area\n// until you remove the br producing <p></p>\nn.ie&&n.ie<9&&u&&u.firstChild&&u.firstChild==u.lastChild&&\"BR\"==u.firstChild.tagName&&r.remove(u.firstChild),/^(LI|DT|DD)$/.test(t.nodeName)){var s=firstNonWhiteSpaceNodeSibling(t.firstChild);s&&/^(UL|OL|DL)$/.test(s.nodeName)&&t.insertBefore(r.doc.createTextNode(\" \"),t.firstChild)}if(o=r.createRng(),\n// Normalize whitespace to remove empty text nodes. Fix for: #6904\n// Gecko will be able to place the caret in empty text nodes but it won't render propery\n// Older IE versions will sometimes crash so for now ignore all IE versions\nn.ie||t.normalize(),t.hasChildNodes()){for(e=new A(t,t);i=e.current();){if(3==i.nodeType){o.setStart(i,0),o.setEnd(i,0);break}if(I[i.nodeName.toLowerCase()]){o.setStartBefore(i),o.setEndBefore(i);break}a=i,i=e.next()}i||(o.setStart(a,0),o.setEnd(a,0))}else\"BR\"==t.nodeName?t.nextSibling&&r.isBlock(t.nextSibling)?(\n// Trick on older IE versions to render the caret before the BR between two lists\n(!D||D<9)&&(M=r.create(\"br\"),t.parentNode.insertBefore(M,t)),o.setStartBefore(t),o.setEndBefore(t)):(o.setStartAfter(t),o.setEndAfter(t)):(o.setStart(t,0),o.setEnd(t,0));g.setRng(o),\n// Remove tempElm created for old IE:s\nr.remove(M),g.scrollIntoView(t)}}", "title": "" }, { "docid": "0a6e8c87d128e0809acf303bfe1189d6", "score": "0.58153546", "text": "function handleSelectToStart() {\n var editor = getEditor(),\n curPos = editor.getCursorPos();\n\n editor.setSelection({line: 0, ch: 0}, curPos);\n }", "title": "" }, { "docid": "9cf98318bba252f2ba8ab7d23c989802", "score": "0.5802912", "text": "function CreateDefaultSelection() {\n var $editor = $(\"div[id^=taTextElement]\"),\n $cursor = $(\"<span />\", { id: \"insertion\" });\n\n $editor.append($cursor);\n $editor.focus();\n}", "title": "" }, { "docid": "148c1293b82b10729cb9a35331713aab", "score": "0.57935023", "text": "function cursor(){\n\t// input.focus();\n\tinput.select();\n\tinput.focus({preventScroll:true});\n\t\n}", "title": "" }, { "docid": "66beca76e80788a72997d0652f96348b", "score": "0.5789211", "text": "function setCaretPosition(el, caretPos) {\n el.value = el.value; // ^ this is used to not only get \"focus\", but\n // to make sure we don't have it everything -selected-\n // (it causes an issue in chrome, and having it doesn't hurt any other browser)\n\n if (el !== null) {\n if (el.createTextRange) {\n var range = el.createTextRange();\n range.move('character', caretPos);\n range.select();\n return true;\n } // (el.selectionStart === 0 added for Firefox bug)\n\n\n if (el.selectionStart || el.selectionStart === 0) {\n el.focus();\n el.setSelectionRange(caretPos, caretPos);\n return true;\n } // fail city, fortunately this never happens (as far as I've tested) :)\n\n\n el.focus();\n return false;\n }\n}", "title": "" }, { "docid": "e9f65acc5ad65352aadd737e9c5c8874", "score": "0.5765722", "text": "function getCaretPosition(txtarea)\n{\n var caretPos = new caretPosition();\n \n // simple Gecko/Opera way\n if(txtarea.selectionStart || txtarea.selectionStart == 0)\n {\n caretPos.start = txtarea.selectionStart;\n caretPos.end = txtarea.selectionEnd;\n }\n // dirty and slow IE way\n else if(document.selection)\n {\n \n // get current selection\n var range = document.selection.createRange();\n\n // a new selection of the whole textarea\n var range_all = document.body.createTextRange();\n range_all.moveToElementText(txtarea);\n \n // calculate selection start point by moving beginning of range_all to beginning of range\n var sel_start;\n for (sel_start = 0; range_all.compareEndPoints('StartToStart', range) < 0; sel_start++)\n { \n range_all.moveStart('character', 1);\n }\n \n txtarea.sel_start = sel_start;\n \n // we ignore the end value for IE, this is already dirty enough and we don't need it\n caretPos.start = txtarea.sel_start;\n caretPos.end = txtarea.sel_start; \n }\n\n return caretPos;\n}", "title": "" }, { "docid": "43e1e6767c836e98fdd95631db728bf9", "score": "0.5757199", "text": "onSelectionPositioned() {\n let contentRect = this._getContentRect()\n let selectionRect = this._getSelectionRect()\n if (!selectionRect) return\n let hints = {\n contentRect,\n selectionRect\n }\n this._emitSelectionPositioned(hints)\n this._scrollSelectionIntoView(selectionRect)\n }", "title": "" }, { "docid": "80a23032fb0558767373ea364d003139", "score": "0.5734782", "text": "function adjustSelectionToVisibleSelection() {\n\t\t\t\tfunction findSelectionEnd(start, end) {\n\t\t\t\t\tvar walker = new TreeWalker(end);\n\t\t\t\t\tfor (node = walker.prev2(); node; node = walker.prev2()) {\n\t\t\t\t\t\tif (node.nodeType == 3 && node.data.length > 0) {\n\t\t\t\t\t\t\treturn node;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (node.childNodes.length > 1 || node == start || node.tagName == 'BR') {\n\t\t\t\t\t\t\treturn node;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Adjust selection so that a end container with a end offset of zero is not included in the selection\n\t\t\t\t// as this isn't visible to the user.\n\t\t\t\tvar rng = ed.selection.getRng();\n\t\t\t\tvar start = rng.startContainer;\n\t\t\t\tvar end = rng.endContainer;\n\n\t\t\t\tif (start != end && rng.endOffset === 0) {\n\t\t\t\t\tvar newEnd = findSelectionEnd(start, end);\n\t\t\t\t\tvar endOffset = newEnd.nodeType == 3 ? newEnd.data.length : newEnd.childNodes.length;\n\n\t\t\t\t\trng.setEnd(newEnd, endOffset);\n\t\t\t\t}\n\n\t\t\t\treturn rng;\n\t\t\t}", "title": "" }, { "docid": "80a23032fb0558767373ea364d003139", "score": "0.5734782", "text": "function adjustSelectionToVisibleSelection() {\n\t\t\t\tfunction findSelectionEnd(start, end) {\n\t\t\t\t\tvar walker = new TreeWalker(end);\n\t\t\t\t\tfor (node = walker.prev2(); node; node = walker.prev2()) {\n\t\t\t\t\t\tif (node.nodeType == 3 && node.data.length > 0) {\n\t\t\t\t\t\t\treturn node;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (node.childNodes.length > 1 || node == start || node.tagName == 'BR') {\n\t\t\t\t\t\t\treturn node;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Adjust selection so that a end container with a end offset of zero is not included in the selection\n\t\t\t\t// as this isn't visible to the user.\n\t\t\t\tvar rng = ed.selection.getRng();\n\t\t\t\tvar start = rng.startContainer;\n\t\t\t\tvar end = rng.endContainer;\n\n\t\t\t\tif (start != end && rng.endOffset === 0) {\n\t\t\t\t\tvar newEnd = findSelectionEnd(start, end);\n\t\t\t\t\tvar endOffset = newEnd.nodeType == 3 ? newEnd.data.length : newEnd.childNodes.length;\n\n\t\t\t\t\trng.setEnd(newEnd, endOffset);\n\t\t\t\t}\n\n\t\t\t\treturn rng;\n\t\t\t}", "title": "" }, { "docid": "80a23032fb0558767373ea364d003139", "score": "0.5734782", "text": "function adjustSelectionToVisibleSelection() {\n\t\t\t\tfunction findSelectionEnd(start, end) {\n\t\t\t\t\tvar walker = new TreeWalker(end);\n\t\t\t\t\tfor (node = walker.prev2(); node; node = walker.prev2()) {\n\t\t\t\t\t\tif (node.nodeType == 3 && node.data.length > 0) {\n\t\t\t\t\t\t\treturn node;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (node.childNodes.length > 1 || node == start || node.tagName == 'BR') {\n\t\t\t\t\t\t\treturn node;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Adjust selection so that a end container with a end offset of zero is not included in the selection\n\t\t\t\t// as this isn't visible to the user.\n\t\t\t\tvar rng = ed.selection.getRng();\n\t\t\t\tvar start = rng.startContainer;\n\t\t\t\tvar end = rng.endContainer;\n\n\t\t\t\tif (start != end && rng.endOffset === 0) {\n\t\t\t\t\tvar newEnd = findSelectionEnd(start, end);\n\t\t\t\t\tvar endOffset = newEnd.nodeType == 3 ? newEnd.data.length : newEnd.childNodes.length;\n\n\t\t\t\t\trng.setEnd(newEnd, endOffset);\n\t\t\t\t}\n\n\t\t\t\treturn rng;\n\t\t\t}", "title": "" }, { "docid": "df39d14847c10b85d7e62fcdef805230", "score": "0.57308894", "text": "function getDraftEditorSelectionWithNodes(editorState, root, anchorNode, anchorOffset, focusNode, focusOffset) {\n var anchorIsTextNode = anchorNode.nodeType === Node.TEXT_NODE;\n var focusIsTextNode = focusNode.nodeType === Node.TEXT_NODE; // If the selection range lies only on text nodes, the task is simple.\n // Find the nearest offset-aware elements and use the\n // offset values supplied by the selection range.\n\n if (anchorIsTextNode && focusIsTextNode) {\n return {\n selectionState: getUpdatedSelectionState(editorState, nullthrows(findAncestorOffsetKey(anchorNode)), anchorOffset, nullthrows(findAncestorOffsetKey(focusNode)), focusOffset),\n needsRecovery: false\n };\n }\n\n var anchorPoint = null;\n var focusPoint = null;\n var needsRecovery = true; // An element is selected. Convert this selection range into leaf offset\n // keys and offset values for consumption at the component level. This\n // is common in Firefox, where select-all and triple click behavior leads\n // to entire elements being selected.\n //\n // Note that we use the `needsRecovery` parameter in the callback here. This\n // is because when certain elements are selected, the behavior for subsequent\n // cursor movement (e.g. via arrow keys) is uncertain and may not match\n // expectations at the component level. For example, if an entire <div> is\n // selected and the user presses the right arrow, Firefox keeps the selection\n // on the <div>. If we allow subsequent keypresses to insert characters\n // natively, they will be inserted into a browser-created text node to the\n // right of that <div>. This is obviously undesirable.\n //\n // With the `needsRecovery` flag, we inform the caller that it is responsible\n // for manually setting the selection state on the rendered document to\n // ensure proper selection state maintenance.\n\n if (anchorIsTextNode) {\n anchorPoint = {\n key: nullthrows(findAncestorOffsetKey(anchorNode)),\n offset: anchorOffset\n };\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n } else if (focusIsTextNode) {\n focusPoint = {\n key: nullthrows(findAncestorOffsetKey(focusNode)),\n offset: focusOffset\n };\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n } else {\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset); // If the selection is collapsed on an empty block, don't force recovery.\n // This way, on arrow key selection changes, the browser can move the\n // cursor from a non-zero offset on one block, through empty blocks,\n // to a matching non-zero offset on other text blocks.\n\n if (anchorNode === focusNode && anchorOffset === focusOffset) {\n needsRecovery = !!anchorNode.firstChild && anchorNode.firstChild.nodeName !== 'BR';\n }\n }\n\n return {\n selectionState: getUpdatedSelectionState(editorState, anchorPoint.key, anchorPoint.offset, focusPoint.key, focusPoint.offset),\n needsRecovery: needsRecovery\n };\n}", "title": "" }, { "docid": "df39d14847c10b85d7e62fcdef805230", "score": "0.57308894", "text": "function getDraftEditorSelectionWithNodes(editorState, root, anchorNode, anchorOffset, focusNode, focusOffset) {\n var anchorIsTextNode = anchorNode.nodeType === Node.TEXT_NODE;\n var focusIsTextNode = focusNode.nodeType === Node.TEXT_NODE; // If the selection range lies only on text nodes, the task is simple.\n // Find the nearest offset-aware elements and use the\n // offset values supplied by the selection range.\n\n if (anchorIsTextNode && focusIsTextNode) {\n return {\n selectionState: getUpdatedSelectionState(editorState, nullthrows(findAncestorOffsetKey(anchorNode)), anchorOffset, nullthrows(findAncestorOffsetKey(focusNode)), focusOffset),\n needsRecovery: false\n };\n }\n\n var anchorPoint = null;\n var focusPoint = null;\n var needsRecovery = true; // An element is selected. Convert this selection range into leaf offset\n // keys and offset values for consumption at the component level. This\n // is common in Firefox, where select-all and triple click behavior leads\n // to entire elements being selected.\n //\n // Note that we use the `needsRecovery` parameter in the callback here. This\n // is because when certain elements are selected, the behavior for subsequent\n // cursor movement (e.g. via arrow keys) is uncertain and may not match\n // expectations at the component level. For example, if an entire <div> is\n // selected and the user presses the right arrow, Firefox keeps the selection\n // on the <div>. If we allow subsequent keypresses to insert characters\n // natively, they will be inserted into a browser-created text node to the\n // right of that <div>. This is obviously undesirable.\n //\n // With the `needsRecovery` flag, we inform the caller that it is responsible\n // for manually setting the selection state on the rendered document to\n // ensure proper selection state maintenance.\n\n if (anchorIsTextNode) {\n anchorPoint = {\n key: nullthrows(findAncestorOffsetKey(anchorNode)),\n offset: anchorOffset\n };\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n } else if (focusIsTextNode) {\n focusPoint = {\n key: nullthrows(findAncestorOffsetKey(focusNode)),\n offset: focusOffset\n };\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n } else {\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset); // If the selection is collapsed on an empty block, don't force recovery.\n // This way, on arrow key selection changes, the browser can move the\n // cursor from a non-zero offset on one block, through empty blocks,\n // to a matching non-zero offset on other text blocks.\n\n if (anchorNode === focusNode && anchorOffset === focusOffset) {\n needsRecovery = !!anchorNode.firstChild && anchorNode.firstChild.nodeName !== 'BR';\n }\n }\n\n return {\n selectionState: getUpdatedSelectionState(editorState, anchorPoint.key, anchorPoint.offset, focusPoint.key, focusPoint.offset),\n needsRecovery: needsRecovery\n };\n}", "title": "" }, { "docid": "df39d14847c10b85d7e62fcdef805230", "score": "0.57308894", "text": "function getDraftEditorSelectionWithNodes(editorState, root, anchorNode, anchorOffset, focusNode, focusOffset) {\n var anchorIsTextNode = anchorNode.nodeType === Node.TEXT_NODE;\n var focusIsTextNode = focusNode.nodeType === Node.TEXT_NODE; // If the selection range lies only on text nodes, the task is simple.\n // Find the nearest offset-aware elements and use the\n // offset values supplied by the selection range.\n\n if (anchorIsTextNode && focusIsTextNode) {\n return {\n selectionState: getUpdatedSelectionState(editorState, nullthrows(findAncestorOffsetKey(anchorNode)), anchorOffset, nullthrows(findAncestorOffsetKey(focusNode)), focusOffset),\n needsRecovery: false\n };\n }\n\n var anchorPoint = null;\n var focusPoint = null;\n var needsRecovery = true; // An element is selected. Convert this selection range into leaf offset\n // keys and offset values for consumption at the component level. This\n // is common in Firefox, where select-all and triple click behavior leads\n // to entire elements being selected.\n //\n // Note that we use the `needsRecovery` parameter in the callback here. This\n // is because when certain elements are selected, the behavior for subsequent\n // cursor movement (e.g. via arrow keys) is uncertain and may not match\n // expectations at the component level. For example, if an entire <div> is\n // selected and the user presses the right arrow, Firefox keeps the selection\n // on the <div>. If we allow subsequent keypresses to insert characters\n // natively, they will be inserted into a browser-created text node to the\n // right of that <div>. This is obviously undesirable.\n //\n // With the `needsRecovery` flag, we inform the caller that it is responsible\n // for manually setting the selection state on the rendered document to\n // ensure proper selection state maintenance.\n\n if (anchorIsTextNode) {\n anchorPoint = {\n key: nullthrows(findAncestorOffsetKey(anchorNode)),\n offset: anchorOffset\n };\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n } else if (focusIsTextNode) {\n focusPoint = {\n key: nullthrows(findAncestorOffsetKey(focusNode)),\n offset: focusOffset\n };\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n } else {\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset); // If the selection is collapsed on an empty block, don't force recovery.\n // This way, on arrow key selection changes, the browser can move the\n // cursor from a non-zero offset on one block, through empty blocks,\n // to a matching non-zero offset on other text blocks.\n\n if (anchorNode === focusNode && anchorOffset === focusOffset) {\n needsRecovery = !!anchorNode.firstChild && anchorNode.firstChild.nodeName !== 'BR';\n }\n }\n\n return {\n selectionState: getUpdatedSelectionState(editorState, anchorPoint.key, anchorPoint.offset, focusPoint.key, focusPoint.offset),\n needsRecovery: needsRecovery\n };\n}", "title": "" }, { "docid": "216ec49eae64f3b905a6bac778b11b6f", "score": "0.5715991", "text": "function selectContent(el) {\n if (typeof window.getSelection !== \"undefined\" && \n typeof document.createRange !== \"undefined\") {\n var range = document.createRange();\n range.selectNodeContents(el);\n var sel = window.getSelection();\n sel.removeAllRanges();\n sel.addRange(range);\n } else if (typeof document.selection !== \"undefined\" && \n typeof document.body.createTextRange !== \"undefined\") {\n var textRange = document.body.createTextRange();\n textRange.moveToElementText(el);\n textRange.select();\n }\n}", "title": "" }, { "docid": "a43a923bd058ccd9af1b6e3d4097b9d5", "score": "0.5710842", "text": "moveToStart() {\n this.updateComplete.then(() => {\n if (!this._textarea) {\n console.warn('dw-textarea: \"textarea\" element not found. Somehow \"moveToStart\" method is triggered after \"disconnectedCallback\"');\n return;\n }\n if (typeof this._textarea.selectionStart == \"number\") {\n this._textarea.selectionStart = this._textarea.selectionEnd = 0;\n this._textarea.focus();\n } else if (typeof this._textarea.createTextRange != \"undefined\") {\n this._textarea.focus();\n let range = this._textarea.createTextRange();\n range.collapse(true);\n range.select();\n } else {\n console.error('dw-textarea: Error while moving cursor to start.');\n }\n this._resize();\n });\n }", "title": "" }, { "docid": "b9191259f97c4e953ebd5bfadba2b88c", "score": "0.5707764", "text": "function getCaret(el) { \n\tif (el.selectionStart) { \n\t\treturn el.selectionStart; \n\t} else if (document.selection) { \n\t\tel.focus(); \n\n\t\tvar r = document.selection.createRange(); \n\t\tif (r == null) { \n\t\t\treturn 0; \n\t\t} \n\n\t\tvar re = el.createTextRange(), \n\t\trc = re.duplicate(); \n\t\tre.moveToBookmark(r.getBookmark()); \n\t\trc.setEndPoint('EndToStart', re); \n\n\t\treturn rc.text.length; \n\t} \n\treturn 0; \n}", "title": "" }, { "docid": "adf1986334bfc2fd40396b56016daede", "score": "0.5699115", "text": "selectClickedElement(target) {\n var vSelection = new scribe.api.Selection();\n var range = document.createRange();\n range.selectNodeContents(target);\n vSelection.selection.removeAllRanges();\n vSelection.selection.addRange(range);\n }", "title": "" }, { "docid": "b27969ab61a42665b6da7424f7bb8ea6", "score": "0.56945515", "text": "_moveCaretToEnd(contentEditableElement) {\n var range,selection;\n if (document.createRange)//Firefox, Chrome, Opera, Safari, IE 9+\n {\n range = document.createRange();//Create a range (a range is a like the selection but invisible)\n range.selectNodeContents(contentEditableElement);//Select the entire contents of the element with the range\n range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start\n selection = window.getSelection();//get the selection object (allows you to change selection)\n selection.removeAllRanges();//remove any selections already made\n selection.addRange(range);//make the range you have just created the visible selection\n }\n else if (document.selection)//IE 8 and lower\n {\n range = document.body.createTextRange();//Create a range (a range is a like the selection but invisible)\n range.moveToElementText(contentEditableElement);//Select the entire contents of the element with the range\n range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start\n range.select();//Select the range (make it the visible selection\n }\n }", "title": "" }, { "docid": "82059f7d54245309f28ceb43b9b3d241", "score": "0.5694184", "text": "function focusFirstElement() {\n // FOCUS First Element\n const elem = document.getElementsByClassName('rwInput')[0];\n if (elem) {\n const elemLen = elem.value.length;\n if (elem.selectionStart || elem.selectionStart == '0') {\n elem.selectionStart = elemLen;\n elem.selectionEnd = elemLen;\n elem.focus();\n }\n }\n }", "title": "" }, { "docid": "28abb932363985ce2576828a7b9eabce", "score": "0.5686604", "text": "function mozillaWorkaroundForAbsentCursorOnFocus()\n{\n\t// NEW Markus / 11-01-09\n if (getBrowser().name == \"firefox\") {\n// if (getBrowser() == \"firefox\") {\n document.getElementById('left_bg').style.position='absolute';\n }\n}", "title": "" }, { "docid": "8e5a2c7a81fa58f2d35a4da067620353", "score": "0.5673249", "text": "function getDraftEditorSelectionWithNodes(editorState, root, anchorNode, anchorOffset, focusNode, focusOffset) {\n var anchorIsTextNode = anchorNode.nodeType === Node.TEXT_NODE;\n var focusIsTextNode = focusNode.nodeType === Node.TEXT_NODE;\n\n // If the selection range lies only on text nodes, the task is simple.\n // Find the nearest offset-aware elements and use the\n // offset values supplied by the selection range.\n if (anchorIsTextNode && focusIsTextNode) {\n return {\n selectionState: getUpdatedSelectionState(editorState, nullthrows(findAncestorOffsetKey(anchorNode)), anchorOffset, nullthrows(findAncestorOffsetKey(focusNode)), focusOffset),\n needsRecovery: false\n };\n }\n\n var anchorPoint = null;\n var focusPoint = null;\n var needsRecovery = true;\n\n // An element is selected. Convert this selection range into leaf offset\n // keys and offset values for consumption at the component level. This\n // is common in Firefox, where select-all and triple click behavior leads\n // to entire elements being selected.\n //\n // Note that we use the `needsRecovery` parameter in the callback here. This\n // is because when certain elements are selected, the behavior for subsequent\n // cursor movement (e.g. via arrow keys) is uncertain and may not match\n // expectations at the component level. For example, if an entire <div> is\n // selected and the user presses the right arrow, Firefox keeps the selection\n // on the <div>. If we allow subsequent keypresses to insert characters\n // natively, they will be inserted into a browser-created text node to the\n // right of that <div>. This is obviously undesirable.\n //\n // With the `needsRecovery` flag, we inform the caller that it is responsible\n // for manually setting the selection state on the rendered document to\n // ensure proper selection state maintenance.\n\n if (anchorIsTextNode) {\n anchorPoint = {\n key: nullthrows(findAncestorOffsetKey(anchorNode)),\n offset: anchorOffset\n };\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n } else if (focusIsTextNode) {\n focusPoint = {\n key: nullthrows(findAncestorOffsetKey(focusNode)),\n offset: focusOffset\n };\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n } else {\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n\n // If the selection is collapsed on an empty block, don't force recovery.\n // This way, on arrow key selection changes, the browser can move the\n // cursor from a non-zero offset on one block, through empty blocks,\n // to a matching non-zero offset on other text blocks.\n if (anchorNode === focusNode && anchorOffset === focusOffset) {\n needsRecovery = !!anchorNode.firstChild && anchorNode.firstChild.nodeName !== 'BR';\n }\n }\n\n return {\n selectionState: getUpdatedSelectionState(editorState, anchorPoint.key, anchorPoint.offset, focusPoint.key, focusPoint.offset),\n needsRecovery: needsRecovery\n };\n}", "title": "" }, { "docid": "8e5a2c7a81fa58f2d35a4da067620353", "score": "0.5673249", "text": "function getDraftEditorSelectionWithNodes(editorState, root, anchorNode, anchorOffset, focusNode, focusOffset) {\n var anchorIsTextNode = anchorNode.nodeType === Node.TEXT_NODE;\n var focusIsTextNode = focusNode.nodeType === Node.TEXT_NODE;\n\n // If the selection range lies only on text nodes, the task is simple.\n // Find the nearest offset-aware elements and use the\n // offset values supplied by the selection range.\n if (anchorIsTextNode && focusIsTextNode) {\n return {\n selectionState: getUpdatedSelectionState(editorState, nullthrows(findAncestorOffsetKey(anchorNode)), anchorOffset, nullthrows(findAncestorOffsetKey(focusNode)), focusOffset),\n needsRecovery: false\n };\n }\n\n var anchorPoint = null;\n var focusPoint = null;\n var needsRecovery = true;\n\n // An element is selected. Convert this selection range into leaf offset\n // keys and offset values for consumption at the component level. This\n // is common in Firefox, where select-all and triple click behavior leads\n // to entire elements being selected.\n //\n // Note that we use the `needsRecovery` parameter in the callback here. This\n // is because when certain elements are selected, the behavior for subsequent\n // cursor movement (e.g. via arrow keys) is uncertain and may not match\n // expectations at the component level. For example, if an entire <div> is\n // selected and the user presses the right arrow, Firefox keeps the selection\n // on the <div>. If we allow subsequent keypresses to insert characters\n // natively, they will be inserted into a browser-created text node to the\n // right of that <div>. This is obviously undesirable.\n //\n // With the `needsRecovery` flag, we inform the caller that it is responsible\n // for manually setting the selection state on the rendered document to\n // ensure proper selection state maintenance.\n\n if (anchorIsTextNode) {\n anchorPoint = {\n key: nullthrows(findAncestorOffsetKey(anchorNode)),\n offset: anchorOffset\n };\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n } else if (focusIsTextNode) {\n focusPoint = {\n key: nullthrows(findAncestorOffsetKey(focusNode)),\n offset: focusOffset\n };\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n } else {\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n\n // If the selection is collapsed on an empty block, don't force recovery.\n // This way, on arrow key selection changes, the browser can move the\n // cursor from a non-zero offset on one block, through empty blocks,\n // to a matching non-zero offset on other text blocks.\n if (anchorNode === focusNode && anchorOffset === focusOffset) {\n needsRecovery = !!anchorNode.firstChild && anchorNode.firstChild.nodeName !== 'BR';\n }\n }\n\n return {\n selectionState: getUpdatedSelectionState(editorState, anchorPoint.key, anchorPoint.offset, focusPoint.key, focusPoint.offset),\n needsRecovery: needsRecovery\n };\n}", "title": "" }, { "docid": "8e5a2c7a81fa58f2d35a4da067620353", "score": "0.5673249", "text": "function getDraftEditorSelectionWithNodes(editorState, root, anchorNode, anchorOffset, focusNode, focusOffset) {\n var anchorIsTextNode = anchorNode.nodeType === Node.TEXT_NODE;\n var focusIsTextNode = focusNode.nodeType === Node.TEXT_NODE;\n\n // If the selection range lies only on text nodes, the task is simple.\n // Find the nearest offset-aware elements and use the\n // offset values supplied by the selection range.\n if (anchorIsTextNode && focusIsTextNode) {\n return {\n selectionState: getUpdatedSelectionState(editorState, nullthrows(findAncestorOffsetKey(anchorNode)), anchorOffset, nullthrows(findAncestorOffsetKey(focusNode)), focusOffset),\n needsRecovery: false\n };\n }\n\n var anchorPoint = null;\n var focusPoint = null;\n var needsRecovery = true;\n\n // An element is selected. Convert this selection range into leaf offset\n // keys and offset values for consumption at the component level. This\n // is common in Firefox, where select-all and triple click behavior leads\n // to entire elements being selected.\n //\n // Note that we use the `needsRecovery` parameter in the callback here. This\n // is because when certain elements are selected, the behavior for subsequent\n // cursor movement (e.g. via arrow keys) is uncertain and may not match\n // expectations at the component level. For example, if an entire <div> is\n // selected and the user presses the right arrow, Firefox keeps the selection\n // on the <div>. If we allow subsequent keypresses to insert characters\n // natively, they will be inserted into a browser-created text node to the\n // right of that <div>. This is obviously undesirable.\n //\n // With the `needsRecovery` flag, we inform the caller that it is responsible\n // for manually setting the selection state on the rendered document to\n // ensure proper selection state maintenance.\n\n if (anchorIsTextNode) {\n anchorPoint = {\n key: nullthrows(findAncestorOffsetKey(anchorNode)),\n offset: anchorOffset\n };\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n } else if (focusIsTextNode) {\n focusPoint = {\n key: nullthrows(findAncestorOffsetKey(focusNode)),\n offset: focusOffset\n };\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n } else {\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n\n // If the selection is collapsed on an empty block, don't force recovery.\n // This way, on arrow key selection changes, the browser can move the\n // cursor from a non-zero offset on one block, through empty blocks,\n // to a matching non-zero offset on other text blocks.\n if (anchorNode === focusNode && anchorOffset === focusOffset) {\n needsRecovery = !!anchorNode.firstChild && anchorNode.firstChild.nodeName !== 'BR';\n }\n }\n\n return {\n selectionState: getUpdatedSelectionState(editorState, anchorPoint.key, anchorPoint.offset, focusPoint.key, focusPoint.offset),\n needsRecovery: needsRecovery\n };\n}", "title": "" }, { "docid": "8e5a2c7a81fa58f2d35a4da067620353", "score": "0.5673249", "text": "function getDraftEditorSelectionWithNodes(editorState, root, anchorNode, anchorOffset, focusNode, focusOffset) {\n var anchorIsTextNode = anchorNode.nodeType === Node.TEXT_NODE;\n var focusIsTextNode = focusNode.nodeType === Node.TEXT_NODE;\n\n // If the selection range lies only on text nodes, the task is simple.\n // Find the nearest offset-aware elements and use the\n // offset values supplied by the selection range.\n if (anchorIsTextNode && focusIsTextNode) {\n return {\n selectionState: getUpdatedSelectionState(editorState, nullthrows(findAncestorOffsetKey(anchorNode)), anchorOffset, nullthrows(findAncestorOffsetKey(focusNode)), focusOffset),\n needsRecovery: false\n };\n }\n\n var anchorPoint = null;\n var focusPoint = null;\n var needsRecovery = true;\n\n // An element is selected. Convert this selection range into leaf offset\n // keys and offset values for consumption at the component level. This\n // is common in Firefox, where select-all and triple click behavior leads\n // to entire elements being selected.\n //\n // Note that we use the `needsRecovery` parameter in the callback here. This\n // is because when certain elements are selected, the behavior for subsequent\n // cursor movement (e.g. via arrow keys) is uncertain and may not match\n // expectations at the component level. For example, if an entire <div> is\n // selected and the user presses the right arrow, Firefox keeps the selection\n // on the <div>. If we allow subsequent keypresses to insert characters\n // natively, they will be inserted into a browser-created text node to the\n // right of that <div>. This is obviously undesirable.\n //\n // With the `needsRecovery` flag, we inform the caller that it is responsible\n // for manually setting the selection state on the rendered document to\n // ensure proper selection state maintenance.\n\n if (anchorIsTextNode) {\n anchorPoint = {\n key: nullthrows(findAncestorOffsetKey(anchorNode)),\n offset: anchorOffset\n };\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n } else if (focusIsTextNode) {\n focusPoint = {\n key: nullthrows(findAncestorOffsetKey(focusNode)),\n offset: focusOffset\n };\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n } else {\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n\n // If the selection is collapsed on an empty block, don't force recovery.\n // This way, on arrow key selection changes, the browser can move the\n // cursor from a non-zero offset on one block, through empty blocks,\n // to a matching non-zero offset on other text blocks.\n if (anchorNode === focusNode && anchorOffset === focusOffset) {\n needsRecovery = !!anchorNode.firstChild && anchorNode.firstChild.nodeName !== 'BR';\n }\n }\n\n return {\n selectionState: getUpdatedSelectionState(editorState, anchorPoint.key, anchorPoint.offset, focusPoint.key, focusPoint.offset),\n needsRecovery: needsRecovery\n };\n}", "title": "" }, { "docid": "8e5a2c7a81fa58f2d35a4da067620353", "score": "0.5673249", "text": "function getDraftEditorSelectionWithNodes(editorState, root, anchorNode, anchorOffset, focusNode, focusOffset) {\n var anchorIsTextNode = anchorNode.nodeType === Node.TEXT_NODE;\n var focusIsTextNode = focusNode.nodeType === Node.TEXT_NODE;\n\n // If the selection range lies only on text nodes, the task is simple.\n // Find the nearest offset-aware elements and use the\n // offset values supplied by the selection range.\n if (anchorIsTextNode && focusIsTextNode) {\n return {\n selectionState: getUpdatedSelectionState(editorState, nullthrows(findAncestorOffsetKey(anchorNode)), anchorOffset, nullthrows(findAncestorOffsetKey(focusNode)), focusOffset),\n needsRecovery: false\n };\n }\n\n var anchorPoint = null;\n var focusPoint = null;\n var needsRecovery = true;\n\n // An element is selected. Convert this selection range into leaf offset\n // keys and offset values for consumption at the component level. This\n // is common in Firefox, where select-all and triple click behavior leads\n // to entire elements being selected.\n //\n // Note that we use the `needsRecovery` parameter in the callback here. This\n // is because when certain elements are selected, the behavior for subsequent\n // cursor movement (e.g. via arrow keys) is uncertain and may not match\n // expectations at the component level. For example, if an entire <div> is\n // selected and the user presses the right arrow, Firefox keeps the selection\n // on the <div>. If we allow subsequent keypresses to insert characters\n // natively, they will be inserted into a browser-created text node to the\n // right of that <div>. This is obviously undesirable.\n //\n // With the `needsRecovery` flag, we inform the caller that it is responsible\n // for manually setting the selection state on the rendered document to\n // ensure proper selection state maintenance.\n\n if (anchorIsTextNode) {\n anchorPoint = {\n key: nullthrows(findAncestorOffsetKey(anchorNode)),\n offset: anchorOffset\n };\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n } else if (focusIsTextNode) {\n focusPoint = {\n key: nullthrows(findAncestorOffsetKey(focusNode)),\n offset: focusOffset\n };\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n } else {\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n\n // If the selection is collapsed on an empty block, don't force recovery.\n // This way, on arrow key selection changes, the browser can move the\n // cursor from a non-zero offset on one block, through empty blocks,\n // to a matching non-zero offset on other text blocks.\n if (anchorNode === focusNode && anchorOffset === focusOffset) {\n needsRecovery = !!anchorNode.firstChild && anchorNode.firstChild.nodeName !== 'BR';\n }\n }\n\n return {\n selectionState: getUpdatedSelectionState(editorState, anchorPoint.key, anchorPoint.offset, focusPoint.key, focusPoint.offset),\n needsRecovery: needsRecovery\n };\n}", "title": "" }, { "docid": "8e5a2c7a81fa58f2d35a4da067620353", "score": "0.5673249", "text": "function getDraftEditorSelectionWithNodes(editorState, root, anchorNode, anchorOffset, focusNode, focusOffset) {\n var anchorIsTextNode = anchorNode.nodeType === Node.TEXT_NODE;\n var focusIsTextNode = focusNode.nodeType === Node.TEXT_NODE;\n\n // If the selection range lies only on text nodes, the task is simple.\n // Find the nearest offset-aware elements and use the\n // offset values supplied by the selection range.\n if (anchorIsTextNode && focusIsTextNode) {\n return {\n selectionState: getUpdatedSelectionState(editorState, nullthrows(findAncestorOffsetKey(anchorNode)), anchorOffset, nullthrows(findAncestorOffsetKey(focusNode)), focusOffset),\n needsRecovery: false\n };\n }\n\n var anchorPoint = null;\n var focusPoint = null;\n var needsRecovery = true;\n\n // An element is selected. Convert this selection range into leaf offset\n // keys and offset values for consumption at the component level. This\n // is common in Firefox, where select-all and triple click behavior leads\n // to entire elements being selected.\n //\n // Note that we use the `needsRecovery` parameter in the callback here. This\n // is because when certain elements are selected, the behavior for subsequent\n // cursor movement (e.g. via arrow keys) is uncertain and may not match\n // expectations at the component level. For example, if an entire <div> is\n // selected and the user presses the right arrow, Firefox keeps the selection\n // on the <div>. If we allow subsequent keypresses to insert characters\n // natively, they will be inserted into a browser-created text node to the\n // right of that <div>. This is obviously undesirable.\n //\n // With the `needsRecovery` flag, we inform the caller that it is responsible\n // for manually setting the selection state on the rendered document to\n // ensure proper selection state maintenance.\n\n if (anchorIsTextNode) {\n anchorPoint = {\n key: nullthrows(findAncestorOffsetKey(anchorNode)),\n offset: anchorOffset\n };\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n } else if (focusIsTextNode) {\n focusPoint = {\n key: nullthrows(findAncestorOffsetKey(focusNode)),\n offset: focusOffset\n };\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n } else {\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n\n // If the selection is collapsed on an empty block, don't force recovery.\n // This way, on arrow key selection changes, the browser can move the\n // cursor from a non-zero offset on one block, through empty blocks,\n // to a matching non-zero offset on other text blocks.\n if (anchorNode === focusNode && anchorOffset === focusOffset) {\n needsRecovery = !!anchorNode.firstChild && anchorNode.firstChild.nodeName !== 'BR';\n }\n }\n\n return {\n selectionState: getUpdatedSelectionState(editorState, anchorPoint.key, anchorPoint.offset, focusPoint.key, focusPoint.offset),\n needsRecovery: needsRecovery\n };\n}", "title": "" }, { "docid": "8e5a2c7a81fa58f2d35a4da067620353", "score": "0.5673249", "text": "function getDraftEditorSelectionWithNodes(editorState, root, anchorNode, anchorOffset, focusNode, focusOffset) {\n var anchorIsTextNode = anchorNode.nodeType === Node.TEXT_NODE;\n var focusIsTextNode = focusNode.nodeType === Node.TEXT_NODE;\n\n // If the selection range lies only on text nodes, the task is simple.\n // Find the nearest offset-aware elements and use the\n // offset values supplied by the selection range.\n if (anchorIsTextNode && focusIsTextNode) {\n return {\n selectionState: getUpdatedSelectionState(editorState, nullthrows(findAncestorOffsetKey(anchorNode)), anchorOffset, nullthrows(findAncestorOffsetKey(focusNode)), focusOffset),\n needsRecovery: false\n };\n }\n\n var anchorPoint = null;\n var focusPoint = null;\n var needsRecovery = true;\n\n // An element is selected. Convert this selection range into leaf offset\n // keys and offset values for consumption at the component level. This\n // is common in Firefox, where select-all and triple click behavior leads\n // to entire elements being selected.\n //\n // Note that we use the `needsRecovery` parameter in the callback here. This\n // is because when certain elements are selected, the behavior for subsequent\n // cursor movement (e.g. via arrow keys) is uncertain and may not match\n // expectations at the component level. For example, if an entire <div> is\n // selected and the user presses the right arrow, Firefox keeps the selection\n // on the <div>. If we allow subsequent keypresses to insert characters\n // natively, they will be inserted into a browser-created text node to the\n // right of that <div>. This is obviously undesirable.\n //\n // With the `needsRecovery` flag, we inform the caller that it is responsible\n // for manually setting the selection state on the rendered document to\n // ensure proper selection state maintenance.\n\n if (anchorIsTextNode) {\n anchorPoint = {\n key: nullthrows(findAncestorOffsetKey(anchorNode)),\n offset: anchorOffset\n };\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n } else if (focusIsTextNode) {\n focusPoint = {\n key: nullthrows(findAncestorOffsetKey(focusNode)),\n offset: focusOffset\n };\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n } else {\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n\n // If the selection is collapsed on an empty block, don't force recovery.\n // This way, on arrow key selection changes, the browser can move the\n // cursor from a non-zero offset on one block, through empty blocks,\n // to a matching non-zero offset on other text blocks.\n if (anchorNode === focusNode && anchorOffset === focusOffset) {\n needsRecovery = !!anchorNode.firstChild && anchorNode.firstChild.nodeName !== 'BR';\n }\n }\n\n return {\n selectionState: getUpdatedSelectionState(editorState, anchorPoint.key, anchorPoint.offset, focusPoint.key, focusPoint.offset),\n needsRecovery: needsRecovery\n };\n}", "title": "" }, { "docid": "9046313db8d255f374feafe38c042586", "score": "0.5671951", "text": "function getDraftEditorSelectionWithNodes(editorState, root, anchorNode, anchorOffset, focusNode, focusOffset) {\n\t var anchorIsTextNode = anchorNode.nodeType === Node.TEXT_NODE;\n\t var focusIsTextNode = focusNode.nodeType === Node.TEXT_NODE;\n\n\t // If the selection range lies only on text nodes, the task is simple.\n\t // Find the nearest offset-aware elements and use the\n\t // offset values supplied by the selection range.\n\t if (anchorIsTextNode && focusIsTextNode) {\n\t return {\n\t selectionState: getUpdatedSelectionState(editorState, nullthrows(findAncestorOffsetKey(anchorNode)), anchorOffset, nullthrows(findAncestorOffsetKey(focusNode)), focusOffset),\n\t needsRecovery: false\n\t };\n\t }\n\n\t var anchorPoint = null;\n\t var focusPoint = null;\n\t var needsRecovery = true;\n\n\t // An element is selected. Convert this selection range into leaf offset\n\t // keys and offset values for consumption at the component level. This\n\t // is common in Firefox, where select-all and triple click behavior leads\n\t // to entire elements being selected.\n\t //\n\t // Note that we use the `needsRecovery` parameter in the callback here. This\n\t // is because when certain elements are selected, the behavior for subsequent\n\t // cursor movement (e.g. via arrow keys) is uncertain and may not match\n\t // expectations at the component level. For example, if an entire <div> is\n\t // selected and the user presses the right arrow, Firefox keeps the selection\n\t // on the <div>. If we allow subsequent keypresses to insert characters\n\t // natively, they will be inserted into a browser-created text node to the\n\t // right of that <div>. This is obviously undesirable.\n\t //\n\t // With the `needsRecovery` flag, we inform the caller that it is responsible\n\t // for manually setting the selection state on the rendered document to\n\t // ensure proper selection state maintenance.\n\n\t if (anchorIsTextNode) {\n\t anchorPoint = {\n\t key: nullthrows(findAncestorOffsetKey(anchorNode)),\n\t offset: anchorOffset\n\t };\n\t focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n\t } else if (focusIsTextNode) {\n\t focusPoint = {\n\t key: nullthrows(findAncestorOffsetKey(focusNode)),\n\t offset: focusOffset\n\t };\n\t anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n\t } else {\n\t anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n\t focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n\n\t // If the selection is collapsed on an empty block, don't force recovery.\n\t // This way, on arrow key selection changes, the browser can move the\n\t // cursor from a non-zero offset on one block, through empty blocks,\n\t // to a matching non-zero offset on other text blocks.\n\t if (anchorNode === focusNode && anchorOffset === focusOffset) {\n\t needsRecovery = !!anchorNode.firstChild && anchorNode.firstChild.nodeName !== 'BR';\n\t }\n\t }\n\n\t return {\n\t selectionState: getUpdatedSelectionState(editorState, anchorPoint.key, anchorPoint.offset, focusPoint.key, focusPoint.offset),\n\t needsRecovery: needsRecovery\n\t };\n\t}", "title": "" }, { "docid": "2f2abb5415a4aab372f97f62df8919a9", "score": "0.566324", "text": "saveSelection(containerEl) {\r\n var start;\r\n if (window.getSelection && document.createRange) {\r\n var range = window.getSelection().getRangeAt(0);\r\n var preSelectionRange = range.cloneRange();\r\n preSelectionRange.selectNodeContents(containerEl);\r\n preSelectionRange.setEnd(range.startContainer, range.startOffset);\r\n start = preSelectionRange.toString().length;\r\n\r\n return {\r\n start: start,\r\n end: start + range.toString().length\r\n }\r\n } else if (document.selection && document.body.createTextRange) {\r\n // This is for IE...\r\n var selectedTextRange = document.selection.createRange();\r\n var preSelectionTextRange = document.body.createTextRange();\r\n preSelectionTextRange.moveToElementText(containerEl);\r\n preSelectionTextRange.setEndPoint(\"EndToStart\", selectedTextRange);\r\n start = preSelectionTextRange.text.length;\r\n\r\n return {\r\n start: start,\r\n end: start + selectedTextRange.text.length\r\n }\r\n }\r\n }", "title": "" }, { "docid": "e63eb2d1f155a5d8ec467340ad8cf3a4", "score": "0.5656805", "text": "function fixCaret(styleElement)\n {\n var doc = styleElement.ownerDocument || styleElement.document; //get the document\n var win = doc.defaultView || doc.parentWindow; //get the window\n\n var range = doc.createRange(); //create new range\n var selection = win.getSelection(); //get the current range\n\n //set the caret to the end of the element\n range.setStart(styleElement, styleElement.textContent.length);\n range.collapse(true);\n selection.removeAllRanges();\n selection.addRange(range);\n\n }", "title": "" }, { "docid": "250ea001c0f05893f801e9cc2377ff0e", "score": "0.56483966", "text": "function set_IE_selection(t) {\n var nbLineStart, nbLineStart, nbLineEnd, range;\n if (!window.closed) {\n nbLineStart = t.value.substr(0, t.selectionStart).split(\"\\n\").length - 1;\n nbLineEnd = t.value.substr(0, t.selectionEnd).split(\"\\n\").length - 1;\n try {\n range = document.selection.createRange();\n range.moveToElementText(t);\n range.setEndPoint('EndToStart', range);\n range.moveStart('character', t.selectionStart - nbLineStart);\n range.moveEnd('character', t.selectionEnd - nbLineEnd - (t.selectionStart - nbLineStart));\n range.select();\n }\n catch (e) {\n }\n }\n}", "title": "" }, { "docid": "d5bf90326c00a6ea02287c02b07208d8", "score": "0.56408334", "text": "function resolveScrollToPos(cm){var range=cm.curOp.scrollToPos;if(range){cm.curOp.scrollToPos=null;var from=estimateCoords(cm,range.from),to=estimateCoords(cm,range.to);var sPos=calculateScrollPos(cm,Math.min(from.left,to.left),Math.min(from.top,to.top)-range.margin,Math.max(from.right,to.right),Math.max(from.bottom,to.bottom)+range.margin);cm.scrollTo(sPos.scrollLeft,sPos.scrollTop);}}// Operations are used to wrap a series of changes to the editor", "title": "" }, { "docid": "3114faf3e3f9018b89d5d05629282adb", "score": "0.56325454", "text": "function restoreFocusOnKeyDown() {\n\t\t\tif (!editor.inline) {\n\t\t\t\teditor.on('keydown', function() {\n\t\t\t\t\tif (document.activeElement == document.body) {\n\t\t\t\t\t\teditor.getWin().focus();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "3114faf3e3f9018b89d5d05629282adb", "score": "0.56325454", "text": "function restoreFocusOnKeyDown() {\n\t\t\tif (!editor.inline) {\n\t\t\t\teditor.on('keydown', function() {\n\t\t\t\t\tif (document.activeElement == document.body) {\n\t\t\t\t\t\teditor.getWin().focus();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "3114faf3e3f9018b89d5d05629282adb", "score": "0.56325454", "text": "function restoreFocusOnKeyDown() {\n\t\t\tif (!editor.inline) {\n\t\t\t\teditor.on('keydown', function() {\n\t\t\t\t\tif (document.activeElement == document.body) {\n\t\t\t\t\t\teditor.getWin().focus();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "3114faf3e3f9018b89d5d05629282adb", "score": "0.56325454", "text": "function restoreFocusOnKeyDown() {\n\t\t\tif (!editor.inline) {\n\t\t\t\teditor.on('keydown', function() {\n\t\t\t\t\tif (document.activeElement == document.body) {\n\t\t\t\t\t\teditor.getWin().focus();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "768ed0b7dc699ad784b2260e017c0552", "score": "0.5626146", "text": "_focusActiveCell(movePreview = true) {\n this._ngZone.runOutsideAngular(() => {\n this._ngZone.onStable.asObservable().pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_12__[\"take\"])(1)).subscribe(() => {\n const activeCell = this._elementRef.nativeElement.querySelector('.mat-calendar-body-active');\n if (activeCell) {\n if (!movePreview) {\n this._skipNextFocus = true;\n }\n activeCell.focus();\n }\n });\n });\n }", "title": "" }, { "docid": "9b52fe3e1add2748435013de7859b966", "score": "0.5624844", "text": "focus() {\n if (this.isFocusable) {\n DomHelper.focusWithoutScrolling(this.focusElement);\n }\n }", "title": "" }, { "docid": "bfcc1b6178d9c8da16cf06adf8732eb4", "score": "0.5619247", "text": "function setDraftEditorSelection(selectionState, node, blockKey, nodeStart, nodeEnd) {\n // It's possible that the editor has been removed from the DOM but\n // our selection code doesn't know it yet. Forcing selection in\n // this case may lead to errors, so just bail now.\n if (!containsNode(document.documentElement, node)) {\n return;\n }\n\n var selection = global.getSelection();\n var anchorKey = selectionState.getAnchorKey();\n var anchorOffset = selectionState.getAnchorOffset();\n var focusKey = selectionState.getFocusKey();\n var focusOffset = selectionState.getFocusOffset();\n var isBackward = selectionState.getIsBackward();\n\n // IE doesn't support backward selection. Swap key/offset pairs.\n if (!selection.extend && isBackward) {\n var tempKey = anchorKey;\n var tempOffset = anchorOffset;\n anchorKey = focusKey;\n anchorOffset = focusOffset;\n focusKey = tempKey;\n focusOffset = tempOffset;\n isBackward = false;\n }\n\n var hasAnchor = anchorKey === blockKey && nodeStart <= anchorOffset && nodeEnd >= anchorOffset;\n\n var hasFocus = focusKey === blockKey && nodeStart <= focusOffset && nodeEnd >= focusOffset;\n\n // If the selection is entirely bound within this node, set the selection\n // and be done.\n if (hasAnchor && hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n return;\n }\n\n if (!isBackward) {\n // If the anchor is within this node, set the range start.\n if (hasAnchor) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n }\n\n // If the focus is within this node, we can assume that we have\n // already set the appropriate start range on the selection, and\n // can simply extend the selection.\n if (hasFocus) {\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n }\n } else {\n // If this node has the focus, set the selection range to be a\n // collapsed range beginning here. Later, when we encounter the anchor,\n // we'll use this information to extend the selection.\n if (hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, focusOffset - nodeStart, selectionState);\n }\n\n // If this node has the anchor, we may assume that the correct\n // focus information is already stored on the selection object.\n // We keep track of it, reset the selection range, and extend it\n // back to the focus point.\n if (hasAnchor) {\n var storedFocusNode = selection.focusNode;\n var storedFocusOffset = selection.focusOffset;\n\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, storedFocusNode, storedFocusOffset, selectionState);\n }\n }\n}", "title": "" }, { "docid": "bfcc1b6178d9c8da16cf06adf8732eb4", "score": "0.5619247", "text": "function setDraftEditorSelection(selectionState, node, blockKey, nodeStart, nodeEnd) {\n // It's possible that the editor has been removed from the DOM but\n // our selection code doesn't know it yet. Forcing selection in\n // this case may lead to errors, so just bail now.\n if (!containsNode(document.documentElement, node)) {\n return;\n }\n\n var selection = global.getSelection();\n var anchorKey = selectionState.getAnchorKey();\n var anchorOffset = selectionState.getAnchorOffset();\n var focusKey = selectionState.getFocusKey();\n var focusOffset = selectionState.getFocusOffset();\n var isBackward = selectionState.getIsBackward();\n\n // IE doesn't support backward selection. Swap key/offset pairs.\n if (!selection.extend && isBackward) {\n var tempKey = anchorKey;\n var tempOffset = anchorOffset;\n anchorKey = focusKey;\n anchorOffset = focusOffset;\n focusKey = tempKey;\n focusOffset = tempOffset;\n isBackward = false;\n }\n\n var hasAnchor = anchorKey === blockKey && nodeStart <= anchorOffset && nodeEnd >= anchorOffset;\n\n var hasFocus = focusKey === blockKey && nodeStart <= focusOffset && nodeEnd >= focusOffset;\n\n // If the selection is entirely bound within this node, set the selection\n // and be done.\n if (hasAnchor && hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n return;\n }\n\n if (!isBackward) {\n // If the anchor is within this node, set the range start.\n if (hasAnchor) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n }\n\n // If the focus is within this node, we can assume that we have\n // already set the appropriate start range on the selection, and\n // can simply extend the selection.\n if (hasFocus) {\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n }\n } else {\n // If this node has the focus, set the selection range to be a\n // collapsed range beginning here. Later, when we encounter the anchor,\n // we'll use this information to extend the selection.\n if (hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, focusOffset - nodeStart, selectionState);\n }\n\n // If this node has the anchor, we may assume that the correct\n // focus information is already stored on the selection object.\n // We keep track of it, reset the selection range, and extend it\n // back to the focus point.\n if (hasAnchor) {\n var storedFocusNode = selection.focusNode;\n var storedFocusOffset = selection.focusOffset;\n\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, storedFocusNode, storedFocusOffset, selectionState);\n }\n }\n}", "title": "" }, { "docid": "bfcc1b6178d9c8da16cf06adf8732eb4", "score": "0.5619247", "text": "function setDraftEditorSelection(selectionState, node, blockKey, nodeStart, nodeEnd) {\n // It's possible that the editor has been removed from the DOM but\n // our selection code doesn't know it yet. Forcing selection in\n // this case may lead to errors, so just bail now.\n if (!containsNode(document.documentElement, node)) {\n return;\n }\n\n var selection = global.getSelection();\n var anchorKey = selectionState.getAnchorKey();\n var anchorOffset = selectionState.getAnchorOffset();\n var focusKey = selectionState.getFocusKey();\n var focusOffset = selectionState.getFocusOffset();\n var isBackward = selectionState.getIsBackward();\n\n // IE doesn't support backward selection. Swap key/offset pairs.\n if (!selection.extend && isBackward) {\n var tempKey = anchorKey;\n var tempOffset = anchorOffset;\n anchorKey = focusKey;\n anchorOffset = focusOffset;\n focusKey = tempKey;\n focusOffset = tempOffset;\n isBackward = false;\n }\n\n var hasAnchor = anchorKey === blockKey && nodeStart <= anchorOffset && nodeEnd >= anchorOffset;\n\n var hasFocus = focusKey === blockKey && nodeStart <= focusOffset && nodeEnd >= focusOffset;\n\n // If the selection is entirely bound within this node, set the selection\n // and be done.\n if (hasAnchor && hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n return;\n }\n\n if (!isBackward) {\n // If the anchor is within this node, set the range start.\n if (hasAnchor) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n }\n\n // If the focus is within this node, we can assume that we have\n // already set the appropriate start range on the selection, and\n // can simply extend the selection.\n if (hasFocus) {\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n }\n } else {\n // If this node has the focus, set the selection range to be a\n // collapsed range beginning here. Later, when we encounter the anchor,\n // we'll use this information to extend the selection.\n if (hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, focusOffset - nodeStart, selectionState);\n }\n\n // If this node has the anchor, we may assume that the correct\n // focus information is already stored on the selection object.\n // We keep track of it, reset the selection range, and extend it\n // back to the focus point.\n if (hasAnchor) {\n var storedFocusNode = selection.focusNode;\n var storedFocusOffset = selection.focusOffset;\n\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, storedFocusNode, storedFocusOffset, selectionState);\n }\n }\n}", "title": "" }, { "docid": "bfcc1b6178d9c8da16cf06adf8732eb4", "score": "0.5619247", "text": "function setDraftEditorSelection(selectionState, node, blockKey, nodeStart, nodeEnd) {\n // It's possible that the editor has been removed from the DOM but\n // our selection code doesn't know it yet. Forcing selection in\n // this case may lead to errors, so just bail now.\n if (!containsNode(document.documentElement, node)) {\n return;\n }\n\n var selection = global.getSelection();\n var anchorKey = selectionState.getAnchorKey();\n var anchorOffset = selectionState.getAnchorOffset();\n var focusKey = selectionState.getFocusKey();\n var focusOffset = selectionState.getFocusOffset();\n var isBackward = selectionState.getIsBackward();\n\n // IE doesn't support backward selection. Swap key/offset pairs.\n if (!selection.extend && isBackward) {\n var tempKey = anchorKey;\n var tempOffset = anchorOffset;\n anchorKey = focusKey;\n anchorOffset = focusOffset;\n focusKey = tempKey;\n focusOffset = tempOffset;\n isBackward = false;\n }\n\n var hasAnchor = anchorKey === blockKey && nodeStart <= anchorOffset && nodeEnd >= anchorOffset;\n\n var hasFocus = focusKey === blockKey && nodeStart <= focusOffset && nodeEnd >= focusOffset;\n\n // If the selection is entirely bound within this node, set the selection\n // and be done.\n if (hasAnchor && hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n return;\n }\n\n if (!isBackward) {\n // If the anchor is within this node, set the range start.\n if (hasAnchor) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n }\n\n // If the focus is within this node, we can assume that we have\n // already set the appropriate start range on the selection, and\n // can simply extend the selection.\n if (hasFocus) {\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n }\n } else {\n // If this node has the focus, set the selection range to be a\n // collapsed range beginning here. Later, when we encounter the anchor,\n // we'll use this information to extend the selection.\n if (hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, focusOffset - nodeStart, selectionState);\n }\n\n // If this node has the anchor, we may assume that the correct\n // focus information is already stored on the selection object.\n // We keep track of it, reset the selection range, and extend it\n // back to the focus point.\n if (hasAnchor) {\n var storedFocusNode = selection.focusNode;\n var storedFocusOffset = selection.focusOffset;\n\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, storedFocusNode, storedFocusOffset, selectionState);\n }\n }\n}", "title": "" }, { "docid": "bfcc1b6178d9c8da16cf06adf8732eb4", "score": "0.5619247", "text": "function setDraftEditorSelection(selectionState, node, blockKey, nodeStart, nodeEnd) {\n // It's possible that the editor has been removed from the DOM but\n // our selection code doesn't know it yet. Forcing selection in\n // this case may lead to errors, so just bail now.\n if (!containsNode(document.documentElement, node)) {\n return;\n }\n\n var selection = global.getSelection();\n var anchorKey = selectionState.getAnchorKey();\n var anchorOffset = selectionState.getAnchorOffset();\n var focusKey = selectionState.getFocusKey();\n var focusOffset = selectionState.getFocusOffset();\n var isBackward = selectionState.getIsBackward();\n\n // IE doesn't support backward selection. Swap key/offset pairs.\n if (!selection.extend && isBackward) {\n var tempKey = anchorKey;\n var tempOffset = anchorOffset;\n anchorKey = focusKey;\n anchorOffset = focusOffset;\n focusKey = tempKey;\n focusOffset = tempOffset;\n isBackward = false;\n }\n\n var hasAnchor = anchorKey === blockKey && nodeStart <= anchorOffset && nodeEnd >= anchorOffset;\n\n var hasFocus = focusKey === blockKey && nodeStart <= focusOffset && nodeEnd >= focusOffset;\n\n // If the selection is entirely bound within this node, set the selection\n // and be done.\n if (hasAnchor && hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n return;\n }\n\n if (!isBackward) {\n // If the anchor is within this node, set the range start.\n if (hasAnchor) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n }\n\n // If the focus is within this node, we can assume that we have\n // already set the appropriate start range on the selection, and\n // can simply extend the selection.\n if (hasFocus) {\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n }\n } else {\n // If this node has the focus, set the selection range to be a\n // collapsed range beginning here. Later, when we encounter the anchor,\n // we'll use this information to extend the selection.\n if (hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, focusOffset - nodeStart, selectionState);\n }\n\n // If this node has the anchor, we may assume that the correct\n // focus information is already stored on the selection object.\n // We keep track of it, reset the selection range, and extend it\n // back to the focus point.\n if (hasAnchor) {\n var storedFocusNode = selection.focusNode;\n var storedFocusOffset = selection.focusOffset;\n\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, storedFocusNode, storedFocusOffset, selectionState);\n }\n }\n}", "title": "" }, { "docid": "bfcc1b6178d9c8da16cf06adf8732eb4", "score": "0.5619247", "text": "function setDraftEditorSelection(selectionState, node, blockKey, nodeStart, nodeEnd) {\n // It's possible that the editor has been removed from the DOM but\n // our selection code doesn't know it yet. Forcing selection in\n // this case may lead to errors, so just bail now.\n if (!containsNode(document.documentElement, node)) {\n return;\n }\n\n var selection = global.getSelection();\n var anchorKey = selectionState.getAnchorKey();\n var anchorOffset = selectionState.getAnchorOffset();\n var focusKey = selectionState.getFocusKey();\n var focusOffset = selectionState.getFocusOffset();\n var isBackward = selectionState.getIsBackward();\n\n // IE doesn't support backward selection. Swap key/offset pairs.\n if (!selection.extend && isBackward) {\n var tempKey = anchorKey;\n var tempOffset = anchorOffset;\n anchorKey = focusKey;\n anchorOffset = focusOffset;\n focusKey = tempKey;\n focusOffset = tempOffset;\n isBackward = false;\n }\n\n var hasAnchor = anchorKey === blockKey && nodeStart <= anchorOffset && nodeEnd >= anchorOffset;\n\n var hasFocus = focusKey === blockKey && nodeStart <= focusOffset && nodeEnd >= focusOffset;\n\n // If the selection is entirely bound within this node, set the selection\n // and be done.\n if (hasAnchor && hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n return;\n }\n\n if (!isBackward) {\n // If the anchor is within this node, set the range start.\n if (hasAnchor) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n }\n\n // If the focus is within this node, we can assume that we have\n // already set the appropriate start range on the selection, and\n // can simply extend the selection.\n if (hasFocus) {\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n }\n } else {\n // If this node has the focus, set the selection range to be a\n // collapsed range beginning here. Later, when we encounter the anchor,\n // we'll use this information to extend the selection.\n if (hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, focusOffset - nodeStart, selectionState);\n }\n\n // If this node has the anchor, we may assume that the correct\n // focus information is already stored on the selection object.\n // We keep track of it, reset the selection range, and extend it\n // back to the focus point.\n if (hasAnchor) {\n var storedFocusNode = selection.focusNode;\n var storedFocusOffset = selection.focusOffset;\n\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, storedFocusNode, storedFocusOffset, selectionState);\n }\n }\n}", "title": "" }, { "docid": "bfcc1b6178d9c8da16cf06adf8732eb4", "score": "0.5619247", "text": "function setDraftEditorSelection(selectionState, node, blockKey, nodeStart, nodeEnd) {\n // It's possible that the editor has been removed from the DOM but\n // our selection code doesn't know it yet. Forcing selection in\n // this case may lead to errors, so just bail now.\n if (!containsNode(document.documentElement, node)) {\n return;\n }\n\n var selection = global.getSelection();\n var anchorKey = selectionState.getAnchorKey();\n var anchorOffset = selectionState.getAnchorOffset();\n var focusKey = selectionState.getFocusKey();\n var focusOffset = selectionState.getFocusOffset();\n var isBackward = selectionState.getIsBackward();\n\n // IE doesn't support backward selection. Swap key/offset pairs.\n if (!selection.extend && isBackward) {\n var tempKey = anchorKey;\n var tempOffset = anchorOffset;\n anchorKey = focusKey;\n anchorOffset = focusOffset;\n focusKey = tempKey;\n focusOffset = tempOffset;\n isBackward = false;\n }\n\n var hasAnchor = anchorKey === blockKey && nodeStart <= anchorOffset && nodeEnd >= anchorOffset;\n\n var hasFocus = focusKey === blockKey && nodeStart <= focusOffset && nodeEnd >= focusOffset;\n\n // If the selection is entirely bound within this node, set the selection\n // and be done.\n if (hasAnchor && hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n return;\n }\n\n if (!isBackward) {\n // If the anchor is within this node, set the range start.\n if (hasAnchor) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n }\n\n // If the focus is within this node, we can assume that we have\n // already set the appropriate start range on the selection, and\n // can simply extend the selection.\n if (hasFocus) {\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n }\n } else {\n // If this node has the focus, set the selection range to be a\n // collapsed range beginning here. Later, when we encounter the anchor,\n // we'll use this information to extend the selection.\n if (hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, focusOffset - nodeStart, selectionState);\n }\n\n // If this node has the anchor, we may assume that the correct\n // focus information is already stored on the selection object.\n // We keep track of it, reset the selection range, and extend it\n // back to the focus point.\n if (hasAnchor) {\n var storedFocusNode = selection.focusNode;\n var storedFocusOffset = selection.focusOffset;\n\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, storedFocusNode, storedFocusOffset, selectionState);\n }\n }\n}", "title": "" }, { "docid": "6cb5b765e202fba31f87be113ed56f61", "score": "0.56174296", "text": "function setDraftEditorSelection(selectionState, node, blockKey, nodeStart, nodeEnd) {\n // It's possible that the editor has been removed from the DOM but\n // our selection code doesn't know it yet. Forcing selection in\n // this case may lead to errors, so just bail now.\n var documentObject = getCorrectDocumentFromNode(node);\n\n if (!containsNode(documentObject.documentElement, node)) {\n return;\n }\n\n var selection = documentObject.defaultView.getSelection();\n var anchorKey = selectionState.getAnchorKey();\n var anchorOffset = selectionState.getAnchorOffset();\n var focusKey = selectionState.getFocusKey();\n var focusOffset = selectionState.getFocusOffset();\n var isBackward = selectionState.getIsBackward(); // IE doesn't support backward selection. Swap key/offset pairs.\n\n if (!selection.extend && isBackward) {\n var tempKey = anchorKey;\n var tempOffset = anchorOffset;\n anchorKey = focusKey;\n anchorOffset = focusOffset;\n focusKey = tempKey;\n focusOffset = tempOffset;\n isBackward = false;\n }\n\n var hasAnchor = anchorKey === blockKey && nodeStart <= anchorOffset && nodeEnd >= anchorOffset;\n var hasFocus = focusKey === blockKey && nodeStart <= focusOffset && nodeEnd >= focusOffset; // If the selection is entirely bound within this node, set the selection\n // and be done.\n\n if (hasAnchor && hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n return;\n }\n\n if (!isBackward) {\n // If the anchor is within this node, set the range start.\n if (hasAnchor) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n } // If the focus is within this node, we can assume that we have\n // already set the appropriate start range on the selection, and\n // can simply extend the selection.\n\n\n if (hasFocus) {\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n }\n } else {\n // If this node has the focus, set the selection range to be a\n // collapsed range beginning here. Later, when we encounter the anchor,\n // we'll use this information to extend the selection.\n if (hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, focusOffset - nodeStart, selectionState);\n } // If this node has the anchor, we may assume that the correct\n // focus information is already stored on the selection object.\n // We keep track of it, reset the selection range, and extend it\n // back to the focus point.\n\n\n if (hasAnchor) {\n var storedFocusNode = selection.focusNode;\n var storedFocusOffset = selection.focusOffset;\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, storedFocusNode, storedFocusOffset, selectionState);\n }\n }\n}", "title": "" }, { "docid": "6cb5b765e202fba31f87be113ed56f61", "score": "0.56174296", "text": "function setDraftEditorSelection(selectionState, node, blockKey, nodeStart, nodeEnd) {\n // It's possible that the editor has been removed from the DOM but\n // our selection code doesn't know it yet. Forcing selection in\n // this case may lead to errors, so just bail now.\n var documentObject = getCorrectDocumentFromNode(node);\n\n if (!containsNode(documentObject.documentElement, node)) {\n return;\n }\n\n var selection = documentObject.defaultView.getSelection();\n var anchorKey = selectionState.getAnchorKey();\n var anchorOffset = selectionState.getAnchorOffset();\n var focusKey = selectionState.getFocusKey();\n var focusOffset = selectionState.getFocusOffset();\n var isBackward = selectionState.getIsBackward(); // IE doesn't support backward selection. Swap key/offset pairs.\n\n if (!selection.extend && isBackward) {\n var tempKey = anchorKey;\n var tempOffset = anchorOffset;\n anchorKey = focusKey;\n anchorOffset = focusOffset;\n focusKey = tempKey;\n focusOffset = tempOffset;\n isBackward = false;\n }\n\n var hasAnchor = anchorKey === blockKey && nodeStart <= anchorOffset && nodeEnd >= anchorOffset;\n var hasFocus = focusKey === blockKey && nodeStart <= focusOffset && nodeEnd >= focusOffset; // If the selection is entirely bound within this node, set the selection\n // and be done.\n\n if (hasAnchor && hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n return;\n }\n\n if (!isBackward) {\n // If the anchor is within this node, set the range start.\n if (hasAnchor) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n } // If the focus is within this node, we can assume that we have\n // already set the appropriate start range on the selection, and\n // can simply extend the selection.\n\n\n if (hasFocus) {\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n }\n } else {\n // If this node has the focus, set the selection range to be a\n // collapsed range beginning here. Later, when we encounter the anchor,\n // we'll use this information to extend the selection.\n if (hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, focusOffset - nodeStart, selectionState);\n } // If this node has the anchor, we may assume that the correct\n // focus information is already stored on the selection object.\n // We keep track of it, reset the selection range, and extend it\n // back to the focus point.\n\n\n if (hasAnchor) {\n var storedFocusNode = selection.focusNode;\n var storedFocusOffset = selection.focusOffset;\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, storedFocusNode, storedFocusOffset, selectionState);\n }\n }\n}", "title": "" }, { "docid": "6cb5b765e202fba31f87be113ed56f61", "score": "0.56174296", "text": "function setDraftEditorSelection(selectionState, node, blockKey, nodeStart, nodeEnd) {\n // It's possible that the editor has been removed from the DOM but\n // our selection code doesn't know it yet. Forcing selection in\n // this case may lead to errors, so just bail now.\n var documentObject = getCorrectDocumentFromNode(node);\n\n if (!containsNode(documentObject.documentElement, node)) {\n return;\n }\n\n var selection = documentObject.defaultView.getSelection();\n var anchorKey = selectionState.getAnchorKey();\n var anchorOffset = selectionState.getAnchorOffset();\n var focusKey = selectionState.getFocusKey();\n var focusOffset = selectionState.getFocusOffset();\n var isBackward = selectionState.getIsBackward(); // IE doesn't support backward selection. Swap key/offset pairs.\n\n if (!selection.extend && isBackward) {\n var tempKey = anchorKey;\n var tempOffset = anchorOffset;\n anchorKey = focusKey;\n anchorOffset = focusOffset;\n focusKey = tempKey;\n focusOffset = tempOffset;\n isBackward = false;\n }\n\n var hasAnchor = anchorKey === blockKey && nodeStart <= anchorOffset && nodeEnd >= anchorOffset;\n var hasFocus = focusKey === blockKey && nodeStart <= focusOffset && nodeEnd >= focusOffset; // If the selection is entirely bound within this node, set the selection\n // and be done.\n\n if (hasAnchor && hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n return;\n }\n\n if (!isBackward) {\n // If the anchor is within this node, set the range start.\n if (hasAnchor) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n } // If the focus is within this node, we can assume that we have\n // already set the appropriate start range on the selection, and\n // can simply extend the selection.\n\n\n if (hasFocus) {\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n }\n } else {\n // If this node has the focus, set the selection range to be a\n // collapsed range beginning here. Later, when we encounter the anchor,\n // we'll use this information to extend the selection.\n if (hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, focusOffset - nodeStart, selectionState);\n } // If this node has the anchor, we may assume that the correct\n // focus information is already stored on the selection object.\n // We keep track of it, reset the selection range, and extend it\n // back to the focus point.\n\n\n if (hasAnchor) {\n var storedFocusNode = selection.focusNode;\n var storedFocusOffset = selection.focusOffset;\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, storedFocusNode, storedFocusOffset, selectionState);\n }\n }\n}", "title": "" }, { "docid": "9c511f652569abc1b16d0d3f21af1ff2", "score": "0.56080794", "text": "function focusEditor(e)\n{\n let key = e.which || e.keyCode; //what key was pressed?\n\n if(key === 73) // key = 'i', move focus to the editor\n {\n //let element = getElt('hiddenTextArea'); //editor's div element\n setTimeout(function(){ hiddenTextArea.focus(); }, 0); //Put focus in editor's div element. Timing issues\n focused = true; //mark the editor as focused\n }\n}", "title": "" } ]
45ea6b91afdf83d9cfe5c2600d2e217a
Get Label from external sources
[ { "docid": "206bc78ae9743e43942577f449dc64b0", "score": "0.56015134", "text": "function findLabel(property) {\n return __awaiter(this, void 0, void 0, function () {\n var vocabDoc, vocabLabel, label;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!(property && property.includes('#'))) return [3 /*break*/, 2];\n vocabDoc = getFetchUrl(property.split('#')[0]);\n return [4 /*yield*/, data.from(vocabDoc)[property].label];\n case 1:\n vocabLabel = _a.sent();\n if (vocabLabel && vocabLabel.value) {\n return [2 /*return*/, vocabLabel.value];\n }\n else {\n label = property.split('#')[1];\n return [2 /*return*/, capitalize(label.replace(/[^a-zA-Z ]/g, ' '))];\n }\n _a.label = 2;\n case 2: return [2 /*return*/, 'noLabel'];\n }\n });\n });\n}", "title": "" } ]
[ { "docid": "906a84953fab3a3a8b02f6b11d327b2e", "score": "0.72617996", "text": "get label() {}", "title": "" }, { "docid": "281dfbc34c18076c201b90d55f2d8a4e", "score": "0.6914973", "text": "function getLabel() {\n return label\n }", "title": "" }, { "docid": "a6d0a24cc0f9976d420b13c40e0c1b52", "score": "0.6548041", "text": "getLabel() {\r\n return this.compilerNode.label == null\r\n ? undefined\r\n : this._getNodeFromCompilerNode(this.compilerNode.label);\r\n }", "title": "" }, { "docid": "f65fd62c272c68dda1ffc8e8ab20c832", "score": "0.65479344", "text": "function getLabel(t) {\n if (t['link'] != undefined && t['link']['label'] != undefined) {\n return t['link']['label'];\n }\n if (t['label'] != undefined) {\n return t['label'];\n }\n if (t['url'] != undefined) {\n return chopForStub(t['url']);\n }\n return 'unnamed'\n}", "title": "" }, { "docid": "2aa0db2b309657d2b15679582a0a9371", "score": "0.6537527", "text": "function loadLabels()\n {\n // Get DZ Label\n DZLabel = dymo.label.framework.openLabelXml(getDZLabelXml());\n\n // Get Address Label\n addressLabel = dymo.label.framework.openLabelXml(getAddressLabelXml());\n\n // Get Tap Label\n tapeLabel = dymo.label.framework.openLabelXml(getTapeLabelXml());\n }", "title": "" }, { "docid": "73a91fc9a1d29227eb8851b875a008d5", "score": "0.65115476", "text": "static getStaticText(label) {\n return SuiLyricDialog.dialogElements.find((x) => x.staticText).staticText.find((x) => x[label])[label];\n }", "title": "" }, { "docid": "9cb94924127d039d2aa3b558cb19becc", "score": "0.64067936", "text": "get label() { return this._label }", "title": "" }, { "docid": "c780a985e163b19a0da40f0d2b312ccb", "score": "0.6352396", "text": "function getLabels(cultureName) {\n var currentFileName = \"SubjectComponent\";\n $http.get(\"Academic/Languages/\" + currentFileName + \".\" + cultureName + \".json\").then(function (response) {\n bindLabels(response.data);\n\n });\n }", "title": "" }, { "docid": "cb063afb912f6f1d829c9c2922b14cad", "score": "0.63135767", "text": "getLabelOrThrow() {\r\n return errors.throwIfNullOrUndefined(this.getLabel(), \"Expected to find a label.\");\r\n }", "title": "" }, { "docid": "c4fc3578625323d0dcee4a5ff2b6dbdf", "score": "0.62627196", "text": "extractLabel(config, resolvedParam) {\n const label = typeof config === 'object' ? config.label : config;\n if (typeof label === 'function') {\n return label(resolvedParam);\n }\n return label;\n }", "title": "" }, { "docid": "0f09d6fbd37c4ebce64f9eb8aee1ebf9", "score": "0.62361693", "text": "labelToSrc(label) {\n\t\treturn this.props.src.replace('{}', label.name)\n\t}", "title": "" }, { "docid": "b5dcce8390e8c85de26bc0947f9c2dfc", "score": "0.61942", "text": "function getLabels(cultureName) {\n var currentFileName = \"SubordinateRequest\";\n $http.get(\"LeaveManagement/StaffLeaves/Languages/\" + currentFileName + \".\" + cultureName + \".json\").then(function(response) {\n bindLabels(response.data);\n\n });\n }", "title": "" }, { "docid": "7b0aad85cf8ff09db03389d3e75d50c0", "score": "0.6136337", "text": "function getLabels(cultureName) {\n\n var currentFileName = \"EditCalendar\";\n $http.get(\"CalendarNotifications/Languages/\" + currentFileName + \".\" + cultureName + \".json\").then(function (response) {\n bindLabels(response.data);\n //appLogger.log(\"\" + JSON.stringify(response.data));\n });\n }", "title": "" }, { "docid": "2acffeff8824ff2f3260e90f2fd7cae1", "score": "0.61357653", "text": "function getLabels(cultureName) {\n $http.get('Person/Languages/PersonLivingPlaces.' + cultureName + '.json').then(function (response) {\n bindLabels(response.data);\n\n });\n }", "title": "" }, { "docid": "72da6faa751bc25edce3c81abbdb24bd", "score": "0.6134499", "text": "function getLabel(labelName) {\n try {\n const label = DriveLabels.Labels.get(labelName, {view: \"LABEL_VIEW_FULL\"});\n Logger.log(\"Fetched label with title: '%s' and %d fields.\", label.properties.title, label.fields.length);\n } catch (err) {\n // TODO (developer) - Handle exception\n Logger.log('Failed to get label with error %s', err.message);\n }\n}", "title": "" }, { "docid": "734f4bffaf53d461bbc20c8377478d8c", "score": "0.6125578", "text": "get getLabel() {\n let UTILS = this\n return (obj, noLabel = \"[ unlabeled ]\", options = {}) => {\n if (typeof obj === \"string\") { return obj }\n let label = obj[options.label] || obj.name || obj.label || obj.title\n if (Array.isArray(label)) {\n label = [...new Set(label.map(l => this.getValue(UTILS.getLabel(l))))]\n }\n if (typeof label === \"object\") {\n label = UTILS.getValue(label)\n }\n return label || noLabel\n }\n }", "title": "" }, { "docid": "ce28903e033fa487491de67604efcab8", "score": "0.6124295", "text": "function getLabels(cultureName) {\n var currentFileName = \"TeamRole\";\n $http.get(\"3ilAppBase01/Languages/\" + currentFileName + \".\" + cultureName + \".json\").then(function (response) {\n \n bindLabels(response.data);\n\n });\n }", "title": "" }, { "docid": "5160ddbcfed68bcca6f33a7f2246bc39", "score": "0.61189693", "text": "function printlabel(lebelObj) {\r\n console.log(labelObj.label);\r\n}", "title": "" }, { "docid": "dd5427ad97a7eab7388c508a99ad992b", "score": "0.6114836", "text": "function getLabels(cultureName) {\n\n $http.get(\"Person/Languages/PersonVaccination.\" + cultureName + \".json\").then(function (response) {\n bindLabels(response.data);\n\n });\n }", "title": "" }, { "docid": "d9bc335cf2983296f35afe972f7f1a72", "score": "0.61119246", "text": "function getLabels(cultureName) {\n var currentFileName = \"DesignationList\";\n $http.get(\"3ilAppBase01/Languages/\" + currentFileName + \".\" + cultureName + \".json\").then(function(response) {\n bindLabels(response.data);\n\n });\n }", "title": "" }, { "docid": "a2d13bc0d74fd5c7db85418175c2706c", "score": "0.6093553", "text": "bratLabel() {\n var label = null;\n for (let i = 0; i < this.comments.length; i++) {\n var comment = this.comments[i];\n var m = comment.match(/^(\\#\\s*sentence-label\\b)(.*)/);\n if (!m) {\n continue;\n }\n label = m[2].trim();\n }\n return label;\n }", "title": "" }, { "docid": "a2d13bc0d74fd5c7db85418175c2706c", "score": "0.6093553", "text": "bratLabel() {\n var label = null;\n for (let i = 0; i < this.comments.length; i++) {\n var comment = this.comments[i];\n var m = comment.match(/^(\\#\\s*sentence-label\\b)(.*)/);\n if (!m) {\n continue;\n }\n label = m[2].trim();\n }\n return label;\n }", "title": "" }, { "docid": "1fcf3572a93fdaef76e194557f6843a7", "score": "0.6073869", "text": "function getLabels(cultureName) {\n\n var currentFileName = \"OrganizationList\";\n $http.get(\"Organization/Languages/\" + currentFileName + \".\" + cultureName + \".json\").then(function (response) {\n bindLabels(response.data);\n\n });\n }", "title": "" }, { "docid": "19ffd3ec0fd7e181caada3c53fdd9b49", "score": "0.6063313", "text": "function getLabel(obj) {\n return g().getLabel(obj);\n}", "title": "" }, { "docid": "7c2cfc9587e0e6e297e887fc07248b7a", "score": "0.6027946", "text": "get Label() { return this.label; }", "title": "" }, { "docid": "ea8dbb7ae0131193d09089bd6b2551fd", "score": "0.60232925", "text": "function getLabel(titleLink) {\r\n return titleLink.firstChild.nodeValue;\r\n}", "title": "" }, { "docid": "bf52d7abb31272420d3b933f626b8876", "score": "0.5999376", "text": "function getTranslatedLabel(code) {\n var label = translations.find(itm => itm.code === code)[selectedLanguage];\n if(!label){\n console.log(\"Unknown labelId: \" + labelId);\n label = \"\";\n }\n return label;\n}", "title": "" }, { "docid": "a6245e00c0359d556717a6d5d64f60ca", "score": "0.59619796", "text": "function extractLabels() {\n const labels = [];\n [].slice.call(document.querySelectorAll(\".label-link\"))\n .forEach(function(element) {\n labels.push({\n name: element.textContent.trim(),\n description: element.getAttribute(\"aria-label\"),\n // using style.backgroundColor might returns \"rgb(...)\"\n color: element.getAttribute(\"style\")\n .replace(\"background-color:\", \"\")\n .replace(/color:.*/,\"\")\n .trim()\n // github wants hex code only without # or ;\n .replace(/^#/, \"\")\n .replace(/;$/, \"\")\n .trim(),\n })\n });\n return labels;\n}", "title": "" }, { "docid": "61617b9dc2943f93cac1abd023485c28", "score": "0.5936931", "text": "function getWellKnownLabel(thing) {\n return _solidLogic.store.any(thing, UI.ns.ui('label')) ||\n // Prioritize ui:label\n _solidLogic.store.any(thing, UI.ns.link('message')) || _solidLogic.store.any(thing, UI.ns.vcard('fn')) || _solidLogic.store.any(thing, UI.ns.foaf('name')) || _solidLogic.store.any(thing, UI.ns.dct('title')) || _solidLogic.store.any(thing, UI.ns.dc('title')) || _solidLogic.store.any(thing, UI.ns.rss('title')) || _solidLogic.store.any(thing, UI.ns.contact('fullName')) || _solidLogic.store.any(thing, _solidLogic.store.sym('http://www.w3.org/2001/04/roadmap/org#name')) || _solidLogic.store.any(thing, UI.ns.cal('summary')) || _solidLogic.store.any(thing, UI.ns.foaf('nick')) || _solidLogic.store.any(thing, UI.ns.as('name')) || _solidLogic.store.any(thing, UI.ns.schema('name')) || _solidLogic.store.any(thing, UI.ns.rdfs('label')) || _solidLogic.store.any(thing, _solidLogic.store.sym('http://www.w3.org/2004/02/skos/core#prefLabel'));\n}", "title": "" }, { "docid": "0faa57a7be255022652886ff3d479163", "score": "0.5936818", "text": "function getLabels()\n{\n\tif(!g_json_labels)\n\t{\n\t\tvar strUrl = JSON_API_URL;\n\t\tvar data = { method:\"Utils.getLabels\", language:\"en\"};\n\t\tpostData(strUrl, data, function(json)\n\t\t{\n\t\t\tg_json_labels = json;\n\t\t\t//alert(JSON.stringify(json).substring(0, 2500)); //Limit the string size\n\t\t}, error);\n\t}\n}", "title": "" }, { "docid": "a1456628b81a673374e31ba2e18973a2", "score": "0.5924273", "text": "get componentLabels() {}", "title": "" }, { "docid": "1d5ed41fa08a1162ea9ea3329b312c5e", "score": "0.5922578", "text": "get labelText () {\n let t = \"?\";\n let c = this;\n // one of: null, value, multivalue, subclass, lookup, list, range, loop\n if (this.ctype === \"subclass\"){\n t = \"ISA \" + (this.type || \"?\");\n }\n else if (this.ctype === \"list\" || this.ctype === \"value\") {\n t = this.op + \" \" + this.value;\n }\n else if (this.ctype === \"lookup\") {\n t = this.op + \" \" + this.value;\n if (this.extraValue) t = t + \" IN \" + this.extraValue;\n }\n else if (this.ctype === \"multivalue\" || this.ctype === \"range\") {\n t = this.op + \" \" + this.values;\n }\n else if (this.ctype === \"null\") {\n t = this.op;\n }\n\n return (this.ctype !== \"subclass\" ? \"(\"+this.code+\") \" : \"\") + t;\n }", "title": "" }, { "docid": "df59e39a2d5e4350863fcff48a61624b", "score": "0.58694553", "text": "resolveMdbLabel() {\n\n let label = this.$mdbFormGroup.find(Selector.MDB_LABEL_WILDCARD)\n if (label === undefined || label.length === 0) {\n // we need to find it based on the configured selectors\n label = this.findMdbLabel(this.config.label.required)\n\n if (label === undefined || label.length === 0) {\n // no label found, and finder did not require one\n } else {\n // a candidate label was found, add the configured default class name\n label.addClass(this.config.label.className)\n }\n }\n\n return label\n }", "title": "" }, { "docid": "f0e96ca28800cc860ec324811021c3a9", "score": "0.5865973", "text": "function getlabel(issue) {\r\n issue.labels.forEach(function (label) {\r\n var labelstring =\r\n '<span class=\"ilabel\" style=\"background-color:#' +\r\n label.color +\r\n '\">' +\r\n label.name +\r\n \"</span>\";\r\n finalcontent.innerHTML += labelstring;\r\n });\r\n}", "title": "" }, { "docid": "e464d718b5d89c250aea44427b0d813a", "score": "0.5836557", "text": "get label() {\n\t\treturn this.nativeElement ? this.nativeElement.label : undefined;\n\t}", "title": "" }, { "docid": "fa9f3e20c51eed52b2deff8bb4da1df3", "score": "0.5813651", "text": "get label() {\n\t\treturn this.account ?\n\t\t\t`${this.name}:${this.shortAddress}` :\n\t\t\t`${this.name}:BLANK`\n\t}", "title": "" }, { "docid": "ace0ee8142437c42948f1e434c3ba6d5", "score": "0.58004487", "text": "function printLabel(labeledObject) {\r\n console.log(labeledObject.label);\r\n}", "title": "" }, { "docid": "a21d6c0d44522f78063b289b4703a605", "score": "0.57871497", "text": "function getLabel(properties) {\n var label = \"\";\n if (properties[\"name\"] != undefined) {\n label = properties[\"name\"]\n } else if (properties[\"name.en\"] != undefined) {\n label = properties[\"name.en\"]\n } else {\n label = properties[\"_uid_\"]\n }\n\n var words = label.split(\" \")\n if (words.length > 1) {\n label = words[0] + \"\\n\" + words[1]\n if (words.length > 2) {\n label += \"...\"\n }\n }\n return label\n}", "title": "" }, { "docid": "1edcbfdaeb8c9466f8e2540c738ce658", "score": "0.57549727", "text": "function getElementLabel(elm) {\r\n var prelm;\r\n \r\n elm = getElement(elm); \r\n prelm = elm.previousElementSibling;\r\n \r\n if (prelm.tagName === \"LABEL\" && prelm.htmlFor === elm.id) return prelm.innerHTML;\r\n \r\n return elm.name;\r\n}", "title": "" }, { "docid": "aedd5862b71030555f903cc9a4a231ff", "score": "0.5741994", "text": "function getLabelName(name) {\n if (name.indexOf(\"Load\") != -1) return \"LD\";\n else if (name.indexOf(\"Store\") != -1) return \"ST\";\n else if (name.indexOf(\"Read\") != -1) return \"RD\";\n else if (name.indexOf(\"Write\") != -1) return \"WR\";\n else return (name);\n }", "title": "" }, { "docid": "1e0dc368cce42d4447ba92874d38bbf3", "score": "0.5741838", "text": "async getProjectLabels() {\n this.logger.verbose.info(`Getting labels for project: ${this.options.repo}`);\n const args = {\n owner: this.options.owner,\n repo: this.options.repo,\n };\n try {\n const labels = await this.github.paginate(this.github.issues.listLabelsForRepo, args);\n this.logger.veryVerbose.info('Got response for \"getProjectLabels\":\\n', labels);\n this.logger.verbose.info(\"Found labels on project:\\n\", labels);\n return labels.map((l) => l.name);\n }\n catch (e) {\n throw new GitAPIError(\"getProjectLabels\", args, e);\n }\n }", "title": "" }, { "docid": "67d5a0feabb3f9d17731c5e9eb502533", "score": "0.5725577", "text": "id_to_label(id) {\n for (let i = 0; i < this.labels.dist.length; i++) {\n let le = this.labels.dist[i];\n if (le.id == id) {\n return le.label;\n }\n }\n console.log(\"Should not happen...\");\n return id;\n }", "title": "" }, { "docid": "3a51344639dc435b355a420d72366419", "score": "0.5710993", "text": "function printLabel(labelledObj) {\n console.log(labelledObj.label);\n}", "title": "" }, { "docid": "dda7fa0d316d8793dd02cc5e536ddd7e", "score": "0.5698322", "text": "function defineLabel(){if(!labelOffsets){labelOffsets=[];}var label=nextLabelId;nextLabelId++;labelOffsets[label]=-1;return label;}", "title": "" }, { "docid": "b5c175b4fef64e50a817354159fd110e", "score": "0.56849957", "text": "function getLanguageString(labels, lang) {\n\n if(labels == undefined) {\n return null;\n }\n\n for(var i = 0; i < labels.length; i++) {\n\n if(labels[i].lang == lang) {\n return labels[i].value;\n }\n }\n\n return null;\n }", "title": "" }, { "docid": "bd31dfb2e74d86157c0997cf5ecbde1a", "score": "0.5682746", "text": "_getLabelFromValue(_suggestions, _value) {\n let label = _value;\n if (_suggestions) {\n _suggestions.forEach(s => {\n if (s.value == _value) {\n label = s.label;\n }\n });\n }\n return label;\n }", "title": "" }, { "docid": "2f5c18b7657164319084dc2fdb3748b0", "score": "0.5669054", "text": "_computeDownloadLabel(download){if(download){return\"Download\"}else{return null}}", "title": "" }, { "docid": "6a18ab3523f0151ef9ea3864a101a28b", "score": "0.56683946", "text": "createLabel() {}", "title": "" }, { "docid": "f281cf8f1191d790ae824f4d518b661c", "score": "0.56587964", "text": "function getlabel(d){\n\t\t\treturn label[d.data.key] || d.data.key;\t\t \n\t\t}", "title": "" }, { "docid": "d9a32c77baec56fcc630dade238f31ec", "score": "0.5637186", "text": "function mapLabel(organizations) {\n const labelOrganization = getLabelOrganization(organizations);\n if (labelOrganization) {\n return labelOrganization['names']['en'];\n } else if (organizations.length == 1) {\n // If only one, assume that's the one\n return organizations[0]['names']['en'];\n } else {\n return null;\n }\n}", "title": "" }, { "docid": "9ed63f4d6c97899cbb302384f4cd3d83", "score": "0.56251943", "text": "function getLabel(name) {\n\tname = name.split(\"___\")[0];\n\treturn $(\"[for='\"+name+\"']\").html();\n}", "title": "" }, { "docid": "d50520720a405ab0f952e296833baae5", "score": "0.5623554", "text": "function getLabel(name) {\r\n\tname = name.split(\"___\")[0];\r\n\treturn $(\"[for='\"+name+\"']\").html();\r\n}", "title": "" }, { "docid": "f8eef6c4625a642226c18c2442914c1b", "score": "0.56148344", "text": "_stringLabel() {\n return this.label instanceof MatStepLabel ? null : this.label;\n }", "title": "" }, { "docid": "00a2cc56e16ce33e7dab7ccd0b8dc508", "score": "0.56131554", "text": "function printLabelY(labelledObj) {\n console.log(labelledObj.label);\n}", "title": "" }, { "docid": "3d307a06f39831a9431768b969700a0b", "score": "0.5612224", "text": "function label(labels, onbuild) {\n labels = flattenLabels(labels)\n var instruction = null\n\n if(labels && labels.length) {\n instruction = `LABEL ${labels.map(mapLabel).join(' \\\\\\n ')}`\n } else {\n throw new errors.InstructionError('label', 'Provided object with no OwnProperties.')\n }\n\n return onbuild ? onBuild(instruction) : instruction\n}", "title": "" }, { "docid": "5c0a94029b361bb1debcb931bf96d9d1", "score": "0.56065303", "text": "function evLabelIconURL(e, icon, fr, fill)\n{\n var text = e.devVIN;\n return evTextLabelIconURL(icon, fr, fill, \"\", \"\", text);\n}", "title": "" }, { "docid": "41574d649ada3455403a41b95af3349b", "score": "0.5604848", "text": "async function doLabel() {\n filterAction(tools.arguments.action)\n const labels = tools.arguments._.slice(1)\n tools.log.info('label', labels)\n return checkStatus(\n await tools.github.issues.addLabels(tools.context.issue({labels}))\n )\n}", "title": "" }, { "docid": "b119a2b6d1df1a054fabde2a3ccaa66d", "score": "0.5596367", "text": "function printLabelY(labelledObj) {\r\n console.log(labelledObj.label);\r\n}", "title": "" }, { "docid": "6f3c08ec8a90d7eb275f2baa76b7f0fd", "score": "0.557433", "text": "async function getLabel() {\r\n // Reference to 'img' element on HTTP page\r\n const imgEl = document.getElementById('img');\r\n // Classify the image\r\n const result = await net.classify(imgEl);\r\n console.log(result);\r\n // Percent probability (rounded)\r\n let probability = (result[0].probability * 100).toFixed(2)\r\n // Display the label below the image\r\n document.getElementById('label').innerHTML = `${result[0].className}: ${probability}%`;\r\n}", "title": "" }, { "docid": "b08d0a1846becbc197ffe9f24283970e", "score": "0.5567405", "text": "function delegateLabel(app, s, label) {\n var widget = app.shell.currentWidget;\n var extender = findExtender(widget, s);\n if (!extender) {\n return '';\n }\n return extender[label];\n }", "title": "" }, { "docid": "bdbeb845a273f53bb3ae9283884b4976", "score": "0.5533186", "text": "get() {\r\n return this.sendGet(Label);\r\n }", "title": "" }, { "docid": "5553e5f10431d22d05a24fad5211e696", "score": "0.55184716", "text": "function ApexDataLabels() { }", "title": "" }, { "docid": "44803608ad85babb6dd3a7f4a1ea2dd9", "score": "0.5494223", "text": "function prettyLabel ( plabel ) {\n\n if(plabel == labels[5]) {return \"Single Image\";} // Stand Alone Image\n if(plabel == labels[6]) {return \"Slider Gallery\";} // Slider Gallary\n if(plabel == labels[7]) {return \"Image Preview\";} // Image Preview\n if(plabel == labels[8]) {return \"Image Gallery\";} // Image Gallary Spread\n if(plabel == labels[9]) {return \"Image-Left Text-Right\";} // Image-Left Text-Right \n if(plabel == labels[10]) {return \"Image-Right Text-Left\";} // Image-Right Text-Left\n if(plabel == labels[11]) {return \"Image-Top Text-Bottom\";} // Image-Top Text-Bottom\n if(plabel == labels[12]) {return \"Image Text-Top\";} // Image with text on top\n if(plabel == labels[13]) {return \"People\";} // Image-Right Text-Left\n\n if(plabel == \"!!Not Recognize!! \") {return \"Not Recognized\";} // Unrecognized label (AI returned)\n return plabel; // Return Unchanged Label Otherwise\n}", "title": "" }, { "docid": "52c1ac7d9c1fa912c22cf87975041b64", "score": "0.54826206", "text": "function decodeLabel ( varname, value ) {\n var convert = DB.Variables[varname], trans, pos, output, res = \"\";\n if (convert) {\n trans = $.isArray(convert.Values) ? convert.Values : [ convert.Values ] || convert,\n pos = trans.indexOf(value),\n output = $.isArray(convert.Labels) ? convert.Labels : [ convert.Labels ] || convert;\n res = output[pos] || value;\n }\n return res;\n }", "title": "" }, { "docid": "fbbe4d2fdbde13f4926bdf3da8d1904f", "score": "0.54795265", "text": "function findLabelForElement(el) {\n if (varCheck(el)) {\n var idVal = el.id;\n labels = document.getElementsByTagName('label');\n for (var i = 0; i < labels.length; i++) {\n if (labels[i].htmlFor == idVal)\n return labels[i];\n }\n }\n}", "title": "" }, { "docid": "d8e09d418a78028707a0553a9fcfe721", "score": "0.5476494", "text": "function printPipelineLabel(pipelineIdFilter) {\n var label = pipelines.filter(\n function(p){\n return (p.pipelineId===pipelineIdFilter);\n }\n )[0].label;\n return label;\n }", "title": "" }, { "docid": "332977258e07ef4c879d3784e02f6055", "score": "0.54761267", "text": "function extractLabel(rule) {\n\t if (isLikeRule(rule)) {\n\t rule = registered[idFor(rule)];\n\t }\n\t return rule.label || '{:}';\n\t}", "title": "" }, { "docid": "ac76a829b113560beaa1c5920c070c87", "score": "0.54660934", "text": "function updateLabel() {\n // set the label to be chosen emoji\n this.marker.setLabel(image)\n //return the image var to empty so that next created marker does not have a label from start\n image = \"\";\n\n }", "title": "" }, { "docid": "98049c0bfdb39b6d13e7f124eb1ccd53", "score": "0.546571", "text": "getCreatorLabel (){\n return element(by.id('creator_label')).getText();\n }", "title": "" }, { "docid": "998724a1459af562cdb0d1dc7c365b18", "score": "0.5464396", "text": "get label() {\n return this.component.label;\n }", "title": "" }, { "docid": "91b9f560661e1ac368cc0a6d7338de0c", "score": "0.5462362", "text": "get label() {\n if (this.isObject(this.options)) {\n return this.options.label;\n }\n else {\n return '';\n }\n }", "title": "" }, { "docid": "74b2010073b461235067fa82071ef646", "score": "0.54618126", "text": "function getLabName(lab){\n\tvar command = 'getSystemName'\n\tvar baseUrl = createMainUrl(lab);\n\tvar url = baseUrl + command;\n\tvar name = getFromUrlDirect(url);\n\t// Decode \n\t// Simple string\n\t//var name = loadSingleStringFunction(url);\n\t\n\treturn name;\n}", "title": "" }, { "docid": "02381a0e7d04a9c9395320832205743f", "score": "0.5461244", "text": "getCurrentPageLabel() {\n // @ts-ignore\n const manifest = window.__LAYER0_CACHE_MANIFEST__ || window.__XDN_CACHE_MANIFEST__;\n if (this.options.router) {\n return this.options.router.getPageLabel(location.href);\n }\n else if (manifest) {\n const matchingRoute = manifest.find((entry) => entry.returnsResponse &&\n entry.route &&\n new RegExp(entry.route, 'i').test(location.pathname));\n return matchingRoute === null || matchingRoute === void 0 ? void 0 : matchingRoute.criteriaPath;\n }\n }", "title": "" }, { "docid": "02381a0e7d04a9c9395320832205743f", "score": "0.5461244", "text": "getCurrentPageLabel() {\n // @ts-ignore\n const manifest = window.__LAYER0_CACHE_MANIFEST__ || window.__XDN_CACHE_MANIFEST__;\n if (this.options.router) {\n return this.options.router.getPageLabel(location.href);\n }\n else if (manifest) {\n const matchingRoute = manifest.find((entry) => entry.returnsResponse &&\n entry.route &&\n new RegExp(entry.route, 'i').test(location.pathname));\n return matchingRoute === null || matchingRoute === void 0 ? void 0 : matchingRoute.criteriaPath;\n }\n }", "title": "" }, { "docid": "bd61315d509862e53a86c76152f656fc", "score": "0.5458248", "text": "static getLabels (datasets) {\n // get all line labels\n const lines = Object.keys(datasets);\n\n if (lines.length == 0) {\n return [];\n }\n\n // get any line from the dataset\n const anyLine = lines[0];\n\n // get any dataset\n const anyDataset = datasets[anyLine];\n const anyData = anyDataset.data;\n const dataLength = anyData.length;\n\n const labels = [];\n for (let i = 0; i < dataLength; ++i) {\n labels.push(i);\n }\n\n return labels;\n }", "title": "" }, { "docid": "cf1837b1865050b4ded698d257d0458f", "score": "0.5456595", "text": "function find_name(id) {\n\tfor (var i in $.verto.audioOutDevices) {\n\t var source = $.verto.audioOutDevices[i];\n\t if (source.id === id) {\n\t\treturn(source.label);\n\t }\n\t}\n\n\treturn id;\n }", "title": "" }, { "docid": "3f53da62b61d4ecb7a1656d9212aa1bd", "score": "0.54418045", "text": "get label() {\n return this.f;\n }", "title": "" }, { "docid": "9c0cd4a0b2b406d1bd43dba3acffe4a5", "score": "0.54380435", "text": "set label(value) {}", "title": "" }, { "docid": "6ac841a701aad2d13cb999e25b5a33a4", "score": "0.5435634", "text": "function extractLabels(base, labelname, i){\n var items = [];\n for (let j = 1; j <= i; j++){\n let rawdata = fs.readFileSync(base+j+'.json');\n var des = JSON.parse(rawdata);\n if (des[\"items\"][0][labelname] == undefined){\n continue;\n }\n var label = des[\"items\"][0][labelname][\"value\"];\n items.push(label);\n }\n //console.log('items: ' + items);\n return items;\n}", "title": "" }, { "docid": "87d106a1dc35d78a025832b20d5bc25b", "score": "0.5423193", "text": "function getLabel(d) {\n\tif (d.type==='researcher')\n\t return \"R\";\n if (d.type==='grant') \n return \"G\";\n if (d.type==='publication')\n return \"P\";\n if (d.type==='dataset')\n return \"D\";\n if (d.type==='institution')\n \t return \"I\";\n\treturn '';\t\n }", "title": "" }, { "docid": "3c23e665aa913cd1820393fb59dc16ee", "score": "0.5395432", "text": "get label(){\n return this.value || this.get('defaultLabel', 'unset')\n }", "title": "" }, { "docid": "b2cf22471949c239849e972a0801bf6b", "score": "0.53744584", "text": "label() {\n // The entity label.\n let label = '';\n const entityLabel = this.model.get('label');\n\n // Label of an active field, if it exists.\n const activeField = Drupal.quickedit.app.model.get('activeField');\n const activeFieldLabel =\n activeField && activeField.get('metadata').label;\n // Label of a highlighted field, if it exists.\n const highlightedField =\n Drupal.quickedit.app.model.get('highlightedField');\n const highlightedFieldLabel =\n highlightedField && highlightedField.get('metadata').label;\n // The label is constructed in a priority order.\n if (activeFieldLabel) {\n label = Drupal.theme('quickeditEntityToolbarLabel', {\n entityLabel,\n fieldLabel: activeFieldLabel,\n });\n } else if (highlightedFieldLabel) {\n label = Drupal.theme('quickeditEntityToolbarLabel', {\n entityLabel,\n fieldLabel: highlightedFieldLabel,\n });\n } else {\n // @todo Add XSS regression test coverage in https://www.drupal.org/node/2547437\n label = Drupal.checkPlain(entityLabel);\n }\n\n this.$el.find('.quickedit-toolbar-label').html(label);\n }", "title": "" }, { "docid": "af2cdedbfa7fc39747fdf562426b53a8", "score": "0.53698057", "text": "function refresh_labels_in_play_bot_from() {\n var $select = $('#play_bot_from');\n looper(PLAY_BOT_FROM_STUFF, function (_, stuff) {\n var $option = $select.find('[value=' + $.escapeSelector(stuff.option_value) + ']');\n var cat = lex.cats.by_name[stuff.option_value];\n var num_cont = cat.num_conts;\n var formatted_label = f(stuff.label, {number: num_cont});\n // console.debug(stuff.option_value, formatted_label, cat_idn, num_cont);\n // EXAMPLE: my from my playlist (76) 735 76\n $option.text(formatted_label);\n });\n }", "title": "" }, { "docid": "37adb92680180133f8de8e80bd6c7aa3", "score": "0.5369296", "text": "buildLabelElement() {\n return html.makeLabelElement(this.propertySpec.displayedLabel + ':');\n }", "title": "" }, { "docid": "22cba8767d952c8261dd043ffce47236", "score": "0.5366398", "text": "static getNameLabel( txtProv )\r\n {\r\n\t\tvar name = '';\r\n var spans = txtProv.getElementsByTagName(\"tspan\");\r\n\t\tif( spans.length > 0){\r\n\t\t\tfor (var i = 0; i < spans.length; i++) {\r\n\t\t\t\tname+= spans[i].innerHTML;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tname = txtProv.innerHTML;\r\n\t\t}\r\n return MapaSvg.codProv(name) ;\r\n\t }", "title": "" }, { "docid": "fa7c9c77f7d292c86d1f6b2fa68c7f6b", "score": "0.5360061", "text": "function findCircleLabel(label){\n\tfor (var i = 0; i < circles.length; i++){\n\t\tif (label == circles[i].label){\n\t\t\treturn circles[i];\n\t\t}\n\t}\n\treturn null;\n}", "title": "" }, { "docid": "00ef56d5c090c9d808c3d0a35b145ec1", "score": "0.5354971", "text": "_label(item, index) { return item.name; }", "title": "" }, { "docid": "3b2d375b19aad51ebca0f7f5a3350692", "score": "0.5353982", "text": "function setLabel(props){\n //label content\n var labelAttribute = \"<h1>\" + props[expressed] + \"k\" +\n \"</h1><b>\" + expressed +\"</b>\" ;\n\n //create info label div\n var infolabel = d3.select(\"body\")\n .append(\"div\")\n .attr(\"class\", \"infolabel\")\n .attr(\"id\", props.Label + \"_label\")\n .html(labelAttribute);\n\n var regionName = infolabel.append(\"div\")\n .attr(\"class\", \"labelname\")\n .html(props.Label);\n }", "title": "" }, { "docid": "6a889b254c7d81bc38842ea8a87d9b7c", "score": "0.5342913", "text": "get systemLabels() {\n return getPSALabels(this);\n }", "title": "" }, { "docid": "5abf662b7f052485978ced4fc725ba1e", "score": "0.533889", "text": "getLabelId() {\n return this._hasFloatingLabel() ? this._labelId : null;\n }", "title": "" }, { "docid": "5abf662b7f052485978ced4fc725ba1e", "score": "0.533889", "text": "getLabelId() {\n return this._hasFloatingLabel() ? this._labelId : null;\n }", "title": "" }, { "docid": "5abf662b7f052485978ced4fc725ba1e", "score": "0.533889", "text": "getLabelId() {\n return this._hasFloatingLabel() ? this._labelId : null;\n }", "title": "" }, { "docid": "5abf662b7f052485978ced4fc725ba1e", "score": "0.533889", "text": "getLabelId() {\n return this._hasFloatingLabel() ? this._labelId : null;\n }", "title": "" }, { "docid": "5abf662b7f052485978ced4fc725ba1e", "score": "0.533889", "text": "getLabelId() {\n return this._hasFloatingLabel() ? this._labelId : null;\n }", "title": "" }, { "docid": "5abf662b7f052485978ced4fc725ba1e", "score": "0.533889", "text": "getLabelId() {\n return this._hasFloatingLabel() ? this._labelId : null;\n }", "title": "" }, { "docid": "f06fd2924f9922ef351855ac01c01010", "score": "0.53347427", "text": "function label(options = {}) {\n logger.deprecated('label', 'The label module has been replaced by the badge module');\n const { context } = options;\n return palette.context(span('hx-label'), context);\n}", "title": "" }, { "docid": "8216083c75f495cf11cbe0df55f79d34", "score": "0.53304625", "text": "getIntroOfPage(label) {\n return label\n }", "title": "" }, { "docid": "41e8c499f51b233dcad4cb06467b14a7", "score": "0.5322481", "text": "function _class_labeler(ce){\n\tvar ret = ce.class_label();\n\t// Optional ID.\n\tvar cid = ce.class_id();\n\tif( cid && cid !== ret ){\n\t ret = '[' + cid + '] ' + ret;\n\t}\n\treturn ret;\n }", "title": "" }, { "docid": "54843c86370233685ce380e862ca35bf", "score": "0.53147143", "text": "async getLabels(prNumber) {\n this.logger.verbose.info(`Getting labels for PR: ${prNumber}`);\n const args = {\n owner: this.options.owner,\n repo: this.options.repo,\n issue_number: prNumber,\n };\n this.logger.verbose.info(\"Getting issue labels using:\", args);\n try {\n const labels = await this.github.issues.listLabelsOnIssue(args);\n this.logger.veryVerbose.info('Got response for \"listLabelsOnIssue\":\\n', labels);\n this.logger.verbose.info(\"Found labels on PR:\\n\", labels.data);\n return labels.data.map((l) => l.name);\n }\n catch (e) {\n throw new GitAPIError(\"listLabelsOnIssue\", args, e);\n }\n }", "title": "" }, { "docid": "3baa6362def2037c1241e8a785f91cac", "score": "0.53068304", "text": "function setLabel(props){\n //label content\n var labelAttribute = \"<h1>\" + props[expressed] +\n \"</h1><b>\" + expressed + \"</b>\";\n \n //create info label div\n var infolabel = d3.select(\"body\")\n .append(\"div\")\n .attr(\"class\", \"infolabel\")\n .attr(\"id\", props.adm1_code + \"_label\")\n .html(labelAttribute);\n \n var regionName = infolabel.append(\"div\")\n .attr(\"class\", \"labelname\")\n .html(props.name);\n }", "title": "" } ]
771d88360b4ad54d348537a20a13600f
very similar to select, in fact it expands out to select, but it's here as a legacy function
[ { "docid": "37e091911444cb6f361cb45518c731e4", "score": "0.0", "text": "function turn(item, turnOn, thenDoThis) {\r\n if (turnOn) {\r\n select(item, thenDoThis)\r\n } else {\r\n deselect(item, thenDoThis)\r\n }\r\n}", "title": "" } ]
[ { "docid": "35ee604989f8191642c7b274fe71aaf9", "score": "0.6537773", "text": "select(key) {}", "title": "" }, { "docid": "a31c56cd7a838169c5481d7130d5c5f5", "score": "0.6263596", "text": "function select() {\n return {};\n}", "title": "" }, { "docid": "6a20a881c9d99c53f56afc89a54ac8a0", "score": "0.61924165", "text": "function dom_select(where, what) { return select(basic_dom_selectors, where, what); }", "title": "" }, { "docid": "04582a234d9b33917d618e4fec0aef01", "score": "0.6148818", "text": "select(cells){}", "title": "" }, { "docid": "98551fc564a8c54c07202cdd749d14e8", "score": "0.5948133", "text": "select(projection){\n //aliasing out generator\n const wrappedGenerator = this[_generator];\n //instatiating new enumerable\n return new Enumerable(function*() {\n for(let item of wrappedGenerator()) {\n yield projection(item); \n } \n }); \n }", "title": "" }, { "docid": "59668251f246a313fc13b8b41ba6497c", "score": "0.5917578", "text": "function select(selection){\n document.querySelector(selection);\n}", "title": "" }, { "docid": "8d8db2acd0a9b0eaa6f7670ba7ebf830", "score": "0.58789253", "text": "function Select (id) {\r\n Id (id).select ();\r\n}", "title": "" }, { "docid": "202442910d8a49fd0c9f017593c70851", "score": "0.5872289", "text": "function _f_select(){\n\tif( !!this.obj.select ) this.obj.select();\n}", "title": "" }, { "docid": "d0eba659da4084f478c26eb64026035e", "score": "0.57539076", "text": "function select(params) {\n var fields = params && params.query && params.query.$select;\n\n for (var _len = arguments.length, otherFields = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n otherFields[_key - 1] = arguments[_key];\n }\n\n if (Array.isArray(fields) && otherFields.length) {\n fields.push.apply(fields, otherFields);\n }\n\n var convert = function convert(result) {\n var _commons_1$_;\n\n if (!Array.isArray(fields)) {\n return result;\n }\n\n return (_commons_1$_ = commons_1._).pick.apply(_commons_1$_, [result].concat(_toConsumableArray(fields)));\n };\n\n return function (result) {\n if (Array.isArray(result)) {\n return result.map(convert);\n }\n\n return convert(result);\n };\n}", "title": "" }, { "docid": "0f5218e0b600ed6c758731da76c58c59", "score": "0.57380617", "text": "function dynamic_data_select(where, what) { return select(dynamic_data_selectors, where, what); }", "title": "" }, { "docid": "0b6f8479a37f325b67cefa24ae3b567c", "score": "0.5683246", "text": "function selection_select(select) {\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}", "title": "" }, { "docid": "36046148f8f7e3510a2f76029b065862", "score": "0.5603241", "text": "static select(index, array) {\n if (!token_1.Token.isUnresolved(index) && !token_1.Token.isUnresolved(array) && !array.some(token_1.Token.isUnresolved)) {\n return array[index];\n }\n return new FnSelect(index, array).toString();\n }", "title": "" }, { "docid": "b3ac540a312e38657b75cafa4b1d684f", "score": "0.5599327", "text": "function Selector() {}", "title": "" }, { "docid": "06d4e4e65c2b5ec25c4a3bd325237a2c", "score": "0.55960137", "text": "function select(fn, list) {\n _assert(isFunction(fn) && isList(list),\n \"select expects a function and a list\");\n var result = [], i, l;\n for (i = 0, l = list.length; i < l; ++i) {\n if (fn(list[i])) {\n result.push(list[i]);\n }\n }\n return result;\n }", "title": "" }, { "docid": "50260dc81f8995eea281b006aa243884", "score": "0.55526155", "text": "function select(selector) {\n return document.querySelector(selector);\n}", "title": "" }, { "docid": "614e083423eb661fc59603c74f537e7b", "score": "0.55493534", "text": "selectWrapCallback($selectEl) {}", "title": "" }, { "docid": "38727bc40ad960b3b86bfc71db29e7f1", "score": "0.55418664", "text": "select(func) {\n return this.notes.filter(func);\n }", "title": "" }, { "docid": "62b2acccef1a6d88ded4756e336f0b9c", "score": "0.54795945", "text": "function src_select(selector) {\n return typeof selector === \"string\"\n ? new Selection([[document.querySelector(selector)]], [document.documentElement])\n : new Selection([[selector]], root);\n}", "title": "" }, { "docid": "da81bb9d88ce816904543e52023bf772", "score": "0.5468129", "text": "select(selector) {\n return super.select(selector);\n }", "title": "" }, { "docid": "953678d1352f4695197350695a187915", "score": "0.5448867", "text": "mapSelect(fn) {\n if (!this.select) return this;\n return new QSelect(this.select.map(el => fn(el)) , this.from, this.where, this.group, this.having, this.order, this.limit, this.opts);\n }", "title": "" }, { "docid": "722083361a14c18443330365026a29c0", "score": "0.54461557", "text": "find(arg){\n let selected = [];\n for (let i = 0; i < this.array.length; i++) {\n // let node = this.array[i]\n selected = selected.concat(Array.from(this.array[i].querySelectorAll(arg)));\n }\n // const collect = Array.from(selected);\n return new DOMNodeCollection(selected);\n }", "title": "" }, { "docid": "e4c5c43454d37b4733d11ea8ac5ea99f", "score": "0.5442835", "text": "function select_select(object, selector) {\n if (typeof_default()(this) === 'object' && this.isSeemple) {\n // when context is Seemple instance, use this as an object and shift other args\n\n /* eslint-disable no-param-reassign */\n selector = object;\n object = this;\n /* eslint-enable no-param-reassign */\n } else {\n // throw error when object type is wrong\n Object(checkobjecttype[\"a\" /* default */])(object, 'select');\n } // the selector includes \"custom\" things like :sandbox or :bound(KEY)\n\n\n if (customSelectorTestReg.test(selector)) {\n return Object(_selectnodes[\"a\" /* default */])(object, selector)[0] || null;\n }\n\n var def = defs[\"a\" /* default */].get(object);\n\n if (!def || typeof selector !== 'string') {\n return null;\n }\n\n var propDef = def.props.sandbox;\n\n if (!propDef) {\n return null;\n }\n\n var bindings = propDef.bindings;\n\n if (bindings) {\n // iterate over all bound nodes trying to find a descendant matched given selector\n for (var i = 0; i < bindings.length; i++) {\n var node = bindings[i].node;\n var selected = node.querySelector(selector);\n\n if (selected) {\n return selected;\n }\n }\n }\n\n return null;\n}", "title": "" }, { "docid": "3156c186838658016f0c40e8763bbbcf", "score": "0.5357172", "text": "function select() {\n throw new Error('Method \"Prototype.Selector.select\" must be defined.');\n }", "title": "" }, { "docid": "b65eaf90509104604f58e8cb2cbb12f6", "score": "0.5342816", "text": "function select(array, callback){\n let newArray = array.filter(callback); \n return newArray;\n }", "title": "" }, { "docid": "d1b40c747f873a5f830597273ef2e2b3", "score": "0.532859", "text": "function select(selector, el) {\n return (el || document).querySelectorAll(selector);\n }", "title": "" }, { "docid": "46c8cae6442a6dc63ab9bd46b634c4bc", "score": "0.53190863", "text": "function select(element) {\n function _attr () {\n return element[element.selectedIndex].value;\n }\n function _set(val) {\n for(var i=0; i < element.options.length; i++) {\n if(element.options[i].value == val) element.selectedIndex = i;\n }\n }\n return function (val) {\n return (\n isGet(val) ? element.options[element.selectedIndex].value\n : isSet(val) ? _set(val)\n : listen(element, 'change', _attr, val)\n )}\n}", "title": "" }, { "docid": "fe175971e479d09f7c9fc57c4497905c", "score": "0.52840596", "text": "function selectElement() {\n this.select();\n}", "title": "" }, { "docid": "c9b1012ac5c60995eedf2c5bc9a7c9c8", "score": "0.5209275", "text": "function selector(a,b){var a=a.match(/^(\\W)?(.*)/),b=b||document,c=b[\"getElement\"+(a[1]?\"#\"==a[1]?\"ById\":\"sByClassName\":\"sByTagName\")],d=c.call(b,a[2]),e=[];return null!==d&&(e=d.length||0===d.length?d:[d]),e}", "title": "" }, { "docid": "c9b1012ac5c60995eedf2c5bc9a7c9c8", "score": "0.5209275", "text": "function selector(a,b){var a=a.match(/^(\\W)?(.*)/),b=b||document,c=b[\"getElement\"+(a[1]?\"#\"==a[1]?\"ById\":\"sByClassName\":\"sByTagName\")],d=c.call(b,a[2]),e=[];return null!==d&&(e=d.length||0===d.length?d:[d]),e}", "title": "" }, { "docid": "6343634dcb4a6b368505d7d1c244f42b", "score": "0.52040553", "text": "selectObject(type) {}", "title": "" }, { "docid": "fc34fb3203a8b506ef146151b63be58d", "score": "0.51892006", "text": "function selectElement(el) {\n return document.querySelector(el);\n}", "title": "" }, { "docid": "91326290c842d6feffa65a74c98bedcc", "score": "0.51734895", "text": "function fixSelection(dom, fn) {\n var validType = SELECTABLE_TYPES.test(dom.type),\n selection = {\n start: validType ? dom.selectionStart : 0,\n end: validType ? dom.selectionEnd : 0\n };\n if (validType && isFunction(fn)) fn(dom);\n return selection;\n }", "title": "" }, { "docid": "5799ecfea07700a5da57cdc9ac79fbba", "score": "0.5171703", "text": "function basic_data_select(where, what) { return select(basic_data_selectors, where, \"[data-x='\" + what + \"']\") }", "title": "" }, { "docid": "306dd386767524c1791565226f620a23", "score": "0.515852", "text": "function select_text(id){\r\n $('#' + id).select();\r\n}", "title": "" }, { "docid": "482b8bbd7174f7faffc4b5b661c4c8ac", "score": "0.51419634", "text": "function select(element) {\n if (document.querySelector(element) !== null) {\n return document.querySelector(element);\n } else {\n console.error('select(element): ' + element + ' is not found!');\n return null;\n }\n}", "title": "" }, { "docid": "36c4b3a01bab88c6debb8c5fae9c2707", "score": "0.51191664", "text": "function ruleSelect1(node) {\n //console.log(\"ruleSelect1\");\n for (var c=0; c<node.children.length; c++) {\n var child = node.children[c];\n if (child instanceof Operators.Select) {\n if (child.evalTree == null) {\n node.children[0] = child.children[0];\n }\n }\n }\n}", "title": "" }, { "docid": "cf34ff91f2ef7f985a2e95223b1d88df", "score": "0.5118575", "text": "function get_selection(control, findall, want_values, anyval) {\r\n var ret = new Array();\r\n\r\n if ((!findall) && (control.selectedIndex == -1))\r\n return ret;\r\n\r\n for (var i = (anyval != null ? 1 : 0); i < control.length; i++)\r\n if (findall || control.options[i].selected)\r\n ret[ret.length] = want_values ? control.options[i].value : i;\r\n\r\n return ret;\r\n}", "title": "" }, { "docid": "0ff0b8090e662c7def5609819253a1cd", "score": "0.51184493", "text": "function $$1(selector, context) {\n var arr = [];\n var i = 0;\n if (selector && !context) {\n if (selector instanceof Dom7) {\n return selector;\n }\n }\n if (selector) {\n // String\n if (typeof selector === 'string') {\n var els = void 0;\n var tempParent = void 0;\n var _html = selector.trim();\n if (_html.indexOf('<') >= 0 && _html.indexOf('>') >= 0) {\n var toCreate = 'div';\n if (_html.indexOf('<li') === 0) toCreate = 'ul';\n if (_html.indexOf('<tr') === 0) toCreate = 'tbody';\n if (_html.indexOf('<td') === 0 || _html.indexOf('<th') === 0) toCreate = 'tr';\n if (_html.indexOf('<tbody') === 0) toCreate = 'table';\n if (_html.indexOf('<option') === 0) toCreate = 'select';\n tempParent = _ssrWindow.document.createElement(toCreate);\n tempParent.innerHTML = _html;\n for (i = 0; i < tempParent.childNodes.length; i += 1) {\n arr.push(tempParent.childNodes[i]);\n }\n } else {\n if (!context && selector[0] === '#' && !selector.match(/[ .<>:~]/)) {\n // Pure ID selector\n els = [_ssrWindow.document.getElementById(selector.trim().split('#')[1])];\n } else {\n // Other selectors\n els = (context || _ssrWindow.document).querySelectorAll(selector.trim());\n }\n for (i = 0; i < els.length; i += 1) {\n if (els[i]) arr.push(els[i]);\n }\n }\n } else if (selector.nodeType || selector === _ssrWindow.window || selector === _ssrWindow.document) {\n // Node/element\n arr.push(selector);\n } else if (selector.length > 0 && selector[0].nodeType) {\n // Array of elements or instance of Dom\n for (i = 0; i < selector.length; i += 1) {\n arr.push(selector[i]);\n }\n }\n }\n return new Dom7(arr);\n}", "title": "" }, { "docid": "35ae793ea769904de7546faf3a5a6bd4", "score": "0.5111238", "text": "function select() {\n selectTask(requireCursor());\n }", "title": "" }, { "docid": "ec16cbb56dedbca5604b9b2158fdf4f4", "score": "0.510752", "text": "function selected_elements(select) {\n var hasSelection = true;\n var i;\n var selected_items = new Array();\n for (i = 0; i < select.options.length; i += 1) {\n if (select.options[i].selected) {\n selected_items.push(select.options[i].text);\n hasSelection = false;\n }\n }\n return [hasSelection,selected_items];\n}", "title": "" }, { "docid": "0c2707f8b8b71cc04f6e4443a59254f6", "score": "0.5100339", "text": "function query(ast, selector) {\n return match(ast, parse(selector));\n }", "title": "" }, { "docid": "fb3265392e40e65085b06c890fb05647", "score": "0.50995374", "text": "function query(ast, selector) {\n return match(ast, parse(selector));\n }", "title": "" }, { "docid": "6f3cf8ae4ea89b028fb15480cda5b2dd", "score": "0.508928", "text": "function compile(selector, options, context) {\n\t var next = compileUnsafe(selector, options, context);\n\t return subselects.ensureIsTag(next, options.adapter);\n\t}", "title": "" }, { "docid": "0933a26337225445c4b33fb610366112", "score": "0.5070749", "text": "function compile(selector, options, context) {\n var next = compileUnsafe(selector, options, context);\n return subselects_1.ensureIsTag(next, options.adapter);\n}", "title": "" }, { "docid": "0933a26337225445c4b33fb610366112", "score": "0.5070749", "text": "function compile(selector, options, context) {\n var next = compileUnsafe(selector, options, context);\n return subselects_1.ensureIsTag(next, options.adapter);\n}", "title": "" }, { "docid": "d1b7147d9a4985f4351ddbd67df99aba", "score": "0.5064394", "text": "function select(selector) {\n if (!selector) {\n return this;\n }\n\n var elements = new S();\n elements.context = (this && this.context) ? this.context : doc;\n elements.selector = selector;\n elements.length = 0;\n\n if (selector.nodeType) {\n elements.context = elements[0] = selector;\n elements.length = 1;\n return elements;\n }\n\n var match = _parseSelector.exec(selector),\n i = 0, l = 0, items = null;\n if (match) {\n if (this.length === 1) {\n elements.context = this[0];\n }\n if (match[1]) {\n elements[0] = doc.getElementById(match[1]);\n elements.length = elements[0] ? 1 : 0;\n } else if (match[2]) {\n if (elements.context === doc) {\n items = doc.getElementsByTagName(match[2]);\n } else {\n items = elements.context.querySelectorAll(match[0]);\n }\n for (i = 0, l = items.length; i < l; i++) {\n elements[i] = items.item(i);\n }\n elements.length = l;\n } else {\n if (elements.context === doc) {\n items = doc.getElementsByClassName(match[3]);\n } else {\n items = elements.context.querySelectorAll(match[0]);\n }\n for (i = 0, l = items.length; i < l; i++) {\n elements[i] = items.item(i);\n }\n elements.length = l;\n }\n }\n return elements;\n }", "title": "" }, { "docid": "eaf263dcbfdb7200391e1bbce1e5d88a", "score": "0.5059437", "text": "function selector(a){\n a=a.match(/^(\\W)?(.*)/);var b=document[\"getElement\"+(a[1]?a[1]==\"#\"?\"ById\":\"sByClassName\":\"sByTagName\")](a[2]);\n var ret=[]; b!=null&&(b.length?ret=b:b.length==0?ret=b:ret=[b]); return ret;\n}", "title": "" }, { "docid": "30101c2ce66e205feaef41682ce8da72", "score": "0.5041931", "text": "function QuerySelector(selector) {\n return querySelectorFunc.bind(this, selector);\n}", "title": "" }, { "docid": "f7166ccbeb096711329a5a4511005f1b", "score": "0.503734", "text": "function parseSelection(parser) { // 289\n\t return peek(parser, _lexer.TokenKind.SPREAD) ? parseFragment(parser) : parseField(parser); // 290\n\t} // 291", "title": "" }, { "docid": "c8ca768de542c9162f858fc02ae500ef", "score": "0.5026248", "text": "selectEach(callback, whereOrFilter, params) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.queryModel.selectEach(this.sqldb, callback, this.toFilter(whereOrFilter, query_1.TABLEALIAS), params);\n });\n }", "title": "" }, { "docid": "1ac0a6aff87a018d53c130bde502df87", "score": "0.50227267", "text": "function selectElementContents(el) {\n var range = document.createRange();\n range.selectNodeContents(el);\n var sel = window.getSelection();\n sel.removeAllRanges();\n sel.addRange(range);\n}", "title": "" }, { "docid": "1703909bfd6c55282024ade32c5ab10b", "score": "0.50185645", "text": "_addSelectable(cssSelector,callbackCtxt,listContext){let matcher=this;const element=cssSelector.element;const classNames=cssSelector.classNames;const attrs=cssSelector.attrs;const selectable=new SelectorContext(cssSelector,callbackCtxt,listContext);if(element){const isTerminal=attrs.length===0&&classNames.length===0;if(isTerminal){this._addTerminal(matcher._elementMap,element,selectable);}else{matcher=this._addPartial(matcher._elementPartialMap,element);}}if(classNames){for(let i=0;i<classNames.length;i++){const isTerminal=attrs.length===0&&i===classNames.length-1;const className=classNames[i];if(isTerminal){this._addTerminal(matcher._classMap,className,selectable);}else{matcher=this._addPartial(matcher._classPartialMap,className);}}}if(attrs){for(let i=0;i<attrs.length;i+=2){const isTerminal=i===attrs.length-2;const name=attrs[i];const value=attrs[i+1];if(isTerminal){const terminalMap=matcher._attrValueMap;let terminalValuesMap=terminalMap.get(name);if(!terminalValuesMap){terminalValuesMap=new Map();terminalMap.set(name,terminalValuesMap);}this._addTerminal(terminalValuesMap,value,selectable);}else{const partialMap=matcher._attrValuePartialMap;let partialValuesMap=partialMap.get(name);if(!partialValuesMap){partialValuesMap=new Map();partialMap.set(name,partialValuesMap);}matcher=this._addPartial(partialValuesMap,value);}}}}", "title": "" }, { "docid": "140c8cdf7b19f7cb1500a988ebd379cf", "score": "0.49846718", "text": "function selector(a){\n\ta=a.match(/^(\\W)?(.*)/);var b=document[\"getElement\"+(a[1]?a[1]==\"#\"?\"ById\":\"sByClassName\":\"sByTagName\")](a[2]);\n\tvar ret=[];\tb!=null&&(b.length?ret=b:b.length==0?ret=b:ret=[b]);\treturn ret;\n}", "title": "" }, { "docid": "bdc93eaa1adf46f30f3987dd08e39d3d", "score": "0.49842948", "text": "function selectElementContents(el) {\n if (window.getSelection && document.createRange) {\n var sel = window.getSelection();\n var range = document.createRange();\n range.selectNodeContents(el);\n sel.removeAllRanges();\n sel.addRange(range);\n } else if (document.selection && document.body.createTextRange) {\n var textRange = document.body.createTextRange();\n textRange.moveToElementText(el);\n textRange.select();\n }\n}", "title": "" }, { "docid": "bb488603fe88067019f596569934feec", "score": "0.4972681", "text": "function query(ast, selector) {\n return match(ast, parse(selector));\n }", "title": "" }, { "docid": "bb488603fe88067019f596569934feec", "score": "0.4972681", "text": "function query(ast, selector) {\n return match(ast, parse(selector));\n }", "title": "" }, { "docid": "2e7c7ff1f23f534271c589cc33a46e3b", "score": "0.4972586", "text": "function collectSelections(id) {\n var i;\n var selections = [];\n var children = document.getElementById(id).children;\n var chillen = children.length;\n var child;\n for (i=0; i<chillen; i++){\n child = children[i];\n if (child.tagName === \"SELECT\"){\n selections.push(child.value);\n }\n }\n return selections;\n}", "title": "" }, { "docid": "d28d61aa0731a0007b3d123b2defc599", "score": "0.49526256", "text": "select_values() {\n let s = [\n {\n 'value': 1,\n 'name': 'liliana'\n },\n {\n 'value': 2,\n 'name': 'two'\n }, {\n 'value': 3,\n 'name': 'three'\n }, {\n 'value': 4,\n 'name': 'four'\n }, {\n 'value': 5,\n 'name': 'five'\n }, {\n 'value': 6,\n 'name': 'six'\n }, {\n 'value': 7,\n 'name': 'seven'\n }, {\n 'value': 8,\n 'name': 'eight'\n }, {\n 'value': 9,\n 'name': 'nine'\n },\n ]\n return s;\n }", "title": "" }, { "docid": "fcebf03282eb908a77c05c735f13b694", "score": "0.49504504", "text": "function somethingSelected() {\n return nSel();\n }", "title": "" }, { "docid": "1f42e11c0a557cbeffd88256a9be61f3", "score": "0.49448758", "text": "function Convert_Pairs__select(selector, options) {\r\n\t\tif (typeof selector !== 'function') {\r\n\t\t\tvar target = selector || options && options.target;\r\n\t\t\tif (!target)\r\n\t\t\t\treturn;\r\n\r\n\t\t\tlibrary_namespace.debug('target: ' + target + ', options: '\r\n\t\t\t\t\t+ options, 3);\r\n\t\t\tif (options === true) {\r\n\t\t\t\treturn this.get_value(target);\r\n\t\t\t}\r\n\r\n\t\t\tif (library_namespace.is_RegExp(target)) {\r\n\t\t\t\tselector = function(key, value) {\r\n\t\t\t\t\treturn target.test(key) && value;\r\n\t\t\t\t};\r\n\t\t\t} else {\r\n\t\t\t\tvar replace_flags = this.flags;\r\n\t\t\t\tselector = function(key, value) {\r\n\t\t\t\t\tvar pattern;\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tpattern = typeof replace_flags === 'function'\r\n\t\t\t\t\t\t//\r\n\t\t\t\t\t\t? replace_flags(key)\r\n\t\t\t\t\t\t//\r\n\t\t\t\t\t\t: new RegExp(key, replace_flags);\r\n\t\t\t\t\t} catch (e) {\r\n\t\t\t\t\t\t// Error key?\r\n\t\t\t\t\t\tlibrary_namespace.error('Convert_Pairs.select: key '\r\n\t\t\t\t\t\t\t\t+ (pattern || '[' + key + ']') + ': '\r\n\t\t\t\t\t\t\t\t+ e.message);\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn pattern.test(target) && value;\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// TODO: use `for (const key of this.pair_Map.keys())`\r\n\t\tfor (var pair_Map = this.pair_Map, keys = Array.from(pair_Map.keys()), index = 0; index < keys.length; index++) {\r\n\t\t\tvar key = keys[index], value = selector(key, pair_Map.get(key));\r\n\t\t\tif (value)\r\n\t\t\t\treturn value;\r\n\t\t}\r\n\t}", "title": "" }, { "docid": "27036ac96eab23bbe1886035e8dd972d", "score": "0.49405536", "text": "function withCachedSelection(func){\n var sel = false;\n return function(opt){\n\tvar iframe = opt.iframe;\n\tif(sel === false){\n\t sel = getSelection(iframe.contentWindow);\n\t}\n\treturn func.call(this, $.extend(opt, {selection: sel}));\n };\n}", "title": "" }, { "docid": "8788e7192ec391cc0ea543021f45f96a", "score": "0.49395952", "text": "function utilSelectTextByObject(obj) {\n obj.select();\n document.execCommand('copy');\n setTimeout( function() {window.getSelection().removeAllRanges();}, 0.20);\n}", "title": "" }, { "docid": "dc503b9b769c24bf3008e55aa1414fc7", "score": "0.49294785", "text": "_getFindSelector(args) {\n if (args.length == 0) return {};else return args[0];\n }", "title": "" }, { "docid": "5ce127cc528d8d4b7a380e4f36c508b2", "score": "0.4924209", "text": "function $(/* ... */) {\n var args = arguments;\n var selected = null;\n if (args.length === 1) {\n selected = document.querySelectorAll(args[0]);\n } else \n if (args.length === 2) {\n selected = args[0].querySelectorAll(args[1]);\n }\n return selected;\n}", "title": "" }, { "docid": "b4d6b7f53cc4e350734d8911bbf3f8f5", "score": "0.49113414", "text": "function selectAll(object, selector) {\n if (typeof_default()(this) === 'object' && this.isSeemple) {\n // when context is Seemple instance, use this as an object and shift other args\n\n /* eslint-disable no-param-reassign */\n selector = object;\n object = this;\n /* eslint-enable no-param-reassign */\n } else {\n // throw error when object type is wrong\n Object(checkobjecttype[\"a\" /* default */])(object, 'selectAll or $');\n } // the selector includes \"custom\" things like :sandbox or :bound(KEY)\n\n\n if (selectall_customSelectorTestReg.test(selector)) {\n return Object(_selectnodes[\"a\" /* default */])(object, selector);\n }\n\n var def = defs[\"a\" /* default */].get(object);\n var result = _dom[\"a\" /* default */].$();\n\n if (!def || typeof selector !== 'string') {\n return result;\n }\n\n var propDef = def.props.sandbox;\n\n if (!propDef) {\n return result;\n }\n\n var bindings = propDef.bindings;\n\n if (bindings) {\n // iterate over all bindings and add found nodes\n Object(foreach[\"a\" /* default */])(bindings, function (_ref) {\n var node = _ref.node;\n var selected = node.querySelectorAll(selector);\n result = result.add(Object(toarray[\"a\" /* default */])(selected));\n });\n }\n\n return result;\n}", "title": "" }, { "docid": "46f62ce95e69abee47b9f59518c95183", "score": "0.49079582", "text": "selector() {\n let all = []\n for (var i = 0; i < arguments.length - 1; i++) {\n all.push(arguments[i + 1][arguments[0]])\n }\n return all;\n }", "title": "" }, { "docid": "b47cec8f0701b9eaf3f2a2e52ee157eb", "score": "0.49030703", "text": "function selectElement(selector) {\n\treturn document.querySelector(selector);\n}", "title": "" }, { "docid": "c81d10f09cd31c7b97f17ba72fc82e1f", "score": "0.4902903", "text": "function _cheerio_method(sel, method, method_arg, new_value){\n var r = $(sel)[method](method_arg);\n if (new_value)\n r = $(sel)[method](method_arg, new_value)[method](method_arg);\n return r;\n}", "title": "" }, { "docid": "591a40a9094df092d05dcb4e9bd92644", "score": "0.49016288", "text": "async select(editor, fn) {\n let selectedRanges = [new Range(0, editor.document.length)];\n /*let selectedRanges = editor.selectedRanges;\n\n if (selectedRanges.length === 1 && selectedRanges[0].start === selectedRanges[0].end) {\n selectedRanges = [new Range(0, editor.document.length)];\n }*/\n for (const range of selectedRanges) {\n const text = editor.getTextInRange(range);\n Promise.resolve(fn.apply(this, [editor, text])).then((response) => {\n if (!response || !response.length) {\n return false;\n }\n\n log('Matches found ' + response.length);\n logPerformanceStart('Nova select');\n\n // Move the cursor position to the first matched range\n editor.selectedRanges = [new Range(response[0].start, response[0].end)];\n\n // Add selection ranges\n /*for (const filteredRange of response) {\n editor.addSelectionForRange(filteredRange);\n }*/\n editor.selectedRanges = response;\n\n // Scroll to the first change\n editor.scrollToPosition(response[0].start);\n logPerformanceEnd('Nova select');\n });\n }\n }", "title": "" }, { "docid": "81cec4b2f274455412de9475b1a31c3b", "score": "0.48911667", "text": "function pick()\n{\n locate() || search();\n}", "title": "" }, { "docid": "d8f6576d15cd1aaeb93fbdfe2bd6771a", "score": "0.48894608", "text": "_addSelectable(cssSelector, callbackCtxt, listContext) {\n let matcher = this;\n const element = cssSelector.element;\n const classNames = cssSelector.classNames;\n const attrs = cssSelector.attrs;\n const selectable = new SelectorContext(cssSelector, callbackCtxt, listContext);\n if (element) {\n const isTerminal = attrs.length === 0 && classNames.length === 0;\n if (isTerminal) {\n this._addTerminal(matcher._elementMap, element, selectable);\n }\n else {\n matcher = this._addPartial(matcher._elementPartialMap, element);\n }\n }\n if (classNames) {\n for (let i = 0; i < classNames.length; i++) {\n const isTerminal = attrs.length === 0 && i === classNames.length - 1;\n const className = classNames[i];\n if (isTerminal) {\n this._addTerminal(matcher._classMap, className, selectable);\n }\n else {\n matcher = this._addPartial(matcher._classPartialMap, className);\n }\n }\n }\n if (attrs) {\n for (let i = 0; i < attrs.length; i += 2) {\n const isTerminal = i === attrs.length - 2;\n const name = attrs[i];\n const value = attrs[i + 1];\n if (isTerminal) {\n const terminalMap = matcher._attrValueMap;\n let terminalValuesMap = terminalMap.get(name);\n if (!terminalValuesMap) {\n terminalValuesMap = new Map();\n terminalMap.set(name, terminalValuesMap);\n }\n this._addTerminal(terminalValuesMap, value, selectable);\n }\n else {\n const partialMap = matcher._attrValuePartialMap;\n let partialValuesMap = partialMap.get(name);\n if (!partialValuesMap) {\n partialValuesMap = new Map();\n partialMap.set(name, partialValuesMap);\n }\n matcher = this._addPartial(partialValuesMap, value);\n }\n }\n }\n }", "title": "" }, { "docid": "d8f6576d15cd1aaeb93fbdfe2bd6771a", "score": "0.48894608", "text": "_addSelectable(cssSelector, callbackCtxt, listContext) {\n let matcher = this;\n const element = cssSelector.element;\n const classNames = cssSelector.classNames;\n const attrs = cssSelector.attrs;\n const selectable = new SelectorContext(cssSelector, callbackCtxt, listContext);\n if (element) {\n const isTerminal = attrs.length === 0 && classNames.length === 0;\n if (isTerminal) {\n this._addTerminal(matcher._elementMap, element, selectable);\n }\n else {\n matcher = this._addPartial(matcher._elementPartialMap, element);\n }\n }\n if (classNames) {\n for (let i = 0; i < classNames.length; i++) {\n const isTerminal = attrs.length === 0 && i === classNames.length - 1;\n const className = classNames[i];\n if (isTerminal) {\n this._addTerminal(matcher._classMap, className, selectable);\n }\n else {\n matcher = this._addPartial(matcher._classPartialMap, className);\n }\n }\n }\n if (attrs) {\n for (let i = 0; i < attrs.length; i += 2) {\n const isTerminal = i === attrs.length - 2;\n const name = attrs[i];\n const value = attrs[i + 1];\n if (isTerminal) {\n const terminalMap = matcher._attrValueMap;\n let terminalValuesMap = terminalMap.get(name);\n if (!terminalValuesMap) {\n terminalValuesMap = new Map();\n terminalMap.set(name, terminalValuesMap);\n }\n this._addTerminal(terminalValuesMap, value, selectable);\n }\n else {\n const partialMap = matcher._attrValuePartialMap;\n let partialValuesMap = partialMap.get(name);\n if (!partialValuesMap) {\n partialValuesMap = new Map();\n partialMap.set(name, partialValuesMap);\n }\n matcher = this._addPartial(partialValuesMap, value);\n }\n }\n }\n }", "title": "" }, { "docid": "d8f6576d15cd1aaeb93fbdfe2bd6771a", "score": "0.48894608", "text": "_addSelectable(cssSelector, callbackCtxt, listContext) {\n let matcher = this;\n const element = cssSelector.element;\n const classNames = cssSelector.classNames;\n const attrs = cssSelector.attrs;\n const selectable = new SelectorContext(cssSelector, callbackCtxt, listContext);\n if (element) {\n const isTerminal = attrs.length === 0 && classNames.length === 0;\n if (isTerminal) {\n this._addTerminal(matcher._elementMap, element, selectable);\n }\n else {\n matcher = this._addPartial(matcher._elementPartialMap, element);\n }\n }\n if (classNames) {\n for (let i = 0; i < classNames.length; i++) {\n const isTerminal = attrs.length === 0 && i === classNames.length - 1;\n const className = classNames[i];\n if (isTerminal) {\n this._addTerminal(matcher._classMap, className, selectable);\n }\n else {\n matcher = this._addPartial(matcher._classPartialMap, className);\n }\n }\n }\n if (attrs) {\n for (let i = 0; i < attrs.length; i += 2) {\n const isTerminal = i === attrs.length - 2;\n const name = attrs[i];\n const value = attrs[i + 1];\n if (isTerminal) {\n const terminalMap = matcher._attrValueMap;\n let terminalValuesMap = terminalMap.get(name);\n if (!terminalValuesMap) {\n terminalValuesMap = new Map();\n terminalMap.set(name, terminalValuesMap);\n }\n this._addTerminal(terminalValuesMap, value, selectable);\n }\n else {\n const partialMap = matcher._attrValuePartialMap;\n let partialValuesMap = partialMap.get(name);\n if (!partialValuesMap) {\n partialValuesMap = new Map();\n partialMap.set(name, partialValuesMap);\n }\n matcher = this._addPartial(partialValuesMap, value);\n }\n }\n }\n }", "title": "" }, { "docid": "d8f6576d15cd1aaeb93fbdfe2bd6771a", "score": "0.48894608", "text": "_addSelectable(cssSelector, callbackCtxt, listContext) {\n let matcher = this;\n const element = cssSelector.element;\n const classNames = cssSelector.classNames;\n const attrs = cssSelector.attrs;\n const selectable = new SelectorContext(cssSelector, callbackCtxt, listContext);\n if (element) {\n const isTerminal = attrs.length === 0 && classNames.length === 0;\n if (isTerminal) {\n this._addTerminal(matcher._elementMap, element, selectable);\n }\n else {\n matcher = this._addPartial(matcher._elementPartialMap, element);\n }\n }\n if (classNames) {\n for (let i = 0; i < classNames.length; i++) {\n const isTerminal = attrs.length === 0 && i === classNames.length - 1;\n const className = classNames[i];\n if (isTerminal) {\n this._addTerminal(matcher._classMap, className, selectable);\n }\n else {\n matcher = this._addPartial(matcher._classPartialMap, className);\n }\n }\n }\n if (attrs) {\n for (let i = 0; i < attrs.length; i += 2) {\n const isTerminal = i === attrs.length - 2;\n const name = attrs[i];\n const value = attrs[i + 1];\n if (isTerminal) {\n const terminalMap = matcher._attrValueMap;\n let terminalValuesMap = terminalMap.get(name);\n if (!terminalValuesMap) {\n terminalValuesMap = new Map();\n terminalMap.set(name, terminalValuesMap);\n }\n this._addTerminal(terminalValuesMap, value, selectable);\n }\n else {\n const partialMap = matcher._attrValuePartialMap;\n let partialValuesMap = partialMap.get(name);\n if (!partialValuesMap) {\n partialValuesMap = new Map();\n partialMap.set(name, partialValuesMap);\n }\n matcher = this._addPartial(partialValuesMap, value);\n }\n }\n }\n }", "title": "" }, { "docid": "a6e91d4fae19d01ab027284c9c99a242", "score": "0.48796266", "text": "function selectSingle(s) {\n if (null == s) return null;\n var attrName, attrRXEnd = /@([^=#\\s]+)$/g, sel = s, match = attrRXEnd.exec(s);\n if (match) {\n attrName = match[1];\n // match the subgroup\n sel = sel.replace(match[0], \"\");\n }\n // query\n var eles;\n try {\n eles = document.querySelectorAll(sel);\n } catch (ex) {\n // seelctor was invalid, so just return null\n return null;\n }\n for (var col = [], i = 0; i < eles.length; i++) {\n var item, ele = eles[i];\n if (attrName) {\n var attr = Svidget.DOM.attr(ele, attrName);\n null != attr && (item = new Svidget.DOMItem(attr));\n } else item = new Svidget.DOMItem(ele);\n item && col.push(item);\n }\n return new Svidget.Collection(col);\n }", "title": "" }, { "docid": "32cec4211523dde16c15af2d35be60f6", "score": "0.48772576", "text": "function selectAllInTable(table) {\r\n\tvar row = $(table).find(\"tr\");\r\n\tvar no1stele = row.slice(1);\r\n\twhile (no1stele.size() != 0) {\r\n\t\t//WARNING, IF YOU DON'T SPLICE HERE, JQUERY WILL SELECT ALL THE ROWS!!\r\n\t\t//I don't understand how it worked in the other function. What matters\r\n\t\t//is that it works now\r\n\t\tvar currentEl = no1stele.slice(0,1);\r\n\t\tif (!currentEl.hasClass(\"row_selected\")) {\r\n\t\t\tcurrentEl.addClass(\"row_selected\");\r\n\t\t}\r\n\t\tno1stele = no1stele.next(\"tr\");\r\n\r\n\t}\r\n\t}", "title": "" }, { "docid": "6236ebc0cbc1f6276367da76c8ba0566", "score": "0.48767656", "text": "function selectMatchingOptions(obj,regex)\r\n{\r\n\tselectUnselectMatchingOptions(obj,regex,\"select\",false);\r\n}", "title": "" }, { "docid": "22a278bc51bc780d65cb30f092eab633", "score": "0.48728395", "text": "function select (model,ppath,val){\n var res;\n if(ppath.isEmpty()) {\n res= model\n .set('select',val);\n } else {\n res= model\n .set('content',model\n .get('content')\n .map(x=>x.merge(Immutable.fromJS({select:false})))\n .set(ppath.first(),\n select(model.get('content').get(ppath.first()),ppath.shift(),val)));\n }\n return res;\n}", "title": "" }, { "docid": "294f9f478de4a966c98c7a21f9d9d58c", "score": "0.4849389", "text": "function getSelectedOptions(sel, fn) {\n var opts = [], opt;\n // loop through options in select list\n for (var i=0, len=sel.options.length; i<len; i++) {\n opt = sel.options[i];\n // check if selected\n if ( opt.selected ) {\n // add to array of option elements to return from this function\n opts.push(opt);\n // invoke optional callback function if provided\n if (fn) {\n fn(opt);\n }\n }\n }\n // return array containing references to selected option elements\n console.log(\"array = \" + opts.value)\n return opts;\n}", "title": "" }, { "docid": "611d00b088292621343b9e8d1406b560", "score": "0.48453", "text": "function selectAllText(elm)\n{\n\tvar selection = window.getSelection(); \n\tvar range = document.createRange();\n\trange.selectNodeContents(elm);\n\tselection.removeAllRanges();\n\tselection.addRange(range);\n}", "title": "" }, { "docid": "3a2c0c5f6a8d1b57d9a729253301d999", "score": "0.48343906", "text": "function selectAllText(textbox) { textbox.focus(); textbox.select(); }", "title": "" }, { "docid": "118258e2ff87b565baafca1b753e1c5a", "score": "0.48292008", "text": "collect(iterator, context) {}", "title": "" }, { "docid": "c694997e7cccf96f01bea87c790f918c", "score": "0.48226184", "text": "function deselect(item, thenDoThis) {\r\n select(item, thenDoThis, false)\r\n}", "title": "" }, { "docid": "b4574efe854a764b2761490ffb439711", "score": "0.4820983", "text": "function selectText() {\n document.execCommand('selectAll', false, null);\n}", "title": "" }, { "docid": "8db3e51fee209dc4d0e1034ca0a59796", "score": "0.4819392", "text": "function selectElementContents(el) {\r\n let range = document.createRange();\r\n range.selectNodeContents(el);\r\n let sel = window.getSelection();\r\n sel.removeAllRanges();\r\n sel.addRange(range);\r\n}", "title": "" }, { "docid": "a645da5101836a2fbecf6dc79b1f2677", "score": "0.48147136", "text": "function select() {\n return __awaiter(this, void 0, void 0, function () {\n var client, resp, i, err_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n client = new Client(config);\n client.connect(function (err) {\n if (err) {\n console.error('connection error', err.stack);\n }\n else {\n console.log('connected');\n }\n });\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, client.query('SELECT * FROM test.usacek')];\n case 2:\n resp = _a.sent();\n for (i in resp.rows) {\n resp.rows[i].datum = moment_1.default(resp.rows[i].datum).format('DD.MM.YYYY');\n //console.log(resp.rows[i].datum);\n }\n console.log(moment_1.default(resp.rows[0].datum).format('DD.MM.YYYY'));\n //console.log(JSON.stringify(resp.rows));\n client.end();\n return [2 /*return*/, JSON.stringify(resp.rows)];\n case 3:\n err_1 = _a.sent();\n console.log('Database ' + err_1);\n client.end();\n return [2 /*return*/, err_1];\n case 4: return [2 /*return*/];\n }\n });\n });\n}", "title": "" }, { "docid": "708bbcdb7b51148f78a88baef5ae9ee3", "score": "0.48115084", "text": "function generateHarmonSelect(selector, contents) {\n const select = { query: selector }\n\n select.func = (node) => {\n const stream = node.createStream({ 'outer' : true })\n\n let innerHtml = ''\n\n stream.on('data', (data) => {\n innerHtml += data\n })\n\n stream.on('end', () => {\n stream.end(innerHtml + contents)\n })\n }\n\n return select\n}", "title": "" }, { "docid": "f41b8087a91c4f5a0d9418a72b34c6e7", "score": "0.48036346", "text": "function collectSelector(root, collector) {\n return function (s) {\n var oid, nid\n if (splittable.test(s)) {\n if (root[nodeType] !== 9) {\n // make sure the el has an id, rewrite the query, set root to doc and run it\n if (!(nid = oid = root.getAttribute('id'))) root.setAttribute('id', nid = '__qwerymeupscotty')\n s = '[id=\"' + nid + '\"]' + s // avoid byId and allow us to match context element\n collector(root.parentNode || root, s, true)\n oid || root.removeAttribute('id')\n }\n return;\n }\n s.length && collector(root, s, false)\n }\n }", "title": "" }, { "docid": "f41b8087a91c4f5a0d9418a72b34c6e7", "score": "0.48036346", "text": "function collectSelector(root, collector) {\n return function (s) {\n var oid, nid\n if (splittable.test(s)) {\n if (root[nodeType] !== 9) {\n // make sure the el has an id, rewrite the query, set root to doc and run it\n if (!(nid = oid = root.getAttribute('id'))) root.setAttribute('id', nid = '__qwerymeupscotty')\n s = '[id=\"' + nid + '\"]' + s // avoid byId and allow us to match context element\n collector(root.parentNode || root, s, true)\n oid || root.removeAttribute('id')\n }\n return;\n }\n s.length && collector(root, s, false)\n }\n }", "title": "" }, { "docid": "f41b8087a91c4f5a0d9418a72b34c6e7", "score": "0.48036346", "text": "function collectSelector(root, collector) {\n return function (s) {\n var oid, nid\n if (splittable.test(s)) {\n if (root[nodeType] !== 9) {\n // make sure the el has an id, rewrite the query, set root to doc and run it\n if (!(nid = oid = root.getAttribute('id'))) root.setAttribute('id', nid = '__qwerymeupscotty')\n s = '[id=\"' + nid + '\"]' + s // avoid byId and allow us to match context element\n collector(root.parentNode || root, s, true)\n oid || root.removeAttribute('id')\n }\n return;\n }\n s.length && collector(root, s, false)\n }\n }", "title": "" }, { "docid": "6d87866dedd6b615ba053528513f5c6a", "score": "0.4801922", "text": "function collectSelector(root, collector) {\n return function(s) {\n var oid, nid\n if (splittable.test(s)) {\n if (root[nodeType] !== 9) {\n // make sure the el has an id, rewrite the query, set root to doc and run it\n if (!(nid = oid = root.getAttribute('id'))) root.setAttribute('id', nid = '__qwerymeupscotty')\n s = '[id=\"' + nid + '\"]' + s // avoid byId and allow us to match context element\n collector(root.parentNode || root, s, true)\n oid || root.removeAttribute('id')\n }\n return;\n }\n s.length && collector(root, s, false)\n }\n }", "title": "" }, { "docid": "68af3b7b8584b8e5fc22c328d310197b", "score": "0.4796237", "text": "function collectSelector(root, collector) {\n return function(s) {\n var oid, nid\n if (splittable.test(s)) {\n if (root[nodeType] !== 9) {\n // make sure the el has an id, rewrite the query, set root to doc and run it\n if (!(nid = oid = root.getAttribute('id'))) root.setAttribute('id', nid = '__qwerymeupscotty')\n s = '[id=\"' + nid + '\"]' + s // avoid byId and allow us to match context element\n collector(root.parentNode || root, s, true)\n oid || root.removeAttribute('id')\n }\n return;\n }\n s.length && collector(root, s, false)\n }\n }", "title": "" }, { "docid": "8ff620485839a7c8fd127470834b6fe8", "score": "0.4779101", "text": "function selection(sel){\t\n\n\t\n\tvar nbhd = sel.closedNeighborhood();\n\tvar others = cy.elements().not( nbhd );\n\tlayout.stop();\n\treset();\n others.addClass('semitransp');\n\tnbhd.addClass('highlight');\n\n\n// return Promise.resolve()\n// .then( reset )\n// .then( pullNbhd )\n// .then( fit(nbhd) )\n// .then( showOthersFaded )\n// ;\n\tpullNbhd(nbhd,sel);\n // fit(nbhd);\n}", "title": "" }, { "docid": "b16eadbb352d158bed7c374029d9290b", "score": "0.477796", "text": "function collectSelector(root, collector) {\n return function (s) {\n var oid, nid\n if (splittable.test(s)) {\n if (root[nodeType] !== 9) {\n // make sure the el has an id, rewrite the query, set root to doc and run it\n if (!(nid = oid = root.getAttribute('id'))) root.setAttribute('id', nid = '__qwerymeupscotty')\n s = '[id=\"' + nid + '\"]' + s // avoid byId and allow us to match context element\n collector(root.parentNode || root, s, true)\n oid || root.removeAttribute('id')\n }\n return;\n }\n s.length && collector(root, s, false)\n }\n }", "title": "" }, { "docid": "900d9ef1645cef6092c22b4ffb3da3b9", "score": "0.4776964", "text": "function fnSelect(objId)\n{\n fnDeSelect();\n if (document.selection) \n {\n var range = document.body.createTextRange();\n range.moveToElementText(document.getElementById(objId));\n range.select();\n }\n else if (window.getSelection) \n {\n var range = document.createRange();\n range.selectNode(document.getElementById(objId));\n window.getSelection().addRange(range);\n }\n}", "title": "" }, { "docid": "1b7f5ae2f58b9b6522c7fcf4dda61ae8", "score": "0.4776877", "text": "function collectSelector(root, collector) {\n return function(s) {\n var oid, nid;\n if (splittable.test(s)) {\n if (root.nodeType !== 9) {\n // Make sure the el has an id, rewrite the query, set root to doc and run it\n if (!(nid = oid = root.getAttribute('id'))) root.setAttribute('id', nid = '__nmSelectormeupscotty');\n s = '[id=\"' + nid + '\"]' + s; // avoid byId and allow us to match context element\n collector(root.parentNode || root, s, true);\n oid || root.removeAttribute('id');\n }\n return;\n }\n s.length && collector(root, s, false);\n }\n }", "title": "" }, { "docid": "2b5b70f776f355c2f416fdc7380dabad", "score": "0.47766104", "text": "function _(selector, all=false){\n if(all == true){\n return document.querySelectorAll(selector);\n }else{\n return document.querySelector(selector);\n }\n}", "title": "" }, { "docid": "edf47e23b86ee7a748d7093ae1422e74", "score": "0.47721523", "text": "function collectSelector(root, collector) {\n return function (s) {\n var oid, nid\n if (splittable.test(s)) {\n if (root[nodeType] !== 9) {\n // make sure the el has an id, rewrite the query, set root to doc and run it\n if (!(nid = oid = root.getAttribute('id'))) root.setAttribute('id', nid = '__qwerymeupscotty')\n s = '[id=\"' + nid + '\"]' + s // avoid byId and allow us to match context element\n collector(root.parentNode || root, s, true)\n oid || root.removeAttribute('id')\n }\n return;\n }\n s.length && collector(root, s, false)\n }\n }", "title": "" }, { "docid": "26a856e9f8603882ba9cdc37e62f31cb", "score": "0.47645125", "text": "function _f(selected, modifier) {\n Array.prototype.forEach.call(selected, modifier);\n}", "title": "" }, { "docid": "586e1822019d1645e72f75687209b63c", "score": "0.47551396", "text": "select (...args) {\n this._fields.add(args)\n return this\n }", "title": "" }, { "docid": "faacff5ea52376ade2a8f1f81252a9f0", "score": "0.47520673", "text": "function _selById (id)\n{\n return '#' + id;\n}", "title": "" } ]
ecc4444c625c16aeabaedd676983e87f
command in ['left', 'right', 'up', 'down']
[ { "docid": "408e5c1f0953872e82401fa145ecc493", "score": "0.0", "text": "advance(command) {\n let reverse = (command == 'right' || command == 'down')\n let moves = [];\n let points = 0;\n\n if (command == 'left' || command == 'right') {\n for (let i = 0; i < GAME_SIZE; i++) {\n let result = this.shiftBlock(this.data[i], reverse);\n for (let move of result['moves']) {\n moves.push([[i, move[0]], [i, move[1]]]);\n }\n }\n } else if (command == 'up' || command == 'down') {\n for (let j = 0; j < GAME_SIZE; j++) {\n let tmp = [];\n for (let i = 0; i < GAME_SIZE; i++) {\n tmp.push(this.data[i][j]);\n }\n let result = this.shiftBlock(tmp, reverse);\n for (let move of result['moves']) {\n moves.push([[move[0], j], [move[1], j]]);\n }\n for (let i = 0; i < GAME_SIZE; i++) {\n this.data[i][j] = tmp[i];\n }\n }\n }\n\n if (moves.length != 0) {\n this.generateNewBlock();\n }\n\n return moves;\n }", "title": "" } ]
[ { "docid": "036ffa9c62de1e64f352f1c5287c1ccc", "score": "0.6278061", "text": "keyDown(event) {\n var keyCode = event.which || event.keyCode;\n this.activeCommands[keyCode] = true;\n }", "title": "" }, { "docid": "036ffa9c62de1e64f352f1c5287c1ccc", "score": "0.6278061", "text": "keyDown(event) {\n var keyCode = event.which || event.keyCode;\n this.activeCommands[keyCode] = true;\n }", "title": "" }, { "docid": "0ed60cb89b946705476d40ed75129797", "score": "0.62526566", "text": "executeCommand(command) {\n switch (command.action) {\n case \"F\":\n this.moveForward(command.value)\n break;\n case \"E\":\n this.moveEast(command.value)\n break;\n case \"W\":\n this.moveWest(command.value)\n break;\n case \"N\":\n this.moveNorth(command.value)\n break;\n case \"S\":\n this.moveSouth(command.value)\n break;\n case \"L\":\n this.rotateLeft(command.value)\n break;\n case \"R\":\n this.rotateRight(command.value)\n break;\n default:\n console.log(\"The ship has received a weird instruction. You should check it\");\n break;\n } \n }", "title": "" }, { "docid": "dfe26839c6035cf6c8e83ac96307bcfe", "score": "0.62062633", "text": "mouseDown(event) {\n var button = event.which || event.button;\n this.activeCommands[button] = true;\n }", "title": "" }, { "docid": "dfe26839c6035cf6c8e83ac96307bcfe", "score": "0.62062633", "text": "mouseDown(event) {\n var button = event.which || event.button;\n this.activeCommands[button] = true;\n }", "title": "" }, { "docid": "ffdf9dd11da648593d0df389e255a9ea", "score": "0.6188315", "text": "function direction(event) {\r\n if (event.keyCode == 37 && dir != \"RIGHT\") {\r\n dir = \"LEFT\";\r\n } else if (event.keyCode == 38 && dir != \"DOWN\") {\r\n dir = \"UP\";\r\n } else if (event.keyCode == 39 && dir != \"LEFT\") {\r\n dir = \"RIGHT\";\r\n } else if (event.keyCode == 40 && dir != \"UP\") {\r\n dir = \"DOWN\";\r\n }\r\n }", "title": "" }, { "docid": "f81ed1e48d7844e3844f051fdd2e2681", "score": "0.6162797", "text": "function commands(movement,Rover)\r\n{\r\n //validation\r\n for(let i=0;i<movement.length;i++)\r\n { \r\n let l=movement.charAt(i).toLowerCase();\r\n if(l===\"f\"|| l===\"b\"||l===\"l\"||l===\"r\")\r\n { \r\n switch(l)\r\n {\r\n case \"f\":moveForward(Rover);\r\n break;\r\n case \"r\":turnRight(Rover);\r\n break;\r\n case \"l\":turnLeft(Rover);\r\n break;\r\n case \"b\":moveBackward(Rover);\r\n break;\r\n }\r\n } \r\n } \r\n}", "title": "" }, { "docid": "a0d1b160bcc6318695e41ad17e371e41", "score": "0.61465317", "text": "function command_ok(command){\n if (command == 2 || command == 4 || command == 6 || command == 7){\n return true;\n }\n return false;\n}", "title": "" }, { "docid": "e23a7426bd6ddd825655af9ef4a2dc70", "score": "0.61238486", "text": "isUpOrDown() {\n return direction === DIRECTIONS.UP || direction === DIRECTIONS.DOWN\n }", "title": "" }, { "docid": "d7152792142e858eaf095a7e66a93df0", "score": "0.6123039", "text": "function commands(command) {\n switch (command) {\n case \"concert-this\":\n concertSearch();\n break;\n case \"movie-this\":\n movieSearch();\n break;\n case \"spotify-this-song\":\n songSearch();\n break;\n case \"do-what-it-says\":\n doThis();\n break;\n default:\n console.log('Liri needs to be told what to do...');\n };\n}", "title": "" }, { "docid": "231af7bb8231a158a2a1791c9ef191e9", "score": "0.6054763", "text": "function onKeyDown(evt) {\n if (evt.keyCode == 81) Up1Pressed = true; //q\n else if (evt.keyCode == 65) Down1Pressed = true; //a\n // else if (evt.keyCode == 80) Up2Pressed = true; //p\n // else if (evt.keyCode == 76) Down2Pressed = true; //l\n}", "title": "" }, { "docid": "cb048fe2fb9ba31f95e87e1be9c9c837", "score": "0.6017986", "text": "function update(event) {\n if (event.keyCode == 37 && direcao != \"right\") direcao = \"left\";\n if (event.keyCode == 65 && direcao != \"right\") direcao = \"left\";\n if (event.keyCode == 38 && direcao != \"down\") direcao = \"up\";\n if (event.keyCode == 87 && direcao != \"down\") direcao = \"up\";\n if (event.keyCode == 39 && direcao != \"left\") direcao = \"right\";\n if (event.keyCode == 68 && direcao != \"left\") direcao = \"right\";\n if (event.keyCode == 40 && direcao != \"up\") direcao = \"down\";\n if (event.keyCode == 83 && direcao != \"up\") direcao = \"down\";\n}", "title": "" }, { "docid": "aec2d941a97fae9042aaed2044c11195", "score": "0.6000209", "text": "function control(e) {\n if (gameOver) return;\n var action = \"\";\n switch (e.keyCode) {\n case 39:\n // Right\n action = \"RIGHT\";\n performMove(action);\n break;\n\n case 38:\n // Up\n action = \"UP\";\n performMove(action);\n break;\n\n case 37:\n // Left\n action = \"LEFT\";\n performMove(action);\n break;\n\n case 40:\n //DOWN\n action = \"DOWN\";\n performMove(action);\n break;\n }\n\n if (debug) alert(action);\n } // control(e)", "title": "" }, { "docid": "81d33b5c8ccd8564200bf536117092be", "score": "0.59950286", "text": "function direction(event){ // event as a parameter it can be named different\n\tif((event.keyCode == 37) && (direc != \"RIGHT\")){ \n\t\tleft.play();\n\t\tdirec = \"LEFT\";\n\t}else if((event.keyCode == 38) && (direc != \"DOWN\")){\n\t\tup.play();\n\t\tdirec = \"UP\";\n\t}else if((event.keyCode == 39) && (direc != \"LEFT\")){\n\t\tright.play();\n\t\tdirec = \"RIGHT\";\n\t}else if((event.keyCode == 40) && (direc != \"UP\")){\n\t\tdown.play();\n\t\tdirec = \"DOWN\";\n\t}\n}", "title": "" }, { "docid": "223346e97b3bb9caab353ebcb88dcda4", "score": "0.5991968", "text": "function selectCommand(command){\n switch(command){\n case \"spotify-this-song\":\n spotifyCommand();\n break;\n case \"movie-this\":\n omdbCommand();\n break;\n case \"concert-this\":\n bandsInTownCommand();\n break;\n case \"do-what-it-says\":\n doWhatItSays();\n break;\n case \"Never Mind\":\n console.log(\"\\nBye!\")\n break;\n }\n}", "title": "" }, { "docid": "9772404e04c4e32c8d5c9f1e06c24cb5", "score": "0.5985656", "text": "function handleMotors() {\n switch (command.id) {\n case 1:\n commandName = \"Forward\";\n commandArgs.push([ \"velocity\", command.args[0] ]);\n commandArgs.push([ \"duration\", command.args[1] ]);\n break;\n case 2:\n commandName = \"Reverse\";\n commandArgs.push([ \"velocity\", command.args[0] ]);\n commandArgs.push([ \"duration\", command.args[1] ]);\n break;\n case 3:\n commandName = \"Left\";\n commandArgs.push([ \"angle\", command.args[0] ]);\n break;\n case 4:\n commandName = \"Right\";\n commandArgs.push([ \"angle\", command.args[0] ]);\n break;\n }\n }", "title": "" }, { "docid": "6b49c150ff14a0e8b6eb6ad2ae470cff", "score": "0.5957134", "text": "function setAxisCommand(str){\n var tmp = str.split(\":\", 3)\n //tmp[0]\n var angle = tmp[1]\n var on = tmp[2]\n \n if(on == 0){//key up, stop\n cmd = commands.STOP;\n }\n else{\n if(angle >= 0 && angle < 45 || angle >= 315 && angle < 360){\n cmd = commands.FORWARD;\n }\n else if(angle >= 45 && angle <= 135){\n cmd = commands.LEFT;\n }\n else if(angle > 135 && angle < 225){\n cmd = commands.BACK;\n }\n else{\n cmd = commands.RIGHT;\n }\n }\n}", "title": "" }, { "docid": "717411798940ea05b51e627e6a41a9be", "score": "0.59274113", "text": "function moveCommand(direction) {\n\tvar whatHappens;\n\tswitch (direction) {\n\t\tcase \"forward\":\n\t\t\twhatHappens = \"you encountered a demon\";\n\t\t\tbreak;\n\t\tcase \"back\":\n\t\t\twhatHappens = \"you arrived home\";\n\t\t\tbreak;\n\t\tcase \"left\":\n\t\t\twhatHappens = \"you fell into a lake\";\n\t\t\tbreak;\n\t\tcase \"right\":\n\t\t\twhatHappens = \"you got trapped in quicksand\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\twhatHappens = \"please enter a valid direction\";\n\t}\n\treturn whatHappens;\n}", "title": "" }, { "docid": "10c4cd06474e9371363a1c0a50caa878", "score": "0.59170383", "text": "function onKeyDown(evt) {\n if (evt.keyCode == 39) rightDown = true;\n else if (evt.keyCode == 37) leftDown = true;\n}", "title": "" }, { "docid": "654e1f58c4b1575099c2129c7b827f4c", "score": "0.58993894", "text": "function keyDown(e) {\n if (e.keyCode == 39) {\n rightPressed = true;\n } else if (e.keyCode == 37) {\n leftPressed = true;\n //arrow up\n } else if (e.keyCode == 38) {\n upPressed = true;\n } else if (e.keyCode == 40) {\n downPressed = true;\n }\n}", "title": "" }, { "docid": "d816eb5057511618b3d9dbec95e523d2", "score": "0.58807576", "text": "function keyDownHandler(e) {\r\n if(e.keyCode == 37) {\r\n leftPressed = true;\r\n }\r\n else if(e.keyCode == 38) {\r\n upPressed = true;\r\n }\r\n else if(e.keyCode == 39) {\r\n rightPressed = true;\r\n }\r\n else if(e.keyCode == 40) {\r\n downPressed = true;\r\n }\r\n}", "title": "" }, { "docid": "d6ce4dd81102193dae3c72e3fecab7bf", "score": "0.5876676", "text": "handleCommand( cmd ) {\n if (!cmd) return;\n\n var tokens = cmd.split(\" \");\n\n if (tokens[0] === \"rect\") {\n var xy = tokens[1].split(\"x\");\n this.fillRect( xy[0], xy[1] );\n }\n\n if (tokens[0] === \"rotate\") {\n if (tokens[1] === \"row\") {\n tokens = cmd.match(/rotate row y=(\\d+) by (\\d+)/ );\n this.rotateRowBits( tokens[1], tokens[2] );\n\n } else if (tokens[1] === \"column\") {\n tokens = cmd.match(/rotate column x=(\\d+) by (\\d+)/ );\n this.rotateColumnBits( tokens[1], tokens[2] );\n\n } else {\n // bad data!\n }\n }\n }", "title": "" }, { "docid": "0f7cb51236cb5f5aa6c037eb39da1a15", "score": "0.5873985", "text": "function moveCommand(direction) {\n var whatHappens;\n switch (direction) {\n case \"forward\":\n break;\n whatHappens = \"you encounter a monster\";\n case \"back\":\n whatHappens = \"you arrived home\";\n break;\n break;\n case \"right\":\n whatHappens = \"you found a river\";\n break;\n case \"left\":\n break;\n whatHappens = \"you run into a troll\";\n break;\n default:\n whatHappens = \"please enter a valid direction\";\n }\n return whatHappens;\n}", "title": "" }, { "docid": "e624abed7636f6784e0b99c62cd85bcb", "score": "0.58633095", "text": "function keyDown (event) {\r\n // console.log(event.keyCode);\r\n if (event.keyCode == 65) {\r\n rightPressed = true;\r\n } else if (event.keyCode == 68) {\r\n leftPressed = true;\r\n } else if (event.keyCode == 87) {\r\n upPressed = true;\r\n } else if (event.keyCode == 83) {\r\n downPressed = true;\r\n }\r\n}", "title": "" }, { "docid": "a4297064dd94e1474e83071d4801e09a", "score": "0.5860424", "text": "function keyDownHandler(e) {\n if(e.keyCode == 39) { \n rightPressed = true\n }\n else if(e.keyCode == 37) { \n leftPressed = true;\n }\n}", "title": "" }, { "docid": "5cfb217b6f58ec74574d628e00f514d5", "score": "0.58454907", "text": "checkKey(e) {\n if (e.keyCode == '87') { //up\n console.log(\"UP key pressed.\")\n this.moveFrog(0, -10);\n }\n else if (e.keyCode == '83') { //down\n console.log(\"DOWN key pressed.\")\n this.moveFrog(0, 10);\n }\n else if (e.keyCode == '65') { //left\n console.log(\"LEFT key pressed.\")\n this.moveFrog(-10, 0)\n }\n else if (e.keyCode == '68') { //right\n console.log(\"RIGHT key pressed.\")\n this.moveFrog(10, 0);\n }\n }", "title": "" }, { "docid": "08ec22fdf54bc58f874f0dd9d86e298f", "score": "0.58426225", "text": "function onKeyDown(evt) {\n if (evt.keyCode == 39) rightDown = true;\n else if (evt.keyCode == 37) leftDown = true;\n }", "title": "" }, { "docid": "927b3dba96f9233161dc9c001d1e0778", "score": "0.58178365", "text": "function control(e){\n if(e.keyCode === 37)\n {\n moveLeft();\n }\n\n else if(e.keyCode === 39)\n {\n moveRight();\n }\n else if(e.keyCode === 38)\n {\n rotate();\n }\n else if(e.keyCode === 40)\n {\n moveDown();\n }\n }", "title": "" }, { "docid": "8b229ce9c9df6c58e2eee4c1622fc544", "score": "0.5810844", "text": "function keyDownHandler(event) {\n if (event.keyCode == 39 || event.keyCode == 68) {\n rightPressed = true;\n }\n else if (event.keyCode == 37 || event.keyCode == 65) {\n leftPressed = true;\n }\n if (event.keyCode == 40 || event.keyCode == 83) {\n downPressed = true;\n }\n else if (event.keyCode == 32) {\n upPressed = true;\n }\n}", "title": "" }, { "docid": "a25d3d92f0ddb45962f87fad381bdf43", "score": "0.580909", "text": "function estado1(){\r\n\r\n \r\n\tif(keyCode === RIGHT_ARROW){\r\n\t\t\t\t uno.control(0);\r\n\t }else if(keyCode === LEFT_ARROW){\r\n\t\t\t uno.control(1); \r\n\t\t }\r\n\r\n}", "title": "" }, { "docid": "0b33b6ebf09b410252e9e449f827a0a9", "score": "0.5808515", "text": "function control(e) {\n if(e.keyCode === 37) {\n moveLeft()\n } else if (e.keyCode === 38) {\n rotate()\n } else if (e.keyCode === 39) {\n moveRight()\n } else if (e.keyCode === 40) {\n moveDown()\n }\n}", "title": "" }, { "docid": "826f0aa3a0d311a4f2d38e2b87fc18be", "score": "0.5798773", "text": "command(keys, exact = false) {\n \n // short-circuit check for exact\n if (exact && (keys.length !== this.pressed.length)) {\n return false\n }\n \n // check if all of our keys are pressed\n // short-circuits on failure\n for (let i = 0, ii = keys.length; i < ii; i++) {\n if (this.keys[keys[i]]) continue\n else return false\n }\n \n return true\n }", "title": "" }, { "docid": "9b3ce015eb629a7ad6a81b0ab65f5279", "score": "0.57974774", "text": "key(code) {\n switch (code) {\n case 0: {\n if (this.inputs.isDown(key_enum_1.KEY.UP)) {\n return true;\n }\n break;\n }\n case 1: {\n if (this.inputs.isDown(key_enum_1.KEY.DOWN)) {\n return true;\n }\n break;\n }\n case 2: {\n if (this.inputs.isDown(key_enum_1.KEY.LEFT)) {\n return true;\n }\n break;\n }\n case 3: {\n if (this.inputs.isDown(key_enum_1.KEY.RIGHT)) {\n return true;\n }\n break;\n }\n case 4: {\n if (this.inputs.isDown(key_enum_1.KEY.A)) {\n return true;\n }\n break;\n }\n case 5: {\n if (this.inputs.isDown(key_enum_1.KEY.B)) {\n return true;\n }\n break;\n }\n case 6: {\n if (this.inputs.isDown(key_enum_1.KEY.X)) {\n return true;\n }\n break;\n }\n case 7: {\n if (this.inputs.isDown(key_enum_1.KEY.Z)) {\n return true;\n }\n break;\n }\n default: {\n break;\n }\n }\n }", "title": "" }, { "docid": "0fe975021c21ca243713776ffe3c6819", "score": "0.579487", "text": "function keyDownHandler(e)\n{\n\tif (e.keyCode == 39)\n\t{\n\t\trightPressed = true;\n\t}\n\telse if (e.keyCode == 37)\n\t{\n\t\tleftPressed = true;\n\t}\n}", "title": "" }, { "docid": "e989f327f92e7c0c01afcc93c9915453", "score": "0.5789848", "text": "function moveCommand(direction) { \n var whatHappens;\n switch (direction) {\n case \"forward\":\n break;\n whatHappens = \"you encounter a monster\";\n case \"back\":\n whatHappens = \"you arrived home\";\n break;\n break;\n case \"right\":\n return whatHappens = \"you found a river\";\n break;\n case \"left\":\n break;\n whatHappens = \"you run into a troll\";\n break;\n default:\n whatHappens = \"please enter a valid direction\";\n }\n return whatHappens;\n}", "title": "" }, { "docid": "0f477d9c3113ef2670a296f1c843e740", "score": "0.5789268", "text": "function m_tt_Extm_CmdEnum()\n{\n\tvar s;\n\n\t// Add new command(s) to the commands enum\n\tfor(var i in config_menu)\n\t{\n\t\ts = \"window.\" + i.toString().toUpperCase();\n\t\tif(eval(\"typeof(\" + s + \") == m_tt_u\"))\n\t\t{\n\t\t\teval(s + \" = \" + m_tt_aV.length);\n\t\t\tm_tt_aV[m_tt_aV.length] = null;\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7218ea9f72c13e7fd377deef2d5d652c", "score": "0.57888156", "text": "function control(e) {\n if(e.keyCode === 37) {\n moveLeft()\n } else if (e.keyCode === 38) {\n rotate()\n }\n else if (e.keyCode === 39) {\n moveRight()\n }\n else if (e.keyCode === 40) {\n moveDown()\n }\n}", "title": "" }, { "docid": "d1b0384919884fb594704d5d97464ea2", "score": "0.578655", "text": "function moveCommand(direction) {\n var whatHappens;\n switch (direction) {\n case \"forward\":\n break;\n whatHappens = \"you encounter a monster\";\n case \"back\":\n whatHappens = \"you arrived home\";\n break;\n break;\n case \"right\":\n return whatHappens = \"you found a river\";\n break;\n case \"left\":\n break;\n return whatHappens = \"you run into a troll\";\n break;\n default:\n whatHappens = \"please enter a valid direction\";\n }\n return whatHappens;\n}", "title": "" }, { "docid": "f92bd1c03ccf327eadaa9e46b279264d", "score": "0.57824993", "text": "function keyDownHandler(e) {\n if(e.keyCode == 39) {\n rightPressed = true;\n } else if(e.keyCode == 37) {\n leftPressed = true;\n }\n}", "title": "" }, { "docid": "f0616bc21f73a147f2e07831fc71c077", "score": "0.5778893", "text": "function keyDownHandler(e){\r\n if(e.keyCode == 39){\r\n rightPressed = true;\r\n }\r\n else if(e.keyCode == 37){\r\n leftPressed = true;\r\n }\r\n }", "title": "" }, { "docid": "e58c55e740590740b7a6952bfb02bd0f", "score": "0.57769895", "text": "function moveCommand(direction) {\n var whatHappens;\n switch (direction) {\n case \"forward\":\n break;\n whatHappens = \"you encounter a monster\";\n case \"back\":\n whatHappens = \"you arrived home\";\n break;\n break;\n case \"right\":\n return whatHappens = \"you found a river\";\n break;\n case \"left\":\n break;\n whatHappens = \"you run into a troll\";\n break;\n default:\n whatHappens = \"please enter a valid direction\";\n }\n return whatHappens;\n}", "title": "" }, { "docid": "e58c55e740590740b7a6952bfb02bd0f", "score": "0.57769895", "text": "function moveCommand(direction) {\n var whatHappens;\n switch (direction) {\n case \"forward\":\n break;\n whatHappens = \"you encounter a monster\";\n case \"back\":\n whatHappens = \"you arrived home\";\n break;\n break;\n case \"right\":\n return whatHappens = \"you found a river\";\n break;\n case \"left\":\n break;\n whatHappens = \"you run into a troll\";\n break;\n default:\n whatHappens = \"please enter a valid direction\";\n }\n return whatHappens;\n}", "title": "" }, { "docid": "e58c55e740590740b7a6952bfb02bd0f", "score": "0.57769895", "text": "function moveCommand(direction) {\n var whatHappens;\n switch (direction) {\n case \"forward\":\n break;\n whatHappens = \"you encounter a monster\";\n case \"back\":\n whatHappens = \"you arrived home\";\n break;\n break;\n case \"right\":\n return whatHappens = \"you found a river\";\n break;\n case \"left\":\n break;\n whatHappens = \"you run into a troll\";\n break;\n default:\n whatHappens = \"please enter a valid direction\";\n }\n return whatHappens;\n}", "title": "" }, { "docid": "eefc28d75015144054312d8b9d216812", "score": "0.57726943", "text": "function keyDownHandler(e) {\n if(e.keyCode == 39) {\n rightPressed = true;\n }\n else if(e.keyCode == 37) {\n leftPressed = true;\n }\n}", "title": "" }, { "docid": "eefc28d75015144054312d8b9d216812", "score": "0.57726943", "text": "function keyDownHandler(e) {\n if(e.keyCode == 39) {\n rightPressed = true;\n }\n else if(e.keyCode == 37) {\n leftPressed = true;\n }\n}", "title": "" }, { "docid": "59bd048006534b78af5d4e075ec057ba", "score": "0.57716143", "text": "function keyDownHandler(e){\n if(e.keyCode == 39){\n rightPressed = true;\n }\n else if (e.keyCode == 37){\n leftPressed = true;\n }\n}", "title": "" }, { "docid": "33fe0c3a5e5f045c3278a162d979f315", "score": "0.5756613", "text": "function onKeyDown(evt) {\n if (evt.keyCode == 39) rightDown = true;\n else if (evt.keyCode == 37) leftDown = true;\n }", "title": "" }, { "docid": "0a27d3439629dd478523bb0f305489e7", "score": "0.5755185", "text": "function getDirection(key){\r\n\tif(key.keyCode==left && dir!=right)\r\n {\r\n \tdir=left;\r\n \tleftm.play();\r\n }\r\n else if(key.keyCode==right && dir!=left)\r\n {\r\n\r\n \tdir=right;\r\n \trightm.play();\r\n }\r\n else if(key.keyCode==up && dir!=down)\r\n {\r\n \tdir=up;\r\n \tupm.play();\r\n }\r\n else if(key.keyCode==down && dir!=up)\r\n {\r\n \tdir=down;\r\n \tdownm.play();\r\n }\r\n}", "title": "" }, { "docid": "497de7d69dee8286f8190c39abb8445e", "score": "0.5753436", "text": "handleKeyDown(e){\n let key = e.which;\n switch(key){\n case 87:\n merge(this.actions, {up: true, down: false});\n break;\n case 68:\n merge(this.actions, {right: true});\n break;\n case 65:\n merge(this.actions, {left: true});\n break;\n case 83:\n merge(this.actions, {down: true, up: false});\n break;\n case 84:\n merge(this.actions, {shoot: true});\n break;\n }\n }", "title": "" }, { "docid": "1778df1aaa0e49a71658a74107381cd0", "score": "0.57512194", "text": "function anyMoveKey(){\n\treturn (keys[upKey] || keys[downKey] || keys[leftKey] || keys[rightKey])\n}", "title": "" }, { "docid": "1778df1aaa0e49a71658a74107381cd0", "score": "0.57512194", "text": "function anyMoveKey(){\n\treturn (keys[upKey] || keys[downKey] || keys[leftKey] || keys[rightKey])\n}", "title": "" }, { "docid": "df7a182e1201da318e16f02d0db49ed9", "score": "0.5748077", "text": "function control(e) {\r\n if (e.keyCode === 37) {\r\n moveLeft();\r\n } else if (e.keyCode === 38) {\r\n rotate();\r\n } else if (e.keyCode === 39) {\r\n moveRight();\r\n } else if (e.keyCode === 40) {\r\n moveDown();\r\n }\r\n }", "title": "" }, { "docid": "1b2b16ae94164396b18d5330d1887812", "score": "0.57469887", "text": "function control (e){\r\n if(e.keyCode ===37){\r\n moveLeft()\r\n \r\n }else if (e.keyCode === 38){\r\n rotate()\r\n }else if(e.keyCode=== 39){\r\n moveRight()\r\n }else if(e.keyCode===40){\r\n moveDown()\r\n }\r\n}", "title": "" }, { "docid": "27b1ae5b7eada16e3bfd69af0a4d066b", "score": "0.5717417", "text": "function inputCommandIs(command)\n {\n var input = my.html.input.value\n return input.substring(input.length - command.length) == command\n }", "title": "" }, { "docid": "245ede0ecc39fce6a256dd956ad13610", "score": "0.5713017", "text": "function control(event) {\n if(event.keyCode === 37) {\n moveLeft();\n } else if (event.keyCode === 38) {\n rotate();\n } else if (event.keyCode === 39) {\n moveRight();\n } else if (event.keyCode === 40) {\n moveDown();\n }\n }", "title": "" }, { "docid": "06f95850fcf4b1ed2e0ee37794c06a33", "score": "0.5705335", "text": "switch(key) {\n case \"ArrowRight\": moveCaret(caret+1, shiftKey); break;\n case \"ArrowLeft\": moveCaret(caret-1, shiftKey); break;\n case \"ArrowUp\": break;\n case \"ArrowDown\": break;\n case \"C\": break;//TODO : copy\n case \"V\": break;//TODO : paste\n case \"X\": break;//TODO : cut\n default: break;\n }", "title": "" }, { "docid": "0006d880967f35eac6591aaaf121d1a6", "score": "0.56989324", "text": "function handleCommand(command,robot,table,tableEle)\n\t{\n\t\tvar isHandled=true;\n\t\tif(command.match(/^\\d+,*\\d+,[a-zA-Z]+$/i)!=null)\n\t\t{\n\t\t\tcommandAr=command.split(/,/ig);\n\t\t\tx=parseInt(commandAr[0]);\n\t\t\ty=parseInt(commandAr[1]);\n\t\t\tfacing=commandAr[2];\n\t\t\tvar isPlaced=commandInvoker.execute(commandList[0],robot,table,[x,y,facing]);\n\t\t\t//to update the view\n\t\t\tif(isPlaced)\n\t\t\t{\n\t\t\t\tupdateView(robot,table,tableEle);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tisHandled=false;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\telse if(command.match(/^Move$/i)!=null)\n\t\t{\n\t\t\tvar isMoved=commandInvoker.execute(commandList[1],robot,table,[]);\n\t\t\t//to update the view\n\t\t\tif(isMoved)\n\t\t\t{\n\t\t\t\tupdateView(robot,table,tableEle);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tisHandled=false;\n\t\t\t}\n\t\t}\n\t\telse if(command.match(/^Left$/i)!=null)\n\t\t{\n\t\t\tvar isTurned=commandInvoker.execute(commandList[2],robot,table,[]);\n\t\t\tif(isTurned)\n\t\t\t{\n\t\t\t\taddDegree(\"robotText\",robot.facing);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tisHandled=false;\n\t\t\t}\n\t\t}\n\t\telse if(command.match(/^Right$/i)!=null)\n\t\t{\n\t\t\tvar isTurned=commandInvoker.execute(commandList[3],robot,table,[]);\n\t\t\tif(isTurned)\n\t\t\t{\n\t\t\t\taddDegree(\"robotText\",robot.facing);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tisHandled=false;\n\t\t\t}\n\t\t}\n\t\telse if(command.match(/^Report$/i)!=null)\n\t\t{\n\t\t var reportText=commandInvoker.execute(commandList[4],robot,table,[]);\n\t\t if(reportText!=false)\n\t\t {\n\t\t \talert(reportText);\n\t\t }\n\t\t else\n\t\t\t{\n\t\t\t\tisHandled=false;\n\t\t\t}\n\t\t}\n\t\telse if(command.match(/^Place$/i)!=null)\n\t\t{\n\t\t\t//skip\n\t\t}\n\t\telse\n\t\t{\n\t\t\talert(\"Invalid command: \"+command);\n\t\t\tisHandled=false;\n\t\t}\n\t\treturn isHandled;\n\t}", "title": "" }, { "docid": "41569b45973c79129b0d51fe59bc756f", "score": "0.56981885", "text": "function keyUp (event) {\r\n if (event.keyCode == 65) {\r\n rightPressed = false;\r\n } else if (event.keyCode == 68) {\r\n leftPressed = false; \r\n } else if (event.keyCode == 87) {\r\n upPressed = false;\r\n } else if (event.keyCode == 83) {\r\n downPressed = false;\r\n }\r\n}", "title": "" }, { "docid": "c468c19d006e0964236bc65994b2119e", "score": "0.56954294", "text": "function keyDownHandler(e)\n{\n if(e.keyCode === 39) {rightPressed = true;}\n if(e.keyCode === 37) {leftPressed = true;}\n if(e.keyCode === 38) {upPressed = true;}\n if(e.keyCode === 40) {downPressed = true;}\n}", "title": "" }, { "docid": "66eab7763e051a8e50965b77c972ecc4", "score": "0.56929255", "text": "function control(e) {\n if (e.keyCode === 37) {\n moveLeft();\n } else if (e.keyCode === 38) {\n rotate();\n } else if (e.keyCode === 39) {\n moveRight();\n } else if (e.keyCode === 40) {\n moveDown();\n }\n }", "title": "" }, { "docid": "fb65040a37bdbc3d42db6a0a00a790f3", "score": "0.568621", "text": "function switchCommand(){\n\tswitch(command){\n\t\tcase \"my-tweets\":\n\t\t\tmyTweets();\n\t\t\tbreak;\n\t\tcase \"spotify-this-song\":\n\t\t\tspotifyThisSong(userChoice);\n\t\t\tbreak;\n\t\tcase \"movie-this\":\n\t\t\tmovieThis(userChoice);\n\t\t\tbreak;\n\t\tcase \"do-what-it-says\":\n\t\t\tdoWhatItSays();\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tconsole.log(\"Please enter a valid command.\");\n\t\t\tconsole.log('\"my-tweets\", \"spotify-this-song\", \"movie-this\", \"do-what-it-says\"');\n\t\t\tbreak;\n\t}\n}", "title": "" }, { "docid": "98addbac7245bbce7d1714b075e97bd5", "score": "0.56794786", "text": "function control(e) {\n if (e.keyCode === 37) {\n moveLeft();\n } else if (e.keyCode === 38) {\n rotate();\n } else if (e.keyCode === 39) {\n moveRight();\n } else if (e.keyCode === 40) {\n moveDown();\n }\n}", "title": "" }, { "docid": "af884f5f38be8bf8e0b0b0f5deb54254", "score": "0.5677716", "text": "function myCommands (commandList) {\r\n for (i=0 ; i<commandList.length ; i++) {\r\n moveEnemy(i);\r\n var command = commandList[i];\r\n switch (command) {\r\n case \"l\":\r\n turnLeft(myRover);\r\n break;\r\n case \"r\":\r\n turnRight(myRover);\r\n break;\r\n case \"f\":\r\n moveForward(myRover);\r\n break;\r\n case \"b\":\r\n moveBackward(myRover);\r\n break;\r\n default:\r\n break;\r\n }\r\n console.log(\"------------------------------\");\r\n }\r\n console.log (\"These are the coordinates of all the places myRover has been:\");\r\n console.log (myRover.travelLog);\r\n}", "title": "" }, { "docid": "2b499bc08ea5c2a1194a222e144bb564", "score": "0.56761146", "text": "function whichKey(e) {\n\t \te.preventDefault();\n\t var code = (e.keyCode ? e.keyCode : e.which);\n\t switch (code){\n\t case 40:\n\t mooveDown();\n\t break;\n\t case 38:\n\t \tmooveUp();\n\t break;\n\t case 37:\n\t alert(\"left\");\n\t break;\n\t case 39:\n\t mooveRight();\n\t break;\n\t }\n\t \n\t }", "title": "" }, { "docid": "7cb50efe1ec1542947f34a8e041ccd63", "score": "0.56755954", "text": "function control(e){\n if(e.keyCode === 37){\n moveLeft();\n }else if(e.keyCode ===38){\n rotate();\n }else if(e.keyCode === 39){\n moveRight();\n }else if(e.keyCode === 40){\n moveDown();\n }\n }", "title": "" }, { "docid": "c61737553ba0c39f2d2220e8aa09c270", "score": "0.56724894", "text": "function control(e)\r\n {\r\n if(e.keyCode === 37)\r\n {\r\n moveLeft()\r\n }\r\n else if(e.keyCode === 38)\r\n {\r\n rotate()\r\n }\r\n else if(e.keyCode === 39)\r\n {\r\n moveRight()\r\n }\r\n else if(e.keyCode === 40)\r\n {\r\n moveDown()\r\n }\r\n }", "title": "" }, { "docid": "cba74db7eedc902bbfa2374013c7a212", "score": "0.566973", "text": "function control(e) {\n\n switch (e.keyCode) {\n case 39: // a la derecha\n direction = 1\n break;\n case 38: //hacia arriba\n direction = -width\n break;\n case 40: //hacia abajo\n direction= width\n break;\n case 37: // a la izquierda\n direction = -1\n break;\n default:\n break;\n }\n}", "title": "" }, { "docid": "53f200b8de17fde605aaac70a14097b1", "score": "0.5664756", "text": "function control(e) {\n if(e.keyCode === 37) {\n keyLeft()\n } else if (e.keyCode === 38) {\n keyUp()\n } else if (e.keyCode === 39) {\n keyRight()\n } else if (e.keyCode === 40) {\n keyDown()\n }\n }", "title": "" }, { "docid": "33a50c06a2fbd37561b55d583945d8df", "score": "0.56589085", "text": "function isNavigationCommand(obj) {\r\n return obj && typeof obj.navigate === 'function';\r\n}", "title": "" }, { "docid": "461232bf5c5bef0b1c6ab55245ba1c9e", "score": "0.56563205", "text": "isCommandEnabled(command) {\n var enabled = true;\n\n switch (command) {\n case \"open_in_folder_button\":\n if (gFolderDisplay.selectedCount != 1) {\n enabled = false;\n }\n break;\n case \"cmd_delete\":\n case \"cmd_shiftDelete\":\n case \"button_delete\":\n // this assumes that advanced searches don't cross accounts\n if (gFolderDisplay.selectedCount <= 0) {\n enabled = false;\n }\n break;\n case \"saveas_vf_button\":\n // need someway to see if there are any search criteria...\n return true;\n case \"cmd_selectAll\":\n return true;\n default:\n if (gFolderDisplay.selectedCount <= 0) {\n enabled = false;\n }\n break;\n }\n\n return enabled;\n }", "title": "" }, { "docid": "728ea3c5f1febf9920f25edb0be0e9c4", "score": "0.56554055", "text": "function setButtonCommand(str){\n var tmp = str.split(\":\", 2)\n var id = tmp[0]\n var on = tmp[1]\n \n if(on == 0){//key up, stop\n cmd = commands.STOP;\n }else{//key down\n switch(id){\n case 'Y': cmd = comands.BALL_SCREW_DN;\n break;\n case 'B': cmd = commands.BALL_SCREW_UP;\n break;\n case 'A': cmd = commands.TURN_AUGUR_CLOCKWISE;;\n break;\n case 'X': cmd = commands.TURN_AUGUR_COUNTER_CLOCKWISE;\n break;\n \n case \"ZR\": cmd = commands.RAISE_F;\n break;\n case 'R': cmd = commands.LOWER_F;\n break;\n case \"ZL\": cmd = commands.CONVEYOR_COLLECT;\n break;\n case 'L': cmd = commands.CONVEYOR_DUMP;\n break;\n \n //keep consistent with tether.js\n case \"PLUS\": cmd = commands.INCREASE_SPEED;\n break;\n case 'MINUS': cmd = commands.DECREASE_SPEED;\n break;\n \n //more cases go here\n }\n }\n}", "title": "" }, { "docid": "1f4584680a8c2ed9f35b96307fbf23d5", "score": "0.56507796", "text": "function isKeypressCommand(nativeEvent){return (nativeEvent.ctrlKey||nativeEvent.altKey||nativeEvent.metaKey)&&// ctrlKey && altKey is equivalent to AltGr, and is not a command.\n!(nativeEvent.ctrlKey&&nativeEvent.altKey);}", "title": "" }, { "docid": "e8c4ec490835235c5525d525a27854cc", "score": "0.5648162", "text": "function moveCommand(direction) {\n\t\tvar whatHappens;\n\t\tswitch(direction){\n\t\t\tcase \"forward\":\n\t\t\t\twhatHappens = \"you encounter a monster\";\n\t\t\t\tbreak; //--> break out of switch statement if this case is true\n\t\t\tcase \"back\":\n\t\t\t\twhatHappens = \"you arrived home\";\n\t\t\t\tbreak; //--> break out of switch statement if this case is true\n\t\t\tcase \"right\":\n\t\t\t\twhatHappens = \"you found a river\";\n\t\t\t\tbreak;//--> break out of switch statement if this case is true\n\t\t\tcase \"left\":\n\t\t\t\twhatHappens = \"you run into a troll\";\n\t\t\t\tbreak;//--> break out of switch statement if this case is true\n\t\t\tdefault:\n\t\t\t\twhatHappens = \"please enter valid direction\"\n\t\t}\n\t\treturn whatHappens;\n\t}", "title": "" }, { "docid": "954e0e0c2f893f8e159d586927f31de1", "score": "0.5646929", "text": "function isKeypressCommand(nativeEvent){return(nativeEvent.ctrlKey||nativeEvent.altKey||nativeEvent.metaKey)&&// ctrlKey && altKey is equivalent to AltGr, and is not a command.\n!(nativeEvent.ctrlKey&&nativeEvent.altKey);}", "title": "" }, { "docid": "954e0e0c2f893f8e159d586927f31de1", "score": "0.5646929", "text": "function isKeypressCommand(nativeEvent){return(nativeEvent.ctrlKey||nativeEvent.altKey||nativeEvent.metaKey)&&// ctrlKey && altKey is equivalent to AltGr, and is not a command.\n!(nativeEvent.ctrlKey&&nativeEvent.altKey);}", "title": "" }, { "docid": "954e0e0c2f893f8e159d586927f31de1", "score": "0.5646929", "text": "function isKeypressCommand(nativeEvent){return(nativeEvent.ctrlKey||nativeEvent.altKey||nativeEvent.metaKey)&&// ctrlKey && altKey is equivalent to AltGr, and is not a command.\n!(nativeEvent.ctrlKey&&nativeEvent.altKey);}", "title": "" }, { "docid": "954e0e0c2f893f8e159d586927f31de1", "score": "0.5646929", "text": "function isKeypressCommand(nativeEvent){return(nativeEvent.ctrlKey||nativeEvent.altKey||nativeEvent.metaKey)&&// ctrlKey && altKey is equivalent to AltGr, and is not a command.\n!(nativeEvent.ctrlKey&&nativeEvent.altKey);}", "title": "" }, { "docid": "954e0e0c2f893f8e159d586927f31de1", "score": "0.5646929", "text": "function isKeypressCommand(nativeEvent){return(nativeEvent.ctrlKey||nativeEvent.altKey||nativeEvent.metaKey)&&// ctrlKey && altKey is equivalent to AltGr, and is not a command.\n!(nativeEvent.ctrlKey&&nativeEvent.altKey);}", "title": "" }, { "docid": "954e0e0c2f893f8e159d586927f31de1", "score": "0.5646929", "text": "function isKeypressCommand(nativeEvent){return(nativeEvent.ctrlKey||nativeEvent.altKey||nativeEvent.metaKey)&&// ctrlKey && altKey is equivalent to AltGr, and is not a command.\n!(nativeEvent.ctrlKey&&nativeEvent.altKey);}", "title": "" }, { "docid": "954e0e0c2f893f8e159d586927f31de1", "score": "0.5646929", "text": "function isKeypressCommand(nativeEvent){return(nativeEvent.ctrlKey||nativeEvent.altKey||nativeEvent.metaKey)&&// ctrlKey && altKey is equivalent to AltGr, and is not a command.\n!(nativeEvent.ctrlKey&&nativeEvent.altKey);}", "title": "" }, { "docid": "954e0e0c2f893f8e159d586927f31de1", "score": "0.5646929", "text": "function isKeypressCommand(nativeEvent){return(nativeEvent.ctrlKey||nativeEvent.altKey||nativeEvent.metaKey)&&// ctrlKey && altKey is equivalent to AltGr, and is not a command.\n!(nativeEvent.ctrlKey&&nativeEvent.altKey);}", "title": "" }, { "docid": "954e0e0c2f893f8e159d586927f31de1", "score": "0.5646929", "text": "function isKeypressCommand(nativeEvent){return(nativeEvent.ctrlKey||nativeEvent.altKey||nativeEvent.metaKey)&&// ctrlKey && altKey is equivalent to AltGr, and is not a command.\n!(nativeEvent.ctrlKey&&nativeEvent.altKey);}", "title": "" }, { "docid": "954e0e0c2f893f8e159d586927f31de1", "score": "0.5646929", "text": "function isKeypressCommand(nativeEvent){return(nativeEvent.ctrlKey||nativeEvent.altKey||nativeEvent.metaKey)&&// ctrlKey && altKey is equivalent to AltGr, and is not a command.\n!(nativeEvent.ctrlKey&&nativeEvent.altKey);}", "title": "" }, { "docid": "954e0e0c2f893f8e159d586927f31de1", "score": "0.5646929", "text": "function isKeypressCommand(nativeEvent){return(nativeEvent.ctrlKey||nativeEvent.altKey||nativeEvent.metaKey)&&// ctrlKey && altKey is equivalent to AltGr, and is not a command.\n!(nativeEvent.ctrlKey&&nativeEvent.altKey);}", "title": "" }, { "docid": "cdf40da756c06b57ff892f4f822010fc", "score": "0.56391776", "text": "function onKeyUp(event) {\n\n switch (event.key) {\n\n case \"ArrowLeft\":\n moveLeft = false;\n break;\n case \"ArrowRight\":\n moveRight = false;\n break;\n \n default:\n break;\n\n } \n\n}", "title": "" }, { "docid": "e19927897845b3c12d19f8b0fe119feb", "score": "0.56382626", "text": "function keyPressed() {\n console.log(key);\n if (key == 'W' || key == \"w\") {\n left.move(-10);\n } else if (key == 'S' || key == \"s\") {\n left.move(10);\n }\n\n if (key == 'ArrowUp') {\n right.move(-10);\n } else if (key == 'ArrowDown') {\n right.move(10);\n }\n}", "title": "" }, { "docid": "fcdd6b2be233158e69ce0ea620012cba", "score": "0.56354666", "text": "function handlerKeyDown(e){\n if(e.keyCode === 37){\n leftPressed = true;\n }else if(e.keyCode === 39){\n rightPressed = true;\n }\n }", "title": "" }, { "docid": "2c8f0a1979d6e8e8ccdf3c798575c69d", "score": "0.5631261", "text": "function keydown(e) {\r\n if (e.keyCode == \"38\") {\r\n // called the function according to the requirement\r\n moveup();\r\n } else if (e.keyCode == \"40\") {\r\n movedown();\r\n } else if (e.keyCode == \"37\") {\r\n moveleft();\r\n } else if (e.keyCode == \"39\") {\r\n moveright();\r\n }\r\n}", "title": "" }, { "docid": "54d187685bd618a3ace227b52f359e88", "score": "0.5629201", "text": "function keyDownHandler(e){\n\tif(e.keyCode == 39){\n\t\tconsole.log(\"Left\");\n\t\trightPressed = true;\n\t}\n\telse if(e.keyCode == 37){\n\t\tconsole.log(\"Right\");\n\t\tleftPressed = true;\n\t}\n}", "title": "" }, { "docid": "3df8d76afd6fca07d3a46cd4327e7da4", "score": "0.5624338", "text": "function isNavigationCommand(obj) {\n return obj && typeof obj.navigate === 'function';\n}", "title": "" }, { "docid": "43ab04d2f2990d4195d917afcfeb3fba", "score": "0.56226075", "text": "runCmd() {\n switch(this.command) {\n case \"concert-this\":\n this.concertThis();\n break;\n case \"spotify-this-song\":\n this.spotifyThisSong();\n break;\n case \"movie-this\":\n this.movieThis();\n break;\n case \"do-what-it-says\":\n this.doWhatItSays();\n break;\n case undefined:\n this.usage();\n return false;\n default:\n console.log(`Unable to understand the command \"${this.command}\"\\n`);\n this.usage();\n return false;\n }\n\n return true;\n }", "title": "" }, { "docid": "aad4737cf93a97d09fc3647b17c1602c", "score": "0.5621779", "text": "function isKeypressCommand(nativeEvent){return (nativeEvent.ctrlKey||nativeEvent.altKey||nativeEvent.metaKey)&& // ctrlKey && altKey is equivalent to AltGr, and is not a command.\n!(nativeEvent.ctrlKey&&nativeEvent.altKey);}", "title": "" }, { "docid": "25c115b4b836fa81583ebf21f7ec0cda", "score": "0.56204057", "text": "function getRealDirection(key) {\n if (key === up_key)\n return 'UP';\n if (key === down_key)\n return 'DOWN';\n if (key === left_key || typeof (key) === 'undefined')\n return 'LEFT';\n if (key === right_key)\n return 'RIGHT';\n}", "title": "" }, { "docid": "1d6b2afc368c71558efc8ae42dcc5c8d", "score": "0.56158584", "text": "function give_up(){\n // if button on line \n}", "title": "" }, { "docid": "ed807e1c84bd82dfd90008fb2759b3c8", "score": "0.5615802", "text": "move(direction, $event) {\n const action = {\n true: 'attack',\n false: 'move'\n }[$event.shiftKey]\n\n this.$http.post(`/api/actions/${action}`, {to: direction}).then(res => {\n if (217 !== res.status) {\n return\n }\n this.character.levelUp(res.data.message).then(function (event) {\n // TODO\n // sth.apply(event, args)\n console.warn(event)\n })\n })\n }", "title": "" }, { "docid": "56054d13dc5f43a1831dafa6e1867cfe", "score": "0.56134516", "text": "function _isMenuThere(cmd) {\n return Menus.getMenuItem(editorContextMenu.id + \"-\" + cmd) ? true : false;\n }", "title": "" }, { "docid": "1ecd29f91fc4bc343796f3113d3ee23c", "score": "0.5613354", "text": "get validCommands() {\n return [\n \"backColor\",\n \"bold\",\n \"createLink\",\n \"copy\",\n \"cut\",\n \"defaultParagraphSeparator\",\n \"delete\",\n \"fontName\",\n \"fontSize\",\n \"foreColor\",\n \"formatBlock\",\n \"forwardDelete\",\n \"insertHorizontalRule\",\n \"insertHTML\",\n \"insertImage\",\n \"insertLineBreak\",\n \"insertOrderedList\",\n \"insertParagraph\",\n \"insertText\",\n \"insertUnorderedList\",\n \"justifyCenter\",\n \"justifyFull\",\n \"justifyLeft\",\n \"justifyRight\",\n \"outdent\",\n \"paste\",\n \"redo\",\n \"selectAll\",\n \"strikethrough\",\n \"styleWithCss\",\n \"superscript\",\n \"undo\",\n \"unlink\",\n \"useCSS\",\n ];\n }", "title": "" }, { "docid": "4e469f0d3ca04041b7915305e3de321c", "score": "0.56013834", "text": "function control (e) {\n if (e.keyCode === 37 || e.keyCode === 65) moveLeft()\n if (e.keyCode === 39 || e.keyCode === 68) moveRight()\n if (e. keyCode === 38 || e.keyCode === 87) rotate()\n if (e.keyCode === 40 || e.keyCode == 83) moveDown()\n }", "title": "" }, { "docid": "dc16d1c45b7b05d3d3982deb3371e723", "score": "0.55935663", "text": "function checkHeldKeys() {\n\n if (downIsHeld) {\n ship.moveDown();\n }\n if (upIsHeld) {\n ship.moveUp();\n }\n if (rightIsHeld) {\n ship.moveRight();\n }\n if (leftIsHeld) {\n ship.moveLeft();\n }\n\n}", "title": "" }, { "docid": "3dba82215a04699e7be40c61ca1124a8", "score": "0.5591964", "text": "function check_inputs() {\n // Left\n if (input_a.isDown\n || input_left.isDown) {\n action_left = true;\n } else {\n action_left = false;\n }\n\n // RIGHT\n if (input_d.isDown\n || input_right.isDown) {\n action_right = true;\n } else {\n action_right = false;\n }\n\n // Up\n if (input_w.isDown\n || input_up.isDown) {\n action_up = true;\n } else {\n action_up = false;\n }\n\n // Down\n if (input_s.isDown\n || input_down.isDown) {\n action_down = true;\n } else {\n action_down = false;\n }\n }", "title": "" }, { "docid": "74a978503441c9b6cc2d0cc3f84098cc", "score": "0.5591142", "text": "function processCommand(c) {\n var cmd = c[\"cmd\"]\n var key = c[\"key\"]\n\n switch (cmd) {\n case \"add\": add(key, c[\"title\"], c[\"x\"], c[\"y\"]); break;\n case \"move\": move_to(key, c[\"x\"], c[\"y\"]); break;\n //case \"set_pos_to\": set_pos_to(key, c[\"x\"], c[\"y\"]); break;\n case \"remove\": remove(key); break;\n case \"link\": add_link(c[\"from\"], c[\"to\"]); break;\n case \"change\": change(c[\"key\"], c[\"title\"])\n }\n}", "title": "" } ]
67d2e91fa39084ff9b5146d176e42cdb
import router from '../router/index.js'
[ { "docid": "e3b15cd4dc5eb22d19dcaa382b67e672", "score": "0.0", "text": "function getCookie(name) {\n let cookieValue = null;\n if (document.cookie && document.cookie !== '') {\n const cookies = document.cookie.split(';');\n for (let i = 0; i < cookies.length; i++) {\n const cookie = cookies[i].trim();\n // Does this cookie string begin with the name we want?\n if (cookie.substring(0, name.length + 1) === (name + '=')) {\n cookieValue = decodeURIComponent(cookie.substring(name.length + 1));\n break;\n }\n }\n }\n return cookieValue;\n}", "title": "" } ]
[ { "docid": "600ee0fe9ed658b0ffd38f69bd3f0cf8", "score": "0.6997558", "text": "constructor(router) {\n this.router = router;\n }", "title": "" }, { "docid": "bed65a6285c776c39310b9cdbdbd71f5", "score": "0.6835864", "text": "setRoutes() {\n require('./Routes')(app)\n }", "title": "" }, { "docid": "3052c069b03543fe5179cd2785a299c4", "score": "0.68308467", "text": "constructor(){\n this.router;\n }", "title": "" }, { "docid": "a57d7c58abc77a3baec1e87e12f55f3f", "score": "0.67581594", "text": "function Router() {}", "title": "" }, { "docid": "a57d7c58abc77a3baec1e87e12f55f3f", "score": "0.67581594", "text": "function Router() {}", "title": "" }, { "docid": "75bec4827f0a9d731936ad27b7f59eed", "score": "0.6637818", "text": "function loadRoutes() {\r\n require('./routes')\r\n}", "title": "" }, { "docid": "e49dcabbc3c694c6fb7b69cf0db1ae62", "score": "0.65636224", "text": "setupRouter() {\n this.router.setupRouter();\n }", "title": "" }, { "docid": "7c05c0c1ab3c1cb875270fcb7e19f283", "score": "0.65575826", "text": "function useRouter() {\n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.inject)(routerKey);\n}", "title": "" }, { "docid": "107c349bbd6dcc2f7a0540c38907478b", "score": "0.6531111", "text": "constructor (router) {\r\n this.router = router;\r\n this.router.configure(config => {\r\n config.title = 'Aurelia Node';\r\n config.map([\r\n { route : ['', 'home'], moduleId : './pages/home' }\r\n ]);\r\n });\r\n }", "title": "" }, { "docid": "d661ab9e8396a75fbff3513dc4bc6baf", "score": "0.6517966", "text": "function RouterModule(guard, router) {}", "title": "" }, { "docid": "04303a1ca3612e68d5a7f9ebd4868d3e", "score": "0.6506252", "text": "function Router() {\n}", "title": "" }, { "docid": "a492a604f6f6d11a42aeb5afab905e15", "score": "0.65016365", "text": "routes() {\n const router = express.Router();\n router.get('/', (req, res, next) => {\n res.json({\n message: 'A basic shopping NodeJS+Typescript api system'\n });\n });\n this.express.use('/', router);\n this.express.use('/api/heroes', HeroRouter_1.default);\n }", "title": "" }, { "docid": "1cc4e7a99e7cce147b9cd48c6e153421", "score": "0.64319324", "text": "constructor () {\n this.router = null\n }", "title": "" }, { "docid": "98099b604d28e48dc9a677c9c0881200", "score": "0.6393319", "text": "function useRouter() {\r\n return (0,runtime_core_esm_bundler/* inject */.f3)(routerKey);\r\n}", "title": "" }, { "docid": "73e7fedf199fe3fcbcc6bdfaf5272bd9", "score": "0.63227665", "text": "function prepare_router() {\n const router = express.Router();\n router.use('/local', localAuthRouter);\n router.use('/twitter', twitterRouter);\n router.use('/facebook', facebookRouter);\n router.use('/instagram', instagramRouter);\n module.exports = router;\n}", "title": "" }, { "docid": "4ea708dc34fe592aa71265fb2a240ffb", "score": "0.62930316", "text": "function RouterModule(guard, router) {\n }", "title": "" }, { "docid": "4ea708dc34fe592aa71265fb2a240ffb", "score": "0.62930316", "text": "function RouterModule(guard, router) {\n }", "title": "" }, { "docid": "4ea708dc34fe592aa71265fb2a240ffb", "score": "0.62930316", "text": "function RouterModule(guard, router) {\n }", "title": "" }, { "docid": "4ea708dc34fe592aa71265fb2a240ffb", "score": "0.62930316", "text": "function RouterModule(guard, router) {\n }", "title": "" }, { "docid": "4ea708dc34fe592aa71265fb2a240ffb", "score": "0.62930316", "text": "function RouterModule(guard, router) {\n }", "title": "" }, { "docid": "4ea708dc34fe592aa71265fb2a240ffb", "score": "0.62930316", "text": "function RouterModule(guard, router) {\n }", "title": "" }, { "docid": "4ea708dc34fe592aa71265fb2a240ffb", "score": "0.62930316", "text": "function RouterModule(guard, router) {\n }", "title": "" }, { "docid": "4ea708dc34fe592aa71265fb2a240ffb", "score": "0.62930316", "text": "function RouterModule(guard, router) {\n }", "title": "" }, { "docid": "4ea708dc34fe592aa71265fb2a240ffb", "score": "0.62930316", "text": "function RouterModule(guard, router) {\n }", "title": "" }, { "docid": "5b316603bbda232db4dd93c25baa85b9", "score": "0.62164825", "text": "registerRoutes() {\n this.get(`/`, `version`);\n }", "title": "" }, { "docid": "a7b65dba026f8df401cad7b4e231e3f5", "score": "0.61561245", "text": "constructor () {\n super();\n //The controller. This layer totaly decouples your app from expressjs. Controll the flow there\n this.controller = new Controller();\n //Set the entry point to be used latter on app.js\n this.entry = '/router';\n //Set custom response on router\n this.routerCustomResponse = (response) => {\n return [\n response\n ]\n }\n //Build the router\n this.build();\n }", "title": "" }, { "docid": "1f346c0b2430c3ba02cb3a977a0dd77e", "score": "0.61516887", "text": "initMasterRouter() {\n this._router.use(\"/test\", TestRouter_1.default);\n }", "title": "" }, { "docid": "d88f981e5b324222e9a5dc2dac5dc754", "score": "0.6129606", "text": "constructor() {\n this.root = '../../../';\n this.express = express();\n this.middleware();\n this.routes();\n }", "title": "" }, { "docid": "7e781b949845c306da3aa067e6c7b01b", "score": "0.61128247", "text": "route(router) {\n\t\trouter.get('/', this.controller.index.bind(this.app));\n\t}", "title": "" }, { "docid": "9bc749d564fa78d25f98a49bab0de1d7", "score": "0.6095002", "text": "get router() {\n // eslint-disable-next-line new-cap\n const router = Router();\n router.use(this.userAuthorizationMiddleware);\n router.get('/', this.getTeams);\n router.get('/:teamid', this.getTeam);\n router.put('/:teamid', this.updateTeam);\n router.post('/', this.createTeam);\n router.delete('/:teamid', this.deleteTeam);\n return router;\n }", "title": "" }, { "docid": "1deb3178ac305809734d17555da245e0", "score": "0.6091696", "text": "initRoutes() {\n // require(\"./routes/TestRoutes.js\")(this.server); // For learning Hapi!\n require(\"./routes/StarRoutes.js\")(this.server); // According to specifications\n // require(\"./BlockController.js\")(this.server); // For project 3\n\t}", "title": "" }, { "docid": "fe76930ed2ad38d76fdeb40e0fea6140", "score": "0.5959744", "text": "constructor(guard, router) { }", "title": "" }, { "docid": "a8af725eac1988f95cd7798727f85470", "score": "0.59227717", "text": "constructor(guard, router) {}", "title": "" }, { "docid": "727e1c427cd0f3de95acf41c4e3eb765", "score": "0.5911017", "text": "get router() { return this._router; }", "title": "" }, { "docid": "6ee1b9293905d4aa6b738ac7e1520433", "score": "0.5898579", "text": "get router() {\n // eslint-disable-next-line new-cap\n const router = Router();\n router.use(this.userAuthorizationMiddleware);\n router.get('/', this.getQuestions);\n router.get('/:id', this.getQuestion);\n router.put('/', this.updateQuestions);\n router.delete('/', this.deleteQuestions);\n router.post('/', this.addQuestions);\n router.post('/submit', this.submitResponse);\n router.post('/replay', this.replayEvents);\n return router;\n }", "title": "" }, { "docid": "a4ce9b776e5c43b76ec1fa5a614506d3", "score": "0.58925927", "text": "function App() {\n\n return (\n <BrowserRouter>\n <Switch>\n <Route exac path = '/' component = {Welcome}/>\n <Route path = '/playroom' component = {Play}/>\n\n </Switch>\n </BrowserRouter>\n );\n}", "title": "" }, { "docid": "a14dbdbd9b546a39741941f9906f44dc", "score": "0.5854698", "text": "importModulesRoutes() {\n this.glob.sync('api/modules/*/route.js').forEach((file) => {\n this.log.info(`Importando rotas de [${file}]`);\n require(this.path.resolve(file));\n });\n }", "title": "" }, { "docid": "d6f58f0fe1159a640af18d3233440196", "score": "0.5845712", "text": "function App() {\n return (\n <Router>\n <Switch>\n <Route path=\"/login\">\n <Login />\n </Route>\n <Route path=\"/class\">\n <ClassInfo />\n </Route>\n <Route path=\"/thongke\">\n <Analytics />\n </Route>\n <Route path=\"/teachers\">\n <ListTeacher />\n </Route>\n <Route path=\"/students\">\n <ListStudent />\n </Route>\n <Route path=\"/\">\n <ListClass />\n </Route>\n </Switch>\n </Router>\n );\n}", "title": "" }, { "docid": "08229f7d81760ffb3543085c58c02f15", "score": "0.5804975", "text": "function App() {\n return (\n <Router>\n <Switch>\n\t \t\t<Route exact path='/' component={TwilioIndex} />\n\t \t\t<Route exact path='/streamer' component={Streamer} />\n\t \t\t<Route exact path='/watch' component={Audience} />\n\t \t\t{/* <Route exact path='/signup' component={SignUp} />\n\t \t\t<Route exact path='/bucketlist' component={BucketList} />\n\t \t\t<Route exact path='/item' component={Item} />\n\t \t\t<Route exact path='/api/v1/api-docs' component={Swagger} />\n\t \t\t<Route path='' component={NotFound} /> */}\n\t\t\t</Switch>\n </Router>\n )\n}", "title": "" }, { "docid": "9bb0e271b865dd038033cf8810adfd83", "score": "0.5793199", "text": "routes() {\n this.server.use(routes);\n this.server.use(Sentry.Handlers.errorHandler());\n }", "title": "" }, { "docid": "dad2506d701677afeb2e06fef0e129bc", "score": "0.5792534", "text": "function AppRouter() {\n return (\n <Router>\n <Login path=\"/login\" />\n {/* <SignUp path=\"signup\" /> */}\n <Dashboard path=\"/*\" />\n </Router>\n );\n}", "title": "" }, { "docid": "9fad24404fe4ec5abd9706078675c8d2", "score": "0.57804406", "text": "function Router () {\n return (\n <Switch>\n <Route exact path=\"/\" component={Dashboard} />\n <Route path=\"/sign-up\" component={SignUp} />\n {/* <Route path=\"\" component={} /> */}\n </Switch>\n )}", "title": "" }, { "docid": "31a026cdfea9b0b9c59f6f5fb088e706", "score": "0.57777804", "text": "function Router() {\n return express.Router({mergeParams: true});\n}", "title": "" }, { "docid": "1ac4ab0f4cf4162d4b6e0cc111c919dd", "score": "0.5777694", "text": "setUpRouter() {\n if (this.getRouter() == 'json') {\n this.setUpJsonRouter();\n } else {\n require(appRoot + '/router/routes.js');\n }\n }", "title": "" }, { "docid": "1960db82ed47631b8483857f4d19673e", "score": "0.57763475", "text": "function App() {\n return (\n <Router>\n\n\n <Switch>\n <Route path='/contact'> <Contact /></Route>\n\n\n <Route path='/about'> <About /></Route>\n <Route path='/android'> < Android /> </Route>\n <Route path='/ios'> < Ios /> </Route>\n <Route path='/mobicare'><Mobicare /></Route>\n\n \n <Route path='/'> <Main /></Route>\n\n\n\n\n </Switch>\n\n\n\n\n </Router>\n );\n}", "title": "" }, { "docid": "811838a72ced81e44e0aa3fc9ec24f47", "score": "0.5739289", "text": "function RouterConfig({ history, app }) {\n const routes = [\n {\n path: '/',\n name: 'IndexPage',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/app'));\n cb(null, require('./routes/app'));\n });\n },\n childRoutes: [\n {\n path: '/login',\n name: 'LoginPage',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/login'));\n cb(null, require('./routes/login/login'));\n });\n },\n },\n {\n path: '/admin_login_as',\n name: 'admin_login_as',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/adminLoginAs'));\n cb(null, require('./routes/login/adminLoginAs'));\n });\n },\n },\n {\n path: '/choose_territory',\n name: 'choose_territory',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/choose_territory'));\n cb(null, require('./routes/choose_territory/index.js'));\n });\n },\n },\n {\n path: '/redirect',\n name: 'redirect',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/redirect'));\n cb(null, require('./routes/redirect/index'));\n });\n },\n },\n {\n path: '/reset_password',\n name: 'reset_password',\n breadcrumbName: '忘记密码',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/userPassword'));\n cb(null, require('./routes/user_password/resetPassword'));\n });\n },\n },\n {\n path: '/change_territory',\n name: 'change_territory',\n breadcrumbName: '岗位选择',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/switch_territory'));\n cb(null, require('./routes/choose_territory/change_territory.js'));\n });\n },\n },\n {\n path: '/change_password',\n name: 'change_password',\n breadcrumbName: '修改密码',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/userPassword'));\n cb(null, require('./routes/user_password/changePassword'));\n });\n },\n },\n {\n path: '/home',\n name: 'home',\n breadcrumbName: '首页',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/home'));\n cb(null, require('./routes/home/home'));\n });\n },\n },\n {\n path: 'object_page/:object_api_name/index_page',\n name: 'object_page',\n breadcrumbName: '首页布局渲染',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/object_page/index'));\n cb(null, require('./routes/object_page/index'));\n });\n },\n },\n {\n path: 'object_page/:object_api_name/:record_id/edit_page',\n name: 'object_page',\n breadcrumbName: '编辑渲染',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/object_page/edit'));\n cb(null, require('./routes/object_page/edit'));\n });\n },\n },\n {\n path: 'object_page/:object_api_name/add_page',\n name: 'object_page',\n breadcrumbName: '新增渲染',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/object_page/add'));\n cb(null, require('./routes/object_page/add'));\n });\n },\n },\n {\n path: 'object_page/:object_api_name/:record_id/detail_page',\n name: 'detail_page',\n breadcrumbName: '详情渲染',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/object_page/detail'));\n cb(null, require('./routes/object_page/detail'));\n });\n },\n },\n {\n path: 'report',\n name: 'report',\n breadcrumbName: '报告',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report/index'));\n cb(null, require('./routes/report/index'));\n });\n },\n },\n {\n path: 'report/workingDetail',\n name: 'workingDetail',\n breadcrumbName: '区域内工作天数详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report/index'));\n cb(null, require('./routes/report/workingDetail'));\n });\n },\n },\n {\n path: 'report/doctorDetail',\n name: 'doctorDetail',\n breadcrumbName: '目标医生数详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report/index'));\n cb(null, require('./routes/report/doctorDetail'));\n });\n },\n },\n {\n path: 'report/doctorCallDetail',\n name: 'doctorCallDetail',\n breadcrumbName: '日均拜访详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report/index'));\n cb(null, require('./routes/report/doctorCallDetail'));\n });\n },\n },\n {\n path: 'report/doctorCallRateDetail',\n name: 'doctorCallRateDetail',\n breadcrumbName: '拜访频率详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report/index'));\n cb(null, require('./routes/report/doctorCallRateDetail'));\n });\n },\n },\n {\n path: 'report/doctorCallCoverDetail',\n name: 'doctorCallCoverDetail',\n breadcrumbName: '医生覆盖率详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report/index'));\n cb(null, require('./routes/report/doctorCallCoverDetail'));\n });\n },\n },\n {\n path: 'report/validDoctorCallCoverDetail',\n name: 'validDoctorCallCoverDetail',\n breadcrumbName: '有效拜访覆盖率详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report/index'));\n cb(null, require('./routes/report/validDoctorCallCoverDetail'));\n });\n },\n },\n {\n path: 'report/eventDetail',\n name: 'eventDetail',\n breadcrumbName: '会议活动次数详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report/index'));\n cb(null, require('./routes/report/eventDetail'));\n });\n },\n },\n {\n path: 'report/coachDetail',\n name: 'coachDetail',\n breadcrumbName: '辅导次数详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report/index'));\n cb(null, require('./routes/report/coachDetail'));\n });\n },\n },\n {\n path: 'report_team',\n name: 'report_team',\n breadcrumbName: '报告',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_team/index'));\n cb(null, require('./routes/report_team/index'));\n });\n },\n },\n {\n path: 'report_team/workingDetail',\n name: 'workingDetail',\n breadcrumbName: '区域内工作天数详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_team/index'));\n cb(null, require('./routes/report_team/workingDetail'));\n });\n },\n },\n {\n path: 'report_team/doctorDetail',\n name: 'doctorDetail',\n breadcrumbName: '目标医生数详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_team/index'));\n cb(null, require('./routes/report_team/doctorDetail'));\n });\n },\n },\n {\n path: 'report_team/doctorCallDetail',\n name: 'doctorCallDetail',\n breadcrumbName: '日均拜访详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_team/index'));\n cb(null, require('./routes/report_team/doctorCallDetail'));\n });\n },\n },\n {\n path: 'report_team/doctorCallRateDetail',\n name: 'doctorCallRateDetail',\n breadcrumbName: '拜访频率详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_team/index'));\n cb(null, require('./routes/report_team/doctorCallRateDetail'));\n });\n },\n },\n {\n path: 'report_team/doctorCallCoverDetail',\n name: 'doctorCallCoverDetail',\n breadcrumbName: '医生覆盖率详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_team/index'));\n cb(null, require('./routes/report_team/doctorCallCoverDetail'));\n });\n },\n },\n {\n path: 'report_team/validDoctorCallCoverDetail',\n name: 'validDoctorCallCoverDetail',\n breadcrumbName: '有效拜访覆盖率详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_team/index'));\n cb(null, require('./routes/report_team/validDoctorCallCoverDetail'));\n });\n },\n },\n {\n path: 'report_team/eventDetail',\n name: 'eventDetail',\n breadcrumbName: '会议活动次数详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_team/index'));\n cb(null, require('./routes/report_team/eventDetail'));\n });\n },\n },\n {\n path: 'report_team/coachDetail',\n name: 'coachDetail',\n breadcrumbName: '辅导次数详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_team/index'));\n cb(null, require('./routes/report_team/coachDetail'));\n });\n },\n },\n {\n path: 'report_me',\n name: 'report_me',\n breadcrumbName: 'ME报告',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_me/index'));\n cb(null, require('./routes/report_me/index'));\n });\n },\n },\n {\n path: 'report_me/eventSummaryDetail',\n name: 'report_me_event_summary_detail',\n breadcrumbName: 'ME报告-活动执行汇总报告',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_me/index'));\n cb(null, require('./routes/report_me/summary'));\n });\n },\n },\n {\n path: 'report_me/eventSupportDetail',\n name: 'report_me_event_support_detail',\n breadcrumbName: 'ME报告-活动支持统计报告',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_me/index'));\n cb(null, require('./routes/report_me/support').default);\n });\n },\n },\n {\n path: 'report_me_country',\n name: 'report_me_country',\n breadcrumbName: 'ME全国报告',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_me_country/index'));\n cb(null, require('./routes/report_me_country/index'));\n });\n },\n },\n {\n path: 'report_me_dsm',\n name: 'report_me_dsm',\n breadcrumbName: 'ME区域经理报告',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_me_dsm/index'));\n cb(null, require('./routes/report_me_dsm/index'));\n });\n },\n },\n {\n path: 'report_hk',\n name: 'report_hk',\n breadcrumbName: '报告',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_hk/index'));\n cb(null, require('./routes/report_hk/index'));\n });\n },\n },\n {\n path: 'report_hk/workingDetail',\n name: 'report_hk_workingDetail',\n breadcrumbName: '区域内工作天数详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_hk/index'));\n cb(null, require('./routes/report_hk/workingDetail'));\n });\n },\n },\n {\n path: 'report_hk/doctorDetail',\n name: 'report_hk_doctorDetail',\n breadcrumbName: '目标医生数详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_hk/index'));\n cb(null, require('./routes/report_hk/doctorDetail'));\n });\n },\n },\n {\n path: 'report_hk/doctorCallDetail',\n name: 'report_hk_doctorCallDetail',\n breadcrumbName: '日均拜访详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_hk/index'));\n cb(null, require('./routes/report_hk/doctorCallDetail'));\n });\n },\n },\n {\n path: 'report_hk/doctorCallRateDetail',\n name: 'report_hk_doctorCallRateDetail',\n breadcrumbName: '拜访频率详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_hk/index'));\n cb(null, require('./routes/report_hk/doctorCallRateDetail'));\n });\n },\n },\n {\n path: 'report_hk/doctorCallCoverDetail',\n name: 'report_hk_doctorCallCoverDetail',\n breadcrumbName: '医生覆盖率详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_hk/index'));\n cb(null, require('./routes/report_hk/doctorCallCoverDetail'));\n });\n },\n },\n {\n path: 'report_hk/validDoctorCallCoverDetail',\n name: 'report_hk_validDoctorCallCoverDetail',\n breadcrumbName: '有效拜访覆盖率详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_hk/index'));\n cb(null, require('./routes/report_hk/validDoctorCallCoverDetail'));\n });\n },\n },\n {\n path: 'report_hk/doctorCallTimesDetail',\n name: 'report_hk_doctorCallTimesDetail',\n breadcrumbName: '客户拜访频次报告详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_hk/index'));\n cb(null, require('./routes/report_hk/doctorCallTimesDetail'));\n });\n },\n },\n {\n path: 'report_hk/coachDetail',\n name: 'report_hk_coachDetail',\n breadcrumbName: '辅导次数详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_hk/index'));\n cb(null, require('./routes/report_hk/coachDetail'));\n });\n },\n },\n {\n path: 'report_hk_senior',\n name: 'report_hk_senior',\n breadcrumbName: '报告',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_hk_senior/index'));\n cb(null, require('./routes/report_hk_senior/index'));\n });\n },\n },\n {\n path: 'report_tw_senior',\n name: 'report_tw_senior',\n breadcrumbName: '报告',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_tw_senior/index'));\n cb(null, require('./routes/report_tw_senior/index'));\n });\n },\n },\n {\n path: 'report_senior',\n name: 'report_senior',\n breadcrumbName: '报告',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_senior/index'));\n cb(null, require('./routes/report_senior/index'));\n });\n },\n },\n {\n path: 'report_tw',\n name: 'report_tw',\n breadcrumbName: '报告',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_tw/index'));\n cb(null, require('./routes/report_tw/index'));\n });\n },\n },\n {\n path: 'report_tw/workingDetail',\n name: 'workingDetail',\n breadcrumbName: '区域内工作天数详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_tw/index'));\n cb(null, require('./routes/report_tw/workingDetail'));\n });\n },\n },\n {\n path: 'report_tw/doctorDetail',\n name: 'doctorDetail',\n breadcrumbName: '目标医生数详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_tw/index'));\n cb(null, require('./routes/report_tw/doctorDetail'));\n });\n },\n },\n {\n path: 'report_tw/doctorCallDetail',\n name: 'doctorCallDetail',\n breadcrumbName: '日均拜访详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_tw/index'));\n cb(null, require('./routes/report_tw/doctorCallDetail'));\n });\n },\n },\n {\n path: 'report_tw/doctorCallRateDetail',\n name: 'doctorCallRateDetail',\n breadcrumbName: '拜访频率详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_tw/index'));\n cb(null, require('./routes/report_tw/doctorCallRateDetail'));\n });\n },\n },\n {\n path: 'report_tw/doctorCallCoverDetail',\n name: 'doctorCallCoverDetail',\n breadcrumbName: '医生覆盖率详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_tw/index'));\n cb(null, require('./routes/report_tw/doctorCallCoverDetail'));\n });\n },\n },\n {\n path: 'report_tw/validDoctorCallCoverDetail',\n name: 'validDoctorCallCoverDetail',\n breadcrumbName: '有效拜访覆盖率详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_tw/index'));\n cb(null, require('./routes/report_tw/validDoctorCallCoverDetail'));\n });\n },\n },\n {\n path: 'report_tw/eventDetail',\n name: 'eventDetail',\n breadcrumbName: '会议活动次数详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_tw/index'));\n cb(null, require('./routes/report_tw/eventDetail'));\n });\n },\n },\n {\n path: 'report_tw/coachDetail',\n name: 'coachDetail',\n breadcrumbName: '辅导次数详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_tw/index'));\n cb(null, require('./routes/report_tw/coachDetail'));\n });\n },\n },\n {\n path: 'report_all_product',\n name: 'report_me',\n breadcrumbName: '全产品报告',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_all_product/index'));\n cb(null, require('./routes/report_all_product/index'));\n });\n },\n },\n {\n path: 'report_all_product/workingDetail',\n name: 'workingDetail',\n breadcrumbName: '区域内工作天数详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_all_product/index'));\n cb(null, require('./routes/report_all_product/workingDetail'));\n });\n },\n },\n {\n path: 'report_all_product/customerNumDetail',\n name: 'customerNumDetail',\n breadcrumbName: '客户数详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_all_product/index'));\n cb(null, require('./routes/report_all_product/customerNumDetail'));\n });\n },\n },\n {\n path: 'report_all_product/callRateDetail',\n name: 'callRateDetail',\n breadcrumbName: '拜访频率详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_all_product/index'));\n cb(null, require('./routes/report_all_product/callRateDetail'));\n });\n },\n },\n {\n path: 'report_all_product/eventDetail',\n name: 'eventDetail',\n breadcrumbName: '推广活动详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_all_product/index'));\n cb(null, require('./routes/report_all_product/eventDetail'));\n });\n },\n },\n {\n path: 'report_all_product/coachDetail',\n name: 'coachDetail',\n breadcrumbName: '辅导报告详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/report_all_product/index'));\n cb(null, require('./routes/report_all_product/coachDetail'));\n });\n },\n },\n {\n path: 'fc_calendar',\n name: 'calendar_page',\n breadcrumbName: '日历',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/calendar_page/index'));\n cb(null, require('./routes/calendar_page/index'));\n });\n },\n },\n {\n path: 'fc_notice',\n name: 'notice_page',\n breadcrumbName: '公告',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/notice/index'));\n cb(null, require('./routes/notice/index'));\n });\n },\n },\n {\n path: 'fc_architecture',\n name: 'architecture_page',\n breadcrumbName: '业务数据',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/architecture/index'));\n cb(null, require('./routes/architecture/index'));\n });\n },\n },\n {\n path: 'fc_custom_report',\n name: 'data_export_index',\n breadcrumbName: '自定义报告',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/data_export/export_script'));\n registerModel(app, require('./models/data_export/export_history'));\n registerModel(app, require('./models/data_export/table'));\n registerModel(app, require('./models/data_export/index'));\n cb(null, require('./routes/data_export/index'));\n });\n },\n },\n {\n path: 'fc_notice/sendbox',\n name: 'notice_sendbox',\n breadcrumbName: '我发布的公告',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/notice/sendbox'));\n cb(null, require('./routes/notice/sendbox'));\n });\n },\n },\n {\n path: 'fc_notice/add',\n name: 'notice_add',\n breadcrumbName: '新建公告',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/notice/form'));\n cb(null, require('./routes/notice/add'));\n });\n },\n },\n {\n path: 'fc_notice/view',\n name: 'notice_view',\n breadcrumbName: '新建公告',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/notice/form'));\n cb(null, require('./routes/notice/view'));\n });\n },\n },\n {\n path: '/segmentation_history/:segmentation_history_id/segmentation_fill_page',\n name: 'segmentation_fill_page',\n breadcrumbName: '填写定级问卷',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(\n app,\n require('./models/segmentation_history_page/segmentation_fill_page'),\n );\n cb(null, require('./routes/segmentation_history_page/segmentation_fill_page'));\n });\n },\n },\n {\n path: '/segmentation_history/:segmentation_history_id/segmentation_detail_page',\n name: 'segmentation_detail_page',\n breadcrumbName: '定级问卷详情',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(\n app,\n require('./models/segmentation_history_page/segmentation_detail_page'),\n );\n cb(null, require('./routes/segmentation_history_page/segmentation_detail_page'));\n });\n },\n },\n {\n path: '/coach_feedback/:coach_feedback_id/coach_fill_page',\n name: 'coach_fill_page',\n breadcrumbName: '填写辅导问卷',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/coach_feedback_page/coach_fill_page'));\n cb(null, require('./routes/coach_feedback_question_page/coach_fill_page'));\n });\n },\n },\n {\n path: '/external_page/:object_api_name/index_page',\n name: 'external_page',\n breadcrumbName: '外部链接页面',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n registerModel(app, require('./models/external_page/index'));\n cb(null, require('./routes/external_page/index'));\n });\n },\n },\n {\n path: '/rich_text_page/:object_api_name/:recordId',\n name: 'rich_text_page',\n breadcrumbName: '富文本页面',\n getComponent(nextState, cb) {\n require.ensure([], (require) => {\n // registerModel(app, require('./models/object_page/edit'));\n cb(null, require('./routes/rice_text_page/index'));\n });\n },\n },\n ],\n },\n ];\n const appHistory = useRouterHistory(createHashHistory)({ queryKey: true });\n\n consoleUtil.log('route appLocale==>', window.appLocale);\n // return (\n // <LocaleProvider locale={window.appLocale.antd}>\n // <IntlProvider\n // locale={window.appLocale.locale}\n // messages={window.appLocale.messages}\n // // formats={appLocale.formats}\n // >\n // <Router history={appHistory} routes={routes} />\n // </IntlProvider>\n // </LocaleProvider>\n // )\n return <Router history={appHistory} routes={routes} />;\n}", "title": "" }, { "docid": "bb885fc3a5a0db5c207cb0f09570fc62", "score": "0.57385755", "text": "function DashboardRouter() {\n return (\n <Router>\n {/* <Users path=\"users\" />\n <AddUser path=\"adduser\" />\n <EditUser path=\"user/:id\" /> */}\n </Router>\n );\n}", "title": "" }, { "docid": "c656c4836fd8cfc60759896b75616f55", "score": "0.5731122", "text": "function router (cb) {\n _router = sheetRouter(cb)\n return _router\n }", "title": "" }, { "docid": "87a2aefd1df616e5556d72c46b35a221", "score": "0.5720214", "text": "function Router() {\n // всякая инициализационная хрень\n if ( this instanceof Router === false ) {\n return new Router();\n }\n // создаем в объекте хранилище для middlewares\n this.middlewares = [];\n\n // создаем в объекте ссылку на приложение\n this.app = {};\n}", "title": "" }, { "docid": "88a7a23c20397188dd72831edfb78df5", "score": "0.57160425", "text": "function Router (){\n return (\n <BrowserRouter>\n <Navigation />\n <Switch>\n <Route exact path=\"/\" component = {Home} />\n <Route exact path=\"/add_ingredients\" component = {AddIngredient} />\n <Route exact path=\"/ingredients_list\" component = {IngredientsList} /> \n <Route exact path=\"/recipes_list\" component = {RecipesList} /> \n <Route exact path=\"/add_recipe\" component = {AddRecipe} /> \n <Route exact path=\"/login\" component = {Login} /> \n <Route exact path=\"/register\" component = {Register} /> \n <Route path=\"/recipe/:id\" component = {Recipe} /> \n <Route path=\"/sum\" component = {SumIngredients} /> \n </Switch>\n </BrowserRouter>\n\n \n )\n}", "title": "" }, { "docid": "70559698ef672d810fcce196555fcd5a", "score": "0.56705695", "text": "function lazyload(view){\n return() => import(`@/routes/${view}.vue`)\n}", "title": "" }, { "docid": "6d9a89358c04ffc1c33b0afbacf16bfb", "score": "0.5661833", "text": "function Index() {\n return (\n <RouterProvider router={router}>\n <App apolloClient={api.client} />\n </RouterProvider>\n );\n}", "title": "" }, { "docid": "ad6250bea985f390e905123ff342ab5e", "score": "0.56555855", "text": "constructor(router) {\r\n this.router = router;\r\n\r\n this.router.get('/:id', this.getSingle.bind(this));\r\n this.router.get('/', this.getMultiple.bind(this));\r\n this.router.post('/:id', this.start.bind(this));\r\n this.router.put('/:id', this.restart.bind(this));\r\n this.router.delete('/:id', this.stop.bind(this));\r\n }", "title": "" }, { "docid": "876f49727a647837909dd41b2954191a", "score": "0.5654487", "text": "function App() {\n return (\n <Router>\n <div>\n <Route path='/' component={Main} />\n </div>\n </Router>\n );\n}", "title": "" }, { "docid": "9b02ec01992b326dfb1cea44b7089b8e", "score": "0.56508505", "text": "function App(){\n return(\n <>\n <Routes />\n \n </>\n ) \n}", "title": "" }, { "docid": "f7069ea40c836fe9bd44c5c952e5cf3e", "score": "0.56500304", "text": "function MockRouter() {\n this.routes = [];\n}", "title": "" }, { "docid": "9326e489d8e681b0e5ec44d197e823ae", "score": "0.5649522", "text": "function App() {\n return (\n <>\n <Routes/>\n </>\n );\n}", "title": "" }, { "docid": "13ebf236c3d515e00315cc2a35f4a1c0", "score": "0.5647319", "text": "function App() { \n return (\n <Routes />\n );\n}", "title": "" }, { "docid": "faed5f86af7ea03350594eb93168199a", "score": "0.5646174", "text": "function App() {\n return (\n <Routes />\n )\n}", "title": "" }, { "docid": "7a583a26a6f0d99da02aac5ebc786123", "score": "0.5643412", "text": "function AppModule(router) {\n // console.log('Routes: ', JSON.stringify(router.config, undefined, 2));\n }", "title": "" }, { "docid": "3c67ad23865f737999fbbee21526d178", "score": "0.5641568", "text": "startRouting() {\n this.router.startRouting();\n }", "title": "" }, { "docid": "31c34274dfd811d2a65e7b9e38d940c0", "score": "0.5635504", "text": "constructor() {\n\t\tthis._router = router;\n\n\t\tthis._router.use(require('body-parser').json());\n\t\tthis._router.use(require('cookie-parser')());\n\t\tthis._router.use(require('express-session')({\n\t\t\t'resave': false,\n\t\t\t'saveUninitialized': true,\n\t\t\t'secret': process.env.EXPRESS_SESSION_SECRET\n\t\t}));\n\t}", "title": "" }, { "docid": "64cf31be63f1a97c2b4b73b9f5deb7a0", "score": "0.5632847", "text": "render(){\n\n\n\n\n return(\n <div className = \"router\">\n <BrowserRouter>\n <Switch>\n <Route path=\"/\" exact component = {ViewGraph} />\n </Switch>\n </BrowserRouter>\n </div>\n )\n }", "title": "" }, { "docid": "2af46eb89218dae0c521f3886158d4ac", "score": "0.56295806", "text": "constructor() {\n super('/');\n }", "title": "" }, { "docid": "a167e6d1b0af9ed116d6d5d2006b5ba5", "score": "0.5625833", "text": "function App() {\n\n return (\n <Routes />\n\n );\n}", "title": "" }, { "docid": "01c07c1023baad1565acbf35cb3afc72", "score": "0.5624249", "text": "render() {\n return (\n <Router>\n <div className=\"App\">\n <Route path=\"/\" exact component={List} />\n <Route path=\"/edit/:id\" component={Edit} />\n <Route path=\"/details/:id\" component={Details} />\n </div>\n </Router>\n );\n }", "title": "" }, { "docid": "6a5840006a81264ba8e02802b58e3e2c", "score": "0.5623965", "text": "buildRoutes() {\n this.app.use(\"/account\", new user_1.UserRouter().getRouter());\n }", "title": "" }, { "docid": "75256cbd1b0c0018872fe5e0f8d724c5", "score": "0.56224954", "text": "setupRoutes() {\n const { apiPrefix } = this.config;\n\n // mount all routes on /api path\n this.app.use(\"/api\", router);\n\n // catch 404 and forward to error handler\n // this.app.use(notFoundRoute);\n\n // error handler, send stacktrace only during development\n this.app.use(errorHandlerMdw);\n\n return this;\n }", "title": "" }, { "docid": "7dc54b0e2473f58786653e86713fdc32", "score": "0.5615716", "text": "registerRoutes() {\n this.router.get('/testServer', this.getServerInfo.bind(this));\n }", "title": "" }, { "docid": "852f9f34f2215f501c38fd05143eae05", "score": "0.5606679", "text": "router() {\n const {\n monitor,\n allowedCORSOrigin,\n rootUrl,\n inputLimit,\n signatureValidator,\n validator,\n schemaset,\n context,\n } = this.options;\n const {errorCodes, serviceName} = this.builder;\n const absoluteSchemas = schemaset.absoluteSchemas(rootUrl);\n\n // Create router\n const router = express.Router();\n\n // Allow CORS requests to the API\n if (allowedCORSOrigin) {\n router.use(corsHeaders(allowedCORSOrigin));\n }\n\n router.use(cacheHeaders());\n\n // Add entries to router\n this.entries.forEach(entry => {\n // Route pattern\n const middleware = [entry.route];\n\n if (monitor) {\n middleware.push(monitor.expressMiddleware(entry.name));\n }\n\n middleware.push(\n buildReportErrorMethod({errorCodes, monitor, entry}),\n parseBody({inputLimit}),\n remoteAuthentication({signatureValidator, entry}),\n parameterValidator({context, entry}),\n queryValidator({context, entry}),\n validateSchemas({validator, absoluteSchemas, rootUrl, serviceName, entry}),\n callHandler({entry, context, monitor})\n );\n\n // Create entry on router\n router[entry.method].apply(router, middleware);\n });\n\n // Return router\n return router;\n }", "title": "" }, { "docid": "401f1a96582a1e2de82537240c0bf41e", "score": "0.5605653", "text": "function init() {\n var router = new Router([\n new Route('home','home.html',true),\n new Route('articles','articles.html'),\n new Route('feedback','feedback.html') \n ]);\n router.init();\n}", "title": "" }, { "docid": "e1d9e2fd174b9542a4cdd00ccbbfbb2e", "score": "0.5603719", "text": "function App() {\r\n return (\r\n <Router>\r\n <StartPortal path=\"/\" default />\r\n <Main path=\"/main/*\" />\r\n </Router>\r\n );\r\n}", "title": "" }, { "docid": "6e3a7a6d05b1922e7d0c24c77c9ffe89", "score": "0.5602527", "text": "function App() {\n return (\n <Router>\n <Nav />\n <Switch>\n <Route path=\"/students/:id\">\n <Student />\n </Route>\n <Route path=\"/students\">\n {/*localhost:3000/students */}\n <Students />\n </Route>\n <Route path=\"/\">\n {/*localhost:3000/about */}\n <h1>This is the Home page</h1>\n </Route>\n </Switch>\n </Router>\n );\n}", "title": "" }, { "docid": "9dde621cb0ef919ac23153b0d86d7158", "score": "0.55952954", "text": "router() {\r\n let router = express.Router();\r\n router.post('/list', this.listSubtask.bind(this));\r\n router.post('/getid', this.getid.bind(this));\r\n router.post('/add', this.addSubtask.bind(this));\r\n router.delete('/remove', this.deleteSubtask.bind(this));\r\n router.put('/amassigned', this.amendPerson.bind(this));\r\n router.put('/amname', this.amendName.bind(this));\r\n router.put('/amdate', this.amendDuedate.bind(this));\r\n router.put('/mark', this.markComplete.bind(this));\r\n router.put('/unmark', this.markUnComplete.bind(this));\r\n router.put('/check', this.countRemaining.bind(this));\r\n return router;\r\n }", "title": "" }, { "docid": "181d49abd56222b000ab881dabc64e95", "score": "0.5590491", "text": "function Router () {\n return (\n <>\n <Loader />\n {/* <Navbar /> */}\n <Switch>\n <Route exact path='/become-a-partner' component={Partner} />\n <Route exact path='/become-a-partner/form-two' component={PartnerForm} />\n <Route exact path='/register' component={Registration} />\n <Route exact path='/login/forgotpassword' component={ForgotPassword} />\n <Route exact path='/login/resetpassword/:token' component={ResetPassword} />\n <Route exact path='/login' component={LoginAuth} />\n <Route exact path='/auth/verify/:token' component={Authenticator} />\n <Route exact path='/result' component={SearchResults} />\n <Route exact path='/selectseat' component={PickSeat} />\n <Route exact path='/' component={Home} />\n <Route exact path='/bookingsearchresult' component={BookingSearchResult} />\n {/* <Route exact path=\"/home\" component={Home} /> */}\n <Route exact path='/resetsent' component={ResetSent} />\n <Route exact path='/dashboard/companydashboard' component={CompanyDashboard} />\n <Route exact path='/dashboard/businessdetaildashboard' component={BusinessDetailsDashboard} />\n <Route exact path='/dashboard/routes' component={VehicleRoutes} />\n <Route exact path='/resetcomplete' component={ResetComplete} />\n <Route exact path='/settings'>\n <Redirect to='/settings/companydetails' />\n </Route>\n <Route exact path='/settings/companydetails' component={CompanyDetails} />\n <Route exact path='/settings/businessdetails' component={BusinessDetails} />\n <Route exact path='/logout'>\n <Redirect to='/' />\n </Route>\n <Route component={NotFound} />\n </Switch>\n <Footer />\n </>\n )\n}", "title": "" }, { "docid": "26f6832d43732a79c7f84c0f672711bb", "score": "0.558836", "text": "function Router() {\n this.middleware = [];\n this.errorHandlers = [];\n this.stack = [];\n}", "title": "" }, { "docid": "897ee4e994271756a4f1d14f7560035b", "score": "0.55872065", "text": "initializeProperties() {\n this._router = require('./src/route/api/index'); \n this._ErrorMiddleware = require('./src/route/infra/middlewares/ErrorMiddleware').ErrorMiddlewareRouter;\n }", "title": "" }, { "docid": "88d3b362c501771144c7dbbc83c2825e", "score": "0.5584762", "text": "function App() {\n window.MyLib = {}\n return (\n \n <Router history={hist}>\n \n <Switch>\n <Route exact path='/' component={Login} />\n <Route path=\"/sign-up\" component={SignUp} />\n \n <Route path=\"/sign-in\" component={Login} />\n \n <Route path=\"/employeradmin\" render={(props) => <EmployerAdminLayout {...props} />} />\n <Route path=\"/employeeadmin\" render={(props) => <EmployeeAdminLayout {...props} />} />\n \n </Switch>\n </Router>\n );\n}", "title": "" }, { "docid": "1f1e18027efcd1cf18319932f41b1b88", "score": "0.5584", "text": "function App() {\n return (\n <div>\n <AppRoutes />\n </div>\n );\n}", "title": "" }, { "docid": "3ee9a741059f0ee790a03418307a1a28", "score": "0.5583623", "text": "render() {\n return (\n <Router>\n <div className=\"App\">\n <Route exact path=\"/\" component={ProjectHome} />\n <Route exact path=\"/admin\" component={AdminPage} />\n </div>\n </Router>\n );\n }", "title": "" }, { "docid": "024a4e22136c06b2f188d2abe7fe50a3", "score": "0.5575003", "text": "function App() {\n return (\n <Routes />\n );\n}", "title": "" }, { "docid": "68280a2a39e11eb4fab367af9f153acb", "score": "0.5570722", "text": "function App() {\n\n return (\n <Routes />\n );\n}", "title": "" }, { "docid": "fcfb40b1c2565d4db33d6cea30d3930e", "score": "0.5569664", "text": "includeRoutes(){\n // new routes(this.app).routesConfig();\n this.app.use('/user', userAPI);\n this.app.use('/chat', chatAPI);\n this.app.use('/room', roomAPI);\n new socketEvents(this.socket).socketConfig();\n }", "title": "" }, { "docid": "917c4be02d4da1ad0d31ff3dd6adf5ba", "score": "0.5568004", "text": "function i(t,e){if(!t)throw new Error(\"[vue-router] \"+e)}", "title": "" }, { "docid": "1dc7d805a80e602aeec86025b9a30c4c", "score": "0.55627674", "text": "function App() {\n return (\n <div>\n <Routes />\n </div>\n );\n\n}", "title": "" }, { "docid": "4afe1cfbb3180815fde134b3cd14fe21", "score": "0.55603117", "text": "configureRouter(config, router) {\n let doAuth = true;\n //console.log(process.env.AuthIsOn);\n if (process.env.AuthIsON === 'false'){\n doAuth = false;\n }\n config.map([\n { route: '', name: 'dashboard', moduleId: './dashboard-routes/dashboard', nav: false, title: 'Dashboard', auth: doAuth},\n { route: 'librarian', name: 'librarian', moduleId: './dashboard-routes/librarian', nav: false, title: 'Librarian', auth: doAuth},\n { route: 'reader', name: 'reader', moduleId: './dashboard-routes/reader', nav: false, title: 'Reader', auth: doAuth}\n ]);\n this.router = router;\n }", "title": "" }, { "docid": "06c2755358bc18ba528857a9f8d3f521", "score": "0.555731", "text": "constructor() {\n this.express = express();\n this.middleware();\n this.routes();\n }", "title": "" }, { "docid": "06c2755358bc18ba528857a9f8d3f521", "score": "0.555731", "text": "constructor() {\n this.express = express();\n this.middleware();\n this.routes();\n }", "title": "" }, { "docid": "20055bf267a7632030659d65ef73d1e6", "score": "0.55523777", "text": "function App() {\n return (\n <div>\n <Provider store={store}>\n {router}\n </Provider>\n </div>\n );\n }", "title": "" }, { "docid": "df262429d90c068c7405525f7a05e8ba", "score": "0.55469495", "text": "configureRouter(config, router) {\n this.router = router\n config.title = \"AUProject title\"\n config.addAuthorizeStep(AuthSettings)\n config.map([\n {\n route: ['', 'index', 'home'],\n name: \"homeRoute\",\n moduleId: PLATFORM.moduleName(\"home\"),\n title: \"Home Title\"\n },\n {\n route: ['lista/:id'],\n name: \"listaRoute\",\n moduleId: PLATFORM.moduleName(\"lista\"),\n title: \"Lista Title\"\n },\n {\n route: ['form'],\n name: \"formRoute\",\n moduleId: PLATFORM.moduleName(\"form\"),\n title: \"Form Title\",\n settings: {auth: true}\n }\n ])\n }", "title": "" }, { "docid": "bd7c6f6ddb26c889b0f4495db20a89ef", "score": "0.5541038", "text": "function Router() {\n if (!(this instanceof Router)) {\n return new Router();\n }\n Emitter.call(this);\n this.routes = [];\n}", "title": "" }, { "docid": "ad803f5dd19bfedc70e0357991cabde4", "score": "0.5540214", "text": "function r(t,e){if(!t)throw new Error(\"[vue-router] \"+e)}", "title": "" }, { "docid": "ad803f5dd19bfedc70e0357991cabde4", "score": "0.5540214", "text": "function r(t,e){if(!t)throw new Error(\"[vue-router] \"+e)}", "title": "" }, { "docid": "ad803f5dd19bfedc70e0357991cabde4", "score": "0.5540214", "text": "function r(t,e){if(!t)throw new Error(\"[vue-router] \"+e)}", "title": "" }, { "docid": "ad803f5dd19bfedc70e0357991cabde4", "score": "0.5540214", "text": "function r(t,e){if(!t)throw new Error(\"[vue-router] \"+e)}", "title": "" }, { "docid": "ad803f5dd19bfedc70e0357991cabde4", "score": "0.5540214", "text": "function r(t,e){if(!t)throw new Error(\"[vue-router] \"+e)}", "title": "" }, { "docid": "ad803f5dd19bfedc70e0357991cabde4", "score": "0.5540214", "text": "function r(t,e){if(!t)throw new Error(\"[vue-router] \"+e)}", "title": "" }, { "docid": "ad803f5dd19bfedc70e0357991cabde4", "score": "0.5540214", "text": "function r(t,e){if(!t)throw new Error(\"[vue-router] \"+e)}", "title": "" }, { "docid": "ad803f5dd19bfedc70e0357991cabde4", "score": "0.5540214", "text": "function r(t,e){if(!t)throw new Error(\"[vue-router] \"+e)}", "title": "" }, { "docid": "ad803f5dd19bfedc70e0357991cabde4", "score": "0.5540214", "text": "function r(t,e){if(!t)throw new Error(\"[vue-router] \"+e)}", "title": "" }, { "docid": "701b0c2f273f2a1fb22c397a36e2be1e", "score": "0.5537307", "text": "function App() {\n return (\n <div className=\"App\">\n <Routes/>\n </div>\n );\n}", "title": "" } ]
11af4fa5c7b192e43d3984fe01e08a06
Detach a line from the document tree and its markers.
[ { "docid": "bc757877b9da46ecced2b43eb160cf12", "score": "0.7346414", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n}", "title": "" } ]
[ { "docid": "4e992b6c059f2a7bcb8f19d913844321", "score": "0.7425726", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line) }\n line.markedSpans = null\n }", "title": "" }, { "docid": "135bfb9145b8e250d2600384cddd59f5", "score": "0.74187696", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line) }\n line.markedSpans = null\n}", "title": "" }, { "docid": "135bfb9145b8e250d2600384cddd59f5", "score": "0.74187696", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line) }\n line.markedSpans = null\n}", "title": "" }, { "docid": "135bfb9145b8e250d2600384cddd59f5", "score": "0.74187696", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line) }\n line.markedSpans = null\n}", "title": "" }, { "docid": "ccd56b4897fde5bcf3bfbfa729d9e859", "score": "0.7399272", "text": "function cleanUpLine(line) {\n line.parent = null\n detachMarkedSpans(line)\n}", "title": "" }, { "docid": "ccd56b4897fde5bcf3bfbfa729d9e859", "score": "0.7399272", "text": "function cleanUpLine(line) {\n line.parent = null\n detachMarkedSpans(line)\n}", "title": "" }, { "docid": "ccd56b4897fde5bcf3bfbfa729d9e859", "score": "0.7399272", "text": "function cleanUpLine(line) {\n line.parent = null\n detachMarkedSpans(line)\n}", "title": "" }, { "docid": "e05f5c7da14aefaaf2739e902e335e64", "score": "0.7388419", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) {\n return;\n }\n for (var i = 0; i < spans.length; ++i) {\n spans[i].marker.detachLine(line);\n }\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7810658bc462b1529a0b09713127c64d", "score": "0.7383718", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7810658bc462b1529a0b09713127c64d", "score": "0.7383718", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7810658bc462b1529a0b09713127c64d", "score": "0.7383718", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7810658bc462b1529a0b09713127c64d", "score": "0.7383718", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7810658bc462b1529a0b09713127c64d", "score": "0.7383718", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7810658bc462b1529a0b09713127c64d", "score": "0.7383718", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7810658bc462b1529a0b09713127c64d", "score": "0.7383718", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7810658bc462b1529a0b09713127c64d", "score": "0.7383718", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7810658bc462b1529a0b09713127c64d", "score": "0.7383718", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7810658bc462b1529a0b09713127c64d", "score": "0.7383718", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7810658bc462b1529a0b09713127c64d", "score": "0.7383718", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7810658bc462b1529a0b09713127c64d", "score": "0.7383718", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7810658bc462b1529a0b09713127c64d", "score": "0.7383718", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7810658bc462b1529a0b09713127c64d", "score": "0.7383718", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7810658bc462b1529a0b09713127c64d", "score": "0.7383718", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "title": "" }, { "docid": "ead27e437c752e6a4aeb4c7aa7eed8c3", "score": "0.73773706", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "title": "" }, { "docid": "5399ea6f2286d3f223a69e73af8d70d5", "score": "0.7371289", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "title": "" }, { "docid": "5399ea6f2286d3f223a69e73af8d70d5", "score": "0.7371289", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "title": "" }, { "docid": "5399ea6f2286d3f223a69e73af8d70d5", "score": "0.7371289", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "title": "" }, { "docid": "5399ea6f2286d3f223a69e73af8d70d5", "score": "0.7371289", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "title": "" }, { "docid": "5399ea6f2286d3f223a69e73af8d70d5", "score": "0.7371289", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "title": "" }, { "docid": "5399ea6f2286d3f223a69e73af8d70d5", "score": "0.7371289", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "title": "" }, { "docid": "5399ea6f2286d3f223a69e73af8d70d5", "score": "0.7371289", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "title": "" }, { "docid": "5399ea6f2286d3f223a69e73af8d70d5", "score": "0.7371289", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "title": "" }, { "docid": "5399ea6f2286d3f223a69e73af8d70d5", "score": "0.7371289", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "title": "" }, { "docid": "5399ea6f2286d3f223a69e73af8d70d5", "score": "0.7371289", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "title": "" }, { "docid": "5399ea6f2286d3f223a69e73af8d70d5", "score": "0.7371289", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "title": "" }, { "docid": "5399ea6f2286d3f223a69e73af8d70d5", "score": "0.7371289", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "title": "" }, { "docid": "5399ea6f2286d3f223a69e73af8d70d5", "score": "0.7371289", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "title": "" }, { "docid": "7441fcd43f31eb8a46a6340ae1cc370f", "score": "0.73689914", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7441fcd43f31eb8a46a6340ae1cc370f", "score": "0.73689914", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7441fcd43f31eb8a46a6340ae1cc370f", "score": "0.73689914", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7441fcd43f31eb8a46a6340ae1cc370f", "score": "0.73689914", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7441fcd43f31eb8a46a6340ae1cc370f", "score": "0.73689914", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7441fcd43f31eb8a46a6340ae1cc370f", "score": "0.73689914", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7441fcd43f31eb8a46a6340ae1cc370f", "score": "0.73689914", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7441fcd43f31eb8a46a6340ae1cc370f", "score": "0.73689914", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7441fcd43f31eb8a46a6340ae1cc370f", "score": "0.73689914", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7441fcd43f31eb8a46a6340ae1cc370f", "score": "0.73689914", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7441fcd43f31eb8a46a6340ae1cc370f", "score": "0.73689914", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7441fcd43f31eb8a46a6340ae1cc370f", "score": "0.73689914", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7441fcd43f31eb8a46a6340ae1cc370f", "score": "0.73689914", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7441fcd43f31eb8a46a6340ae1cc370f", "score": "0.73689914", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7441fcd43f31eb8a46a6340ae1cc370f", "score": "0.73689914", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7441fcd43f31eb8a46a6340ae1cc370f", "score": "0.73689914", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7441fcd43f31eb8a46a6340ae1cc370f", "score": "0.73689914", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "title": "" }, { "docid": "7441fcd43f31eb8a46a6340ae1cc370f", "score": "0.73689914", "text": "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "title": "" }, { "docid": "a823f26b26968571b08030795ede9059", "score": "0.7352401", "text": "function detachMarkedSpans(line) {\n\t var spans = line.markedSpans;\n\t if (!spans) return;\n\t for (var i = 0; i < spans.length; ++i)\n\t spans[i].marker.detachLine(line);\n\t line.markedSpans = null;\n\t }", "title": "" }, { "docid": "a823f26b26968571b08030795ede9059", "score": "0.7352401", "text": "function detachMarkedSpans(line) {\n\t var spans = line.markedSpans;\n\t if (!spans) return;\n\t for (var i = 0; i < spans.length; ++i)\n\t spans[i].marker.detachLine(line);\n\t line.markedSpans = null;\n\t }", "title": "" }, { "docid": "a823f26b26968571b08030795ede9059", "score": "0.7352401", "text": "function detachMarkedSpans(line) {\n\t var spans = line.markedSpans;\n\t if (!spans) return;\n\t for (var i = 0; i < spans.length; ++i)\n\t spans[i].marker.detachLine(line);\n\t line.markedSpans = null;\n\t }", "title": "" }, { "docid": "5c54c2802e508c3771d0246a899f8b7b", "score": "0.73238677", "text": "function detachMarkedSpans(line) {\n\t\t var spans = line.markedSpans\n\t\t if (!spans) { return }\n\t\t for (var i = 0; i < spans.length; ++i)\n\t\t { spans[i].marker.detachLine(line) }\n\t\t line.markedSpans = null\n\t\t}", "title": "" }, { "docid": "bf0f663b7bd51aeb747fc2e9fd4e83f2", "score": "0.732119", "text": "function cleanUpLine(line) {\n line.parent = null\n detachMarkedSpans(line)\n }", "title": "" }, { "docid": "c4a7a03e6a30431bff45381756d01dfa", "score": "0.72909045", "text": "function detachMarkedSpans(line) { // 5710\n var spans = line.markedSpans; // 5711\n if (!spans) return; // 5712\n for (var i = 0; i < spans.length; ++i) // 5713\n spans[i].marker.detachLine(line); // 5714\n line.markedSpans = null; // 5715\n } // 5716", "title": "" }, { "docid": "677b3ab123db5bae3a07cd3af091793b", "score": "0.72725695", "text": "function detachMarkedSpans(line) {\n\t var spans = line.markedSpans\n\t if (!spans) { return }\n\t for (var i = 0; i < spans.length; ++i)\n\t { spans[i].marker.detachLine(line) }\n\t line.markedSpans = null\n\t}", "title": "" }, { "docid": "677b3ab123db5bae3a07cd3af091793b", "score": "0.72725695", "text": "function detachMarkedSpans(line) {\n\t var spans = line.markedSpans\n\t if (!spans) { return }\n\t for (var i = 0; i < spans.length; ++i)\n\t { spans[i].marker.detachLine(line) }\n\t line.markedSpans = null\n\t}", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" }, { "docid": "bdc60feb7cdc1a9b2f9a9a65ada81b7b", "score": "0.72641426", "text": "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }", "title": "" } ]
7431c75e5abe59f391bc7e64d177640d
Handles any errors sent back from backend.
[ { "docid": "351de4197a79d65fa66682d239654e8b", "score": "0.0", "text": "function errors(response) {\n // If there is an error.\n if (!response.ok) {\n throw (response);\n }\n // Otherwise return the response.\n return response;\n}", "title": "" } ]
[ { "docid": "37de49e2104fa54beedce85878ef3a4e", "score": "0.71137476", "text": "function handleError() {}", "title": "" }, { "docid": "47ddbde7fb194ab3fa9e0e1b9965f1f8", "score": "0.7025548", "text": "handleError() { }", "title": "" }, { "docid": "b8de7ecef2e1105c8a827e1db60c39b2", "score": "0.6792188", "text": "function handleError() {\n $scope.inProgress = false;\n $scope.wasError = true;\n $scope.wasSuccess = false;\n $scope.errorMessage = defaultError;\n }", "title": "" }, { "docid": "a98794e923f8eb5a01bbf02d27b6931b", "score": "0.66612613", "text": "onError(errors) {\n this.response.status(ExpressHandler.httpStatus.internalServerError);\n this.response.json(errors);\n }", "title": "" }, { "docid": "39f1a1253eee46120316647bf1daaa80", "score": "0.66242826", "text": "handleError() {\n\t\tconst { app } = this;\n\t\tapp.use(function(err, req, res, next) {\n\t\t res.status(err.status || 500);\n\t\t res.render('error', {\n\t\t message: err.message,\n\t\t error: {}\n\t\t });\n\t\t});\n\t}", "title": "" }, { "docid": "d782fed7c6e216ad377053077917f4f3", "score": "0.65376556", "text": "handleErrors(response) { // prepares error message for HTTP request errors\n if (response.ok === true) {\n return response.json();\n } else {\n throw new Error(\"Code \" + response.status + \" Message: \" + response.statusText)\n }\n }", "title": "" }, { "docid": "e35bc3e66333abc3da5df75317e92c3d", "score": "0.6518692", "text": "function errorHandling(error, status, response){\n response.status(status).send('Sorry, something went wrong');\n}", "title": "" }, { "docid": "67d6421fc95ed0b6387bad5165a0f1aa", "score": "0.63934386", "text": "_onProcessOrderEmailError() {\n EventEmitter.on(eventMap.processOrderEmailFailed, (response) => {\n this.summaryRenderer.cleanAlerts();\n this.summaryRenderer.renderErrorMessage(response.responseJSON.message);\n });\n }", "title": "" }, { "docid": "4e5a16c99db909ca019e90f3ad68162a", "score": "0.6373187", "text": "function _onRecordUpdateError() {\n console.log(\"error on record update - PUT Error\");\n vm.$alertService.error(\"Error\");\n }", "title": "" }, { "docid": "e832249dd8f7693c26c10e967b1e4ec5", "score": "0.6357046", "text": "function handleError (error) {\n self.handleError(error)\n }", "title": "" }, { "docid": "f21bf00b582dc1dda52588c7c6fcdb17", "score": "0.63471246", "text": "errorHandler (err, request, response, next) {\n return response.status(500).json(\n { status: 500,\n success: false,\n message: 'Internal server errorr',\n error: err.message })\n }", "title": "" }, { "docid": "bb950164ea7b85e458703a4a2a5af0e0", "score": "0.6336778", "text": "function handleErrors() {\n let args = Array.prototype.slice.call(arguments);\n notify.onError({\n title: 'Compile Error',\n message: '<%= error.message %>'\n }).apply(this, args);\n this.emit('end'); // Keep gulp from hanging on this task\n}", "title": "" }, { "docid": "0407495ef8f49e31a8c383673c80bbd9", "score": "0.63205695", "text": "catchApiErrors(){\n if(!this.error) return;\n if (this.error.response){\n // Request made and server responded\n console.log(this.error.response.data);\n console.log(this.error.response.status);\n console.log(this.error.response.headers);\n this.msg = this.error.response.data.message;\n }else if (this.error.request){\n // The request was made but no response was received\n console.log(this.error.request);\n this.err_msg = this.error.message;\n }else{\n // Something happened in setting up the request that triggered an Error\n console.log('Error', this.error.message);\n this.err_msg = this.error.message;\n }\n }", "title": "" }, { "docid": "101ae0df2f3c2a885402b8b274aa602f", "score": "0.6297146", "text": "handleError(err) {\n if (err.response) {\n this.errorMsg =\n \"Oops ! Looks like the request failed to get data. Please try again later...\";\n // console.log(\"Problem with Response\",err.response.status);\n } else {\n this.errorMsg = \"Error Occured ! Please try again later...\";\n // console.log(\"Error Occured -\",err.message);\n }\n }", "title": "" }, { "docid": "67b7181c687130453cc7fb7b27df6956", "score": "0.6296991", "text": "function handleError() {\n console.log('se ha presentado un error');\n}", "title": "" }, { "docid": "089e763bbe4f9c2f0ccd30c93b149f5f", "score": "0.62931764", "text": "handleUnhandleds() {\n this.Errors.handleUnhandleds();\n }", "title": "" }, { "docid": "25bfe5c1c9778c3c617551f859089a17", "score": "0.62715423", "text": "function ticket_managingError_controller(){}", "title": "" }, { "docid": "c00e4021de737f91f2725c1915369d56", "score": "0.6263275", "text": "function handleError() {\n return ({ errors: ['There was no response from the server.'] });\n}", "title": "" }, { "docid": "f2c9f3797df860f126a3cca6a7409b7b", "score": "0.6261994", "text": "function f_handleApiCallManagerErrors(err, req, res, next) {\n console.error(err);\n res.status(500);\n res.json({\n error: {\n errorCode: \"CRITICAL\",\n status: 500,\n message: \"If this error persists, please contact the server admin\"\n }\n });\n}", "title": "" }, { "docid": "c2ae30cf5daa0ea0657644495ed2793e", "score": "0.6254545", "text": "function handleException(error) {\n // clear the message array\n vm.uiState.messages = [];\n // sort the errors by http results\n switch (error.status) {\n case 400:\n addValidationMessages(error.data.ModelState);\n break;\n case 404:\n setUIState(pageMode.EXCEPTION);\n addValidationMessage('product', \"The product you were requesting could not be found\");\n break;\n case 500:\n setUIState(pageMode.EXCEPTION);\n addValidationMessage('product', \"Status: \" + error.status + \" - Error Message: \" + error.statusText);\n break;\n default:\n }\n vm.uiState.isMessageAreaVisible = (vm.uiState.messages.length > 0);\n }", "title": "" }, { "docid": "525700661cddc77b99e091534ed5113b", "score": "0.6249483", "text": "function handleError(err, res) {\n\t\tconsole.log(err);\n\t\tres.send(\"Sorry, there was an error in the server. Try navigating to the previous page.\");\n\t}", "title": "" }, { "docid": "beb0bf1b1c257a4d83c809c6507574bd", "score": "0.62454253", "text": "function handleError(res, reason, message, code) {\n\t console.log(\"ERROR: \" + reason);\n\t res.status(code || 500).json({ \"error\": message });\n\t}", "title": "" }, { "docid": "279889e32a84b9866398ef181e0b6557", "score": "0.6228865", "text": "function handleError(response,error){\n // log the error\n response.status(500).json(error);\n}", "title": "" }, { "docid": "baab4c99ee2b891274bffce317227791", "score": "0.6227173", "text": "_handleError(error) {\n set(this, 'error', error);\n }", "title": "" }, { "docid": "301f4b1a3e4fa59e6a2a13b2c18a5f4e", "score": "0.6224264", "text": "handleError(error) {\n if (this._responseReject) {\n this._responseReject(error);\n }\n if (this.errorHandler) {\n this.errorHandler(error);\n } else {\n seisplotjs.util.log(\"datalink handleError: \"+error.message);\n }\n }", "title": "" }, { "docid": "5a427da90c7755ee1347844de3190a50", "score": "0.6215073", "text": "function hndlError(err, req, res, next) {\n // unhandled error\n sendError(res, err);\n}", "title": "" }, { "docid": "a1322afd088e0546871086ad2e91fcb6", "score": "0.621305", "text": "function handleError(err, req, res) {\n\n var stack;\n\n // store the original stack for later\n if (err instanceof Error) {\n stack = err.stack;\n }\n var error = {\n message: err.message || 'Internal Server Error'\n };\n\n if (err.status) {\n error.status = err.status;\n }\n\n res.format({\n html: function () {\n res.render(req.model.viewName, _.extend({\n error: error\n }, req.model));\n },\n json: function () {\n res.json(_.extend({\n error: error\n }, req.model));\n }\n });\n\n\n}", "title": "" }, { "docid": "f16ecf46cb17f058eaf2ea667392c808", "score": "0.62039536", "text": "_handleRequest(request, response, next) {\n // Try to write an error response through an appropriate view\n let error = response.error || (response.error = new Error('Unknown error')),\n view = this._negotiateView('Error', request, response),\n metadata = { prefixes: this._prefixes, datasources: this._datasources, error: error };\n response.writeHead(500);\n view.render(metadata, request, response);\n }", "title": "" }, { "docid": "7b7e8601de25640fd2bec36616c9c09d", "score": "0.6189891", "text": "function handleError(e) {\n try {\n // If Login Error\n if(e.status === 401){\n if (e.responseJSON.type === 'login_other_browser'){\n location.reload();\n return;\n }\n else if(e.responseJSON.type === 'logout'){\n location.reload();\n return;\n }\n }\n if (typeof e.responseText != 'undefined' && e.responseText != '') {\n var error = JSON.parse(e.responseText);\n var params = '';\n if (!isBlank(error.message)) {\n params = error.code + \"/\" + decodeURIComponent(error.message);\n }\n window.location.href = window.location.href.split('users/general')[0] + 'error/' + params;\n }\n } catch (ex) {\n window.location.href = window.location.href.split('users/general')[0] + 'error';\n }\n}", "title": "" }, { "docid": "7ee26e05a32c8b781fcdaad9981f3ce3", "score": "0.61838025", "text": "function handleError(model, err){\n this.$consumersFieldError.html(err);\n }", "title": "" }, { "docid": "ed2de3c0d04646dd22e740e1a3848a09", "score": "0.61740595", "text": "function handleError(errors, error) {\n utilService.handleDialogError($scope.errors, error);\n }", "title": "" }, { "docid": "1bee5ba63de1fe4602e25653f1e343fc", "score": "0.6173333", "text": "function handleError(reason, message, code) {\n console.log(\"ERROR: \" + reason);\n //res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "cc72b52a382f56a7c27b5d9eacb9d5de", "score": "0.61517006", "text": "_handleErrorEvent(err) {\n if (this._connecting) {\n return this._handleErrorWhileConnecting(err)\n }\n this._queryable = false\n this._errorAllQueries(err)\n this.emit('error', err)\n }", "title": "" }, { "docid": "31cbaf2007385eff37cc7589b74dd23a", "score": "0.61465895", "text": "function handleError(errMessage, resp) {\n var errorMessage = errMessage;\n\n if(resp != null) {\n IDMappingExtUtils.traceString(\"Error response: \"+resp.getCode());\n IDMappingExtUtils.traceString(\"Error response body: \"+resp.getBody());\n var json = getJSON(resp);\n\n if(json != null && json.messageDescription != null) {\n errorMessage = json.messageDescription;\n }\n }\n\n macros.put(\"@ERROR_MESSAGE@\", errorMessage);\n page.setValue(\"/authsvc/authenticator/ci/error.html\");\n}", "title": "" }, { "docid": "94273a8b5e94a02b16a51c8a0d47d677", "score": "0.6145133", "text": "function handleRequestError(res) {\n if (res.error) {\n // XXX: we can (and actually do) better in the client...\n throw res.error;\n }\n}", "title": "" }, { "docid": "81a712a817579ea199762d638d00c86c", "score": "0.614139", "text": "function handleError(error) {\n $scope.status['submitLoading'] = false;\n $scope.status['containsNoError'] = false;\n submit.ErrorMessages['general'] = \"Ooops hubo un problema ... \" + error;\n }", "title": "" }, { "docid": "81a712a817579ea199762d638d00c86c", "score": "0.614139", "text": "function handleError(error) {\n $scope.status['submitLoading'] = false;\n $scope.status['containsNoError'] = false;\n submit.ErrorMessages['general'] = \"Ooops hubo un problema ... \" + error;\n }", "title": "" }, { "docid": "2a0bec1a792a3eb60829231ce8292f8c", "score": "0.6132041", "text": "function errorHandling(resp) {\n if (!resp.ok) { // resp is not okay on network failure or something preventing the request from completeing\n if (resp.status >= 400 && resp.status < 500) { // status is from 400-500 on client errors\n return resp.json().then(data => {\n let err = { errMessage: data.message };\n throw err;\n });\n } else { // there's a network failure or something stopping the req from completing\n let err = { errMessage: 'Please try again later. There\\'s something wrong in the cloud' };\n throw err;\n }\n }\n}", "title": "" }, { "docid": "3d293314145917e2eae356f68f608106", "score": "0.6131331", "text": "function handleErrors(response) {\nif (!response.ok) {\n throw Error(response.statusText);\n}\nreturn response;\n}", "title": "" }, { "docid": "4ef8fa25e0bbf8e78e2b53816c77c877", "score": "0.61296487", "text": "function update_error(){\n // your code when post failed\n console.log(\"error!\");\n}", "title": "" }, { "docid": "984d1cc0fd90571eb75901bc351f55e6", "score": "0.612782", "text": "function handleError(error) {\n submit.status['submitLoading'] = false;\n submit.status['containsNoError'] = false;\n submit.ErrorMessages['general'] = \"Ooops hubo un problema ... \" + error;\n }", "title": "" }, { "docid": "984d1cc0fd90571eb75901bc351f55e6", "score": "0.612782", "text": "function handleError(error) {\n submit.status['submitLoading'] = false;\n submit.status['containsNoError'] = false;\n submit.ErrorMessages['general'] = \"Ooops hubo un problema ... \" + error;\n }", "title": "" }, { "docid": "984d1cc0fd90571eb75901bc351f55e6", "score": "0.612782", "text": "function handleError(error) {\n submit.status['submitLoading'] = false;\n submit.status['containsNoError'] = false;\n submit.ErrorMessages['general'] = \"Ooops hubo un problema ... \" + error;\n }", "title": "" }, { "docid": "984d1cc0fd90571eb75901bc351f55e6", "score": "0.612782", "text": "function handleError(error) {\n submit.status['submitLoading'] = false;\n submit.status['containsNoError'] = false;\n submit.ErrorMessages['general'] = \"Ooops hubo un problema ... \" + error;\n }", "title": "" }, { "docid": "984d1cc0fd90571eb75901bc351f55e6", "score": "0.612782", "text": "function handleError(error) {\n submit.status['submitLoading'] = false;\n submit.status['containsNoError'] = false;\n submit.ErrorMessages['general'] = \"Ooops hubo un problema ... \" + error;\n }", "title": "" }, { "docid": "14d8d98478f64d1914c660ca4e45ba98", "score": "0.6117599", "text": "function handleError(err, vm, msgPrefix, status) {\n\n if (!vm) return;\n\n if (status === 404) {\n // TODO: go to a specific page\n }\n\n if (err != null) {\n var errors = [];\n if (err.ModelState) {\n for (var key in err.ModelState) {\n for (var i = 0; i < response.data.ModelState[key].length; i++) {\n errors.push(response.data.ModelState[key][i]);\n }\n }\n\n vm.message = (msgPrefix || '') + errors.join(' ');\n } else {\n if (err.ExceptionMessage !== undefined)\n vm.message = (msgPrefix || '') + err.ExceptionMessage;\n else if (err.error_description !== undefined)\n vm.message = (msgPrefix || '') + err.error_description;\n else if (err.data) {\n if (err.data.ExceptionMessage !== undefined) {\n vm.message = (msgPrefix || '') + err.data.ExceptionMessage;\n } else {\n vm.message = (msgPrefix || '') + err.data.Message;\n }\n } else if (err.substring)\n vm.message = (msgPrefix || '') + err;\n else\n vm.message = (msgPrefix || '') + \"unknown error, please try again later.\";\n }\n } else {\n vm.message = \"An error just occurred, please try again later.\";\n }\n }", "title": "" }, { "docid": "3c5b55d61c04e28f10d54a01c05496a3", "score": "0.6113108", "text": "function handleError(res, reason, message, code) {\r\n console.log(\"ERROR: \" + reason);\r\n res.status(code || 500).json({\"error\": message});\r\n}", "title": "" }, { "docid": "d1a304a3c351d8abd0484eabc9d54e2d", "score": "0.60912853", "text": "handleError(error) {\n throw new Error(error);\n }", "title": "" }, { "docid": "ee83544c9dfacb1d656fbda7c90ea62b", "score": "0.60876197", "text": "function handleError (err) {\n plugins.gutil.log(plugins.gutil.colors.red(err));\n this.emit('end');\n}", "title": "" }, { "docid": "37eac6087541a045c9fefccbcd4bd6f6", "score": "0.6086529", "text": "function handleError(res, reason, message, code) {\n console.error(\"[ERROR] \" + reason);\n res.status(code || 500).json({\"error\": reason});\n }", "title": "" }, { "docid": "3680f55260c74be2b463e1954882fc9a", "score": "0.6077275", "text": "function handleError(res, reason, message, code){\n\tconsole.log(\"ERROR: \" + reason);\n\tres.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "46dfbdfe2e98669d991a0f5b025d65a6", "score": "0.60768485", "text": "function handleResponseOnError (err, node)\n {\n \tnode.log(\"Response on ERROR fired\");\n\n // Por si las moscas\n clearTimeout(node.context().get('serverGoneTimer'));\n\n // Indicamos el error en el nodo y lo hacemos cacheable por nodo Catch\n node.status({fill:\"red\", shape:\"ring\", text:err.toString()});\n node.error(\"Response error: \" + err.toString(), {});\n }", "title": "" }, { "docid": "352c78a5de7d51485d1cfbdfd2c10857", "score": "0.6075164", "text": "function handleError(res, reason, message, code){\n\tconsole.log(\"ERROR: \" + reason);\n\tres.status(code || 500).json({\"error\":message});\n}", "title": "" }, { "docid": "d3860ea600fbc134cf1f8390e32d2b3c", "score": "0.6070348", "text": "function handleError(res, reason, message, code) {\n\tconsole.log(\"API Error: \" + reason);\n\tres.status(code || 500).json({\"Error\": message});\n}", "title": "" }, { "docid": "c662cbf16b95e8d1ce1248a3097418b1", "score": "0.6069684", "text": "handleError(error) {\n this.$refs.spinner.hideSpinner();\n if (error) {\n this.resetButtonClicked = false;\n this.passwordServerError = this.i18n[\n error.response.data.errors[0].message\n ];\n globalEventBus.$emit('announce', this.passwordServerError);\n }\n }", "title": "" }, { "docid": "f3468eb694e85def9d1b0b2be6bc4f7c", "score": "0.60667336", "text": "function mongoDbErrorHandling(err) {\n console.log();\n console.log('There was an error!');\n console.log(err);\n console.log();\n // return res.send(err);\n return res.send(500, { error: err });\n}", "title": "" }, { "docid": "c9d38ea50c7bc9473f21d550b85d43e3", "score": "0.60639507", "text": "static handleErrors(response) {\n if (!response.ok) {\n throw new Error(response.statusText);\n }\n return response;\n }", "title": "" }, { "docid": "2c356b06c4aca7bb195d9117604b3926", "score": "0.6061782", "text": "function handleError(res, reason, message, code) {\n\tconsole.log(\"ERROR: \" + reason);\n\tres.status(code || 500).json({\n\t\t\"error\" : message\n\t});\n}", "title": "" }, { "docid": "0385b1db27d08ba10a75d5eb7e168335", "score": "0.606148", "text": "function handleError(res, reason, message, code) {\n\tconsole.log(\"ERROR: \" + reason);\n\tres.status(code || 500).json({\n\t\t\"error\": message\n\t});\n}", "title": "" }, { "docid": "640163c36ad14e9d14f07d71eb061fa6", "score": "0.60612494", "text": "function handleError(error) {\n growl.error(errorMessage, {ttl:7000});\n reject(null);\n }", "title": "" }, { "docid": "66c56339451d2d6fd734ba65c3624fb9", "score": "0.60595506", "text": "appError(){\r\n console.log('Server Error');\r\n }", "title": "" }, { "docid": "279d1a89c02401bb3950a7605c5c868d", "score": "0.6057169", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "279d1a89c02401bb3950a7605c5c868d", "score": "0.6057169", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "279d1a89c02401bb3950a7605c5c868d", "score": "0.6057169", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "279d1a89c02401bb3950a7605c5c868d", "score": "0.6057169", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "279d1a89c02401bb3950a7605c5c868d", "score": "0.6057169", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "641196b3da2ac904dd984b2b36a0e3b7", "score": "0.60539395", "text": "_handleErrorMessage(msg) {\n if (this._connecting) {\n return this._handleErrorWhileConnecting(msg)\n }\n const activeQuery = this.activeQuery\n\n if (!activeQuery) {\n this._handleErrorEvent(msg)\n return\n }\n\n this.activeQuery = null\n activeQuery.handleError(msg, this.connection)\n }", "title": "" }, { "docid": "a53ce8b283250f640107758f285c8f98", "score": "0.6053419", "text": "function handleError( res, reason, message, code ) {\n console.log( 'ERROR: ' + reason );\n res.status( code || 500 ).json({ error: message });\n}", "title": "" }, { "docid": "254e56527dc84d2861e8a3b13de443e4", "score": "0.6047373", "text": "function _handleRoutingErrors() {\n $rootScope.$on('$stateChangeError', onEvent);\n\n //noinspection JSUnusedLocalSymbols\n\n /**\n * Callback for $stateChangeError event.\n *\n * @param {object} event\n * @param {IState} toState\n * @param {object} toParams\n * @param {IState} fromState\n * @param {object} fromParams\n * @param {Error|string} error\n */\n function onEvent(event, toState, toParams, fromState, fromParams, error) {\n // Oh noes error is already activated\n if (handlingStateChangeError) {\n return;\n }\n\n stateCounts.errors++;\n handlingStateChangeError = true;\n\n // State requires authenticated user.\n if (error === 'AUTH_REQUIRED') {\n $state.go('auth.login');\n\n logger.error('Login required');\n } else { // Otherwise show error message and redirect user to root (/)\n var message = _getErrorMessage(error, toState);\n\n logger.warning(message, toState);\n\n $location.path('/');\n }\n }\n }", "title": "" }, { "docid": "5c37fdea09c67b7e33f64c55a3b15327", "score": "0.6044202", "text": "function handleError(res, reason, message, code) {\n console.log(\"Error: \", reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "4d54bda9a7aed2bc29050298615e8f90", "score": "0.6041957", "text": "function handleError(res, reason, message, code){\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "97319bfd209e40d23cd0cf724c7be525", "score": "0.60383075", "text": "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n}", "title": "" }, { "docid": "877b98d3750780e90ef37baf6ace7043", "score": "0.60376024", "text": "function useErrorHandlers() {\n const component = Component.current;\n\n component._handlePushOrderError = async function (error) {\n // This error handler receives `error` equivalent to `error.message` of the rpc error.\n if (error.message === 'Backend Invoice') {\n await this.showPopup('ConfirmPopup', {\n title: this.env._t('Please print the invoice from the backend'),\n body:\n this.env._t(\n 'The order has been synchronized earlier. Please make the invoice from the backend for the order: '\n ) + error.data.order.name,\n });\n } else if (error.code < 0) {\n // XmlHttpRequest Errors\n const title = this.env._t('Unable to sync order');\n const body = this.env._t(\n 'Check the internet connection then try to sync again by clicking on the red wifi button (upper right of the screen).'\n );\n await this.showPopup('OfflineErrorPopup', { title, body });\n } else if (error.code === 200) {\n // OpenERP Server Errors\n await this.showPopup('ErrorTracebackPopup', {\n title: error.data.message || this.env._t('Server Error'),\n body:\n error.data.debug ||\n this.env._t('The server encountered an error while receiving your order.'),\n });\n } else if (error.code === 700) {\n // Fiscal module errors\n await this.showPopup('ErrorPopup', {\n title: this.env._t('Fiscal data module error'),\n body:\n error.data.error.status ||\n this.env._t('The fiscal data module encountered an error while receiving your order.'),\n });\n } else {\n // ???\n await this.showPopup('ErrorPopup', {\n title: this.env._t('Unknown Error'),\n body: this.env._t(\n 'The order could not be sent to the server due to an unknown error'\n ),\n });\n }\n };\n }", "title": "" }, { "docid": "8945ae1c5eb5d61ed716c5e1ee630bea", "score": "0.6033639", "text": "_attachErrorHandler() {\n // catch 404 and forward to error handler\n this.app.use((req, res, next) => {\n const error = new AppError('The page you were looking for was not found', 404);\n next(error);\n });\n if (this.app.get('env') === 'development') {\n this.app.use((err, req, res, next) => {\n req.scope.addData({\n error: err\n });\n res.status(err.status || 500);\n res.render('error', req.scope);\n });\n }\n\n /**\n * production error handler\n * no stacktraces leaked to user\n */\n this.app.use((err, req, res, next) => {\n res.status(err.status || 500);\n delete err.stack;\n req.scope.addData(err);\n res.render('error', req.scope);\n });\n }", "title": "" }, { "docid": "821b3512c7957645627005de315b63e1", "score": "0.6032696", "text": "function handleError(err, req, res, next) {\n res.status(err.status || 500);\n res.render('error', {\n message: err.message,\n error: {}\n });\n}", "title": "" }, { "docid": "db985f8f50c941a2c5bc1a0de5ab918d", "score": "0.6029644", "text": "function handleErrors (err, req, res, next) {\n if (err.statusCode && err.body) {\n bunyan.customLog('debug', req, { message: \"Validation errors\", errors: err.body, responseStatus: err.statusCode });\n return res.json(err.statusCode, err.body);\n } else if (err.message) {\n bunyan.error(err);\n return res.send(500, err.message);\n } else {\n bunyan.error(err);\n return res.send(500, 'Unknown error');\n }\n}", "title": "" } ]
559fa926f9ae2e6fbb3fc606a95c5843
Given range (or extent) of brush, returns limited range to prevent values outofrange to be registered, e.g. [1.6, 10]
[ { "docid": "49d08a71ac2e01e4d17b0c43c54002ce", "score": "0.0", "text": "function filter_domain(aloi) {\n aloi.sort(function (a, b) {\n return a - b;\n });\n aloi[0] = Math.max(MIN_X_DOMAIN, aloi[0]);\n aloi[1] = Math.min(MAX_X_DOMAIN, aloi[1]);\n if (aloi[0] == aloi[1]) {\n if (aloi[1] == MAX_X_DOMAIN) {\n aloi[0] -= DATA_IV;\n } else {\n aloi[1] += DATA_IV; // Increment max range to prevent non-existent\n }\n }\n return aloi;\n}", "title": "" } ]
[ { "docid": "663aef12345473c148c4567d48e83572", "score": "0.6781073", "text": "_getRange() {\n const that = this;\n\n if (that.logarithmicScale) {\n that._range = that._drawMax - that._drawMin;\n return;\n }\n\n if (that.scaleType === 'floatingPoint') {\n that._range = (that._drawMax - that._drawMin).toString();\n }\n else {\n that._range = new JQX.Utilities.BigNumber(that._drawMax).subtract(that._drawMin).toString();\n }\n }", "title": "" }, { "docid": "36cb66ec77c1b67c415ce341ac7f516a", "score": "0.6464282", "text": "function numericExtent(values) {\n var _a = extent(values), min = _a[0], max = _a[1];\n if (typeof min === 'number' && isFinite(min) && typeof max === 'number' && isFinite(max)) {\n return [min, max];\n }\n}", "title": "" }, { "docid": "7e001c096d2dd81b0f9de05575a16018", "score": "0.64261", "text": "function clampRange(range, min, max) {\n var lo = range[0],\n hi = range[1],\n span;\n\n if (hi < lo) {\n span = hi;\n hi = lo;\n lo = span;\n }\n span = hi - lo;\n\n return span >= (max - min)\n ? [min, max]\n : [\n (lo = Math.min(Math.max(lo, min), max - span)),\n lo + span\n ];\n }", "title": "" }, { "docid": "0329870ddb47dff31cb1f0b874258954", "score": "0.6356569", "text": "function d3_scaleRange(scale) {\n return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());\n}", "title": "" }, { "docid": "0e31baeb21b69ac7ed8e1c6e0b5ed6b4", "score": "0.6208844", "text": "function Range() {\n\tthis._value = 0;\n\tthis._minimum = 0;\n\tthis._maximum = 100;\n\tthis._extent = 0;\n\t\n\tthis._isChanging = false;\n}", "title": "" }, { "docid": "4a504cb6c743c1a6851cd475aca50781", "score": "0.62015265", "text": "function extendRange(range_arr, extend_coef) {\n var max = range_arr[1];\n var min = range_arr[0];\n max = max + Math.abs(max) * extend_coef;\n min = min - Math.abs(min) * extend_coef;\n var extended_arr = [min, max];\n return extended_arr;\n\n}", "title": "" }, { "docid": "6465feace8d0fa8a3b00baa921cf361d", "score": "0.61987776", "text": "function fitToRange(value, minValue, maxValue) {\n if (_Type__WEBPACK_IMPORTED_MODULE_0__[\"isNumber\"](minValue)) {\n if (_Type__WEBPACK_IMPORTED_MODULE_0__[\"isNumber\"](maxValue) && maxValue < minValue) {\n var temp = maxValue;\n maxValue = minValue;\n minValue = temp;\n }\n if (value < minValue) {\n value = minValue;\n }\n }\n if (_Type__WEBPACK_IMPORTED_MODULE_0__[\"isNumber\"](maxValue)) {\n if (value > maxValue) {\n value = maxValue;\n }\n }\n return value;\n}", "title": "" }, { "docid": "cb0b4360d5aa3612d8b30db9bac7a36c", "score": "0.6154171", "text": "function extent(arr){\n return [min(arr), max(arr)];\n }", "title": "" }, { "docid": "15425fc91ead6f24d5fc93a450d517b9", "score": "0.6138176", "text": "function __WEBPACK_DEFAULT_EXPORT__(range, min, max) {\n var lo = range[0],\n hi = range[1],\n span;\n\n if (hi < lo) {\n span = hi;\n hi = lo;\n lo = span;\n }\n span = hi - lo;\n\n return span >= (max - min)\n ? [min, max]\n : [\n (lo = Math.min(Math.max(lo, min), max - span)),\n lo + span\n ];\n}", "title": "" }, { "docid": "56f836dc4b35bd86db5b33e05a2eb5b8", "score": "0.6135577", "text": "_setRange(range) {\n const min2Scale = this._toPixelScale(range.min);\n const max2Scale = this._toPixelScale(range.max);\n const minBounds = this._toPixelScale(this.props.min);\n const maxBounds = this._toPixelScale(this.props.max);\n if (min2Scale > max2Scale) {\n throw new Error(`Minimum slider value: ${range.min} is greater than max value: ${range.max}`);\n }\n if (min2Scale < minBounds || min2Scale > maxBounds) {\n throw new Error(`Minimum slider value: ${range.min} exceeds bounds:\n ${this.props.min} - ${this.props.max}`);\n }\n if (max2Scale < minBounds || max2Scale > maxBounds) {\n throw new Error(`Maximum slider value: ${range.max} exceeds bounds:\n ${this.props.min} - ${this.props.max}`);\n }\n this._range = {\n min: min2Scale || 0,\n max: max2Scale || 0,\n };\n return this._range;\n }", "title": "" }, { "docid": "524cffc8f3e9dbcfe2b78a18d4611d1b", "score": "0.6111301", "text": "function limitRange(node, minX, minY, maxX, maxY) {\n var width = node.width,\n height = node.height;\n var targetX = node.x;\n var targetY = node.y;\n\n if (targetX < minX) {\n targetX = minX;\n }\n\n if (targetY < minY) {\n targetY = minY;\n }\n\n if (targetX >= maxX - width) {\n targetX = maxX - width - 1;\n }\n\n if (targetY >= maxY - height) {\n targetY = maxY - height - 1;\n }\n\n return {\n x: targetX,\n y: targetY\n };\n}", "title": "" }, { "docid": "28ab9cfc5444c26b2a76dc54a7ea4299", "score": "0.60930246", "text": "function __WEBPACK_DEFAULT_EXPORT__(range, min, max) {\n var lo = range[0],\n hi = range[1],\n span;\n\n if (hi < lo) {\n span = hi;\n hi = lo;\n lo = span;\n }\n span = hi - lo;\n\n return span >= (max - min)\n ? [min, max]\n : [\n Math.min(Math.max(lo, min), max - span),\n Math.min(Math.max(hi, span), max)\n ];\n}", "title": "" }, { "docid": "afa0e6c683fcf1cfff57d9d80f6ef373", "score": "0.6082071", "text": "calc_range() {\n let z = this.zoom / this.drug.z\n let zk = (1 / z - 1) / 2\n\n let range = this.y_range.slice()\n let delta = range[0] - range[1]\n range[0] = range[0] + delta * zk\n range[1] = range[1] - delta * zk\n\n return range\n }", "title": "" }, { "docid": "65826fc89d93a3e2e0abf826d9362a6b", "score": "0.6055713", "text": "function restrictToRange(val,min,max) {\n\t\tif (val < min) return min;\n\t\tif (val > max) return max;\n\t\treturn val;\n\t}", "title": "" }, { "docid": "e680fb3dc5d09a19a17b26c2c047a093", "score": "0.6052745", "text": "limits() {\n var keys = Object.keys(this.data);\n var min = parseInt(this.data[keys[0]]); // ignoring case of empty list for conciseness\n var max = parseInt(this.data[keys[0]]);\n var i;\n for (i = 1; i < keys.length; i++) {\n var value = parseInt(this.data[keys[i]]);\n if (value < min) min = value;\n if (value > max) max = value;\n }\n this.yMin =min - Math.round(min/4);\n if(this.yMin <= 0)\n this.yMin=0;\n this.yMax = max + Math.round(max/4);\n\n }", "title": "" }, { "docid": "3bd86169919e7f84eff85a7a516c3c0d", "score": "0.60477704", "text": "validateColorRange(value) {\n const that = this.context;\n\n return Math.min(Math.max(value, that.min), that.max);\n }", "title": "" }, { "docid": "f5732b6f3945183db8e24beb57b2f835", "score": "0.60463166", "text": "function explicitRange(min, max) {\n return tr.b.math.Range.fromExplicitRange(min, max);\n }", "title": "" }, { "docid": "7f22f35977e738c5f79c968b9b298aa0", "score": "0.60378593", "text": "_setRangeDebouced() {\n var range;\n if(this.orientation === 'vertical') {\n var h = Math.max(this._height, 0);\n range = [h, 0];\n\n } else {\n var w = Math.max(this._width, 0);\n range = [0, w];\n }\n\n this._scale.range(range);\n\n // force a recalc\n this._scaleChanged = !this._scaleChanged;\n }", "title": "" }, { "docid": "4f23ca406a87cb4cb2079494ccba0fc2", "score": "0.60287726", "text": "function rangeMinLimiter(zoomPanOptions, newMin) {\n\tif (zoomPanOptions.scaleAxes && zoomPanOptions.rangeMin &&\n\t\t\t!helpers.isNullOrUndef(zoomPanOptions.rangeMin[zoomPanOptions.scaleAxes])) {\n\t\tvar rangeMin = zoomPanOptions.rangeMin[zoomPanOptions.scaleAxes];\n\t\tif (newMin < rangeMin) {\n\t\t\tnewMin = rangeMin;\n\t\t}\n\t}\n\treturn newMin;\n}", "title": "" }, { "docid": "034fef91090c755110733d9479d46e53", "score": "0.5990169", "text": "function d3_scaleExtent(domain) {\n var start = domain[0], stop = domain[domain.length - 1];\n return start < stop ? [start, stop] : [stop, start];\n}", "title": "" }, { "docid": "fc465cedcd6f223056821a94f044eab2", "score": "0.5983411", "text": "function getPriceRange(data) {\r\n var range = d3.extent(data, function(d) {\r\n return +d['Price']\r\n });\r\n // console.log(\"min price: \" + range[0] + \" max price: \" + range[1]);\r\n return range;\r\n }", "title": "" }, { "docid": "1176e52a4fc8900c18c121c16b319ef6", "score": "0.59815365", "text": "function clamp(min, x, max) { return Math.min(Math.max(x, min), max); }", "title": "" }, { "docid": "a427a63bcc4872ed6fc43d01bc6f67fe", "score": "0.59805566", "text": "function calcRange(low, high, factor) {\n\t\tvar j = 0;\n\t\tvar ticks = new Array();\n\t\tvar step = Math.ceil((high - low) / 50) * 5 * factor;\n\t\tvar min = ((low == 0) ? 0 : (low - (low + 1) % step - step + 1));\n\t\tvar max = high - (high - 1) % step + step - 1;\n\t\tfor (i = min; i <= max; i += step) {\n\t\t\tticks[j++] = i;\n\t\t}\n\t\tvar range = {\"min\": min, \"max\": max, \"ticks\": ticks};\n\t\treturn range;\n\t}", "title": "" }, { "docid": "d30298138fdb5cef90a4c8a729d7fd1a", "score": "0.5976107", "text": "function range(scale) {\n // for non ordinal, simply return the range\n if (!isOrdinal(scale)) {\n return scale.range();\n }\n\n // For ordinal, use the rangeExtent. However, rangeExtent always provides\n // a non inverted range (i.e. extent[0] < extent[1]) regardless of the\n // range set on the scale. The logic below detects the inverted case.\n //\n // The d3 code that tackles the same issue doesn't have to deal with the inverted case.\n var scaleRange = scale.range();\n var extent = scale.rangeExtent();\n if (scaleRange.length <= 1) {\n // we cannot detect the inverted case if the range (and domain) has\n // a single item in it.\n return extent;\n }\n\n var inverted = scaleRange[0] > scaleRange[1];\n return inverted ? [extent[1], extent[0]] : extent;\n }", "title": "" }, { "docid": "b756f4c561f7bbae7198b433709aed46", "score": "0.59631145", "text": "validateColorRange(value) {\n const that = this.context;\n\n if (that._wordLengthNumber < 64) {\n return super.validateColorRange(value);\n }\n\n if (that.mode === 'numeric') {\n value = new JQX.Utilities.BigNumber(value);\n }\n else {\n value = JQX.Utilities.DateTime.validateDate(value);\n value = value.getTimeStamp();\n }\n\n const bigMin = new JQX.Utilities.BigNumber(that.min),\n bigMax = new JQX.Utilities.BigNumber(that.max);\n\n if (value.compare(bigMin) === -1) {\n value = bigMin;\n }\n\n if (value.compare(bigMax) === 1) {\n value = bigMax;\n }\n\n return value;\n }", "title": "" }, { "docid": "6907acdcb3feb1948d5624dce174a22c", "score": "0.5948581", "text": "require_range(min,max,value, field_name=\"\"){\n\t if (this.is_empty(value) ){ return value; }\n\t var number = this.to_number(value);\n\t if (value < min || value > max) {\n\t throw new Error(`out of range ${value} ${field_name} ${value}`);\n\t }\n\t return value;\n\t }", "title": "" }, { "docid": "80f35ab43043ef3880041fb0d47dda2a", "score": "0.59240776", "text": "function clipRange(range, min, max) {\n return range\n .filter(segment => segment[1] >= min && segment[0] <= max)\n .map(segment => [Math.max(segment[0], min), Math.min(segment[1], max)]);\n}", "title": "" }, { "docid": "98edbf1e98660c8ce09b2eab209c4ca6", "score": "0.5915166", "text": "function bound(value, min, max)\n{\n\tif(value < min)\n\t\treturn min;\n\tif(value > max)\n\t\treturn max;\n\treturn value;\n}", "title": "" }, { "docid": "b25b55ecf0f2dc13dc02860186df9e31", "score": "0.5896635", "text": "function set_brush_extent(ext) {\n this.brush.extent(ext);\n return this;\n }", "title": "" }, { "docid": "1cac2046e3dc6ac0b12f07b4de51a66a", "score": "0.58875394", "text": "function range(min, max) {\n return {\n accepts: function (_, list) { return max === undefined || list.length < max; },\n complete: function (list) { return list.length >= min; }\n };\n}", "title": "" }, { "docid": "3ac9bf93d64150d62723f398982566e6", "score": "0.58796936", "text": "function range(nbr,min,max){if(nbr<min){return min;}else if(nbr>max){return max;}else{return nbr;}}", "title": "" }, { "docid": "52bfe5f2d86bfcdf51accb39ca0b86e1", "score": "0.58660793", "text": "function toValidRange(value) {\n value = parseFloat(value);\n\n // value is too small\n if (!value || value < MIN) {\n return MIN;\n }\n\n // value is too big\n if (value > MAX) {\n return MAX;\n }\n\n // value have float value\n return parseFloat(value.toFixed(ZOOM_PRECISION));\n }", "title": "" }, { "docid": "b84104922a60a26324bb854f28caab98", "score": "0.58587337", "text": "function calculateRange(upperOrLower, series) {\n if (upperOrLower === 'upper') {\n highestPoint = _.max(_.pluck(series, 'y'))\n return Math.ceil(highestPoint/5)*5;\n }\n else if (upperOrLower === 'lower') {\n lowestPoint = _.min(_.pluck(series, 'y'))\n return Math.floor(lowestPoint/5)*5;\n }\n else {\n return 0;\n }\n }", "title": "" }, { "docid": "38a0a8bb50c94f1e0add086812e7eca9", "score": "0.5858425", "text": "function getBarExtent(){\n \t\tvar repExtent = getExtent(\"Representatives\"),\n \t\t\telectoralExtent = getExtent(\"Electoral Votes\");\n \t\treturn [d3.min([repExtent[0],electoralExtent[0]]), d3.max([repExtent[1],electoralExtent[1]])];\n\t\t}", "title": "" }, { "docid": "4fa08cb9d4d207a30d4a9a70f63aa7cc", "score": "0.5849173", "text": "clamp(min, max) {\r\n if (this.data < min) return FNumber(min)\r\n if (this.data > max) return FNumber(max)\r\n\r\n return FNumber(this.data)\r\n }", "title": "" }, { "docid": "fd97c049cfe5e609f376b1ed3ff214da", "score": "0.5842206", "text": "function clampBetween(value, lowerBound, upperBound) {\n let result;\n if ( value >= lowerBound && value <= upperBound) {\n result = value;\n } else if (value < lowerBound) {\n result = lowerBound;\n } else if ( value > upperBound) {\n result = upperBound;\n }\n return result;\n}", "title": "" }, { "docid": "7b20cc2d2df97bba132b8d2d23c55269", "score": "0.5840214", "text": "function toNumberRange(value, min, max) {\n if (_Type__WEBPACK_IMPORTED_MODULE_0__[\"hasValue\"](value)) {\n value = _Type__WEBPACK_IMPORTED_MODULE_0__[\"toNumber\"](value);\n return fitToRange(value, min, max);\n }\n return value;\n}", "title": "" }, { "docid": "82a11ddc79b11922b3933d3c9e12e771", "score": "0.58324355", "text": "function wrapInBounds(min, max, value) {\n if (value < min) {\n return max;\n } else if (value > max) {\n return min;\n }\n\n return value;\n}", "title": "" }, { "docid": "c64e91545c333e5837da4aa1b9f20c04", "score": "0.5830071", "text": "function getQuantizeScale(domain, range) {\n return function (value) {\n var step = (domain[1] - domain[0]) / range.length;\n var idx = Math.floor((value - domain[0]) / step);\n var clampIdx = Math.max(Math.min(idx, range.length - 1), 0);\n\n return range[clampIdx];\n };\n}", "title": "" }, { "docid": "c5060681ff340be1b2fd6d6400c03d81", "score": "0.58285874", "text": "function locRange(min, max) {\n let buffer = Math.ceil((max - min) / 10) \n const values = [min]\n for (let i = 1; i < 11; i++) {\n values[i] = values[i - 1] + buffer\n }\n return values\n}", "title": "" }, { "docid": "f6d9f13e1f57139a5ed2894c32ea8e65", "score": "0.5806882", "text": "_setRange() {\n this.debounce('_setRange', function() {\n if(this._scale && this._width && this._height) {\n this._setRangeDebouced();\n }\n }, 10);\n }", "title": "" }, { "docid": "0c6fc6a4a00e5463198017797cc36aa6", "score": "0.5791263", "text": "function clamp(lower, upper, x) {\n return max (lower, min (upper, x));\n }", "title": "" }, { "docid": "55c1b0af88df5da51ff48155b5e835f1", "score": "0.5790522", "text": "function scaleToRange(data, maxRange) {\n\n let min = data[0];\n let max = min;\n\n data.forEach((value) => {\n if(value < min) min = value;\n if(value > max) max = value;\n });\n\n let diff = (max - min);\n\n data.forEach((value, index) => {\n data[index] = Math.floor( (value - min) / diff * maxRange );\n });\n\n return data;\n}", "title": "" }, { "docid": "1d5a53dc2239d2d2376ae2da82faa9b6", "score": "0.577519", "text": "function extent(values) {\n var n = values.length;\n var i = -1;\n var value;\n var min;\n var max;\n while (++i < n) { // Find the first comparable value.\n if ((value = values[i]) != null && value >= value) {\n min = max = value;\n while (++i < n) { // Compare the remaining values.\n if ((value = values[i]) != null) {\n if (min > value) {\n min = value;\n }\n if (max < value) {\n max = value;\n }\n }\n }\n }\n }\n return [min, max];\n}", "title": "" }, { "docid": "e03b12634982e093508205ebe5d8216b", "score": "0.5774563", "text": "get SUPPORT_RANGE_BOUNDS() {\n 'use strict';\n\n var value = testRangeBounds(document);\n Object.defineProperty(FEATURES, 'SUPPORT_RANGE_BOUNDS', { value: value });\n return value;\n }", "title": "" }, { "docid": "e03b12634982e093508205ebe5d8216b", "score": "0.5774563", "text": "get SUPPORT_RANGE_BOUNDS() {\n 'use strict';\n\n var value = testRangeBounds(document);\n Object.defineProperty(FEATURES, 'SUPPORT_RANGE_BOUNDS', { value: value });\n return value;\n }", "title": "" }, { "docid": "e03b12634982e093508205ebe5d8216b", "score": "0.5774563", "text": "get SUPPORT_RANGE_BOUNDS() {\n 'use strict';\n\n var value = testRangeBounds(document);\n Object.defineProperty(FEATURES, 'SUPPORT_RANGE_BOUNDS', { value: value });\n return value;\n }", "title": "" }, { "docid": "fd2c144ea46f9747d3b091c38b3cab08", "score": "0.5768182", "text": "function brush() {\n var actives = dimensions.filter(function(p) { return !yScale[p].brush.empty(); }),\n extents = actives.map(function(p) { return yScale[p].brush.extent(); });\n d3.selectAll(\".foreground path\").style(\"display\", function(d) {\n var inRange = actives.every(function(p, i) {\n return extents[i][0] <= d[p] && d[p] <= extents[i][1];\n }) ? true : false;\n if (inRange){\n // Check year and region selection\n var selectedRegion = d3.select(\"#legend_\" + reduceString(d.region)).classed(\"disabled\");\n return (paraCoordsYear == d.year && !selectedRegion)? null : \"none\";\n } else {\n return \"none\";\n }\n });\n}", "title": "" }, { "docid": "32c875e29b0ff1b5f34f7992e9c28fc5", "score": "0.57588", "text": "getZRange() {\n const zValues = this.getZValues();\n if (zValues) {\n let zMin = Number.MAX_VALUE;\n let zMax = Number.MIN_VALUE;\n for (let y = 0; y < this.arrayHeight; ++y) {\n for (let x = 0; x < this.arrayWidth; x++) {\n const zValue = zValues[y][x];\n if (zValue < zMin)\n zMin = zValue;\n if (zValue > zMax)\n zMax = zValue;\n }\n }\n return new NumberRange_1.NumberRange(zMin, zMax);\n }\n return undefined;\n }", "title": "" }, { "docid": "63df32dc316568c2943f6a6b9ff1db8c", "score": "0.5751861", "text": "clamp(number, lower, upper){\r\n \r\n //capture the lower bound value\r\n let lowerClampedValue = Math.max(number, lower)\r\n let clampedValue = Math.min(lowerClampedValue, upper)\r\n return clampedValue;\r\n }", "title": "" }, { "docid": "e6282404420ae2a7c8739de08c80aca0", "score": "0.57495934", "text": "static range(type, min, max, inclusive = false) {\n return Argument.validate(type, (msg, p, x) => {\n const o = typeof x === \"number\" || typeof x === \"bigint\" ? x : x.length != null ? x.length : x.size != null ? x.size : x;\n return o >= min && (inclusive ? o <= max : o < max);\n });\n }", "title": "" }, { "docid": "23d2c062da3d789b58b8086e5b9877b8", "score": "0.57478404", "text": "limit(genome, geneMin, geneMax) {\n\t\t\t// For each gene\n\t\t\tfor(var i = 0; i < genome.chromo.length; i++) {\n\t\t\t\tgenome.chromo[i] = utils.clamp(genome.chromo[i], geneMin, geneMax)\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "844e289fba9855a136f98daf2dc415b6", "score": "0.5738482", "text": "function Range() {}", "title": "" }, { "docid": "cbe31ae2445d83aebe3333c2eb692d12", "score": "0.5728945", "text": "function clip(value, low_limit, high_limit)\r {\r \tif(value < low_limit)\r \t\treturn low_limit;\r \telse if(value > high_limit)\r \t\treturn high_limit;\r \telse\r \t\treturn value;\r }", "title": "" }, { "docid": "15f31ed912e122cf2fa14937d680022c", "score": "0.5724898", "text": "function filterRange(arr, minValue, maxValue) {\n\tvar newArr = [];\n\n\tfor(var index = 0; index < arr.length; index++) {\n\t\tif(arr[index] >= minValue && arr[index] <= maxValue) {\n\t\t\tnewArr.push(arr[index]);\n\t\t}\n\t}\n\n\treturn newArr;\n}", "title": "" }, { "docid": "255a46c1b33a006a144eb98fb73e5aa2", "score": "0.5717261", "text": "function brush() {\n var actives = that.dimensions.filter(function(p) { \n return !that.brushes[p].empty(); \n });\n var extents = actives.map(function(p) { \n return that.brushes[p].extent(); \n });\n for(var i = 0; i < actives.length; i++) {\n var currentField = actives[i];\n that.model.get(\"parallelConfig\").set(currentField , {\n min:extents[i][0],\n max:extents[i][1]\n })\n }\n }", "title": "" }, { "docid": "200ced766374dcf4b6ddc2489163db0d", "score": "0.57031083", "text": "function changeRange() {\n\t\t\t\t// var v = range.max - range.value;\n\t\t\t\tvar v = range.value;\n\t\t\t\tdispatcher.fire('update.scale', v);\n\t\t\t}", "title": "" }, { "docid": "7339bf622a48a013a1beaa1511dad8ff", "score": "0.5692949", "text": "convertRange(oldMin, oldMax, newMin, newMax, oldValue) {\n return (((oldValue - oldMin) * (newMax - newMin)) / (oldMax - oldMin)) + newMin;\n }", "title": "" }, { "docid": "1ea9e4c1b56af2b920e6e40046ace28c", "score": "0.5680935", "text": "clamp(\n min,ceil, // Number\n ) {\n const {_sx,_sy,_scale} = this\n return Point.init(\n _sx,_sy,\n _scale < min ? min : Math.ceil(_scale / ceil) * ceil\n )\n }", "title": "" }, { "docid": "f01597baf808754026f7578c0e1357fe", "score": "0.56804734", "text": "function quantizeScale(domain, range, value) {\n var step = (domain[1] - domain[0]) / range.length;\n var idx = Math.floor((value - domain[0]) / step);\n var clampIdx = Math.max(Math.min(idx, range.length - 1), 0);\n\n return range[clampIdx];\n}", "title": "" }, { "docid": "75502623ac7e8863613bff8bcb596ff5", "score": "0.56776786", "text": "function extentToBounds (extent) {\r\n // \"NaN\" coordinates from ArcGIS Server indicate a null geometry\r\n if (extent.xmin !== 'NaN' && extent.ymin !== 'NaN' && extent.xmax !== 'NaN' && extent.ymax !== 'NaN') {\r\n var sw = Object(leaflet__WEBPACK_IMPORTED_MODULE_0__[\"latLng\"])(extent.ymin, extent.xmin);\r\n var ne = Object(leaflet__WEBPACK_IMPORTED_MODULE_0__[\"latLng\"])(extent.ymax, extent.xmax);\r\n return Object(leaflet__WEBPACK_IMPORTED_MODULE_0__[\"latLngBounds\"])(sw, ne);\r\n } else {\r\n return null;\r\n }\r\n}", "title": "" }, { "docid": "6e52666f28fcd57ef67bccaf41f982f5", "score": "0.56753415", "text": "function findExtremeBounds(bounds) {\n\t var extrema = {\n\t left: 0,\n\t right: SIZE,\n\t top: 0,\n\t bottom: SIZE\n\t };\n\n\t for (var i = 0; i < bounds.length; i++) {\n\t var bound = bounds[i];\n\t extrema = {\n\t left: Math.min(extrema.left, bound.left),\n\t right: Math.max(extrema.right, bound.right),\n\t top: Math.min(extrema.top, bound.top),\n\t bottom: Math.max(extrema.bottom, bound.bottom)\n\t };\n\t }\n\t return extrema;\n\t }", "title": "" }, { "docid": "caef741bbd3743184a9fcbb60f461f73", "score": "0.5673239", "text": "setRange(startX, endX) {\n // swap the range if needed\n if (startX > endX) {\n let xbuf = startX;\n startX = endX;\n endX = xbuf;\n }\n\n // correct the range\n startX = Math.max(startX, this.timeRange.startTime);\n endX = Math.min(endX, this.timeRange.endTime);\n\n // apply the new range\n if (startX !== endX) {\n let isZoomed = startX > this.timeRange.startTime || endX < this.timeRange.endTime;\n this._xAxisTag.min = startX;\n this._xAxisTag.max = endX;\n this._xAxisTag.alignToGrid = isZoomed;\n this._zoomMode = isZoomed;\n this._calcAllYRanges();\n this.draw();\n }\n }", "title": "" }, { "docid": "3fe1a6a62c385879d532fcd147898217", "score": "0.56704116", "text": "function snapBrush() {\n if (!d3.event.sourceEvent) return; // only transition after input\n extent = brush.extent();\n viewfinderUpperLimit = extent[1];\n // We iterate from most recent since we assume that most users will look at that data more often\n for (var i = 0; i < snapGuides.length; i++) {\n snap = snapGuides[i]\n diffInMillis = Math.abs(viewfinderUpperLimit - snap);\n if (diffInMillis <= SNAP_DISTANCE_IN_MILLIS) {\n snapExtent = getDayRangeFromUpperBound(snap.getTime() / 1000);\n d3.select(this).transition()\n .call(brush.extent(snapExtent))\n .call(brush.event)\n .duration(500);\n return;\n }\n }\n }", "title": "" }, { "docid": "3c96df68573a8f3cc915eb2bad23abcd", "score": "0.56668323", "text": "bounds() {\n if(this.isEmpty()) return null;\n // maximum boundaries possible\n let min = Number.POSITIVE_INFINITY\n let max = Number.NEGATIVE_INFINITY\n\n return [min, max] = this.forEachNode( (currentNode) => {\n if(currentNode.value < min) min = currentNode.value;\n if(currentNode.value > max) max = currentNode.value;\n return [min, max]\n }, min, max)\n \n }", "title": "" }, { "docid": "89bb563ed5ad4771ad1ba8639ac15742", "score": "0.5662494", "text": "function clamp(min, x, max) {\n return Math.max(min, Math.min(x, max));\n}", "title": "" }, { "docid": "89bb563ed5ad4771ad1ba8639ac15742", "score": "0.5662494", "text": "function clamp(min, x, max) {\n return Math.max(min, Math.min(x, max));\n}", "title": "" }, { "docid": "eb637e5ff7aa6e253cfc294bcc9a2fd2", "score": "0.56563425", "text": "function alterGamerRange(min, max) {\n if (min >= 10) {\n min -= 10;\n } else if (min < 10) {\n min = 0;\n }\n max += 10;\n }", "title": "" }, { "docid": "8c1d5e0d3d0a50b2f1c53142c1fbff22", "score": "0.5646744", "text": "function bound(min, max, val)\n\t{\n\t\treturn Math.max(Math.min(val, max), min);\n\t}", "title": "" }, { "docid": "a5bc35c6037b80d9cf48640c8972c872", "score": "0.5641611", "text": "function filterRange(arr, minVal, maxVal){\n\n /*\n loop through the Array\n IF value not between min and max:\n move all values after current idx to the left one\n and short the length of array\n ELSE move on the next idx\n */\n for(var i = 0; i < arr.length; i++){\n if(arr[i] < minVal || arr[i] > maxVal){\n // move everthing coming afterwars to the left one idx\n for(var l = i+1; l < arr.length; l++){\n arr[l-1] = arr[l];\n }\n arr.length--; // Decreases length of arr by one like pop()\n i--; // cancel i++ operation effectively\n }\n }\n}", "title": "" }, { "docid": "01df0dfacc12e3b228d248be0717cc8b", "score": "0.563859", "text": "function setRangeValue(min, max) {\n minNumRange.value = min;\n maxNumRange.value = max;\n}", "title": "" }, { "docid": "5c876e7c507124fc7f5be1f1216f0944", "score": "0.5635064", "text": "function clamp(min, max, value) {\n return Math.min(Math.max(value, min), max);\n }", "title": "" }, { "docid": "6cc04f3aa828298fae7388a410b7083b", "score": "0.56331515", "text": "function clampValueBetween(value, min, max) {\n return Math.min(Math.max(value, min), max);\n }", "title": "" }, { "docid": "32da58876f080bb2d424df9dc04db657", "score": "0.5626589", "text": "function filterBetween(array, min, max) {\n\n}", "title": "" }, { "docid": "2147e1faaa2632cd029903e26ba1272e", "score": "0.56240976", "text": "function xrangeset(min,max) {\n // Force the slider thumbs to adjust to the appropriate place\n $(\"#slider-range\").slider(\"option\", \"values\", [min,max]);\n }", "title": "" }, { "docid": "3e47424586e67b8f38674bb32174f290", "score": "0.5618279", "text": "function range(input,min,max) {\n\t\tif(min > max) { var x = min; min = max; max = x;}\n\t\treturn Math.max(Math.min(input,max),min);\n\t}", "title": "" }, { "docid": "28e4b2003dc6d57b5b0057693ee720d3", "score": "0.561545", "text": "isInBounds(value, minExclusive = false, maxExclusive = false) { \n\t\tif (!FormatUtils.isNumber(value) && !FormatUtils.canBeNumber(value)) \n\t\t\treturn false;\n\n\t\tvalue = Number(value);\n\t\tlet aboveMin = minExclusive ? value > this.#min : value >= this.#min;\n\t\tlet belowMax = maxExclusive ? value < this.#max : value <= this.#max;\n\n\t\treturn aboveMin && belowMax;\n\t}", "title": "" }, { "docid": "4f6b5640d72101c4d3383fcf332cba96", "score": "0.5607751", "text": "static range(min, max){\n\n let l = [];\n for(let i=min; i < max; i++) l.push(i);\n return l;\n\n }", "title": "" }, { "docid": "150c89e765099b4bd08ba120a13a9a65", "score": "0.5603539", "text": "function keepWithin(value, min, max) {\n if(value < min) value = min;\n if(value > max) value = max;\n return value;\n }", "title": "" }, { "docid": "bacbb0a84cd95816d900529cd58dce68", "score": "0.55980116", "text": "function extent$6(array) {\n var i = 0, n, v, min, max;\n\n if (array && (n = array.length)) {\n // find first valid value\n for (v = array[i]; v == null || v !== v; v = array[++i]);\n min = max = v;\n\n // visit all other values\n for (; i<n; ++i) {\n v = array[i];\n // skip null/undefined; NaN will fail all comparisons\n if (v != null) {\n if (v < min) min = v;\n if (v > max) max = v;\n }\n }\n }\n\n return [min, max];\n }", "title": "" }, { "docid": "ca6f96f485f87b1f04cefa2050a3da6a", "score": "0.55973583", "text": "function extendXRangeIfNeededByBar(){\n\t\t\tif(options.xaxis.max == null){\n\t\t\t\t/**\n\t\t\t\t * Autoscaling.\n\t\t\t\t */\n\t\t\t\tvar newmax = xaxis.max;\n\t\t\t\tfor(var i = 0; i < series.length; ++i){\n\t\t\t\t\tif(series[i].bars.show && series[i].bars.barWidth + xaxis.datamax > newmax){\n\t\t\t\t\t\tnewmax = xaxis.max + series[i].bars.barWidth;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\txaxis.max = newmax;\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "3784714339a88279f8271965002ed3b7", "score": "0.55969083", "text": "function range_scatter(data, ranges) {\n\n let range = d3.scaleLinear()\n .domain([data.min, data.max])\n .range([ranges.min, ranges.max]);\n return range;\n}", "title": "" }, { "docid": "45d9a206d8da10a9ae79d754d45b8015", "score": "0.55961204", "text": "function clamp(a,min,max)\r\n{return Math.min(Math.max(a,min),max);}", "title": "" }, { "docid": "d7f17448f6f0936f79050aab58a29a44", "score": "0.5593503", "text": "static range(min, max){\n \n let l = [];\n for(let i=min; i < max; i++) l.push(i);\n return l;\n \n }", "title": "" }, { "docid": "6b3a49a48dff7a7bb1e11b5f2fe21872", "score": "0.5591567", "text": "function clamp(number, lowerBound, upperBound) {\n return Math.max(lowerBound, Math.min(number, upperBound));\n}", "title": "" }, { "docid": "9ac232b62db7c3a1c111fa28fd64da21", "score": "0.55890745", "text": "function range(min,max)\n{\n var output = [];\n return rangeRec(min,max,output);\n}", "title": "" }, { "docid": "e6aedba6270fc83dc4a5efa8f6cf4d2e", "score": "0.55829394", "text": "function arrayFromRange(min, max) {\n // your code\n}", "title": "" }, { "docid": "2ff4fc2c4e5c0ae8edc229dd3d3dcaae", "score": "0.5576103", "text": "function calculate_minmax(data) {\n\n bound = [];\n bound.max = Math.max.apply(Math, data);\n bound.min = Math.min.apply(Math, data);\n return bound;\n\n}", "title": "" }, { "docid": "0b636635f3693df838ca26d0965f763e", "score": "0.55750126", "text": "function supportRangeBounds() {\n var r, testElement, rangeBounds, rangeHeight, support = false;\n\n if (doc.createRange) {\n r = doc.createRange();\n if (r.getBoundingClientRect) {\n testElement = doc.createElement('boundtest');\n testElement.style.height = \"123px\";\n testElement.style.display = \"block\";\n doc.body.appendChild(testElement);\n\n r.selectNode(testElement);\n rangeBounds = r.getBoundingClientRect();\n rangeHeight = rangeBounds.height;\n\n if (rangeHeight === 123) {\n support = true;\n }\n doc.body.removeChild(testElement);\n }\n }\n\n return support;\n }", "title": "" }, { "docid": "0b636635f3693df838ca26d0965f763e", "score": "0.55750126", "text": "function supportRangeBounds() {\n var r, testElement, rangeBounds, rangeHeight, support = false;\n\n if (doc.createRange) {\n r = doc.createRange();\n if (r.getBoundingClientRect) {\n testElement = doc.createElement('boundtest');\n testElement.style.height = \"123px\";\n testElement.style.display = \"block\";\n doc.body.appendChild(testElement);\n\n r.selectNode(testElement);\n rangeBounds = r.getBoundingClientRect();\n rangeHeight = rangeBounds.height;\n\n if (rangeHeight === 123) {\n support = true;\n }\n doc.body.removeChild(testElement);\n }\n }\n\n return support;\n }", "title": "" }, { "docid": "ea567fbf698982a4bc6dcda3736ed1d4", "score": "0.5574846", "text": "function fitBrushStepSize(value) {\n return Math.round(value / brushStepSize) * brushStepSize;\n}", "title": "" }, { "docid": "52f253ddb83dc27902f190c18cd3ba09", "score": "0.5571457", "text": "function supportRangeBounds() {\r\n var r, testElement, rangeBounds, rangeHeight, support = false;\r\n\r\n if (doc.createRange) {\r\n r = doc.createRange();\r\n if (r.getBoundingClientRect) {\r\n testElement = doc.createElement('boundtest');\r\n testElement.style.height = \"123px\";\r\n testElement.style.display = \"block\";\r\n doc.body.appendChild(testElement);\r\n\r\n r.selectNode(testElement);\r\n rangeBounds = r.getBoundingClientRect();\r\n rangeHeight = rangeBounds.height;\r\n\r\n if (rangeHeight === 123) {\r\n support = true;\r\n }\r\n doc.body.removeChild(testElement);\r\n }\r\n }\r\n\r\n return support;\r\n }", "title": "" }, { "docid": "52f253ddb83dc27902f190c18cd3ba09", "score": "0.5571457", "text": "function supportRangeBounds() {\r\n var r, testElement, rangeBounds, rangeHeight, support = false;\r\n\r\n if (doc.createRange) {\r\n r = doc.createRange();\r\n if (r.getBoundingClientRect) {\r\n testElement = doc.createElement('boundtest');\r\n testElement.style.height = \"123px\";\r\n testElement.style.display = \"block\";\r\n doc.body.appendChild(testElement);\r\n\r\n r.selectNode(testElement);\r\n rangeBounds = r.getBoundingClientRect();\r\n rangeHeight = rangeBounds.height;\r\n\r\n if (rangeHeight === 123) {\r\n support = true;\r\n }\r\n doc.body.removeChild(testElement);\r\n }\r\n }\r\n\r\n return support;\r\n }", "title": "" }, { "docid": "1d513de41ca013892c7d76d0a24e5b12", "score": "0.5569596", "text": "function keepWithin(value, min, max) {\r\n if(value < min) value = min;\r\n if(value > max) value = max;\r\n return value;\r\n }", "title": "" }, { "docid": "d0341995aa58054cc8f39a4cce4230c2", "score": "0.556862", "text": "function NumberRangeLimt(ctrId,minVal,maxVal){\n//var str =$(\"#\"+ctrId.id).get(0).value.replace(/\\D/g,'');\n\tvar str = ($(\"#\"+ctrId.id).val()).replace(/\\D/g,'')*1;\n\tif(minVal != maxVal)\n\t{\n\t if(str < minVal) {return minVal;}\n\t if(str > maxVal) {return maxVal;}\n\t}\n\treturn str;\n}", "title": "" }, { "docid": "8846b590dacb0474bf0f98409d058b73", "score": "0.5567847", "text": "function computeRange(samples) {\r\n // slice() is a hack for cloning\r\n var lowerBound = samples[0].slice();\r\n var upperBound = samples[0].slice();\r\n $.each(samples, function (index, value) {\r\n lowerBound = binaryMap(Math.min, lowerBound, value);\r\n upperBound = binaryMap(Math.max, upperBound, value);\r\n });\r\n var ranges = [];\r\n $.each(lowerBound, function (index, value) {\r\n ranges.push([value, upperBound[index]]);\r\n });\r\n return ranges;\r\n}", "title": "" }, { "docid": "2adb517593c1773d28b15781fb409262", "score": "0.55641896", "text": "function filterRange(range) {\n emptyDatasets();\n return filterFunction(function(d) {\n return d >= range[0] && d <= range[1];\n });\n }", "title": "" }, { "docid": "940fb60e317584e542ad52203f9ab44c", "score": "0.5563262", "text": "clamp(number, lower, upper){\n let lowerClampedValue = Math.max(number, lower);\n let clampedValue = Math.min(lowerClampedValue, upper);\n return clampedValue;\n }", "title": "" }, { "docid": "b668b127e598807ba49359fe669460a0", "score": "0.556315", "text": "isRange(value) {\n return Object(__WEBPACK_IMPORTED_MODULE_0_is_plain_object__[\"a\" /* default */])(value) && Point.isPoint(value.anchor) && Point.isPoint(value.focus);\n }", "title": "" }, { "docid": "93ca75c2a8ad7feecf7efb4f811096aa", "score": "0.5557352", "text": "function keepWithin(value, min, max) {\nif( value < min ) value = min;\nif( value > max ) value = max;\nreturn value;\n}", "title": "" }, { "docid": "64139b0cf0e0094076e641dc3b154b01", "score": "0.55490124", "text": "function mapRange(value, x1, y1, x2, y2){\n var r=(value - x1) * (y2 - x2) / (y1 - x1) + x2;\n return clamp(r, x2, y2);\n}", "title": "" } ]
a425b385a6149941e314d48ba84071fd
adds the customer total
[ { "docid": "f3675639e92c9359eb931ffaab7e771e", "score": "0.0", "text": "function customerTotal(requestedQuantity) {\n productPrice = productPrice * requestedQuantity;\n console.log(\"Your total is: \" + productPrice)\n return continueShopping();\n process.exit();\n}", "title": "" } ]
[ { "docid": "5798effbf89ec856562ed1c6cc6e7c8a", "score": "0.7125682", "text": "function add(productCost, total) {\n return productCost + total;\n}", "title": "" }, { "docid": "b78cce0d651d1b980b0eeef0f517a012", "score": "0.7051314", "text": "function getTotal() {\n return getSubTotal(orderCount) + getTax();\n}", "title": "" }, { "docid": "a25f3f3726fc2bb422a4ab2063e67ff5", "score": "0.6807467", "text": "function calculateTotal(){\r\n const convertPhoneCount = getProductCount('phone');\r\n const convertCaseCount = getProductCount('case');\r\n //Calculate subtotal and display.\r\n const subTotal = convertPhoneCount * 1219 + convertCaseCount * 59;\r\n document.getElementById('subTotal').innerText = subTotal;\r\n //Calculate tax and display.\r\n const tax = Math.round(subTotal * 0.05);\r\n document.getElementById('tax').innerText = tax;\r\n //Calculate total and display.\r\n const total = subTotal + tax;\r\n document.getElementById('total').innerText = total;\r\n }", "title": "" }, { "docid": "e5c3c673a990b24937a5350edb15e4ac", "score": "0.67866737", "text": "addToTotal($block) {\n this.total += this.sub_total + $block;\n this.resetSubTotalToZero();\n }", "title": "" }, { "docid": "83fe06a9eb14cc289f707b8f2b8f6505", "score": "0.67732227", "text": "function setTotal (total) {\n charges.total = total;\n}", "title": "" }, { "docid": "5af1ccc9f59d90bd1c90dfa39808f786", "score": "0.67354655", "text": "_calculateTotal() {\n // The Math.max is used because any empty field will give -1.\n\n // Get the tax, doc fee, and down payment\n let total = Math.max(0, this._tax.value) +\n Math.max(0, this._docFee.value) - // << Subtract the down payment\n Math.max(0, this._downPayment.value) - // << Subtract the total payments\n Math.max(0, this._payments.Total);\n\n // Add the amount for all the vehicles\n for (let v of this._vehicles) total += Math.max(0, v.Price.value);\n\n // Add the amount for all the miscellaneous charges\n for (let c of this._miscCharges) total += Math.max(0, c.Price.value);\n\n // Update the total\n document.getElementById(INVOICE_TOTAL_ID).innerHTML = \"$ \" + total.toFixed(2).toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n }", "title": "" }, { "docid": "44e8b1713fa41adbed1e7b1b46768972", "score": "0.6700994", "text": "get totalValue() {\n return this.cash + this.invested\n }", "title": "" }, { "docid": "3e075b9820bdedca9b648f15a23a08c4", "score": "0.6687036", "text": "addToSubTotal($number) {\n this.sub_total += $number;\n }", "title": "" }, { "docid": "336f6e92c307e9739a210f3c9e8adc16", "score": "0.6660511", "text": "function calculate_total(frm) {\n const { amount = 0, loan_charges = [] } = frm.doc;\n frm.set_value(\n 'total',\n amount + loan_charges.reduce((a, { charge_amount: x = 0 }) => a + x, 0)\n );\n}", "title": "" }, { "docid": "d01345925307a13c19c9211364c95d7e", "score": "0.66312134", "text": "function addTotal() {\n\n\t// get the user input and save it to a variable\n\tvar inputValue = $('#newEntry').val();\n\t\tinputValue = parseFloat(inputValue);\n\n\t// add value to screen\n\t$('#entries').append(\"<tr><td>\"+\"$\"+inputValue+\"</td></tr>\");\n\n\t// set the input value to blank\n\t$('#newEntry').val(\"\");\n\n\t// add totals\n\t$(\"#total\").text(function() {\n\t\ttotal += inputValue;\n\t\t$(\"#total\").text(\"$\"+total)\n\t});\n}", "title": "" }, { "docid": "3b0d5ead976f395de65044324411d786", "score": "0.66200775", "text": "function calculateTotal() {\r\n let serviceFee = 0;\r\n let processFee = 0;\r\n let totalTicketOnly = 0;\r\n let totalFees = 0;\r\n for (let element in this.options.ticketData) {\r\n let ticket = this.options.ticketData[element];\r\n let tempCost = ticket.price;\r\n let tempQuantity = ticket.selected;\r\n totalTicketOnly += tempCost * tempQuantity;\r\n serviceFee = calcServiceFee(tempCost);\r\n processFee = calcProcessFee(tempCost + serviceFee);\r\n totalFees += (serviceFee + processFee) * tempQuantity;\r\n }\r\n\r\n let centsTotal = totalTicketOnly;\r\n this.ticketTotalPrice = centsTotal + totalFees;\r\n this.ticketTotalContainer.innerHTML = `${this.options.currency}$${fromCents(totalTicketOnly)} <br>`;\r\n if (totalTicketOnly > 0)\r\n this.ticketTotalContainer.innerHTML += `+ Fees ${this.options.currency+'$'+fromCents(totalFees)}`;\r\n }", "title": "" }, { "docid": "a75ac76aad8cdf5ccdfd5b1724b76265", "score": "0.66171354", "text": "function calculateTotal(){\n console.log(info.cost*value)\n var totalCost = info.cost*value\n setTotal(totalCost)\n alert('Your reservation done \\n Your service costs: '+total)\n }", "title": "" }, { "docid": "0a012c0a1b6be332a3dacf9d5b5fc08f", "score": "0.6611562", "text": "function total() {\n let total = 0;\n for (const i in cart) {\n total += cart[i].subTotal;\n }\n return total;\n}", "title": "" }, { "docid": "5bf1bc1d0c28e83d238a7a2e5673af21", "score": "0.66043943", "text": "function billTotal(cost){\n\tvar tip = 0.15*cost;\n\tvar tax = (0.095*(tip+cost));\n\treturn (tax+cost+tip);\n}", "title": "" }, { "docid": "2106107de466b497e142a2dae19ad30c", "score": "0.6596019", "text": "function getTotal(){\n return _total;\n }", "title": "" }, { "docid": "7da87b8cf62f2adc2ca3521c7d976ff8", "score": "0.6564742", "text": "function getTotal(data) {\n total = total + data;\n $(\"#total\").html(total).digits();\n $(\"#total_k\").html(kFormatter(total));\n }", "title": "" }, { "docid": "58953cd9aceaaf42245252120272073a", "score": "0.6553251", "text": "function total(firstClassCost, ecoClassCost) {\n let currentSubTotal, tax, total;\n currentSubTotal = firstClassCost + ecoClassCost;\n document.getElementById(\"subTotal\").innerText = currentSubTotal;\n tax = currentSubTotal * 10 / 100;\n document.getElementById(\"tax\").innerText = tax;\n total = currentSubTotal + tax;\n document.getElementById(\"total\").innerText = total;\n}", "title": "" }, { "docid": "347de114fd45ce306611e6f50d8d014e", "score": "0.65507096", "text": "function add(total, num) {\n return total + num;\n }", "title": "" }, { "docid": "fafc068476a2aa617528f669cfdd29e8", "score": "0.65247935", "text": "get total() {\n if (this.selectedItems.length === 0)\n return 0;\n return this._recipe.totalPrice + this._shippingCost;\n }", "title": "" }, { "docid": "3dec080bb0f0a1b82434b39b09089b56", "score": "0.6514354", "text": "function calcTotal() {\n\t\tvar w = parseFloat(toppingTotal);\n\t\t//alert(\"variable w: \"+w);\n\t\tvar x = parseFloat(piePrice) + w;\n\t\tvar y = x * .06;\n\t\t\n\t\t//alert(\"variable y: \"+y);\n\t\tyy = y.toFixed(2);\n\t\tvar z = x + y;\n\t\t zz = z.toFixed(2);\n\t\tdocument.getElementById(\"tallySalesTax\").innerHTML = \"<i><strong>\"+yy+\"</strong></i>\";\n\t\tdocument.getElementById(\"tallyTotal\").innerHTML = \"<strong>$\"+zz+\"</strong>\";\n\t\t//alert(\"Sales Tax \" + y + \" Pie Price \" + x + \" Total Cost:$\" + zz); \n\t\t\t\t}", "title": "" }, { "docid": "b805cc95399c1ac349c89370c490d825", "score": "0.6491336", "text": "function updateTotal(subtotal, taxes){\n $(\".subtotal-number\").text(\"$ \"+ subtotal.toFixed(2));\n $(\".tax-number\").text(\"$ \"+ taxes.toFixed(2));\n $(\".total-number\").text(\"$ \"+ (subtotal+taxes).toFixed(2));\n }", "title": "" }, { "docid": "5d87133391ba6e03730e8313c86e31f3", "score": "0.6488331", "text": "costoTotal() {\n return this.costo + this.calcularIgv();\n }", "title": "" }, { "docid": "1866f0feb05d80cd00d429b34a724955", "score": "0.6485299", "text": "function updateTotal() {\n\tdeliveryCostValue = deliveryPercentageValue * subtotalValue;\n\ttotalValue = subtotalValue + deliveryCostValue;\n\tdeliveryCost.innerHTML = 'UYU ' + deliveryCostValue.toFixed(2);\n\ttotal.innerHTML = 'UYU ' + totalValue;\n}", "title": "" }, { "docid": "4b302ea15bedfa0ad106845d8d005ebc", "score": "0.6485265", "text": "function updateTotal() {\n let subtotal = 0;\n $(\"[name='total-cost']\").each(function() {\n subtotal += parseInt($(this).val());\n });\n\n let tax = subtotal * MASSTAX;\n\n $(\"[name='subtotal']\").val(subtotal.toFixed(2));\n $(\"[name='tax']\").val(tax.toFixed(2));\n $(\"[name='total']\").val((subtotal + tax).toFixed(2));\n}", "title": "" }, { "docid": "57f236467d8d50f41cb27a73efbca406", "score": "0.6476464", "text": "function theme_commerce_cart_total(variables) {\n try {\n return '<h3 class=\"ui-bar ui-bar-a ui-corner-all\">Order Total: ' +\n variables.order.commerce_order_total_formatted +\n '</h3>';\n }\n catch (error) { console.log('theme_commerce_cart_total - ' + error); }\n}", "title": "" }, { "docid": "ab22f11d569076b245a1ccc101f79be3", "score": "0.647448", "text": "addTotal(){\n this.total = 0;\n for(var i = 0; i < this.arr.length; i++)\n this.total += (this.arr[i].price * this.arr[i].quantity);\n return(\n <li class=\"list-group-item d-flex justify-content-between\">\n <span>Total (BRL)</span>\n <strong>R$ {this.total}</strong>\n </li>\n );\n }", "title": "" }, { "docid": "b9061bf1688d54677d12ed95305f2966", "score": "0.64724976", "text": "calculaCosteTotal(){\n this.costeTotal=0;\n this.unidades.forEach(\n (value,index)=>{this.costeTotal+=value.coste;}\n )\n }", "title": "" }, { "docid": "8a8267c9983fab75fce74fe7eb3844d5", "score": "0.6466571", "text": "get total () {\r\n\t\treturn this._total;\r\n\t}", "title": "" }, { "docid": "60d397c45e652247850f413ad0fbd303", "score": "0.6466163", "text": "getTotalCost() {\n return this.transactions.map(t => t.cost).reduce((acc, value) => acc + value, 0);\n }", "title": "" }, { "docid": "60d397c45e652247850f413ad0fbd303", "score": "0.6466163", "text": "getTotalCost() {\n return this.transactions.map(t => t.cost).reduce((acc, value) => acc + value, 0);\n }", "title": "" }, { "docid": "60d397c45e652247850f413ad0fbd303", "score": "0.6466163", "text": "getTotalCost() {\n return this.transactions.map(t => t.cost).reduce((acc, value) => acc + value, 0);\n }", "title": "" }, { "docid": "60d397c45e652247850f413ad0fbd303", "score": "0.6466163", "text": "getTotalCost() {\n return this.transactions.map(t => t.cost).reduce((acc, value) => acc + value, 0);\n }", "title": "" }, { "docid": "b168d4e845015988e8f6620e4f80d340", "score": "0.64653", "text": "function total() {\n var totalUser1 = document.getElementById(\"totalExpenses1\").value * 1;\n var totalUser2 = document.getElementById(\"totalExpenses2\").value * 1;\n var totalUser3 = document.getElementById(\"totalExpenses3\").value*1;\n document.getElementById(\"total\").value = totalUser1 + totalUser2+ totalUser3;\n }", "title": "" }, { "docid": "ab3bb9f97dc06e1f977671ec7f70ca99", "score": "0.6454898", "text": "function setTotalPrice(){\n tax_total = setTax(phone_base_price + phone_acc_price);\n total_price = phone_base_price + phone_acc_price + tax_total;\n}", "title": "" }, { "docid": "65fbf02c38aeb0b6c9daa8455c551f1f", "score": "0.6445305", "text": "function calculateTotal() {\n const firstClassCount = parseInt(document.getElementById(\"firstClass-count\").value)\n const firstClassCost = firstClassCount * 150;\n const economyCount = parseInt(document.getElementById(\"economyClass-count\").value)\n const economyCost = economyCount * 100;\n\n\n\n const totalCost = firstClassCost + economyCost;\n document.getElementById(\"sub-total\").innerText ='$'+ totalCost;\n\n const vatCost =Math.round(totalCost * 0.1) ;\n document.getElementById(\"vat\").innerText = '$'+ vatCost;\n\n const grandTotal = totalCost + vatCost;\n document.getElementById(\"grand-total\").innerText ='$'+ grandTotal; \n\n}", "title": "" }, { "docid": "ad799c50baa57b029e3cfb6c04d81dfa", "score": "0.6434897", "text": "function calculateTotal() {\n\n var valueTotal = 0;\n\n listTotalPrices.map((num) => {\n valueTotal += num.value;\n });\n\n setTotal(valueTotal);\n\n }", "title": "" }, { "docid": "850e8a75e1b855effc3e0931b08d46c7", "score": "0.6432732", "text": "updateTotal() {\n let itemCode = this.get('membership.itemCode');\n let membershipOption = this.get('membershipsService.membershipOptions').findBy('id', itemCode);\n let itemPrice = membershipOption ? membershipOption.price : 0;\n\n let shippingRegion = this.get('shippingRegion');\n let shippingRegionOption = this.get('membershipsService.shippingRegionOptions').findBy('id', shippingRegion);\n let shippingFee = shippingRegionOption ? shippingRegionOption.price : 0;\n\n let bookletPrice = this.get('membership.includeBooklet') ? 17 : 0;\n\n let total = itemPrice + bookletPrice + shippingFee;\n\n let isFree = this.get('isFree');\n if (isFree) {\n total = 0;\n }\n\n this.set('membership.total', total);\n }", "title": "" }, { "docid": "884328a6acaca96334a900315b5d9f3a", "score": "0.6432293", "text": "function calculateTotal () {\n return cart.reduce((prev, cur) => prev + cur.price * cur.quantity, 0)\n }", "title": "" }, { "docid": "12662df2f78b9d69d673ef3ccc326218", "score": "0.64294446", "text": "get total () {\n\t\treturn this._total;\n\t}", "title": "" }, { "docid": "642c5d99fe732ce02be9943079012bb5", "score": "0.64164054", "text": "function handleSumTotal() {\n const reducer = (accumulator, currentValue) =>\n accumulator + currentValue.price;\n //cart.reduce() funcion de un array que retorna o reduce a un unico valor de un array\n const sum = cart.reduce(reducer, 0);\n return sum;\n }", "title": "" }, { "docid": "11edce0e56c46ba0de39f33df691db55", "score": "0.6410957", "text": "get totalBudget() {\n let totalBudget = 0;\n this.model.forEach((customer) => {\n totalBudget += customer.budget;\n });\n return totalBudget;\n }", "title": "" }, { "docid": "7d8270cf5e6c67158bcdfad6ce2cf6b0", "score": "0.6409626", "text": "getTotal(subtotal, tax) {\n if (subtotal == 0) { // if nothing in cart, it's weird to charge for shipping, so return 0\n return 0\n }\n return subtotal + tax + this.props.constants.SHIPPING_COST\n }", "title": "" }, { "docid": "351d73094b866ffa9fce2c0deb1c22a8", "score": "0.6404784", "text": "add(additional) {\n this.amount += additional.amount;\n }", "title": "" }, { "docid": "351d73094b866ffa9fce2c0deb1c22a8", "score": "0.6404784", "text": "add(additional) {\n this.amount += additional.amount;\n }", "title": "" }, { "docid": "c429c45fff936bd22f7c12d5f44b3770", "score": "0.64024955", "text": "function calculateGrandTotal() {\n var grandTotal = 0;\n\n //get all the grandtotals from the pizza orders\n for (var i = 0; i < customerOrder.pizzaOrderArray.length; i++) {\n grandTotal += customerOrder.pizzaOrderArray[i].pizzaCost;\n }\n\n //get all the grand totals from the sandwich orders\n for (var i = 0; i < customerOrder.sandwhichOrderArray.length; i++) {\n grandTotal += customerOrder.sandwhichOrderArray[i].sandwichCost;\n }\n\n //get all the grand total from the drnk orders\n for (var i = 0; i < customerOrder.drinkOrderArray.length; i++) {\n grandTotal += customerOrder.drinkOrderArray[i].drinkCost;\n }\n\n //return the total cost to display in invoice\n return grandTotal;\n}", "title": "" }, { "docid": "0c2af0e9817e93b94dedeaaf5135fdba", "score": "0.6391111", "text": "_totalPrice() {\n\t\tlet total = 0;\n\t\tconst { cart, customer } = this.props;\n\n\t\t// get the deals with price\n\t\tif (cart && cart.length) {\n\t\t\tcart.forEach((c) => {\n\t\t\t\tlet { price, count, adType } = c;\n\n\t\t\t\tconst customersRule = customer && _.find(customer.deals, { dealsType: adType });\n\n\t\t\t\tif (customersRule) {\n\t\t\t\t\ttotal += this._priceRule(customersRule, price, count);\n\t\t\t\t} else {\n\t\t\t\t\ttotal += this._calculateNormalPrice(price, count);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn total;\n\t}", "title": "" }, { "docid": "95019fce6458e3294943bad701438b2e", "score": "0.6388601", "text": "function calcTotal() {\n var w = parseFloat(toppingTotal);\n //alert(\"variable w: \"+w);\n var x = parseFloat(piePrice) + w + couponValue;\n var y = x * .06;\n \n //alert(\"variable y: \"+y);\n yy = y.toFixed(2);\n var z = x + y;\n zz = z.toFixed(2);\n document.getElementById(\"tallySalesTax\").innerHTML = \"<i><strong>\"+yy+\"</strong></i>\";\n document.getElementById(\"tallyTotal\").innerHTML = \"<strong>$\"+zz+\"</strong>\";\n pizza.orderTotal.value = zz;\n \n //alert(\"Sales Tax \" + y + \" Pie Price \" + x + \" Total Cost:$\" + zz); \n }", "title": "" }, { "docid": "dcb3c7c7324bbbfd397d5418c6062e35", "score": "0.63884395", "text": "function addToTotal(newNumber,runningTotal) {\n return runningTotal + newNumber;\n}", "title": "" }, { "docid": "6d8f76258be6e14ba573260cbc6def65", "score": "0.63769436", "text": "carrinhoTotal() {\n let total = 0\n if(this.carrinho.length)\n this.carrinho.forEach(item => {\n total += item.preco\n });\n return total\n }", "title": "" }, { "docid": "0d438114b8dd0183a9ee8b0c8d67d2cb", "score": "0.6373881", "text": "function totalMetodoPago() {\n let pagoEfectivo, pagoTransferencia, pagoDeposito, pagoCheque, totalMetodos;\n let customer;\n pagoEfectivo = $('#m_efectivo').val();\n pagoTransferencia = $('#m_transferencia').val();\n pagoDeposito = $('#m_deposito').val();\n pagoCheque = $('#m_cheque').val();\n let pEfectivo = parseFloat(pagoEfectivo);\n let pTransferencia = parseFloat(pagoTransferencia);\n let pDeposito = parseFloat(pagoDeposito);\n let pCheque = parseFloat(pagoCheque);\n totalMetodos =Number(pEfectivo+pTransferencia+pDeposito+pCheque);\n $('#pago_final').val(totalMetodos);\n }", "title": "" }, { "docid": "c18abdea8454f7bfa25f6b5c77b7893c", "score": "0.63706", "text": "function calculatetotals(){\r\n \tvar totalmonthly = (parseFloat(paymentmonthlycost) + parseFloat(bundlemonthlycost) - 10).toFixed(2);\r\n \tvar totalonetime = parseFloat(paymentonetimecost) + 24.24;\r\n \t$('.totalbaronetime').html('$ ' + totalonetime);\r\n \t$('.totalbarmonthly').html('$ ' + totalmonthly);\r\n }", "title": "" }, { "docid": "433b9fdd10e797cb50b2c2b171781c46", "score": "0.6359257", "text": "function countTotal() {\n vm.factura.total = 0;\n vm.factura.cancelado = 0;\n vm.detalles_factura.forEach(function(detalle){\n vm.factura.total = vm.factura.total + (detalle.cantidad*detalle.precio_venta);\n })\n vm.listapagos.forEach(function (pago){\n vm.factura.cancelado = vm.factura.cancelado + pago.monto;\n });\n }", "title": "" }, { "docid": "92ae3bc963f2dbfb70c232cfbc64c285", "score": "0.63497114", "text": "function updateTotal() {\n $('#total').html(\"$\" + total + \".00\"); //Update Total field\n }", "title": "" }, { "docid": "e895013d2843a3e52ea2c9e429660b0c", "score": "0.6323295", "text": "function calculateTotal() {\n const currentCountFirstClass = parseInt(document.getElementById('first-class-count').value);\n const currentCountEconomyClass = parseInt(document.getElementById('economy-class-count').value)\n const subtotal = currentCountFirstClass * 150 + currentCountEconomyClass * 100;\n const vat = subtotal * 0.1;\n const grandTotal = vat + subtotal;\n appendingAmounts(subtotal, vat, grandTotal, currentCountEconomyClass, currentCountFirstClass);\n\n}", "title": "" }, { "docid": "857454ed3b625ea7d4f7abe47ede2f9e", "score": "0.63206136", "text": "function finalTotal () {\r\n for(var i = 0; i < stores.length; i++){\r\n grandTotal+= stores[i].totalCookiesOfTheDay;\r\n }\r\n}", "title": "" }, { "docid": "9643a3e5b642ed0dbf2fbad85bf1d02c", "score": "0.6315821", "text": "function calcTotal(){\n\n //Used for submission processing\n getAdults();\n getSeniors();\n getChildren();\n\n getPopcorn();\n getCoke();\n getCandy();\n getNachos();\n\n //Used to get cost\n var sub = getSeatCost() + getFoodCost();\n var tax = sub*0.13;\n var total = sub + tax;\n\n document.getElementById(\"subtotal\").innerHTML = sub.toFixed(2);\n document.getElementById(\"tax\").innerHTML = tax.toFixed(2);\n document.getElementById(\"total\").innerHTML = total.toFixed(2);\n\n getTotal();\n}", "title": "" }, { "docid": "4abc5d99b2ecb8ea15654fe65833aeeb", "score": "0.6315058", "text": "calculateTotalPrice() {\n return this.calculateTotalWithoutDelivery() + this.deliveryFee();\n }", "title": "" }, { "docid": "19ec83fc2f194cfa52718328ccd257b0", "score": "0.63121367", "text": "function updateTotals() {\n\t\tvm.courseTotal = _.round(_.sumBy(vm.coursesAndCourseRelatedExpenses, 'tuitionAmount'), 2);\n\t\tvm.expenseTotal = _.round(_.sumBy(vm.coursesAndCourseRelatedExpenses, 'feesAmount'), 2) + _.round(_.sumBy(vm.otherExpenses, 'feesAmount'), 2);\n\t\tvar subResult = vm.courseTotal + vm.expenseTotal;\n\t\tvm.courseAndExpenseTotal = _.round(subResult, 2);\n\t}", "title": "" }, { "docid": "2d4849562370382d2823bee050dfe246", "score": "0.63091165", "text": "function calculate_total(){\r\n\t//get price editor\r\n\tvar priceEditor=getEditor('price');\r\n\t//get price(data)\r\n\tvar price=$(priceEditor.target).val();\r\n\t\r\n\t//var nunEditor=getEditor('num');\r\n\t//get quantity\r\n\tvar num=$(getEditor('num').target).val();\r\n\t\r\n\t//keep two decimal places after the decimal point\r\n\tvar money=(price*num).toFixed(2);\r\n\t\r\n\t//set total\r\n\t$(getEditor('money').target).val(money);\r\n\t\r\n\t//set row total value into datagrid\r\n\t$('#ordersgrid').datagrid('getRows')[existEditIndex].money=money;\r\n}", "title": "" }, { "docid": "d8dcddd6e197988fec320e86f8f21770", "score": "0.6305557", "text": "function calculateTotalSales() {\n\n var saleSum = 0;\n\n for (var i = 0; i < deliveryData.length; i++) {\n saleSum += deliveryData[i].price\n }\n\n return saleSum;\n\n }", "title": "" }, { "docid": "96cc42d6b5e79f0e6d592bf6615a38d9", "score": "0.6304676", "text": "function calculateTotal() {\n const phoneCount = getInputValue('phone');\n document.getElementById('invoice-phone-quantity').innerText = phoneCount;\n document.getElementById('invoice-phone-total').innerText = phoneCount * 1219;\n\n const caseCount = getInputValue('case');\n document.getElementById('invoice-case-quantity').innerText = caseCount;\n document.getElementById('invoice-case-total').innerText = caseCount * 59;\n\n const subtotal = phoneCount * 1219 + caseCount * 59;\n document.getElementById('subtotal').innerText = subtotal;\n document.getElementById('invoice-subtotal').innerText = subtotal;\n\n const tax = Math.round((subtotal / 100) * 5);\n document.getElementById('tax').innerText = tax;\n document.getElementById('invoice-tax').innerText = tax;\n\n const total = subtotal + tax;\n document.getElementById('total').innerText = total;\n document.getElementById('invoice-total').innerText = total;\n\n}", "title": "" }, { "docid": "6b0b66990323e2d472963206cb8910e4", "score": "0.629777", "text": "function getTotalAmount() {\n\tvar totalAmount = 0;\n\tvar subTotal;\n\tvar rowCollection;\n\n\trowCollection = Array.from(document.getElementsByClassName('table-Row')) // array of order item table rows\n\n\tfor (var i = 0; i < rowCollection.length; i++) {\n\t\t//subTotal = Number(rowCollection[i].children[4].innerHTML)\n\t\tsubTotal = parseFloat(rowCollection[i].children[5].textContent)\n\t\tconsole.log(subTotal)\n\t\ttotalAmount = totalAmount + subTotal;\n\t}\n\n\tdocument.getElementById('grandTotal').textContent = totalAmount;\n}", "title": "" }, { "docid": "7e08a5c86e00f8af61b31fc42afc15e5", "score": "0.62932134", "text": "function calculateTotal(){\n let casePrice = getItemInput('case') * 59;\n let phonePrice = getItemInput('phone') * 1219;\n let subTotal = casePrice + phonePrice;\n let tax = subTotal * 2/100;\n let totalPrice = subTotal + parseInt(tax);\n document.getElementById('sub-total').innerText = subTotal;\n document.getElementById('tax').innerText = parseInt(tax);\n document.getElementById('total-price').innerText = totalPrice;\n \n }", "title": "" }, { "docid": "0dcd689bf65a6b4f8b0a78eb8c9e17c6", "score": "0.6287437", "text": "function calculateBillTotal(totalBill) {\n var totalTax = totalBill * 0.095;\n var totalTip = totalBill * 0.15;\n\n return totalBill + totalTax + totalTip;\n}", "title": "" }, { "docid": "6c1e674bbdca56471cb542af719d4c65", "score": "0.62633264", "text": "function totalFunction(total, num) {\n return total + num;\n }", "title": "" }, { "docid": "49c965a06d90246fe7cc5c688731ad87", "score": "0.62611437", "text": "getTotal() {\n return basket\n .get(this)\n .reduce((currentSum, item) => item.price + currentSum, 0);\n }", "title": "" }, { "docid": "0e8eda8d86a7051343ba1c1e0272480d", "score": "0.62597615", "text": "function total_purchase() {\n var total = $('.total'), sum = 0;\n for (var i = 0; i < total.length; i++) {\n sum += parseFloat($(total[i]).text());\n }\n $('#total-purch').text(\"$R \" + sum);\n\n}", "title": "" }, { "docid": "86be2536b46bbbc2e0e71ad30f3daf5f", "score": "0.62549365", "text": "function calculateTotal() {\n labelImportTotal2.setText(Global.Functions.numToEuro(beforeTotal - parseFloat(editEuro.getValue().replace(\",\", \".\"))));\n }", "title": "" }, { "docid": "312bed952a80fe786788d6e7af3cf749", "score": "0.6251633", "text": "function vatTotal () {\n var vat = 0;\n for (product of products){\n vat += product.price * product.units * product.tax / 100;\n }\n return vat;\n}", "title": "" }, { "docid": "724a783fe04209a10f79b84c74daa693", "score": "0.62484753", "text": "function addtionTotal() {\n const deliveryChargeText = deliveryCharge.innerText\n const deliveryNumber = parseFloat(deliveryChargeText);\n\n const storageCostText = storageCost.innerText;\n const storageCostNumber = parseFloat(storageCostText);\n\n const memoryCostText = memoryCost.innerText;\n const memoryCostNumber = parseFloat(memoryCostText);\n\n const defouldPriceText = defouldPrice.innerText;\n const defouldPriceNumber = parseFloat(defouldPriceText);\n\n\n const allUpdatePrice = deliveryNumber + storageCostNumber + memoryCostNumber + defouldPriceNumber;\n totalPrice.innerText = allUpdatePrice;\n\n // Final Total PRice\n document.getElementById('final-order-price').innerText = allUpdatePrice;\n}", "title": "" }, { "docid": "8f19e9a69df47d19b1563fada22172c1", "score": "0.6246837", "text": "function printTotal() {\r\n let totalNode = document.getElementById('total');\r\n totalNode.textContent = `Total: $${getTotal().toFixed(2)}`;\r\n}", "title": "" }, { "docid": "4dfdf2e4fe2d33247ffb848dd7f3335c", "score": "0.6244532", "text": "function updateTotal() {\n const amounts = transactions.map((transaction) => transaction.amount);\n const total = amounts.reduce((acc, amt) => (acc += amt), 0);\n const plus = amounts.filter((amt) => amt >= 0).reduce((acc, amt) => (acc += amt), 0);\n const minus = amounts.filter((amt) => amt < 0).reduce((acc, amt) => (acc += amt), 0);\n\n // Add values to DOM\n balance.innerText = `$${total.toFixed(2)}`;\n income.innerText = `$${plus.toFixed(2)}`;\n expense.innerText = `$${minus.toFixed(2)}`;\n}", "title": "" }, { "docid": "6f911c8e6cc361194ce4fa679aac1b17", "score": "0.6238487", "text": "function updateTotalCost(obj, amount, operation = 'add') {\n\toperation === 'add'? obj.totalCost =parseFloat(obj.totalCost) + parseFloat(amount) : obj.totalCost = parseFloat(obj.totalCost) - parseFloat(amount);\n\tobj.totalCost = parseFloat(obj.totalCost.toFixed(2));\n}", "title": "" }, { "docid": "9ca60652f69b281a0253fbcbd46b4d1a", "score": "0.62315613", "text": "function calculateTotal() {\n const mainPrice = document.getElementById(\"main-price\").innerText;\n const memoryPrice = document.getElementById(\"memory-total-price\").innerText;\n const storagePrice = document.getElementById(\"storage-total-price\").innerText;\n const deliveryPrice = document.getElementById(\"delivery-price\").innerText;\n // calculate Total\n const mainAndMemoryPrice = parseInt(mainPrice) + parseInt(memoryPrice);\n const storageAndDeliveryPrice =\n parseInt(storagePrice) + parseInt(deliveryPrice);\n const totalPrice = mainAndMemoryPrice + storageAndDeliveryPrice;\n // show total in display\n const totalPriceField = document.getElementById(\"total-price\");\n\n totalPriceField.innerText = totalPrice;\n const discountTotalPrice = document.getElementById(\"discount-price\");\n discountTotalPrice.innerText = totalPrice;\n}", "title": "" }, { "docid": "14b5aedb2243b767d9e1531be632486e", "score": "0.6230617", "text": "function calculateTotal() {\r\n\r\n let newTotal = 0;\r\n\r\n for (checkbox of PurchaseItemCheckboxes) {\r\n if (checkbox.checked == true) {\r\n let item = findObject(checkbox.id, PurchaseItems)\r\n if (item != null) {\r\n newTotal += item.price;\r\n }\r\n }\r\n }\r\n\r\n PurchaseTotal.innerHTML = \"$ \" + newTotal.toFixed(2);\r\n}", "title": "" }, { "docid": "51d5725531f293413d98f2283c36d852", "score": "0.62266093", "text": "function sumDealt(){\n\n return total;\n}", "title": "" }, { "docid": "b1dcbc868f52d9462c29402bca36ae85", "score": "0.6221052", "text": "getTotal() {\r\n\t\treturn this.price * this.quantity\r\n\t}", "title": "" }, { "docid": "6cb50a0902f3e5c25cee0c3e478554ce", "score": "0.62210035", "text": "function total() {\r\n {\r\n transactions.map((transaction) => {\r\n\r\n //si la transaccion es ingreso y el checkbox de ingreso esta prendido, entonces sumar monto\r\n if (transaction.income == true && incomeCheck == true) {\r\n monto = monto + transaction.amount\r\n }\r\n\r\n\r\n //si la transaccion es gasto y el checkbox de gasto esta prendido, entonces restar monto\r\n else if (transaction.income == false && expenseCheck == true) {\r\n monto = monto - transaction.amount\r\n }\r\n }\r\n )\r\n }\r\n if (monto < 0){\r\n colorTotal = \"minus\"\r\n }\r\n }", "title": "" }, { "docid": "50569c0ea31e32e1a47bc3dff9cf7ed7", "score": "0.6214249", "text": "function givMeTotalInvoice(products){\n\tvar total=0;\n\tfor(var i=0; i<products.length; i++){\n\t\ttotal = total + products[i].valueTotal;\n\t}\n\treturn total;\n}", "title": "" }, { "docid": "a82625122298e5678f734bc1ac017ac6", "score": "0.6209463", "text": "function addOrder() {\r\n allOrder = allOrder + total;\r\n count++;\r\n\r\n document.getElementById(\"finalCost\").innerHTML = \"Total is : \" + allOrder;\r\n document.getElementById(\"noOfOrders\").innerHTML = \"Total number of orders is : \" + count;\r\n document.getElementById(\"currentManu\").innerHTML = \"Selected Manufacturer : \";\r\n document.getElementById(\"currentPackage\").innerHTML = \"Selected Packing Choice : \";\r\n document.getElementById(\"currentSize\").innerHTML = \"Selected Size : \";\r\n document.getElementById(\"currentExtra\").innerHTML = \"Selected Extra item : \";\r\n document.getElementById(\"currentTotalCost\").innerHTML = \"Current Order Total : \";\r\n\r\n\r\n}", "title": "" }, { "docid": "b2957728da1ab7c9189d8b3a71b01685", "score": "0.62014973", "text": "getPaymentTotal() {\n return Object.values(this.lineItems).reduce(\n (total, {product, sku, quantity}) =>\n total + (quantity ? quantity : 0) * this.products[product].skus.data[0].price,\n 0\n );\n }", "title": "" }, { "docid": "4262cfd65621e624d73b45f7f03cb0a2", "score": "0.6197914", "text": "function totalWithNJSalesTax() {\n\nvar saleTax = coffeeTotal * 0.07;\nvar totalWithNJSalesTax = saleTax + coffeeTotal;\n\nreturn totalWithNJSalesTax;\n}", "title": "" }, { "docid": "de54742b28430dd426c23b0c19337a6f", "score": "0.61882985", "text": "function importeTotal(pedido) {\n let suma = 0;\n for (const itemProducto of pedido.item_producto) {\n suma = suma + itemProducto.subTotal;\n }\n pedido.total = suma;\n return pedido;\n}", "title": "" }, { "docid": "a5f65eadcc4a9c42739bc2e7aa271186", "score": "0.6183058", "text": "total() {\n return this.items * this.price;\n }", "title": "" }, { "docid": "543f8346e4c610322f73d024ed3dc2f6", "score": "0.61708117", "text": "_calcTotal() {\n return this.items.reduce((accumulator, current) => {\n return accumulator + current.price;\n },0);\n }", "title": "" }, { "docid": "cc414cb260792af4a8aead45e6f4e8d2", "score": "0.6167572", "text": "get totalCost() {\n\t\treturn this.__totalCost;\n\t}", "title": "" }, { "docid": "7d2f7cb87d6424706602445182152ccc", "score": "0.6165779", "text": "function calcTotal() {\n for (var l = 0; l < allLocations.length; l++) {\n netTotal += allLocations[l].totalCookiesSoldPerStore;\n }\n}", "title": "" }, { "docid": "4fad7600f438ab362266c1df5a7f383c", "score": "0.61629474", "text": "function calulateTotal(type){\n var sum = 0;\n\n data.allItems[type].forEach(function(current){\n sum += current.value;\n })\n \n data.total[type] = sum;\n }", "title": "" }, { "docid": "16929139fd895e736807cfdcd614534f", "score": "0.61629117", "text": "setTotal(total) { this._behavior('set total', total); }", "title": "" }, { "docid": "3a45e979b91df1d1c0269daa5435b81e", "score": "0.6159215", "text": "function calcula_costo_total() {\n\tif(frm.txtCantidad.value!='') {\n\t\tfrm.txtCostoTotal.value=frm.txtCantidad.value*frm.txtCostoUnitario.value\n\t}\n}", "title": "" }, { "docid": "2ad8b632368cfb011ae0f6b6c00cbfe9", "score": "0.6156775", "text": "function add(){\n var sum = 0;\n for (var i = 0; i<total.length;i++){\n sum+= Number(total[i]);\n }\n var table = document.getElementById(\"get_budget\");\n var body = table.getElementsByTagName(\"tbody\");\n var row = body.insertRow(body.length);\n var cell1 = row.insertCell(0);\n cell1.innerHTML=\"\";\n var cell2 = row.insertCell(1);\n cell2.innerHTML=\"\";\n var cell3 = row.insertCell(2);\n cell3.innerHTML=\"$\"+sum;\n}", "title": "" }, { "docid": "ef9a726c259d2eafbcaccc9890318800", "score": "0.61508924", "text": "function getTotal() {\n grandTotal = totalInput + totalCheckboxe;\n $(\"#text-customQuote, #text-customQuoteWidget\").text(grandTotal + \" € \");\n}", "title": "" }, { "docid": "7210803ca85648bed64c8042fa6d2f40", "score": "0.6145789", "text": "function orderTotals() {\n subTotal = (pizzaPrice + vegTotal + toppingsTotal);\n var taxTotal = (subTotal * taxRate)\n var grandTotal = (subTotal + taxTotal + delFee)\n $(\"#outputSubTotal\").text(subTotal.toFixed(2)).css(\"color\", \"lightGreen\")\n $(\"#outputTax\").text(taxTotal.toFixed(2)).css(\"color\", \"lightGreen\")\n $(\"#outputDelFee\").text(delFee.toFixed(2)).css(\"color\", \"lightGreen\")\n $(\"#outputGrandTotal\").text(grandTotal.toFixed(2)).css(\"color\", \"lightGreen\")\n }", "title": "" }, { "docid": "1e7b97e57f72faab786fe44a51b418d8", "score": "0.614407", "text": "function updateTotal(){\n let total = 0;\n\n for (let product of cart) {\n let price = product.price;\n total += Number(price);\n //total += parseInt(price);\n }\n\n let totalElement = document.querySelector('.total span');\n totalElement.textContent = total;\n}", "title": "" }, { "docid": "18c4b74e424ffc43cb130dea378bedfc", "score": "0.61345905", "text": "function addTotalProductPrice(a, b) {\n return a + b;\n}", "title": "" }, { "docid": "2a7c217c11c318535d0c23e87f8f5c0b", "score": "0.613301", "text": "function onRecalculateTotal( tableElement ) {\n var\n ds = tableElement.dataSet,\n row,\n total = 0;\n\n for( row = 0; row < ds.length; row++ ) {\n\n if( ds[row].hasOwnProperty( 'cost' ) && !isNaN( ds[row].cost ) ) {\n total = total + parseFloat( ds[row].cost );\n }\n }\n\n // DEPRECATED: we should get the total from the activity, which should set it from API call\n Y.log( 'Grand total: ' + total, 'debug', NAME );\n\n //total = total.toFixed(2);\n //currentActivity.content('EUR ' + total.toFixed( 2 ) + ' (' + ds.length + ')');\n template.map( { 'total': Y.doccirrus.comctl.numberToLocalCurrency( total ) }, true, onReMapComplete );\n\n function onReMapComplete( err ) {\n if( err ) {\n Y.log( 'Problem mapping invoice: ' + err, 'warn', NAME );\n return;\n }\n\n template.raise( 'mapcomplete', {} );\n\n //alert('form mapped after selection change, saving form: ' + JSON.stringify(template.toDict()), 'debug', NAME);\n context.attachments.updateFormDoc( context, template, onTotalUpdated );\n }\n\n function onTotalUpdated(err) {\n if (err) {\n Y.log('Problem updating linked form document: ' + JSON.stringify(err), 'warn', NAME);\n }\n }\n }", "title": "" }, { "docid": "f292cb2c9863c1faf1689ff312494d03", "score": "0.61299413", "text": "function total() {\n\tlet total;\n\tif ($('#coupon').val() === 'DEPTRAI') {\n\t\ttotal = formatNumber(subtotal() * 0.9);\n\t}\n\tif ($('#coupon').val() === 'XINHGAI') {\n\t\ttotal = formatNumber(subtotal() * 0.85);\n\t}\n\tif ($('#coupon').val() === 'CHONGDAY') {\n\t\ttotal = formatNumber(subtotal() * 0.8);\n\t}\n\tif ($('#coupon').val() === '') {\n\t\ttotal = formatNumber(subtotal());\n\t}\n\treturn total;\n}", "title": "" }, { "docid": "137468d168c04adfb273df8a2d445cdc", "score": "0.61210376", "text": "totalDepositos() {\n let total = 0;\n for (let i = 0; i < this.depositos.length; i++) {\n total += this.depositos[i][1]\n }\n return total;\n }", "title": "" }, { "docid": "339e7065eeebb777347c59b196b02037", "score": "0.61202", "text": "function totalAmount(cost, service){\n if (service.toLowerCase() === \"good\"){\n tip = cost * .2;\n ((tip * 100) / 100).toFixed(2);\n }\n else if (service.toLowerCase() === \"fair\"){\n tip = cost * .15;\n ((tip * 100) / 100).toFixed(2);\n }\n else if (service.toLowerCase() === \"bad\"){\n tip = cost * .1;\n ((tip * 100) / 100).toFixed(2);\n }\n var total = tip + cost;\n console.log(`Total cost: $${total.toFixed(2)}`);\n}", "title": "" }, { "docid": "678183de58852bd00884155155804200", "score": "0.6119229", "text": "function calculateTotal() {\n const firstclassInput = document.getElementById(\"firstClassInput\");\n const firstclassCount = parseInt(firstclassInput.value);\n const economyclassInput = document.getElementById(\"economyClassInput\");\n const economyclassCount = parseInt(economyclassInput.value);\n\n const subtotalPrice = firstclassCount * 150 + economyclassCount * 100;\n document.getElementById(\"subtotal\").innerText = subtotalPrice;\n const vat = Math.round(subtotalPrice * 0.1);\n document.getElementById(\"vat-amount\").innerText = vat;\n const grandTotal = subtotalPrice + vat;\n document.getElementById(\"total\").innerText = grandTotal;\n}", "title": "" }, { "docid": "81e786c508cfb5786edb8b3d83c534a5", "score": "0.6118816", "text": "function updateTotal(vehiclePrice, colorPrice, packagePrice){\n runningTotal = vehiclePrice + colorPrice + packagePrice;\n runningTotal = numsWithcommas(runningTotal);\n $('.cost-display').text(\"$\"+ runningTotal);\n}", "title": "" } ]
f2e798d815d9abd84b84f9ee34d076ea
private _uniqContentEquals function. That function is checking equality of 2 iterator contents with 2 assumptions iterators lengths are the same iterators values are unique falsepositive result will be returned for comparision of, e.g. [1,2,3] and [1,2,3,4] [1,1,1] and [1,2,3]
[ { "docid": "f61a83fca5caa8b069196a6aa63e5f7e", "score": "0.7693198", "text": "function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {\n var a = _arrayFromIterator(aIterator);\n\n var b = _arrayFromIterator(bIterator);\n\n function eq(_a, _b) {\n return _equals(_a, _b, stackA.slice(), stackB.slice());\n } // if *a* array contains any element that is not included in *b*\n\n\n return !_includesWith(function (b, aItem) {\n return !_includesWith(eq, aItem, b);\n }, b, a);\n}", "title": "" } ]
[ { "docid": "881725df0988273ea9181e4a95f560a0", "score": "0.78885794", "text": "function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {\r\n var a = _arrayFromIterator(aIterator)\r\n var b = _arrayFromIterator(bIterator)\r\n\r\n function eq(_a, _b) {\r\n return _equals(_a, _b, stackA.slice(), stackB.slice())\r\n }\r\n\r\n // if *a* array contains any element that is not included in *b*\r\n return !_includesWith(\r\n function(b, aItem) {\r\n return !_includesWith(eq, aItem, b)\r\n },\r\n b,\r\n a\r\n )\r\n }", "title": "" }, { "docid": "4b5963e6c12839945ca1bbc7226d9ee3", "score": "0.7853599", "text": "function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {\n\t var a = _arrayFromIterator(aIterator);\n\n\t var b = _arrayFromIterator(bIterator);\n\n\t function eq(_a, _b) {\n\t return _equals(_a, _b, stackA.slice(), stackB.slice());\n\t } // if *a* array contains any element that is not included in *b*\n\n\n\t return !_containsWith(function (b, aItem) {\n\t return !_containsWith(eq, aItem, b);\n\t }, b, a);\n\t}", "title": "" }, { "docid": "d81024f3308317cadb200fabbf23661b", "score": "0.78442276", "text": "function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {\n\t var a = _arrayFromIterator(aIterator);\n\t var b = _arrayFromIterator(bIterator);\n\n\t function eq(_a, _b) {\n\t return _equals(_a, _b, stackA.slice(), stackB.slice());\n\t }\n\n\t // if *a* array contains any element that is not included in *b*\n\t return !_containsWith(function (b, aItem) {\n\t return !_containsWith(eq, aItem, b);\n\t }, b, a);\n\t}", "title": "" }, { "docid": "239fd51b53989f093f0a45d33b4527be", "score": "0.7778579", "text": "function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {\n var a = (0,_arrayFromIterator_js__WEBPACK_IMPORTED_MODULE_0__.default)(aIterator);\n\n var b = (0,_arrayFromIterator_js__WEBPACK_IMPORTED_MODULE_0__.default)(bIterator);\n\n function eq(_a, _b) {\n return _equals(_a, _b, stackA.slice(), stackB.slice());\n } // if *a* array contains any element that is not included in *b*\n\n\n return !(0,_includesWith_js__WEBPACK_IMPORTED_MODULE_1__.default)(function (b, aItem) {\n return !(0,_includesWith_js__WEBPACK_IMPORTED_MODULE_1__.default)(eq, aItem, b);\n }, b, a);\n}", "title": "" }, { "docid": "56326d03d537439b533a464c922f8cf9", "score": "0.774101", "text": "function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {\n var a = (0, _arrayFromIterator2.default)(aIterator);\n var b = (0, _arrayFromIterator2.default)(bIterator);\n\n function eq(_a, _b) {\n return _equals(_a, _b, stackA.slice(), stackB.slice());\n } // if *a* array contains any element that is not included in *b*\n\n\n return !(0, _containsWith2.default)(function (b, aItem) {\n return !(0, _containsWith2.default)(eq, aItem, b);\n }, b, a);\n}", "title": "" }, { "docid": "56326d03d537439b533a464c922f8cf9", "score": "0.774101", "text": "function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {\n var a = (0, _arrayFromIterator2.default)(aIterator);\n var b = (0, _arrayFromIterator2.default)(bIterator);\n\n function eq(_a, _b) {\n return _equals(_a, _b, stackA.slice(), stackB.slice());\n } // if *a* array contains any element that is not included in *b*\n\n\n return !(0, _containsWith2.default)(function (b, aItem) {\n return !(0, _containsWith2.default)(eq, aItem, b);\n }, b, a);\n}", "title": "" }, { "docid": "b002eb4be1e12c06d3aba52a21135155", "score": "0.7689134", "text": "function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {\n var a = Object(_arrayFromIterator_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(aIterator);\n var b = Object(_arrayFromIterator_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(bIterator);\n\n function eq(_a, _b) {\n return _equals(_a, _b, stackA.slice(), stackB.slice());\n }\n\n // if *a* array contains any element that is not included in *b*\n return !Object(_includesWith_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(function (b, aItem) {\n return !Object(_includesWith_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(eq, aItem, b);\n }, b, a);\n}", "title": "" }, { "docid": "4d412191ebb3bd4868d74abeb72bbf3a", "score": "0.7685182", "text": "function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {\n var a = Object(_arrayFromIterator_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(aIterator);\n\n var b = Object(_arrayFromIterator_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(bIterator);\n\n function eq(_a, _b) {\n return _equals(_a, _b, stackA.slice(), stackB.slice());\n } // if *a* array contains any element that is not included in *b*\n\n\n return !Object(_includesWith_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(function (b, aItem) {\n return !Object(_includesWith_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(eq, aItem, b);\n }, b, a);\n}", "title": "" }, { "docid": "2e46cc4eade2f4f6b417b56b5a0fa710", "score": "0.7660818", "text": "function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {\n var a = Object(_arrayFromIterator__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(aIterator);\n var b = Object(_arrayFromIterator__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(bIterator);\n\n function eq(_a, _b) {\n return _equals(_a, _b, stackA.slice(), stackB.slice());\n }\n\n // if *a* array contains any element that is not included in *b*\n return !Object(_containsWith__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(function (b, aItem) {\n return !Object(_containsWith__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(eq, aItem, b);\n }, b, a);\n}", "title": "" }, { "docid": "2e46cc4eade2f4f6b417b56b5a0fa710", "score": "0.7660818", "text": "function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {\n var a = Object(_arrayFromIterator__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(aIterator);\n var b = Object(_arrayFromIterator__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(bIterator);\n\n function eq(_a, _b) {\n return _equals(_a, _b, stackA.slice(), stackB.slice());\n }\n\n // if *a* array contains any element that is not included in *b*\n return !Object(_containsWith__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(function (b, aItem) {\n return !Object(_containsWith__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(eq, aItem, b);\n }, b, a);\n}", "title": "" }, { "docid": "cf78cf6d5d6a6a33f418ca30ee4653d1", "score": "0.76438606", "text": "function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {\n var a = _arrayFromIterator(aIterator);\n var b = _arrayFromIterator(bIterator);\n\n function eq(_a, _b) {\n return _equals(_a, _b, stackA.slice(), stackB.slice());\n }\n\n // if *a* array contains any element that is not included in *b*\n return !_includesWith(function (b, aItem) {\n return !_includesWith(eq, aItem, b);\n }, b, a);\n}", "title": "" }, { "docid": "cf78cf6d5d6a6a33f418ca30ee4653d1", "score": "0.76438606", "text": "function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {\n var a = _arrayFromIterator(aIterator);\n var b = _arrayFromIterator(bIterator);\n\n function eq(_a, _b) {\n return _equals(_a, _b, stackA.slice(), stackB.slice());\n }\n\n // if *a* array contains any element that is not included in *b*\n return !_includesWith(function (b, aItem) {\n return !_includesWith(eq, aItem, b);\n }, b, a);\n}", "title": "" }, { "docid": "cf78cf6d5d6a6a33f418ca30ee4653d1", "score": "0.76438606", "text": "function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {\n var a = _arrayFromIterator(aIterator);\n var b = _arrayFromIterator(bIterator);\n\n function eq(_a, _b) {\n return _equals(_a, _b, stackA.slice(), stackB.slice());\n }\n\n // if *a* array contains any element that is not included in *b*\n return !_includesWith(function (b, aItem) {\n return !_includesWith(eq, aItem, b);\n }, b, a);\n}", "title": "" }, { "docid": "cf78cf6d5d6a6a33f418ca30ee4653d1", "score": "0.76438606", "text": "function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {\n var a = _arrayFromIterator(aIterator);\n var b = _arrayFromIterator(bIterator);\n\n function eq(_a, _b) {\n return _equals(_a, _b, stackA.slice(), stackB.slice());\n }\n\n // if *a* array contains any element that is not included in *b*\n return !_includesWith(function (b, aItem) {\n return !_includesWith(eq, aItem, b);\n }, b, a);\n}", "title": "" }, { "docid": "46728987a47a1a4f299236885eeb5bb4", "score": "0.76355207", "text": "function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {\n var a = _arrayFromIterator(aIterator);\n var b = _arrayFromIterator(bIterator);\n\n function eq(_a, _b) {\n return _equals(_a, _b, stackA.slice(), stackB.slice());\n }\n\n // if *a* array contains any element that is not included in *b*\n return !_containsWith(function (b, aItem) {\n return !_containsWith(eq, aItem, b);\n }, b, a);\n}", "title": "" }, { "docid": "194af5e7934001cfd78165f8d7a32fe2", "score": "0.7604497", "text": "function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {\n var a = Object(__WEBPACK_IMPORTED_MODULE_0__arrayFromIterator__[\"a\" /* default */])(aIterator);\n var b = Object(__WEBPACK_IMPORTED_MODULE_0__arrayFromIterator__[\"a\" /* default */])(bIterator);\n\n function eq(_a, _b) {\n return _equals(_a, _b, stackA.slice(), stackB.slice());\n }\n\n // if *a* array contains any element that is not included in *b*\n return !Object(__WEBPACK_IMPORTED_MODULE_1__containsWith__[\"a\" /* default */])(function (b, aItem) {\n return !Object(__WEBPACK_IMPORTED_MODULE_1__containsWith__[\"a\" /* default */])(eq, aItem, b);\n }, b, a);\n}", "title": "" }, { "docid": "194af5e7934001cfd78165f8d7a32fe2", "score": "0.7604497", "text": "function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {\n var a = Object(__WEBPACK_IMPORTED_MODULE_0__arrayFromIterator__[\"a\" /* default */])(aIterator);\n var b = Object(__WEBPACK_IMPORTED_MODULE_0__arrayFromIterator__[\"a\" /* default */])(bIterator);\n\n function eq(_a, _b) {\n return _equals(_a, _b, stackA.slice(), stackB.slice());\n }\n\n // if *a* array contains any element that is not included in *b*\n return !Object(__WEBPACK_IMPORTED_MODULE_1__containsWith__[\"a\" /* default */])(function (b, aItem) {\n return !Object(__WEBPACK_IMPORTED_MODULE_1__containsWith__[\"a\" /* default */])(eq, aItem, b);\n }, b, a);\n}", "title": "" }, { "docid": "8ae54c0351817c4485a1736426713f66", "score": "0.6766677", "text": "function same(a1, a2) {\n\tconst uniqueItems1 = Array.from(new Set(a1));\n\tconst uniqueItems2 = Array.from(new Set(a2));\n\t\n\treturn uniqueItems1.length === uniqueItems2.length;\n}", "title": "" }, { "docid": "8ae54c0351817c4485a1736426713f66", "score": "0.6766677", "text": "function same(a1, a2) {\n\tconst uniqueItems1 = Array.from(new Set(a1));\n\tconst uniqueItems2 = Array.from(new Set(a2));\n\t\n\treturn uniqueItems1.length === uniqueItems2.length;\n}", "title": "" }, { "docid": "3b2ab6c1f75cde794fd74a9730d5f97b", "score": "0.66937685", "text": "areSequenceObjectsUnEqual(seq1,seq2) {\r\n if(seq1.length !== seq2.length) {\r\n //simple test for equality\r\n return true;\r\n } else {\r\n for(let i = 0; i < seq1.length; ++i) {\r\n //more elaborate test\r\n if(!isEqual(seq1[i], seq2[i])) {\r\n return true;\r\n }\r\n }\r\n\r\n }\r\n return false;\r\n }", "title": "" }, { "docid": "f7be7941c4c15557590f6202ad232844", "score": "0.63800937", "text": "isSameSet(i, j) {\n return this.findSet(i) === this.findSet(j)\n }", "title": "" }, { "docid": "39fb2cd5bd25b702e302e4ccae84ff25", "score": "0.6186047", "text": "function areSetsEqual(a, b, isEqual, meta) {\r\n var isValueEqual = a.size === b.size;\r\n if (isValueEqual && a.size) {\r\n var matchedIndices_2 = {};\r\n a.forEach(function (aValue) {\r\n if (isValueEqual) {\r\n var hasMatch_2 = false;\r\n var matchIndex_2 = 0;\r\n b.forEach(function (bValue) {\r\n if (!hasMatch_2 && !matchedIndices_2[matchIndex_2]) {\r\n hasMatch_2 = isEqual(aValue, bValue, meta);\r\n if (hasMatch_2) {\r\n matchedIndices_2[matchIndex_2] = true;\r\n }\r\n }\r\n matchIndex_2++;\r\n });\r\n isValueEqual = hasMatch_2;\r\n }\r\n });\r\n }\r\n return isValueEqual;\r\n}", "title": "" }, { "docid": "85403fac5f9b09c105b9b76b617037ca", "score": "0.6183554", "text": "equals(otherSet) {\n if (otherSet.size !== this.size) return false;\n let equals = true;\n for (let item of otherSet) {\n if (!this.has(item)) {\n equals = false;\n }\n }\n return equals;\n }", "title": "" }, { "docid": "f5da74fa1df3d5af86be9de6288e90f0", "score": "0.6098754", "text": "function areSetsEqual(a, b, isEqual, meta) {\r\n var isValueEqual = a.size === b.size;\r\n if (isValueEqual && a.size) {\r\n a.forEach(function (aValue) {\r\n if (isValueEqual) {\r\n isValueEqual = false;\r\n b.forEach(function (bValue) {\r\n if (!isValueEqual) {\r\n isValueEqual = isEqual(aValue, bValue, meta);\r\n }\r\n });\r\n }\r\n });\r\n }\r\n return isValueEqual;\r\n }", "title": "" }, { "docid": "c5925989f5133ebc263a041e74eff075", "score": "0.60688674", "text": "function areSetsEqual(a, b, isEqual, meta) {\n var isValueEqual = a.size === b.size;\n if (isValueEqual && a.size) {\n a.forEach(function (aValue) {\n if (isValueEqual) {\n isValueEqual = false;\n b.forEach(function (bValue) {\n if (!isValueEqual) {\n isValueEqual = isEqual(aValue, bValue, meta);\n }\n });\n }\n });\n }\n return isValueEqual;\n }", "title": "" }, { "docid": "da34335f3119c54fc3153f62a866c2fb", "score": "0.6065797", "text": "function equalList(a,b) {\n let isMatch = true;\n if (a.length === b.length) {\n for (let i = 0; i < a.length; i++) {\n if (a[i] != b[i]) {\n isMatch = false;\n }\n }\n } else {\n isMatch = false;\n }\n return isMatch;\n}", "title": "" }, { "docid": "688c987712f542ffc5477756f74bea4f", "score": "0.6065525", "text": "function eqArrays(array1, array2) { //does work for us, compare equality\n if (array1.length !== array2.length) {\n return false;\n }\n for (let i = 0; i < array1.length; i++) { //check item at same index if the same; not nested for loop, not need both 1 and 2\n if (array1[i] !== array2[i]) { //end condition is not equal\n return false;\n }\n }\n return true; //return boolean\n}", "title": "" }, { "docid": "269a84158cf6f0b2fb9d8c54b2a12b93", "score": "0.597577", "text": "hasIdenticalEndPoints(tileArr1,tileArr2){\n return (tileArr1.filter(endPoint=>{\n return tileArr2.indexOf(endPoint)!=-1;\n }).length>0);\n }", "title": "" }, { "docid": "66a1d627411e589d4caf58a72739688e", "score": "0.59549874", "text": "function eqSets_QMRK_(s1, s2) {\n let ok_QMRK_ = true;\n if( (s1.size === s2.size) ) {\n if (true) {\n s1.forEach(function(v, k) {\n return ((!s2.has(v)) ?\n (ok_QMRK_ = false) :\n null);\n });\n }\n }\n return ok_QMRK_;\n}", "title": "" }, { "docid": "7b790668367adecd1012001a4bcb936a", "score": "0.59414095", "text": "function _isEqualArray(a, b) {\n\t if (a === b) {\n\t return true;\n\t }\n\t if ((a === undefined) || (b === undefined)) {\n\t return false;\n\t }\n\t var i = a.length;\n\t if (i !== b.length){\n\t return false;\n\t }\n\t while (i--) {\n\t if (a[i] !== b[i]) {\n\t return false;\n\t }\n\t }\n\t return true;\n\t }", "title": "" }, { "docid": "8abd015038c6d16ea8388f01ee09f9cf", "score": "0.5934695", "text": "equals(secondQ){\n if(this.getSize() != secondQ.getSize()) return false;\n\n /* let runner1 = this.head;\n let runner2 = secondQ.head;\n while(runner1 != null && runner2 != null){\n if(runner1.value != runner2.value) return false;\n\n else{\n runner1 = runner1.next;\n runner2 = runner2.next;\n }\n } */\n if(this.printPretty() == secondQ.printPretty())return true;\n\n else return false;\n }", "title": "" }, { "docid": "e40cf559366bcab1e2b8030f0db3b626", "score": "0.5924988", "text": "function areSimilar(a, b) \n{ \n let n = 0;\n for(let i = 0; i < a.length; ++i)\n {\n if(b[i] !== a[i])\n {\n if(++n == 2)return false;\n \n let indexes = []; \n indexes.push(b.indexOf(a[i], i));\n \n if(indexes[0] == -1) return false;\n let index = indexes[0] +1;\n \n while(index != -1 && index < a.length)\n {\n index = b.indexOf(a[i], index);\n if(index != -1) indexes.push(index++);\n \n }\n \n for(let k = 0; k < indexes.length; ++k)\n {\n if(a[indexes[k]] == b[i])\n {\n const c = b[indexes[k]];\n b[indexes[k]] = b[i];\n b[i] = c; \n }\n }\n }\n }\n \n return a.toString() === b.toString();\n}", "title": "" }, { "docid": "a128247c6ec56e5ce229864b503ef031", "score": "0.59146583", "text": "function same(list1, list2){\n\tif(list1.length !== list2.length) return false;\n\tlet obj1 = {};\n\tlet obj2 = {};\n\tfor (let i of list1) {\n\t\tobj1[i] ? ++obj1[i] : obj1[i] = 1;\n\t}\n\tfor (let i of list2) {\n\t\tobj2[i] ? ++obj2[i] : obj2[i] = 1;\n\t}\n\tfor(let i in obj1){\n\t\tif(!(i ** 2 in obj2)) return false;\n\t\tif(obj2[i ** 2] !== obj1[i]) return false;\n\t}\n\treturn true;\n}", "title": "" }, { "docid": "9b531d3af8bb10d5cfd90fb80690b52f", "score": "0.5914279", "text": "function flatArraysAreEqualWithOrder(a,b) {\r\n if (a.length != b.length) { return false; }\r\n\r\n for (var i = 0; i < a.length; i++) {\r\n if (a[i] != b[i]) { return false; }\r\n }\r\n\r\n return true;\r\n}", "title": "" }, { "docid": "30fb5166f5b77f750113c244f045a1f0", "score": "0.5884979", "text": "_getDuplicates(first, second) {\n var mixer = this;\n return second.map(function (c) {\n var duplicate = false;\n first.forEach(function (i) {\n // Does the main link match?\n if (UrlCompare.sameUrls(c.label, i.label)) {\n duplicate = true;\n return;\n }\n\n // Do any of the sublinks match?\n var sublinks = mixer._collectSublinks(i.data);\n sublinks.some(function (u) {\n if (UrlCompare.sameUrls(u, c.label)) {\n duplicate = true;\n return true; // stop iteration\n }\n });\n });\n\n if (duplicate) {\n return c;\n }\n }).filter(function (result) {\n return result;\n });\n }", "title": "" }, { "docid": "23e5c82a9541fa85f9c1749a64426ffc", "score": "0.5872841", "text": "function arrayOfObjectsEquals(a, b) {\n\n if (a === null || b === null) {\n return false;\n }\n if (a.length !== b.length) {\n return false;\n }\n\n a.sort();\n b.sort();\n\n\n for (var i = 0; i < a.length; ++i) {\n if (JSON.stringify(a[i]) !== JSON.stringify(b[i])) {\n return false;\n }\n }\n\n return true;\n}", "title": "" }, { "docid": "c3751d7d8691756702792c760538c940", "score": "0.5872448", "text": "function same (a, b) {\n\t return a === b || a !== a && b !== b\n\t}", "title": "" }, { "docid": "272ed5e5c2f1733cb3304856bf34319a", "score": "0.5871818", "text": "function arraysAreEqual(ary1,ary2){\n\tif(ary1.length == ary2.length) {\n\t\t\n\t\tvar i;\n\t\tvar j;\n\t\tvar tmp = 0;\n\t\t\n\t\tfor( i = 0; i < ary1.length; i++) {\n\t\t\t\n\t\t\tfor( j = 0; j < ary2.length; j++) {\n\t\t\t\t\n\t\t\t\tif(ary1[i] == ary2[j]){\n\t\t\t\t\t\n\t\t\t\t\ttmp++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif(tmp == ary1.length) {\n\t\t\t\n\t\t\treturn true;\n\t\t\t\n\t\t} else {\n\t\t\t\n\t\t\treturn false;\n\t\t\t\n\t\t}\n\t\t\n\t} else {\n\t\t\n\t\treturn false;\n\t\t\n\t}\n\t\n return (ary1.join('') == ary2.join(''));\n}", "title": "" }, { "docid": "59eb23c8c1de9a419dc9eb61f622ae8d", "score": "0.58500755", "text": "function areSetsEqual(a, b, isEqual, meta) {\r\n var isValueEqual = a.size === b.size;\r\n if (!isValueEqual) {\r\n return false;\r\n }\r\n if (!a.size) {\r\n return true;\r\n }\r\n // The use of `forEach()` is to avoid the transpilation cost of `for...of` comparisons, and\r\n // the inability to control the performance of the resulting code. It also avoids excessive\r\n // iteration compared to doing comparisons of `keys()` and `values()`. As a result, though,\r\n // we cannot short-circuit the iterations; bookkeeping must be done to short-circuit the\r\n // equality checks themselves.\r\n var matchedIndices = {};\r\n a.forEach(function (aValue, aKey) {\r\n if (!isValueEqual) {\r\n return;\r\n }\r\n var hasMatch = false;\r\n var matchIndex = 0;\r\n b.forEach(function (bValue, bKey) {\r\n if (!hasMatch &&\r\n !matchedIndices[matchIndex] &&\r\n (hasMatch = isEqual(aValue, bValue, aKey, bKey, a, b, meta))) {\r\n matchedIndices[matchIndex] = true;\r\n }\r\n matchIndex++;\r\n });\r\n isValueEqual = hasMatch;\r\n });\r\n return isValueEqual;\r\n}", "title": "" }, { "docid": "6387ad3867cd44f99326de3aa92d77fa", "score": "0.58422124", "text": "function flatArraysAreEqual(a,b) {\r\n if (a.length != b.length) { return false; }\r\n\r\n // Sort arrays\r\n // sortValue = function(el) { return el; }\r\n // a = _.sortBy(a, sortValue);\r\n // b = _.sortBy(b, sortValue);\r\n a.sort();\r\n b.sort();\r\n\r\n for (var i = 0; i < a.length; i++) {\r\n if (a[i] != b[i]) { return false; }\r\n }\r\n\r\n return true;\r\n}", "title": "" }, { "docid": "306bd40cea9305947aa7129fb763f10f", "score": "0.5825217", "text": "arrayEq (ary1, ary2) {\n const a = [].concat(ary1).sort()\n const b = [].concat(ary2).sort()\n\n if (a.length !== b.length) return false\n\n for (let i in a) {\n if (a[i] !== b[i]) return false\n }\n\n return true\n }", "title": "" }, { "docid": "1c05d928c829108651de3beb0018cbd7", "score": "0.581932", "text": "function same(array1, array2) {\n if (array1.length !== array2.length) {\n return false;\n }\n\n for (let element of array1) {\n let index = array2.indexOf(element ** 2);\n\n if (index === -1) {\n return false;\n }\n\n array2.splice(index, 1);\n }\n\n return true;\n}", "title": "" }, { "docid": "974006a17e95c49f90fd300965f83649", "score": "0.57944834", "text": "equals(other) {\n if (other.size !== this.size) {\n return false;\n }\n for(let i = 0; i < this.array.length; i++){\n if (this.array[i] !== other.array[i]) {\n return false;\n }\n }\n return true;\n }", "title": "" }, { "docid": "9d41bc0012e65dff6d521c32d1dba4d6", "score": "0.57931995", "text": "equals(secondQ){\n if (secondQ.size != this.size) {\n return false;\n }\n let runner1 = this.head;\n let runner2 = secondQ.head;\n\n while (runner1 && runner2) {\n if(runner1.value != runner2.value) {\n return false;\n }\n runner1 = runner1.next;\n runner2 = runner2.next;\n }\n return true;\n }", "title": "" }, { "docid": "eae83b59f129b0a3d75bdda25163ef4a", "score": "0.5789687", "text": "function item_set_equal( set1, set2 )\n{\n\tvar i, j, cnt = 0;\n\t\n\tif( set1.length != set2.length )\n\t\treturn false;\n\n\tfor( i = 0; i < set1.length; i++ )\n\t{\n\t\tfor( j = 0; j < set2.length; j++ )\n\t\t{\t\t\t\n\t\t\tif( set1[i].prod == set2[j].prod &&\n\t\t\t\tset1[i].dot_offset == set2[j].dot_offset )\n\t\t\t{\n\t\t\t\tcnt++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tif( cnt == set1.length )\n\t\treturn true;\n\t\t\n\treturn false;\n}", "title": "" }, { "docid": "3175b3f721f3e3366856e11f5301c7df", "score": "0.5784811", "text": "areInSameSet(elemIndex0, elemIndex1) {\n return this.getRepr(elemIndex0) == this.getRepr(elemIndex1);\n }", "title": "" }, { "docid": "6c7ed353a6203d283059d61e651e427e", "score": "0.5782498", "text": "_isEqual(a, b) {\n return deepequal(a, b);\n }", "title": "" }, { "docid": "614a2291f24bd9df9e1a62af7ce346f4", "score": "0.5781205", "text": "function arrEquals(array1, array2) {\n if (!array1 || !array2)\n return false;\n if (array1.length != array2.length)\n return false;\n for (var i = 0, l=array1.length; i < l; i++) {\n if (array1[i] instanceof Array && array2[i] instanceof Array) {\n if (!array1[i].equals(array2[i]))\n return false; \n } else if (array1[i] != array2[i]) { \n // Warning - two different object instances will never be equal: {x:20} != {x:20}\n return false; \n } \n } \n return true;\n}", "title": "" }, { "docid": "c64745981ed0ebff1df34c18dd723348", "score": "0.57809526", "text": "function eqArrs_QMRK_(a1, a2) {\n let ok_QMRK_ = true;\n if( (a1.length == a2.length) ) {\n if (true) {\n a1.forEach(function(v, k) {\n return ((!eq_QMRK_(a2[k], v)) ?\n (ok_QMRK_ = false) :\n null);\n });\n }\n }\n return ok_QMRK_;\n}", "title": "" }, { "docid": "842cdcde6280e9c4c4e8089d9b98d4fc", "score": "0.5779239", "text": "function equal(first, second) {\n if (first.length !== second.length) {\n return false;\n }\n for (var i = 0; i < first.length; i++) {\n if (first[i] !== second[i]) {\n return false;\n }\n }\n return true;\n}", "title": "" }, { "docid": "9e78a42bcf2142a4a627c366e7f1f655", "score": "0.57790387", "text": "function areSimilar(a, b) {\n let ab = a.filter((v,i)=> v!=b[i]) //creates array of differences between a and b\n if (ab.length > 2) return false\n let ba = b.filter((v,i)=> v!=a[i]) //creates array of differences between b and a\n return ab.length === 0 || (ab.length === 2 && ab.join(\"\") == ba.reverse().join(\"\")) //base case || swaps\n}", "title": "" }, { "docid": "b2e3d193dae470d9165c1118d3694fb2", "score": "0.5775707", "text": "function same (a, b) {\n return a === b || a !== a && b !== b\n}", "title": "" }, { "docid": "b2e3d193dae470d9165c1118d3694fb2", "score": "0.5775707", "text": "function same (a, b) {\n return a === b || a !== a && b !== b\n}", "title": "" }, { "docid": "b2e3d193dae470d9165c1118d3694fb2", "score": "0.5775707", "text": "function same (a, b) {\n return a === b || a !== a && b !== b\n}", "title": "" }, { "docid": "b2e3d193dae470d9165c1118d3694fb2", "score": "0.5775707", "text": "function same (a, b) {\n return a === b || a !== a && b !== b\n}", "title": "" }, { "docid": "b2e3d193dae470d9165c1118d3694fb2", "score": "0.5775707", "text": "function same (a, b) {\n return a === b || a !== a && b !== b\n}", "title": "" }, { "docid": "b2e3d193dae470d9165c1118d3694fb2", "score": "0.5775707", "text": "function same (a, b) {\n return a === b || a !== a && b !== b\n}", "title": "" }, { "docid": "b2e3d193dae470d9165c1118d3694fb2", "score": "0.5775707", "text": "function same (a, b) {\n return a === b || a !== a && b !== b\n}", "title": "" }, { "docid": "b2e3d193dae470d9165c1118d3694fb2", "score": "0.5775707", "text": "function same (a, b) {\n return a === b || a !== a && b !== b\n}", "title": "" }, { "docid": "b2e3d193dae470d9165c1118d3694fb2", "score": "0.5775707", "text": "function same (a, b) {\n return a === b || a !== a && b !== b\n}", "title": "" }, { "docid": "b2e3d193dae470d9165c1118d3694fb2", "score": "0.5775707", "text": "function same (a, b) {\n return a === b || a !== a && b !== b\n}", "title": "" }, { "docid": "781fe94a1d7cd2e73a3c2223ee4b9f82", "score": "0.5772724", "text": "function isEqual(a, b) {\n if (typeof a === 'function' && typeof b === 'function') {\n return true;\n }\n if (a instanceof Array && b instanceof Array) {\n if (a.length !== b.length) {\n return false;\n }\n for (var i = 0; i !== a.length; i++) {\n if (!isEqual(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n if (isObject(a) && isObject(b)) {\n if (Object.keys(a).length !== Object.keys(b).length) {\n return false;\n }\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = Object.keys(a)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var key = _step3.value;\n\n if (!isEqual(a[key], b[key])) {\n return false;\n }\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3['return']) {\n _iterator3['return']();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n\n return true;\n }\n return a === b;\n}", "title": "" }, { "docid": "781fe94a1d7cd2e73a3c2223ee4b9f82", "score": "0.5772724", "text": "function isEqual(a, b) {\n if (typeof a === 'function' && typeof b === 'function') {\n return true;\n }\n if (a instanceof Array && b instanceof Array) {\n if (a.length !== b.length) {\n return false;\n }\n for (var i = 0; i !== a.length; i++) {\n if (!isEqual(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n if (isObject(a) && isObject(b)) {\n if (Object.keys(a).length !== Object.keys(b).length) {\n return false;\n }\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = Object.keys(a)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var key = _step3.value;\n\n if (!isEqual(a[key], b[key])) {\n return false;\n }\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3['return']) {\n _iterator3['return']();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n\n return true;\n }\n return a === b;\n}", "title": "" }, { "docid": "97a6c8224970ac298beed54273c612bb", "score": "0.57496625", "text": "static cmp(a, b) {\n if (a.elems !== b.elems) return false;\n if (a.length !== b.length) return false;\n for (let k in a) {\n if (a[k] !== b[k]) return false;\n }\n\n return true;\n }", "title": "" }, { "docid": "80928feac603f1a6cbe9b06dd4c2794d", "score": "0.57403004", "text": "function compareEqualLengthArrays(a, b) {\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false\n }\n }\n return true\n }", "title": "" }, { "docid": "143aa4e7f53e025e54a3bb369a3530c5", "score": "0.57363385", "text": "containsDuplicates() {\n for (let i = 0; i < this.size; i++) {\n for (let j = 0; j < this.size; j++) {\n // two identical values appear at different positions in the array\n if (i !== j && this.data[i] === this.data[j]) {\n return true\n }\n }\n }\n return false\n }", "title": "" }, { "docid": "69dd969ac257fb731188e16b76544a94", "score": "0.5725874", "text": "function seqEqual(arr1, arr2) {\n if (arr1.length !== arr2.length) {\n return false;\n }\n for (let i = 0; i < arr1.length; i++) {\n if (arr1[i] !== arr2[i]) {\n return false;\n }\n }\n return true;\n}", "title": "" }, { "docid": "69dd969ac257fb731188e16b76544a94", "score": "0.5725874", "text": "function seqEqual(arr1, arr2) {\n if (arr1.length !== arr2.length) {\n return false;\n }\n for (let i = 0; i < arr1.length; i++) {\n if (arr1[i] !== arr2[i]) {\n return false;\n }\n }\n return true;\n}", "title": "" }, { "docid": "80dcb597486f134b3e6a5a92a06f8ab6", "score": "0.5703238", "text": "function same(arr1, arr2) {\n if (arr1.length !== arr2.length) {\n return false\n }\n debugger\n // [1, 2, 3]\n for (let i = 0; i < arr1.length; i++) /*?*/ {\n // [4, 1, 9]\n let numArr1 = arr1[i]\n for (let j = 0; j < arr2.length; j++) {\n if (numArr1 /*?*/ ** 2 === arr2[j]) {\n arr2.splice(j, 1)\n //?\n }\n }\n }\n arr1 //?\n arr2 //?\n return arr2.length === 0\n}", "title": "" }, { "docid": "042361501818b566c7a811e9c43acbe9", "score": "0.57002085", "text": "function deepUnorderedEquals(list1, list2) {\n // recursion base: not lists\n if (!Array.isArray(list1) ||\n !Array.isArray(list2))\n return list1 == list2;\n\n // Unequal length, trivially unequal\n if (list1.length != list2.length)\n return false;\n\n // Try to match up every element in list1 with a unique element in list2\n var found1 = [];\n var found2 = [];\n list1.forEach(function(e1, i1) {\n list2.forEach(function(e2, i2) {\n if (!found2[i2] && deepUnorderedEquals(e1, e2)) {\n found1[i1] = true;\n found2[i2] = true;\n }\n });\n });\n\n // Check that all elements in both lists are matched\n for (var i=0; i < list1.length; i++)\n if (!found1[i] || !found2[i])\n return false;\n\n return true;\n}", "title": "" }, { "docid": "67467ca601499cb88c235bd34b59f246", "score": "0.5696596", "text": "static eq(oldSets, newSets, from = 0, to) {\n if (to == null) to = 1000000000 /* C.Far */ - 1\n let a = oldSets.filter(\n (set) => !set.isEmpty && newSets.indexOf(set) < 0\n )\n let b = newSets.filter(\n (set) => !set.isEmpty && oldSets.indexOf(set) < 0\n )\n if (a.length != b.length) return false\n if (!a.length) return true\n let sharedChunks = findSharedChunks(a, b)\n let sideA = new SpanCursor(a, sharedChunks, 0).goto(from),\n sideB = new SpanCursor(b, sharedChunks, 0).goto(from)\n for (;;) {\n if (\n sideA.to != sideB.to ||\n !sameValues(sideA.active, sideB.active) ||\n (sideA.point && (!sideB.point || !sideA.point.eq(sideB.point)))\n )\n return false\n if (sideA.to > to) return true\n sideA.next()\n sideB.next()\n }\n }", "title": "" }, { "docid": "a280f7de8df9d74e3039cdd3fe532d63", "score": "0.5693971", "text": "function equal(a, b) {\n if (a.size !== b.size) {\n return false;\n }\n var it = a.values();\n while (true) {\n var _a = it.next(), value = _a.value, done = _a.done;\n if (done) {\n return true;\n }\n if (!b.has(value)) {\n return false;\n }\n }\n}", "title": "" }, { "docid": "0965f4ee99d2a47aeebe222d705ba4f4", "score": "0.5690278", "text": "function areEqual(a, b) {\n var same = true;\n $.each(a, function (i, _) {\n if (b[i] === undefined || a[i] !== b[i]) {\n same = false;\n return false;\n }\n });\n return same;\n }", "title": "" }, { "docid": "3398a1e6fee3aed8238245e8818911c9", "score": "0.568331", "text": "function areArraysEqual(a, b, isEqual, meta) {\n var index = a.length;\n if (b.length !== index) {\n return false;\n }\n while (index-- > 0) {\n if (!isEqual(a[index], b[index], meta)) {\n return false;\n }\n }\n return true;\n }", "title": "" }, { "docid": "91aaefcdd1b6c10cbda9f76ac3e700f5", "score": "0.5682317", "text": "function same(a, b) {\n return a === b || a !== a && b !== b;\n}", "title": "" }, { "docid": "91aaefcdd1b6c10cbda9f76ac3e700f5", "score": "0.5682317", "text": "function same(a, b) {\n return a === b || a !== a && b !== b;\n}", "title": "" }, { "docid": "91aaefcdd1b6c10cbda9f76ac3e700f5", "score": "0.5682317", "text": "function same(a, b) {\n return a === b || a !== a && b !== b;\n}", "title": "" }, { "docid": "427d051e971233b1045a1dd2d3136bb8", "score": "0.5675286", "text": "compareBoxRows(r1, r2, same) {\n for(let i = 0; i < (same ? BOX_SIZE - 1 : BOX_SIZE); i++) {\n if(r1[i] == EMPTY_VALUE) {\n continue;\n }\n \n for(let j = (same ? i + 1 : 0); j < BOX_SIZE; j++) {\n if(r2[j] == EMPTY_VALUE) {\n continue;\n }\n \n if (r1[i] == r2[j]) {\n return false;\n }\n }\n }\n \n return true;\n }", "title": "" }, { "docid": "261aff7ea85b0b882f217bfed6cfc573", "score": "0.5645293", "text": "function areArraysEqual(a, b, isEqual, meta) {\r\n var index = a.length;\r\n if (b.length !== index) {\r\n return false;\r\n }\r\n while (index-- > 0) {\r\n if (!isEqual(a[index], b[index], meta)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }", "title": "" }, { "docid": "99f11bc6ef0b8b25304655c9ad35975a", "score": "0.5644637", "text": "function isUniq(input) {\n for (let i = 0; i < input.length; i++) {\n for (let j = i + 1; j < input.length; j++) {\n if (input[i] === input[j]) {\n return false;\n }\n }\n }\n return true;\n}", "title": "" }, { "docid": "541e619f524e9ca793d1ef7b6da306b5", "score": "0.5643699", "text": "function shallowCompare(obj1, obj2) {\n\t\t\t\t\t\tfor (var attr in obj1) {\n\t\t\t\t\t\t\tif(obj1[attr] !== obj2[attr] && attr !== 'uniq' && attr !== 'generated') {\n\t\t\t\t\t\t\t\tif(attr === 'uniq') console.log(attr + \":\" + obj1[attr] + \":\" + obj2[attr]);\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}", "title": "" }, { "docid": "6e5c3b87a3359eb8dfa0733bdba6d09d", "score": "0.5643672", "text": "function equalArray(a, b) {\r\n if (a.length !== b.length) {\r\n return false;\r\n }\r\n for (let i = 0, len = a.length; i < len; i++) {\r\n if (a[i] != b[i]) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n}", "title": "" }, { "docid": "0ccdf2f72aea0599be45f6e57ecea4c1", "score": "0.5636195", "text": "function sameArray(arr1, arr2) {\n if ($(arr1).not(arr2).length === 0 && $(arr2).not(arr1).length === 0) {\n return true;\n }\n return false;\n }", "title": "" }, { "docid": "2f343129fb21e8f49d32cccdf89c8a46", "score": "0.5635096", "text": "function assertEqual( checksum1, checksum2 ) {\n if ( checksum1.length !== checksum2.length || checksum1.length !== 4 ) {\n return false;\n }\n for ( var i = 0; i < checksum1.length; ++i ) {\n if ( checksum1[ i ] !== checksum2[ i ] ) return false;\n }\n return true;\n }", "title": "" }, { "docid": "71c12284ebfb7fff92c17b3046012b7e", "score": "0.56337184", "text": "eq(other) { return this == other || eqContent(this, other); }", "title": "" }, { "docid": "71c12284ebfb7fff92c17b3046012b7e", "score": "0.56337184", "text": "eq(other) { return this == other || eqContent(this, other); }", "title": "" }, { "docid": "75b7e53a8f469284bff208d480fa1557", "score": "0.5633264", "text": "function areArraysEqual(a, b, isEqual, meta) {\r\n var index = a.length;\r\n if (b.length !== index) {\r\n return false;\r\n }\r\n while (index-- > 0) {\r\n if (!isEqual(a[index], b[index], meta)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n}", "title": "" }, { "docid": "a0bfa13c4131090690afa57643d7a053", "score": "0.5633058", "text": "function undirectedEdgeSetsAreEqual(a,b) {\r\n if (a.length != b.length) { return false; }\r\n\r\n for (var i = 0; i < a.length; i++) {\r\n var elementIsThere = false;\r\n\r\n for (var k = 0; k < b.length; k++) {\r\n if (flatArraysAreEqual(a[i], b[k])) { elementIsThere = true; } \r\n }\r\n\r\n if (!elementIsThere) { return false; }\r\n }\r\n\r\n return true;\r\n}", "title": "" }, { "docid": "c3abe4dd99e343f804925235aba25e5b", "score": "0.5632762", "text": "function areIdentical(input1, input2) {\n return input1 === input2 ;\n\n }", "title": "" }, { "docid": "6b15cd63a1e6fc02202c9dd9524c3bd3", "score": "0.5629921", "text": "function sameArray(arr1, arr2){\n //loop over arrays to see if they have the same ammount of characters\n if(arr1.length !== arr2.length) return;\n\n //create 2 objects to compare\n let objarr1 = {};\n let objarr2 = {};\n\n //add values to object counter\n for(let value of arr1){\n objarr1[value] = (objarr1[value] || 0) + 1;\n }\n\n for(let i of arr2){\n objarr2 = (objarr2[i] || 0) + 1;\n }\n\n //compare items in 2 objects\n for(let key in objarr1){\n if(!(key ** 2 in objarr2)) return false; // if\n if(objarr2[key ** 2] !== objarr1[1]) return false;\n }\n\n return true;\n}", "title": "" }, { "docid": "ed271c361a75afd2d511f23ff19f46c7", "score": "0.56249833", "text": "isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache;}", "title": "" }, { "docid": "e54ff250cf21ec94d270c131f7309382", "score": "0.5617776", "text": "function arraysEqual(a, b) {\n return $(a).not(b).length === 0 && $(b).not(a).length === 0;\n }", "title": "" }, { "docid": "8987ab4402e4855bd1f6b9e7723d3fe6", "score": "0.56143177", "text": "function equal (a, b) {\n if (a.length !== b.length) {\n return false\n }\n\n for (var i in a) {\n if (a[i] !== b[i]) {\n return false\n }\n }\n\n return true\n}", "title": "" }, { "docid": "c22f809d3b45e909c330accc8f73bdbb", "score": "0.5604459", "text": "function areSimilar(a, b) {\n let arr = [];\n \n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) arr.push(i);\n }\n \n return arr.length == 0 || arr.length == 2 && a[arr[0]] == b[arr[1]] && b[arr[0]] == a[arr[1]]; \n}", "title": "" }, { "docid": "ae24d0b619254191519fab246a9f0d2c", "score": "0.559566", "text": "function areEqual(a, b) {\n var same = true;\n $.each(a, function(i, _) {\n if (b[i] === undefined || a[i] !== b[i]) {\n same = false;\n return false;\n }\n });\n return same;\n }", "title": "" }, { "docid": "8585b6be9f29ec8aa35247377fb12e3e", "score": "0.55946434", "text": "function isSUbset(array1,array2){\n\n\n var count = 0 ;\n\n for (var i = 0 ; i <array2.length ; i++){\n\n for (var j = 0 ; j < array1.length ; j++){\n\n if ( array2[i] === array1[j]){\n \n array2.splice(i,1)\n array1.splice(j,1)\n j=0; \n i = 0 ; \n\n \n }\n\n }\n console.log (array2.length)\n if (array2.length === 0){\n\n return true\n\n }\n else{\n return false\n }\n \n }\n}", "title": "" } ]
f7de95e368c78ed12d57f32716e4dabf
reminder we set today's date to be UTCDate1 up in the weather stuff reminder because we're using UTCDate1, calendar stuff has to be called AFTER weather stuff!
[ { "docid": "0d060049c9d1fbcaf604c9f600d96b21", "score": "0.5787376", "text": "function setCalendar() {\n\t\tcalMonth.innerHTML = months[(UTCdate1.getMonth())];\n\t\tcalDay.innerHTML = UTCdate1.getDate();\n\t\tvar t = new Date();\n\t\tvar s = t.getSeconds();\n\t\tvar m = t.getMinutes();\n\t\tif (m < 10) {\n\t\t\tm = \"0\" + m;\n\t\t}\n\t\tif (t.getHours()>12) {\n\t\t\tvar ampm = \"pm\"\n\t\t\tcalAmPm.innerHTML = \"pm\" \n\t\t} else {\n\t\t\tvar ampm = \"am\"\n\t\t\tcalAmPm.innerHTML = \"am\"\n\t\t};\n\t\tif (ampm === \"pm\") {\n\t\t\tvar h = t.getHours() - 12 \n\t\t} else {\n\t\t\tvar h = t.getHours()\n\t\t};\n\t\t// var h = t.getHours();\n\t\t// calTime.textContent = h + \":\" + m + \":\" + s;\n\t\tcalHour.textContent = h;\n\t\tcalMin.textContent = m;\n\t\t// calTime.textContent = h + \":\" + m + ampm;\n\t}", "title": "" } ]
[ { "docid": "43ca570e9d64110937b5395085e97ed1", "score": "0.6472699", "text": "function dayReset(){\n //day/night times reset\n let noon = new Date()\n noon.setHours(12,0,0,0)\n noonToday = noon.getTime()\n\n let midnight = new Date()\n midnight.setHours(24,0,0,0)\n midnightToday = midnight.getTime()\n\n //sun times reset\n if(navigator.geolocation){\n navigator.geolocation.getCurrentPosition(position=>{\n const lat = position.coords.latitude\n const long = position.coords.longitude\n \n const key = '244c80ce16b21783f5b9730bd651493f'\n const apiUrl = `http://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${long}&cnt=10&appid=${key}`\n \n fetch(apiUrl).then(response=>{\n response.json().then(data=>{\n sunriseTime = data.sys.sunrise * 1000\n sunsetTime = data.sys.sunset * 1000\n let sunrise = new Date(sunriseTime)\n let sunset = new Date(sunsetTime)\n\n console.log(`Sunrise: ${sunrise}`)\n console.log(`Sunset: ${sunset}`)\n \n })\n })\n }, console.log)\n }\n}", "title": "" }, { "docid": "6404dcbaa18d06dfee562c38a913d48d", "score": "0.6289603", "text": "function changedate1() {\n endDate = new Date(currentDate.getTime() - 7 * 24 * 3600 * 1000);\n //endDate = DateToString(new Date(currentDate.getTime()-7*24*3600*1000)); //从系统时间开始算\n gap = 7;\n queryDataToCal();\n}", "title": "" }, { "docid": "98cc9bd99b3bebad5ca1e9f89e6700bd", "score": "0.62832385", "text": "function _resetCalandarDates()\n{\n if (!IS_FLEET && jsvLastEventYMD && (jsvLastEventEpoch > 0)) {\n if (mapCal_to) {\n var day = jsvLastEventYMD.DD + 1; // next day\n mapCal_to.setDate(jsvLastEventYMD.YYYY, jsvLastEventYMD.MM, day);\n }\n if (mapCal_fr) { \n var day = jsvLastEventYMD.DD; // this day\n mapCal_fr.setDate(jsvLastEventYMD.YYYY, jsvLastEventYMD.MM, day); \n }\n } else\n if (jsvTodayYMD) {\n if (mapCal_to) {\n var day = jsvTodayYMD.DD + 1; // next day\n //alert(\"_resetCalandarDates: YYYY=\"+jsvTodayYMD.YYYY+ \" MM=\"+jsvTodayYMD.MM+ \" DD=\"+day);\n mapCal_to.setDate(jsvTodayYMD.YYYY, jsvTodayYMD.MM, day);\n }\n if (mapCal_fr) { \n var day = jsvTodayYMD.DD; // this day\n mapCal_fr.setDate(jsvTodayYMD.YYYY, jsvTodayYMD.MM, day); \n }\n } else {\n // as a last resort, we could rely on the 'Date' returned by the browser\n // (which may be inaccurate), but for now just leave the calendars as-is.\n }\n}", "title": "" }, { "docid": "967c09d6e0a8f2f8aa5e756b9f605784", "score": "0.6245592", "text": "function setToday() {\n\n \n // SET GLOBAL DATE TO TODAY'S DATE\n calDate = new Date();\n\n // SET DAY MONTH AND YEAR TO TODAY'S DATE\n var month = calDate.getMonth();\n var year = calDate.getFullYear();\n\n // SET MONTH IN DROP-DOWN LIST\n tDoc.calControl.month.selectedIndex = month;\n\n // SET YEAR VALUE\n tDoc.calControl.year.value = year;\n\n\t// GENERATE THE CALENDAR SRC\n\tcalDocBottom = buildBottomCalFrame();\n\n // DISPLAY THE NEW CALENDAR\n writeCalendar(calDocBottom);\n}", "title": "" }, { "docid": "1803c3948638e84224629571445b53b4", "score": "0.6222175", "text": "function refreshCurrentDate() {\n\t\t\t\tdateCurrent = getDateInRange(dateCurrent, dateShadow, before, after);\n\t\t\t}", "title": "" }, { "docid": "8c5c27d32275fac8308624108f39d282", "score": "0.6213876", "text": "function checkDate() {\n $(\"#currentDay\").text(currentTime.format(\"dddd, MMMM Do\")); // Set current day\n\n // Check for new day\n // if (planData.date != currentTime.format(\"DDD\")) {\n // planData = {date: currentTime.format(\"DDD\")};\n // buildTimeBlocks();\n // update();\n // }\n /*\n This functionality is also commented out but written for the same reasons as the interval\n above.\n */\n }", "title": "" }, { "docid": "be99c396ec02e8cbc1f186fa022fff8c", "score": "0.61929864", "text": "function getWeatherInfo(url) {\n\n $.ajax({\n url: url,\n dataType: 'json',\n success: function(response) {\n var location = response.location;\n var forecastDay = response.forecastday.day;\n var forecastHour = response.forecastday.hour; \n $('.location').text(location.name + ', ' + location.country);\n \n //newFeed() toggle with current \n $('.avgtemp_c').html(Math.round(forecastDay.avgtemp_c) + '<a class=\"cel\"> ºC</a>');\n $('.avgtemp_f').html(Math.round(forecastDay.avgtemp_f) + '<a class=\"fah\"> ºF</a>');\n \n $('.day_icon').attr('src', forecastDay.condition.icon);\n// //for 24 hour ?\n// $('.hour_temp_c').html(Math.round(forecastHour.temp_c) + '<a class=\"cel\"> ºC</a>');\n// $('.hour_temp_f').html(Math.round(forecastHour.temp_f) + '<a class=\"fah\"> ºF</a>');\n \n \n// $('.hour_will_it_snow').html(forecastHour.will_it_snow + '<a class=\"\"> </a>');\n// $('.hour_will_it_rain').html(forecastHour.will_it_rain + '<a class=\"\"> </a>'); \n// var theConservationMonth = new Date();\n// theConservationMonth.setUTCMonth(7);\n// var today = new Date();\n// var tomorrow = today.getUTCMonth();\n \n// var theConservationDate = new Date();\n// theConservationDate.setUTCDate(15);\n// var today = new Date();\n// var tomorrow = today.getUTCDate() + 1;//if tommorrow is 15 august \n\nvar theConservationTime = new Date(); \ntheConservationTime.setUTCMonth(7) + ':' + setUTCDate(15);//???????????????????????????????\nvar today = new Date();\nvar tomorrowConservation = today.getUTCMonth() + ':' + today.getUTCDate() + 1;//if tommorrow is 15 august\n\nvar theSalaryDay = new Date();\ntheSalaryDay.setUTCDate(15);\nvar today = new Date();\nvar tomorrow = today.getUTCDate() + 1;//if tommorrow is 15\n\nvar isSnow = forecastHour.will_it_snow; \nvar isRain = forecastHour.will_it_rain; \nvar f = '';//Math.round(forecastDay.avgtemp_f);\nvar c = Math.round(forecastDay.avgtemp_c); \nvar nextButtonForecast = document.getElementById('next-button-forecast'); //toggle butt next-button \n \nvar userFeedForecast = new Instafeed({// http://instagram.pixelunion.net/ ORhttps://api.instagram.com/v1/users/self/media/liked?access_token=ACCESS-TOKEN \nget: 'user',\nuserId: '6909994807',\naccessToken: '6909994807.1677ed0.128066a7b9984d5392b0143cbde87360',\n//resolution:\"low_resolution\", \n template: '<a class=\"fancybox\" rel=\"instagram\" href=\"{{link}}\"target=\"_blank\"><img src=\"{{image}}\" /></a>',\n limit: 60,\n // every time we load more, run this function\n after: function() {\n // disable button if no more results to load\n if (!this.hasNext()) {\n nextButtonForecast.setAttribute('disabled', 'disabled');\n }\n\n },\n success: function() {\n foundImages = 0;\n maxImages = 60;\n },\n //window.setTimeout(function() {\n filter: function(image) {\n\n \n if(( f == '86') && (image.tags.indexOf('86') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if ((today == theConservationTime) && (image.tags.indexOf('id4wConsCucu') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( isSnow == '1') && (image.tags.indexOf('id4wSnow') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( isRain == '1') && (image.tags.indexOf('id4wRain') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n \n else if(( tomorrow == theSalaryDay ) && (image.tags.indexOf('id4wReNew') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n \n else if(( f == '85') && (image.tags.indexOf('85') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '84') && (image.tags.indexOf('84') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if(( f == '83') && (image.tags.indexOf('83') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '82') && (image.tags.indexOf('82') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if(( f == '81') && (image.tags.indexOf('81') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((f == '80') && (image.tags.indexOf('80') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '79') && (image.tags.indexOf('79') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '78') && (image.tags.indexOf('78') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((f == '77') && (image.tags.indexOf('77') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '6') && (image.tags.indexOf('76') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if(( f == '75') && (image.tags.indexOf('75') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '74') && (image.tags.indexOf('74') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if(( f == '73') && (image.tags.indexOf('73') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '72') && (image.tags.indexOf('72') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if(( f == '71') && (image.tags.indexOf('71') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '70') && (image.tags.indexOf('70') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '69') && (image.tags.indexOf('69') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '68') && (image.tags.indexOf('68') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((f == '67') && (image.tags.indexOf('67') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '66') && (image.tags.indexOf('66') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if(( f == '65') && (image.tags.indexOf('65') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '64') && (image.tags.indexOf('64') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if(( f == '63') && (image.tags.indexOf('63') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '62') && (image.tags.indexOf('62') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if(( f == '61') && (image.tags.indexOf('61') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '60') && (image.tags.indexOf('60') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '59') && (image.tags.indexOf('59') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '58') && (image.tags.indexOf('58') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((f == '57') && (image.tags.indexOf('57') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '56') && (image.tags.indexOf('56') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if(( f == '55') && (image.tags.indexOf('55') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '54') && (image.tags.indexOf('54') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if(( f == '53') && (image.tags.indexOf('53') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '52') && (image.tags.indexOf('52') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if(( f == '51') && (image.tags.indexOf('51') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '50') && (image.tags.indexOf('50') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '49') && (image.tags.indexOf('49') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '48') && (image.tags.indexOf('48') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((f == '47') && (image.tags.indexOf('47') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '46') && (image.tags.indexOf('46') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if(( f == '45') && (image.tags.indexOf('45') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '44') && (image.tags.indexOf('44') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if(( f == '43') && (image.tags.indexOf('43') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if(( f == '42') && (image.tags.indexOf('42') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if(( f == '41') && (image.tags.indexOf('41') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '40'|| f == '40') && (image.tags.indexOf('40') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '39'|| f == '39') && (image.tags.indexOf('39') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '38'|| f == '38') && (image.tags.indexOf('38') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((c == '37'|| f == '27') && (image.tags.indexOf('37') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '36'|| f == '36') && (image.tags.indexOf('36') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((c == '35'|| f == '35') && (image.tags.indexOf('35') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '34'|| f == '34') && (image.tags.indexOf('34') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((c == '33'|| f == '33') && (image.tags.indexOf('33') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '32'|| f == '32') && (image.tags.indexOf('32') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((c == '31'|| f == '31') && (image.tags.indexOf('31') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if ((c == '30'|| f == '30') && (image.tags.indexOf('30') >= 0 && foundImages < maxImages)) {//++++\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '29'|| f == '29') && (image.tags.indexOf('29') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '28'|| f == '28') && (image.tags.indexOf('28') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((c == '27'|| f == '27') && (image.tags.indexOf('27') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '26'|| f == '26') && (image.tags.indexOf('26') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((c == '25'|| f == '25') && (image.tags.indexOf('25') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '24'|| f == '24') && (image.tags.indexOf('24') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((c == '23'|| f == '23') && (image.tags.indexOf('23') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '22'|| f == '22') && (image.tags.indexOf('22') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((c == '21'|| f == '21') && (image.tags.indexOf('21') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '20'|| f == '20') && (image.tags.indexOf('20') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((c == '19'|| f == '19') && (image.tags.indexOf('19') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '18'|| f == '18') && (image.tags.indexOf('18') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((c == '17'|| f == '17') && (image.tags.indexOf('17') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '16'|| f == '16') && (image.tags.indexOf('16') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((c == '15'|| f == '15') && (image.tags.indexOf('15') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '14'|| f == '14') && (image.tags.indexOf('14') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((c == '13'|| f == '13') && (image.tags.indexOf('13') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '12'|| f == '12') && (image.tags.indexOf('12') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((c == '11'|| f == '11') && (image.tags.indexOf('11') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '10'|| f == '10') && (image.tags.indexOf('10') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((c == '9'|| f == '9') && (image.tags.indexOf('9') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '8'|| f == '8') && (image.tags.indexOf('8') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((c == '7'|| f == '7') && (image.tags.indexOf('7') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '6'|| f == '6') && (image.tags.indexOf('6') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((c == '5'|| f == '5') && (image.tags.indexOf('5') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '4'|| f == '4') && (image.tags.indexOf('4') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((c == '3'|| f == '3') && (image.tags.indexOf('3') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '2'|| f == '2') && (image.tags.indexOf('2') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n } \n else if((c == '1'|| f == '1') && (image.tags.indexOf('1') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '0'|| f == '0') && (image.tags.indexOf('0') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-1'|| f == '-1') && (image.tags.indexOf('01') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-2'|| f == '-2') && (image.tags.indexOf('02') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-3'|| f == '-3') && (image.tags.indexOf('03') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-4'|| f == '-4') && (image.tags.indexOf('04') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-5'|| f == '-5') && (image.tags.indexOf('05') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-6'|| f == '-6') && (image.tags.indexOf('06') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-7'|| f == '-7') && (image.tags.indexOf('07') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-8'|| f == '-8') && (image.tags.indexOf('08') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-9'|| f == '-9') && (image.tags.indexOf('09') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-10'|| f == '-10') && (image.tags.indexOf('010') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-11'|| f == '-11') && (image.tags.indexOf('011') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-12'|| f == '-12') && (image.tags.indexOf('012') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-13'|| f == '-13') && (image.tags.indexOf('013') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-14'|| f == '-14') && (image.tags.indexOf('014') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-15'|| f == '-15') && (image.tags.indexOf('015') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-16'|| f == '-16') && (image.tags.indexOf('016') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-17'|| f == '-17') && (image.tags.indexOf('017') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-18'|| f == '-18') && (image.tags.indexOf('018') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-19'|| f == '-19') && (image.tags.indexOf('019') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-20'|| f == '-20') && (image.tags.indexOf('020') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-21'|| f == '-21') && (image.tags.indexOf('021') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-22'|| f == '-22') && (image.tags.indexOf('022') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-23'|| f == '-23') && (image.tags.indexOf('023') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-24'|| f == '-24') && (image.tags.indexOf('024') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-25'|| f == '-25') && (image.tags.indexOf('025') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-26'|| f == '-26') && (image.tags.indexOf('026') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-27'|| f == '-27') && (image.tags.indexOf('027') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-28'|| f == '-28') && (image.tags.indexOf('028') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n else if((c == '-29'|| f == '-29') && (image.tags.indexOf('029') >= 0 && foundImages < maxImages)) {\n foundImages = foundImages + 1;\n return true;\n }\n \n return false;\n \n } //filter\n // }, 10000);\n\n}); \n // bind the load more button\n nextButtonForecast.addEventListener('click', function(event) {\n event.preventDefault();\n feed.next();\n });\n userFeedForecast.run(); \n \n\n\n \n // bind the load more button\n nextButton.addEventListener('click', function(event) {\n event.preventDefault();\n feed.next();\n });\n userFeed.run();\n\n\n\n }\n }).fail(function() {\n $('.border').append('<p>Error: Could not load weather data!</p>');\n });\n }", "title": "" }, { "docid": "9549f203d1de0486bfe9ca5b5acdc851", "score": "0.61491007", "text": "updateTodaysDate() {\n const currentView = this.currentView;\n let view;\n if (currentView === 'month') {\n view = this.monthView;\n }\n else if (currentView === 'year') {\n view = this.yearView;\n }\n else {\n view = this.multiYearView;\n }\n view._init();\n }", "title": "" }, { "docid": "e56d3c89ec304158ee91168b58035695", "score": "0.61485004", "text": "function setDate() \n{\n\tRMPApplication.debug(\"begin setDate\");\n\tc_debug(debug.dates_check, \"=> begin datesCheck\");\n\n // Retrieving local current date&time\n var today = new Date();\n var local_date = moment(today, \"DD/MM/YYYY HH:mm:ss\").format(\"DD/MM/YYYY HH:mm:ss\");\n id_date.setValue(local_date);\n\tc_debug(debug.dates_check, \"=> datesCheck: local_date = \", local_date);\n\n // we save UTC dates for ulterior use\n var utc_date = moment(today, \"DD/MM/YYYY HH:mm:ss\").utc().format(\"DD/MM/YYYY HH:mm:ss\");\n id_utc_date.setValue(utc_date);\n c_debug(debug.dates_check, \"=> datesCheck: utc_date = \", utc_date);\n\n\tRMPApplication.debug(\"end setDate\");\n}", "title": "" }, { "docid": "9c0fad908e35e043ddfc94f5d51deb39", "score": "0.6147663", "text": "function updateNow() {\r\n now = new Date();\r\n utcTime = new Date(now.getTime() + now.getTimezoneOffset() * 60000);\r\n // represents our local time in UTC\r\n}", "title": "" }, { "docid": "22fcbe2e5647a36bd6089d610b76aad9", "score": "0.61002314", "text": "refreshDateFromNow() {\n this.update({ dateFromNow: this._computeDateFromNow() });\n }", "title": "" }, { "docid": "8b55ca1c5b0a331b34752361b4db8455", "score": "0.6074193", "text": "updateTodaysDate() {\n const view = this.currentView === McCalendarView.Month ? this.monthView :\n (this.currentView === McCalendarView.Year ? this.yearView : this.multiYearView);\n view.ngAfterContentInit();\n }", "title": "" }, { "docid": "9bc02407ea0b17c57e478e9ef2ba4834", "score": "0.60590786", "text": "function updateDate(direction) {\n if (!(isBusyR || isBusyW)) {\n var currentDate = $('#daily_datepicker').datepicker( \"getDate\" );\n var newTime = currentDate.getTime();\n if (direction < 0) {\n //newTime -= 86400000;\n newTime -= 79200000; // 22 hours\n } else if (direction > 0) {\n //newTime += 86400000;\n newTime += 93600000; // 26 hours\n } else {\n newTime = today_start * 1000;\n }\n if (newTime >= (min_time * 1000) && newTime <= (max_time * 1000)) {\n currentDate.setTime(newTime);\n $('#daily_datepicker').datepicker(\"setDate\", currentDate);\n // Setting the date doesn't fire the onSelect, so repeat that code here.\n\n // Get the chosen start time, rounded to midnight plus the TV day start, in seconds.\n log_stuff(\"Simulated datepicker.onSelect(\" + new Date(newTime) + \")\");\n var chosen = get_tv_day_start(newTime / 1000, true);\n update_daily(chosen);\n }\n }\n }", "title": "" }, { "docid": "c3d318ee16b917962388f173b3e1d08f", "score": "0.60475487", "text": "function moveCalendarNow()\r\n{\r\n\td = new Date();\r\n\tdrawMainCalendar(d.valueOf());\r\n}", "title": "" }, { "docid": "d73e3822b1eb6fb1d0f049b883bb5382", "score": "0.603473", "text": "setToNow() {\n\t\tconst date = new Date();\n\t\tthis.setToDate(new Date());\n\t}", "title": "" }, { "docid": "ea1c5959c5f7c9f66998d6d0b9ea0385", "score": "0.5988412", "text": "function setDate() {\n var weatherDay = moment().format('(MM/DD/YYYY)');\n $(\"#todaydate\").text(weatherDay);\n var oneDay = moment().add(01, 'days').format('MM/DD/YYYY')\n $(\"#forecastdate\").text(oneDay);\n var twoDay = moment().add(02, 'days').format('MM/DD/YYYY')\n $(\"#forecastdate2\").text(twoDay);\n var threeDay = moment().add(03, 'days').format('MM/DD/YYYY')\n $(\"#forecastdate3\").text(threeDay);\n var fourDay = moment().add(04, 'days').format('MM/DD/YYYY')\n $(\"#forecastdate4\").text(fourDay);\n var fiveDay = moment().add(05, 'days').format('MM/DD/YYYY')\n $(\"#forecastdate5\").text(fiveDay);\n}", "title": "" }, { "docid": "061066c8da4ba8fe5e4f992acc31f79d", "score": "0.598058", "text": "setBeginCalendarToToday() {\n this.displayData.dateRange.dateBegin = moment().subtract(2, 'weeks').format('MM-DD-YYYY');\n }", "title": "" }, { "docid": "90e38e053d1555212111a9edbee49c0d", "score": "0.5949256", "text": "jumpToToday() {\n this.setBeginCalendarToToday();\n this.setEndCalendarToTomorrow();\n }", "title": "" }, { "docid": "94e14a688746a7129c86e194975e6373", "score": "0.59305686", "text": "function setSunTimes(whatDay) { // sets global sunrise/set times, returns html with same\n my.data.sunrisetoday = new Date(whatDay);\n my.data.sunsettoday = new Date(whatDay);\n\n var tomoro = new Date(whatDay);\n tomoro.setDate(tomoro.getDate() + 1); // add a day\n\n my.data.sunrise2moro = new Date(tomoro);\n\n findAndSetSuntimeOnDate(whatDay, true, my.data.sunrisetoday);\n findAndSetSuntimeOnDate(whatDay, false, my.data.sunsettoday);\n findAndSetSuntimeOnDate(tomoro, true, my.data.sunrise2moro);\n\n var mTodaySunrise = moment(my.data.sunrisetoday).format('dddd MMMM Do YYYY, h:mm a');\n var mTodaySunset = moment(my.data.sunsettoday).format('dddd MMMM Do YYYY, h:mm a');\n var mTomoroSunrise = moment(my.data.sunrise2moro).format('dddd MMMM Do YYYY, h:mm a');\n\n my.log(\"l\", 'SUNRISE:' + mTodaySunrise + ', SUNSET: ' + mTodaySunset + ', 2MORO:' + mTomoroSunrise);\n\n var output = 'sunrise:' + moment(my.data.sunrisetoday).format('h:mm a')+ ', sunset:' + moment(my.data.sunsettoday).format('h:mm a');\n output = '<i class=\"icon-certificate\"></i> ' + output;\n output = my.label(\"default\", output);\n\n return output;\n }", "title": "" }, { "docid": "e258f3ee1baee40c0b79379c793b0771", "score": "0.59293306", "text": "resetDate() {\r\n if(this.type != T.HOUR && this.value.day == -1) {\r\n var d = new Date();\r\n this.setDay(d.getDate(), d.getMonth()+1, d.getFullYear(), false);\r\n }\r\n }", "title": "" }, { "docid": "d2be071bac988422e3d9db22a59575d9", "score": "0.59235317", "text": "function futureDate(){\n date=aqDateTime.AddDays(TodayDate,1);\n formatedDate=aqConvert.DateTimeToFormatStr(Date,\"%m%d%Y\");\n futureDate=formatedDate\n }", "title": "" }, { "docid": "eb6241290acab4ae64d1775e1da26ea3", "score": "0.5872735", "text": "function utcnow() {\n console.log(\"Someone is calling com.myapp.date\");\n now = new Date();\n return now.toISOString();\n }", "title": "" }, { "docid": "0e96e3cc8ff65b72227045f2bb70b4f1", "score": "0.5850271", "text": "function updateCalendar () {\n displayDay();\n getCurrentHour();\n setTimeBlockTense();\n console.log(\"in updateCalendar function!\");\n console.log(\"----\");\n}", "title": "" }, { "docid": "21be58fb36713dcadf51eb9ff581cb94", "score": "0.58355594", "text": "function initializeDates() {\n let today = new Date();\n\n document.getElementById(\"today\").innerHTML = today.toDateString() + \" | 18° C\";\n let todayString = getFormattDate(today);\n pickupDate.defaultValue = todayString;\n dropoffDate.defaultValue = todayString;\n }", "title": "" }, { "docid": "e59abf164e308f2b8c2a7a4a3f96d768", "score": "0.5815536", "text": "function testAPODUpdateNeed() {\n let d = new Date();\n let curdate = d.getDate();\n if (curdate > localStorage.apodCallDate){\n updateAPODData();\n } else if (curdate === 1) {\n updateAPODData();\n }\n}", "title": "" }, { "docid": "411a78b723c361348ac7cb24dce4f597", "score": "0.5801437", "text": "function updateCalcUpdate(){\n var date1 = getRegularClockTime();\n\n\tset10BaseClockGeneral(date1);\n}", "title": "" }, { "docid": "8b4830a4e6a141cd1009dd6286cc57de", "score": "0.57984257", "text": "function updateCurrentDate() {\n let options = {\n weekday: \"long\"\n ,day: \"numeric\"\n ,month: \"long\"\n ,year: \"numeric\"\n ,hour: \"numeric\"\n ,minute: \"numeric\"\n };\n // return new Date();\n return new Date().toLocaleDateString(\"en-Us\", options)\n}", "title": "" }, { "docid": "25fa87f77c6b6b246e78f39ce73e63a1", "score": "0.5769189", "text": "setDate(now = new Date()) {\n let startDay = new Date(now.getFullYear(), now.getMonth(), 1).getDay() - 1;\n startDay = startDay < 0 ? 6 : startDay;\n\n this.date = {\n year: now.getFullYear(),\n month: now.getMonth(),\n day: now.getDate(),\n startDay: startDay,\n daysOfMonth: new Date(now.getFullYear(), now.getMonth()+1, 0).getDate()\n }\n }", "title": "" }, { "docid": "2e6383584c6a6cf1eff29fb651853786", "score": "0.56922466", "text": "function initHackMITCurrentEvents() {\n var refreshEvents = function() {\n //hours since the zero-date\n var time = ((+new Date) - ZERO_DATE)/(60*60*1000);\n loadEventsForTime(time);\n };\n setInterval(refreshEvents, INCR);\n refreshEvents();\n }", "title": "" }, { "docid": "a8b9b6f5160d43287da533d03fedd5a2", "score": "0.5659273", "text": "function goToDate(date) {\n getMinimonth().value = cal.dtz.dateTimeToJsDate(date);\n currentView().goToDay(date);\n}", "title": "" }, { "docid": "a172eea2aa7e201db8ef427508ca558e", "score": "0.5656669", "text": "function setDates(datePicked) {\n \"use strict\";\n if (datePicked) {\n today = new Date(datePicked);\n } else {\n today = new Date();\n }\n\n yesterday = new Date(today);\n yesterday.setDate(today.getDate() - 1);\n tomorrow = new Date(today);\n tomorrow.setDate(today.getDate() + 1);\n\n //Convert yesterday, today, and tomorrow in yy-mm-dd format\n yesterday = convertDateFormat(yesterday);\n today = convertDateFormat(today);\n tomorrow = convertDateFormat(tomorrow);\n\n\n getCalDataLocal();\n}", "title": "" }, { "docid": "227e6f1144d7f4bab70b1056557564d3", "score": "0.5644999", "text": "function setInitialDate() {\n \n // CREATE A NEW DATE OBJECT (WILL GENERALLY PARSE CORRECT DATE EXCEPT WHEN \".\" IS USED AS A DELIMITER)\n // (THIS ROUTINE DOES *NOT* CATCH ALL DATE FORMATS, IF YOU NEED TO PARSE A CUSTOM DATE FORMAT, DO IT HERE)\n calDate = new Date(inDate);\n\n // IF THE INCOMING DATE IS INVALID, USE THE CURRENT DATE\n if (isNaN(calDate) || inDate == \"\" || inDate == null) {\n\n // ADD CUSTOM DATE PARSING HERE\n // IF IT FAILS, SIMPLY CREATE A NEW DATE OBJECT WHICH DEFAULTS TO THE CURRENT DATE\n calDate = new Date();\n }\n\n // KEEP TRACK OF THE CURRENT DAY VALUE\n calDay = calDate.getDate();\n\n // SET DAY VALUE TO 1... TO AVOID JAVASCRIPT DATE CALCULATION ANOMALIES\n // (IF THE MONTH CHANGES TO FEB AND THE DAY IS 30, THE MONTH WOULD CHANGE TO MARCH\n // AND THE DAY WOULD CHANGE TO 2. SETTING THE DAY TO 1 WILL PREVENT THAT)\n calDate.setDate(1);\n}", "title": "" }, { "docid": "eafc3e4746600bdc67267abfa7eb6003", "score": "0.5639355", "text": "function AskForReminder()\n{\n\tif(confirm(\"Would you like to be reminded in 24 hours ?\\r\\n(Cancel to be reminded next week only)\"))\n\t{\n\t\tvar today = new Date();\n\t\ttoday = today.getTime();\t\t\n\t\tvar sixdays_ms = 6 * 24 * 60 * 60 * 1000;\n\t\tvar sda_ms = today - sixdays_ms;\t\t\n\t\tvar sixdaysago = new Date(sda_ms)\n\n\t\t//Since we check for updates after 7 days, just make it seem like the last check was 6 days ago.\n\t\tGM_setValue(gm_updateparam, String(sixdaysago));\n\t}\n\telse\n\t\tSkipWeeklyUpdateCheck();\n}", "title": "" }, { "docid": "b080259f5d085b6f7648fc9a4de80753", "score": "0.562912", "text": "metronomeUpdateDate()\n\t{\n\t\tthis.metronome.dateNow = Date.now()\n\t}", "title": "" }, { "docid": "4316e7ab9145ac46f4aa7ff8d973f46e", "score": "0.5623351", "text": "function AskForReminder()\r\n{\r\n\tif(confirm(\"Would you like to be reminded in 24 hours ?\\r\\n(Cancel to be reminded next week only)\"))\r\n\t{\r\n\t\tvar today = new Date();\r\n\t\ttoday = today.getTime();\t\t\r\n\t\tvar sixdays_ms = 6 * 24 * 60 * 60 * 1000;\r\n\t\tvar sda_ms = today - sixdays_ms;\t\t\r\n\t\tvar sixdaysago = new Date(sda_ms)\r\n\r\n\t\t//Since we check for updates after 7 days, just make it seem like the last check was 6 days ago.\r\n\t\tGM_setValue(gm_updateparam, String(sixdaysago));\r\n\t}\r\n\telse\r\n\t\tSkipWeeklyUpdateCheck();\r\n}", "title": "" }, { "docid": "bad821fa1d4caef445f9cef46a97a9bb", "score": "0.5620273", "text": "gotToDate(date) {\n\t\t\tthis.containerElement.fullCalendar(\"gotoDate\", new Date(date));\n\t\t}", "title": "" }, { "docid": "ef16cf69738298db72bcf16862b5ea6c", "score": "0.561448", "text": "_updateDatetime() {\n if (this._run !== undefined &&\n this._offset !== undefined)\n this.datetime = new Date(this._run.valueOf() + this._offset * 1000);\n }", "title": "" }, { "docid": "e0c724409d845cc73a768bfd9ad8d4c9", "score": "0.56090444", "text": "setTodayDate(date) {\n let todayDate = new Date(+date);\n this.setProperties({ value: todayDate }, true);\n super.todayButtonClick(null, todayDate, true);\n }", "title": "" }, { "docid": "112ecc3e80cf7bd82f497a068340b33f", "score": "0.5584675", "text": "function postReminder() {\n cron.schedule('13***', () => {\n communityCallReminder();\n }, {\n scheduled: true,\n timezone: \"America/New_York\"\n });\n}", "title": "" }, { "docid": "eaeb54a42642281ff9cf954be5aa90fd", "score": "0.55674636", "text": "function updateAllDateTimes() {\n\n\t\t// get date, times, tz\n\t\tconst chiTime = getTime(\"America/Chicago\");\n\t\tconst chiDate = getDate(\"America/Chicago\");\n\t\tconst nycTime = getTime(\"America/New_York\");\n\t\tconst nycDate = getDate(\"America/New_York\");\n\t\tconst amsTime = getTime(\"Europe/Amsterdam\");\n\t\tconst amsDate = getDate(\"Europe/Amsterdam\");\n\t\tconst sydTime = getTime(\"Australia/Sydney\");\n\t\tconst sydDate = getDate(\"Australia/Sydney\");\n\t\tconst chiTz = getTimeZoneDiff(\"Europe/Amsterdam\", \"America/Chicago\");\n\t\tconst nycTz = getTimeZoneDiff(\"Europe/Amsterdam\", \"America/New_York\");\n\t\tconst amsTz = getTimeZoneDiff(\"Europe/Amsterdam\", \"Europe/Amsterdam\");\n\t\tconst sydTz = getTimeZoneDiff(\"Australia/Sydney\", \"Europe/Amsterdam\");\n\n\t\t// update date and time elements\n\t\tupdateInnerHTML(\"chi-time\", chiTime);\n\t\tupdateInnerHTML(\"chi-date\", chiDate);\n\t\tupdateInnerHTML(\"chi-tz\", chiTz + \"hr\");\n\t\tupdateInnerHTML(\"nyc-time\", nycTime);\n\t\tupdateInnerHTML(\"nyc-date\", nycDate);\n\t\tupdateInnerHTML(\"nyc-tz\", nycTz + \"hr\");\n\t\tupdateInnerHTML(\"ams-time\", amsTime);\n\t\tupdateInnerHTML(\"ams-date\", amsDate);\n\t\tupdateInnerHTML(\"ams-tz\", amsTz + \"hr\");\n\t\tupdateInnerHTML(\"syd-time\", sydTime);\n\t\tupdateInnerHTML(\"syd-date\", sydDate);\n\t\tupdateInnerHTML(\"syd-tz\", sydTz + \"hr\");\n\t}", "title": "" }, { "docid": "ee06dae662350e21cd8b5d755f788c89", "score": "0.55620223", "text": "static setTaskDate() {\n const taskButton = this.parentNode.parentNode\n const projectName = document.getElementById('project-name').textContent\n const taskName = taskButton.children[0].children[1].textContent\n const newDueDate = format(new Date(this.value), 'dd/MM/yyyy')\n\n if (projectName === 'Today' || projectName === 'This week') {\n const mainProjectName = taskName.split('(')[1].split(')')[0]\n const mainTaskName = taskName.split(' (')[0]\n Storage.setTaskDate(projectName, taskName, newDueDate)\n Storage.setTaskDate(mainProjectName, mainTaskName, newDueDate)\n if (projectName === 'Today') {\n Storage.updateTodayProject()\n } else {\n Storage.updateWeekProject()\n }\n } else {\n Storage.setTaskDate(projectName, taskName, newDueDate)\n }\n UI.clearTasks()\n UI.loadTasks(projectName)\n UI.closeSetDateInput(taskButton)\n }", "title": "" }, { "docid": "847e4b0ff9a7f7cc486f2d0a4db76206", "score": "0.55473256", "text": "function populateHomePageShortCalEvents() {\n upcomingEvents.reverse();\n \n // Builds the array of Weekly Events that will later have the upcoming events pushed into it.\n // Setting the condition number (i <= 10) will change how many weekly events are added\n // to the cal. Special events will still display if they occur after this cut off.\n for (i = 0; i <= 14; i++) {\n\n var calEndDate = new Date();\n var weeklyCalEntry = calEndDate.setDate(calEndDate.getDate() + i);\n var weeklyCalEntryString = new Date(weeklyCalEntry);\n\n if (weeklyCalEntryString.getDay() === 1) {\n calWeeklyEventsList.push({'eventDate' : weeklyCalEntryString.toDateString(), 'eventName' : weeklyEvents[0].eventName, 'eventDesc' : '', 'eventImgWide' : weeklyEvents[0].eventImgWide, 'eventTime' : weeklyEvents[0].eventTime, 'eventLink' : weeklyEvents[0].eventLink});\n }\n /*\n else if (weeklyCalEntryString.getDay() === 4) {\n calWeeklyEventsList.push({'eventDate' : weeklyCalEntryString.toDateString(), 'eventName' : weeklyEvents[1].eventName, 'eventDesc' : weeklyEvents[1].eventDesc, 'eventImgWide' : weeklyEvents[1].eventImgWide, 'eventTime' : weeklyEvents[1].eventTime, 'eventLink' : weeklyEvents[1].eventLink});\n }\n */\n else if (weeklyCalEntryString.getDay() === 5) {\n calWeeklyEventsList.push({'eventDate' : weeklyCalEntryString.toDateString(), 'eventName' : weeklyEvents[2].eventName, 'eventDesc' : '', 'eventImgWide' : weeklyEvents[2].eventImgWide, 'eventTime' : weeklyEvents[2].eventTime, 'eventLink' : weeklyEvents[2].eventLink});\n }\n\n else if (weeklyCalEntryString.getDay() === 6) {\n calWeeklyEventsList.push({'eventDate' : weeklyCalEntryString.toDateString(), 'eventName' : weeklyEvents[3].eventName, 'eventDesc' : '', 'eventImgWide' : weeklyEvents[3].eventImgWide, 'eventTime' : weeklyEvents[3].eventTime, 'eventLink' : weeklyEvents[3].eventLink});\n }\n }\n\n // Adds upcoming events to the weekly events\n for (i = 0; i <= upcomingEvents.length - 1; i++) {\n calWeeklyEventsList.push(upcomingEvents[i]);\n }\n\n // Sorts the cal events\n calWeeklyEventsList.sort(function(a,b){var c = new Date(a.eventDate); var d = new Date(b.eventDate); return c-d;});\n\n // Pushes Cal events into the cal page\n function buildCal(a) {\n calendarEvents.innerHTML = a;\n }\n\n // Removes Weekly if a special event is set to overide\n for (i = 0; i <= calWeeklyEventsList.length - 1; i++) {\n \n // If a Special Event is set to Override, remove the previous weekly entry\n if (calWeeklyEventsList[i].eventWklOvrd === 1) {\n calWeeklyEventsList.splice(i-1, 1);\n }\n // Else, Do nothing\n else {\n\n }\n }\n\n // Fixes the Special Event Dates for the cal and builds the Event entry. Push to the buildCal function.\n var formatedDate;\n var formatedTime;\n \n for (i = 0; i <= calWeeklyEventsList.length - 1; i++) {\n\n if (calWeeklyEventsList[i].eventTix !== undefined) {\n \n if (calWeeklyEventsList[i].eventTix != 'none') {\n formatedDate = calWeeklyEventsList[i].eventDate.toDateString();\n formatedTime = calWeeklyEventsList[i].eventDate.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'}); \n\n buildCal(calendarEvents.innerHTML + '<div class=\"home-page-event-content col col-3-xs\"><h3><a href=\"' + calWeeklyEventsList[i].eventLink + '\"><span class=\"event-day\">' + formatedDate + ', ' + formatedTime + '</span><br><span class=\"event-name\">' + calWeeklyEventsList[i].eventArtist + '</span></a></h3><a href=\"' + calWeeklyEventsList[i].eventLink + '\"><img src=\"' + calWeeklyEventsList[i].eventImgWide + '\" alt=\"An event poster for ' + calWeeklyEventsList[i].eventArtist + ' performing at the Necto Nightclub in Ann Arbor, Michigan on ' + (calWeeklyEventsList[i].eventDate.getMonth() + 1) + '/' + calWeeklyEventsList[i].eventDate.getDate() + '/' + calWeeklyEventsList[i].eventDate.getFullYear() + '.\"></a><p>' + '</p><div class=\"row event-nav\"><a href=\"' + calWeeklyEventsList[i].eventLink + '\"class=\"col col-4-xs\">VIEW EVENT</a><a href=\"bottle-service-vip-reservations.html?=calpagelink\" class=\"col col-4-xs\">VIP</a><a href=\"' + calWeeklyEventsList[i].eventTix + '\" onclick=\"trackOutboundLink(' + \"'\" + calWeeklyEventsList[i].eventTix + \"'\" + '); return true;\" class=\"col col-4-xs \">TICKETS</a></div></div><br><br>');\n }\n\n else {\n formatedDate = calWeeklyEventsList[i].eventDate.toDateString();\n formatedTime = calWeeklyEventsList[i].eventDate.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});\n buildCal(calendarEvents.innerHTML + '<div class=\"home-page-event-content col col-3-xs\"><h3><a href=\"' + calWeeklyEventsList[i].eventLink + '\"><span class=\"event-day\">' + formatedDate + ', ' + formatedTime + '</span><br><span class=\"event-name\">' + calWeeklyEventsList[i].eventName + '</span></a></h3><a href=\"' + calWeeklyEventsList[i].eventLink + '\"><img src=\"' + calWeeklyEventsList[i].eventImgWide + '\" alt=\"An event poster for ' + calWeeklyEventsList[i].eventArtist + ' performing at the Necto Nightclub in Ann Arbor, Michigan on ' + (calWeeklyEventsList[i].eventDate.getMonth() + 1) + '/' + calWeeklyEventsList[i].eventDate.getDate() + '/' + calWeeklyEventsList[i].eventDate.getFullYear() + '.\"></a><p>' + '</p><div class=\"row event-nav\"><a href=\"' + calWeeklyEventsList[i].eventLink + '\"class=\"col col-6-xs\">VIEW EVENT</a><a href=\"bottle-service-vip-reservations.html?=calpagelink\" class=\"col col-6-xs \">VIP</a></div></div><br><br>');\n }\n }\n\n else {\n buildCal(calendarEvents.innerHTML + '<div class=\"home-page-event-content col col-3-xs\"><h3><a href=\"' + calWeeklyEventsList[i].eventLink + '\"><span class=\"event-day\">' + calWeeklyEventsList[i].eventDate + ', ' + calWeeklyEventsList[i].eventTime + '</span><br><span class=\"event-name\">' + calWeeklyEventsList[i].eventName + '</span></a></h3><a href=\"' + calWeeklyEventsList[i].eventLink + '\"><img src=\"' + calWeeklyEventsList[i].eventImgWide + '\" alt=\"A image of ' + calWeeklyEventsList[i].eventName + ', a weekly event at the Necto Nightclub in Ann Arbor, Michigan.\"></a><p>' + calWeeklyEventsList[i].eventDesc + '</p><div class=\"row event-nav\"><a href=\"' + calWeeklyEventsList[i].eventLink + '\"class=\"col col-6-xs\">VIEW EVENT</a><a href=\"bottle-service-vip-reservations.html?=calpagelink\" class=\"col col-6-xs \">VIP</a></div></div><br><br>');\n }\n }\n \n}", "title": "" }, { "docid": "cf515d3a96fbf343964b6d633333a3d9", "score": "0.5534731", "text": "get sunSet() {\n var nextSunSet ;\n var nextSunRise;\n\n if (this._config.time_format) {\n nextSunSet = new Date(this.hass.states[sunSensor].attributes.next_setting).toLocaleTimeString(this._config.locale,\n {hour: '2-digit', minute:'2-digit',hour12: this.is12Hour});\n nextSunRise = new Date(this.hass.states[sunSensor].attributes.next_rising).toLocaleTimeString(this._config.locale,\n {hour: '2-digit', minute:'2-digit', hour12: this.is12Hour});\n }\n else {\n nextSunSet = new Date(this.hass.states[sunSensor].attributes.next_setting).toLocaleTimeString(this._config.locale,\n {hour: '2-digit', minute:'2-digit'});\n nextSunRise = new Date(this.hass.states[sunSensor].attributes.next_rising).toLocaleTimeString(this._config.locale,\n {hour: '2-digit', minute:'2-digit'});\n }\n var nextDate = new Date();\n nextDate.setDate(nextDate.getDate() + 1);\n if (this.hass.states[sunSensor].state == \"above_horizon\" ) {\n nextSunRise = nextDate.toLocaleDateString(this._config.locale,{weekday: 'short'}) + \" \" + nextSunRise;\n return {\n 'next': html`<li><span class=\"ha-icon\"><ha-icon icon=\"mdi:weather-sunset-down\"></ha-icon></span><span id=\"sun-next-text\">${nextSunSet}</span></li>`,\n 'following': html`<li><span class=\"ha-icon\"><ha-icon icon=\"mdi:weather-sunset-up\"></ha-icon></span><span id=\"sun-following-text\">${nextSunRise}</span></li>`,\n 'nextText': nextSunSet,\n 'followingText': nextSunRise,\n };\n } else {\n if (new Date().getDate() != new Date(this.hass.states[sunSensor].attributes.next_rising).getDate()) {\n nextSunRise = nextDate.toLocaleDateString(this._config.locale,{weekday: 'short'}) + \" \" + nextSunRise;\n nextSunSet = nextDate.toLocaleDateString(this._config.locale,{weekday: 'short'}) + \" \" + nextSunSet;\n } \n return {\n 'next': html`<li><span class=\"ha-icon\"><ha-icon icon=\"mdi:weather-sunset-up\"></ha-icon></span><span id=\"sun-next-text\">${nextSunRise}</span></li>`,\n 'following': html`<li><span class=\"ha-icon\"><ha-icon icon=\"mdi:weather-sunset-down\"></ha-icon></span><span id=\"sun-following-text\">${nextSunSet}</span></li>`,\n 'nextText': nextSunRise,\n 'followingText': nextSunSet,\n };\n }\n }", "title": "" }, { "docid": "9c144f8fb6620ff7b5b2a00e92c7cc46", "score": "0.5534727", "text": "function fiveDay() {\n rightNow = new Date();// get current date\n let fiveDayUTC = new Array(5);\n sixPm = new Date(rightNow.setHours(18,0,0,0)); // forcast for tonight\n fiveDayUTC[0] = (rightNow.setHours(18,0,0,0));\n\n for (let i = 1; i < 6; i++) {\n fiveDayUTC[i] = (rightNow.setHours(18,0,0,0) + ((24 * 60 * 60 * 1000) * i)); \n }\n return fiveDayUTC;\n}", "title": "" }, { "docid": "e1234455ae651731b479f1958f087952", "score": "0.55299646", "text": "function getOnsetAsUTC(obs, localdate) {\n //return new Date(localdate.getTime() - obs.offsetFrom);\n return localdate - obs.offsetFrom;\n }", "title": "" }, { "docid": "7148967304441a46e6e8661eec7812f4", "score": "0.5529338", "text": "function getTomorrowDate(){\n date=aqDateTime.AddDays(TodayDate,1)\n formatedDate=aqConvert.DateTimeToFormatStr(date,\"%B %#d, %Y\")\n getTomorrowDate=formatedDate \n }", "title": "" }, { "docid": "adbef47e82bc489d6f246094d508a00d", "score": "0.55130553", "text": "handleSetToday(e) {\n e.preventDefault();\n const nowDate = new Date();\n const nowMonth = nowDate.getMonth()+1;\n const nowDay = nowDate.getDate();\n this.setState({\n month: nowMonth,\n day: nowDay,\n });\n this.handleFetchFact();\n }", "title": "" }, { "docid": "cfce9f6ed4d5592cf47e428348b7b458", "score": "0.550689", "text": "function setUTCISODay(dirtyDate, dirtyDay) {\n Object(_requiredArgs_index_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(2, arguments);\n var day = Object(_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(dirtyDay);\n\n if (day % 7 === 0) {\n day = day - 7;\n }\n\n var weekStartsOn = 1;\n var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(dirtyDate);\n var currentDay = date.getUTCDay();\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n }", "title": "" }, { "docid": "60ea21db0cca3e9bc2f1fbe2935bf8e3", "score": "0.5503961", "text": "function set_by_date() {\r\n $('#countdown_dashboard').stopCountDown();\r\n $('#countdown_dashboard').setCountDown({\r\n targetDate: {\r\n 'day': 2,\r\n 'month': 4,\r\n 'year': 2014,\r\n 'hour': 0,\r\n 'min': 0,\r\n 'sec': 0\r\n }\r\n });\r\n $('#countdown_dashboard').startCountDown();\r\n}", "title": "" }, { "docid": "aa3f5aa0ace1929509b17cc25395b55f", "score": "0.5498861", "text": "async function setTodaysDate(i) {\n var today = new Date();\n var dd = today.getDate();\n var mm = today.getMonth()+1; //0 indexed\n var yyyy = today.getFullYear();\n if(dd<10) {\n dd = '0'+dd\n } \n if(mm<10) {\n mm = '0'+mm\n } \n var lastVisitedDate = dd + '/' + mm + '/' + yyyy;\n setData('P'+i,lastVisitedDate);\n}", "title": "" }, { "docid": "5bea9adb9b71f2fdb4e28d79e6b43aee", "score": "0.5498711", "text": "function markPresent(){\n\t\twindow.markDate = new Date();\n \t\tupdateClock();\n}", "title": "" }, { "docid": "e853dc5ed1332740c358192ccc9ada40", "score": "0.5495722", "text": "function findFutureDate (socratesObjTwo) {\n var socratesDate = socratesObjTwo[row][4].split(' '); // Date/time is on the second line 5th column\n var socratesTime = socratesDate[3].split(':'); // Split time from date for easier management\n\n var sYear = parseInt(socratesDate[0]); // UTC Year\n var sMon = MMMtoInt(socratesDate[1]); // UTC Month in MMM prior to converting\n var sDay = parseInt(socratesDate[2]); // UTC Day\n var sHour = parseInt(socratesTime[0]); // UTC Hour\n var sMin = parseInt(socratesTime[1]); // UTC Min\n var sSec = parseInt(socratesTime[2]); // UTC Sec - This is a decimal, but when we convert to int we drop those\n\n function MMMtoInt (month) {\n switch (month) {\n case 'Jan':\n return 0;\n case 'Feb':\n return 1;\n case 'Mar':\n return 2;\n case 'Apr':\n return 3;\n case 'May':\n return 4;\n case 'Jun':\n return 5;\n case 'Jul':\n return 6;\n case 'Aug':\n return 7;\n case 'Sep':\n return 8;\n case 'Oct':\n return 9;\n case 'Nov':\n return 10;\n case 'Dec':\n return 11;\n }\n } // Convert MMM format to an int for Date() constructor\n\n var selectedDate = new Date(sYear, sMon, sDay, sHour, sMin, sSec); // New Date object of the future collision\n // Date object defaults to local time.\n selectedDate.setUTCDate(sDay); // Move to UTC day.\n selectedDate.setUTCHours(sHour); // Move to UTC Hour\n\n var today = new Date(); // Need to know today for offset calculation\n timeManager.propOffset = selectedDate - today; // Find the offset from today\n camSnapMode = false;\n satCruncher.postMessage({ // Tell satCruncher we have changed times for orbit calculations\n typ: 'offset',\n dat: (timeManager.propOffset).toString() + ' ' + (1.0).toString()\n });\n timeManager.propRealTime = Date.now(); // Reset realtime TODO: This might not be necessary...\n timeManager.propTime();\n }", "title": "" }, { "docid": "874473679d76c156e09af7839b782064", "score": "0.54910666", "text": "function setDate() {\n var date = new Date()\n var today = (date.getMonth() + 1) + '/' + date.getDay() + '/' + date.getFullYear();\n $('#date').html(today);\n}", "title": "" }, { "docid": "f3efeaf2cf5f12b50f9b9c50a3ae978a", "score": "0.54716414", "text": "function defaultDates() {\n\tvar from = new Date();\n\t//from = from.addDays(frmOffset);\n\t//from.setHours(0, 0, 0, 0);\n\treturn from;\n}", "title": "" }, { "docid": "75253f8d88a68cdeb1e7f10daf613c1d", "score": "0.54699343", "text": "async resetDates() {\n\t\tconst today = new Date(); // Get current date in Unix time format\n\t\t// Store current used data memory\n\t\tconst previousDates = {\n\t\t\t// day: actualDate.day,\n\t\t\tweek: actualDate.week,\n\t\t\tmonth: actualDate.month,\n\t\t\tquarter: actualDate.quarter,\n\t\t\tyear: actualDate.year\n\t\t};\n\n\t\t// actualDate.Day = weekdays[today.getDay()];\n\t\tactualDate.week = await this.getWeekNumber(new Date());\n\t\tactualDate.month = months[today.getMonth()];\n\t\tactualDate.quarter = Math.floor((today.getMonth() + 3) / 3);\n\t\tactualDate.year = (new Date().getFullYear());\n\n\t\treturn previousDates;\n\t}", "title": "" }, { "docid": "1ff06c12a692d5ff0bd13a0e42affb98", "score": "0.5464257", "text": "function _initialiseDate() {\r\n _date = new Date();\r\n }", "title": "" }, { "docid": "8b965f1b7349d1aa53b93737e1daa9a4", "score": "0.546412", "text": "function buildToday(squid){\n todayCast.empty();\n todayCast.attr(\"class\",\"mt-3 bg-light border rounded p-2\")\n //city name, \n let cityName = $(\"<p><strong>City Name:</strong> \"+ squid.name + \"</p>\")\n console.log(squid.name);\n todayCast.append(cityName)\n //the date, \n const event = new Date(squid.dt*1000);\n console.log(squid.dt*1000)\n let todayDate = $(\"<p><strong>Today's Date:</strong> \"+ event.toDateString() + \"</p>\")\n todayCast.append(todayDate)\n //an icon representation of weather conditions, \n let currentConditions = $(\"<p><strong>Sky Condition:</strong> \"+ squid.weather[0].description +\"</p>\")\n let weatherIcon = $(\"<img>\")\n weatherIcon.attr(\"src\", \n \"http://openweathermap.org/img/wn/\" + squid.weather[0].icon + \"@2x.png\"\n )\n currentConditions.append(weatherIcon)\n todayCast.append(currentConditions)\n //the temperature, \n let currentTemp = squid.main.temp;\n currentTemp = (currentTemp - 273.15) * 1.80 + 32;\n let tempDisplay = $(\"<p><strong>Temperature:</strong> \"+ currentTemp.toFixed(2) + \"°F</p>\")\n todayCast.append(tempDisplay);\n //the humidity, \n let currentHumidity = $(\"<p><strong>Humidity:</strong> \"+ squid.main.humidity +\"%</p>\")\n todayCast.append(currentHumidity);\n //the wind speed,\n let windSpeed = $(\"<p><strong>Wind Speed:</strong> \"+ (squid.wind.speed * 2.237).toFixed(2) +\"mph</p>\")\n todayCast.append(windSpeed);\n //and the UV index\n //squid.coord.lat + squid.coord.lon into ajax url\n var onecallURL = \"https://api.openweathermap.org/data/2.5/onecall?lat=\"+ squid.coord.lat + \"&lon=\" + squid.coord.lon + \"&exclude=alerts&appid=\" + myKey;\n $.ajax({\n url: onecallURL,\n method: \"GET\"\n }).then(function(response) {\n console.log(response);\n let currentUV = $(\"<span>\" + response.current.uvi +\"</span>\")\n //UV index is displayed in color coded field\n //favorable, \n if (parseInt(response.current.uvi) < 3){\n currentUV.attr(\"class\", \"bg-success border rounded col-2\")\n\n //moderate,\n }else if(parseInt(response.current.uvi) < 8){\n currentUV.attr(\"class\", \"bg-warning border rounded col-2\")\n //or severe\n }else{\n currentUV.attr(\"class\", \"bg-danger border rounded col-2\")\n }\n\n ultraViolet = $(\"<p><strong>UV Index: </strong></p>\")\n ultraViolet.append(currentUV)\n todayCast.append(ultraViolet)\n\n //populate fiveCast w/ information \n fiveCast.empty();\n let fiveDay = $(\"<div>\")\n fiveDay.attr(\"class\", \"row\")\n fiveCast.append(fiveDay);\n predictFuture(response.daily);\n \n\n\n\n\n \n });\n\n}", "title": "" }, { "docid": "9f7814860138477a8df6389071f593e6", "score": "0.5459177", "text": "function trackMapGotoLastEventDate()\n{\n _resetCalandarDates();\n trackMapClickedUpdateAll();\n}", "title": "" }, { "docid": "e3eac337ea03b15b44f7d0420cbfef27", "score": "0.54539394", "text": "function displayTomorrowDate() {\n const today = new Date();\n today.setDate(today.getDate() + 1);\n return today.toLocaleDateString(\"en-GB\");\n}", "title": "" }, { "docid": "e075d4ad1fb884a0024f6c8f6bf3e429", "score": "0.5449245", "text": "function setUTCISODay(dirtyDate, dirtyDay) {\n Object(_requiredArgs_index_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(2, arguments);\n var day = Object(_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(dirtyDay);\n\n if (day % 7 === 0) {\n day = day - 7;\n }\n\n var weekStartsOn = 1;\n var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(dirtyDate);\n var currentDay = date.getUTCDay();\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n }", "title": "" }, { "docid": "b9ef3553a843dde9cbdd22798a3748b4", "score": "0.5443989", "text": "function populateCurrentDate() {\n\n function twoDigit(n) { return (n < 10 ? '0' : '') + n; };\n\n let today = new Date();\n let todayFormatted = '' + today.getFullYear() + '-' + twoDigit(today.getMonth() + 1) + '-' + twoDigit(today.getDate());\n return todayFormatted;\n}", "title": "" }, { "docid": "d845961671da57dfb92856afcdc1a57c", "score": "0.5427242", "text": "function today(){\n currentDate=aqConvert.DateTimeToFormatStr(TodayDate,\"%m%d%Y\")\n today=currentDate\n }", "title": "" }, { "docid": "ad5fa768797d3ec2f0476b1a07994a7c", "score": "0.5399735", "text": "changeDate () {\n const {isToday} = this.state\n const {actions} = this.props\n\n if (isToday) {\n const date = this.getYesterday()\n actions.getGameGeneral(date[0], date[1], date[2])\n this.setState({\n date,\n isToday: false\n })\n } else {\n const date = this.getToday()\n actions.getGameGeneral(date[0], date[1], date[2])\n this.setState({\n date,\n isToday: true\n })\n }\n }", "title": "" }, { "docid": "5a95216ff61fdb39371a4e4db12880cf", "score": "0.5398056", "text": "function setRefDates(firstModel)\n\t{\n\t\tvar re = /^(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})/;\n\t\t\tvar servertime = firstModel.get('servertime') || new Date();\n\t\t\tvar todayStr = servertime.toString();\n\t\tvar match = todayStr.match(re);\n\t\tvar today = new Date();\n\t\tvar offsetMs = today.getTimezoneOffset() * 60 * 1000;\n\t\t\tif (match) {\n\t\ttoday.setFullYear(match[1]);\n\t\ttoday.setMonth(match[2]-1);\n\t\ttoday.setDate(match[3]);\n\t\ttoday.setHours(match[4]);\n\t\ttoday.setMinutes(match[5]);\n\t\ttoday.setSeconds(match[6]);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t\ttoday.setFullYear(servertime.getFullYear());\n\t\t\t\t\ttoday.setMonth(servertime.getMonth());\n\t\t\t\t\ttoday.setDate(servertime.getDate());\n\t\t\t\t\ttoday.setHours(servertime.getHours());\n\t\t\t\t\ttoday.setMinutes(servertime.getMinutes());\n\t\t\t\t\ttoday.setSeconds(servertime.getSeconds());\n\t\t\t}\n\n\t\ttodayMs = Date.parse(today.toString());\t// Server time (GMT) in milliseconds (since 1980 or somesuch).\n\t\ttodayMs -= offsetMs;\t\t\t\t\t// DG: Convert to local time, since that is what we compare against.\n\n\t\tcurrentCutoff = todayMs + daysMs(FILTER_CURRENT_DAYS);\n\t\tgradedCutoff = todayMs - daysMs(FILTER_GRADED_DAYS);\n\t}", "title": "" }, { "docid": "93f9b7834b07d4f983f1d50c837c7492", "score": "0.5395901", "text": "function updateTimeAndDateOfToday() {\n \n const date = new Date();\n\n let hours = date.getHours();\n let minutes = date.getMinutes();\n\n hours = formateTimeCounter(hours); \n minutes = formateTimeCounter(minutes); \n\n const timeHolder = document.getElementById('todays-time');\n timeHolder.innerHTML = hours + ':' + minutes;\n\n //update weekday\n const weekdayHolder = document.getElementById('weekday')\n weekdayHolder.innerHTML = getWeekday(date);\n\n //Update month\n const monthHolder = document.getElementById('month'); \n monthHolder.innerHTML = getMonth(date);\n}", "title": "" }, { "docid": "4bc9f18bdec06343e0450b5c587781a7", "score": "0.53777874", "text": "function createDate() {\n theDate = new Date();\n }", "title": "" }, { "docid": "8bf29da0476fdd662d4898a8f15fbec7", "score": "0.5372391", "text": "function setupCalendar() {\n const calTarget = document.getElementById('calendar');\n\n //get today code stolen from stackoverflow\n // var today = new Date();\n let thisDate = new Date(\n currentMonth.substring(3) +\n '-' +\n currentMonth.substring(0, 2) +\n '-03T00:00:00.000-07:00'\n );\n //thisDate = new Date('2021-05-23');\n console.log(currentMonth.substring(0, 2));\n console.log(thisDate);\n\n //var curr_day_number = today.getDate();\n let currMonthNumber = thisDate.getMonth();\n let currYearNumber = thisDate.getFullYear();\n\n let month_first_dow = firstDow(currMonthNumber, currYearNumber);\n\n //month title on top\n //wrapper\n let month_header = document.createElement('div');\n month_header.classList.add('month_header');\n //text\n let month_label = document.createElement('p');\n month_label.classList.add('month_label');\n month_label.innerText = months[currMonthNumber];\n month_header.appendChild(month_label);\n calTarget.appendChild(month_header);\n\n //top bar of weekday names\n let weekdays_label = document.createElement('ul');\n weekdays_label.classList.add('weekdays_label');\n for (let i = 0; i < weekdays.length; i++) {\n let weekday = document.createElement('li');\n weekday.innerText = weekdays[i];\n weekday.classList.add('weekday');\n weekdays_label.appendChild(weekday);\n }\n calTarget.appendChild(weekdays_label);\n\n //all the little days\n let days_field = document.createElement('ul');\n days_field.classList.add('days_field');\n let endDay = daysInMonth(currMonthNumber + 1, currYearNumber);\n console.log('Current month has ' + endDay + ' days');\n //fake days for padding\n //empty tiles for paddding\n for (let i = 0; i < month_first_dow; i++) {\n let blank_day = document.createElement('li');\n blank_day.classList.add('day');\n blank_day.classList.add('blank_day');\n blank_day.innerText = '';\n days_field.appendChild(blank_day);\n }\n\n //real days\n for (let i = 1; i <= endDay; i++) {\n let day = document.createElement('li');\n day.classList.add('day');\n day.innerText = i;\n\n //check if today (so we can highlight it)\n // if (i == curr_day_number) {\n // day.classList.add('today');\n // }\n\n // check if today so we can highlight it\n let today = new Date();\n let currDay = today.getDate();\n let currMonth = today.getMonth();\n let currYear = today.getFullYear();\n\n if (\n i == dayNumber(currDay) &&\n currMonth == currMonthNumber &&\n currYear == currYearNumber\n ) {\n day.classList.add('today');\n }\n\n days_field.appendChild(day);\n\n //link to daily overview\n day.addEventListener('click', () => {\n window.location.href =\n day_OV_link +\n '#' +\n monthNumber(currMonthNumber) +\n '/' +\n //convert day number into a string\n dayNumber(i) +\n '/' +\n currYearNumber;\n });\n }\n\n //pad with more fake days at the end\n let monthLastDow = lastDow(currMonthNumber, currYearNumber);\n for (let i = monthLastDow; i < 6; i++) {\n let blank_day = document.createElement('li');\n blank_day.classList.add('day');\n blank_day.classList.add('blank_day');\n blank_day.innerText = '';\n days_field.appendChild(blank_day);\n }\n\n calTarget.append(days_field);\n}", "title": "" }, { "docid": "e8c76e06a140f456ec7e625df8607b39", "score": "0.53716546", "text": "function currentDate() {\n const now = new Date();\n const hours = now.getHours();\n let timeOfDay\n \n //Deterrmine what hour of day and apply appropriate greeting\n if(hours < 12) {\n timeOfDay = \"Good morning. Have a lovely day ahead\";\n } else if (hours >= 12 && hours < 17) {\n timeOfDay = \"Good afternoon. How is your day going?\";\n } else {\n timeOfDay = \"Good evening. Hope you had a great day today\";\n }\n \n const optionsDate = {\n year: 'numeric', month: 'long', weekday: 'long', day: 'numeric'\n };\n const optionsTime = {\n hour: 'numeric', minute: 'numeric', hour12: true\n };\n const datePart = new Intl.DateTimeFormat('en-US', optionsDate).format(now);\n const timePart = new Intl.DateTimeFormat('en-US', optionsTime).format(now);\n\n setDate.textContent = datePart;\n setTime.textContent = timePart;\n setGreeting.textContent = timeOfDay;\n}", "title": "" }, { "docid": "0b56ea4c375a2df6178cbcd88082959b", "score": "0.536661", "text": "setEndCalendarToTomorrow() {\n this.displayData.dateRange.dateEnd = moment().add(1, 'days').format('MM-DD-YYYY');\n }", "title": "" }, { "docid": "31de09fc9f3dd6bf2524d285c8898859", "score": "0.53651124", "text": "updateAccordingToDate(dateInput){\n // alert('in updateaccordingtodate');\n this.satDate = dateInput;\n this.updateActiveSat(getFlightPathPoints(1,dateInput)[0])\n //this.updateOtherMarkerAccordingToDate(dateInput)\n }", "title": "" }, { "docid": "92523eacb5240fb9aa485805688430dc", "score": "0.53622496", "text": "function update_current_date_section(obj){\r\n\t\t\tobj.find('.evodv_current_day .evodv_events span').html(current_events).parent().show();\r\n\t\t\tobj.find('.evodv_current_day .evodv_daynum b').html(current_date);\r\n\t\t\tobj.find('.evodv_current_day .evodv_dayname').html(current_day);\r\n\t\t}", "title": "" }, { "docid": "2343ff4f70dd8bb175dd50ab621253fd", "score": "0.53597987", "text": "function inis_events_addDateInfo() {\n\n\t\t\t// Get the current Date\n\t\t\t// ---------------------------\n\t\t\t// -- used to determine if the [event] has passed\n\n\t\t\t\tlet current_date = new Date();\n\n\t\t\t\tlet current_day = current_date.getDate();\n\t\t\t\tlet current_month = current_date.getMonth();\n\t\t\t\tlet current_year = current_date.getFullYear();\n\n\t\t\t\tlet current_timeIndex = current_date.getTime();\n\n\t\t\t// Call the [eventsData__run()] for [events] and [online]\n\t\t\t// ---------------------------\n\n\t\t\t\tinis_data.events.map(event__obj => inis_events_addDateInfo_run(event__obj) );\n\t\t\t\tinis_data.online.map(event__obj => inis_events_addDateInfo_run(event__obj) );\n\n\t\t\t// inis_events_addDateInfo_run()\n\t\t\t// ---------------------------\n\n\t\t\t\tfunction inis_events_addDateInfo_run(event__obj) {\n\n\t\t\t\t\t// Create Date format\n\t\t\t\t\t// ---------------------------\n\n\t\t\t\t\t\tevent__obj.date_start = new Date(event__obj.date_start);\n\t\t\t\t\t\tevent__obj.date_end = new Date(event__obj.date_end);\n\t\t\t\t\t\tlet date_start = event__obj.date_start;\n\t\t\t\t\t\tlet date_end = event__obj.date_end ;\n\n\t\t\t\t\t// Store Date details as string \n\t\t\t\t\t// ---------------------------\n\n\t\t\t\t\t\tevent__obj.dateDetails = {};\n\n\t\t\t\t\t// Day Name & abbreviation\n\t\t\t\t\t// ---------------------------\n\n\t\t\t\t\t\tlet dayName = date_getDayName(date_start); \n\t\t\t\t\t\tevent__obj.dateDetails.dayName = dayName;\n\t\t\t\t\t\tevent__obj.dateDetails.dayName_abbr = dayName.slice(0, 3);\n\n\t\t\t\t\t// Month Name & abbreviation\n\t\t\t\t\t// ---------------------------\n\n\t\t\t\t\t\tlet monthName = date_getMonthName(date_start); \n\t\t\t\t\t\tevent__obj.dateDetails.monthName = monthName;\n\t\t\t\t\t\tevent__obj.dateDetails.monthName_abbr = monthName.slice(0, 3);\n\n\t\t\t\t\t// Start Time\n\t\t\t\t\t// ---------------------------\n\n\t\t\t\t\t\tlet start_minutes = date_start.getMinutes(); if (start_minutes < 10) { start_minutes = '0'+ start_minutes };\n\t\t\t\t\t\tlet start_hour = date_start.getHours() ; if (start_hour < 10) { start_hour = '0'+ start_hour };\n\n\t\t\t\t\t\tlet time_start = `${start_hour}:${start_minutes}`;\n\t\t\t\t\t\tevent__obj.dateDetails.time_start = time_start; \n\n\t\t\t\t\t// End Time\n\t\t\t\t\t// ---------------------------\n\n\t\t\t\t\t\tlet end_minutes = date_end.getMinutes(); if (end_minutes < 10) { end_minutes = '0'+ end_minutes };\n\t\t\t\t\t\tlet end_hour = date_end.getHours() ; if (end_hour < 10) { end_hour = '0'+ end_hour };\n\n\t\t\t\t\t\tlet time_end = `${end_hour}:${end_minutes}`;\n\t\t\t\t\t\tevent__obj.dateDetails.time_end = time_end; \n\n\t\t\t\t\t// Full Time\n\t\t\t\t\t// ---------------------------\n\n\t\t\t\t\t\tevent__obj.dateDetails.time = `${time_start} - ${time_end}`;\n\n\t\t\t\t\t// hasPassed\n\t\t\t\t\t// ---------------------------\n\n\t\t\t\t\t\tevent__obj.hasPassed = (date_end.getTime() > current_timeIndex) ? false : true;\n\n\t\t\t\t\t// Remove extra spacing from [Description] String\n\t\t\t\t\t// ---------------------------\n\n\t\t\t\t\t\tevent__obj.description = event__obj.description.replace(/\\n|\\t| /g, '');\n\t\t\t\t};\n\n\t\t\t// Intermediary Functions\n\t\t\t// ---------------------------\n\n\t\t\t\tfunction date_getDayName(date , returnAbbreviation__boolean) {\n\t\t\t\t\tlet dayName = [ 'Sunday' , 'Monday' , 'Tuesday' , 'Wednesday' , 'Thursday' , 'Friday' , 'Saturday' ][date.getDay()]\n\t\t\t\t\treturn ( returnAbbreviation__boolean ? dayName.slice(0, 3) : dayName )\n\t\t\t\t};\n\t\t\t\tfunction date_getMonthName(date , returnAbbreviation__boolean) {\n\t\t\t\t\tlet monthName = [ 'January' , 'February' , 'March' , 'April' , 'May' , 'June' , \n\t\t\t\t\t\t\t\t\t 'July' , 'August' , 'September' , 'October' , 'November' , 'December' ][date.getMonth()]\n\t\t\t\t\treturn ( returnAbbreviation__boolean ? monthName.slice(0, 3) : monthName )\n\t\t\t\t};\n\t\t}", "title": "" }, { "docid": "d3c9d4395f5a1f323b45450cfc2bfaf7", "score": "0.535698", "text": "function dateReset() {\n var date = new Date();\n document.write(\"Current date \"+ date);\n var hr = date.getHours();\n date.setHours(hr-1);\n document.write(\"<br> 1 hour ago, it was \"+ date);\n}", "title": "" }, { "docid": "7aca6776e329e3557c6c3ba1d99a3249", "score": "0.53459525", "text": "function rightBtn() {\n $('#setTime').hide();\n $('.setTime').addClass('animated slideInUp').show().one(\n 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend',\n function() {\n $(this).removeClass('animated slideInUp');\n });\n\n var temp = location[0].split(\" \")\n\n var nextWednesday = dateOfNext(dayOfWeekAsInteger(temp[0]));\n var movedate = nextWednesday.getDate();\n var movemonth = nextWednesday.getMonth() + 1;\n var movedates = ((movedate < 10) ? '0' + movedate : movedate);\n var movemonths = ((movemonth < 10) ? '0' + movemonth : movemonth);\n\n var title = location[1];\n \n//2015-05-28T09:00:00-07:00 due to google calendar api and daylight savings time i am temporarily changing 07:00 to 08:00. Will need to find a fix for this in the future.\n \n var eventz = {\n 'summary': 'Move Car ' + title,\n 'location': title,\n 'description': title,\n 'start': {\n 'dateTime': y + '-' + movemonths + '-' + movedates + 'T' +\n temp[1] + '-08:00',\n 'timeZone': 'America/Los_Angeles'\n },\n 'end': {\n 'dateTime': y + '-' + movemonths + '-' + movedates + 'T' +\n temp[3] + '-08:00',\n 'timeZone': 'America/Los_Angeles'\n },\n 'recurrence': ['RRULE:FREQ=DAILY;COUNT=1'],\n 'reminders': {\n 'useDefault': false,\n 'overrides': [{\n 'method': 'popup',\n 'minutes': 60\n }, {\n 'method': 'popup',\n 'minutes': 10\n }]\n }\n };\n if (calevent == 1) {\n var requestzy = gapi.client.calendar.events.delete({\n 'calendarId': 'primary',\n 'eventId': eventzId\n });\n requestzy.execute();\n var request = gapi.client.calendar.events.insert({\n 'calendarId': 'primary',\n 'resource': eventz\n });\n request.execute();\n } else {\n var request = gapi.client.calendar.events.insert({\n 'calendarId': 'primary',\n 'resource': eventz\n });\n request.execute();\n };\n }", "title": "" }, { "docid": "976146943a79b4e8c51b9923e59b23b8", "score": "0.5339681", "text": "function setCurrentDateTime() {\n var now = moment();\n displayDate = now.clone();\n setInterval(setCurrentDateTime, 1000);\n}", "title": "" }, { "docid": "4b0ec414cd3a2308a727b4f437f3a827", "score": "0.53386116", "text": "function update() {\n\n $('#currentDay').html(moment().format('dddd MMMM Do h:mm a'));\n }", "title": "" }, { "docid": "2b9b3300a2cb8833a9eae9c534b9ccc0", "score": "0.53289896", "text": "function initCalendar() {\n // The timezone takes into account the Easter Time zone offset + 1 hour of\n // dayling savings. Since it's a set day in the past, scheduling dates on this\n // calendar shouldn't change because of the time zone.\n calendar = new tui.Calendar('#calendar', {\n defaultView: 'week',\n useCreationPopup: true,\n useDetailPopup: true,\n disableDblClick: true,\n disableClick: true,\n isReadOnly: true,\n scheduleView: ['time'],\n taskView: false,\n timezones: [{\n timezoneOffset: -300,\n tooltip: 'EDT',\n }],\n });\n // The hard coded date that all scheduled events should fall around\n // Date: Sunday January 2nd, 2000 @ 00:00 EST\n calendar.setDate(new Date('2000-01-02T00:00:00'));\n\n randomizeColors();\n scheduleColors = [...ORIGINAL_COLORS];\n}", "title": "" }, { "docid": "f853b77df95b64a9ac8690782c0393e4", "score": "0.5323578", "text": "function calculateTime (app) {\n\n let myDate= calcTime(\"-5\"); //Eastern time right now\n let myHour= myDate.getHours();\n let myMinute= myDate.getMinutes();\n\n //Converting All the time in terms of minutes\n let currentInMinutes = (myHour*60) + myMinute;\n\n //Give 15 minute extra for person to go to sleep\n const PREPARE_TO_SLEEP = 15;\n\n //A good sleep consists of 5-6 sleeping cycles.\n //A cycle is 90 minutes long.\n\n let goodTimeToSleep = [];\n goodTimeToSleep[0] = convert_raw_minutes((5*90) + currentInMinutes + PREPARE_TO_SLEEP);\n goodTimeToSleep[1] = convert_raw_minutes((6* 90) + currentInMinutes + PREPARE_TO_SLEEP);\n \n\n function calcTime(offset) {\n // create Date object for current location\n var d = new Date();\n\n // convert to msec\n // subtract local time zone offset\n // get UTC time in msec\n var utc = d.getTime() - (d.getTimezoneOffset() * 60000);\n\n // create new Date object for different city\n // using supplied offset\n var nd = new Date(utc + (3600000*offset));\n\n // return time as a string\n return nd;\n }\n\n //Function to convert raw minutes to Hour:Minute Format Military Time\n function convert_raw_minutes(time)\n {\n let updatedTime = time % 1440; //1440 is total minutes in a day\n let hours = Math.floor(updatedTime/60);\n let minute = updatedTime % 60 ;\n return hours+\":\"+minute;\n }\n\n app.tell(\"Good time to wake up would be \" + goodTimeToSleep[0]+ \" or \"+ goodTimeToSleep[1]);\n\n }", "title": "" }, { "docid": "5e9ec884488bdd64890b70f58a890d14", "score": "0.53225636", "text": "function tick() {\n setDate(new Date());\n \n }", "title": "" }, { "docid": "009f240c4028082c99aa5abf6a4eda21", "score": "0.5322316", "text": "async function fetchJSONs() {\n // Calendar and reminder data.\n try {\n // Calendar\n if(showCalendar[0]) {\n let today = new Date()\n let end = new Date()\n today.setHours(0)\n today.setMinutes(0)\n today.setSeconds(0)\n\n if(calendarPeriod == 'today') {\n calendarJSON = await CalendarEvent.today(calendarSource)\n }\n else if(calendarPeriod == 'thisMonth') {\n end.setMonth(end.getMonth() + 1)\n end.setDate(-1)\n calendarJSON = await CalendarEvent.between(today, end,\n calendarSource)\n }\n else if(calendarPeriod == 'thisWeek') {\n end.setDate(end.getDate() + 6 - end.getDay())\n calendarJSON = await CalendarEvent.between(today, end,\n calendarSource)\n }\n else {\n end.setDate(end.getDate()+parseInt(calendarPeriod))\n calendarJSON = await CalendarEvent.between(today, end,\n calendarSource)\n }\n }\n // Reminder\n if(showCalendar[1]) {\n reminderJSON = await Reminder.allIncomplete()\n reminderJSON.sort(sortReminder)\n }\n }\n catch { console.error('Error : Load calendar data') }\n\n // Weather data.\n let weatherURL;\n let nx = -1, ny = -1;\n while(nx+ny < 0) {\n console.log('Loading current location data...');\n try {\n Location.setAccuracyToThreeKilometers();\n let location = await Location.current();\n let lat = location.latitude;\n let lon = location.longitude;\n // Change current location to grid(x, y)\n let grid = changeLocationGrid(lat, lon);\n nx = grid[0];\n ny = grid[1];\n }\n catch { nx = ny = -1; }\n }\n\n try {\n weatherURL = await getWeatherURL(nx, ny)\n weatherJSON = await new Request(weatherURL).loadJSON()\n }\n catch {\n console.error('Error : Load weather data')\n console.error('URL : ' + weatherURL)\n }\n\n\n // Function : Sort reminder content for date\n function sortReminder(a, b) {\n if(a.dueDate == null & b.dueDate == null) {\n compareCreationDate()\n }\n else if(a.dueDate != null && b.dueDate == null) return -1\n else if(a.dueDate == null && b.dueDate != null) return 1\n else {\n if(a.dueDate == b.dueDate) compareCreationDate()\n else if(a.dueDate < b.dueDate) return -1\n else return 1\n }\n\n function compareCreationDate() {\n if(a.creationDate == b.creationDate) return 0\n else if(a.creationDate < b.creationDate) return -1\n else return 1\n }\n }\n}", "title": "" }, { "docid": "545efda1d71429d8af3689ba59bd2a63", "score": "0.53180045", "text": "function today() { // 1\n var now = new Date(); //\n return createDay(now.getFullYear(), now.getMonth(), now.getDate()); //\n} // 4", "title": "" }, { "docid": "d8577e4741b1e7d97af90dc404ebc5f2", "score": "0.5315713", "text": "function setUTCISODay(dirtyDate, dirtyDay) {\n Object(_requiredArgs_index_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(2, arguments);\n var day = Object(_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(dirtyDay);\n\n if (day % 7 === 0) {\n day = day - 7;\n }\n\n var weekStartsOn = 1;\n var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(dirtyDate);\n var currentDay = date.getUTCDay();\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n}", "title": "" }, { "docid": "d8577e4741b1e7d97af90dc404ebc5f2", "score": "0.5315713", "text": "function setUTCISODay(dirtyDate, dirtyDay) {\n Object(_requiredArgs_index_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(2, arguments);\n var day = Object(_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(dirtyDay);\n\n if (day % 7 === 0) {\n day = day - 7;\n }\n\n var weekStartsOn = 1;\n var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(dirtyDate);\n var currentDay = date.getUTCDay();\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n}", "title": "" }, { "docid": "7e03efa1eaadf22c1969b9a283aea3b8", "score": "0.5311622", "text": "function setUTCISODay (dirtyDate, dirtyDay, dirtyOptions) {\r\n var day = Number(dirtyDay);\r\n\r\n if (day % 7 === 0) {\r\n day = day - 7;\r\n }\r\n\r\n var weekStartsOn = 1;\r\n var date = toDate(dirtyDate, dirtyOptions);\r\n var currentDay = date.getUTCDay();\r\n\r\n var remainder = day % 7;\r\n var dayIndex = (remainder + 7) % 7;\r\n\r\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\r\n\r\n date.setUTCDate(date.getUTCDate() + diff);\r\n return date\r\n}", "title": "" }, { "docid": "615daf0882c4fcab029650fe4297bf47", "score": "0.5307329", "text": "function setup (dateObject) {\n\n //format timezone\n document.querySelector('.timezone').innerHTML = dateObject.timeZone\n\n //look at currentDay in subheader, check if date matches highlight\n const possibleHighlight = document.querySelector(dateObject.currentDayTag)\n const compare = new Date()\n const compareDay = compare.getDate()\n\n dateObject.dd === compareDay\n ? possibleHighlight.parentElement.style.color = '#ff3333'\n : possibleHighlight.parentElement.style.color = ''\n\n //assign dates to subheader + subheader class\n Array.from(document.querySelectorAll('.date span')).forEach(day => {\n\n let thisDate = (dateObject.dateDay*1)\n + (dateObject.weekArray.indexOf(day.classList.value)\n - dateObject.dateDayIndex)\n\n //adjust when the day passes the current month\n thisDate > dateObject.totalDaysInMonth\n ? thisDate = Math.abs(thisDate - dateObject.totalDaysInMonth)\n : null\n\n //adjust when days go negative\n thisDate <= 0\n ? thisDate = thisDate + dateObject.totalDaysInMonth\n : null\n\n day.innerHTML = thisDate;\n\n //add class. if class already exists, remove and replace\n if (day.parentElement.classList.length < 2) {\n day.parentElement.classList.add(thisDate)\n } else {\n day.parentElement.classList.remove(day.parentElement.classList[1])\n day.parentElement.classList.add(thisDate)\n }\n })\n\n //add current month to top of page\n const dateItems = document.querySelectorAll('.date')\n const headerMonth = document.querySelector('.header-monthof')\n\n //detect when two months are in the week range, and adjust\n dateItems[1].classList[1]*1 > dateItems[7].classList[1]*1\n ? headerMonth.innerHTML = `\n ${dateObject.dateMonth}\n /${dateObject.monthArray[dateObject.monthArray.indexOf(dateObject.dateMonth) + 1]}`\n : headerMonth.innerHTML = dateObject.dateMonth\n\n //generate empty rightside divs for content, if they have not already been generated\n const rightSideColumn = Array.from(document.querySelectorAll('.rightside-column'))\n\n if (rightSideColumn[0].children.length < 26) {\n\n rightSideColumn.forEach(item => {\n //for loop to create 26 empty divs in each column\n for (var i = 0; i < 26; i++) {\n let contentPiece = document.createElement('div');\n contentPiece.className = 'rightside-column-content';\n item.appendChild(contentPiece);\n }\n })\n }\n\n //check local storage, fill in data based on saved events\n checkForData(dateObject)\n\n //add event listeners on grid\n Array.from(document.querySelectorAll('.rightside-column-content'))\n .forEach(item => item\n .addEventListener('click', () => revealModal(dateObject)))\n}", "title": "" }, { "docid": "bfc16113c0a41892d05efd1d34c451f2", "score": "0.53010887", "text": "function findAndSetSuntimeOnDate(whatDay, bSunRise, d) {\n var thatDaysSunInfo = new SunriseSunset( whatDay.getFullYear(), whatDay.getMonth()+1, whatDay.getDate(), my.data.latitude, my.data.longitude );\n\n var rawTime;\n\n if ( bSunRise ) {\n rawTime = thatDaysSunInfo.sunriseLocalHours( -( whatDay.getTimezoneOffset() ) / 60 );\n } else {\n rawTime = thatDaysSunInfo.sunsetLocalHours( -( whatDay.getTimezoneOffset() ) / 60 );\n }\n\n d.setHours(Math.abs(rawTime));\n d.setMinutes(Math.abs((rawTime % 1)* 60)); // mod 1 gives just decimal part of number\n }", "title": "" }, { "docid": "a3affe28948911c36eaecf210983edff", "score": "0.5300521", "text": "function update_current_vub_week() {\n var d = new Date();\n var date_array = date_to_VUB_time(d);\n $(\"#start-week\").attr(\"placeholder\", date_array[0]);\n}", "title": "" }, { "docid": "aa830e5e0c25cf40dc9dc788f915be92", "score": "0.53003854", "text": "function dateSetter() {\n let currentDate = new Date();\n let currentMonth = (currentDate.getMonth() + 1).toString();\n\n if (currentMonth.length < 2) {\n currentMonth = `0${currentMonth}`;\n }\n\n let currentDay = currentDate.getDate().toString();\n\n if (currentDay.length < 2) {\n currentDay = `0${currentDay}`;\n }\n\n let currentYear = (currentDate.getYear() + 1900).toString();\n let today = `${currentMonth}/${currentDay}/${currentYear}`;\n\n $('#date').val(today);\n}", "title": "" }, { "docid": "8c99000714419d11e717e9b85d5abca4", "score": "0.5300266", "text": "function generateCurrentDate() {\n\n return 4;//TODO REMOVE\n\n\tvar d = (new Date().getDay() + 6) % 7;\n\n if (d >= 5) {\n return 0;\n }\n if (new Date().getHours() > 17) {\n d++;\n if (d >= 5) {\n return 0;\n } else {\n return d;\n }\n }\n return d;\n}", "title": "" }, { "docid": "f27a9bb2eb46bddaee228f9b07756287", "score": "0.52957726", "text": "function setUTCISODay (dirtyDate, dirtyDay, dirtyOptions) {\n var day = Number(dirtyDay);\n\n if (day % 7 === 0) {\n day = day - 7;\n }\n\n var weekStartsOn = 1;\n var date = toDate(dirtyDate, dirtyOptions);\n var currentDay = date.getUTCDay();\n\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n\n date.setUTCDate(date.getUTCDate() + diff);\n return date\n}", "title": "" }, { "docid": "f27a9bb2eb46bddaee228f9b07756287", "score": "0.52957726", "text": "function setUTCISODay (dirtyDate, dirtyDay, dirtyOptions) {\n var day = Number(dirtyDay);\n\n if (day % 7 === 0) {\n day = day - 7;\n }\n\n var weekStartsOn = 1;\n var date = toDate(dirtyDate, dirtyOptions);\n var currentDay = date.getUTCDay();\n\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n\n date.setUTCDate(date.getUTCDate() + diff);\n return date\n}", "title": "" }, { "docid": "f27a9bb2eb46bddaee228f9b07756287", "score": "0.52957726", "text": "function setUTCISODay (dirtyDate, dirtyDay, dirtyOptions) {\n var day = Number(dirtyDay);\n\n if (day % 7 === 0) {\n day = day - 7;\n }\n\n var weekStartsOn = 1;\n var date = toDate(dirtyDate, dirtyOptions);\n var currentDay = date.getUTCDay();\n\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n\n date.setUTCDate(date.getUTCDate() + diff);\n return date\n}", "title": "" }, { "docid": "f27a9bb2eb46bddaee228f9b07756287", "score": "0.52957726", "text": "function setUTCISODay (dirtyDate, dirtyDay, dirtyOptions) {\n var day = Number(dirtyDay);\n\n if (day % 7 === 0) {\n day = day - 7;\n }\n\n var weekStartsOn = 1;\n var date = toDate(dirtyDate, dirtyOptions);\n var currentDay = date.getUTCDay();\n\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n\n date.setUTCDate(date.getUTCDate() + diff);\n return date\n}", "title": "" }, { "docid": "f27a9bb2eb46bddaee228f9b07756287", "score": "0.52957726", "text": "function setUTCISODay (dirtyDate, dirtyDay, dirtyOptions) {\n var day = Number(dirtyDay);\n\n if (day % 7 === 0) {\n day = day - 7;\n }\n\n var weekStartsOn = 1;\n var date = toDate(dirtyDate, dirtyOptions);\n var currentDay = date.getUTCDay();\n\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n\n date.setUTCDate(date.getUTCDate() + diff);\n return date\n}", "title": "" }, { "docid": "f27a9bb2eb46bddaee228f9b07756287", "score": "0.52957726", "text": "function setUTCISODay (dirtyDate, dirtyDay, dirtyOptions) {\n var day = Number(dirtyDay);\n\n if (day % 7 === 0) {\n day = day - 7;\n }\n\n var weekStartsOn = 1;\n var date = toDate(dirtyDate, dirtyOptions);\n var currentDay = date.getUTCDay();\n\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n\n date.setUTCDate(date.getUTCDate() + diff);\n return date\n}", "title": "" }, { "docid": "509f805d268c25afab5c3596919285e8", "score": "0.5288836", "text": "function handleUpcomingMatch() {\n var today = new Date();\n var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+ (\"0\" + today.getDate()).slice(-2)+'T'+today.getHours()+\":\"+today.getMinutes();\n handleUpcoming(date);\n}", "title": "" }, { "docid": "4e7e1c92a691918a6d04ee16e36ef0d4", "score": "0.5288809", "text": "function RelaxTimeStart()\n{\n var dNow = new Date();\n let localdate= (dNow.getDate() + '/' + dNow.getMonth() + '/' + dNow.getFullYear() + ' ' + dNow.getHours() + ':' + dNow.getMinutes());\n document.getElementById(\"RdateStart\").innerHTML=localdate;\n}", "title": "" }, { "docid": "a83a5707793309525a79afb3980f9cf0", "score": "0.5288708", "text": "function calculateFutureDate(){\r\n\t return new Date();\r\n }", "title": "" }, { "docid": "a098a6167164d311ca8e620e10d478b1", "score": "0.528341", "text": "function displayDate() {\n var months = ['Sagittarius', 'Dhanus', 'Capricornus', 'Makara', 'Aquarius', 'Kumbha', 'Pisces', 'Mina', 'Aries', 'Mesha', 'Taurus', 'Rishabha']\n\n dt = today.getUTCDate();\n m = today.getUTCMonth();\n y = today.getUTCFullYear()+11;\n\n todaysDate.innerHTML = dt + '.' + ' ' + months[m] + ' ' + y;\n}", "title": "" }, { "docid": "f97ff0400c1a759ee6a058409d77c241", "score": "0.5282487", "text": "function findDailyReset(date) {\r\n var result = new Date(\r\n date.getFullYear(),\r\n date.getMonth(),\r\n date.getDate() +\r\n (date.getHours() < DAILY_RESET.hour ||\r\n (date.getHours() == DAILY_RESET.hour && date.getMinutes() < DAILY_RESET.minute) ||\r\n (date.getMinutes() == DAILY_RESET.minute && date.getSeconds() < DAILY_RESET.second)\r\n ? 0\r\n : 1),\r\n DAILY_RESET.hour,\r\n DAILY_RESET.minute,\r\n DAILY_RESET.second\r\n );\r\n return result;\r\n}", "title": "" } ]
f33793ae9eba639215d663f30967261c
RLP Encoding based on: This function takes in a data, convert it to buffer if not, and a length for recursion
[ { "docid": "41b8242921ca5f6639b1505d039b25ca", "score": "0.0", "text": "function encode(input) {\n if (Array.isArray(input)) {\n var output = [];\n\n for (var i = 0; i < input.length; i++) {\n output.push(encode(input[i]));\n }\n\n var buf = Buffer.concat(output);\n return Buffer.concat([encodeLength(buf.length, 192), buf]);\n } else {\n var inputBuf = toBuffer(input);\n return inputBuf.length === 1 && inputBuf[0] < 128 ? inputBuf : Buffer.concat([encodeLength(inputBuf.length, 128), inputBuf]);\n }\n}", "title": "" } ]
[ { "docid": "69f700f73233b490f71435d690cee769", "score": "0.6078248", "text": "function _decode(input) {\n var length, llength, data, innerRemainder, d\n var decoded = []\n var firstByte = input[0]\n if (firstByte <= 0x7f) {\n // a single byte whose value is in the [0x00, 0x7f] range, that byte is its own RLP encoding.\n return {\n data: input.slice(0, 1),\n remainder: input.slice(1),\n }\n } else if (firstByte <= 0xb7) {\n // string is 0-55 bytes long. A single byte with value 0x80 plus the length of the string followed by the string\n // The range of the first byte is [0x80, 0xb7]\n length = firstByte - 0x7f\n // set 0x80 null to 0\n if (firstByte === 0x80) {\n data = Buffer.from([])\n } else {\n data = input.slice(1, length)\n }\n if (length === 2 && data[0] < 0x80) {\n throw new Error('invalid rlp encoding: byte must be less 0x80')\n }\n return {\n data: data,\n remainder: input.slice(length),\n }\n } else if (firstByte <= 0xbf) {\n // string is greater than 55 bytes long. A single byte with the value (0xb7 plus the length of the length),\n // followed by the length, followed by the string\n llength = firstByte - 0xb6\n if (input.length - 1 < llength) {\n throw new Error('invalid RLP: not enough bytes for string length')\n }\n length = safeParseInt(input.slice(1, llength).toString('hex'), 16)\n if (length <= 55) {\n throw new Error(\n 'invalid RLP: expected string length to be greater than 55',\n )\n }\n data = input.slice(llength, length + llength)\n if (data.length < length) {\n throw new Error('invalid RLP: not enough bytes for string')\n }\n return {\n data: data,\n remainder: input.slice(length + llength),\n }\n } else if (firstByte <= 0xf7) {\n // a list between 0-55 bytes long\n length = firstByte - 0xbf\n innerRemainder = input.slice(1, length)\n while (innerRemainder.length) {\n d = _decode(innerRemainder)\n decoded.push(d.data)\n innerRemainder = d.remainder\n }\n return {\n data: decoded,\n remainder: input.slice(length),\n }\n } else {\n // a list over 55 bytes long\n llength = firstByte - 0xf6\n length = safeParseInt(input.slice(1, llength).toString('hex'), 16)\n var totalLength = llength + length\n if (totalLength > input.length) {\n throw new Error(\n 'invalid rlp: total length is larger than the data',\n )\n }\n innerRemainder = input.slice(llength, totalLength)\n if (innerRemainder.length === 0) {\n throw new Error('invalid rlp, List has a invalid length')\n }\n while (innerRemainder.length) {\n d = _decode(innerRemainder)\n decoded.push(d.data)\n innerRemainder = d.remainder\n }\n return {\n data: decoded,\n remainder: input.slice(totalLength),\n }\n }\n }", "title": "" }, { "docid": "51709bb4e237430e9597dcdc1af183af", "score": "0.6010429", "text": "function _decode(input) {\n var length, llength, data, innerRemainder, d;\n var decoded = [];\n var firstByte = input[0];\n if (firstByte <= 0x7f) {\n // a single byte whose value is in the [0x00, 0x7f] range, that byte is its own RLP encoding.\n return {\n data: input.slice(0, 1),\n remainder: input.slice(1),\n };\n }\n else if (firstByte <= 0xb7) {\n // string is 0-55 bytes long. A single byte with value 0x80 plus the length of the string followed by the string\n // The range of the first byte is [0x80, 0xb7]\n length = firstByte - 0x7f;\n // set 0x80 null to 0\n if (firstByte === 0x80) {\n data = Buffer.from([]);\n }\n else {\n data = input.slice(1, length);\n }\n if (length === 2 && data[0] < 0x80) {\n throw new Error('invalid rlp encoding: byte must be less 0x80');\n }\n return {\n data: data,\n remainder: input.slice(length),\n };\n }\n else if (firstByte <= 0xbf) {\n // string is greater than 55 bytes long. A single byte with the value (0xb7 plus the length of the length),\n // followed by the length, followed by the string\n llength = firstByte - 0xb6;\n if (input.length - 1 < llength) {\n throw new Error('invalid RLP: not enough bytes for string length');\n }\n length = safeParseInt(input.slice(1, llength).toString('hex'), 16);\n if (length <= 55) {\n throw new Error('invalid RLP: expected string length to be greater than 55');\n }\n data = input.slice(llength, length + llength);\n if (data.length < length) {\n throw new Error('invalid RLP: not enough bytes for string');\n }\n return {\n data: data,\n remainder: input.slice(length + llength),\n };\n }\n else if (firstByte <= 0xf7) {\n // a list between 0-55 bytes long\n length = firstByte - 0xbf;\n innerRemainder = input.slice(1, length);\n while (innerRemainder.length) {\n d = _decode(innerRemainder);\n decoded.push(d.data);\n innerRemainder = d.remainder;\n }\n return {\n data: decoded,\n remainder: input.slice(length),\n };\n }\n else {\n // a list over 55 bytes long\n llength = firstByte - 0xf6;\n length = safeParseInt(input.slice(1, llength).toString('hex'), 16);\n var totalLength = llength + length;\n if (totalLength > input.length) {\n throw new Error('invalid rlp: total length is larger than the data');\n }\n innerRemainder = input.slice(llength, totalLength);\n if (innerRemainder.length === 0) {\n throw new Error('invalid rlp, List has a invalid length');\n }\n while (innerRemainder.length) {\n d = _decode(innerRemainder);\n decoded.push(d.data);\n innerRemainder = d.remainder;\n }\n return {\n data: decoded,\n remainder: input.slice(totalLength),\n };\n }\n}", "title": "" }, { "docid": "51709bb4e237430e9597dcdc1af183af", "score": "0.6010429", "text": "function _decode(input) {\n var length, llength, data, innerRemainder, d;\n var decoded = [];\n var firstByte = input[0];\n if (firstByte <= 0x7f) {\n // a single byte whose value is in the [0x00, 0x7f] range, that byte is its own RLP encoding.\n return {\n data: input.slice(0, 1),\n remainder: input.slice(1),\n };\n }\n else if (firstByte <= 0xb7) {\n // string is 0-55 bytes long. A single byte with value 0x80 plus the length of the string followed by the string\n // The range of the first byte is [0x80, 0xb7]\n length = firstByte - 0x7f;\n // set 0x80 null to 0\n if (firstByte === 0x80) {\n data = Buffer.from([]);\n }\n else {\n data = input.slice(1, length);\n }\n if (length === 2 && data[0] < 0x80) {\n throw new Error('invalid rlp encoding: byte must be less 0x80');\n }\n return {\n data: data,\n remainder: input.slice(length),\n };\n }\n else if (firstByte <= 0xbf) {\n // string is greater than 55 bytes long. A single byte with the value (0xb7 plus the length of the length),\n // followed by the length, followed by the string\n llength = firstByte - 0xb6;\n if (input.length - 1 < llength) {\n throw new Error('invalid RLP: not enough bytes for string length');\n }\n length = safeParseInt(input.slice(1, llength).toString('hex'), 16);\n if (length <= 55) {\n throw new Error('invalid RLP: expected string length to be greater than 55');\n }\n data = input.slice(llength, length + llength);\n if (data.length < length) {\n throw new Error('invalid RLP: not enough bytes for string');\n }\n return {\n data: data,\n remainder: input.slice(length + llength),\n };\n }\n else if (firstByte <= 0xf7) {\n // a list between 0-55 bytes long\n length = firstByte - 0xbf;\n innerRemainder = input.slice(1, length);\n while (innerRemainder.length) {\n d = _decode(innerRemainder);\n decoded.push(d.data);\n innerRemainder = d.remainder;\n }\n return {\n data: decoded,\n remainder: input.slice(length),\n };\n }\n else {\n // a list over 55 bytes long\n llength = firstByte - 0xf6;\n length = safeParseInt(input.slice(1, llength).toString('hex'), 16);\n var totalLength = llength + length;\n if (totalLength > input.length) {\n throw new Error('invalid rlp: total length is larger than the data');\n }\n innerRemainder = input.slice(llength, totalLength);\n if (innerRemainder.length === 0) {\n throw new Error('invalid rlp, List has a invalid length');\n }\n while (innerRemainder.length) {\n d = _decode(innerRemainder);\n decoded.push(d.data);\n innerRemainder = d.remainder;\n }\n return {\n data: decoded,\n remainder: input.slice(totalLength),\n };\n }\n}", "title": "" }, { "docid": "51709bb4e237430e9597dcdc1af183af", "score": "0.6010429", "text": "function _decode(input) {\n var length, llength, data, innerRemainder, d;\n var decoded = [];\n var firstByte = input[0];\n if (firstByte <= 0x7f) {\n // a single byte whose value is in the [0x00, 0x7f] range, that byte is its own RLP encoding.\n return {\n data: input.slice(0, 1),\n remainder: input.slice(1),\n };\n }\n else if (firstByte <= 0xb7) {\n // string is 0-55 bytes long. A single byte with value 0x80 plus the length of the string followed by the string\n // The range of the first byte is [0x80, 0xb7]\n length = firstByte - 0x7f;\n // set 0x80 null to 0\n if (firstByte === 0x80) {\n data = Buffer.from([]);\n }\n else {\n data = input.slice(1, length);\n }\n if (length === 2 && data[0] < 0x80) {\n throw new Error('invalid rlp encoding: byte must be less 0x80');\n }\n return {\n data: data,\n remainder: input.slice(length),\n };\n }\n else if (firstByte <= 0xbf) {\n // string is greater than 55 bytes long. A single byte with the value (0xb7 plus the length of the length),\n // followed by the length, followed by the string\n llength = firstByte - 0xb6;\n if (input.length - 1 < llength) {\n throw new Error('invalid RLP: not enough bytes for string length');\n }\n length = safeParseInt(input.slice(1, llength).toString('hex'), 16);\n if (length <= 55) {\n throw new Error('invalid RLP: expected string length to be greater than 55');\n }\n data = input.slice(llength, length + llength);\n if (data.length < length) {\n throw new Error('invalid RLP: not enough bytes for string');\n }\n return {\n data: data,\n remainder: input.slice(length + llength),\n };\n }\n else if (firstByte <= 0xf7) {\n // a list between 0-55 bytes long\n length = firstByte - 0xbf;\n innerRemainder = input.slice(1, length);\n while (innerRemainder.length) {\n d = _decode(innerRemainder);\n decoded.push(d.data);\n innerRemainder = d.remainder;\n }\n return {\n data: decoded,\n remainder: input.slice(length),\n };\n }\n else {\n // a list over 55 bytes long\n llength = firstByte - 0xf6;\n length = safeParseInt(input.slice(1, llength).toString('hex'), 16);\n var totalLength = llength + length;\n if (totalLength > input.length) {\n throw new Error('invalid rlp: total length is larger than the data');\n }\n innerRemainder = input.slice(llength, totalLength);\n if (innerRemainder.length === 0) {\n throw new Error('invalid rlp, List has a invalid length');\n }\n while (innerRemainder.length) {\n d = _decode(innerRemainder);\n decoded.push(d.data);\n innerRemainder = d.remainder;\n }\n return {\n data: decoded,\n remainder: input.slice(totalLength),\n };\n }\n}", "title": "" }, { "docid": "1e5045a99d9f623901883902522d51a2", "score": "0.5970385", "text": "function _decode(input) {\n var length, llength, data, innerRemainder, d;\n var decoded = [];\n var firstByte = input[0];\n if (firstByte <= 0x7f) {\n // a single byte whose value is in the [0x00, 0x7f] range, that byte is its own RLP encoding.\n return {\n data: input.slice(0, 1),\n remainder: input.slice(1),\n };\n }\n else if (firstByte <= 0xb7) {\n // string is 0-55 bytes long. A single byte with value 0x80 plus the length of the string followed by the string\n // The range of the first byte is [0x80, 0xb7]\n length = firstByte - 0x7f;\n // set 0x80 null to 0\n if (firstByte === 0x80) {\n data = Buffer.from([]);\n }\n else {\n data = input.slice(1, length);\n }\n if (length === 2 && data[0] < 0x80) {\n throw new Error('invalid rlp encoding: byte must be less 0x80');\n }\n return {\n data: data,\n remainder: input.slice(length),\n };\n }\n else if (firstByte <= 0xbf) {\n llength = firstByte - 0xb6;\n length = safeParseInt(input.slice(1, llength).toString('hex'), 16);\n data = input.slice(llength, length + llength);\n if (data.length < length) {\n throw new Error('invalid RLP');\n }\n return {\n data: data,\n remainder: input.slice(length + llength),\n };\n }\n else if (firstByte <= 0xf7) {\n // a list between 0-55 bytes long\n length = firstByte - 0xbf;\n innerRemainder = input.slice(1, length);\n while (innerRemainder.length) {\n d = _decode(innerRemainder);\n decoded.push(d.data);\n innerRemainder = d.remainder;\n }\n return {\n data: decoded,\n remainder: input.slice(length),\n };\n }\n else {\n // a list over 55 bytes long\n llength = firstByte - 0xf6;\n length = safeParseInt(input.slice(1, llength).toString('hex'), 16);\n var totalLength = llength + length;\n if (totalLength > input.length) {\n throw new Error('invalid rlp: total length is larger than the data');\n }\n innerRemainder = input.slice(llength, totalLength);\n if (innerRemainder.length === 0) {\n throw new Error('invalid rlp, List has a invalid length');\n }\n while (innerRemainder.length) {\n d = _decode(innerRemainder);\n decoded.push(d.data);\n innerRemainder = d.remainder;\n }\n return {\n data: decoded,\n remainder: input.slice(totalLength),\n };\n }\n}", "title": "" }, { "docid": "1e5045a99d9f623901883902522d51a2", "score": "0.5970385", "text": "function _decode(input) {\n var length, llength, data, innerRemainder, d;\n var decoded = [];\n var firstByte = input[0];\n if (firstByte <= 0x7f) {\n // a single byte whose value is in the [0x00, 0x7f] range, that byte is its own RLP encoding.\n return {\n data: input.slice(0, 1),\n remainder: input.slice(1),\n };\n }\n else if (firstByte <= 0xb7) {\n // string is 0-55 bytes long. A single byte with value 0x80 plus the length of the string followed by the string\n // The range of the first byte is [0x80, 0xb7]\n length = firstByte - 0x7f;\n // set 0x80 null to 0\n if (firstByte === 0x80) {\n data = Buffer.from([]);\n }\n else {\n data = input.slice(1, length);\n }\n if (length === 2 && data[0] < 0x80) {\n throw new Error('invalid rlp encoding: byte must be less 0x80');\n }\n return {\n data: data,\n remainder: input.slice(length),\n };\n }\n else if (firstByte <= 0xbf) {\n llength = firstByte - 0xb6;\n length = safeParseInt(input.slice(1, llength).toString('hex'), 16);\n data = input.slice(llength, length + llength);\n if (data.length < length) {\n throw new Error('invalid RLP');\n }\n return {\n data: data,\n remainder: input.slice(length + llength),\n };\n }\n else if (firstByte <= 0xf7) {\n // a list between 0-55 bytes long\n length = firstByte - 0xbf;\n innerRemainder = input.slice(1, length);\n while (innerRemainder.length) {\n d = _decode(innerRemainder);\n decoded.push(d.data);\n innerRemainder = d.remainder;\n }\n return {\n data: decoded,\n remainder: input.slice(length),\n };\n }\n else {\n // a list over 55 bytes long\n llength = firstByte - 0xf6;\n length = safeParseInt(input.slice(1, llength).toString('hex'), 16);\n var totalLength = llength + length;\n if (totalLength > input.length) {\n throw new Error('invalid rlp: total length is larger than the data');\n }\n innerRemainder = input.slice(llength, totalLength);\n if (innerRemainder.length === 0) {\n throw new Error('invalid rlp, List has a invalid length');\n }\n while (innerRemainder.length) {\n d = _decode(innerRemainder);\n decoded.push(d.data);\n innerRemainder = d.remainder;\n }\n return {\n data: decoded,\n remainder: input.slice(totalLength),\n };\n }\n}", "title": "" }, { "docid": "1e5045a99d9f623901883902522d51a2", "score": "0.5970385", "text": "function _decode(input) {\n var length, llength, data, innerRemainder, d;\n var decoded = [];\n var firstByte = input[0];\n if (firstByte <= 0x7f) {\n // a single byte whose value is in the [0x00, 0x7f] range, that byte is its own RLP encoding.\n return {\n data: input.slice(0, 1),\n remainder: input.slice(1),\n };\n }\n else if (firstByte <= 0xb7) {\n // string is 0-55 bytes long. A single byte with value 0x80 plus the length of the string followed by the string\n // The range of the first byte is [0x80, 0xb7]\n length = firstByte - 0x7f;\n // set 0x80 null to 0\n if (firstByte === 0x80) {\n data = Buffer.from([]);\n }\n else {\n data = input.slice(1, length);\n }\n if (length === 2 && data[0] < 0x80) {\n throw new Error('invalid rlp encoding: byte must be less 0x80');\n }\n return {\n data: data,\n remainder: input.slice(length),\n };\n }\n else if (firstByte <= 0xbf) {\n llength = firstByte - 0xb6;\n length = safeParseInt(input.slice(1, llength).toString('hex'), 16);\n data = input.slice(llength, length + llength);\n if (data.length < length) {\n throw new Error('invalid RLP');\n }\n return {\n data: data,\n remainder: input.slice(length + llength),\n };\n }\n else if (firstByte <= 0xf7) {\n // a list between 0-55 bytes long\n length = firstByte - 0xbf;\n innerRemainder = input.slice(1, length);\n while (innerRemainder.length) {\n d = _decode(innerRemainder);\n decoded.push(d.data);\n innerRemainder = d.remainder;\n }\n return {\n data: decoded,\n remainder: input.slice(length),\n };\n }\n else {\n // a list over 55 bytes long\n llength = firstByte - 0xf6;\n length = safeParseInt(input.slice(1, llength).toString('hex'), 16);\n var totalLength = llength + length;\n if (totalLength > input.length) {\n throw new Error('invalid rlp: total length is larger than the data');\n }\n innerRemainder = input.slice(llength, totalLength);\n if (innerRemainder.length === 0) {\n throw new Error('invalid rlp, List has a invalid length');\n }\n while (innerRemainder.length) {\n d = _decode(innerRemainder);\n decoded.push(d.data);\n innerRemainder = d.remainder;\n }\n return {\n data: decoded,\n remainder: input.slice(totalLength),\n };\n }\n}", "title": "" }, { "docid": "1e5045a99d9f623901883902522d51a2", "score": "0.5970385", "text": "function _decode(input) {\n var length, llength, data, innerRemainder, d;\n var decoded = [];\n var firstByte = input[0];\n if (firstByte <= 0x7f) {\n // a single byte whose value is in the [0x00, 0x7f] range, that byte is its own RLP encoding.\n return {\n data: input.slice(0, 1),\n remainder: input.slice(1),\n };\n }\n else if (firstByte <= 0xb7) {\n // string is 0-55 bytes long. A single byte with value 0x80 plus the length of the string followed by the string\n // The range of the first byte is [0x80, 0xb7]\n length = firstByte - 0x7f;\n // set 0x80 null to 0\n if (firstByte === 0x80) {\n data = Buffer.from([]);\n }\n else {\n data = input.slice(1, length);\n }\n if (length === 2 && data[0] < 0x80) {\n throw new Error('invalid rlp encoding: byte must be less 0x80');\n }\n return {\n data: data,\n remainder: input.slice(length),\n };\n }\n else if (firstByte <= 0xbf) {\n llength = firstByte - 0xb6;\n length = safeParseInt(input.slice(1, llength).toString('hex'), 16);\n data = input.slice(llength, length + llength);\n if (data.length < length) {\n throw new Error('invalid RLP');\n }\n return {\n data: data,\n remainder: input.slice(length + llength),\n };\n }\n else if (firstByte <= 0xf7) {\n // a list between 0-55 bytes long\n length = firstByte - 0xbf;\n innerRemainder = input.slice(1, length);\n while (innerRemainder.length) {\n d = _decode(innerRemainder);\n decoded.push(d.data);\n innerRemainder = d.remainder;\n }\n return {\n data: decoded,\n remainder: input.slice(length),\n };\n }\n else {\n // a list over 55 bytes long\n llength = firstByte - 0xf6;\n length = safeParseInt(input.slice(1, llength).toString('hex'), 16);\n var totalLength = llength + length;\n if (totalLength > input.length) {\n throw new Error('invalid rlp: total length is larger than the data');\n }\n innerRemainder = input.slice(llength, totalLength);\n if (innerRemainder.length === 0) {\n throw new Error('invalid rlp, List has a invalid length');\n }\n while (innerRemainder.length) {\n d = _decode(innerRemainder);\n decoded.push(d.data);\n innerRemainder = d.remainder;\n }\n return {\n data: decoded,\n remainder: input.slice(totalLength),\n };\n }\n}", "title": "" }, { "docid": "e54b3c5a58fa82f335dbd1c3a27c874c", "score": "0.5920611", "text": "function _decode(input) {\n var length, llength, data, innerRemainder, d;\n var decoded = [];\n var firstByte = input[0];\n\n if (firstByte <= 0x7f) {\n // a single byte whose value is in the [0x00, 0x7f] range, that byte is its own RLP encoding.\n return {\n data: input.slice(0, 1),\n remainder: input.slice(1)\n };\n } else if (firstByte <= 0xb7) {\n // string is 0-55 bytes long. A single byte with value 0x80 plus the length of the string followed by the string\n // The range of the first byte is [0x80, 0xb7]\n length = firstByte - 0x7f; // set 0x80 null to 0\n\n if (firstByte === 0x80) {\n data = Buffer.from([]);\n } else {\n data = input.slice(1, length);\n }\n\n if (length === 2 && data[0] < 0x80) {\n throw new Error('invalid rlp encoding: byte must be less 0x80');\n }\n\n return {\n data: data,\n remainder: input.slice(length)\n };\n } else if (firstByte <= 0xbf) {\n // string is greater than 55 bytes long. A single byte with the value (0xb7 plus the length of the length),\n // followed by the length, followed by the string\n llength = firstByte - 0xb6;\n\n if (input.length - 1 < llength) {\n throw new Error('invalid RLP: not enough bytes for string length');\n }\n\n length = safeParseInt(input.slice(1, llength).toString('hex'), 16);\n\n if (length <= 55) {\n throw new Error('invalid RLP: expected string length to be greater than 55');\n }\n\n data = input.slice(llength, length + llength);\n\n if (data.length < length) {\n throw new Error('invalid RLP: not enough bytes for string');\n }\n\n return {\n data: data,\n remainder: input.slice(length + llength)\n };\n } else if (firstByte <= 0xf7) {\n // a list between 0-55 bytes long\n length = firstByte - 0xbf;\n innerRemainder = input.slice(1, length);\n\n while (innerRemainder.length) {\n d = _decode(innerRemainder);\n decoded.push(d.data);\n innerRemainder = d.remainder;\n }\n\n return {\n data: decoded,\n remainder: input.slice(length)\n };\n } else {\n // a list over 55 bytes long\n llength = firstByte - 0xf6;\n length = safeParseInt(input.slice(1, llength).toString('hex'), 16);\n var totalLength = llength + length;\n\n if (totalLength > input.length) {\n throw new Error('invalid rlp: total length is larger than the data');\n }\n\n innerRemainder = input.slice(llength, totalLength);\n\n if (innerRemainder.length === 0) {\n throw new Error('invalid rlp, List has a invalid length');\n }\n\n while (innerRemainder.length) {\n d = _decode(innerRemainder);\n decoded.push(d.data);\n innerRemainder = d.remainder;\n }\n\n return {\n data: decoded,\n remainder: input.slice(totalLength)\n };\n }\n}", "title": "" }, { "docid": "b02b7d18f56e0c126cdac57f9368b6a2", "score": "0.58050895", "text": "rleEncode(arr) {\n const maxChunkNum = 50000; // Limit of N, so that it can be represented as a single char (we're targeting before surrogates, 0xD800=55296).\n let res = \"\"; // Result string.\n\n // As we encode the input array, we keep 2 chunks in 'assembling' state - one literal and one incremental.\n // Both have the same string length. Each can be empty. Incremental chunk conceptually comes after literal.\n let curStrLen = 0, // Length of strings in current chunks.\n literalChunkBody = \"\", // Literal chunk body.\n literalChunkNum = 0, // Number of strings in literalChunkBody (can't be calculated when curStrLen = literalChunkBody.length = 0).\n incrChunkBase = \"\", // Base of incremental sequence.\n incrChunkNum = 0; // Length of incremental sequence.\n\n if (arr.length === 0) {\n return \"\";\n }\n\n const encodeHeaderChar = (i) => {\n assert(0 < i && i < 0xd800 - 0x22); // Check the character is below surrogates.\n return String.fromCharCode(0x22 + i);\n };\n\n const encodeChunk = (type, strlen, numstr, body) =>\n encodeHeaderChar(type + (strlen << 1)) + encodeHeaderChar(numstr) + body;\n\n const flushChunks = () => {\n if (incrChunkNum < this.rleMinIncrChunkNum) {\n convertIncrChunkToLiteral();\n }\n\n if (literalChunkNum) {\n res += encodeChunk(1, curStrLen, literalChunkNum, literalChunkBody);\n literalChunkBody = \"\";\n literalChunkNum = 0;\n }\n\n if (incrChunkNum) {\n res += encodeChunk(0, curStrLen, incrChunkNum, incrChunkBase);\n incrChunkBase = \"\";\n incrChunkNum = 0;\n }\n };\n\n const convertIncrChunkToLiteral = () => {\n this._forEachIncrementalStr(incrChunkBase, incrChunkNum, (str) => {\n literalChunkBody += str;\n });\n literalChunkNum += incrChunkNum;\n incrChunkNum = 0;\n return true;\n };\n\n const isIncrementalStr = (str, baseStr, diff) =>\n str.length > 0 &&\n baseStr.length === str.length &&\n baseStr.slice(0, -1) === str.slice(0, -1) &&\n baseStr.charCodeAt(baseStr.length - 1) + diff === str.charCodeAt(str.length - 1);\n\n // Process input array of strings one by one.\n for (let i = 0; i < arr.length; i++) {\n const str = arr[i];\n assert(typeof str === \"string\");\n assert(str.length < maxChunkNum / 2, `Input string is too long: ${str.length}`);\n\n if (\n str.length !== curStrLen ||\n literalChunkNum > maxChunkNum ||\n incrChunkNum > maxChunkNum\n ) {\n // Flush everything and start anew.\n flushChunks();\n curStrLen = str.length;\n incrChunkBase = str;\n incrChunkNum = 1;\n } else if (isIncrementalStr(str, incrChunkBase, incrChunkNum)) {\n incrChunkNum++;\n } else {\n // We can't continue incremental chunk.\n if (incrChunkNum < this.rleMinIncrChunkNum) {\n // Incremental chunk too small - move the data to literal and restart incremental.\n convertIncrChunkToLiteral();\n } else {\n // Incremental chunk is big enough - add both chunks to res and restart both.\n flushChunks();\n }\n incrChunkBase = str;\n incrChunkNum = 1;\n }\n }\n flushChunks();\n\n return res;\n }", "title": "" }, { "docid": "69c61f598c2fff2a34f38149903ba712", "score": "0.5732641", "text": "function encode(data) {\n console.log(data);\n let buf = Buffer.from(data);\n console.log(buf);\n let base64 = buf.toString(\"base64\");\n console.log(base64);\n\n let buff = new Buffer(base64, \"base64\");\n console.log(buff);\n\n var x = Buffer.compare(buf, buff);\n console.log(x);\n\n return base64;\n}", "title": "" }, { "docid": "348bcfb4dd39ddda7404de96468f0be0", "score": "0.56637007", "text": "function fixdata(data) {\n var o = \"\", l = 0, w = 10240;\n for(; l<data.byteLength/w; ++l) o+=String.fromCharCode.apply(null,new Uint8Array(data.slice(l*w,l*w+w)));\n o+=String.fromCharCode.apply(null, new Uint8Array(data.slice(l*w)));\n return o;\n }", "title": "" }, { "docid": "b3518c9379609c34f20a150bf1b7587f", "score": "0.555738", "text": "function r(){d.call(this,'utf-8 encode')}/**\n\t * The following functions come from pako, from pako/lib/utils/strings\n\t * released under the MIT license, see pako https://github.com/nodeca/pako/\n\t */// Table with utf8 lengths (calculated by first byte of sequence)", "title": "" }, { "docid": "1005d263161f94fbdbe9bddc1c6128df", "score": "0.5531122", "text": "encodeLength(length:Number, b:Array) {\n }", "title": "" }, { "docid": "096429dd109dd5d13b84e1c092c41e65", "score": "0.5505107", "text": "function encode(data){\n let buf = Buffer.from(data);\n let base64 = buf.toString('base64');\n return base64\n}", "title": "" }, { "docid": "b135b98afedb53ef08d4db622645eeb6", "score": "0.54866064", "text": "buffer(buffer = new ArrayBuffer(this.size)) {\n const view = new DataView(buffer);\n let pc = 0;\n this.data.forEach(({ type, value }) => {\n if (Array.isArray(value)) {\n value.forEach(v => index_14(index_9, pc++, view, v));\n } else {\n index_14(type, pc, view, value);\n pc += index_16[type];\n }\n });\n return buffer;\n }", "title": "" }, { "docid": "41828d53feb7f84585b2d1d9d24e8ba5", "score": "0.5449142", "text": "function Buffer(arg,encodingOrOffset,length){// Common case.\nif(typeof arg==='number'){if(typeof encodingOrOffset==='string'){throw new Error('If encoding is specified then the first argument must be a string');}return allocUnsafe(arg);}return from(arg,encodingOrOffset,length);}// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97", "title": "" }, { "docid": "41828d53feb7f84585b2d1d9d24e8ba5", "score": "0.5449142", "text": "function Buffer(arg,encodingOrOffset,length){// Common case.\nif(typeof arg==='number'){if(typeof encodingOrOffset==='string'){throw new Error('If encoding is specified then the first argument must be a string');}return allocUnsafe(arg);}return from(arg,encodingOrOffset,length);}// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97", "title": "" }, { "docid": "41828d53feb7f84585b2d1d9d24e8ba5", "score": "0.5449142", "text": "function Buffer(arg,encodingOrOffset,length){// Common case.\nif(typeof arg==='number'){if(typeof encodingOrOffset==='string'){throw new Error('If encoding is specified then the first argument must be a string');}return allocUnsafe(arg);}return from(arg,encodingOrOffset,length);}// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97", "title": "" }, { "docid": "41828d53feb7f84585b2d1d9d24e8ba5", "score": "0.5449142", "text": "function Buffer(arg,encodingOrOffset,length){// Common case.\nif(typeof arg==='number'){if(typeof encodingOrOffset==='string'){throw new Error('If encoding is specified then the first argument must be a string');}return allocUnsafe(arg);}return from(arg,encodingOrOffset,length);}// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97", "title": "" }, { "docid": "f1ac94e7325321adfa0cf6faac122e36", "score": "0.5418863", "text": "function atob(data) {\n\t // Web IDL requires DOMStrings to just be converted using ECMAScript\n\t // ToString, which in our case amounts to using a template literal.\n\t data = `${data}`;\n\t // \"Remove all ASCII whitespace from data.\"\n\t data = data.replace(/[ \\t\\n\\f\\r]/g, \"\");\n\t // \"If data's length divides by 4 leaving no remainder, then: if data ends\n\t // with one or two U+003D (=) code points, then remove them from data.\"\n\t if (data.length % 4 === 0) {\n\t data = data.replace(/==?$/, \"\");\n\t }\n\t // \"If data's length divides by 4 leaving a remainder of 1, then return\n\t // failure.\"\n\t //\n\t // \"If data contains a code point that is not one of\n\t //\n\t // U+002B (+)\n\t // U+002F (/)\n\t // ASCII alphanumeric\n\t //\n\t // then return failure.\"\n\t if (data.length % 4 === 1 || /[^+/0-9A-Za-z]/.test(data)) {\n\t return null;\n\t }\n\t // \"Let output be an empty byte sequence.\"\n\t let output = \"\";\n\t // \"Let buffer be an empty buffer that can have bits appended to it.\"\n\t //\n\t // We append bits via left-shift and or. accumulatedBits is used to track\n\t // when we've gotten to 24 bits.\n\t let buffer = 0;\n\t let accumulatedBits = 0;\n\t // \"Let position be a position variable for data, initially pointing at the\n\t // start of data.\"\n\t //\n\t // \"While position does not point past the end of data:\"\n\t for (let i = 0; i < data.length; i++) {\n\t // \"Find the code point pointed to by position in the second column of\n\t // Table 1: The Base 64 Alphabet of RFC 4648. Let n be the number given in\n\t // the first cell of the same row.\n\t //\n\t // \"Append to buffer the six bits corresponding to n, most significant bit\n\t // first.\"\n\t //\n\t // atobLookup() implements the table from RFC 4648.\n\t buffer <<= 6;\n\t buffer |= atobLookup(data[i]);\n\t accumulatedBits += 6;\n\t // \"If buffer has accumulated 24 bits, interpret them as three 8-bit\n\t // big-endian numbers. Append three bytes with values equal to those\n\t // numbers to output, in the same order, and then empty buffer.\"\n\t if (accumulatedBits === 24) {\n\t output += String.fromCharCode((buffer & 0xff0000) >> 16);\n\t output += String.fromCharCode((buffer & 0xff00) >> 8);\n\t output += String.fromCharCode(buffer & 0xff);\n\t buffer = accumulatedBits = 0;\n\t }\n\t // \"Advance position by 1.\"\n\t }\n\t // \"If buffer is not empty, it contains either 12 or 18 bits. If it contains\n\t // 12 bits, then discard the last four and interpret the remaining eight as\n\t // an 8-bit big-endian number. If it contains 18 bits, then discard the last\n\t // two and interpret the remaining 16 as two 8-bit big-endian numbers. Append\n\t // the one or two bytes with values equal to those one or two numbers to\n\t // output, in the same order.\"\n\t if (accumulatedBits === 12) {\n\t buffer >>= 4;\n\t output += String.fromCharCode(buffer);\n\t } else if (accumulatedBits === 18) {\n\t buffer >>= 2;\n\t output += String.fromCharCode((buffer & 0xff00) >> 8);\n\t output += String.fromCharCode(buffer & 0xff);\n\t }\n\t // \"Return output.\"\n\t return output;\n\t}", "title": "" }, { "docid": "3765478870f115736503a17f77e472e4", "score": "0.5410434", "text": "[processData](data) {\n if (data.length < this[kBytesToRead]) {\n this[kBytesToRead] -= data.length;\n this[kPosition] += data.copy(this[kBuffer], this[kPosition]);\n } else {\n this[kPosition] += data.copy(\n this[kBuffer], this[kPosition], 0, this[kBytesToRead]\n );\n\n const tail = data.slice(this[kBytesToRead]);\n const length = extractLength(this[kBuffer]);\n\n if (this[kPosition] === parser.PACKET_HEADER_SIZE + length) {\n this[kPosition] = 0;\n this[kBytesToRead] = parser.PACKET_HEADER_SIZE;\n const size = parser.PACKET_HEADER_SIZE + length;\n const buffer = Buffer.alloc(size);\n this[kBuffer].copy(buffer, 0, 0, size);\n const packet = parser.parse(buffer);\n this[processPacket](packet);\n } else {\n this[kBytesToRead] =\n extractLength(this[kBuffer]) +\n parser.PACKET_HEADER_SIZE -\n this[kPosition];\n }\n\n if (tail.length) this[processData](tail);\n }\n }", "title": "" }, { "docid": "0d5f4cd72255326bf1e1a51bdf64909b", "score": "0.53875655", "text": "function atob(data) {\n // Web IDL requires DOMStrings to just be converted using ECMAScript\n // ToString, which in our case amounts to using a template literal.\n data = \"\".concat(data); // \"Remove all ASCII whitespace from data.\"\n\n data = data.replace(/[ \\t\\n\\f\\r]/g, \"\"); // \"If data's length divides by 4 leaving no remainder, then: if data ends\n // with one or two U+003D (=) code points, then remove them from data.\"\n\n if (data.length % 4 === 0) {\n data = data.replace(/==?$/, \"\");\n } // \"If data's length divides by 4 leaving a remainder of 1, then return\n // failure.\"\n //\n // \"If data contains a code point that is not one of\n //\n // U+002B (+)\n // U+002F (/)\n // ASCII alphanumeric\n //\n // then return failure.\"\n\n\n if (data.length % 4 === 1 || /[^+/0-9A-Za-z]/.test(data)) {\n return null;\n } // \"Let output be an empty byte sequence.\"\n\n\n var output = \"\"; // \"Let buffer be an empty buffer that can have bits appended to it.\"\n //\n // We append bits via left-shift and or. accumulatedBits is used to track\n // when we've gotten to 24 bits.\n\n var buffer = 0;\n var accumulatedBits = 0; // \"Let position be a position variable for data, initially pointing at the\n // start of data.\"\n //\n // \"While position does not point past the end of data:\"\n\n for (var i = 0; i < data.length; i++) {\n // \"Find the code point pointed to by position in the second column of\n // Table 1: The Base 64 Alphabet of RFC 4648. Let n be the number given in\n // the first cell of the same row.\n //\n // \"Append to buffer the six bits corresponding to n, most significant bit\n // first.\"\n //\n // atobLookup() implements the table from RFC 4648.\n buffer <<= 6;\n buffer |= atobLookup(data[i]);\n accumulatedBits += 6; // \"If buffer has accumulated 24 bits, interpret them as three 8-bit\n // big-endian numbers. Append three bytes with values equal to those\n // numbers to output, in the same order, and then empty buffer.\"\n\n if (accumulatedBits === 24) {\n output += String.fromCharCode((buffer & 0xff0000) >> 16);\n output += String.fromCharCode((buffer & 0xff00) >> 8);\n output += String.fromCharCode(buffer & 0xff);\n buffer = accumulatedBits = 0;\n } // \"Advance position by 1.\"\n\n } // \"If buffer is not empty, it contains either 12 or 18 bits. If it contains\n // 12 bits, then discard the last four and interpret the remaining eight as\n // an 8-bit big-endian number. If it contains 18 bits, then discard the last\n // two and interpret the remaining 16 as two 8-bit big-endian numbers. Append\n // the one or two bytes with values equal to those one or two numbers to\n // output, in the same order.\"\n\n\n if (accumulatedBits === 12) {\n buffer >>= 4;\n output += String.fromCharCode(buffer);\n } else if (accumulatedBits === 18) {\n buffer >>= 2;\n output += String.fromCharCode((buffer & 0xff00) >> 8);\n output += String.fromCharCode(buffer & 0xff);\n } // \"Return output.\"\n\n\n return output;\n}", "title": "" }, { "docid": "c36eedb62acd1f5f40e8a9f13887dfde", "score": "0.53798616", "text": "static encode(obj) {\n var buffer = [131]\n return this.encode_data(obj, buffer)\n }", "title": "" }, { "docid": "3f2962d3ab37c2cb4e0b7521293dda36", "score": "0.5353813", "text": "function buf2rstr(buf) { var r = ''; for (var i = 0; i < buf.length; i++) { r += String.fromCharCode(buf[i]); } return r; }", "title": "" }, { "docid": "46a6439650229bdc7c550404dc3058a8", "score": "0.5333754", "text": "function encode(input) {\n if (Array.isArray(input)) {\n var output = []\n for (var i = 0; i < input.length; i++) {\n output.push(encode(input[i]))\n }\n var buf = Buffer.concat(output)\n return Buffer.concat([encodeLength(buf.length, 192), buf])\n } else {\n var inputBuf = toBuffer(input)\n return inputBuf.length === 1 && inputBuf[0] < 128\n ? inputBuf\n : Buffer.concat([encodeLength(inputBuf.length, 128), inputBuf])\n }\n }", "title": "" }, { "docid": "f2be0056fdefcc8e612bdfde84a300fe", "score": "0.5331914", "text": "function atob$1(data) {\n // Web IDL requires DOMStrings to just be converted using ECMAScript\n // ToString, which in our case amounts to using a template literal.\n data = \"\".concat(data); // \"Remove all ASCII whitespace from data.\"\n\n data = data.replace(/[ \\t\\n\\f\\r]/g, \"\"); // \"If data's length divides by 4 leaving no remainder, then: if data ends\n // with one or two U+003D (=) code points, then remove them from data.\"\n\n if (data.length % 4 === 0) {\n data = data.replace(/==?$/, \"\");\n } // \"If data's length divides by 4 leaving a remainder of 1, then return\n // failure.\"\n //\n // \"If data contains a code point that is not one of\n //\n // U+002B (+)\n // U+002F (/)\n // ASCII alphanumeric\n //\n // then return failure.\"\n\n\n if (data.length % 4 === 1 || /[^+/0-9A-Za-z]/.test(data)) {\n return null;\n } // \"Let output be an empty byte sequence.\"\n\n\n var output = \"\"; // \"Let buffer be an empty buffer that can have bits appended to it.\"\n //\n // We append bits via left-shift and or. accumulatedBits is used to track\n // when we've gotten to 24 bits.\n\n var buffer = 0;\n var accumulatedBits = 0; // \"Let position be a position variable for data, initially pointing at the\n // start of data.\"\n //\n // \"While position does not point past the end of data:\"\n\n for (var i = 0; i < data.length; i++) {\n // \"Find the code point pointed to by position in the second column of\n // Table 1: The Base 64 Alphabet of RFC 4648. Let n be the number given in\n // the first cell of the same row.\n //\n // \"Append to buffer the six bits corresponding to n, most significant bit\n // first.\"\n //\n // atobLookup() implements the table from RFC 4648.\n buffer <<= 6;\n buffer |= atobLookup(data[i]);\n accumulatedBits += 6; // \"If buffer has accumulated 24 bits, interpret them as three 8-bit\n // big-endian numbers. Append three bytes with values equal to those\n // numbers to output, in the same order, and then empty buffer.\"\n\n if (accumulatedBits === 24) {\n output += String.fromCharCode((buffer & 0xff0000) >> 16);\n output += String.fromCharCode((buffer & 0xff00) >> 8);\n output += String.fromCharCode(buffer & 0xff);\n buffer = accumulatedBits = 0;\n } // \"Advance position by 1.\"\n\n } // \"If buffer is not empty, it contains either 12 or 18 bits. If it contains\n // 12 bits, then discard the last four and interpret the remaining eight as\n // an 8-bit big-endian number. If it contains 18 bits, then discard the last\n // two and interpret the remaining 16 as two 8-bit big-endian numbers. Append\n // the one or two bytes with values equal to those one or two numbers to\n // output, in the same order.\"\n\n\n if (accumulatedBits === 12) {\n buffer >>= 4;\n output += String.fromCharCode(buffer);\n } else if (accumulatedBits === 18) {\n buffer >>= 2;\n output += String.fromCharCode((buffer & 0xff00) >> 8);\n output += String.fromCharCode(buffer & 0xff);\n } // \"Return output.\"\n\n\n return output;\n }", "title": "" }, { "docid": "5e320802277dffac91e4b1795fec8dac", "score": "0.53277117", "text": "function inflate(data, usz) {\n\t/* shortcircuit for empty buffer [0x03, 0x00] */\n\tif(data[0] == 3 && !(data[1] & 0x3)) { return [new_raw_buf(usz), 2]; }\n\n\t/* bit offset */\n\tvar boff = 0;\n\n\t/* header includes final bit and type bits */\n\tvar header = 0;\n\n\tvar outbuf = new_unsafe_buf(usz ? usz : (1<<18));\n\tvar woff = 0;\n\tvar OL = outbuf.length>>>0;\n\tvar max_len_1 = 0, max_len_2 = 0;\n\n\twhile((header&1) == 0) {\n\t\theader = read_bits_3(data, boff); boff += 3;\n\t\tif((header >>> 1) == 0) {\n\t\t\t/* Stored block */\n\t\t\tif(boff & 7) boff += 8 - (boff&7);\n\t\t\t/* 2 bytes sz, 2 bytes bit inverse */\n\t\t\tvar sz = data[boff>>>3] | data[(boff>>>3)+1]<<8;\n\t\t\tboff += 32;\n\t\t\t/* push sz bytes */\n\t\t\tif(!usz && OL < woff + sz) { outbuf = realloc(outbuf, woff + sz); OL = outbuf.length; }\n\t\t\tif(typeof data.copy === 'function') {\n\t\t\t\t// $FlowIgnore\n\t\t\t\tdata.copy(outbuf, woff, boff>>>3, (boff>>>3)+sz);\n\t\t\t\twoff += sz; boff += 8*sz;\n\t\t\t} else while(sz-- > 0) { outbuf[woff++] = data[boff>>>3]; boff += 8; }\n\t\t\tcontinue;\n\t\t} else if((header >>> 1) == 1) {\n\t\t\t/* Fixed Huffman */\n\t\t\tmax_len_1 = 9; max_len_2 = 5;\n\t\t} else {\n\t\t\t/* Dynamic Huffman */\n\t\t\tboff = dyn(data, boff);\n\t\t\tmax_len_1 = dyn_len_1; max_len_2 = dyn_len_2;\n\t\t}\n\t\tif(!usz && (OL < woff + 32767)) { outbuf = realloc(outbuf, woff + 32767); OL = outbuf.length; }\n\t\tfor(;;) { // while(true) is apparently out of vogue in modern JS circles\n\t\t\t/* ingest code and move read head */\n\t\t\tvar bits = read_bits_n(data, boff, max_len_1);\n\t\t\tvar code = (header>>>1) == 1 ? fix_lmap[bits] : dyn_lmap[bits];\n\t\t\tboff += code & 15; code >>>= 4;\n\t\t\t/* 0-255 are literals, 256 is end of block token, 257+ are copy tokens */\n\t\t\tif(((code>>>8)&0xFF) === 0) outbuf[woff++] = code;\n\t\t\telse if(code == 256) break;\n\t\t\telse {\n\t\t\t\tcode -= 257;\n\t\t\t\tvar len_eb = (code < 8) ? 0 : ((code-4)>>2); if(len_eb > 5) len_eb = 0;\n\t\t\t\tvar tgt = woff + LEN_LN[code];\n\t\t\t\t/* length extra bits */\n\t\t\t\tif(len_eb > 0) {\n\t\t\t\t\ttgt += read_bits_n(data, boff, len_eb);\n\t\t\t\t\tboff += len_eb;\n\t\t\t\t}\n\n\t\t\t\t/* dist code */\n\t\t\t\tbits = read_bits_n(data, boff, max_len_2);\n\t\t\t\tcode = (header>>>1) == 1 ? fix_dmap[bits] : dyn_dmap[bits];\n\t\t\t\tboff += code & 15; code >>>= 4;\n\t\t\t\tvar dst_eb = (code < 4 ? 0 : (code-2)>>1);\n\t\t\t\tvar dst = DST_LN[code];\n\t\t\t\t/* dist extra bits */\n\t\t\t\tif(dst_eb > 0) {\n\t\t\t\t\tdst += read_bits_n(data, boff, dst_eb);\n\t\t\t\t\tboff += dst_eb;\n\t\t\t\t}\n\n\t\t\t\t/* in the common case, manual byte copy is faster than TA set / Buffer copy */\n\t\t\t\tif(!usz && OL < tgt) { outbuf = realloc(outbuf, tgt); OL = outbuf.length; }\n\t\t\t\twhile(woff < tgt) { outbuf[woff] = outbuf[woff - dst]; ++woff; }\n\t\t\t}\n\t\t}\n\t}\n\treturn [usz ? outbuf : outbuf.slice(0, woff), (boff+7)>>>3];\n}", "title": "" }, { "docid": "5e320802277dffac91e4b1795fec8dac", "score": "0.53277117", "text": "function inflate(data, usz) {\n\t/* shortcircuit for empty buffer [0x03, 0x00] */\n\tif(data[0] == 3 && !(data[1] & 0x3)) { return [new_raw_buf(usz), 2]; }\n\n\t/* bit offset */\n\tvar boff = 0;\n\n\t/* header includes final bit and type bits */\n\tvar header = 0;\n\n\tvar outbuf = new_unsafe_buf(usz ? usz : (1<<18));\n\tvar woff = 0;\n\tvar OL = outbuf.length>>>0;\n\tvar max_len_1 = 0, max_len_2 = 0;\n\n\twhile((header&1) == 0) {\n\t\theader = read_bits_3(data, boff); boff += 3;\n\t\tif((header >>> 1) == 0) {\n\t\t\t/* Stored block */\n\t\t\tif(boff & 7) boff += 8 - (boff&7);\n\t\t\t/* 2 bytes sz, 2 bytes bit inverse */\n\t\t\tvar sz = data[boff>>>3] | data[(boff>>>3)+1]<<8;\n\t\t\tboff += 32;\n\t\t\t/* push sz bytes */\n\t\t\tif(!usz && OL < woff + sz) { outbuf = realloc(outbuf, woff + sz); OL = outbuf.length; }\n\t\t\tif(typeof data.copy === 'function') {\n\t\t\t\t// $FlowIgnore\n\t\t\t\tdata.copy(outbuf, woff, boff>>>3, (boff>>>3)+sz);\n\t\t\t\twoff += sz; boff += 8*sz;\n\t\t\t} else while(sz-- > 0) { outbuf[woff++] = data[boff>>>3]; boff += 8; }\n\t\t\tcontinue;\n\t\t} else if((header >>> 1) == 1) {\n\t\t\t/* Fixed Huffman */\n\t\t\tmax_len_1 = 9; max_len_2 = 5;\n\t\t} else {\n\t\t\t/* Dynamic Huffman */\n\t\t\tboff = dyn(data, boff);\n\t\t\tmax_len_1 = dyn_len_1; max_len_2 = dyn_len_2;\n\t\t}\n\t\tif(!usz && (OL < woff + 32767)) { outbuf = realloc(outbuf, woff + 32767); OL = outbuf.length; }\n\t\tfor(;;) { // while(true) is apparently out of vogue in modern JS circles\n\t\t\t/* ingest code and move read head */\n\t\t\tvar bits = read_bits_n(data, boff, max_len_1);\n\t\t\tvar code = (header>>>1) == 1 ? fix_lmap[bits] : dyn_lmap[bits];\n\t\t\tboff += code & 15; code >>>= 4;\n\t\t\t/* 0-255 are literals, 256 is end of block token, 257+ are copy tokens */\n\t\t\tif(((code>>>8)&0xFF) === 0) outbuf[woff++] = code;\n\t\t\telse if(code == 256) break;\n\t\t\telse {\n\t\t\t\tcode -= 257;\n\t\t\t\tvar len_eb = (code < 8) ? 0 : ((code-4)>>2); if(len_eb > 5) len_eb = 0;\n\t\t\t\tvar tgt = woff + LEN_LN[code];\n\t\t\t\t/* length extra bits */\n\t\t\t\tif(len_eb > 0) {\n\t\t\t\t\ttgt += read_bits_n(data, boff, len_eb);\n\t\t\t\t\tboff += len_eb;\n\t\t\t\t}\n\n\t\t\t\t/* dist code */\n\t\t\t\tbits = read_bits_n(data, boff, max_len_2);\n\t\t\t\tcode = (header>>>1) == 1 ? fix_dmap[bits] : dyn_dmap[bits];\n\t\t\t\tboff += code & 15; code >>>= 4;\n\t\t\t\tvar dst_eb = (code < 4 ? 0 : (code-2)>>1);\n\t\t\t\tvar dst = DST_LN[code];\n\t\t\t\t/* dist extra bits */\n\t\t\t\tif(dst_eb > 0) {\n\t\t\t\t\tdst += read_bits_n(data, boff, dst_eb);\n\t\t\t\t\tboff += dst_eb;\n\t\t\t\t}\n\n\t\t\t\t/* in the common case, manual byte copy is faster than TA set / Buffer copy */\n\t\t\t\tif(!usz && OL < tgt) { outbuf = realloc(outbuf, tgt); OL = outbuf.length; }\n\t\t\t\twhile(woff < tgt) { outbuf[woff] = outbuf[woff - dst]; ++woff; }\n\t\t\t}\n\t\t}\n\t}\n\treturn [usz ? outbuf : outbuf.slice(0, woff), (boff+7)>>>3];\n}", "title": "" }, { "docid": "5e320802277dffac91e4b1795fec8dac", "score": "0.53277117", "text": "function inflate(data, usz) {\n\t/* shortcircuit for empty buffer [0x03, 0x00] */\n\tif(data[0] == 3 && !(data[1] & 0x3)) { return [new_raw_buf(usz), 2]; }\n\n\t/* bit offset */\n\tvar boff = 0;\n\n\t/* header includes final bit and type bits */\n\tvar header = 0;\n\n\tvar outbuf = new_unsafe_buf(usz ? usz : (1<<18));\n\tvar woff = 0;\n\tvar OL = outbuf.length>>>0;\n\tvar max_len_1 = 0, max_len_2 = 0;\n\n\twhile((header&1) == 0) {\n\t\theader = read_bits_3(data, boff); boff += 3;\n\t\tif((header >>> 1) == 0) {\n\t\t\t/* Stored block */\n\t\t\tif(boff & 7) boff += 8 - (boff&7);\n\t\t\t/* 2 bytes sz, 2 bytes bit inverse */\n\t\t\tvar sz = data[boff>>>3] | data[(boff>>>3)+1]<<8;\n\t\t\tboff += 32;\n\t\t\t/* push sz bytes */\n\t\t\tif(!usz && OL < woff + sz) { outbuf = realloc(outbuf, woff + sz); OL = outbuf.length; }\n\t\t\tif(typeof data.copy === 'function') {\n\t\t\t\t// $FlowIgnore\n\t\t\t\tdata.copy(outbuf, woff, boff>>>3, (boff>>>3)+sz);\n\t\t\t\twoff += sz; boff += 8*sz;\n\t\t\t} else while(sz-- > 0) { outbuf[woff++] = data[boff>>>3]; boff += 8; }\n\t\t\tcontinue;\n\t\t} else if((header >>> 1) == 1) {\n\t\t\t/* Fixed Huffman */\n\t\t\tmax_len_1 = 9; max_len_2 = 5;\n\t\t} else {\n\t\t\t/* Dynamic Huffman */\n\t\t\tboff = dyn(data, boff);\n\t\t\tmax_len_1 = dyn_len_1; max_len_2 = dyn_len_2;\n\t\t}\n\t\tif(!usz && (OL < woff + 32767)) { outbuf = realloc(outbuf, woff + 32767); OL = outbuf.length; }\n\t\tfor(;;) { // while(true) is apparently out of vogue in modern JS circles\n\t\t\t/* ingest code and move read head */\n\t\t\tvar bits = read_bits_n(data, boff, max_len_1);\n\t\t\tvar code = (header>>>1) == 1 ? fix_lmap[bits] : dyn_lmap[bits];\n\t\t\tboff += code & 15; code >>>= 4;\n\t\t\t/* 0-255 are literals, 256 is end of block token, 257+ are copy tokens */\n\t\t\tif(((code>>>8)&0xFF) === 0) outbuf[woff++] = code;\n\t\t\telse if(code == 256) break;\n\t\t\telse {\n\t\t\t\tcode -= 257;\n\t\t\t\tvar len_eb = (code < 8) ? 0 : ((code-4)>>2); if(len_eb > 5) len_eb = 0;\n\t\t\t\tvar tgt = woff + LEN_LN[code];\n\t\t\t\t/* length extra bits */\n\t\t\t\tif(len_eb > 0) {\n\t\t\t\t\ttgt += read_bits_n(data, boff, len_eb);\n\t\t\t\t\tboff += len_eb;\n\t\t\t\t}\n\n\t\t\t\t/* dist code */\n\t\t\t\tbits = read_bits_n(data, boff, max_len_2);\n\t\t\t\tcode = (header>>>1) == 1 ? fix_dmap[bits] : dyn_dmap[bits];\n\t\t\t\tboff += code & 15; code >>>= 4;\n\t\t\t\tvar dst_eb = (code < 4 ? 0 : (code-2)>>1);\n\t\t\t\tvar dst = DST_LN[code];\n\t\t\t\t/* dist extra bits */\n\t\t\t\tif(dst_eb > 0) {\n\t\t\t\t\tdst += read_bits_n(data, boff, dst_eb);\n\t\t\t\t\tboff += dst_eb;\n\t\t\t\t}\n\n\t\t\t\t/* in the common case, manual byte copy is faster than TA set / Buffer copy */\n\t\t\t\tif(!usz && OL < tgt) { outbuf = realloc(outbuf, tgt); OL = outbuf.length; }\n\t\t\t\twhile(woff < tgt) { outbuf[woff] = outbuf[woff - dst]; ++woff; }\n\t\t\t}\n\t\t}\n\t}\n\treturn [usz ? outbuf : outbuf.slice(0, woff), (boff+7)>>>3];\n}", "title": "" }, { "docid": "5e320802277dffac91e4b1795fec8dac", "score": "0.53277117", "text": "function inflate(data, usz) {\n\t/* shortcircuit for empty buffer [0x03, 0x00] */\n\tif(data[0] == 3 && !(data[1] & 0x3)) { return [new_raw_buf(usz), 2]; }\n\n\t/* bit offset */\n\tvar boff = 0;\n\n\t/* header includes final bit and type bits */\n\tvar header = 0;\n\n\tvar outbuf = new_unsafe_buf(usz ? usz : (1<<18));\n\tvar woff = 0;\n\tvar OL = outbuf.length>>>0;\n\tvar max_len_1 = 0, max_len_2 = 0;\n\n\twhile((header&1) == 0) {\n\t\theader = read_bits_3(data, boff); boff += 3;\n\t\tif((header >>> 1) == 0) {\n\t\t\t/* Stored block */\n\t\t\tif(boff & 7) boff += 8 - (boff&7);\n\t\t\t/* 2 bytes sz, 2 bytes bit inverse */\n\t\t\tvar sz = data[boff>>>3] | data[(boff>>>3)+1]<<8;\n\t\t\tboff += 32;\n\t\t\t/* push sz bytes */\n\t\t\tif(!usz && OL < woff + sz) { outbuf = realloc(outbuf, woff + sz); OL = outbuf.length; }\n\t\t\tif(typeof data.copy === 'function') {\n\t\t\t\t// $FlowIgnore\n\t\t\t\tdata.copy(outbuf, woff, boff>>>3, (boff>>>3)+sz);\n\t\t\t\twoff += sz; boff += 8*sz;\n\t\t\t} else while(sz-- > 0) { outbuf[woff++] = data[boff>>>3]; boff += 8; }\n\t\t\tcontinue;\n\t\t} else if((header >>> 1) == 1) {\n\t\t\t/* Fixed Huffman */\n\t\t\tmax_len_1 = 9; max_len_2 = 5;\n\t\t} else {\n\t\t\t/* Dynamic Huffman */\n\t\t\tboff = dyn(data, boff);\n\t\t\tmax_len_1 = dyn_len_1; max_len_2 = dyn_len_2;\n\t\t}\n\t\tif(!usz && (OL < woff + 32767)) { outbuf = realloc(outbuf, woff + 32767); OL = outbuf.length; }\n\t\tfor(;;) { // while(true) is apparently out of vogue in modern JS circles\n\t\t\t/* ingest code and move read head */\n\t\t\tvar bits = read_bits_n(data, boff, max_len_1);\n\t\t\tvar code = (header>>>1) == 1 ? fix_lmap[bits] : dyn_lmap[bits];\n\t\t\tboff += code & 15; code >>>= 4;\n\t\t\t/* 0-255 are literals, 256 is end of block token, 257+ are copy tokens */\n\t\t\tif(((code>>>8)&0xFF) === 0) outbuf[woff++] = code;\n\t\t\telse if(code == 256) break;\n\t\t\telse {\n\t\t\t\tcode -= 257;\n\t\t\t\tvar len_eb = (code < 8) ? 0 : ((code-4)>>2); if(len_eb > 5) len_eb = 0;\n\t\t\t\tvar tgt = woff + LEN_LN[code];\n\t\t\t\t/* length extra bits */\n\t\t\t\tif(len_eb > 0) {\n\t\t\t\t\ttgt += read_bits_n(data, boff, len_eb);\n\t\t\t\t\tboff += len_eb;\n\t\t\t\t}\n\n\t\t\t\t/* dist code */\n\t\t\t\tbits = read_bits_n(data, boff, max_len_2);\n\t\t\t\tcode = (header>>>1) == 1 ? fix_dmap[bits] : dyn_dmap[bits];\n\t\t\t\tboff += code & 15; code >>>= 4;\n\t\t\t\tvar dst_eb = (code < 4 ? 0 : (code-2)>>1);\n\t\t\t\tvar dst = DST_LN[code];\n\t\t\t\t/* dist extra bits */\n\t\t\t\tif(dst_eb > 0) {\n\t\t\t\t\tdst += read_bits_n(data, boff, dst_eb);\n\t\t\t\t\tboff += dst_eb;\n\t\t\t\t}\n\n\t\t\t\t/* in the common case, manual byte copy is faster than TA set / Buffer copy */\n\t\t\t\tif(!usz && OL < tgt) { outbuf = realloc(outbuf, tgt); OL = outbuf.length; }\n\t\t\t\twhile(woff < tgt) { outbuf[woff] = outbuf[woff - dst]; ++woff; }\n\t\t\t}\n\t\t}\n\t}\n\treturn [usz ? outbuf : outbuf.slice(0, woff), (boff+7)>>>3];\n}", "title": "" }, { "docid": "545771bfae5e7780c9a4fcd9b455ab01", "score": "0.5321486", "text": "function Buffer(arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === \"number\") {\n if (typeof encodingOrOffset === \"string\") {\n throw new Error(\n \"If encoding is specified then the first argument must be a string\"\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n }", "title": "" }, { "docid": "3afe70d8da4d0ee3aaa8cfb2a70c4c4d", "score": "0.5315603", "text": "nextString(fixedLength) {\n let idx = this.offset;\n while (this.buffer[idx] !== 0x00) {\n idx++;\n }\n let strBuffer = this.buffer.slice(this.offset, idx);\n this.offset += fixedLength;\n return strBuffer.toString('latin1');\n }", "title": "" }, { "docid": "8a30a150ae8ed4322a53655d31ef1b40", "score": "0.5307735", "text": "function lengthEncoding (path, field) {\n const element = field.body.fields[field.body.fields.length - 1]\n const I = `$I[${++$I}]`\n if (element.type == 'buffer') {\n return map(dispatch, I, field.body.encoding)\n }\n return $(`\n `, map(dispatch, I, field.body.encoding), `\n $i[${++$i}] = 0\n `)\n }", "title": "" }, { "docid": "08aba37abde25f231d08ac046f923250", "score": "0.53053516", "text": "static getEncodedData(correctedBits) {\n let endIndex = correctedBits.length;\n let latchTable = Table.UPPER; // table most recently latched to\n let shiftTable = Table.UPPER; // table to use for the next read\n let result = '';\n let index = 0;\n while (index < endIndex) {\n if (shiftTable === Table.BINARY) {\n if (endIndex - index < 5) {\n break;\n }\n let length = Decoder.readCode(correctedBits, index, 5);\n index += 5;\n if (length === 0) {\n if (endIndex - index < 11) {\n break;\n }\n length = Decoder.readCode(correctedBits, index, 11) + 31;\n index += 11;\n }\n for (let charCount = 0; charCount < length; charCount++) {\n if (endIndex - index < 8) {\n index = endIndex; // Force outer loop to exit\n break;\n }\n const code = Decoder.readCode(correctedBits, index, 8);\n result += /*(char)*/ StringUtils.castAsNonUtf8Char(code);\n index += 8;\n }\n // Go back to whatever mode we had been in\n shiftTable = latchTable;\n }\n else {\n let size = shiftTable === Table.DIGIT ? 4 : 5;\n if (endIndex - index < size) {\n break;\n }\n let code = Decoder.readCode(correctedBits, index, size);\n index += size;\n let str = Decoder.getCharacter(shiftTable, code);\n if (str.startsWith('CTRL_')) {\n // Table changes\n // ISO/IEC 24778:2008 prescribes ending a shift sequence in the mode from which it was invoked.\n // That's including when that mode is a shift.\n // Our test case dlusbs.png for issue #642 exercises that.\n latchTable = shiftTable; // Latch the current mode, so as to return to Upper after U/S B/S\n shiftTable = Decoder.getTable(str.charAt(5));\n if (str.charAt(6) === 'L') {\n latchTable = shiftTable;\n }\n }\n else {\n result += str;\n // Go back to whatever mode we had been in\n shiftTable = latchTable;\n }\n }\n }\n return result;\n }", "title": "" }, { "docid": "785e8827a433394f368bdf3e0b1bcb3b", "score": "0.52910227", "text": "function Buffer(arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error('If encoding is specified then the first argument must be a string');\n }\n return allocUnsafe(arg);\n }\n return from(arg, encodingOrOffset, length);\n }", "title": "" }, { "docid": "8d46652898273c97cdd580c10881fc67", "score": "0.5290348", "text": "function buf2binstring(buf,len){ // use fallback for big arrays to avoid stack overflow\n if(len<65537){if(buf.subarray&&STR_APPLY_UIA_OK||!buf.subarray&&STR_APPLY_OK){return String.fromCharCode.apply(null,utils.shrinkBuf(buf,len));}}var result='';for(var i=0;i<len;i++){result+=String.fromCharCode(buf[i]);}return result;} // Convert byte array to binary string", "title": "" }, { "docid": "ab0cbadb51327c27a8bce9f94970edb2", "score": "0.52832353", "text": "function reverseBytes(data) {\n\t// Your code goes here\n}", "title": "" }, { "docid": "d2de807cc1915dc841448d5b2a8f6177", "score": "0.5282228", "text": "function convertBufferToBase64(arrayBuffer) {\n var base64 = '';\n var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n var bytes = new Uint8Array(arrayBuffer.buffer);\n var byteLength = bytes.byteLength;\n var byteRemainder = byteLength % 3;\n var mainLength = byteLength - byteRemainder;\n var a, b, c, d;\n var chunk; // Main loop deals with bytes in chunks of 3\n\n for (var i = 0; i < mainLength; i = i + 3) {\n // Combine the three bytes into a single integer\n chunk = bytes[i] << 16 | bytes[i + 1] << 8 | bytes[i + 2]; // Use bitmasks to extract 6-bit segments from the triplet\n\n a = (chunk & 16515072) >> 18; // 16515072 = (2^6 - 1) << 18\n\n b = (chunk & 258048) >> 12; // 258048 = (2^6 - 1) << 12\n\n c = (chunk & 4032) >> 6; // 4032 = (2^6 - 1) << 6\n\n d = chunk & 63; // 63 = 2^6 - 1\n // Convert the raw binary segments to the appropriate ASCII encoding\n\n base64 += encodings[a] + encodings[b] + encodings[c] + encodings[d];\n } // Deal with the remaining bytes and padding\n\n\n if (byteRemainder === 1) {\n chunk = bytes[mainLength];\n a = (chunk & 252) >> 2; // 252 = (2^6 - 1) << 2\n // Set the 4 least significant bits to zero\n\n b = (chunk & 3) << 4; // 3 = 2^2 - 1\n\n base64 += encodings[a] + encodings[b] + '==';\n } else if (byteRemainder === 2) {\n chunk = bytes[mainLength] << 8 | bytes[mainLength + 1];\n a = (chunk & 64512) >> 10; // 64512 = (2^6 - 1) << 10\n\n b = (chunk & 1008) >> 4; // 1008 = (2^6 - 1) << 4\n // Set the 2 least significant bits to zero\n\n c = (chunk & 15) << 2; // 15 = 2^4 - 1\n\n base64 += encodings[a] + encodings[b] + encodings[c] + '=';\n }\n\n return base64;\n}", "title": "" }, { "docid": "91ba357925683866bfe5cd5085e435ec", "score": "0.52768517", "text": "function atob(data) {\n // Web IDL requires DOMStrings to just be converted using ECMAScript\n // ToString, which in our case amounts to using a template literal.\n data = `${data}`;\n // \"Remove all ASCII whitespace from data.\"\n data = data.replace(/[ \\t\\n\\f\\r]/g, \"\");\n // \"If data's length divides by 4 leaving no remainder, then: if data ends\n // with one or two U+003D (=) code points, then remove them from data.\"\n if (data.length % 4 === 0) {\n data = data.replace(/==?$/, \"\");\n }\n // \"If data's length divides by 4 leaving a remainder of 1, then return\n // failure.\"\n //\n // \"If data contains a code point that is not one of\n //\n // U+002B (+)\n // U+002F (/)\n // ASCII alphanumeric\n //\n // then return failure.\"\n if (data.length % 4 === 1 || /[^+/0-9A-Za-z]/.test(data)) {\n return null;\n }\n // \"Let output be an empty byte sequence.\"\n let output = \"\";\n // \"Let buffer be an empty buffer that can have bits appended to it.\"\n //\n // We append bits via left-shift and or. accumulatedBits is used to track\n // when we've gotten to 24 bits.\n let buffer = 0;\n let accumulatedBits = 0;\n // \"Let position be a position variable for data, initially pointing at the\n // start of data.\"\n //\n // \"While position does not point past the end of data:\"\n for (let i = 0; i < data.length; i++) {\n // \"Find the code point pointed to by position in the second column of\n // Table 1: The Base 64 Alphabet of RFC 4648. Let n be the number given in\n // the first cell of the same row.\n //\n // \"Append to buffer the six bits corresponding to n, most significant bit\n // first.\"\n //\n // atobLookup() implements the table from RFC 4648.\n buffer <<= 6;\n buffer |= atobLookup(data[i]);\n accumulatedBits += 6;\n // \"If buffer has accumulated 24 bits, interpret them as three 8-bit\n // big-endian numbers. Append three bytes with values equal to those\n // numbers to output, in the same order, and then empty buffer.\"\n if (accumulatedBits === 24) {\n output += String.fromCharCode((buffer & 0xff0000) >> 16);\n output += String.fromCharCode((buffer & 0xff00) >> 8);\n output += String.fromCharCode(buffer & 0xff);\n buffer = accumulatedBits = 0;\n }\n // \"Advance position by 1.\"\n }\n // \"If buffer is not empty, it contains either 12 or 18 bits. If it contains\n // 12 bits, then discard the last four and interpret the remaining eight as\n // an 8-bit big-endian number. If it contains 18 bits, then discard the last\n // two and interpret the remaining 16 as two 8-bit big-endian numbers. Append\n // the one or two bytes with values equal to those one or two numbers to\n // output, in the same order.\"\n if (accumulatedBits === 12) {\n buffer >>= 4;\n output += String.fromCharCode(buffer);\n } else if (accumulatedBits === 18) {\n buffer >>= 2;\n output += String.fromCharCode((buffer & 0xff00) >> 8);\n output += String.fromCharCode(buffer & 0xff);\n }\n // \"Return output.\"\n return output;\n}", "title": "" }, { "docid": "8f73600a22f29325a8e2cf5d22ef6925", "score": "0.52745354", "text": "function Buffer(arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number');\n\n }\n return allocUnsafe(arg);\n }\n return from(arg, encodingOrOffset, length);\n }", "title": "" }, { "docid": "e1e469d5c23c3071010f66435a354252", "score": "0.5273711", "text": "function Buffer(arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === \"number\") {\n if (typeof encodingOrOffset === \"string\") {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n );\n }\n return allocUnsafe(arg);\n }\n return from(arg, encodingOrOffset, length);\n }", "title": "" }, { "docid": "c63c21160edb30c2f1ef1e61698bf340", "score": "0.52676696", "text": "function i(n){var t=n;return e.isBuffer(t)||(t=e.from(t)),r.default.encode(t)}", "title": "" }, { "docid": "878037085babc1268f38690fbdff51f4", "score": "0.52649975", "text": "function atob(data) {\n // Web IDL requires DOMStrings to just be converted using ECMAScript\n // ToString, which in our case amounts to using a template literal.\n data = `${data}`;\n // \"Remove all ASCII whitespace from data.\"\n data = data.replace(/[ \\t\\n\\f\\r]/g, '');\n // \"If data's length divides by 4 leaving no remainder, then: if data ends\n // with one or two U+003D (=) code points, then remove them from data.\"\n if (data.length % 4 === 0) {\n data = data.replace(/==?$/, '');\n }\n // \"If data's length divides by 4 leaving a remainder of 1, then return\n // failure.\"\n //\n // \"If data contains a code point that is not one of\n //\n // U+002B (+)\n // U+002F (/)\n // ASCII alphanumeric\n //\n // then return failure.\"\n if (data.length % 4 === 1 || /[^+/0-9A-Za-z]/.test(data)) {\n return null;\n }\n // \"Let output be an empty byte sequence.\"\n let output = '';\n // \"Let buffer be an empty buffer that can have bits appended to it.\"\n //\n // We append bits via left-shift and or. accumulatedBits is used to track\n // when we've gotten to 24 bits.\n let buffer = 0;\n let accumulatedBits = 0;\n // \"Let position be a position variable for data, initially pointing at the\n // start of data.\"\n //\n // \"While position does not point past the end of data:\"\n for (let i = 0; i < data.length; i++) {\n // \"Find the code point pointed to by position in the second column of\n // Table 1: The Base 64 Alphabet of RFC 4648. Let n be the number given in\n // the first cell of the same row.\n //\n // \"Append to buffer the six bits corresponding to n, most significant bit\n // first.\"\n //\n // atobLookup() implements the table from RFC 4648.\n buffer <<= 6;\n buffer |= atobLookup(data[i]);\n accumulatedBits += 6;\n // \"If buffer has accumulated 24 bits, interpret them as three 8-bit\n // big-endian numbers. Append three bytes with values equal to those\n // numbers to output, in the same order, and then empty buffer.\"\n if (accumulatedBits === 24) {\n output += String.fromCharCode((buffer & 0xff0000) >> 16);\n output += String.fromCharCode((buffer & 0xff00) >> 8);\n output += String.fromCharCode(buffer & 0xff);\n buffer = accumulatedBits = 0;\n }\n // \"Advance position by 1.\"\n }\n // \"If buffer is not empty, it contains either 12 or 18 bits. If it contains\n // 12 bits, then discard the last four and interpret the remaining eight as\n // an 8-bit big-endian number. If it contains 18 bits, then discard the last\n // two and interpret the remaining 16 as two 8-bit big-endian numbers. Append\n // the one or two bytes with values equal to those one or two numbers to\n // output, in the same order.\"\n if (accumulatedBits === 12) {\n buffer >>= 4;\n output += String.fromCharCode(buffer);\n } else if (accumulatedBits === 18) {\n buffer >>= 2;\n output += String.fromCharCode((buffer & 0xff00) >> 8);\n output += String.fromCharCode(buffer & 0xff);\n }\n // \"Return output.\"\n return output;\n}", "title": "" }, { "docid": "74fd243a8a26fe7a7c720e2edadb8197", "score": "0.5263917", "text": "function Buffer(arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n }", "title": "" }, { "docid": "46e7e73c07a8fa39d7b7acd88ce34ab5", "score": "0.52600664", "text": "function toBuffer(\n data\n) {\n // Buffer.from(buffer) copies which we don't want here\n if (data instanceof _LiteBuffer.LiteBuffer) {\n return data;\n }\n (0, _invariant2.default)(\n data instanceof ArrayBuffer,\n 'RSocketBufferUtils: Cannot construct buffer. Expected data to be an ' +\n 'arraybuffer, got `%s`.',\n data\n );\n return _LiteBuffer.LiteBuffer.from(data);\n}", "title": "" }, { "docid": "4596184a8b9b91a5e8e0b1235de48271", "score": "0.52590716", "text": "function Buffer(arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === \"number\") {\n if (typeof encodingOrOffset === \"string\") {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n );\n }\n return allocUnsafe(arg);\n }\n return from(arg, encodingOrOffset, length);\n }", "title": "" }, { "docid": "b47fda72d0aa29f6e2b9447b01a9f4e9", "score": "0.52546436", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n }", "title": "" }, { "docid": "f122e693786906493a395ec4078ee203", "score": "0.5254434", "text": "function Buffer(arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError('The \"string\" argument must be of type string. Received type number')\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n }", "title": "" }, { "docid": "146fcce716942a8c204424fd41afded0", "score": "0.52503854", "text": "function Buffer(arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n }", "title": "" }, { "docid": "3702f5401c2439ac4b7e4f6f022d33f2", "score": "0.5238191", "text": "function Buffer(arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === \"number\") {\n if (typeof encodingOrOffset === \"string\") {\n throw new Error(\n \"If encoding is specified then the first argument must be a string\"\n );\n }\n return allocUnsafe(arg);\n }\n return from(arg, encodingOrOffset, length);\n }", "title": "" }, { "docid": "d77b3579fe4796faeacf22827c28de1c", "score": "0.5228957", "text": "function Buffer(arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error('If encoding is specified then the first argument must be a string');\n }\n\n return allocUnsafe(arg);\n }\n\n return from(arg, encodingOrOffset, length);\n } // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97", "title": "" }, { "docid": "d77b3579fe4796faeacf22827c28de1c", "score": "0.5228957", "text": "function Buffer(arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error('If encoding is specified then the first argument must be a string');\n }\n\n return allocUnsafe(arg);\n }\n\n return from(arg, encodingOrOffset, length);\n } // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97", "title": "" }, { "docid": "225678f398fbf0c12e3d383bbbdfe30b", "score": "0.5228487", "text": "function encode(source) {\n if (Array.isArray(source) || source instanceof Uint8Array) {\n source = _Buffer.from(source);\n }\n\n if (!_Buffer.isBuffer(source)) {\n throw new TypeError('Expected Buffer');\n }\n\n if (source.length === 0) {\n return '';\n } // Skip & count leading zeroes.\n\n\n var zeroes = 0;\n var length = 0;\n var pbegin = 0;\n var pend = source.length;\n\n while (pbegin !== pend && source[pbegin] === 0) {\n pbegin++;\n zeroes++;\n } // Allocate enough space in big-endian base58 representation.\n\n\n var size = (pend - pbegin) * iFACTOR + 1 >>> 0;\n var b58 = new Uint8Array(size); // Process the bytes.\n\n while (pbegin !== pend) {\n var carry = source[pbegin]; // Apply \"b58 = b58 * 256 + ch\".\n\n var i = 0;\n\n for (var it1 = size - 1; (carry !== 0 || i < length) && it1 !== -1; it1--, i++) {\n carry += 256 * b58[it1] >>> 0;\n b58[it1] = carry % BASE >>> 0;\n carry = carry / BASE >>> 0;\n }\n\n if (carry !== 0) {\n throw new Error('Non-zero carry');\n }\n\n length = i;\n pbegin++;\n } // Skip leading zeroes in base58 result.\n\n\n var it2 = size - length;\n\n while (it2 !== size && b58[it2] === 0) {\n it2++;\n } // Translate the result into a string.\n\n\n var str = LEADER.repeat(zeroes);\n\n for (; it2 < size; ++it2) {\n str += ALPHABET.charAt(b58[it2]);\n }\n\n return str;\n }", "title": "" }, { "docid": "1f4a2772f47feb08b44c2f01b13f1c4b", "score": "0.522638", "text": "function encode (source) {\n\t if (Array.isArray(source) || source instanceof Uint8Array) { source = _Buffer.from(source); }\n\t if (!_Buffer.isBuffer(source)) { throw new TypeError('Expected Buffer') }\n\t if (source.length === 0) { return '' }\n\t // Skip & count leading zeroes.\n\t var zeroes = 0;\n\t var length = 0;\n\t var pbegin = 0;\n\t var pend = source.length;\n\t while (pbegin !== pend && source[pbegin] === 0) {\n\t pbegin++;\n\t zeroes++;\n\t }\n\t // Allocate enough space in big-endian base58 representation.\n\t var size = ((pend - pbegin) * iFACTOR + 1) >>> 0;\n\t var b58 = new Uint8Array(size);\n\t // Process the bytes.\n\t while (pbegin !== pend) {\n\t var carry = source[pbegin];\n\t // Apply \"b58 = b58 * 256 + ch\".\n\t var i = 0;\n\t for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {\n\t carry += (256 * b58[it1]) >>> 0;\n\t b58[it1] = (carry % BASE) >>> 0;\n\t carry = (carry / BASE) >>> 0;\n\t }\n\t if (carry !== 0) { throw new Error('Non-zero carry') }\n\t length = i;\n\t pbegin++;\n\t }\n\t // Skip leading zeroes in base58 result.\n\t var it2 = size - length;\n\t while (it2 !== size && b58[it2] === 0) {\n\t it2++;\n\t }\n\t // Translate the result into a string.\n\t var str = LEADER.repeat(zeroes);\n\t for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }\n\t return str\n\t }", "title": "" }, { "docid": "bbf44a75739978b832d0cb60763a901e", "score": "0.5223306", "text": "constructor(bufferData, options) {\n this._options = Object.assign({}, {\n dataType: BufferDataType.BASE64,\n verbose: false,\n }, options);\n this._bufferData = this._options.dataType === BufferDataType.BASE64\n ? bufferData\n : bufferData.slice(0);\n }", "title": "" }, { "docid": "62c404a38d93013afd96e646952987d9", "score": "0.5220069", "text": "function encode (source) {\n if (Array.isArray(source) || source instanceof Uint8Array) { source = _Buffer.from(source); }\n if (!_Buffer.isBuffer(source)) { throw new TypeError('Expected Buffer') }\n if (source.length === 0) { return '' }\n // Skip & count leading zeroes.\n var zeroes = 0;\n var length = 0;\n var pbegin = 0;\n var pend = source.length;\n while (pbegin !== pend && source[pbegin] === 0) {\n pbegin++;\n zeroes++;\n }\n // Allocate enough space in big-endian base58 representation.\n var size = ((pend - pbegin) * iFACTOR + 1) >>> 0;\n var b58 = new Uint8Array(size);\n // Process the bytes.\n while (pbegin !== pend) {\n var carry = source[pbegin];\n // Apply \"b58 = b58 * 256 + ch\".\n var i = 0;\n for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {\n carry += (256 * b58[it1]) >>> 0;\n b58[it1] = (carry % BASE) >>> 0;\n carry = (carry / BASE) >>> 0;\n }\n if (carry !== 0) { throw new Error('Non-zero carry') }\n length = i;\n pbegin++;\n }\n // Skip leading zeroes in base58 result.\n var it2 = size - length;\n while (it2 !== size && b58[it2] === 0) {\n it2++;\n }\n // Translate the result into a string.\n var str = LEADER.repeat(zeroes);\n for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }\n return str\n }", "title": "" }, { "docid": "0b7f16eabc53f7c7f315adb6f02260c8", "score": "0.52157885", "text": "function Buffer(arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === \"number\") {\n if (typeof encodingOrOffset === \"string\") throw new TypeError('The \"string\" argument must be of type string. Received type number');\n return allocUnsafe(arg);\n }\n return from(arg, encodingOrOffset, length);\n}", "title": "" }, { "docid": "2ad0c566db1b5a294cbfc2584b07e0e6", "score": "0.5214608", "text": "function runningLengthEncodingV2(str) {\n\n let counter = 0; // intialize counter to 0, and array (to return compressed string)\n let encodedString = []; \n\n for (let i = 0; i < str.length; i++) { // loop through each char in string\n const char = str[i]; // grab current and next char\n const nextChar = str[i + 1];\n counter++; // increment counter by 1\n\n if ((counter === 9) || (char !== nextChar)) { // if we hit count of 9 or current != next\n encodedString.push(counter, char); // update compressed array, update counter\n counter = 0;\n }\n }\n\n return encodedString.join(\"\");\n}", "title": "" }, { "docid": "ab68de00f38dd91210619fea23aec95a", "score": "0.52090347", "text": "function Buffer(arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') throw new TypeError('The \"string\" argument must be of type string. Received type number');\n return allocUnsafe(arg);\n }\n return from(arg, encodingOrOffset, length);\n}", "title": "" }, { "docid": "1dbb3bac6e6e16c1cce4e89f5227a2a5", "score": "0.52081996", "text": "function fixBinary(data) {\n var length = data.length;\n var bytes = new ArrayBuffer(length);\n var arr = new Uint8Array(bytes);\n for (var i = 0; i < length; i++) {\n arr[i] = data.charCodeAt(i);\n }\n return bytes;\n }", "title": "" }, { "docid": "1dbb3bac6e6e16c1cce4e89f5227a2a5", "score": "0.52081996", "text": "function fixBinary(data) {\n var length = data.length;\n var bytes = new ArrayBuffer(length);\n var arr = new Uint8Array(bytes);\n for (var i = 0; i < length; i++) {\n arr[i] = data.charCodeAt(i);\n }\n return bytes;\n }", "title": "" }, { "docid": "71b283fc57ebc19386bc51df7801415a", "score": "0.5205644", "text": "function routingInfoEncoder(datas){var buffer=Buffer(0);datas.forEach(function(data){buffer=Buffer.concat([buffer,hexToBuffer(data.pubkey)]);buffer=Buffer.concat([buffer,hexToBuffer(data.short_channel_id)]);buffer=Buffer.concat([buffer,Buffer([0,0,0].concat(intBEToWords(data.fee_base_msat,8)).slice(-4))]);buffer=Buffer.concat([buffer,Buffer([0,0,0].concat(intBEToWords(data.fee_proportional_millionths,8)).slice(-4))]);buffer=Buffer.concat([buffer,Buffer([0].concat(intBEToWords(data.cltv_expiry_delta,8)).slice(-2))]);});return hexToWord(buffer);}// if text, return the sha256 hash of the text as words.", "title": "" }, { "docid": "3de8d2cac76bbef1fcc8161e9db35f6c", "score": "0.52019477", "text": "_continueManuallyEncodingData({ inputBuffer }) {\n if (!this.get('_isRecording') || this.get('isDestroying') || this.get('isDestroyed')) {\n return;\n }\n const encoderWorker = this.get('_encoderWorker');\n if (encoderWorker && inputBuffer) {\n encoderWorker.postMessage(['encode', inputBuffer.getChannelData(0)]);\n }\n }", "title": "" }, { "docid": "6678513d53c66b7877111d7416a978c9", "score": "0.51949394", "text": "function rstr2binl(input)\n {\n var output = Array(input.length >> 2);\n for(var i = 0; i < output.length; i++)\n output[i] = 0;\n for(var i = 0; i < input.length * 8; i += 8)\n output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (i%32);\n return output;\n }", "title": "" }, { "docid": "6a08a78641fffe4eba5c66b6b487efa5", "score": "0.51942915", "text": "function Buffer(arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError('The \"string\" argument must be of type string. Received type number');\n }\n\n return allocUnsafe(arg);\n }\n\n return from(arg, encodingOrOffset, length);\n } // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97", "title": "" }, { "docid": "8f7fdf6e21871f928109d6008c64f9af", "score": "0.51942205", "text": "function Buffer(arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n }", "title": "" }, { "docid": "ee1218eb4b3dacc8a989d32da5ad5175", "score": "0.51696616", "text": "function Buffer (arg, encodingOrOffset, length) {\r\n // Common case.\r\n if (typeof arg === 'number') {\r\n if (typeof encodingOrOffset === 'string') {\r\n throw new Error(\r\n 'If encoding is specified then the first argument must be a string'\r\n )\r\n }\r\n return allocUnsafe(arg)\r\n }\r\n return from(arg, encodingOrOffset, length)\r\n}", "title": "" }, { "docid": "ee1218eb4b3dacc8a989d32da5ad5175", "score": "0.51696616", "text": "function Buffer (arg, encodingOrOffset, length) {\r\n // Common case.\r\n if (typeof arg === 'number') {\r\n if (typeof encodingOrOffset === 'string') {\r\n throw new Error(\r\n 'If encoding is specified then the first argument must be a string'\r\n )\r\n }\r\n return allocUnsafe(arg)\r\n }\r\n return from(arg, encodingOrOffset, length)\r\n}", "title": "" }, { "docid": "ee1218eb4b3dacc8a989d32da5ad5175", "score": "0.51696616", "text": "function Buffer (arg, encodingOrOffset, length) {\r\n // Common case.\r\n if (typeof arg === 'number') {\r\n if (typeof encodingOrOffset === 'string') {\r\n throw new Error(\r\n 'If encoding is specified then the first argument must be a string'\r\n )\r\n }\r\n return allocUnsafe(arg)\r\n }\r\n return from(arg, encodingOrOffset, length)\r\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" }, { "docid": "aecbb6be0231bb1421e61d16eb286ea6", "score": "0.5165224", "text": "function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}", "title": "" } ]
dc766d435b67d473292f53d9f39e1c30
a success message has been triggered.
[ { "docid": "f9921ac1cc81b0c80347854c54bceb2d", "score": "0.72682583", "text": "success(message) {}", "title": "" } ]
[ { "docid": "58cf2dcf69b3be9449c6a23e062daa14", "score": "0.74875855", "text": "function sendSuccess() {\n\tconsole.log('Received Events: ' + 'sendSuccess');\n}", "title": "" }, { "docid": "616e3affaf3af5a6196081ebb0d205b3", "score": "0.735485", "text": "function guiMessageSuccess(message) {\n guiMessageHelper('success', message);\n}", "title": "" }, { "docid": "139bc32576eb8dcdcccb1c4eea336cac", "score": "0.7259026", "text": "function respondSuccess() {\r\n\tthis.send(msg.success);\r\n}", "title": "" }, { "docid": "b9bb7701adca36608754c1476cbd83e0", "score": "0.72435784", "text": "function showSuccessMsg(msg){\n showMsg(msg, 'success', 'complete');\n }", "title": "" }, { "docid": "61bdd3ce0ec34a189ebab0351a99a62b", "score": "0.7191319", "text": "handleSuccess() {\n this.dispatchEvent(\n new ShowToastEvent({\n title: 'Success',\n message: this.recordId ? 'Account updated' : 'Account created',\n variant: 'success'\n })\n );\n }", "title": "" }, { "docid": "39d9af59126113a76ad87040dde58545", "score": "0.71685916", "text": "function statusMessageSuccessHandler() {\n console.log(\"Ready message send succeeded.\"); \n}", "title": "" }, { "docid": "c1789a13ce2e2c50867e6c1099205cf5", "score": "0.715247", "text": "showSuccessMessage(message) {\n this.showMessage(\"Success\", message, \"success\");\n }", "title": "" }, { "docid": "07e0f5090c0ef23694fa5cbb087943a7", "score": "0.71005994", "text": "function triggerSuccess() {\n console.info('success');\n playSound(data.sounds.success.ref);\n incrementScore();\n document.dispatchEvent(new CustomEvent('score_update', {\n bubbles: true\n }));\n}", "title": "" }, { "docid": "b65417f30203cdf12d7ee97d13943e24", "score": "0.70720965", "text": "function successCB(msg) {\r\n // Success handling\r\n success(msg);\r\n }", "title": "" }, { "docid": "b65417f30203cdf12d7ee97d13943e24", "score": "0.70720965", "text": "function successCB(msg) {\r\n // Success handling\r\n success(msg);\r\n }", "title": "" }, { "docid": "b65417f30203cdf12d7ee97d13943e24", "score": "0.70720965", "text": "function successCB(msg) {\r\n // Success handling\r\n success(msg);\r\n }", "title": "" }, { "docid": "b65417f30203cdf12d7ee97d13943e24", "score": "0.70720965", "text": "function successCB(msg) {\r\n // Success handling\r\n success(msg);\r\n }", "title": "" }, { "docid": "b65417f30203cdf12d7ee97d13943e24", "score": "0.70720965", "text": "function successCB(msg) {\r\n // Success handling\r\n success(msg);\r\n }", "title": "" }, { "docid": "b65417f30203cdf12d7ee97d13943e24", "score": "0.70720965", "text": "function successCB(msg) {\r\n // Success handling\r\n success(msg);\r\n }", "title": "" }, { "docid": "b65417f30203cdf12d7ee97d13943e24", "score": "0.70720965", "text": "function successCB(msg) {\r\n // Success handling\r\n success(msg);\r\n }", "title": "" }, { "docid": "b65417f30203cdf12d7ee97d13943e24", "score": "0.70720965", "text": "function successCB(msg) {\r\n // Success handling\r\n success(msg);\r\n }", "title": "" }, { "docid": "b65417f30203cdf12d7ee97d13943e24", "score": "0.70720965", "text": "function successCB(msg) {\r\n // Success handling\r\n success(msg);\r\n }", "title": "" }, { "docid": "b65417f30203cdf12d7ee97d13943e24", "score": "0.70720965", "text": "function successCB(msg) {\r\n // Success handling\r\n success(msg);\r\n }", "title": "" }, { "docid": "b65417f30203cdf12d7ee97d13943e24", "score": "0.70720965", "text": "function successCB(msg) {\r\n // Success handling\r\n success(msg);\r\n }", "title": "" }, { "docid": "b65417f30203cdf12d7ee97d13943e24", "score": "0.70720965", "text": "function successCB(msg) {\r\n // Success handling\r\n success(msg);\r\n }", "title": "" }, { "docid": "b65417f30203cdf12d7ee97d13943e24", "score": "0.70720965", "text": "function successCB(msg) {\r\n // Success handling\r\n success(msg);\r\n }", "title": "" }, { "docid": "84f9573726ae07f109624da999279c4c", "score": "0.7051427", "text": "function messageSuccessHandler() {\n console.log(\"Message send succeeded.\"); \n}", "title": "" }, { "docid": "fc760f8ebd276a9f3ccb328d4cf91471", "score": "0.69853806", "text": "function onFileSendSuccess() {\n showInfo('File sent successfully.');\n }", "title": "" }, { "docid": "3e48681dd5cd853ef4417f11929ca942", "score": "0.68663573", "text": "function success() {\n\tvar placeOrderResult = app.getController('COPlaceOrder').Start();\n\tif (placeOrderResult.error) {\n\t\tapp.getController('COSummary').Start({\n\t\t\tPlaceOrderError : new Status(Status.ERROR, 'basket.changed.error')\n\t\t});\n\t} else if (placeOrderResult.order_created) {\n\t\tapp.getController('COSummary').ShowConfirmation(placeOrderResult.Order);\n\t}\n}", "title": "" }, { "docid": "101acd543002c0052c1184a711d277ed", "score": "0.67905015", "text": "function displaySuccess(message) {\n displayMessage(message, \"green\", true);\n}", "title": "" }, { "docid": "513e8e2fae2b303f6d0de960fce4e1e0", "score": "0.6778651", "text": "handleSuccess(event) {\n\n // Turn off Spinner\n this.doneLoading = true;\n\n // Displays Success Message\n this.alertMsg = this.meetupRcd.Name ? 'Congratulations, your registration for ' + this.meetupRcd.Name + ' was successful!' : 'Congratulations, your registraion was successful!';\n this.alertClass = SUCCESS_CLASS;\n }", "title": "" }, { "docid": "628dbb3351903f9d2de7b94437143787", "score": "0.6754832", "text": "function handleSuccess() {\n toast.success('Acesso Permitido!');\n }", "title": "" }, { "docid": "0e317ccb7fb63724a1ac3624e4546e29", "score": "0.6753815", "text": "function messageSuccess(message) {\n $('.sticky').click(function () {\n $.stickyNote(message, $.extend({}, defaults, { classList: 'stickyNote-success' }), callback)\n });\n $('.sticky').trigger(\"click\");\n}", "title": "" }, { "docid": "ac21ae51a89e275e6c0184973934094e", "score": "0.67410594", "text": "function notifySuccess() {\n $(\"#send\").notify(\n \"Message has been send successfully\",\n \"success\",\n { position:\"bottom\" },\n {showAnimation: 'slideDown'},\n {hideAnimation: 'slideUp'}\n );\n}", "title": "" }, { "docid": "7c0676a836e2b02e5e557404a7d451af", "score": "0.6705897", "text": "hasSuccess() {\n return this.internalSuccessMessages.length > 0 || this.success;\n }", "title": "" }, { "docid": "66cca074375779f72b6d7ebfa7f888ac", "score": "0.6687367", "text": "onSuccess(message) {\n if (message) {\n this.emit(FW_EVENT.SUCCESS, message);\n } else {\n this.emit(FW_EVENT.SUCCESS);\n }\n }", "title": "" }, { "docid": "0270502f44046ce10d84f51809b6d907", "score": "0.6668193", "text": "function d(e)\n {\n console.log(\"Double success\") //ensures that the publishing of publishState was successful so the UI can receive initial state of Photon\n }", "title": "" }, { "docid": "da543db63ab1038be5c488b30eb19c05", "score": "0.6647702", "text": "writeSuccess(message) {\n this.$message.removeClass(\"text-danger\");\n this.$message.addClass(\"text-success\");\n this.$message.html(message);\n }", "title": "" }, { "docid": "a3146b4d1f17d5c0371875707ccc001f", "score": "0.6606618", "text": "function showSuccessAlert(message) {\n self.alertMessage = message;\n self.showSuccessAlert = true;\n $timeout(function() {\n self.showSuccessAlert = false;\n }, 4000);\n }", "title": "" }, { "docid": "441e4e2ed0aef180142cf7b9bf535bd3", "score": "0.6584125", "text": "function createSuccessMsg (loc, msg) {\n\t\tloc.append(\n\t\t\t'<div class=\"alert alert-success\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button><strong><i class=\"icon24 i-checkmark-circle\"></i> Well done!</strong> '+ msg + ' </div>'\n\t\t);\n\t}", "title": "" }, { "docid": "de22cc07140c3910efdeeef5ad8112a8", "score": "0.6570387", "text": "function feedbackSuccess(message){\n\n if(!message)\n return;\n // this checks if alertify is here\n if(alertify){\n alertify.success(message);\n }\n }", "title": "" }, { "docid": "c9d7e028db825b718c2720d3935a5639", "score": "0.6552231", "text": "onNotifyMeSuccess(success) {\n this.$refs.notifyMeModal.close();\n this.showFlyout(this.flyoutStatus.success, success, true);\n }", "title": "" }, { "docid": "833a56ec67c8fc9a816cb2d016f601d5", "score": "0.6552116", "text": "function successCB() {\r\n \r\n}", "title": "" }, { "docid": "fc68a0966267743aef9c3922788f48b7", "score": "0.6550867", "text": "function emailSuccess() {\n swal({\n title: \"Great!\",\n text: \"Your message has been sent successfully!\",\n icon: \"success\",\n button: \"ok!\",\n });\n}", "title": "" }, { "docid": "57c13cbfdd5458b6c78445abeae8d442", "score": "0.6549384", "text": "printSuccess (msg) { console.log(`${this.FgGreen}Success: ${msg}${this.FgDefault}`) }", "title": "" }, { "docid": "1cc74c9aa8a89b9502d63bf6d5ac91af", "score": "0.6541011", "text": "function onSendMailSuccess() {\n\t\t\t\t\t\n\t\t\t\t\tHistoryUtils.addHistoryEvent(\n\t\t\t\t\t\tdocument, \n\t\t\t\t\t\t'email.sendAcknowledgment.success', /* eventType */ \n\t\t\t\t\t\t'', /* message */\n\t\t\t\t\t\t'system' /* referrer */\n\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t}", "title": "" }, { "docid": "4a4716b371a59b15327120de7fce8a27", "score": "0.65390605", "text": "function success() {\n var placeOrderResult = app.getController('COPlaceOrder').Start();\n if (placeOrderResult.error) {\n app.getController('COSummary').Start({\n PlaceOrderError: new Status(Status.ERROR, 'basket.changed.error')\n });\n } else if (placeOrderResult.order_created) {\n app.getController('COSummary').ShowConfirmation(placeOrderResult.Order);\n }\n}", "title": "" }, { "docid": "40a238f8f303db9b3ae35aaa4de7a36f", "score": "0.6534438", "text": "function OnSuccess(data,status,request) {\n\t\tvar error = $(request.responseText).find(\"error\").text();\n\t\tvar success = $(request.responseText).find(\"success\").text();\n\t\t\n\t\tif ((error == \"\") && (success !== \"\")) {\n\t\t\tDeleteMessage();\n\t\t\tCreateMessage(\"green\", success, 0.5, 3, 0.5);\n\t\t\t\n\t\t\t//Remove the unblock user button\n\t\t\t$(\"#unblock_user_button\").remove();\n\t\t\t\n\t\t\t//Refresh the user status\n\t\t\tget_user_status()\n\t\t}\n\t\t//Else, print the error in a message\n\t\telse if ((error !== \"\") && (success == \"\")) {\n\t\t\tDeleteMessage();\n\t\t\tCreateMessage(\"red\", error, 0.5, 3, 0.5);\n\t\t}\n\t}", "title": "" }, { "docid": "468f1e0e6402b5c041ff130449e457b9", "score": "0.65219635", "text": "function displaySuccess(message) {\n $('#message').html(' <div class=\"alert alert-success\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>\\n\\\n ' + message + '</div>');\n }", "title": "" }, { "docid": "dbd2459f714cfb75f39ba9898dfe0172", "score": "0.6507399", "text": "function successMsg(){\n $(\"#msg\").attr(\"class\", \"msgStyle\");\n $('#pass').text(\"You PASSED!\");\n $('button').attr(\"class\", \"showButton\");\n $('button').text(\"Click to continue\");\n $('button').click(function(){\n window.location.href = \"final.html\";\n })\n }", "title": "" }, { "docid": "4c2cabcde689f7a091881a71effc283f", "score": "0.6506807", "text": "function addSuccessAlert() {\n $scope.alerts.push({\n type: 'success',\n msg : $filter('translate')('pages.sm.service.SERVICE_MGMT_ALERTS.SERVICE_MGMT_ALERT_SERVICE_INFO_EDIT_SUCCESSFUL')\n });\n }", "title": "" }, { "docid": "3dc108038ec8ea1d07b5834c8566b4ce", "score": "0.6503992", "text": "function handleSuccess(data) {\n console.log(data)\n if (data) { \n alert ('Comanda a fost efectuata, mail confirmare')\n } \n }", "title": "" }, { "docid": "78bdff699af56837da67afbfe37efa79", "score": "0.64986664", "text": "success(domain, location, text) {\n\t\tthis.log(domain, this.data.constants.types.SUCCESS, location, text);\n\t}", "title": "" }, { "docid": "f60806f56700bf1f277251496b17f731", "score": "0.64704484", "text": "success(message, title, options) {\n return this.show(message, title, 'success', options);\n }", "title": "" }, { "docid": "7737e8d7cbfc91a03179ffd08673ee45", "score": "0.6462144", "text": "function successMsg(msg){\n new Noty({\n theme:'relax',\n text: msg,\n type:'success',\n layout:'topRight',\n timeout:1500\n }).show();\n }", "title": "" }, { "docid": "4fc49db3d78ce2b936d291ddf692436b", "score": "0.64531904", "text": "success(message, uglySuccessKeyword = \"success\") {\n var checkmark;\n\n if (! this._pretty) {\n return this.info(`${message}: ${uglySuccessKeyword}`);\n }\n\n if (process.platform === \"win32\") {\n checkmark = chalk.green('SUCCESS');\n } else {\n checkmark = chalk.green('\\u2713'); // CHECKMARK\n }\n\n return this.info(\n chalk.green(message),\n this.options({ bulletPoint: checkmark + \" \"}));\n }", "title": "" }, { "docid": "04cf74ce9886b914280d9258373da61a", "score": "0.6450297", "text": "notifyOnRegistrationSuccess() {\n toast.success(\"Registrierung erfolgreich abgeschlossen, Sie können sich jetzt anmelden.\")\n }", "title": "" }, { "docid": "0240ead0514a951982e177ba6b5d085c", "score": "0.6436328", "text": "function showSuccessMessage( successMessage ){\n\t\n\tnoty({\n\t\ttext: successMessage,\n\t\tlayout: 'topCenter',\n\t\ttype: 'success'\t\n\t});\n \n}", "title": "" }, { "docid": "353b6cb26ada7ad83254b2b41fbe5dfc", "score": "0.64315766", "text": "handleSuccess() {\n /* this.showLoadingSpinner = true;\n this.getContactData(); */\n this.dispatchEvent(\n new ShowToastEvent({\n title: \"Success!!\",\n message: \" Updated Successfully!!.\",\n variant: \"success\"\n })\n );\n this.dispatchEvent(new CustomEvent(\"savevendor\"));\n }", "title": "" }, { "docid": "9ad4530bf27812d710d24bc60445174b", "score": "0.64277124", "text": "_handleSuccess(data) {\n\n this.localBalance = this.WriteAheadLog[this.WriteAheadLog.length -1];\n this.globalBalance = this.localBalance;\n\n if(this.onPhaseChange) this.onPhaseChange(Action.success, this.localBalance);\n if(this.onError) this.onError(\"Commit successful!\", \"success\");\n\n let ack =\n Action.acknowledge +\",\"+\n this.clientId;\n\n this.websocket.send(ack);\n\n this._resetStates();\n }", "title": "" }, { "docid": "188d6bfacc3723ea2e75e11e4dc0dfd4", "score": "0.64114237", "text": "success(message, options = {}) {\n options.type = 'success';\n options.message = message;\n return this.showNotification(options);\n }", "title": "" }, { "docid": "2dbc4872e6e33f8aae69d8009425cec2", "score": "0.640639", "text": "function onSuccessFn(data){\n\n /**\n * HomeController has the listener for 'RESULTS.FOUND' \n * and there the data presentation has been handled\n */\n $rootScope.$emit('RESULTS.FOUND', data);\n }", "title": "" }, { "docid": "ac3619a1fa78bda6cc9514d6e45f35bc", "score": "0.63986903", "text": "function onQueryStatusSuccess( oData ) {\n\t\t if ( oData.Status == Enum.Status.Submitted) {\n\t\t \tUtil.info(\"Congratulations, you have submitted successfully!\");\n\t\t } else {\n\t\t \tUtil.info(\"Sorry, you have added to the waiting list because registration exceed maximun limitation!\");\n\t\t }\n\t\t}", "title": "" }, { "docid": "d85d69b183277c1b22faa628b755a908", "score": "0.6385486", "text": "success({ markTag, message, data, detail }) {\n\t\tthis.app.logger.info(`[${markTag}] ${message} detail=${JSON.stringify(detail)}`);\n return { success: true, message, data };\n\t}", "title": "" }, { "docid": "613b4c7cf7cb9ab4dbdc2b093d7f4f51", "score": "0.6375781", "text": "function successMessage(message) {\n M.toast({html: message, classes: \"success-message\"});\n}", "title": "" }, { "docid": "f35739e0d229e9d2e38dc38be07739aa", "score": "0.6374538", "text": "handleSuccess () {\n this.log.info(this.name + ' Success')\n monitor.gauge(this.gauge, 1, 1, this.monitorTags)\n }", "title": "" }, { "docid": "974374561cd7c53ac10d5b3809858a78", "score": "0.63474697", "text": "function success()\n\t{\n\t\tapp.clearLoadingBox();\n\n\t\tvar wid = fw.getWidget('login');\n\t\twid && wid.terminate();\n\n\t\tconfirm();\n\t}", "title": "" }, { "docid": "5d3802cee316bb31d89604153821b3ce", "score": "0.63221085", "text": "function setSuccessfulMessage(e) {\n var message;\n if (curPage === FormListConst.FORM_LIST_PAGE) {\n message = '\"' + e.data.OldFormName + '\" has been duplicated and renamed to \"' + e.data.Name + '\".';\n }\n else if (curPage === StylesConst.STYLES_PAGE) {\n message = '\"' + e.data.OldStyleName + '\" has been successfully duplicated. The duplicate file is named' +\n ' \"' + e.data.Title + '\".';\n }\n return message;\n }", "title": "" }, { "docid": "cada10fae2e50dbf87246cba029ab299", "score": "0.63167346", "text": "function showSuccessMessage() {\n $feedbackMessage.addClass(cssClass.success).removeClass(cssClass.hide);\n $preferredBoutique.find(selectors.changeBoutiqueBtn).addClass(cssClass.hide);\n $setBoutiqueBtn.addClass(cssClass.hide);\n util.ajaxloader.hide();\n }", "title": "" }, { "docid": "662cedb9d03b35ebf41c24118381027b", "score": "0.6310499", "text": "function successMessage() {\n dialog.showMessageBox( {type: 'none', title: 'Success!', message: 'Post was successful!'} )\n ipcRenderer.send('post-success')\n}", "title": "" }, { "docid": "04a89b824ab59b367d004fc090b8e7ea", "score": "0.6309987", "text": "function createSuccessMsg(msg) {\n return msg.green;\n}", "title": "" }, { "docid": "8004c47635c163a9fda8a715a1c3cecb", "score": "0.6305702", "text": "function addSuccess(message, afterAddSuccess) {\n html = '<div id=\"alert\"><p id=\"dynamic-alert\" class=\"alert alert-dismissible alert-success\" role=\"alert\">'\n + message\n + '<button class=\"close\" data-dismiss=\"alert\" type=\"button\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button></p></div>';\n $(\"#alert\").html(html);\n if(afterAddSuccess) { afterAddSuccess(); }\n}", "title": "" }, { "docid": "1ed54a3edba8cdcf7d1039b987292554", "score": "0.6299143", "text": "function setChangeMessageSuccess(message) {\n $('#changeMessage').html(message);\n $('#changeMessage').show();\n}", "title": "" }, { "docid": "4ea2e0b29f4451ef431ac8723bd14e4e", "score": "0.627435", "text": "success(message){\n cname.textContent = `Hello, ${message} `\n title.textContent = `Account Confirm success`\n }", "title": "" }, { "docid": "8a4c514dae5deb6102f575b9398826d0", "score": "0.6268327", "text": "onSuccess() {\n this.emit(\"success\");\n this.cleanup();\n }", "title": "" }, { "docid": "63e09786c0ce6f088028e5d33c27d617", "score": "0.62544644", "text": "function success(arg) {\n if (config.successToast) {\n toasts.remove();\n toasts.success(config.successToast);\n }\n if (config.successTrackPage) {\n context.analytics.trackPage(config.successTrackPage);\n }\n if (config.successRoute) {\n context.route(config.successRoute);\n }\n return arg;\n }", "title": "" }, { "docid": "b19b6a2df06da47ff8e956876e2a3595", "score": "0.6249144", "text": "function emailSuccessfullySent(email) {\n successMessage.innerHTML = \"<strong>\" + email + \"</strong>\" + emailSentHTML;\n }", "title": "" }, { "docid": "701a02137622d7e7654bd59fdacd661b", "score": "0.62460434", "text": "onSuccess() {\n this.emit(\"success\");\n this.cleanup();\n }", "title": "" }, { "docid": "2e46d4374089e5db309a18ed50c3c2e7", "score": "0.62373966", "text": "alertSuccess(message, autoClose) {\n this.$root.alert.mode = 'toast';\n this.$root.alert.type = 'success';\n this.$root.alert.message = message;\n this.$root.alert.autoClose = autoClose;\n }", "title": "" }, { "docid": "ad32b53a6c36a7851a1183de9f82a923", "score": "0.6231069", "text": "function printSuccess (ctx) {\n process.stdout.write(`\\n\\n\n${chalk.bold.green(figures.tick + \" Success!\")}\\n\nWe successfully added the chosen template contents to your current directory.\\n\\n`);\n\n if (\n ctx.manifest.done\n && typeof ctx.manifest.done.message === \"string\"\n && checkWhen(ctx, ctx.manifest.done.when)\n ) {\n var output = processText(ctx, ctx.manifest.done.message);\n process.stdout.write(\"And now a word from the author:\\n\");\n process.stdout.write(output + \"\\n\\n\");\n }\n}", "title": "" }, { "docid": "b5261173e362e3af4019158f518eaaaa", "score": "0.62173146", "text": "function RequestSuccess(result) {\r\n if (result === \"true\") {\r\n eventModal();\r\n $('.eventcompletetxt').html(\"Your request has been sent! You will be notified if this user accepts.\");\r\n }\r\n else if (result === \"falsescheduledswapother\") {\r\n eventModal();\r\n $('.eventcompletetxt').html(\"This user already has a scheduled swap within this time frame.\");\r\n }\r\n else if (result === \"falsescheduledswapyou\") {\r\n eventModal();\r\n $('.eventcompletetxt').html(\"You have already committed to swapping with someone within this time frame.\");\r\n }\r\n else if (result === \"falsesentrequest\") {\r\n eventModal();\r\n $('.eventcompletetxt').html(\"You have already sent this user a request for this vehicle.\");\r\n }\r\n else if (result === \"falseothersent\") {\r\n eventModal();\r\n $('.eventcompletetxt').html(\"This user has already sent you a request for this swap, and is waiting on your reply.\");\r\n }\r\n else if (result === \"error\") {\r\n eventModal();\r\n $('.eventcompletetxt').html(\"An error has occurred, please contact us if this persists.\");\r\n }\r\n }", "title": "" }, { "docid": "d4a18a59d00800f5401f382f392ac723", "score": "0.6209548", "text": "function OnSuccess(data,status,request) {\n\t\tvar error = $(request.responseText).find(\"error\").text();\n\t\tvar success = $(request.responseText).find(\"success\").text();\n\t\t\n\t\tif ((error == \"\") && (success !== \"\")) {\n\t\t\tDeleteMessage();\n\t\t\tCreateMessage(\"green\", success, 0.5, 3, 0.5);\n\t\t\t\n\t\t\t//Remove the form\n\t\t\t$(\"#user_info_div\").remove();\n\t\t\t$(\"#user_group_div\").remove();\n\t\t}\n\t\telse if ((error !== \"\") && (success == \"\")) {\n\t\t\tDeleteMessage();\n\t\t\tCreateMessage(\"red\", error, 0.5, 3, 0.5);\n\t\t}\n\t}", "title": "" }, { "docid": "553c0bbfaf2c5d5fd55bb2fe8859af17", "score": "0.6205067", "text": "function DialogSuccess(message) {\n\n BootstrapDialog.show({\n type: BootstrapDialog.TYPE_SUCCESS,\n title: \"Exito\",\n message: \"<b>\" + message + \"</b>\",\n buttons: [{\n cssClass: 'btn-success',\n label: 'Cerrar',\n action: function (dialogItself) {\n location.href = $Ctr_autor;\n }\n }]\n });\n}", "title": "" }, { "docid": "fe51ce0dbe8f1a3f729b87d0a2c45508", "score": "0.61874694", "text": "function addSuccess(student_object){\n if ($('.alert').hasClass('alert-danger')){\n $('.alert').removeClass('alert-danger hidden').addClass('alert-success').text('You added student ' + student_object.name);\n }else{\n $('.alert').removeClass('hidden').addClass('alert-success').text('You added student ' + student_object.name);\n }\n}", "title": "" }, { "docid": "8b23bfd75812725835d78ed7c928688d", "score": "0.61851215", "text": "function success(){\n \n alert(\"success\");\n\n}", "title": "" }, { "docid": "3cbb905a3c42d23b5076c4b64d9dfc69", "score": "0.6183449", "text": "function complete() {\n $('#apptForm-success-msg').fadeIn();\n }", "title": "" }, { "docid": "81cfe3636882231487fdde80a13d1b5f", "score": "0.6183058", "text": "function emitEmbeddedMessagingInitSuccessEvent() {\n\t\thasEmbeddedMessagingInitEventFired = true;\n\t\ttry {\n\t\t\tdispatchEventToHost(ON_EMBEDDED_MESSAGING_INIT_SUCCESS_EVENT_NAME);\n\t\t} catch(err) {\n\t\t\thasEmbeddedMessagingInitEventFired = false;\n\t\t\terror(`Something went wrong in firing onEmbeddedMessagingInitSuccess event ${err}.`);\n\t\t}\n\t}", "title": "" }, { "docid": "fc18d74249f0282a40526c9a2177bdae", "score": "0.6180572", "text": "function MailgunSuccessStatus(response) {\n MessagingServiceStatus.call(this, 'mailgun');\n\n // Message successfully sent\n this.state.message = response.message;\n this.state.code = this.StatusCodes.SUCCESS;\n}", "title": "" }, { "docid": "8c74c1c05108a4dbc542fa24472d0ee3", "score": "0.6180062", "text": "function createAlertSuccess(text) {\n $.notify({\n title: '<strong>Success: </strong>',\n message: text\n }, {\n type: 'success',\n animate: {\n enter: 'animated bounceInDown',\n exit: 'animated bounceOutUp'\n }\n });\n}", "title": "" }, { "docid": "ea1aca3e422d6340105f9cb42d704dce", "score": "0.61657", "text": "showSuccessMessage(heading, message) {\n this.clearMessagePanel();\n this.messagePanel.panel.classList.add(\"success\");\n this.showMessage(heading ,message);\n }", "title": "" }, { "docid": "bcfa1f729472528848358c9c3c4a4eb4", "score": "0.6162261", "text": "function showSuccess() {\n $changeMessage.addClass(cssClass.success).removeClass(cssClass.hide);\n if ($body.find(selectors.preferredBoutiqueComponent).length) {\n iwc.comp.preferredboutique.update(boutiqueId);\n util.ajaxloader.hide();\n closeLightBox();\n } else {\n window.location.reload();\n }\n }", "title": "" }, { "docid": "d4c218e92e74810a6959782b8462ee10", "score": "0.616106", "text": "function OnSuccess(data,status,request) {\n\t\tvar error = $(request.responseText).find(\"error\").text();\n\t\tvar success = $(request.responseText).find(\"success\").text();\n\t\t\n\t\tif ((error == \"\") && (success !== \"\")) {\n\t\t\tDeleteMessage();\n\t\t\tCreateMessage(\"green\", success, 0.5, 3, 0.5);\n\t\t\t\n\t\t\t//Remove the form and delete the selected option in the selectpicker and hide the button\n\t\t\t$(\"#password_user_info\").remove();\n\t\t\t$('#user_select').selectpicker('deselectAll');\n\t\t\t$('#manage_user_info_button').hide();\n\t\t}\n\t\telse if ((error !== \"\") && (success == \"\")) {\n\t\t\tDeleteMessage();\n\t\t\tCreateMessage(\"red\", error, 0.5, 3, 0.5);\n\t\t}\n\t}", "title": "" }, { "docid": "cc56f944fe6ea0a9c4c368864a85cec6", "score": "0.6159437", "text": "function showCorrectAnswerMessage() {\n toastr.success(state.correctAnsMsg);\n }", "title": "" }, { "docid": "cf02f3c29e64d2945245a1321076bbf9", "score": "0.615639", "text": "onSuccess() {\n let message = `${this.speaker.tag(this.author)} Nice job! You fulfilled the following commitment:\n ${this.getInfo_pretty()}`\n this.speaker.say(message, this.channel);\n }", "title": "" }, { "docid": "ec472fc3508d3c000359f50d1ed5da63", "score": "0.615603", "text": "function success() {\n\talert(\"success...\");\n\t\n\tpoints();\n\t\t\n\tif(eval.percentage.toPrecision(2) > 90) {\n\t\t$('#messageBox').html(\"SUPER! Versuch gleich den nächsten Buchstaben!\");\n\t}\n\telse if(eval.percentage.toPrecision(2) > 80) {\n\t\t$('#messageBox').html(\"Toll! Versuch dich noch zu verbessern!\");\n\t}\n\telse if(eval.percentage.toPrecision(2) > 70) {\n\t\t$('#messageBox').html(\"Das war schon ganz toll!\");\n\t}\n\telse if(eval.percentage.toPrecision(2) > 50) {\n\t\t$('#messageBox').html(\"Übe noch ein bisschen.\");\n\t}\n\telse {\n\t\t$('#messageBox').html(\"Das schaffst du besser. Versuch es nocheinmal!\");\n\t}\n}", "title": "" }, { "docid": "2294b1aa21dc6faf6255f1bd9313f1eb", "score": "0.61420566", "text": "function PushBotsSuccessStatus(response) {\n MessagingServiceStatus.call(this, 'pushbots');\n\n // Message successfully sent\n this.state.message = response.statusCode + ': ' + response.statusMessage;\n this.state.code = this.StatusCodes.SUCCESS;\n}", "title": "" }, { "docid": "c92186ada669d8d7fef408617f4fdff6", "score": "0.61322606", "text": "function showSuccess(msg, headline) {\n toastr.success(parse(msg), headline || 'Success', {\n 'newestOnTop': false,\n 'progressBar': false,\n 'positionClass': 'toast-bottom-right',\n 'preventDuplicates': false,\n 'onclick': null,\n 'showDuration': '300',\n 'hideDuration': '1000',\n 'timeOut': '5000',\n 'extendedTimeOut': '1000',\n 'showEasing': 'swing',\n 'hideEasing': 'linear',\n 'showMethod': 'fadeIn',\n 'hideMethod': 'fadeOut'\n });\n}", "title": "" }, { "docid": "136ec56304cc4ae56d1d1586f8842791", "score": "0.61319125", "text": "function success() {\n const modalBody = document.getElementById('successMessage');\n modalBody.textContent = `Your payment of $${localStorage.getItem(\n 'total'\n )} has been accepted. Pizza is on the way!`;\n }", "title": "" }, { "docid": "1a9db1533edb374bcca44749649a560b", "score": "0.6103505", "text": "function successHandler (result) {\n if (consoleAvailable) {\n console.log(\"PushPlugin - Success: \" + result);\n }\n }", "title": "" }, { "docid": "60cdefa5de6d946d0d8c6b5a39bdd534", "score": "0.61019784", "text": "success(message, options = {}) {\n this.overwriteNotificationId(options);\n return this.id = this.raw.success(message, options);\n }", "title": "" }, { "docid": "76ab0f2a11a2f211238bbfe2e4180264", "score": "0.6101345", "text": "verifySuccessMessage() {\n this.wishlistAddSuccess.waitForDisplayed(3000);\n return this.wishlistAddSuccess.isDisplayed().should.be.true;\n }", "title": "" }, { "docid": "a58d0e9fd38bc5e85d5b11d7411bb074", "score": "0.60996044", "text": "confirmSaveStatus(isSuccess) {\n const notifications = this.get('notifications');\n const toastOptions = {\n timeOut: '4000',\n positionClass: 'toast-bottom-right'\n };\n if (isSuccess) {\n notifications.success('Alert options saved successfully', 'Done', toastOptions);\n } else {\n notifications.error('Alert options failed to save', 'Error', toastOptions);\n }\n }", "title": "" }, { "docid": "c4e84d348a907ee4fcf2e85fdcc69a30", "score": "0.6098935", "text": "function success_msg() {\n setTimeout(function() {\n $(\"#overlay\").removeClass(\"overlay h4 p-3 ml-4\");\n $(\"#overlay\").html(\"\");\n window.history.back();\n // window.location = \"./create\";\n }, 2000);\n $(\"#overlay\").addClass(\"overlay h4 p-3 ml-4\");\n $(\"#overlay\").html(\"Participants Added &#10003;\");\n }", "title": "" }, { "docid": "68db48ecda275c95a71e4c17ed44a4af", "score": "0.6079313", "text": "function receiveAuthSuccess(data) {\n if (data.equals(SUCCESS)) {\n self._onAuthed()\n }\n }", "title": "" } ]
871cee4882f146cd5337cde946e6a42a
Incorrect syntax because rest params should be the last parameter in function function TestRest(param1, param2, ...args, param3)
[ { "docid": "6917ec31b61fe628e1478dc8ba527f3e", "score": "0.7737492", "text": "function TestRest(param1, param2) {\n for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n args[_key - 2] = arguments[_key];\n }\n\n console.log(args);\n console.log(param1, param2, args[0]);\n}", "title": "" } ]
[ { "docid": "21eac7c84dc41ed87d69dcca074c8e1d", "score": "0.7827866", "text": "function afterRest(first, ...second, third) {\n\t// SyntaxError: parameter after rest parameter\n}", "title": "" }, { "docid": "111b673819d3af7b9d7f41decca6ab43", "score": "0.7430499", "text": "function res(arg,...REST) {\r\n // console.log(arg, REST);\r\n}", "title": "" }, { "docid": "1309d0adb933046019df0558c786be64", "score": "0.7304992", "text": "function _restParam(func,startIndex){return startIndex=null==startIndex?func.length-1:+startIndex,function(){for(var length=Math.max(arguments.length-startIndex,0),rest=Array(length),index=0;index<length;index++)rest[index]=arguments[index+startIndex];switch(startIndex){case 0:return func.call(this,rest);case 1:return func.call(this,arguments[0],rest)}}}", "title": "" }, { "docid": "38df81ce33f6a8d08e822367125ed4da", "score": "0.7215957", "text": "function func(a,b,c,...rest){\n console.log(a)\n console.log(b)\n console.log(c)\n console.log(rest)\n}", "title": "" }, { "docid": "681d99fef376e1446d5299fc43864f07", "score": "0.71341294", "text": "function _restParam(func,startIndex){startIndex=startIndex==null?func.length-1:+startIndex;return function(){var length=Math.max(arguments.length-startIndex,0);var rest=Array(length);for(var index=0;index<length;index++){rest[index]=arguments[index+startIndex];}switch(startIndex){case 0:return func.call(this,rest);case 1:return func.call(this,arguments[0],rest);} // Currently unused but handle cases outside of the switch statement:\n\t// var args = Array(startIndex + 1);\n\t// for (index = 0; index < startIndex; index++) {\n\t// args[index] = arguments[index];\n\t// }\n\t// args[startIndex] = rest;\n\t// return func.apply(this, args);\n\t};}", "title": "" }, { "docid": "6235e73573c95c11bcf7a922b97448a9", "score": "0.7031242", "text": "function funcw2Params(x=0, y=1, ...z){\n console.log(x, y);\n console.log(`This is the rest operator`, z,`\\n`);\n return(x+y);\n}", "title": "" }, { "docid": "2d01e4fd652fe67ee58fb0ab8d4bd26f", "score": "0.6895459", "text": "function restParameters(first, ...rest) {\n return rest[0] === 1 && rest[1] === 2;\n }", "title": "" }, { "docid": "538c456b7740f1eee01282dec4f5c733", "score": "0.68151957", "text": "function _restParam(func, startIndex) {\n\t startIndex = startIndex == null ? func.length - 1 : +startIndex;\n\t return function() {\n\t var length = Math.max(arguments.length - startIndex, 0);\n\t var rest = Array(length);\n\t for (var index = 0; index < length; index++) {\n\t rest[index] = arguments[index + startIndex];\n\t }\n\t switch (startIndex) {\n\t case 0: return func.call(this, rest);\n\t case 1: return func.call(this, arguments[0], rest);\n\t }\n\t // Currently unused but handle cases outside of the switch statement:\n\t // var args = Array(startIndex + 1);\n\t // for (index = 0; index < startIndex; index++) {\n\t // args[index] = arguments[index];\n\t // }\n\t // args[startIndex] = rest;\n\t // return func.apply(this, args);\n\t };\n\t }", "title": "" }, { "docid": "538c456b7740f1eee01282dec4f5c733", "score": "0.68151957", "text": "function _restParam(func, startIndex) {\n\t startIndex = startIndex == null ? func.length - 1 : +startIndex;\n\t return function() {\n\t var length = Math.max(arguments.length - startIndex, 0);\n\t var rest = Array(length);\n\t for (var index = 0; index < length; index++) {\n\t rest[index] = arguments[index + startIndex];\n\t }\n\t switch (startIndex) {\n\t case 0: return func.call(this, rest);\n\t case 1: return func.call(this, arguments[0], rest);\n\t }\n\t // Currently unused but handle cases outside of the switch statement:\n\t // var args = Array(startIndex + 1);\n\t // for (index = 0; index < startIndex; index++) {\n\t // args[index] = arguments[index];\n\t // }\n\t // args[startIndex] = rest;\n\t // return func.apply(this, args);\n\t };\n\t }", "title": "" }, { "docid": "538c456b7740f1eee01282dec4f5c733", "score": "0.68151957", "text": "function _restParam(func, startIndex) {\n\t startIndex = startIndex == null ? func.length - 1 : +startIndex;\n\t return function() {\n\t var length = Math.max(arguments.length - startIndex, 0);\n\t var rest = Array(length);\n\t for (var index = 0; index < length; index++) {\n\t rest[index] = arguments[index + startIndex];\n\t }\n\t switch (startIndex) {\n\t case 0: return func.call(this, rest);\n\t case 1: return func.call(this, arguments[0], rest);\n\t }\n\t // Currently unused but handle cases outside of the switch statement:\n\t // var args = Array(startIndex + 1);\n\t // for (index = 0; index < startIndex; index++) {\n\t // args[index] = arguments[index];\n\t // }\n\t // args[startIndex] = rest;\n\t // return func.apply(this, args);\n\t };\n\t }", "title": "" }, { "docid": "338fa09f663e9be3b25457b5550e3523", "score": "0.67799276", "text": "function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }", "title": "" }, { "docid": "338fa09f663e9be3b25457b5550e3523", "score": "0.67799276", "text": "function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }", "title": "" }, { "docid": "338fa09f663e9be3b25457b5550e3523", "score": "0.67799276", "text": "function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }", "title": "" }, { "docid": "338fa09f663e9be3b25457b5550e3523", "score": "0.67799276", "text": "function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }", "title": "" }, { "docid": "338fa09f663e9be3b25457b5550e3523", "score": "0.67799276", "text": "function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }", "title": "" }, { "docid": "338fa09f663e9be3b25457b5550e3523", "score": "0.67799276", "text": "function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }", "title": "" }, { "docid": "338fa09f663e9be3b25457b5550e3523", "score": "0.67799276", "text": "function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }", "title": "" }, { "docid": "338fa09f663e9be3b25457b5550e3523", "score": "0.67799276", "text": "function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }", "title": "" }, { "docid": "338fa09f663e9be3b25457b5550e3523", "score": "0.67799276", "text": "function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }", "title": "" }, { "docid": "338fa09f663e9be3b25457b5550e3523", "score": "0.67799276", "text": "function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }", "title": "" }, { "docid": "338fa09f663e9be3b25457b5550e3523", "score": "0.67799276", "text": "function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }", "title": "" }, { "docid": "338fa09f663e9be3b25457b5550e3523", "score": "0.67799276", "text": "function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }", "title": "" }, { "docid": "338fa09f663e9be3b25457b5550e3523", "score": "0.67799276", "text": "function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }", "title": "" }, { "docid": "338fa09f663e9be3b25457b5550e3523", "score": "0.67799276", "text": "function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }", "title": "" }, { "docid": "338fa09f663e9be3b25457b5550e3523", "score": "0.67799276", "text": "function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }", "title": "" }, { "docid": "338fa09f663e9be3b25457b5550e3523", "score": "0.67799276", "text": "function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }", "title": "" }, { "docid": "338fa09f663e9be3b25457b5550e3523", "score": "0.67799276", "text": "function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }", "title": "" }, { "docid": "338fa09f663e9be3b25457b5550e3523", "score": "0.67799276", "text": "function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }", "title": "" }, { "docid": "338fa09f663e9be3b25457b5550e3523", "score": "0.67799276", "text": "function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }", "title": "" }, { "docid": "338fa09f663e9be3b25457b5550e3523", "score": "0.67799276", "text": "function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }", "title": "" }, { "docid": "06815591bac1fcbd613c7c7b81c44b4a", "score": "0.67272943", "text": "function hello(s, a, ...rest) {\n console.log('hello1', s);\n console.log('hello2', a);\n console.log('hello3', rest);\n return '111';\n}", "title": "" }, { "docid": "d24b6cc231666cc72f6445015c18af86", "score": "0.6670261", "text": "function iAmAFunction(param1, param2, ...rest) {\n console.log([...arguments]); // [ 'Hello', 'have', 'a', 'nice', 'day', '!' ]\n console.log(rest); // [ 'a', 'nice', 'day', '!' ]\n}", "title": "" }, { "docid": "c968165c254dfc2fa1e88d99fe9476b0", "score": "0.66257805", "text": "function rest(...args) {\n return args.reduce((sum, arg) => sum + arg);\n}", "title": "" }, { "docid": "6b72fe42cf3b3072971905ed5c8c44e3", "score": "0.66088635", "text": "function print1( first, second, ...rest ) {\n console.log( 'First : ', first );\n console.log( 'Second : ', second );\n console.log( 'Rest : ', rest );\n}", "title": "" }, { "docid": "c52bdfa4cc3acff3fd878cb58fcfe951", "score": "0.656028", "text": "function theAwesome(...rest) {\n console.log('theAwesome');\n console.log(`${rest[0]} | ${rest[1]}`);\n console.log(rest[1]);\n return `${arguments[0]} | ${arguments.length} | ${arguments[1].nathan}`\n}", "title": "" }, { "docid": "c2456128e42c793ff51d982cc7631ed6", "score": "0.6555449", "text": "function printResult(first, second, third, ...rest){\n console.log(`First position is ${first}`);\n console.log(`Second position is ${second}`);\n console.log(`Third position is ${third}`);\n console.log(`Rest ${rest}`)\n}", "title": "" }, { "docid": "b10c40a4b44002bb91e51b0f0e451396", "score": "0.6549209", "text": "function rest() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return args;\n}", "title": "" }, { "docid": "d40217784999a9166eb6fd11933a12cf", "score": "0.64631265", "text": "function sumWithRestParams(...numbers){ \t\n\treturn numbers.reduce(\n\t\t(prev, current) => prev + current\n\t);\n}", "title": "" }, { "docid": "e0c0a58f709596ece32e5a5737f87a17", "score": "0.6447752", "text": "function argsAccessEmptyRestObject(...{}) {\n return arguments[0];\n}", "title": "" }, { "docid": "1a74e9594ee42531922cf757700c7e99", "score": "0.6426605", "text": "function restParamaterFunction(x, y, ...a) {\n return (x + y) * a.length;\n}", "title": "" }, { "docid": "149b3a482dc9c17a3cf9ef96b41e93cb", "score": "0.64209586", "text": "function argsAccessEmptyRestArray(...[]) {\n return arguments[0];\n}", "title": "" }, { "docid": "2698dbd7f22d9dba12c867c98e431e65", "score": "0.6335168", "text": "function restSum(...params) {\n let nums = [...params];\n let summedSums = nums.reduce((accumulator, value) => accumulator + value, 0);\n return summedSums;\n}", "title": "" }, { "docid": "00e87553dfc4185087a64dab9959b081", "score": "0.6295672", "text": "function restParameters(){\r\n // ...colors is a rest paramter (but is actually an array)\r\n \r\n function showColors(isMetalic,...colors){ \r\n if(isMetalic){\r\n console.log('the following colors are metalic:')\r\n }\r\n colors.forEach(c => console.log(c));\r\n }\r\n\r\n showColors(true, 'red', 'yellow', 'blue');\r\n\r\n showColors(false, 'red', 'green' , 'yellow', 'blue');\r\n}", "title": "" }, { "docid": "c3870f804e628c417c9eb8d0c8a4800e", "score": "0.6270279", "text": "function listadoFrutas(fruta1, fruta2, ...resto_de_fruta){\n\n console.log(\"Fruta 1 \", fruta1);\n console.log(\"Fruta 2 \", fruta2);\n console.log(resto_de_fruta);\n\n}", "title": "" }, { "docid": "2f885aff453d6fb6251e82d318087af7", "score": "0.6249404", "text": "function restParamaterFunction2(x, y) {\n var a = Array.prototype.slice.call(arguments, 2);\n return (x + y) * a.length;\n}", "title": "" }, { "docid": "520d8c86ead76ce032874155073aaac4", "score": "0.62277174", "text": "function arrayRest(...[a, b]) {\n return a + b;\n}", "title": "" }, { "docid": "30b3c12897adfdc92284883f3952f368", "score": "0.6222198", "text": "function hasRest(node) {\n return t.isRestElement(node.params[node.params.length - 1]);\n}", "title": "" }, { "docid": "1da13fc9c75e1538d2d554b8ea989361", "score": "0.6218655", "text": "function listadoFrutas(fruta1, fruta2, ...resto_frutas)\r\n{\r\n console.log(\"FRUTA 1:\", fruta1);\r\n console.log(\"FRUTA 2:\", fruta2);\r\n console.log(resto_frutas);\r\n}", "title": "" }, { "docid": "07b747a64b03f37ba54bc55b71bee800", "score": "0.62154263", "text": "function lotsOfArgs(mainVar, ...theRest){\n console.log('this is mainVar', mainVar);\n console.log('this is rest', theRest);\n}", "title": "" }, { "docid": "9937e0460825b176406388cb32595588", "score": "0.61675525", "text": "function listadoFrutas(fruta1, fruta2,... restoFrutas){\r\n\tconsole.log(\"Fruta 1: \"+fruta1);\r\n\tconsole.log(\"Fruta 2: \"+fruta2);\r\n\tconsole.log(restoFrutas);\r\n}", "title": "" }, { "docid": "16ab76ad1b7440bb63c4db9e791159e9", "score": "0.6149938", "text": "function getNameWithRest(name1, ...names){\r\n console.log(name1)\r\n console.log(names)\r\n}", "title": "" }, { "docid": "1a6518886262928c55e8c8bdcd89598a", "score": "0.6086961", "text": "function fetchStuff({ arg1, arg2, arg3, arg4, arg5 }) {\n pass;\n}", "title": "" }, { "docid": "1a6518886262928c55e8c8bdcd89598a", "score": "0.6086961", "text": "function fetchStuff({ arg1, arg2, arg3, arg4, arg5 }) {\n pass;\n}", "title": "" }, { "docid": "8614ab5073af7dc38be158318eabbc92", "score": "0.60867083", "text": "function sortRestArgs(...theArgs){\r\n let sortedArgs = theArgs.sort()\r\n return sortedArgs\r\n}", "title": "" }, { "docid": "bffef4eb5820aef06f7864cd454502d6", "score": "0.6068022", "text": "function multiply (a, b, ...rest){\n console.log('LOOK AT THE CODE to understand the magic: ',rest);\n return a * b;\n}", "title": "" }, { "docid": "8f7680a6d190bb1480d06bfdd302d08b", "score": "0.6019122", "text": "function pruebaRest(...meses){\n for (let uno of meses){\n document.write(uno + \"<br>\");\n }\n}", "title": "" }, { "docid": "c39b7dc02a4f188b853710dcf3c7b27e", "score": "0.6011055", "text": "function listadoRestSpread(lenguaje1,lenguaje2,lenguaje3,...lenguaje4){\n\tconsole.log(\"*********************************\");\n\tconsole.log(\"MOSTRANDO REST Y SPREAD\");\n\tconsole.log(\"Lenguaje1 : \",lenguaje1);\n\tconsole.log(\"Lenguaje2 : \",lenguaje2);\n\tconsole.log(\"Lenguaje3 : \",lenguaje3);\n\tconsole.log(\"Lenguaje4 : \",lenguaje4);\n}", "title": "" }, { "docid": "073c9de2d2ac3398818e3c3d4d0993ed", "score": "0.60071594", "text": "function listadoFrutas(fruta1, fruta2, ...restoDeFrutas){\n console.log(\"Fruta 1: \"+ fruta1);\n console.log(\"Fruta 2: \"+ fruta2);\n console.log(restoDeFrutas);\n}", "title": "" }, { "docid": "739d6833ee21c77490eb861b495ca281", "score": "0.59951854", "text": "function argsLengthEmptyRestObject(...{}) {\n return arguments.length;\n}", "title": "" }, { "docid": "d90e0619a03d217c74794169829dcef8", "score": "0.5987421", "text": "function fruitList(fruit_1, fruit_2, ...rest_of_fruits){\n console.log(\"Fruit 1 \", fruit_1);\n console.log(\"Fruit 2 \", fruit_2);\n console.log(rest_of_fruits);\n}", "title": "" }, { "docid": "296105c9f65ca6687fecbbcb22f35832", "score": "0.5986418", "text": "function printObjects( { name, age, ...rest } ) {\n console.log( 'Name : ', name );\n console.log( 'Age : ', age );\n console.log( 'Rest : ', rest );\n}", "title": "" }, { "docid": "8a86590ed96d12eb14b572d563f310df", "score": "0.59680486", "text": "function sortRestArgs(...theArgs) {\n let sortedArgs = theArgs.sort();\n return sortedArgs;\n}", "title": "" }, { "docid": "7143c8d2f363374308cc3e409df5abba", "score": "0.5967686", "text": "function rest(func, start) {\n return (0, _overRest3.default)(func, start, _identity2.default);\n}", "title": "" }, { "docid": "7143c8d2f363374308cc3e409df5abba", "score": "0.5967686", "text": "function rest(func, start) {\n return (0, _overRest3.default)(func, start, _identity2.default);\n}", "title": "" }, { "docid": "7143c8d2f363374308cc3e409df5abba", "score": "0.5967686", "text": "function rest(func, start) {\n return (0, _overRest3.default)(func, start, _identity2.default);\n}", "title": "" }, { "docid": "7143c8d2f363374308cc3e409df5abba", "score": "0.5967686", "text": "function rest(func, start) {\n return (0, _overRest3.default)(func, start, _identity2.default);\n}", "title": "" }, { "docid": "7143c8d2f363374308cc3e409df5abba", "score": "0.5967686", "text": "function rest(func, start) {\n return (0, _overRest3.default)(func, start, _identity2.default);\n}", "title": "" }, { "docid": "7143c8d2f363374308cc3e409df5abba", "score": "0.5967686", "text": "function rest(func, start) {\n return (0, _overRest3.default)(func, start, _identity2.default);\n}", "title": "" }, { "docid": "7143c8d2f363374308cc3e409df5abba", "score": "0.5967686", "text": "function rest(func, start) {\n return (0, _overRest3.default)(func, start, _identity2.default);\n}", "title": "" }, { "docid": "7143c8d2f363374308cc3e409df5abba", "score": "0.5967686", "text": "function rest(func, start) {\n return (0, _overRest3.default)(func, start, _identity2.default);\n}", "title": "" }, { "docid": "7143c8d2f363374308cc3e409df5abba", "score": "0.5967686", "text": "function rest(func, start) {\n return (0, _overRest3.default)(func, start, _identity2.default);\n}", "title": "" }, { "docid": "5e94dc8d8967d3a219319c61539fe4a3", "score": "0.5959258", "text": "function rest(func, start) {\n return overRest$1(func, start, identity);\n}", "title": "" }, { "docid": "5e94dc8d8967d3a219319c61539fe4a3", "score": "0.5959258", "text": "function rest(func, start) {\n return overRest$1(func, start, identity);\n}", "title": "" }, { "docid": "5e94dc8d8967d3a219319c61539fe4a3", "score": "0.5959258", "text": "function rest(func, start) {\n return overRest$1(func, start, identity);\n}", "title": "" }, { "docid": "5e94dc8d8967d3a219319c61539fe4a3", "score": "0.5959258", "text": "function rest(func, start) {\n return overRest$1(func, start, identity);\n}", "title": "" }, { "docid": "38da0c39a959744aee6f6410d82716cd", "score": "0.5950241", "text": "function funcWithMultipleParameters(arg1, arg2, arg3, arg4, arg5) {\n console.log(arg1);\n console.log(arg2);\n console.log(arg3);\n console.log(arg4);\n console.log(arg5);\n}", "title": "" }, { "docid": "8c2bad8dc19833e98c59fa517528db42", "score": "0.5922291", "text": "function listadoFrutas(frutal, fruta2, ...resto_de_frutas){ \n console.log(\"Fruta 1: \", frutal); \n console.log(\"Fruta 2: \", fruta2); \n console. log(resto_de_frutas); \n}", "title": "" }, { "docid": "8ee06ce36c44d6fcde9a372ccd1d7057", "score": "0.5905033", "text": "function paramFunction2(...params){\n console.log(params);\n}", "title": "" }, { "docid": "7cb11e1e88d55509b2b444ba761bea0e", "score": "0.58860254", "text": "function exercise(a, b, ...values){\n// Here, REST operator will ignore the first two values\n console.log(`\n We will multiply ${a} and ${b}\n Summation: ${values}\n `);\n let add = 0;\n const mult = a*b;\n values.forEach(i => {\n add += i;\n });\n return [mult, add];\n}", "title": "" }, { "docid": "40a1735e8f124b37c3818dc13330e706", "score": "0.5884698", "text": "function listadoFrutas(fruta1, fruta2, ...resto_de_frutas){\n\tconsole.log(\"Fruta1: \", fruta1);\n\tconsole.log(\"Fruta2: \", fruta2);\n\tconsole.log(\"Fruta2: \", resto_de_frutas);\n}", "title": "" }, { "docid": "526aa3a03b402a627cf6d785effacc1c", "score": "0.58691514", "text": "function listadoFrutas(fruta1, fruta2, ...resto_de_frutas){\n console.log(\"Fruta 1: \"+ fruta1);\n console.log(\"Fruta 2: \"+ fruta2);\n console.log(\"Resto de Frutas: \",...resto_de_frutas);\n}", "title": "" }, { "docid": "1bfd2891ef372ba6af85ab3199270308", "score": "0.5842263", "text": "function listadoFrutas(fruta1, fruta2, ...resto_de_frutas){\n console.log(\"Fruta 1: \", fruta1);\n console.log(\"Fruta 2: \", fruta2);\n console.log(\"Resto de frutas: \", resto_de_frutas);\n}", "title": "" }, { "docid": "0ea3c664fe919f34cc787547118f164d", "score": "0.5837233", "text": "function spreadRest(){\n\tlet name = [\"firstname\", \"lastname\"];\n\tlet bio = [...name, \"address\"];\n\tconsole.log(bio);\n\n\t// rest parameter\n\tfunction fullBio(...fullname) {\n\t\tlet addressWithName = [...fullname, \"address\"]; \n\t\tlet addressWithNameArray = [fullname, \"address\"];\n\t\tconsole.log(addressWithName); // [\"firstname\", \"lastname\", \"address\"]\n\t\tconsole.log(addressWithNameArray); // [Array(2), \"address\"]\n\n\t}\n\tfullBio(\"firstname\", \"lastname\");\n}", "title": "" }, { "docid": "6fae135527bcfa27f6727c5d02eaa991", "score": "0.58150417", "text": "function myFunc(x, y, ...params) {\r\n console.log(x);\r\n console.log(y);\r\n console.log(params);\r\n}", "title": "" }, { "docid": "7fa17ba0b2c6544bc4dcd3716bb6de2f", "score": "0.58103627", "text": "function types(firstArg, ...theRestOfTheArgs) {\n console.log(firstArg)\n console.log(theRestOfTheArgs[1])\n}", "title": "" }, { "docid": "91969bd092ccfeb86b7954f9a7e9ef44", "score": "0.5804683", "text": "function saludarRest(saludo, ...nombres) {\n for(i in nombres ){\n console.log(`${saludo} ${nombres}`);\n }\n}", "title": "" }, { "docid": "ca317fb8e4dc7d02b982fb8cc4c06036", "score": "0.5789539", "text": "function myFunction2(...params) {\n console.log(params);\n}", "title": "" }, { "docid": "61c643c1b8c2295bdb0eb8850164db8f", "score": "0.57628703", "text": "function argsLengthEmptyRestArray(...[]) {\n return arguments.length;\n}", "title": "" }, { "docid": "a3816945c30f6e8f157ca15802df2d61", "score": "0.5751973", "text": "function run(...param1){\n console.log(param1);\n}", "title": "" }, { "docid": "1b588fca5d5cfa229e46437be1e3c54e", "score": "0.5730834", "text": "function sum1(...args){ //args is an array. the ... is called Rest operator. Must be last arg.\n return args.reduce((a,b) => a + b);\n}", "title": "" }, { "docid": "15abdd4e868a6a132d1f8f186cf828a3", "score": "0.5720464", "text": "function sayHi(firstArg, ...restOfArgs) {\n console.log(`Hi, ${firstArg}`)\n console.log(restOfArgs)\n}", "title": "" }, { "docid": "833fefa673c120a097423686936040a6", "score": "0.56925297", "text": "function listadoFrutas(fruta1,fruta2, ...resto){ //rest = todos los valores que se le pasa en un array para despues demostrarlo\n console.log(\"Fruta1: \"+ fruta1);\n console.log(\"Fruta2: \"+ fruta2);\n}", "title": "" }, { "docid": "7fd875cccb72b0e29078b606ee98ed1a", "score": "0.5666541", "text": "function __rest$1(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&\"function\"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}", "title": "" }, { "docid": "03883641c6fea14f49a9bcccda9bdc32", "score": "0.56602603", "text": "function callrest()\n{\n const retsObject = rest(hero);\n}", "title": "" }, { "docid": "6828a8085ace6a7d9cfc20825c35a854", "score": "0.55873746", "text": "function hello(...myParameter){\n return myParameter\n}", "title": "" }, { "docid": "22e5d46be49873e26b3f195dc7b1b56b", "score": "0.55655676", "text": "function foo( x, y, ...z ) {\n console.log( x, y, z );\n}", "title": "" }, { "docid": "e6c43b2319f1c92f542c20657770d06e", "score": "0.55610824", "text": "function myFunc (...stuff) {\n console.log(stuff)\n}", "title": "" }, { "docid": "b8938a30935352e3d23e75b0e61bd4d1", "score": "0.55607605", "text": "function makeArrayRest() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return args;\n}", "title": "" }, { "docid": "5e4eaf5ee936026cbb69912b0666c19a", "score": "0.55385065", "text": "function foo( x, y, ...z ) {\n console.log( 'x = ', x );\n console.log( 'y = ', y );\n console.log( 'z = ', z );\n}", "title": "" }, { "docid": "69218784f69b7c626be9fec9930b2790", "score": "0.55342996", "text": "function makeArrayRest1(name) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n console.log('passede name was ' + name);\n return args;\n}", "title": "" } ]
21ea0dd0fac82f9ef93f0cd331e6508f
reset timer and start idle time from start
[ { "docid": "e0ce42343222ea9f8531d753ce6d914e", "score": "0.8364355", "text": "function resetTimer() {\n if (!state.isRunning) {\n return;\n }\n\n clearTimer();\n idleTimer = setTimeout(idleComplete.bind(this), options.idle);\n }", "title": "" } ]
[ { "docid": "5644a05ef24afab9c26d5ecf4c59f60f", "score": "0.8153526", "text": "function resetIdleTimer() {\n idleTimer = 0;\n}", "title": "" }, { "docid": "ca98adda342117d7d4961b60f3f3b7ab", "score": "0.78053457", "text": "function idleReset() {\r\n\r\n //Reset the timeout\r\n console.log(\"reset\");\r\n clearTimeout(timeout);\r\n\r\n idleBegin();\r\n\r\n}", "title": "" }, { "docid": "7c1c91c97cc51a0d1d216b7545148f22", "score": "0.76993394", "text": "function resetTimer(){cancelTimer&&(cancelTimer(),cancelTimer=null),start&&Date.now()-start>maxWait?runScheduledForNextTick||(runScheduledForNextTick=!0,utils.compile(runNow)):(start||(start=Date.now()),cancelTimer=utils.wait(runNow,wait))}", "title": "" }, { "docid": "dc18f69bbe1cccf486d476dc9ffaa7f5", "score": "0.7614303", "text": "resetIdleTimer(ev) {\n // Remove any timeouts as the user just interacted\n clearTimeout(_timeoutId);\n // Set idle time to 10 min\n _timeoutId = setTimeout(_idleCallback, _TEN_MINUTES_IN_MS);\n }", "title": "" }, { "docid": "4d861f8539a0e3ab4f698b196c959e78", "score": "0.754296", "text": "function resetTimer() {\n stopTimer();\n time = shortTimer ? 5: maxTime;\n writeTime();\n updateCircle();\n timerID = setInterval(updateTimer, 1000);\n }", "title": "" }, { "docid": "1b9f09cc87c04404c0687a819e25c66c", "score": "0.7524492", "text": "function resetTimer() {\n // 1) incase timer is paused, change back to reset\n state.resetTimer = true;\n // 2) Clear the existing Interval => To avoid duplicating timer\n Model.clearTimer();\n // 3) Start timer\n startTimer();\n}", "title": "" }, { "docid": "cd7f88408f3f8b9fcb1892728751a53d", "score": "0.75002754", "text": "function resetTimer() {\n if( cancelTimer ) {\n cancelTimer();\n cancelTimer = null;\n }\n if( start && Date.now() - start > maxWait ) {\n if(!runScheduledForNextTick){\n runScheduledForNextTick = true;\n utils.compile(runNow);\n }\n }\n else {\n if( !start ) { start = Date.now(); }\n cancelTimer = utils.wait(runNow, wait);\n }\n }", "title": "" }, { "docid": "cd7f88408f3f8b9fcb1892728751a53d", "score": "0.75002754", "text": "function resetTimer() {\n if( cancelTimer ) {\n cancelTimer();\n cancelTimer = null;\n }\n if( start && Date.now() - start > maxWait ) {\n if(!runScheduledForNextTick){\n runScheduledForNextTick = true;\n utils.compile(runNow);\n }\n }\n else {\n if( !start ) { start = Date.now(); }\n cancelTimer = utils.wait(runNow, wait);\n }\n }", "title": "" }, { "docid": "cd7f88408f3f8b9fcb1892728751a53d", "score": "0.75002754", "text": "function resetTimer() {\n if( cancelTimer ) {\n cancelTimer();\n cancelTimer = null;\n }\n if( start && Date.now() - start > maxWait ) {\n if(!runScheduledForNextTick){\n runScheduledForNextTick = true;\n utils.compile(runNow);\n }\n }\n else {\n if( !start ) { start = Date.now(); }\n cancelTimer = utils.wait(runNow, wait);\n }\n }", "title": "" }, { "docid": "f444a27b6117f84dce5f65a5d34233c4", "score": "0.74864894", "text": "function setTimer() {\n\tidleTime = 0;\n\t\n\t// increment the idle time counter each minute - watch out milliseconds!\n\tvar idleInterval = setInterval(\"timerIncrement()\", 60000);\n\t\n\t// zero the idle timer on mouse movement.\n\t$(document).mousemove(function (e) {\n\t idleTime = 0;\n\t});\n\t$(document).keypress(function (e) {\n\t idleTime = 0;\n\t});\n}", "title": "" }, { "docid": "a99c38cfdc6f865d34b02ea2ff0efd3f", "score": "0.7460662", "text": "start() {\n if (this.state === GuiTimer.State.RUNNING)\n return;\n this.state = GuiTimer.State.RUNNING;\n this.num_ticks = 0;\n this.elapsedTime = 0;\n }", "title": "" }, { "docid": "b0f4740091244ef723375fb145017bc8", "score": "0.73783827", "text": "resetIdle()\n {\n //only if not already in idle mode\n if (!this.state.waiting)\n {\n this.setState({waiting:true});\n ttrack.logEnd();\n this.minuteTimer.current.endTime();\n ttrack.waitForRunning();\n }\n }", "title": "" }, { "docid": "a8eb8442fb41076b84c253e063e08982", "score": "0.7309834", "text": "reset() {\n this.nextDelay = this.initialDelay;\n if (this.running) {\n const now = new Date();\n const newEndTime = this.startTime;\n newEndTime.setMilliseconds(newEndTime.getMilliseconds() + this.nextDelay);\n clearTimeout(this.timerId);\n if (now < newEndTime) {\n this.runTimer(newEndTime.getTime() - now.getTime());\n }\n else {\n this.running = false;\n }\n }\n }", "title": "" }, { "docid": "d21dc4db07bf59d094db28c0117faef0", "score": "0.72742116", "text": "function startTimer() {\n setIsActive(!isActive);\n }", "title": "" }, { "docid": "5b8a94f8f9b3c0ff1865a41d60c6113d", "score": "0.72443056", "text": "reStart() {\n this.state = GuiTimer.State.RUNNING;\n this.num_ticks = 0;\n this.elapsedTime = 0;\n }", "title": "" }, { "docid": "99896fdb7c764c0bc8657f766c50d266", "score": "0.7216905", "text": "function startTimer(){\n\n\t\t\t// Define the start time as now.\n\t\t\tstartTime = new Date();\n\n\t\t\t// Start an interval to update the time.\n\t\t\ttimer = setInterval( updateTimeRemaining, 100 );\n\n\t\t}", "title": "" }, { "docid": "cf37f5bfa3ccfb95ea9d67960bf9b26d", "score": "0.72121257", "text": "function startTimer(){\n\tif(timerON == 0){\n\t\ttimerON = 1;\n\t\ttickTock();\n\t}\n}", "title": "" }, { "docid": "67094e84c6d5b6f64a2042d7c6ae397e", "score": "0.71929216", "text": "function resetTimer() {\n if (timer.interval !== null) {\n clearInterval(timer.interval);\n }\n\n timer.interval = null;\n timer.seconds = null;\n timer.onEnd = null;\n timer.onRun = null;\n timer.paused = false;\n\n $('#timerControl').html('Roast!');\n\n $('#timer').html('00:00');\n $('#timer').css('visibility', 'hidden');\n hideProgressCircles();\n}", "title": "" }, { "docid": "c4c768fba428e8979752147f399c2d89", "score": "0.71924704", "text": "function resetTimer() {\n $interval.cancel(timer);\n timerState = 'idle';\n var workTime = INTERVAL_WORK;\n var breakTime = scope.isLongBreak() ? INTERVAL_LONG_BREAK : INTERVAL_BREAK;\n scope.timerCount = workCompleted ? breakTime : workTime;\n }", "title": "" }, { "docid": "b759cb7f871b1659b83229bbabb62cec", "score": "0.7189619", "text": "function resetTimer() {\n if (timer_is_on) {\n clearTimeout(timer);\n timer_is_on = false;\n }\n}", "title": "" }, { "docid": "f3f47e358b83ff217e27583a58ebdf1d", "score": "0.717133", "text": "function resetTimer() {\r\n\r\n if (data.interval) {\r\n\r\n clearInterval(data.inteval);\r\n\r\n }\r\n\r\n data.time = 0;\r\n showTime();\r\n clearTimes();\r\n\r\n}", "title": "" }, { "docid": "e9a7195a79451bbbc482f93fe2a7e74a", "score": "0.7155847", "text": "function resetTimer() {\n timerDuration = TT;\n secTimer = timerDuration;\n}", "title": "" }, { "docid": "c409e26a2cba303cd1761c73f2b85453", "score": "0.7153805", "text": "resetIdleTimer(ev){\n\t\tconsole.info('event:',ev.type);\n\t\t/* remove any timeouts as the user just interacted */\n\t\tclearTimeout(_timeoutId);\n\t\t/* queue the callback to happen 5 minutes from now */\n\t\t_timeoutId=setTimeout(_idleCallback, _FIVE_MINUTES_IN_MS);\n\t}", "title": "" }, { "docid": "dcc84a59412ad6febc93d052bce77eb6", "score": "0.71527094", "text": "function resetTimer() {\n\tseconds = 0;\n\ttimer();\n}", "title": "" }, { "docid": "b5fcbdf28a2309a015ee094c4e1cc023", "score": "0.7152628", "text": "function infiniteTimer() {\n hideTimerBtns(); \n m, resetTime = 0;\n pos = true; \n startTime = 0; \n changedTmr = false; \n changedTimer(this);\n }", "title": "" }, { "docid": "6b9cad2b6957f69303012da7d327f115", "score": "0.71504766", "text": "function resetTimer() {\n\talarm.stop();\n\tsetInput();\n\tdoTransition(\"stop\");\n}", "title": "" }, { "docid": "0b548a8541c4d7ad632dd6e7722c2fcd", "score": "0.7137211", "text": "function startTimer() {\n if (self._timeout) {\n clearTimeout(self._timeout);\n }\n self._timeout = setTimeout(function () {\n self.emit(\"timeout\");\n clearTimer();\n }, msecs);\n }", "title": "" }, { "docid": "a080631f27ae73ab3c79519e9c55749c", "score": "0.71096015", "text": "startTimer(){\n timer = setTimeout(this.timerSystem, this.temps);\n }", "title": "" }, { "docid": "b3f4853d3edf9d4b731bbf563b281d3e", "score": "0.71069264", "text": "function startTimer() {\r\n // Sets timer\r\n\r\n // Tests if win condition is met\r\n \r\n // Clears interval and stops timer\r\n \r\n // Tests if time has run out\r\n \r\n // Clears interval\r\n \r\n}", "title": "" }, { "docid": "66d2b4a860b51becaa3d3844a483b30e", "score": "0.7085133", "text": "function startTimer() {\n if (self._timeout) {\n clearTimeout(self._timeout)\n }\n\n self._timeout = setTimeout(function () {\n self.emit('timeout')\n clearTimer()\n }, msecs)\n } // Prevent a timeout from triggering", "title": "" }, { "docid": "cf4bcd2234716c2fc96e8c204ed35e97", "score": "0.7076396", "text": "function resetTimer()\n{\n\ttimer.reset(); // Call the reset method of the timer object from this file \n\t\n}", "title": "" }, { "docid": "cb8c747e284564087a4d21d6e08aee92", "score": "0.7068433", "text": "function resetTimer(){\n // when click to indicator or controls button stop timer\n clearInterval(timer);\n // then started again timer\n timer=setInterval(autoPlay,6000);\n }", "title": "" }, { "docid": "b9d06def4ebcbb94f7639cbd4f5cf67d", "score": "0.7050951", "text": "function startTimer() {\n // to clear any other timer intervals before the timer start working in case more than one timer interval are working at the same time on the game borad (Best Practice)\n if (game.timerInterval) {\n stopTimer();\n }\n game.timer = 60;\n updateTimerDisplay();\n\n game.timerInterval = setInterval(() => {\n game.timer--;\n updateTimerDisplay();\n //special case: when the interval get reduced to 0, game is over\n if (game.timer === 0) {\n updateTimerDisplay();\n handleGameOver();\n }\n }, 1000);\n}", "title": "" }, { "docid": "c37d9f42fa133062a7b05a6158d00238", "score": "0.7015146", "text": "function startTimer() {\n state.interval = setInterval(setTimer, 1000);\n}", "title": "" }, { "docid": "92b01be04359b43eddfca32a72cb6309", "score": "0.70146495", "text": "function slideResetTimer()\n{\n\ttimer_start = timer_elapsed;\n\tupdateTimer();\n}", "title": "" }, { "docid": "177528c6b0bca5329024a609e8262f84", "score": "0.6995576", "text": "function resetInactivity() {\n if (inactivityCounter >= inactivityTime) {\n self.start_time();\n }\n inactivityCounter = 0;\n }", "title": "" }, { "docid": "d2a8180630a01061f5ccc219dde3eb2d", "score": "0.6988282", "text": "reset() {\n this.setState( {\n isRunning: false,\n currentTime: this.startingTime\n });\n clearInterval(window.timerInterval);\n\n // callback to setup new game\n this.props.onTimerReset(this.state);\n }", "title": "" }, { "docid": "28a91caf6e8d45842846a7047c9b30bb", "score": "0.6941256", "text": "function startTimer() {\n\t\tcounter = setInterval(countDown, 1000);\n\t}", "title": "" }, { "docid": "1489f87f44a13a3ed42d270d36a007ed", "score": "0.69408894", "text": "function resetTimer() {\n //write code here\n stopClock = true;\n seconds = 0;//reset time back to zero(\"It took me a day to realize how easy it is\")\n minutes = 0;\n hours = 0;\n timerEl.textContent = \"00:00:00\";\n }", "title": "" }, { "docid": "eb7071df9e6e5bd7b899ea6795bc1d3e", "score": "0.6928704", "text": "function resetTimer() {\n pauseTimer();\n changeTitle(0+\":\"+0);\n}", "title": "" }, { "docid": "2c74c1c22973d65015413ede2c5c9ad4", "score": "0.6925927", "text": "function startTimer() {\n\t\t\t/* toggle start\\stop button */\n\t\t\t$scope.mode = 'Stop';\n\t\t\t$scope.icon = 'icon-stop';\n\n\t\t\tvar h, m, s, ms, today = new Date();\n\t\t\t/* compute for the duration, normalize for the user */\n\t\t\ttimeEnd = today.getTime();\n\t\t\tms = Math.floor((timeEnd - timeStart) / 1000);\n\t\t\th = checkTime(Math.floor(ms / 3600));\n\t\t\tms = Math.floor(ms % 3600);\n\t\t\tm = checkTime(Math.floor(ms / 60));\n\t\t\tms = Math.floor(ms % 60);\n\t\t\ts = checkTime(Math.floor(ms));\n\t\t\t/* normalize time string */\n\t\t\t$scope.timer = h + ':' + m + '.' + s;\n\n\t\t\t/* timer expired, restart timer */\n\t\t\ttmPromise = $timeout(function () {\n\t\t\t\tstartTimer();\n\t\t\t}, 500);\n\t\t}", "title": "" }, { "docid": "d19998dd048cfc8174ed8e47d7babb3c", "score": "0.6905533", "text": "function startTimer() {\n // 1) Update State\n state.activeTimer = true;\n // 2) Toggle start -> pause\n View.toggleStartPause();\n // 3) Change timer title\n elements.timerTitle.innerHTML = 'Pomodoro Timer';\n // 4) Check & update timer setting\n Model.updateLocalStorage();\n // 5) Reset existing timer if needed\n Model.resetTime();\n // 6) Start the timming setInterval function\n state.timerId = setInterval( () => {\n Model.interval();\n View.formatTimer();\n if (state.remainingTime <= 0) {\n timerFinished();\n };\n }, 1000);\n}", "title": "" }, { "docid": "7d07ca82c9f88cf0eb9af2bc25c08877", "score": "0.6902268", "text": "resetTimer() {\n clearInterval(this.theTimer);\n\n this.setState({\n timerText: \"START\",\n timerStatus: 0,\n timeFormatted: \"00:00:00\"\n });\n }", "title": "" }, { "docid": "74fa6802dcb4846a71523db18aae0294", "score": "0.6889447", "text": "function resetTimer() {\n console.log(\"Reset\");\n timer.innerHTML = \"00:00:00\";\n hr = 0;\n min = 0;\n sec = 0;\n stoptime = true;\n}", "title": "" }, { "docid": "c6940802fa1f47d7e42453accc2d8bee", "score": "0.6872907", "text": "function startTimer() {\n timerId = setInterval(countdown, 1000);\n }", "title": "" }, { "docid": "a073fee3ce3fda8f7f047c0eb578def1", "score": "0.6867085", "text": "function startTimer() {\n console.log(\"Started\");\n if (stoptime == true) {\n stoptime = false;\n timerCycle();\n }\n}", "title": "" }, { "docid": "8c959b77fecfd3d4bb83abb0a1eeeedb", "score": "0.68494755", "text": "start()\n {\n this.stop();\n\n const priv = d.get(this);\n\n const cb = this.safeCallback(() =>\n {\n this.timeout();\n\n if (priv.repeat && priv.running)\n {\n priv.currentTimer = setTimeout(cb, priv.interval);\n }\n else\n {\n priv.currentTimer = null;\n }\n\n });\n\n priv.currentTimer = setTimeout(cb, priv.interval);\n }", "title": "" }, { "docid": "32968fe127e5e9029af3915270e11a84", "score": "0.67899793", "text": "function resetTime() {\n startTime = millis();\n}", "title": "" }, { "docid": "be426922e7b9b8e3e2df2fa0fb9825f8", "score": "0.678944", "text": "function resetTimer(timer) {\n if (timer) {\n clearInterval(timer);\n }\n}", "title": "" }, { "docid": "be426922e7b9b8e3e2df2fa0fb9825f8", "score": "0.678944", "text": "function resetTimer(timer) {\n if (timer) {\n clearInterval(timer);\n }\n}", "title": "" }, { "docid": "be426922e7b9b8e3e2df2fa0fb9825f8", "score": "0.678944", "text": "function resetTimer(timer) {\n if (timer) {\n clearInterval(timer);\n }\n}", "title": "" }, { "docid": "bc7220ec8df4eef34d4f16e4d56b2b7b", "score": "0.6785029", "text": "function resetTimer() {\n clearInterval(timer);\n paused = true;\n startButton.innerHTML = 'Start';\n totalTime = 25 * 60;\n minutes = Math.floor(totalTime / 60);\n seconds = totalTime - minutes * 60;\n displayTime(minutes, seconds);\n}", "title": "" }, { "docid": "6e435f0ecfb189b6f3b46fbbeab2af5e", "score": "0.6782156", "text": "reset() {\n this.start_time = millis();\n }", "title": "" }, { "docid": "fd71e5e5166dcc0c01b7d6804b3184eb", "score": "0.6781738", "text": "function startTimer() {\n if (!clockRunning) {\n timerId = setInterval(count, 1000);\n clockRunning = true;\n }\n }", "title": "" }, { "docid": "ba313d514eaf7184d1fd639c78007b9e", "score": "0.67756426", "text": "function resetTimer(){\n\t\t$('#description').text('Session');\n\t\tbreakNumber = 5;\n\t\tsessionNumber = 25;\n\t\ttotalSecondsRemaining = sessionNumber * 60;\n\t\tdisplayNewValues();\n\t}", "title": "" }, { "docid": "cda3a77e9455562b902a1308f6952bb1", "score": "0.676368", "text": "function startTimer()\n{\n startTime = new Date();\n}", "title": "" }, { "docid": "c5f28970e6bdc2ba0864d45216e066c4", "score": "0.6748591", "text": "function timer() {\n startTimer();\n timeInterval = setInterval(startTimer, 1000);\n}", "title": "" }, { "docid": "7822df3b0e8299f6f1e20a83dfc011fb", "score": "0.67479074", "text": "function beginTimer(timer)\n{\n\t// Get our start time\n\tvar dteStart = new Date();\n\tdteStart = dteStart.getTime();\n\t\n\t// Call countdown clock function\n\tcountDownClock(dteStart,timer);\n\t\n\t// Reset elements to their defaults\n\t$clock.show();\n\t$timer.show();\n}", "title": "" }, { "docid": "808a6e53e3fc3246ab226942a95b2236", "score": "0.6747874", "text": "function startTimer()\r\n{\r\n timerClear = window.setInterval(\"updateTime()\", 1000);\r\n}", "title": "" }, { "docid": "d7ff5ceed581597398eee10093966e33", "score": "0.6746119", "text": "function reset() {\n setTime(30);\n setIsActive(false);\n }", "title": "" }, { "docid": "6caf9682f017451a48e5727b833e25a6", "score": "0.67445964", "text": "function resetTimer() {\r\n\tclearInterval(time);\r\n\ttimer = \"0:00\";\r\n\t$(\".time\").text(\"Time: \"+timer);\r\n}", "title": "" }, { "docid": "b4e6342a3208de701a71b68546325a64", "score": "0.67342186", "text": "function resetTime() {\n time = 16;\n }", "title": "" }, { "docid": "39ef3944ac755354fb56f9e64a9af0ad", "score": "0.67210644", "text": "function setTimer(){\n if (timer1.active){\n timer1.el.textContent = toMin(--timer1.time);\n if (timer1.time === 0){\n endGame(2);\n }\n } else if (timer2.active){\n timer2.el.textContent = toMin(--timer2.time);\n if (timer2.time === 0){\n endGame(1);\n }\n }\n }", "title": "" }, { "docid": "869895870c2eb11bde0192a2352ab8b1", "score": "0.6719596", "text": "function resetTimer() {\n timerTime = 25;\n breakTime = 5;\n clearInterval(timerStart);\n $('#work-time').html(timerTime);\n $('#break-time').html(breakTime);\n $('#timer').html(timerTime+':00');\n $('#clockTimer').prop('disabled', false);\n $('#clock').removeClass('breakInterval');\n \n }", "title": "" }, { "docid": "a9f32c0af447f7d08c58ad9441ded5aa", "score": "0.6685418", "text": "__startTimer() {\n if (!this.__timer && this.hasListener(\"interval\")) {\n var timer = new qx.event.Timer(this.getTimeoutInterval());\n timer.addListener(\"interval\", this._onInterval, this);\n timer.start();\n\n this.__timer = timer;\n }\n }", "title": "" }, { "docid": "d76c4b5641ddf292b61d4e857c00068d", "score": "0.6653376", "text": "restartTimer() {\n this.stopTimer();\n this.startTimer();\n }", "title": "" }, { "docid": "1f34b28a9adce3e8b849973238ce6fd0", "score": "0.66425484", "text": "function resetTimer() {\n clearInterval(timerInterval);\n timeCount=0;\n $(clock).text('0 minutes 0 seconds');\n}", "title": "" }, { "docid": "f4e1bb6c2cf8a3a179f0d692300211a4", "score": "0.663644", "text": "resetTimer(){\n \tif(this.state.isWorkTime){\n\t \tthis.setState({\n\t \t\ttime:{minutes:this.state.workTime, seconds:'00'}\n\t \t})\n\t }\n\t else{\n\t \tthis.setState({\n\t \t\ttime:{minutes:this.state.breakTime, seconds:'00'}\n\t \t})\n\t }\n \tthis.stopCountDown();\n }", "title": "" }, { "docid": "727ab7f297b1686417832287f6a23d80", "score": "0.6629848", "text": "setTimer() {\n this.timerId = setInterval(() => this.tick(), this.calculateTempo(this.state.bpm));\n }", "title": "" }, { "docid": "81a0bc00d9fce3452b02b4ce8a348c64", "score": "0.662374", "text": "resetIdleTimeout()\n {\n clearTimeout(this.idleTimer);\n\n const {idle_timeout: idleTimeout} = this.options;\n\n if (idleTimeout !== null) {\n this.idleTimer = setTimeout(() => {\n throw new Error('The idle timeout has been reached.');\n }, idleTimeout * 1000);\n }\n }", "title": "" }, { "docid": "24845de8dc22e4e0b795ef91cb1aaf19", "score": "0.6619044", "text": "beginTimer() {\n timerIntervalId = setInterval(this.decrementTime, 1000);\n }", "title": "" }, { "docid": "8479b225c09e964976edf10fee5fb669", "score": "0.65945137", "text": "function clockStart() {\n time = 60;\n if (!countingDown) {\n timeKeep = setInterval(count, 1000);\n countingDown = true;\n }\n\n }", "title": "" }, { "docid": "e559d0a20ed8d97e86333bd300d6c6e6", "score": "0.65907556", "text": "function startTimer() {\n let sec;\n timerCounter++\n sec = timerCounter;\n if (timerCounter === 60) {\n timerMin++;\n sec = 0;\n timerCounter = 0;\n }\n document.querySelector('#timer').innerHTML = addZeroToTimer(timerMin) + ':' + addZeroToTimer(sec);\n }", "title": "" }, { "docid": "9e6adc141170a61c620389ac63d0f99e", "score": "0.655808", "text": "function resumeTimer() {\n setTimer(setInterval(() => {\n\t\t\tdisplayTimer();\n\t\t},1000))\n\t}", "title": "" }, { "docid": "c9fc62b4d8493964a0649bbc1fbd9927", "score": "0.6552772", "text": "function timeStart() {\n intervalId = setInterval(timeCount, 1000);\n }", "title": "" }, { "docid": "abd4c7ac63e4615f6449408d84045861", "score": "0.65518075", "text": "function startTimer () {\n setInterval(myTimer, 100);\n }", "title": "" }, { "docid": "11291275a0a87326a410eec65596efd1", "score": "0.6547816", "text": "function resetDefault() {\n clearInterval(countdownProgress);\n $('#break-length').html(5);\n $('#session-length').html(25);\n timerActive = false;\n timerPaused = false;\n timerType = 'session';\n $('#circle-status').html(\"START\");\n }", "title": "" }, { "docid": "2b0be3162c8bc21bdcb3626aa1f22c19", "score": "0.6545871", "text": "function resetActionTimer() {\n actionTimer = new Date()\n }", "title": "" }, { "docid": "e5e3e0f7165a40541b0b54ef41471f43", "score": "0.6533825", "text": "function reset() {\n clearInterval(interval);\n seconds = 0;\n minutes = 0;\n hours = 0;\n eleDisplay.innerHTML = \"00:00:00\";\n eleStartButton.innerHTML = \"Start\";\n }", "title": "" }, { "docid": "1d65cecb797d57a263d1fa37f9d9b01e", "score": "0.6529498", "text": "function doTimer() {\n\t Hercules_Universal.jog_timer = 0;\n\t}", "title": "" }, { "docid": "1576ed52f2ad77ddd96aa5ba6aba38ce", "score": "0.65265936", "text": "reset(){\n\n //clear the interval function to stop the counting\n window.clearInterval(counter)\n //set all the variables to zero\n this.seconds = 0;\n this.minutes = 0;\n this.hours = 0;\n\n //set the status to false, so the stopwatch can be started after it is reset\n stopwatchStatus = false\n document.getElementById(\"stopwatch-time\").innerHTML = \"0h:0m:0s\"\n document.getElementById(\"start\").innerHTML = \"Start\";\n\n }", "title": "" }, { "docid": "2f5f55908d74125b25708105f001a795", "score": "0.6503157", "text": "resetTimers()\n {\n this._blackTimer.resetTimer();\n this._whiteTimer.resetTimer();\n clearInterval(this._winIntervalID);\n this._currentState = STATE[0];\n }", "title": "" }, { "docid": "59aa9788fe4fd5ccf643adf543d494b7", "score": "0.650315", "text": "function startTimer() {\n // lowering the timerValue\n timerValue = stateRequirements[currentState].timerlength;\n clearInterval(theTimer);\n theTimer = setInterval(runningTimer, 1000);\n $(\"#timer\").html(\"<h2>\" + timerValue + \"</h2>\");\n\n }", "title": "" }, { "docid": "1a8627113339bfdde0782f1e5ce22947", "score": "0.6500862", "text": "function resetSessionIdleTime() {\n sessionIdleTime = 0;\n activityOccurred = true;\n}", "title": "" }, { "docid": "61afd49190083d752dcedf5bdf05fab9", "score": "0.6500283", "text": "resetTimer() {\n this.stopTimer();\n this.props.resetTimer();\n this.props.onPlayStopTimer(false);\n this.setState({\n timerSecond: 0,\n isSession: true,\n });\n }", "title": "" }, { "docid": "fa3889d0c3db0ec405a0467e15d8efbf", "score": "0.6493807", "text": "function startTimer() {\r\n if (gTimeInterval) return\r\n else {\r\n gStartTime = new Date().getTime();\r\n gTimeInterval = setInterval(function () {\r\n getGameTime()\r\n renderTime()\r\n }, 1000)\r\n };\r\n\r\n}", "title": "" }, { "docid": "f44ebcd0cb88f409d9b807eac99da639", "score": "0.6492697", "text": "function restartTimer(){\n startTimer = setInterval(next,10000);\n\n}", "title": "" }, { "docid": "799d9963c85549c012a2e61fb78f8b22", "score": "0.64911795", "text": "function timerIncrement() {\n idleTime++;\n \n if (idleTime >= 2) { // 2 minutes\n logout();\n }\n}", "title": "" }, { "docid": "12cc7d13c075c8504dfa20cae190146d", "score": "0.6490447", "text": "resetTimer() {\n this.pauseTimer();\n this.setState({\n timerSecs: '00',\n timerMins: '00',\n startTimerFlag: false,\n timerMsg: ''\n });\n }", "title": "" }, { "docid": "c09603fcf991edc77c77a9dea416951c", "score": "0.6476423", "text": "startStop() {\n let now = new Date()\n if (this.timerEnd === null && this.pauseTime === null) {\n // Starts timer.\n this.sessionStart(this.sessionLength * 60000)\n } else if (this.pauseTime === null) {\n // Pauses timer.\n clearInterval(this.interval)\n this.pauseTime = (this.timerEnd - now)\n this.interval = null\n this.timerEnd = null \n this.forceUpdate()\n } else {\n // Unpauses timer. Ensures correct timer is re-initialised.\n if (this.state.timerLabel === \"Session\") {\n this.sessionStart(this.pauseTime)\n } else {\n this.breakStart(this.pauseTime)\n }\n this.pauseTime = null\n }\n }", "title": "" }, { "docid": "d6017b8cf2a21a303338aec37fa4b296", "score": "0.6473825", "text": "reset() {\n this.stop();\n\n if (this.refs.timer) {\n this.refs.timer.resetTimer();\n }\n }", "title": "" }, { "docid": "147028c4c65aca975f42537a71ebbb7a", "score": "0.64735335", "text": "function resetTimer() {\n\tclearInterval(timer);\n\ttimer = setInterval(NextSlideAutomation, 5000);\n}", "title": "" }, { "docid": "2e31ecd2be9e8ad4dd050b5d1357ee17", "score": "0.6466726", "text": "startTimer() {\n\t\tthis.open = true;\n\t\tsetTimeout(function() {\n\t\t\tthis.open = false;\n\t\t}.bind(this), this.timeout * 60 * 1000);\n\t}", "title": "" }, { "docid": "2c8c5b1faec9c5496dcfafbe82671f41", "score": "0.64627147", "text": "function startTimer() {\n clock = setInterval(time, 1000);\n}", "title": "" }, { "docid": "05b2840c30e99e8f1c1707d8fcf48975", "score": "0.6455185", "text": "startTimer() {\n // run the countup function which adds one to the elapsedtime and setinterval to run every second\n setInterval(this.countUp, 1000);\n }", "title": "" }, { "docid": "2eaa3264b402a4263639dbd5a71b2230", "score": "0.6453928", "text": "_startTimer () {\n\t\tif (this.timer != null) clearInterval(this.timer);\n\n\t\tlet secsLeft = this.gameDuration;\n\n\t\t// Update the game every second\n\t\tthis.timer = setInterval(() => {\n\t\t\tthis._setCounterText(secsLeft -= 1);\n\n\t\t\t// Reset the game if the time has run out.\n\t\t\tif (secsLeft <= 0) {\n\t\t\t\tclearInterval(this.timer);\n\t\t\t\tthis._announceWinner(null);\n\t\t\t\tthis._restart();\n\n\t\t\t} else if (this._checkForWinner()) {\n\t\t\t\tthis._restart();\n\t\t\t}\n\t\t}, 1000);\n\n\t\tthis._setCounterText(secsLeft);\n\t}", "title": "" }, { "docid": "643938e50f6a4f2a5892ee84359bdb94", "score": "0.64515644", "text": "function startstopTimer() {\n clearInterval(timerInterval);\n var processedTime = tmr.minutesCount * 60 + tmr.secondsCount;\n if (processedTime !== 0 && tmr.toggleState === false) {\n if (timeLeft < processedTime) {\n ToggleTimer(true, timeLeft);\n }\n else {\n ToggleTimer(true, processedTime);\n }\n }\n else if (processedTime !== 0) {\n clearInterval(timerInterval);\n ToggleTimer(false, timeLeft);\n }\n else {\n clearInterval(timerInterval);\n ToggleTimer(false);\n }\n}", "title": "" }, { "docid": "8c3a0f60c5de4a4a33a742695af888ea", "score": "0.6441438", "text": "function startTimer(){\n if(!running){\n changeIcon(icoActive);\n startTime = new Date().getTime();\n tInterval = setInterval(getShowTime, 1);\n // change 1 to 1000 above to run script every second instead of every millisecond. one other change will be needed in the getShowTime() function below for this to work. see comment there.\n paused = 0;\n running = 1;\n timerDisplay.style.background = \"#FF6700\"; //active timer color\n timerDisplay.style.cursor = \"auto\";\n timerDisplay.style.color = \"white\";\n }else{\n pauseTimer();\n }\n}", "title": "" }, { "docid": "5429595ae3d7c63203a2b7ad95654b2e", "score": "0.64412105", "text": "function reset(){\n stop();\n start();\n}", "title": "" }, { "docid": "fcd64456ce0d6f9396d1ef7f5fbaed52", "score": "0.64385504", "text": "startTimer() {\n Timing.start(CONST.TIMING.SWITCH_REPORT);\n }", "title": "" } ]
441f921a5a66b2509aa15fa723199586
takes an obstacle object from DrawLine and draws it.
[ { "docid": "7fd704de10aa26ee0cbf464b846e8214", "score": "0.76551265", "text": "function drawObstacle(obstacle)\n{\n\n if(obstacle[\"type\"] == \"begin\")\n {\n obstacle[\"orient\"] = \"horizontal\";\n var isObstacle = findBegin()\n \n if (isObstacle != -1) //e.g. if there IS a beginning square\n { \n obstacles.splice(isObstacle, 1) \n drawGrid();\n }\n }\n \n obstacles.push(obstacle); \n\n x = obstacle[\"x\"] * INTERVAL\n y = obstacle[\"y\"] * INTERVAL\n \n switch(obstacle[\"orient\"])\n {\n case \"vertical\":\n var moveX = 0;\n var moveY = INTERVAL;\n break;\n case \"horizontal\":\n var moveX = INTERVAL;\n var moveY = 0;\n break;\n }\n\n //sets up the context...\n var canvas = document.getElementById(\"canvas\");\n var context = canvas.getContext(\"2d\");\n \n switch(OBSTACLE_TYPE)\n {\n case \"wall\":\n context.strokeStyle=\"#FF0000\";\n break;\n case \"end\":\n context.strokeStyle=\"#00DD00\";\n break;\n case \"permeable\":\n context.strokeStyle=\"#0000FF\";\n break;\n case \"begin\":\n context.strokeStyle=\"#005500\";\n break;\n }\n\n context.beginPath();\n \n context.moveTo(x+BORDER, y+BORDER); //Move the line to the coordinate\n context.lineTo(x + moveX+BORDER, y + moveY+BORDER); //and draw the hash.\n\n context.stroke();\n}", "title": "" } ]
[ { "docid": "07138b50217dd520774804c206c0052c", "score": "0.7147922", "text": "function drawObstacle(){\n ctx.fillStyle = \"maroon\";\n obstacles.forEach(obstacle => {\n ctx.fillRect(obstacle.x, obstacle.y+=0.5, obstacle.w, obstacle.h);\n })\n \n }", "title": "" }, { "docid": "f949a552cc798e0b3bd2577128e27e4d", "score": "0.7083107", "text": "function drawObst() {\r\n\r\n obstacle.draw();\r\n obstacle2.draw();\r\n obstacle10.draw();\r\n obstacle11.draw();\r\n obstacle12.draw();\r\n obstacle13.draw();\r\n\r\n obstacle3.draw();\r\n obstacle4.draw();\r\n obstacle5.draw();\r\n obstacle6.draw();\r\n obstacle7.draw();\r\n\r\n obstacle8.draw();\r\n obstacle9.draw();\r\n }", "title": "" }, { "docid": "3ecda6298cff131b81847c07a02d7aa4", "score": "0.69471675", "text": "function Obstacle() {\n this.xPos = Math.random() * (canvas.width - OBSTACLE_OPENING);\n this.yPos = -200;\n\n this.draw = function () {\n ctx.lineWidth = 4;\n ctx.strokeStyle = \"#000\";\n ctx.strokeRect(-10, this.yPos, this.xPos + 10, 20);\n ctx.strokeRect(this.xPos + OBSTACLE_OPENING, this.yPos, canvas.width, 20);\n ctx.fillStyle = \"#fdd813\";\n ctx.fillRect(-10, this.yPos, this.xPos + 10, 20);\n ctx.fillRect(this.xPos + OBSTACLE_OPENING, this.yPos, canvas.width, 20);\n }\n }", "title": "" }, { "docid": "9b78c71ee7b6cd1d81229d4bcf96db6e", "score": "0.68430567", "text": "display() {\n\t\tfill(\"#00c07f\"); // Color of the obstacle\n\t\trect(this.x, this.y, this.obstacleWidth, 100); // Obstacle is a rectangle\n\t}", "title": "" }, { "docid": "c2d80dd0f6622cc7eab12470e69cf60a", "score": "0.66833717", "text": "line(obj){\n\t\tthis.beginPath(obj)\n\t\tthis.moveTo({x:obj.x[0],y:obj.y[0]})\n\t\tthis.lineTo({x:obj.x[1],y:obj.y[1]})\n\t\tthis.stroke(obj)\n\t}", "title": "" }, { "docid": "85caefb108f3e864f11cf85120c361b1", "score": "0.65803146", "text": "draw() {\n \n // draw correspondingly for the obstacle car.\n if(!this.isPlayer) {\n\n ctx.save();\n ctx.beginPath();\n ctx.drawImage(OBSTACLE_IMAGE, ((laneWidth - this.width) / 2 ) + laneWidth * (this.currentLane - 1), this.y + this.offSet);\n ctx.fill();\n ctx.closePath();\n ctx.restore();\n }else if(this.isPlayer) {\n\n // draw correspondingly for the player car.\n ctx.save();\n ctx.beginPath();\n ctx.drawImage(PLAYER_IMAGE, ((laneWidth - this.width) / 2 ) + laneWidth * (this.currentLane - 1), this.y - this.height - 20);\n ctx.fill();\n ctx.closePath();\n ctx.restore();\n }\n }", "title": "" }, { "docid": "7ac8b0af03ec9d30d69d7d316a3faa31", "score": "0.6438472", "text": "function Obstacle()\n{\n var topRand = Math.abs(random(170,height) - SPACING);\n this.top = topRand;\n this.bottom = height - (this.top + SPACING);\n this.x = width;\n this.width = 30;\n this.speed = 3;\n this.passed = false;\n\n // displays the obstacle\n this.show = function()\n {\n fill( 0,191,255);\n rect(this.x, 0,this.width,this.top);\n rect(this.x, height-this.bottom,this.width,this.bottom);\n }\n\n // updates the position of the obstacle based on it's speeds\n this.update = function()\n {\n this.x -= this.speed;\n }\n\n // returns true if the obstacle is off the offscreen else false\n this.offscreen = function()\n {\n if(this.x < -this.width)\n return true;\n\n return false;\n }\n\n // returns true if an obstacle has collided with a bird else false\n this.collides = function(bird)\n {\n if((bird.y+BIRDOFFSET) < this.top || (bird.y+BIRDOFFSET) > (height - this.bottom))\n {\n if((bird.x+BIRDOFFSET) > this.x && (bird.x+BIRDOFFSET) < (this.x + this.width))\n {\n this.passed = false;\n return true;\n }\n }\n\n return false;\n }\n\n // returns true if a bird has passed through an obstacle else false\n this.pass = function(bird)\n {\n if((bird.x+BIRDOFFSET) > (this.x + this.width) && !this.passed)\n {\n this.passed = true;\n return true;\n }\n\n return false;\n }\n}", "title": "" }, { "docid": "2f181db9af311c6b8e9fd8584a76e496", "score": "0.64326334", "text": "function clickObstacle(e) {\r\n\r\n if (!painting) return;\r\n\r\n //returns mouse position of user\r\n var x = e.pageX - (window.innerWidth - (canvas.width + 425));\r\n var y = e.pageY - 135;\r\n\r\n for (var i = 0; i < n; i++) {\r\n for (var j = 0; j < n; j++) {\r\n if (i * cellSide < x && x < i * cellSide + cellSide && j * cellSide < y && y < j * cellSide + cellSide) {\r\n //adding new obstacle\r\n if (attribute == \"add\" && ar[i][j] == 0) {\r\n ar[i][j] = 1;\r\n drawRec(i, j, \"#808080\");\r\n\r\n if (i == startx && j == starty) {\r\n hasStart = false;\r\n startx = -1;\r\n starty = -1;\r\n }\r\n\r\n else if (i == endx && j == endy) {\r\n hasEnd = false;\r\n endx = -1;\r\n endy = -1;\r\n }\r\n }\r\n\r\n //resetting current obstacle\r\n else if (attribute == \"remove\" && ar[i][j] == 1) {\r\n ar[i][j] = 0;\r\n drawRec(i, j, \"white\");\r\n }\r\n return;\r\n }\r\n }\r\n }\r\n}", "title": "" }, { "docid": "ac02aeeede110f44d5a91473c7506298", "score": "0.619044", "text": "function obstacle(){\n\tthis.height = Math.floor(minHeight + Math.random()*(maxHeight-minHeight+1));\n\tthis.width = Math.floor(minWidth + Math.random()*(maxWidth-minWidth+1));\n\n\t// drawing the obstacle\n\tthis.x = 1200;\n\tthis.y = gameArea.canvas.height - this.height;\n\tthis.index = Math.floor(Math.random()*colors.length);\n\tthis.color = colors[this.index];\n\tthis.draw = function(){\n\t\tgameArea.context.fillStyle = this.color;\n\t\tgameArea.context.fillRect(this.x, this.y, this.width, this.height);\n\t\t// gameArea.context.drawImage(imgObstacle, this.x, this.y, this.width, this.height);\n\t}\n}", "title": "" }, { "docid": "84b1f94e15a273bcb6e9d063aacd207f", "score": "0.6186228", "text": "function Obstacle(x, y, w, h, s) {\n Rectangle.call(this, x, y, w, h);\n this.speed = s;\n}", "title": "" }, { "docid": "d2f61c02caa27efb3a624f17c94dacae", "score": "0.61546606", "text": "function setLine(x, y)\n{\n var lessThanX = 0;\n var lessThanY = 0;\n //gets whether it's closer to a horizontal or vertical line\n if (x % INTERVAL < INTERVAL - (x % INTERVAL) )\n { var x_dist = x % INTERVAL }\n else { var x_dist = INTERVAL - (x % INTERVAL)\n lessThanX = 1;\n }\n\n if (y % INTERVAL < INTERVAL - (y % INTERVAL))\n { var y_dist = y % INTERVAL }\n else { var y_dist = INTERVAL - (y % INTERVAL)\n lessThanY = 1;\n }\n\n \n if (x_dist < y_dist) { //closer to vertical line, VERTICAL hash\n \n if (lessThanX == 1){\n //user clicked BEHIND grid mark\n while(x % INTERVAL != 0) //line up exactly to grid mark\n { x++; } //it's ++ because you're BEHIND the grid mark\n while(y % INTERVAL != 0)\n { y--; }\n } else { \n //user clicked IN FRONT of grid mark\n while(x % INTERVAL != 0)\n { x--; }\n while(y % INTERVAL != 0)\n { y--; }\n }\n\n //now save x and y based on intervals\n var x_int = x / INTERVAL;\n var y_int = y / INTERVAL;\n\n //create new obstacle item\n var DictItem = {};\n DictItem[\"type\"]=OBSTACLE_TYPE;\n DictItem[\"orient\"]=\"vertical\";\n DictItem[\"x\"]=x_int;\n DictItem[\"y\"]=y_int;\n }\n else { //closer to horizontal line, HORIZONTAL hash\n\n if(lessThanY == 1) { \n //user clicked BEHIND grid mark\n while(x % INTERVAL != 0) //line up exactly to grid mark\n { x--; } \n while(y % INTERVAL != 0) \n { y++; } //it's ++ because you're BEHIND the grid mark\n } else { \n //user clicked IN FRONT of grid mark\n while(x % INTERVAL != 0)\n { x--; }\n while(y % INTERVAL != 0)\n { y--; }\n }\n\n //now save x and y based on intervals\n var x_int = x / INTERVAL;\n var y_int = y / INTERVAL;\n \n //add item to objects list\n var DictItem = {};\n DictItem[\"type\"]=OBSTACLE_TYPE;\n DictItem[\"orient\"]=\"horizontal\";\n DictItem[\"x\"]=x_int;\n DictItem[\"y\"]=y_int;\n }\n\n //check if an obstacle already exists at that spot.\n //If it does, erase that obstacle from the list.\n //If it does not, create a new obstacle.\n var isObstacle = checkForObstacle(DictItem)\n if (isObstacle == -1)\n { \n switch(OBSTACLE_TYPE)\n {\n case \"wall\":\n drawObstacle(DictItem);\n break;\n case \"permeable\":\n drawObstacle(DictItem);\n break;\n case \"begin\":\n drawObstacle(DictItem);\n break;\n case \"end\":\n drawObstacle(DictItem);\n break;\n }\n }\n else { \n obstacles.splice(isObstacle, 1) \n drawGrid(); //refresh the page to erase the obstacle.\n } \n}", "title": "" }, { "docid": "a891a35d80aea10a61b68ee0f5fbcca7", "score": "0.60689217", "text": "function obstacle(x, y) {\n var hitZoneSize = 25;\n var damageFromObstacle = 10;\n var sawBladeHitZone = game.createObstacle(hitZoneSize, damageFromObstacle);\n\n sawBladeHitZone.x = x;\n sawBladeHitZone.y = y;\n\n var obstacleImage = draw.bitmap('img/sawblade.png');\n obstacleImage.x = -25;\n obstacleImage.y = -25;\n\n sawBladeHitZone.addChild(obstacleImage);\n\n game.addGameItem(sawBladeHitZone);\n }", "title": "" }, { "docid": "3ee6a8c1c43ab99a1f1e0ed793365611", "score": "0.60463804", "text": "drawRectObstacle(x, y, w, h) {\n for(var i = x; i < x + w; i++) {\n for(var j = y; j < y + h; j++) {\n this.grid_state[i][j] = COLORS[5];\n }\n }\n }", "title": "" }, { "docid": "b46b2f06f6341cae6505ed44227e61b9", "score": "0.6011203", "text": "function draw(object) {\r\n\r\n switch (object.options.shape) {\r\n case 'Line':\r\n ctx.beginPath();\r\n ctx.moveTo(object.startX, object.startY);\r\n ctx.lineTo(object.lastX, object.lastY);\r\n break;\r\n case 'Rectangle':\r\n ctx.beginPath();\r\n\r\n // Get the size of the rectangle\r\n var sizeX = object.lastX - object.startX;\r\n var sizeY = object.lastY - object.startY;\r\n\r\n // Set the rectangles parameters\r\n ctx.rect(object.startX, object.startY, sizeX, sizeY);\r\n break;\r\n case 'Ellipse':\r\n ctx.save();\r\n // Get the size of the rectangle the circle is in\r\n var xDiff = object.lastX - object.startX;\r\n var yDiff = object.lastY - object.startY;\r\n\r\n // Translate the context because scale will scale the position,\r\n // so we want to center the circle at 0,0\r\n ctx.translate(object.startX + xDiff / 2, object.startY + yDiff / 2);\r\n\r\n // Scale the circle to create an oval\r\n ctx.scale(xDiff / 2, yDiff / 2);\r\n\r\n // Set the parameters for the circle\r\n ctx.beginPath();\r\n ctx.arc(0, 0, 1, 0, 2 * Math.PI, false);\r\n ctx.restore();\r\n break;\r\n } // End switch\r\n\r\n ctx.lineWidth = object.options.lineWidth;\r\n ctx.strokeStyle = object.options.lineColor; // Set the line color\r\n\r\n if (object.options.filled) {\r\n ctx.fillStyle = object.options.shapeColor; // Set the fill color\r\n ctx.fill();\r\n }\r\n\r\n ctx.stroke();\r\n if (object.selected) {\r\n\r\n if (object.options.shape == 'Line') {\r\n ctx.save();\r\n ctx.beginPath();\r\n ctx.lineWidth = 1;\r\n ctx.strokeStyle = '#358fff';\r\n\r\n ctx.rect(object.startX - 2, object.startY - 2, 3, 3);\r\n ctx.stroke();\r\n ctx.beginPath();\r\n ctx.rect(object.lastX - 2, object.lastY - 2, 3, 3);\r\n ctx.stroke();\r\n\r\n ctx.restore();\r\n } else {\r\n ctx.save();\r\n ctx.beginPath();\r\n\r\n var sX = object.startX;\r\n var sY = object.startY;\r\n var eX = object.lastX;\r\n var eY = object.lastY;\r\n\r\n // Get the size of the rectangle\r\n var sizeX = eX - sX + 12;\r\n var sizeY = eY - sY + 12;\r\n\r\n // Set the rectangles parameters\r\n ctx.rect(sX - 6, sY - 6, sizeX, sizeY);\r\n ctx.setLineDash([5, 3]);\r\n ctx.lineWidth = 1;\r\n ctx.strokeStyle = '#358fff'; // Some blue color\r\n ctx.stroke();\r\n ctx.restore();\r\n }\r\n\r\n }\r\n\r\n } // End draw function", "title": "" }, { "docid": "de0ec08df04dec03b250d24bd84dc6b8", "score": "0.6005694", "text": "function drawRoad() {\n drawPavement();\n drawroadDivider();\n}", "title": "" }, { "docid": "f60300dfca9f756fb24ef6f1532c73b9", "score": "0.598518", "text": "function Obstacle(center, radius, height, divisions) {\n this.center = center;\n this.radius = radius;\n this.height = height;\n this.divisions = divisions;\n this.normals = [];\n this.points = [];\n}", "title": "" }, { "docid": "b7d04f65c9f3c58c17c117076db5e900", "score": "0.59801733", "text": "function drawLine(or, ob) {\r\n\tor.style.strokeDasharray = [ob.length, ob.pathLength].join(' ');\r\n}", "title": "" }, { "docid": "1360edc1befca6364eb7588c5294b903", "score": "0.59784937", "text": "function drawMovingLine(thea){\r\n //drawing a line\r\n stroke(255,255,255,thea);\r\n strokeWeight(4);\r\n line(0,line_y,width,line_y);\r\n line_y=line_y-2;\r\n if(line_y<0){\r\n line_y=height;\r\n }\r\n}", "title": "" }, { "docid": "9c3da9309c8bdf129c47ffe925027894", "score": "0.59784794", "text": "render() {\n\t\tstroke(\"rgba(166, 130, 206, 0.77)\");\n\t\tline(MAP_SCALE * player.x, MAP_SCALE * player.y, MAP_SCALE * this.wallHitX, MAP_SCALE * this.wallHitY);\n\t}", "title": "" }, { "docid": "84f658149df3635991f84dba388d2864", "score": "0.597415", "text": "function drawLine (ctx, x1, x2, y, trg, obj) {\n\tx1 = parseInt(x1);\n\tx2 = parseInt(x2);\n\tlet startX = Math.min(x1, x2);\n\tlet endX = Math.max(x1, x2);\n\tfor(let j = startX ; j <= endX ; ++j){\n\t\tlet curPixel = new Point2D(j, y);\n\t\tlet p3D = convert2Dto3D(trg, curPixel, obj);\n\t\tif(j < canvasWidth && j >= 0 && y >= 0\n\t\t\t&& y < zBuffer[j].length) {\n\t\t\tif(p3D.coordinates[2] < zBuffer[j][y].distance) {\n\t\t\t\tzBuffer[j][y].distance = p3D.coordinates[2];\n\t\t\t\tlet computedColor = getPhongColor(curPixel, p3D, trg, obj);\n\t\t\t\tzBuffer[j][y].color = computedColor;\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ef443ba2e97d03d033599eb57e107532", "score": "0.59229916", "text": "function drawLine(x0, y0, x1, y1) {\n var xi = 1;\n var yi = 1;\n var dx = Math.abs(x1 - x0);\n var dy = Math.abs(y1 - y0);\n \n if(x0 > x1){\n xi = -xi;\n }\n \n if(y0 > y1){\n yi = -yi;\n }\n var d;\n if(dx > dy){\n d = dx / 2;\n }else {\n d = -dy / 2;\n }\n while(true){\n context.fillRect(x0, y0, 1, 1);\n if (xi > 0 && yi > 0 && x0 >= x1 && y0 >= y1) {\n break;\n } else if (xi > 0 && yi < 0 && x0 >= x1 && y0 <= y1) {\n break;\n } else if (xi < 0 && yi > 0 && x0 <= x1 && y0 >= y1) {\n break;\n } else if (xi < 0 && yi < 0 && x0 <= x1 && y0 <= y1) {\n break;\n }\n if (d > -dx) {\n d = d - dy;\n x0 = x0 + xi;\n }\n if (d < dy) {\n d = d + dx;\n y0 = y0 + yi;\n }\n }\n}", "title": "" }, { "docid": "974f0a364fac68009abff434875448fc", "score": "0.5922655", "text": "drawLanded (context) {\n context.beginPath()\n context.arc(\n this.trajectory.getImpactPoint().x, this.trajectory.getImpactPoint().y, 4, 0, 2 * Math.PI, false\n )\n context.lineWidth = 2\n context.strokeStyle = '#B23432'\n context.stroke()\n }", "title": "" }, { "docid": "607a0d7bc95fc7b28629356710358bc9", "score": "0.5914064", "text": "makeLine(){\n for(var i = 0; i < squares.length; i++){\n if(this.loc.dist(balls[i].loc) < 75){\n stroke(255,255,255);\n line(this.loc.x, this.loc.y, balls[i].loc.x + 5, balls[i].loc.y + 5);\n noStroke();\n }\n }\n }", "title": "" }, { "docid": "613e5944cd8a2d9fdf8377c81127a108", "score": "0.5903421", "text": "function drawroad(){\n this.x = 0;\n this.y = 0;\n this.width = 0;\n this.height = 0;\n this.color = \"#605A4C\";\n \n /*\n 1. fill the road with grey color\n 2. set the fillstyle of the middle line of the road to be yellow\n 3. if the road is vertical and it has 2 directions\n a. draw the yellow middle line\n b. begin to draw the dash line to divide the 2 lanes of each direction\n c. draw the curb of each road\n */\n this.draw = function(){\n //1\n ctx.fillStyle = this.color;\n ctx.fillRect(this.x,this.y,this.width,this.height);\n \n //2\n ctx.fillStyle = \"#A68B44\";\n\n //3\n if(this.width < this.height && this.width > 40){\n //a yellowMiddleLine.width = 2;\n ctx.fillRect(this.x+((this.width/2)-1),this.y,2,this.height);\n \n //b\n ctx.beginPath();\n ctx.setLineDash([2,5]);\n ctx.moveTo(this.x+((this.width/4)-1), this.y);\n ctx.lineTo(this.x+((this.width/4)-1), (this.y + this.height));\n ctx.closePath();\n ctx.strokeStyle = \"#A09383\";\n ctx.lineWidth = 1;\n ctx.fill();\n ctx.stroke();\n \n ctx.beginPath();\n ctx.setLineDash([2,5]);\n ctx.moveTo(this.x+((this.width/(4/3))-1), this.y);\n ctx.lineTo(this.x+((this.width/(4/3))-1), (this.y + this.height));\n ctx.closePath();\n ctx.strokeStyle = \"#A09383\";\n ctx.lineWidth = 1;\n ctx.fill();\n ctx.stroke();\n \n //c curb.width = 10, curb.height = road.height\n ctx.fillStyle = \"#A09383\";\n ctx.rounded_rect(this.x-10,this.y,10,this.height);\n ctx.fillStyle = \"#A09383\";\n ctx.fillRect(this.x+this.width,this.y,10,this.height);\n \n }\n else if(this.width > this.height && this.height > 40){\n ctx.fillRect(this.x,this.y+((this.height/2)-1),this.width,2);\n \n ctx.beginPath();\n ctx.setLineDash([2,5]);\n ctx.moveTo(this.x, this.y+((this.height/4)-1));\n ctx.lineTo((this.x+this.width), this.y+((this.height/4)-1));\n ctx.closePath();\n ctx.strokeStyle = \"#A09383\";\n ctx.lineWidth = 1;\n ctx.fill();\n ctx.stroke();\n \n ctx.beginPath();\n ctx.setLineDash([2,5]);\n ctx.moveTo(this.x, this.y+((this.height/(4/3))-1));\n ctx.lineTo((this.x+this.width), this.y+((this.height/(4/3))-1));\n ctx.closePath();\n ctx.strokeStyle = \"#A09383\";\n ctx.lineWidth = 1;\n ctx.fill();\n ctx.stroke();\n \n ctx.fillStyle = \"#A09383\";\n ctx.fillRect(this.x,this.y-10,this.width,10);\n ctx.fillStyle = \"#A09383\";\n ctx.fillRect(this.x,this.y+this.height,this.width,10);\n \n }\n else if(this.width > this.height && this.height < 41){\n ctx.fillRect(this.x,this.y+((this.height/2)-1),this.width,2);\n ctx.fillStyle = \"#A09383\";\n ctx.fillRect(this.x,this.y-10,this.width,10);\n ctx.fillStyle = \"#A09383\";\n ctx.fillRect(this.x,this.y+this.height,this.width,10);\n }\n else if(this.width < this.height && this.width < 41){\n ctx.fillRect(this.x+((this.width/2)-1),this.y,2,this.height);\n ctx.fillStyle = \"#A09383\";\n ctx.fillRect(this.x-10,this.y,10,this.height);\n ctx.fillStyle = \"#A09383\";\n ctx.fillRect(this.x+this.width,this.y,10,this.height);\n }\n } \n }", "title": "" }, { "docid": "23f3f060bee6cfb0b67c69ad08830c59", "score": "0.58976215", "text": "lineTo(obj){\n\t\tvar ctx = this.getContext()\n\t\tvar x = obj.x\n\t\tvar y = obj.y\n\t\tctx.lineTo(x,y)\n\t}", "title": "" }, { "docid": "1fdadf9e41a1c48103fb2c90a4462685", "score": "0.5897269", "text": "function refreshObstacles(canvas, context)\n{\n\n var obst_types = [\"wall\",\"permeable\",\"begin\",\"end\"];\n \n for(var h=0; h<obst_types.length; h++)\n {\n context.beginPath();\n \n switch(obst_types[h])\n {\n case \"wall\":\n context.strokeStyle=\"#FF0000\";\n break;\n case \"permeable\":\n context.strokeStyle=\"#0000FF\";\n break;\n case \"begin\":\n context.strokeStyle=\"#005500\";\n break;\n case \"end\":\n context.strokeStyle=\"#00DD00\";\n break;\n }\n\n for(var i=0; i<obstacles.length; i++)\n {\n var x = obstacles[i][\"x\"] * INTERVAL;\n var y = obstacles[i][\"y\"] * INTERVAL;\n var moveX;\n var moveY;\n if(obstacles[i][\"type\"]==obst_types[h])\n {\n if(obstacles[i][\"orient\"]==\"vertical\")\n {\n moveX = 0;\n moveY = INTERVAL;\n }\n else if(obstacles[i][\"orient\"]==\"horizontal\")\n {\n moveX = INTERVAL;\n moveY = 0;\n }\n\n context.moveTo(x+BORDER, y+BORDER); //Now move the line to the coordinate\n context.lineTo(x + moveX+BORDER, y + moveY+BORDER); //and draw the hash.\n }\n }\n context.stroke();\n }\n}", "title": "" }, { "docid": "4ca46d9f4136411b5cf44d2e83351b85", "score": "0.5886642", "text": "function animateLineDrawing() {\n //var creates a loop\n const animationLoop = requestAnimationFrame(animateLineDrawing);\n //method clears content from last loop iteration\n c.clearRect(0, 0, 608, 608)\n //starts a new path\n c.beginPath();\n //moves to the starting point of the line\n c.moveTo(x1, y1)\n //indicates end point in the line\n c.lineTo(x, y)\n //sets width of line\n c.lineWidth = 10;\n //sets line color\n c.strokeStyle = 'rgba(70, 255, 33, .8)';\n //method draws everything laid out\n c.stroke();\n //condition checks if the endpoint is reached\n if (x1 <= x2 && y1 <= y2) {\n //condition adds 10 to the previous end x point\n if (x < x2) { x += 10; }\n //add 10 to previous end y point\n if (y < y2) { y += 10; }\n //condition cancels the animation loop\n //if the end points are reached\n if (x >= x2 && y >= y2) { cancelAnimationFrame(animationLoop); }\n }\n //similar to above, necessary to 6, 4, 2 win condition\n if (x1 <= x2 && y1 >= y2) {\n if (x < x2) { x += 10; }\n if (y > y2) { y -= 10; }\n if (x >= x2 && y <= y2) { cancelAnimationFrame(animationLoop); }\n }\n }", "title": "" }, { "docid": "a2e4acb1f7f5925e2116cad84ef8ad88", "score": "0.5877751", "text": "function animateLineDrawing() {\r\n const animationLoop = requestAnimationFrame(animateLineDrawing);\r\n c.clearRect(0,0,608,608);\r\n c.beginPath()\r\n c.moveTo(x1, y1);\r\n c.lineTo(x, y);\r\n c.lineWidth = 10;\r\n c.strokeStyle =\"#cc46ff21\";\r\n c.stroke();\r\n if(x1 <= x2 && y1 <= y2){\r\n if(x < x2){\r\n x +=10;\r\n }\r\n if(y < y2){\r\n y += 10;\r\n }\r\n if(x >= x2 && y >= y2){\r\n cancelAnimationFrame(animationLoop);\r\n }\r\n }\r\n if(x1 <= x2 && y1 >= y2){\r\n if(x < x2){\r\n x += 10;\r\n }\r\n if(y > y2){\r\n y -= 10;\r\n }\r\n if(x >= x2 && y <= y2){\r\n cancelAnimationFrame(animationLoop);\r\n }\r\n }\r\n }", "title": "" }, { "docid": "d114cba80a2451647432cd46cca6228c", "score": "0.5867309", "text": "draw()\n {\n Renderer.ctx.beginPath();\n Renderer.ctx.moveTo(this.startPosition.x, this.startPosition.y);\n Renderer.ctx.lineTo(this.endPosition.x,this.endPosition.y);\n Renderer.ctx.lineWidth=this.lineWidth;\n Renderer.ctx.strokeStyle=this.color;\n Renderer.ctx.stroke(); \n }", "title": "" }, { "docid": "d1e36ff03c6d44f56d7fb90595282fef", "score": "0.58602774", "text": "function drawShape(shape, fill) {\n for(var i = 0; i < shape.seg.length; i++) {\n drawObstacle(shape.seg[i], shape.dist, fill);\n }\n}", "title": "" }, { "docid": "ccfd901eaabe88978cf57d7af728eb98", "score": "0.58433414", "text": "display_line() {\n stroke(255, 0, 0)\n strokeWeight(5)\n line(this.x, this.y, this.line_x, this.line_y)\n }", "title": "" }, { "docid": "7f4db7ebecbb1b6e11faad5425b7dbff", "score": "0.58398914", "text": "function checkForObstacle(rover, obstacles){\n for(let i = 0; i < obstacles.length; i++){\n if(rover.position.x && rover.position.y == obstacles[i].x && obstacles[i].y){\n console.log(`Whoa there cowboy! or cowgirl! or cowperson!... or cow..., The Rover loves everyone, \nthere's an obstacle in your way, try turning to go around it.`);\n \n rover.position.x = rover.travelLog[rover.travelLog.length-1].x;\n rover.position.y = rover.travelLog[rover.travelLog.length-1].y;\n }\n }\n}", "title": "" }, { "docid": "bfaebb48de66bf5bcf40618e81c13b50", "score": "0.58284175", "text": "function drawLine(lienzo, color, xInitial, yInitial, xFinal, yFinal){\n lienzo.beginPath();\n lienzo.strokeStyle = color;\n lienzo.moveTo(xInitial, yInitial); \n lienzo.lineTo(xFinal, yFinal); \n lineWidth = 0.5;\n lienzo.stroke(); \n lienzo.closePath(); \n\n}", "title": "" }, { "docid": "9cb0c16abb79e30f1de9748bb3494453", "score": "0.58279383", "text": "function draw_dragline(ctx, node, x, y) {\n ctx.strokeStyle = \"rgba(100,100,100,.6)\";\n ctx.lineWidth = 5;\n ctx.beginPath();\n ctx.moveTo(node.x+150, node.y+75);\n ctx.bezierCurveTo(node.x+250, node.y+75, x-50, y, x, y)\n ctx.lineTo(x, y);\n ctx.stroke();\n \n \n}", "title": "" }, { "docid": "a35f8ef03f2f2f008da21b253b9745fb", "score": "0.58271784", "text": "function drawline(from, to) {\n ctx.beginPath()\n ctx.moveTo(o.x + from.x, o.y - from.y)\n ctx.lineTo(o.x + to.x, o.y - to.y)\n ctx.closePath()\n ctx.stroke()\n}", "title": "" }, { "docid": "bcae3f1cc57f22cbabff29e940cf6afb", "score": "0.58145404", "text": "drawObject(obj, time) {\n obj.draw(time, this);\n }", "title": "" }, { "docid": "8ea06806056ff0c19bf7c6bf38fefb61", "score": "0.5810413", "text": "function animateLineDrawing() {\n //this function creates the loop for when the game ends it restarts\n const animationLoop = requestAnimationFrame(animateLineDrawing);\n // this method clears content from last loop itieration\n c.clearRect(0,0,608,608);\n //this method starts a new path\n c.beginPath();\n //this moves us to a starting point for our line\n c.moveTo(x1,y1);\n //this method indicates the end point of our line\n c.lineTo(x,y);\n //this method sets the width of our line\n c.lineWidth = 10;\n //this method sets the color of our line\n c.strokeStyle = 'rgba(70,225,33,0.8)';\n //this method draws everything we laid out above\n c.stroke();\n //this condition checks to see if we have reached the end point\n if (x1<=x2 &&y1<=y2) {\n //this condition adds 10 to the previous end x point\n if (x < x2) {x+=10;}\n //this condition adds 10 to the previous end y point\n if (y<y2) {y+=10;}\n //this condition cancles our animation loop if reach the end point\n if (x>=x2 && y>=y2) { cancelAnimationFrame(animationLoop);}\n }\n //this condition is similar to the one above\n //it was necessary for the 6,4,2 win condition\n if (x1 <=x2 && y1 >=y2) {\n if (x<x2) {x+=10;}\n if (y>y2) {y-=10;}\n if (x>=x2 && y<=y2) {cancelAnimationFrame(animationLoop);}\n }\n }", "title": "" }, { "docid": "9c5f0c11193dced1ac97782bccdf034f", "score": "0.57819325", "text": "addObstacle(x, y) {\n let node = this.nodeFromValues(x, y);\n if(this.isStartNode(node) || this.isEndNode(node))\n return;\n if(this.ui.obstacle == 'wall') {\n this.addWall(x, y);\n } else {\n this.addWeight(x, y);\n }\n }", "title": "" }, { "docid": "3c850cb67c5cf2f866077b65683f6c56", "score": "0.5780547", "text": "function obstacleHandler(stop_obstacle, checkNumber) \n //checkNumber = flag to use this function\n{ //to check number of directions\n //just in case the interval is an odd number,\n //and you didn't land exactly on INTERVAL\n //this will fix that problem. :-)\n spot[0]=Math.round(spot[0]);\n spot[1]=Math.round(spot[1]);\n\n spot[3]=\"stopped\";\n \n drawGrid(); //refresh the line so the corners look nice.\n //do this BEFORE adding the last obstacle\n //so the line refresh can make the last segment\n //in a darker color.\n\n if(checkNumber != 1)\n { //add the next stop point to the route[] list.\n var tempSpot = [];\n tempSpot[0] = spot[0];\n tempSpot[1] = spot[1];\n tempSpot[2] = spot[2];\n route.push( {\"spot\":tempSpot, \"obstacle\":stop_obstacle} );\n\n } \n \n var sides = []; //will be populated with which sides\n //of the square have obstacles in them\n\n for (var i=0; i<obstacles.length; i++)\n {\n if( obstacles[i][\"x\"] == spot[0] &&\n obstacles[i][\"y\"] == spot[1] &&\n obstacles[i][\"orient\"] == \"vertical\" &&\n obstacles[i][\"type\"] != \"permeable\" )\n { sides.push(\"left\"); }\n \n if( obstacles[i][\"x\"] == spot[0] &&\n obstacles[i][\"y\"] == spot[1] &&\n obstacles[i][\"orient\"] == \"horizontal\" &&\n obstacles[i][\"type\"] != \"permeable\" )\n { sides.push(\"top\"); }\n \n if( obstacles[i][\"x\"] == (spot[0] + 1) &&\n obstacles[i][\"y\"] == spot[1] &&\n obstacles[i][\"orient\"] == \"vertical\" &&\n obstacles[i][\"type\"] != \"permeable\" )\n { sides.push(\"right\"); }\n \n if ( obstacles[i][\"x\"] == spot[0] &&\n obstacles[i][\"y\"] == (spot[1] + 1) &&\n obstacles[i][\"orient\"] == \"horizontal\" &&\n obstacles[i][\"type\"] != \"permeable\" )\n { sides.push(\"bottom\"); }\n }\n\n var directions = [] //will be populated with the direction \n // choices the user has.\n\n //now handle the directions based on where you are oriented.\n switch(spot[2]) \n { //switch case for your direction when you stopped.\n case \"up\": //we KNOW there is an obstacle on TOP.\n if( stop_obstacle[\"type\"] == \"permeable\" )\n { directions.push(\"forward\")\n turns[\"upkey\"] = \"forward\" }\n \n if( isIn(sides, \"left\") &&\n isIn(sides, \"right\") )\n { directions.push(\"backward\") \n turns[\"downkey\"] = \"backward\" }\n\n if( isIn(sides, \"left\") &&\n !isIn(sides, \"right\") )\n { directions.push(\"right\") \n turns[\"rightkey\"] = \"right\" }\n \n if( !isIn(sides, \"left\") &&\n isIn(sides, \"right\") )\n { directions.push(\"left\")\n turns[\"leftkey\"] = \"left\" }\n \n if( !isIn(sides, \"right\") &&\n !isIn(sides, \"left\") )\n { directions.push(\"right\")\n directions.push(\"left\") \n turns[\"rightkey\"] = \"right\"\n turns[\"leftkey\"] = \"left\" }\n\n break;\n\n case \"down\": //we KNOW there is an obstacle BELOW.\n if( stop_obstacle[\"type\"] == \"permeable\" )\n { directions.push(\"forward\") \n turns[\"downkey\"] = \"forward\" }\n \n if( isIn(sides, \"left\") &&\n isIn(sides, \"right\") )\n { directions.push(\"backward\")\n turns[\"upkey\"] = \"backward\" }\n\n if( isIn(sides, \"left\") &&\n !isIn(sides, \"right\") )\n { directions.push(\"left\") \n turns[\"rightkey\"] = \"left\" }\n //left and right are swapped\n //when moving down\n if( !isIn(sides, \"left\") &&\n isIn(sides, \"right\") )\n { directions.push(\"right\") \n turns[\"leftkey\"] = \"right\" }\n //left and right are swapped\n //when moving down\n if( !isIn(sides, \"right\") &&\n !isIn(sides, \"left\") )\n { directions.push(\"right\")\n directions.push(\"left\") \n turns[\"leftkey\"] = \"right\"\n turns[\"rightkey\"] = \"left\" }\n break;\n\n case \"right\": //we KNOW there is an obstacle TO THE RIGHT.\n if( stop_obstacle[\"type\"] == \"permeable\" )\n { directions.push(\"forward\")\n turns[\"rightkey\"] = \"forward\" }\n \n if( isIn(sides, \"top\") &&\n isIn(sides, \"bottom\") )\n { directions.push(\"backward\") \n turns[\"leftkey\"] = \"backward\" }\n\n if( isIn(sides, \"top\") &&\n !isIn(sides, \"bottom\") )\n { directions.push(\"right\") \n turns[\"downkey\"] = \"right\" }\n\n if( !isIn(sides, \"top\") &&\n isIn(sides, \"bottom\") )\n { directions.push(\"left\") \n turns[\"upkey\"] = \"left\" }\n\n if( !isIn(sides, \"top\") &&\n !isIn(sides, \"bottom\") )\n { directions.push(\"right\")\n directions.push(\"left\") \n turns[\"downkey\"] = \"right\"\n turns[\"upkey\"] = \"left\" }\n break;\n\n case \"left\": //we KNOW there is an obstacle TO THE LEFT.\n if( stop_obstacle[\"type\"] == \"permeable\" )\n { directions.push(\"forward\")\n turns[\"leftkey\"] = \"forward\" }\n \n if( isIn(sides, \"top\") &&\n isIn(sides, \"bottom\") )\n { directions.push(\"backward\")\n turns[\"rightkey\"] = \"backward\" }\n\n if( isIn(sides, \"top\") &&\n !isIn(sides, \"bottom\") )\n { directions.push(\"left\")\n turns[\"downkey\"] = \"left\" }\n\n if( !isIn(sides, \"top\") &&\n isIn(sides, \"bottom\") )\n { directions.push(\"right\") \n turns[\"upkey\"] = \"right\" }\n\n if( !isIn(sides, \"top\") &&\n !isIn(sides, \"bottom\") )\n { directions.push(\"right\")\n directions.push(\"left\")\n turns[\"upkey\"] = \"right\"\n turns[\"downkey\"] = \"left\" }\n break;\n }\n \n if(checkNumber == 1) //flag to use this function\n { //just to check number of directions.\n return directions.length\n }\n \n //to simplify changing the action bar\n actionBar = document.getElementById(\"action\");\n \n if(stop_obstacle[\"type\"] == \"edge\")\n {\n //set the action bar to say \"Start the Maze\"\n actionBar.innerHTML = \"<input type='submit' value='Backtrack' onclick='backTrack()'/>\" + mazeSOLVER;\n spot[3] = \"stopped\";\n directions = [];\n alert(\"You went off the edge!\")\n }\n else if(stop_obstacle[\"type\"] == \"end\")\n {\n actionBar.innerHTML = mazeSOLVER;\n actionBar.innerHTML = mazeSOLVER;\n spot[3] = \"stopped\";\n directions = [];\n alert(\"Goncratulations! You win!\");\n }\n else if (directions.length == 1 && directions[0] != \"backward\")\n {\n if(directions[0] == \"right\")\n { turnRight(); }\n \n if(directions[0] == \"left\")\n { turnLeft(); } \n }\n else \n {\n actionBar.innerHTML = turningHTML;\n }\n\n if(directions.length != 1)\n {\n if(isIn(directions, \"left\"))\n {\n /* actionBar.innerHTML += \" <input type='submit' value='Turn Left' onclick='turnLeft()'/>\" */\n \n //I added this to make the maze a little less disorienting.\n switch(spot[2])\n {\n case \"up\":\n actionBar.innerHTML += \" <input type='submit' value='Go Left' onclick='turnLeft()'/>\"\n break;\n case \"down\":\n actionBar.innerHTML += \" <input type='submit' value='Go Right' onclick='turnLeft()'/>\"\n break;\n case \"right\":\n actionBar.innerHTML += \" <input type='submit' value='Go Up' onclick='turnLeft()'/>\"\n break;\n case \"left\":\n actionBar.innerHTML += \" <input type='submit' value='Go Down' onclick='turnLeft()'/>\"\n break;\n }\n \n }\n\n if(isIn(directions, \"right\"))\n {\n /* actionBar.innerHTML += \" <input type='submit' value='Turn Right' onclick='turnRight()'/>\" */\n \n //I added this to make the maze a little less disorienting.\n switch(spot[2])\n {\n case \"up\":\n actionBar.innerHTML += \" <input type='submit' value='Go Right' onclick='turnRight()'/>\"\n break;\n case \"down\":\n actionBar.innerHTML += \" <input type='submit' value='Go Left' onclick='turnRight()'/>\"\n break;\n case \"right\":\n actionBar.innerHTML += \" <input type='submit' value='Go Down' onclick='turnRight()'/>\"\n break;\n case \"left\":\n actionBar.innerHTML += \" <input type='submit' value='Go Up' onclick='turnRight()'/>\"\n break;\n }\n \n }\n }\n \n if(isIn(directions, \"backward\"))\n {\n actionBar.innerHTML += \" <input type='submit' value='Turn Around' onclick='turnBackward()'/>\"\n }\n \n if(isIn(directions, \"forward\"))\n {\n actionBar.innerHTML += \" <input type='submit' value='Move Forward' onclick='moveForward()'/>\"\n }\n\n if(directions.length > 1 ) //&& !isIn(directions, \"backward\") )\n {actionBar.innerHTML += \"<input type='submit' value='Restart' onclick='startMaze()' style='margin-left: 15px;'/> <input type='submit' value='Custom Spot' onclick='startCustom()'/>\" }\n}", "title": "" }, { "docid": "e2f0fe0ba5f611aadaee455c3482dcdc", "score": "0.5778419", "text": "function drawRoute(routeObj) {\n for (var i = 0; i < routeObj.coordinates.length -2; i++) {\n var line = new google.maps.Polyline({\n path: [new google.maps.LatLng(routeObj.coordinates[i].lat, routeObj.coordinates[i].lon), new google.maps.LatLng(routeObj.coordinates[i + 1].lat, routeObj.coordinates[i + 1].lon)],\n strokeColor: \"#425cf4\",\n strokeOpacity: 1.0,\n strokeWeight: 7,\n map: mapGlobal\n });\n\n }\n\n}", "title": "" }, { "docid": "2619ce80c0c8c26b44a313b8d0ebc977", "score": "0.5774311", "text": "static drawLine(canvas, contour, redLine) {\n ProduceTrainer.clearCanvas(canvas);\n let ctx = canvas.getContext('2d');\n ctx.lineWidth = 3;\n ctx.beginPath();\n ctx.moveTo(0,(1-contour)*canvas.height);\n ctx.lineTo(canvas.width, (1-contour)*canvas.height);\n ctx.strokeStyle = 'black';\n ctx.stroke();\n if(!(redLine == null)) {\n ctx.beginPath();\n ctx.moveTo(0,(1-redLine)*canvas.height);\n ctx.lineTo(canvas.width, (1-redLine)*canvas.height);\n ctx.strokeStyle = (Math.abs(redLine - contour) < ProduceTrainer.band)? 'green':'red';\n ctx.stroke();\n }\n }", "title": "" }, { "docid": "4e0c61a7be28be8ce5691fcee6b5ebee", "score": "0.5767017", "text": "draw(){\n\t\t// gets the points of the moving vertices based on the elapsed time\n\t\tvar hs = ((performance.now() / 40 + this.animOffset) % 20) - 10;\n\t\tvar vs = ((performance.now() / 40 + 10 + this.animOffset) % 20) - 10;\n\t\ths /= 15;\n\t\tvs /= 15;\n\t\tvar h1 = tilesize * -1 * hs + this.pos.x;\n\t\tvar h2 = tilesize * hs + this.pos.x;\n\t\tvar v1 = tilesize * -1 * vs + this.pos.y;\n\t\tvar v2 = tilesize * vs + this.pos.y;\n\t\t\n\t\tcontext.fillStyle = \"#ee0\";\n\t\tcontext.strokeStyle = \"#550\";\n\t\tcontext.beginPath();\n\t\tcontext.arc(this.pos.x, this.pos.y, 7, 0, 2 * Math.PI);\n\t\tcontext.fill();\n\t\tcontext.stroke();\n\t\tcontext.fillStyle = \"#dd0\";\n\t\tcontext.strokeStyle = \"#ff6\";\n\t\tcontext.lineWidth = 2;\n\t\tcontext.beginPath();\n\t\tcontext.moveTo(h1, this.pos.y);\n\t\tcontext.lineTo(this.pos.x, v1);\n\t\tcontext.lineTo(h2, this.pos.y);\n\t\tcontext.lineTo(this.pos.x, v2);\n\t\tcontext.fill();\n\t\tcontext.stroke();\n\t}", "title": "" }, { "docid": "0cc1a3a94b2c819fa5dd532a68886fae", "score": "0.576669", "text": "function Obstacle(x_, y_, dx, dy, speed, width, height, tileSrc = \"cloudTex.png\") {\r\n\t//initialize all the parameters\r\n\r\n\t//private\r\n\tvar obstacleTile = new Tile(tileSrc, width, height);\r\n\r\n\t//public\r\n\tthis.tag = \"obstacle\";\r\n\tthis.position = {x:x_, y:y_};\r\n\tthis.direction = {x:dx, y:dy};\r\n\tthis.speed = speed;\r\n\tthis.width = width;\r\n\tthis.height = height;\r\n\r\n\tthis.draw = function(gamestate) {\r\n\t\tobstacleTile.draw(this, gamestate);\r\n\t}\r\n\r\n\tthis.update = function(gamestate) {\r\n\t\tthis.position.x += this.direction.x * this.speed;\r\n\t\tthis.position.y += this.direction.y * this.speed;\r\n\t\tthis.subOffscreen(gamestate);\r\n\t}\r\n\r\n\tthis.subOffscreen = function(gamestate) {\r\n\t\tvar p0 = this.position.x - this.width*2 > gamestate.canvas.width;\r\n\t\tvar p1 = this.position.x + this.width*2 < 0;\r\n\t\tvar p2 = this.position.y - this.height*2 > gamestate.canvas.height;\r\n\t\tvar p3 = this.position.y + this.height*2 < 0;\r\n\t\tif (p0 || p1 || p2 || p3) {\r\n\t\t\tgamestate.activeEnemyList.delete(this);\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "2b4d02da84c0d9a85eee6bb67998a742", "score": "0.57611567", "text": "function draw_curved_line() {\r\n let path = document.getElementById(no_objects).attributes.d.nodeValue;\r\n if (mouse_down) {\r\n if (new_point) {\r\n new_point = false\r\n path += `Q${click_poz.x+(mouse_poz.x-click_poz.x)/2},${click_poz.y+mouse_poz.y-click_poz.y} ${(click_poz.x+(mouse_poz.x-click_poz.x))},${mouse_poz.y}`\r\n document.getElementById(no_objects).attributes.d.nodeValue = path\r\n } else {\r\n let str = path.split(/M|Z|Q|,|\\s/g)\r\n let vector = []\r\n for (let i = 0; i < str.length; i++) {\r\n if (str[i] !== \"\")\r\n vector.push(str[i])\r\n }\r\n path = \"M\" + vector[0] + \",\" + vector[1] + \"Z \"\r\n for (let i = 2; i < vector.length - 4; i += 4)\r\n path += \"Q\" + vector[i] + \",\" + vector[i + 1] + \" \" + vector[i + 2] + \",\" + vector[i + 3] + \" \"\r\n path += `Q${click_poz.x+(mouse_poz.x-click_poz.x)/2},${click_poz.y+mouse_poz.y-click_poz.y} ${(click_poz.x+(mouse_poz.x-click_poz.x))},${mouse_poz.y}`\r\n document.getElementById(no_objects).attributes.d.nodeValue = path\r\n }\r\n }\r\n}", "title": "" }, { "docid": "a5955e0d06e1b0dbdbc0aa2cc7f10083", "score": "0.5732363", "text": "function drawLine ( data ) {\n var options = { 'lineColor' : \"#FF0000\" , 'lineThickness' : 3};\n var interior = UAlberta.Maps.Interior;\n var a = {'x':data.Lines[0].x,'y':10,'z':data.Lines[0].z};\n interior.addImage('static/css/img/marker_greenA.png', a, 20, 34, options);\n $.each(data.Lines, function(index, value) {\n var start = value;\n var end = data.Lines[index+1];\n if(end){\n interior.addLine( start , end , options );\n }\n\n });\n var b = {'x':data.Lines[data.Lines.length-1].x,'y':10,'z':data.Lines[data.Lines.length-1].z};\n interior.addImage('static/css/img/marker_greenB.png', b, 20, 34, options);\n interior.render(true);\n setTimeout(interior.render, 200); \n}", "title": "" }, { "docid": "f3dead3d629c68fe2c38ddafc708ad98", "score": "0.57299274", "text": "function draw() {\r\n var job, i, count;\r\n\r\n job = this;\r\n\r\n for (i = 0, count = job.lineJobs.length; i < count; i += 1) {\r\n job.lineJobs[i].draw();\r\n }\r\n }", "title": "" }, { "docid": "23fdd24522be498bb7d1c77d4db4cfc8", "score": "0.57276917", "text": "function addObstacle() {\r\n canvas.removeEventListener(\"click\", clickStart);\r\n canvas.removeEventListener(\"click\", clickEnd);\r\n canvas.addEventListener(\"mousedown\", startPos);\r\n canvas.addEventListener(\"mouseup\", endPos);\r\n canvas.addEventListener(\"mousemove\", clickObstacle);\r\n\r\n document.getElementById(\"status\").innerHTML = \"Adding / Removing Obstacle\";\r\n}", "title": "" }, { "docid": "a10db2bd19432e60811e26318b9349d3", "score": "0.5722845", "text": "function mouseReleased(){\n\t// If Draw/Delete is selected and click is on screen\n\tif(mouseX < MAP_BORDER && TOOL == 3){\n\t\tEND_RECT = createVector(mouseX,mouseY);\n\n\t\t// Garantee Begin X < End X & Begin Y < End Y\n\t\tlet aux = 0;\n\t\tif(BEGIN_RECT.x > END_RECT.x){\n\t\t\taux = BEGIN_RECT.x;\n\t\t\tBEGIN_RECT.x = END_RECT.x;\n\t\t\tEND_RECT.x = aux;\n\t\t}\n\t\tif(BEGIN_RECT.y > END_RECT.y){\n\t\t\taux = BEGIN_RECT.y;\n\t\t\tBEGIN_RECT.y = END_RECT.y;\n\t\t\tEND_RECT.y = aux;\n\t\t}\n\n\t\t// Create obstacle and add to list\n\t\tlet xSize = END_RECT.x - BEGIN_RECT.x;\n\t\tlet ySize = END_RECT.y - BEGIN_RECT.y\n\t\tlet newObs = new Obstacle(BEGIN_RECT,createVector(xSize,ySize));\n\t\tOBSTACLES.push(newObs);\n\t\tBEGIN_RECT = [];\n\t\tEND_RECT = [];\n\t}\n\t// User updated method, needs to update GUIObject\n\telse if( TOOL == 11 || TOOL == 12){\n\t\t// Scan through Selection methods\n\t\tlet cont = 0;\n\t\tlet i = 0;\n\t\tif(TOOL == 11){\n\t\t\t// Find position of current selection method\n\t\t\tfor(i = 0; i < ARRAY_SELECTIONS_METHODS.length && ARRAY_SELECTIONS_METHODS[cont] != SELECTION_METHOD; i++){\n\t\t\t\tif(ARRAY_SELECTIONS_METHODS[i] == SELECTION_METHOD) cont = i;\n\t\t\t}\n\t\t\tcont = (cont + 1) % ARRAY_SELECTIONS_METHODS.length\n\t\t\tSELECTION_METHOD = ARRAY_SELECTIONS_METHODS[cont]\n\t\t}\n\t\t// Scan through Crossover methods\n\t\telse if(TOOL == 12){\n\t\t\t\n\t\t\tfor(i = 0; i < ARRAY_CROSSOVER_METHODS.length && ARRAY_CROSSOVER_METHODS[cont] != CROSSOVER_METHOD; i++){\n\t\t\t\tif(ARRAY_CROSSOVER_METHODS[i] == CROSSOVER_METHOD) cont = i;\n\t\t\t}\n\t\t\tcont = (cont + 1) % ARRAY_CROSSOVER_METHODS.length\n\t\t\tCROSSOVER_METHOD = ARRAY_CROSSOVER_METHODS[cont]\n\n\t\t}\n\n\t\t// Update the GUIObjects\n\t\ti = 0;\n\t\tcont = 0;\n\t\tfor(i = 0; i < GUI_OBJECTS.length && !cont; i++){\n\t\t\tif(TOOL == 11 && GUI_OBJECTS[i].text == \"Selection Method:\") cont = 1;\n\t\t\tif(TOOL == 12 && GUI_OBJECTS[i].text == \"Crossover Method:\") cont = 1;\n\t\t}\n\t\tif(cont) i--;\n\t\tif(TOOL == 11) GUI_OBJECTS[i].varText = SELECTION_METHOD;\n\t\tif(TOOL == 12) GUI_OBJECTS[i].varText = CROSSOVER_METHOD;\n\t}\n\t// User selected to adjust position for Percentage Slidebar\n\telse if(TOOL == 7 || TOOL == 8 || TOOL == 9 || TOOL == 10){\n\t\t// Find button index\n\t\tlet cont = 0;\n\t\tlet i = 0;\n\n\t\tfor(i = 0; i < GUI_OBJECTS.length && !cont; i++){\n\t\t\tif(TOOL == 7 && GUI_OBJECTS[i].text == \"Crossover\") cont = 1; \n\t\t\tif(TOOL == 8 && GUI_OBJECTS[i].text == \"Elitism\") cont = 1;\n\t\t\tif(TOOL == 9 && GUI_OBJECTS[i].text == \"Mutation\") cont = 1;\n\t\t\tif(TOOL == 10 && GUI_OBJECTS[i].text == \"Player Size\") cont = 1;\n\t\t\tif(DIVERSITY_TOOL == 1 && GUI_OBJECTS[i].text == \"Diversity\") cont = 1;\n\t\t\tif(DIVERSITY_TOOL == 2 && GUI_OBJECTS[i].text == \"Falloff\") cont = 1; \n\t\t}\n\n\t\tif(cont) i--;\n\t\tlet barLimit = GUI_OBJECTS[i].pos.x + GUI_OBJECTS[i].size.x - (GUI_OBJECTS[i].size.y/4);\n\t\t// Found button index (i)\n\t\tlet test = 0;\n\n\t\t// Test if allowed to set value: Dont want Prob Crossover + Prob Elitism to be > 1\n\t\tif(mouseX < GUI_OBJECTS[i].pos.x) test = 0;\n\t\telse if(mouseX > barLimit ) test = 1;\n\t\telse{\n\t\t\ttest = (mouseX - GUI_OBJECTS[i].pos.x) / (barLimit - GUI_OBJECTS[i].pos.x);\n\t\t}\n\n\t\t// Treatment for each slider\n\t\tif(TOOL == 7){\n\t\t\t// Probability of Crossover slider\n\t\t\tif(test + P_ELITISM < 1) GUI_OBJECTS[i].bar = test;\n\t\t\telse GUI_OBJECTS[i].bar = 1 - P_ELITISM - 0.01;\n\t\t\tP_CROSSOVER = GUI_OBJECTS[i].bar;\n\t\t\tGUI_OBJECTS[i].varText = GUI_OBJECTS[i].bar.toFixed(2);\n\t\t}\n\t\telse if(TOOL == 8){\n\t\t\t// Probability of Elitism slider\n\t\t\tif(test + P_CROSSOVER < 1) GUI_OBJECTS[i].bar = test;\n\t\t\telse GUI_OBJECTS[i].bar = 1 - P_CROSSOVER - 0.01;\n\t\t\tP_ELITISM = GUI_OBJECTS[i].bar;\n\t\t\tGUI_OBJECTS[i].varText = GUI_OBJECTS[i].bar.toFixed(2);\n\t\t}\n\t\telse if(TOOL == 9){\n\t\t\t// Probability of Mutation slider\n\t\t\tGUI_OBJECTS[i].bar = test;\n\t\t\tP_MUTATION = GUI_OBJECTS[i].bar;\n\t\t\tGUI_OBJECTS[i].varText = GUI_OBJECTS[i].bar.toFixed(2);\n\t\t}\n\t\telse if(TOOL == 10){\n\t\t\t// Player size configurationslider\n\t\t\tGUI_OBJECTS[i].bar = test\n\t\t\tPLAYER_SIZE = createVector(5 + int(25*test),5 + int(25*test))\n\t\t\tGUI_OBJECTS[i].varText = PLAYER_SIZE.x;\n\t\t}\n\t\t\n\t\tTOOL = 1;\n\t}\n\telse if(DIVERSITY_TOOL == 1 || DIVERSITY_TOOL == 2){\n\t\t// Find button index\n\t\tlet cont = 0;\n\t\tlet i = 0;\n\n\n\t\tfor(i = 0; i < GUI_OBJECTS.length && !cont; i++){\n\t\t\tif(DIVERSITY_TOOL == 1 && GUI_OBJECTS[i].text == \"Diversity\") cont = 1; \n\t\t\tif(DIVERSITY_TOOL == 2 && GUI_OBJECTS[i].text == \"Falloff\") cont = 1; \n\t\t}\n\n\t\tif(cont) i--;\n\t\tlet barLimit = GUI_OBJECTS[i].pos.x + GUI_OBJECTS[i].size.x - (GUI_OBJECTS[i].size.y/4);\n\t\t// Found button index (i)\n\t\tlet test = 0;\n\n\t\t// Test if allowed to set value: Dont want Prob Crossover + Prob Elitism to be > 1\n\t\tif(mouseX < GUI_OBJECTS[i].pos.x) test = 0;\n\t\telse if(mouseX > barLimit ) test = 1;\n\t\telse{\n\t\t\ttest = (mouseX - GUI_OBJECTS[i].pos.x) / (barLimit - GUI_OBJECTS[i].pos.x);\n\t\t}\n\n\t\tif(DIVERSITY_TOOL == 1){\n\t\t\tGUI_OBJECTS[i].bar = test;\n\t\t\tDIVERSITY_WEIGHT = test * 5;\n\t\t\tCURRENT_DIVERSITY = DIVERSITY_WEIGHT;\n\t\t\tGUI_OBJECTS[i].varText = DIVERSITY_WEIGHT.toFixed(1);\n\t\t}\n\t\telse if(DIVERSITY_TOOL == 2){\n\t\t\tGUI_OBJECTS[i].bar = test;\n\t\t\tDIVERSITY_FALLOFF = test;\n\t\t\tGUI_OBJECTS[i].varText = DIVERSITY_FALLOFF.toFixed(2);\n\t\t}\n\t\tDIVERSITY_TOOL = 0;\n\t}\n\t\n}", "title": "" }, { "docid": "0724e71425d0e5efc785e8ea80607235", "score": "0.57212514", "text": "drawObstacles(canvas, assetManager) {\n this.obstacles.forEach((obstacle) => {\n obstacle.draw(canvas, assetManager);\n });\n }", "title": "" }, { "docid": "5ab94cc445440298a8aca408e24dbb9c", "score": "0.5719388", "text": "function draw() {\n\t// draw opponent's draw line if they're currently dragging\n\tctxUI.strokeStyle = ctxUI.fillStyle = COLORS[opponent.side];\n\tif (opponent.lastClick) {\n\t\tctxUI.beginPath();\t\n\t\tctxUI.moveTo(opponent.lastClick.x, opponent.lastClick.y);\n\t\tctxUI.lineTo(opponent.pos.x, opponent.pos.y);\n\t\tctxUI.stroke();\n\t}\n\tctxUI.beginPath();\t\n\tctxUI.arc(opponent.pos.x, opponent.pos.y, 5, 0, Math.PI * 2);\n\tctxUI.fill();\n\tctxUI.closePath();\n\t\n\t// draw our own draw line if we're currently dragging\n\tctxUI.strokeStyle = ctxUI.fillStyle = COLORS[player.side];\n\tif (player.lastClick) {\n\t\tctxUI.beginPath();\n\t\tctxUI.moveTo(player.lastClick.x, player.lastClick.y);\n\t\tctxUI.lineTo(player.pos.x, player.pos.y);\n\t\tctxUI.stroke();\n\t}\n\tctxUI.beginPath();\t\n\tctxUI.arc(player.pos.x, player.pos.y, 5, 0, Math.PI * 2);\n\tctxUI.fill();\n\tctxUI.closePath();\n}", "title": "" }, { "docid": "e5cb3040c4ebb76077e19f80f14fd6d5", "score": "0.57153636", "text": "debugDraw() {\n this.ctx.strokeStyle=\"rgb(0,255,0)\"; // Green\n this.ctx.lineWidth = 2;\n this.ctx.setLineDash([10,5]);\n var _wMod = 0,\n _hMod = 0;\n \n if (this.World.cells.length == 1) {\n this.ctx.strokeRect(this.pos.x + 1, this.pos.y + 1, this.width - 2, this.height - 2);\n } else {\n this.ctx.beginPath();\n\n if (this.pos.x == this.World.width - this.width) {\n _wMod = -1;\n }\n\n if (this.pos.y == this.World.height - this.height) {\n _hMod = -1;\n }\n\n if (this.pos.x == 0) {\n this.ctx.moveTo(this.pos.x + 1, this.pos.y + 1);\n this.ctx.lineTo(this.pos.x + 1, this.pos.y + this.height + _hMod);\n this.ctx.moveTo(this.pos.x + 1, this.pos.y + 1);\n }\n\n if (this.pos.y == 0) {\n this.ctx.moveTo(this.pos.x + 1, this.pos.y + 1);\n this.ctx.lineTo(this.pos.x + this.width + _wMod, this.pos.y + 1);\n }\n \n this.ctx.moveTo(this.pos.x + this.width + _wMod, this.pos.y);\n this.ctx.lineTo(this.pos.x + this.width + _wMod, this.pos.y + this.height + _hMod);\n this.ctx.lineTo(this.pos.x, this.pos.y + this.height + _hMod);\n this.ctx.stroke();\n }\n this.ctx.setLineDash([]);\n }", "title": "" }, { "docid": "7decae525df4316b9ce9d239025034a6", "score": "0.5710559", "text": "function animateLineDrawing() { //interacts with the canvas\n const animationLoop = requestAnimationFrame(animateLineDrawing); // creates the loop for when the game ends it restarts\n c.clearRect(0, 0, 608, 608); // clears contents of rectangle \n c.beginPath(); //starts new path\n c.moveTo(x1, y1); //moves us to a starting point for our line\n c.lineTo(x, y); //indicates the end point of our line\n c.lineWidth = 10; //set width our our line\n c.strokeStyle = 'rgba(70,255,33,.8)'; //sets color of our line\n c.stroke(); // draws everything we laid out\n if (x1 <= x2 && y1 <= y2) { //checks if we have reached the end point\n if (x < x2) { x += 10; } // adds 10 to previous end x point\n if (y < y2) { y += 10; } //adds to to previous end y point\n if (x >= x2 && y >= y2) { cancelAnimationFrame(animationLoop); } //cancels our animation loop if reach the end points\n }\n if (x1 <= x2 && y1 >= y2) { //this is similar to above. it was necessary for the 6,4,2 win condition\n if (x < x2) { x += 10; }\n if (y > y2) { y -= 10; }\n if (x >= x2 && y <= y2) { cancelAnimationFrame(animationLoop); }\n }\n\n }", "title": "" }, { "docid": "48f1ff6a52e2426a561e07986ae7ad17", "score": "0.57039", "text": "function drawBounds(obj){\r\n\tif (gameTime % 2){\r\n\t\tctx.beginPath();\r\n\t\tctx.strokeStyle = 'green';\r\n\t\tctx.strokeRect(obj.x1, obj.y1, obj.x2 - obj.x1, obj.y2 - obj.y1);\r\n\t}\r\n}", "title": "" }, { "docid": "65159de28866918f2b2df93254654e16", "score": "0.5696258", "text": "function drawLine(){\n var rect1=link.getBoundingClientRect();\n\n //rect1 center, rel to tl corner of viewport\n var rect1CenterX = (rect1.left + rect1.right)/2;\n var rect1CenterY = (rect1.top + rect1.bottom)/2;\n\n //rect1 center, rel to tl corner of document\n var rect1CenterXreldoc = rect1CenterX + scrollX;\n var rect1CenterYreldoc = rect1CenterY + scrollY;\n\n //create svg path element for line\n var path=document.createElementNS('http://www.w3.org/2000/svg', 'path');\n path.setAttribute('d', `M ${rect0CenterXreldoc},${rect0CenterYreldoc} L ${rect1CenterXreldoc},${rect1CenterYreldoc}`);\n path.setAttribute('class', '-linkline-linkline');\n\n //if path endpoint (or any ancestor) has fixed position, mark with a class\n for(var element=link; element!==null; element=element.parentElement){\n if(window.getComputedStyle(element).position==='fixed'){\n path.setAttribute('class', path.getAttribute('class') + ' -linkline-endfixed');\n break;\n }\n }\n\n //add path to svg; ensure hitbox is last so it gets drawn over the lines\n svg.insertBefore(path, hitbox);\n }", "title": "" }, { "docid": "14c5ab6a6bbb2614e221a069a586ad38", "score": "0.56842387", "text": "makeLine(){\n for(var i = 0; i < squares.length; i++){\n if(this.loc.dist(squares[i].loc) < 75){\n stroke(255,255,255);\n line(this.loc.x, this.loc.y, squares[i].loc.x + 5, squares[i].loc.y + 5);\n noStroke();\n }\n if(this.loc.dist(balls[i].loc) < 75){\n stroke(255,255,255);\n line(this.loc.x, this.loc.y, balls[i].loc.x + 5, balls[i].loc.y + 5);\n noStroke();\n }\n }\n}", "title": "" }, { "docid": "e372588d8e9865112fdd8022bc990209", "score": "0.5679758", "text": "function buildLine(){ //for diagnostic purposes\n \n var line = new createjs.Shape();\n line.graphics.beginStroke(\"red\").drawRect(0,0,spriteArr[0].getBounds().width, spriteArr[0].getBounds().height);\n stage.addChild(line);\n}", "title": "" }, { "docid": "12a702bd1e58b0f0511a245a1b79ba42", "score": "0.56748486", "text": "function obstacleObject(row, col) {\n return {\n row,\n col,\n // RGB is a fixed value that corresponds to the\n // body background RGB (looks like lakes / rivers).\n rgb: 'rgba(0, 0, 0, 0)',\n type: 'obstacle',\n crossable: false,\n }\n}", "title": "" }, { "docid": "2e3f1ed5d7a6741cf6ba19d5f2281db7", "score": "0.56727856", "text": "function drawLine() {\n // Si c'est le début, j'initialise\n if (!started) {\n // Je place mon curseur pour la première fois :\n context.beginPath();\n context.moveTo(cursorX, cursorY);\n started = true;\n }\n // Sinon je dessine\n else {\n context.lineTo(cursorX, cursorY);\n context.strokeStyle = Pykasso.painter.color;\n context.lineWidth = Pykasso.painter.width_brush;\n context.stroke();\n }\n points.push({x: cursorX, y: cursorY});\n }", "title": "" }, { "docid": "311d584e9ecc4ef5bcb9f7a43e7d4b61", "score": "0.56573707", "text": "function draw(){\r\nreset();\r\nc.beginPath();\r\nc.moveTo(cordx[cordnum-segs], cordy[cordnum-segs]);\r\nfor(var i=-(segs-1); i<=0; i++){\r\nc.lineTo(cordx[cordnum+i], cordy[cordnum+i]);}\r\nc.lineTo(x, y);\r\nfor(var i=0; i<=-(segs-1); i++){\r\nc.lineTo(cordx[cordnum-i], cordy[cordnum-i]);}\r\nc.moveTo(cordx[cordnum-segs], cordy[cordnum-segs]);\r\nc.closePath();\r\n\r\n//line attr\r\nc.lineWidth=linewidth;\r\nc.strokeStyle=linecolor;\r\nc.stroke();}", "title": "" }, { "docid": "acac23a0a7ecf628743b656c96e7eceb", "score": "0.5648219", "text": "function ObstacleList() {\r\n\tthis.obstaclemap = new Set();\r\n\r\n\tthis.insert = function(o) {\r\n\t\tthis.obstaclemap.add(o);\r\n\t}\r\n\r\n\tthis.delete = function(o) {\r\n\t\tthis.obstaclemap.delete(o);\r\n\t}\r\n\r\n\tthis.draw = function(gamestate) {\r\n\t\tthis.obstaclemap.forEach(function(o) {\r\n\t\t\to.draw(gamestate);\r\n\t\t});\r\n\t}\r\n\r\n\tthis.update = function(gamestate) {\r\n\t\tthis.obstaclemap.forEach(function(o) {\r\n\t\t\to.update(gamestate);\r\n\t\t});\r\n\t}\r\n}", "title": "" }, { "docid": "92974ffc84cf735fc3a2522c7eddb9fa", "score": "0.5645917", "text": "function drawShip(x, y, a, colour = \"white\") {\n ctx.beginPath();\n ctx.strokeStyle = colour;\n ctx.lineWidth = 4;\n // shipSize / 20\n ctx.beginPath();\n ctx.moveTo(\n // nose of the ship\n x + (4 / 3) * ship.r * Math.cos(a),\n y - (4 / 3) * ship.r * Math.sin(a)\n );\n ctx.lineTo(\n // rear left\n x - ship.r * ((2 / 3) * Math.cos(a) + Math.sin(a)),\n y + ship.r * ((2 / 3) * Math.sin(a) - Math.cos(a))\n );\n ctx.lineTo(\n // rear right\n x - ship.r * ((2 / 3) * Math.cos(a) - Math.sin(a)),\n y + ship.r * ((2 / 3) * Math.sin(a) + Math.cos(a))\n );\n ctx.closePath();\n ctx.stroke();\n ctx.fillStyle = \"red\";\n ctx.fill();\n ctx.lineWidth = 1;\n ctx.strokeStyle = \"cyan\";\n}", "title": "" }, { "docid": "3df5a40bab26cee37e39c9543e8833f4", "score": "0.5641433", "text": "function drawObject(obj){\n\tctx.drawImage(obj.img, \n\t\tobj.width*obj.anim[obj.state], 0,\n\t\tobj.width, obj.height,\n\t\tobj.x, obj.y,\n\t\tobj.width, obj.height);\n}", "title": "" }, { "docid": "b95e9a6f50e9e5096c9d7064c815188c", "score": "0.56408215", "text": "function DrawDrawable(object)\n{\n for(let x = object.x; x < object.x + object.w; x++)\n {\n for(let y = object.y; y < object.y + object.h; y++)\n {\n if(x > 7)\n {\n x = 7;\n object.x = 7;\n }\n \n if(x < 0)\n {\n x = 0;\n object.x = 0;\n }\n\n if(y > 7)\n {\n y = 7;\n object.y = 7;\n }\n \n if(y < 0)\n {\n y = 0;\n object.y = 0;\n }\n\n display.grid[x][y] = 'rgb(' + object.color.r + ', ' + object.color.g + ', ' + object.color.b + ')';\n }\n }\n}", "title": "" }, { "docid": "bc806638fedd29d1b556dd48cf622ab6", "score": "0.5640133", "text": "function LineDrawer (onMode, startX, endX, y){\n //choosing the color\n if (onMode){\n context.strokeStyle = colorOne ;\n } else context.strokeStyle = colorTwo;\n //actually drawing\n context.lineWidth = 4;\n context.beginPath();\n context.moveTo(startX, y);\n context.lineTo(endX, y);\n context.stroke();\n // managing collisions\n if (onMode && ghost.y > y - 64 && ghost.y < y+10 && ghost.x > startX - 32 && ghost.x < endX) {\n //set jumping to false so we can jump again\n ghost.jumping = false;\n jumpSound.pause();\n jumpSound.currentTime=0;\n ghost.y = y - 64;\n ghost.y_velocity = 0;\n }\n\n}", "title": "" }, { "docid": "1c97455b71295bdfd5f913bbeea650fb", "score": "0.5632474", "text": "function draw() {\n ship.move(); \n controller.watchTheHour(sky);\n \n // Para entender como funciona a função forEach veja: \n // https://clovisdasilvaneto.github.io/explorando-javascript-filter-reduce-map-every-some-e-foreach\n sky.render((elements) => elements.forEach((el) => { el.move(); el.render(); }));\n}", "title": "" }, { "docid": "f6098064d64c0c270fab389cffd6c6c6", "score": "0.5626148", "text": "function drawLine() {\n\t\t// Si c'est le début, j'initialise\n\t\tif (!started) {\n\t\t\t// Je place mon curseur pour la première fois\n\t\t\tcontext.beginPath();\n\t\t\tcontext.moveTo(cursorX, cursorY);\n\t\t\tstarted = true;\n\t\t} \n\t\t// Sinon je dessine\n\t\telse {\n\t\t\tcontext.lineTo(cursorX, cursorY);\n\t\t\tcontext.strokeStyle = document.getElementById('couleur').value;\n\t\t\tcontext.lineWidth = document.getElementById('size').value;\n\t\t\tcontext.stroke();\n\t\t}\n\t}", "title": "" }, { "docid": "73b4106320f44b527b139aa94e6c09e2", "score": "0.5619462", "text": "function move()\n{\n var canvas = document.getElementById(\"canvas\");\n var context = canvas.getContext(\"2d\");\n \n var pixelsSpot;\n \n //an array containing the distance to the next stop\n //and the information about the next obstacle.\n var stop = checkObstacles();\n\n //move the line on an interval\n var time_interval = setInterval(function() {\n\n\t\t//Do this first. Otherwise, the backtrack function will not work properly.\n if(spot[3] == \"stopped\")\n {\n clearInterval(time_interval);\n\t\t\treturn;\n }\n\n\t\tcontext.beginPath(); //First draw a line in GREEN\n context.strokeStyle=\"#007700\"; //dark green\n\n context.moveTo( Math.round(spot[0]*INTERVAL + INTERVAL/2)+BORDER, \n Math.round(spot[1]*INTERVAL + INTERVAL/2)+BORDER ); \n\n switch(spot[2]) //move the line in the right direction,\n { //while keeping it in reference to the grids.\n case \"up\":\n pixelsSpot = spot[1]*INTERVAL;\n pixelsSpot -= MOVEDIST;\n spot[1] = pixelsSpot / INTERVAL;\n break;\n case \"down\":\n pixelsSpot = spot[1]*INTERVAL;\n pixelsSpot += MOVEDIST;\n spot[1] = pixelsSpot / INTERVAL;\n break;\n case \"right\":\n pixelsSpot = spot[0]*INTERVAL;\n pixelsSpot += MOVEDIST;\n spot[0] = pixelsSpot / INTERVAL;\n break;\n case \"left\":\n pixelsSpot = spot[0]*INTERVAL;\n pixelsSpot -= MOVEDIST;\n spot[0] = pixelsSpot / INTERVAL;\n break;\n }\n\n \n //draw the line, ALWAYS keeping it in reference to the grids.\n context.lineTo( Math.round(spot[0]*INTERVAL + INTERVAL/2)+BORDER, \n Math.round(spot[1]*INTERVAL + INTERVAL/2)+BORDER ); \n context.stroke();\n\n //Decrease the distance to the next obstacle\n pixelsSpot = stop[\"dist\"]*INTERVAL;\n pixelsSpot -= MOVEDIST;\n stop[\"dist\"] = pixelsSpot / INTERVAL;\n\n /*\n //Now give the line a BLACK tip AHEAD of your spot.\n context.beginPath(); \n context.moveTo( Math.round(spot[0]*INTERVAL + INTERVAL/2), \n Math.round(spot[1]*INTERVAL + INTERVAL/2) ); \n context.strokeStyle=\"#000000\";\n\n var tip = []\n tip[0]=spot[0]\n tip[1]=spot[1]\n \n switch(spot[2]) //Add a BLACK tip \n { //so you can better see the END.\n case \"up\":\n pixelsSpot = tip[1]*INTERVAL;\n pixelsSpot -= MOVEDIST;\n tip[1] = pixelsSpot / INTERVAL;\n break;\n case \"down\":\n pixelsSpot = tip[1]*INTERVAL;\n pixelsSpot += MOVEDIST;\n tip[1] = pixelsSpot / INTERVAL;\n break;\n case \"right\":\n pixelsSpot = tip[0]*INTERVAL;\n pixelsSpot += MOVEDIST;\n tip[0] = pixelsSpot / INTERVAL;\n break;\n case \"left\":\n pixelsSpot = tip[0]*INTERVAL;\n pixelsSpot -= MOVEDIST;\n tip[0] = pixelsSpot / INTERVAL;\n break;\n }\n \n context.lineTo( Math.round(tip[0]*INTERVAL + INTERVAL/2), \n Math.round(tip[1]*INTERVAL + INTERVAL/2) ); \n context.stroke();\n */\n\n \n //If you hit an obstacle, clear the interval\n //and handle each obstacle differently.\n if (stop[\"dist\"] <= 0)\n {\n clearInterval(time_interval);\n obstacleHandler(stop[\"obstacle\"]);\n } \n \n }, TIME_INTERVAL); //how often in ms the line is moved.\n}", "title": "" }, { "docid": "9fd3f9dfa5b96982111817d878ed232a", "score": "0.5617284", "text": "function drawLineSegment(jg,line) {\n\n var xfrom = line.getFirstPoint().x;\n var yfrom = line.getFirstPoint().y;\n var xto = line.getSecondPoint().x;\n var yto = line.getSecondPoint().y;\n \n var limitSides = getLimitSides();\n var xList = limitSides.getXList();\n var yList = limitSides.getYList();\n \n var xMin = Math.min.apply({},xList);\n var yMin = Math.min.apply({},yList); \n var xMax = Math.max.apply({},xList);\n var yMax = Math.max.apply({},yList); \n \n var points = new Array();\n \n if (xfrom >= xMin && xfrom <= xMax && yfrom >= yMin && yfrom <= yMax) {\n points.push(line.getFirstPoint()); \n }\n \n if (xto >= xMin && xto <= xMax && yto >= yMin && yto <= yMax) {\n points.push(line.getSecondPoint()); \n }\n \n var s = 1;\n \n while(points.length < 2 && s <= limitSides.getSidesNumber()){ \n var intersectionPoint = limitSides.getSide(s).intersection(line);\n if (intersectionPoint != null) {\n points.push(intersectionPoint);\n }\n s++;\n }\n \n if(points.length == 2){ \n jg.drawLine(points[0].x, points[0].y, points[1].x,points[1].y); \n jg.paint(); \n }\n \n}", "title": "" }, { "docid": "92d14fde479c42e2c834bd5cf54978a4", "score": "0.56169474", "text": "function drawFromThisClient(checkpoint) {\n\n const endPoint = {\n\t\tx: mouseX,\n\t\ty: mouseY,\n };\n \n // console.log(`endPoint.id: ${endPoint.id}, socket.id: ${socket.id}`);\n // if(!previous) {\n // previous = endPoint;\n // }\n if(checkpoint) {\n previous = endPoint;\n }\n const point = {id: socket.id, start:previous, end:endPoint};\n point.lineSize = lineSize;\n\tpoint.color = cor;\n\tpoint.checkpoint = checkpoint;\n\n drawLine(point, true);\n previous = endPoint;\n \n socket.emit('mouse draw', point);\n}", "title": "" }, { "docid": "fdd97b901ca584965c401d13359d7587", "score": "0.5613794", "text": "function drawLine() {\n\t\t// Si c'est le début, j'initialise\n\t\tif (!started) {\n\t\t\t// Je place mon curseur pour la première fois :\n\t\t\tcontext.beginPath();\n\t\t\tcontext.moveTo(cursorX, cursorY);\n\t\t\tstarted = true;\n\t\t} \n\t\t// Sinon je dessine\n\t\telse {\n\t\t\tcontext.lineTo(cursorX, cursorY);\n\t\t\tcontext.strokeStyle = color;\n\t\t\tcontext.lineWidth = width_brush;\n\t\t\tcontext.stroke();\n\t\t}\n\t}", "title": "" }, { "docid": "e7337356da5ee5d101079a4ab15b5d3a", "score": "0.56084853", "text": "draw() {\n this.checkContext();\n this.setRendered();\n\n const tick_context = this.getTickContext();\n const next_context = _tickcontext__WEBPACK_IMPORTED_MODULE_2__[\"TickContext\"].getNextContext(tick_context);\n\n const begin_x = this.getAbsoluteX();\n const end_x = next_context ? next_context.getX() : this.stave.x + this.stave.width;\n const y = this.stave.getYForLine(this.line + (-3)) + 1;\n\n L(\n 'Drawing ',\n this.decrescendo ? 'decrescendo ' : 'crescendo ',\n this.height,\n 'x',\n begin_x - end_x\n );\n\n renderHairpin(this.context, {\n begin_x: begin_x - this.render_options.extend_left,\n end_x: end_x + this.render_options.extend_right,\n y: y + this.render_options.y_shift,\n height: this.height,\n reverse: this.decrescendo,\n });\n }", "title": "" }, { "docid": "61caef014a48dc1fa6911e1f6830bb9b", "score": "0.5606058", "text": "function draw() { \n // Set the background to black\n background(50);\n y = y - 1; \n if (y < 0) { \n y = height; \n } \n line(0, y, width, y); \n // fill(\"white\");\n\n if (keyIsDown(LEFT_ARROW)) {\n odbijaczX-=10;\n }\n if (keyIsDown(RIGHT_ARROW)) {\n odbijaczX+=10;\n }\n odbijaczX = constrain(odbijaczX, 0+odbijacz_dlugosc/2, width-odbijacz_dlugosc/2);\n rect(odbijaczX-odbijacz_dlugosc/2, odbijaczY, odbijacz_dlugosc, odbijacz_szerokosc);\n fill(\"red\");\n for (var i = 0; i < bloki.length; i++) {\n if(bloki[i].turned)\n bloki[i].display();\n }\n}", "title": "" }, { "docid": "25cddba629cf619b5d2678ed53ff7bdd", "score": "0.5602761", "text": "function draw(evt) {\n console.log(\"drawing\");\n var rect = canvas.getBoundingClientRect();\n var x = evt.clientX - rect.left;\n var y = evt.clientY - rect.top;\n ctx.lineTo(x, y);\n ctx.stroke();\n console.log(\"Draw to (\" + x + \", \" + y + \") (\" + ctx.fillStyle + \")\");\n}", "title": "" }, { "docid": "bb0d706144a4bac166c0df06b4cca2f7", "score": "0.56007034", "text": "function drawObject(obj) {\n if (CAMERA_FOLLOW) {\n camX = player.x - WIDTH/2 + Math.floor(player.w/2);\n camY = player.y - HEIGHT/2 + Math.floor(player.h/2);\n } else {\n camX = 0;\n camY = 0;\n }\n\n // Stop the camera from showing beyond the furthest walls\n if (camX < lowX) {\n camX = lowX;\n } else if (camX > highX - WIDTH) {\n camX = highX - WIDTH;\n }\n if (camY < lowY) {\n camY = lowY;\n } else if (camY > highY - HEIGHT) {\n camY = highY - HEIGHT;\n }\n\n x = obj.x;\n y = obj.y;\n w = obj.w;\n h = obj.h;\n\n // Set origin to bottom left\n y = HEIGHT - obj.y - obj.h;\n\n // Change values depending on camera location\n x = x - camX;\n y = y + camY;\n\n ctx.fillRect(x, y, w, h);\n}", "title": "" }, { "docid": "496bf837935742acbcdd6a6aabcade6e", "score": "0.55977964", "text": "function vecDraw() {\n\t\tthis.graphics.drawOSControl();\n\t\tthis.graphics.rectPath(0, 0, this.size[0], this.size[1]);\n\t\tthis.graphics.fillPath(this.graphics.newBrush(this.graphics.BrushType.SOLID_COLOR, [0, 0, 0, 0]));\n\t\ttry {\n\t\t\tfor (var i = 0; i < this.coord.length; i++) {\n\t\t\t\tvar line = this.coord[i];\n\t\t\t\tthis.graphics.newPath();\n\t\t\t\tthis.graphics.moveTo(line[0][0] + (this.size[0] / 2 - this.artSize[0] / 2), line[0][1] + (this.size[1] / 2 - this.artSize[1] / 2));\n\t\t\t\tfor (var j = 0; j < line.length; j++) {\n\t\t\t\t\tthis.graphics.lineTo(line[j][0] + (this.size[0] / 2 - this.artSize[0] / 2), line[j][1] + (this.size[1] / 2 - this.artSize[1] / 2));\n\t\t\t\t}\n\t\t\t\tthis.graphics.fillPath(this.graphics.newBrush(this.graphics.BrushType.SOLID_COLOR, hexToArray(this.iconColor)));\n\t\t\t}\n\t\t} catch (e) {\n\n\t\t}\n\t}", "title": "" }, { "docid": "c9b0248ccb8f3b160b5fdcd6aa3d8489", "score": "0.55929667", "text": "function drawPaths(obj, moveTO, midPoint, lineTO, isDashed, strokeColor, lineWidth, arrowDir, middleArrowHeadReq) {\n var headlen = 18;\n obj.paint = function (_director, time) {\n var dx = lineTO.x - moveTO.x;\n var dy = lineTO.y - moveTO.y;\n var angle = Math.atan2(dy, dx);\n var canvas = _director.ctx;\n canvas.strokeStyle = '#9933cc';\n canvas.fillStyle = strokeColor;\n canvas.lineWidth = 1.5;\n if (isDashed) {} else {\n canvas.beginPath();\n canvas.moveTo(moveTO.x, moveTO.y);\n canvas.lineTo(lineTO.x, lineTO.y);\n canvas.stroke();\n }\n canvas.beginPath();\n if (arrowDir == 'leftArrowHead') {\n canvas.moveTo(moveTO.x, moveTO.y);\n canvas.lineTo(moveTO.x + headlen * Math.cos(angle - Math.PI / 8), moveTO.y + headlen * Math.sin(angle - Math.PI / 8));\n canvas.lineTo(moveTO.x + headlen * Math.cos(angle + Math.PI / 8), moveTO.y + headlen * Math.sin(angle + Math.PI / 8));\n canvas.fill();\n } else if (arrowDir == 'rightArrowHead') {\n canvas.moveTo((lineTO.x), lineTO.y);\n canvas.lineTo((lineTO.x) - headlen * Math.cos(angle - Math.PI / 8), lineTO.y - headlen * Math.sin(angle - Math.PI / 8));\n canvas.lineTo((lineTO.x) - headlen * Math.cos(angle + Math.PI / 8), lineTO.y - headlen * Math.sin(angle + Math.PI / 8));\n canvas.fill();\n }\n canvas.lineJoin = 'round';\n canvas.lineCap = 'round';\n canvas.closePath();\n };\n }", "title": "" }, { "docid": "101459cc3c80714f2973b080d268b28c", "score": "0.5590098", "text": "function drawLine(obj, svg) {\n svg.style.strokeDasharray = [obj.length, obj.pathLength].join(' ');\n}", "title": "" }, { "docid": "eea64adf8a7c7d727cecd636d7e951ae", "score": "0.558897", "text": "function DrawLines(a, b, c, d, r) {\n this.a = a; // x point of line origin\n this.b = b; // y point of line origin\n this.c = c; // x point of line terminal\n this.d = d; // y point of line terminal\n // obtain the radian measurement\n this.r = atan2((this.d - this.b), (this.c - this.a)); // radians of slope of line\n // use the radian measurement to get a new destination for the leading point of the line\n this.Xpoint = this.a + cos(this.r); // how much to increment x point\n this.Ypoint = this.b + sin(this.r); // how much to increment y point\n // get the distance of the finished line\n this.distance = dist(this.a, this.b, this.c, this.d); // store distane between points\n this.drawnline = 0; // store where the line is in the process of being drawn\n this.connect = function(red, green, blue) { //store paremeters for line color\n if (lineX.length >= 2) {\n stroke(red, green, blue);\n strokeWeight(5);\n if (millis() - lastTime > lineSpeed) {\n if (this.distance >= this.drawnline) {\n line(this.a, this.b, this.Xpoint, this.Ypoint);\n this.drawnline = dist(this.a, this.b, this.Xpoint, this.Ypoint);\n this.Xpoint = this.Xpoint + cos(this.r) * lineSpeed;\n this.Ypoint = this.Ypoint + sin(this.r) * lineSpeed;\n XonLine.push(this.Xpoint); //store x values in array to evaluate if circle intersects this point\n YonLine.push(this.Ypoint); //store y value in array to evaluate if circle intersects this point\n lastTime = millis(); //reset timer\n } else {\n line(this.a, this.b, this.c, this.d); //keep line\n }\n }\n }\n strokeWeight(1);\n }\n}", "title": "" }, { "docid": "dd02afd1b0043e52ef647cb032540c52", "score": "0.55837107", "text": "function drawLine() {\n var startX;\n var startY;\n var endX;\n var endY;\n var rect = canvas.getBoundingClientRect();\n variables.getLineVars()[variables.getLineVars().length] = 'l' + (variables.getLineVars().length+1);\n variables.printVars();\n $('#' + canvas.id).off('.draw');\n if(figNum < 0) $('#' + canvas.id).on('vmousedown.draw', function(evt) {\n \n startX = Math.floor(evt.clientX - rect.left);\n startY = Math.floor(evt.clientY - rect.top);\n \n //visualize what the line will look like as the user moves the cursor around\n $('#' + canvas.id).on('vmousemove.draw', function(evt) {\n var ctx = canvas.getContext('2d');\n ctx.beginPath();\n ctx.moveTo(startX, startY);\n ctx.lineTo(evt.clientX - rect.left, evt.clientY - rect.top);\n ctx.strokeStyle = \"#FF0000\";\n ctx.stroke();\n });\n \n $('#' + canvas.id).on('vmouseup.draw', function(evt) {\n //Turn mouse move listener off\n endX = Math.floor(evt.clientX - rect.left);\n endY = Math.floor(evt.clientY - rect.top);\n \n if(endX>=0 && endX<=300 & endY>=0 && endY<=300) {\n toDraw[toDraw.length] = new shapes.line(startX, startY, endX, endY, \"line\");\n \n code.addNewRow(editor.getSelectedRowIndex(), [code.getIndent(editor.getSelectedRowIndex()) + variables.getLineVars()[variables.getLineVars().length-1], \"&nbsp;=&nbsp;\", \n \"(\", \"(\", startX, \",\", 300-startY, \")\", \",\", \"(\", endX, \",\", 300-endY, \")\", \")\"]);\n code.addNewRow(editor.getSelectedRowIndex(), [code.getIndent(editor.getSelectedRowIndex()) + \"draw\", \"(\", variables.getLineVars()[variables.getLineVars().length-1], \")\"]);\n }\n //Turn off all .draw listeners\n $('#' + canvas.id).off('.draw');\n });\n });\n }", "title": "" }, { "docid": "c530261e0904175f0261d33a0675cf67", "score": "0.5579509", "text": "function animateLineDrawing() { //create func//\n const animationLoop = requestAnimationFrame(animateLineDrawing); //creates loop//\n c.clearRect(0,0,608,608) //clears content//\n c.beginPath()// starts new path//\n c.moveTo(x1, y1)//creates new starting point//\n c.lineTo(x, y) //creates new end point//\n c.lineWidth = 10; //dicleares width//\n c.strokestyle = 'rgba(70, 255, 33, .8)' //what line looks like//\n c.stroke();//does the line//\n\n if (x1 <= x2 && y1 <= y2) { //checks if we reached end pint//\n if (x < x2) { x +=10; } //adds 10 to previous end x point//\n if(y < y2) { y += 10; } //adds 10 to previous end y point//\n if(x >= x2 && y >= y2) {cancelAnimationFrame(animationLoop)}//cancels animation//\n }\n if (x1 <= x2 && y1 >= y2) {\n if (x < x2) { x +=10; } //adds 10 to previous end x point//\n if( y > y2) {y -= 10; } //removes 10 to previous end x point//\n if (x >= x2 && y <=y2 ) {cancelAnimationFrame(animationLoop);}\n }\n }", "title": "" }, { "docid": "31042ab027805377a8c26c677db3fd04", "score": "0.5573645", "text": "function drawLine(app, x1, y1, x2, y2, color = '0x000000'){\n let line = new PIXI.Graphics();\n line.lineStyle(0.3, color, 1);\n line.moveTo(x1, y1);\n line.lineTo(x2, y2);\n //line.x = 32;\n //line.y = 32;\n app.stage.addChild(line);\n console.log(\"Line drawn\");\n}", "title": "" }, { "docid": "52f039ef323ce593c13f4de1160903d3", "score": "0.5552932", "text": "function Obstacle(gameHeight, opening, x) { //ParDeBarreiras\n this.element = newElement('div', 'obstacle'); // the whole obstacle!\n\n this.topBarrier = new Barrier(true); // top barrier\n this.bottomBarrier = new Barrier(false); // bottom barrier\n\n // appending to complete the obstacle in the html\n this.element.appendChild(this.topBarrier.element);\n this.element.appendChild(this.bottomBarrier.element);\n\n // generating a random opening for the bird to pass through\n this.lotteryOpening = () => {\n const topHeight = Math.random() * (gameHeight - opening);\n const bottomHeight = gameHeight - opening - topHeight;\n // now setting the height of both barriers\n this.topBarrier.setHeight(topHeight);\n this.bottomBarrier.setHeight(bottomHeight);\n }\n\n // parsing the left pixels from the obstacle to check where it is\n this.getX = () => parseInt(this.element.style.left.split('px')[0]); // ex: [100,px]\n\n // considering the x passed in the arguments, setting new x\n this.setX = x => this.element.style.left = `${x}px`;\n // \"The clientWidth property returns the viewable width of an element \n // in pixels, including padding, but not the border, scrollbar or margin\".\n this.getWidth = () => this.element.clientWidth;\n // calling the lottery opening function to choose randomly\n this.lotteryOpening();\n // setting the x axis (moving)\n this.setX(x);\n}", "title": "" }, { "docid": "fe4f6cde1999c8f0f50aa8db0e2331fe", "score": "0.5546242", "text": "poly(obj){\n\t\tthis.beginPath(obj)\n\t\tvar px = obj.x\n\t\tvar py = obj.y\n\t\tthis.moveTo({x:px[0],y:py[0]})\n\t\tfor( var i=1; i<px.length; i++) this.lineTo({x:px[i],y:py[i]})\n\t}", "title": "" }, { "docid": "4127050f65e26ab783b3bdf692016ce9", "score": "0.5539559", "text": "function drawLane(){\n\t//dotted line rectangle x\n\tvar lx=0\n\tctx.fillStyle = \"rgba(255, 255, 255, 1)\"\n\twhile(lx<700){\n\t\tctx.beginPath()\n\t\tctx.rect(lx, 149, 10, 3)\n\t\tctx.closePath()\n\t\tctx.fill()\n\t\tlx+=15\n\t}\n}", "title": "" }, { "docid": "f24ebdf1bc10fa74e9a2d47f93a906a4", "score": "0.55395293", "text": "function drawLine(x,y,color,width)\n{\n\n //tool.minDistance = 10;\n pathio = new Path();\n pathio.strokeColor = color;\n pathio.strokeWidth = width;\n //pathio.add(x,y);\n\n console.log(x,y,color);\n}", "title": "" }, { "docid": "0c5792ac012a4d1b2a65c05fbe09a53e", "score": "0.5530585", "text": "function line() { // Draws a line from (-0.5,0) to (0.5,0)\n graphics.beginPath();\n graphics.moveTo(-0.5,0);\n graphics.lineTo(0.5,0);\n graphics.stroke();\n}", "title": "" }, { "docid": "1f6a86ae9974f452e61efd94946d440e", "score": "0.55254453", "text": "function addLine(index,polyline_path,info_object){\n // generate line in map\n var path_line = new google.maps.Polyline({\n path:polyline_path,\n strokeColor:'red',\n StrokeOvacity: 1.000000,\n map:map\n });\n var start_info = addMarker(polyline_path[0]);\n start_info.setIcon(\"http://icons.iconarchive.com/icons/icons-land/vista-flags/32/Solid-Color-White-Flag-3-icon.png\");\n var finish_info = addMarker(polyline_path[polyline_path.length-1]);\n finish_info.setIcon(\"http://icons.iconarchive.com/icons/icons8/windows-8/32/Sports-Finish-Flag-icon.png\");\n\n\n\n // checking and update object\n if(getObject(index) != null){\n var obj = getObject(index);\n while(obj.length){\n obj.pop().setMap(null);\n }\n object[checkIndexObject(index)].object=[start_info,finish_info,path_line];\n }else{\n var tuple_obje = {\"index\": index, \"object\":[start_info, finish_info, path_line]};\n object.push(tuple_obje);\n }\n focusMap(polyline_path);\n \n // generate info window string\n if(info_object!=null){\n x = '</th><th>';\n y= '</th></tr><tr><th>';\n string_info = \"<table class=table table-bordered table-sm><tbody><tr><th>\";\n string_info += \"gid\"+x+info_object.gid+y;\n string_info += 'start_time'+x+info_object.start_time+y;\n string_info += 'finish_time'+x+info_object.finish_time+y;\n string_info += 'total_time'+x+info_object.total_time+y;\n string_info += 'trajectory_length'+x+info_object.length+y;\n string_info += 'object_velocity'+x+info_object.velocity;\n string_info += \"</tr></tbody></table>\";\n }else{\n string_info = \"no information\";\n }\n\n // generate info window\n info = new google.maps.InfoWindow();\n google.maps.event.addListener(start_info,'click',(function(start_info,string_info,info){\n return function(){\n info.setContent(string_info);\n info.open(map,start_info);\n }\n })(start_info, string_info, info));\n}", "title": "" }, { "docid": "e86dceabac116acfc74c5e1e99d52deb", "score": "0.5524761", "text": "draw() {\n const me = this,\n {\n client\n } = me;\n me.lineSegments.forEach(el => el.remove());\n me.lineSegments = [];\n\n if (!me.shouldDrawProgressLine()) {\n return;\n }\n\n if (client.isAnimating) {\n client.on({\n transitionend() {\n me.scheduleDraw();\n },\n\n once: true\n });\n return;\n }\n\n const data = me.getRenderData(),\n lines = [];\n client.rowManager.forEach(row => {\n lines.push(...me.getLineSegmentRenderData(row, data));\n }); // Batch rendering to avoid constant layout reflows\n // With batch drawing line takes ~8ms comparing to ~30ms prior\n\n lines.forEach(line => me.drawLineSegment(line));\n client.trigger('progressLineDrawn');\n }", "title": "" }, { "docid": "6ca2098e808f2968e6feb87b392f9ef8", "score": "0.5524744", "text": "function draw() {\r\n var job;\r\n\r\n job = this;\r\n\r\n // TODO:\r\n }", "title": "" }, { "docid": "6ca2098e808f2968e6feb87b392f9ef8", "score": "0.5524744", "text": "function draw() {\r\n var job;\r\n\r\n job = this;\r\n\r\n // TODO:\r\n }", "title": "" }, { "docid": "38d7a302cfd754dbd803c9c5f6732ac1", "score": "0.5524373", "text": "function draw() {}", "title": "" }, { "docid": "38d7a302cfd754dbd803c9c5f6732ac1", "score": "0.5524373", "text": "function draw() {}", "title": "" }, { "docid": "38d7a302cfd754dbd803c9c5f6732ac1", "score": "0.5524373", "text": "function draw() {}", "title": "" }, { "docid": "84f24246896f231a61891ef0acb1e2ed", "score": "0.5522785", "text": "function draw(){ \n ctx.drawImage(bg.image,0,0,bg.image.width,bg.image.height,0,0,canvas.width,canvas.height);\n \n \n for(let i = 1; i < obstacole.length; i++)\n obstacole[i].drawMe();\n for(let i = 0; i < AllPlayers.length; i++)\n if(AllPlayers[i].dead == false)\n AllPlayers[i].drawMe();\n\n /////////// DIRECTIA IN CARE SE UITA JUCATORUL /////////\n for(cineTrage of AllPlayers)\n for(bullet of cineTrage.bullets)\n {\n if(bullet.dead == false)\n {\n ctx.beginPath();\n ctx.lineWidth = 2;\n ctx.strokeStyle = bullet.color;\n ctx.moveTo(bullet.x,bullet.y);\n ctx.lineTo(bullet.x + bullet.velocity.x * bullet.size,bullet.y + bullet.velocity.y * bullet.size);\n ctx.stroke();\n ctx.closePath();\n }\n }\n\n\n if(Jucator.dead == false){\n\n }\n\n if(mouseX && mouseY){\n crosshair.drawMe();\n }\n}", "title": "" }, { "docid": "dc3d59c9a2b55ed4869991787455af3f", "score": "0.55173486", "text": "function drawParkingLine(parkingObj) {\n // Get all the coordinates for the current parking zone\n parkingCoordinates = [];\n $.each(parkingObj.coordinates, function(key, coordinate) {\n parkingCoordinates.push({\n lat: coordinate[1],\n lng: coordinate[0]\n });\n });\n\n // Draw a line with every coordinates to show the whole parking zone\n var parkingPath = new google.maps.Polyline({\n path: parkingCoordinates,\n geodesic: true,\n strokeColor: '#FF0000',\n strokeOpacity: 1.0,\n strokeWeight: 2\n });\n parkingPath.setMap(map);\n}", "title": "" }, { "docid": "ef59f04cbf1afdf8a9759b99facf9db2", "score": "0.55123395", "text": "function drawLine(ctx, linex, liney) {\n for (i = 0; i < window.arrayx.length; ++i) {\n if (((linex == window.arrayx[i]) && (liney == window.arrayy[i])) || (linex < 0) || (linex > 1200) || (liney < 0) || (liney > 700)) {\n socket.emit('lose');\n clearInterval(window.myVar);\n clearInterval(window.myVar2);\n gameInProgress = false;\n\n var message = \"You Just Lost!\";\n socket.emit('loadLobbyPage', message);\n }\n }\n window.arrayx[arrayx.length] = linex;\n window.arrayy[arrayy.length] = liney;\n\n var updatex = 0;\n var updatey = 0;\n\n ctx.moveTo(linex,liney);\n if (direction == \"right\") {\n updatex = 1;\n updatey = 0;\n }\n if (direction == \"left\") {\n updatex = -1;\n updatey = 0;\n }\n if (direction == \"down\") {\n updatex = 0;\n updatey = 1;\n }\n if (direction == \"up\") {\n updatex = 0;\n updatey = -1;\n }\n\n linex+= updatex;\n liney+= updatey;\n window.linex+=updatex;\n window.liney+=updatey;\n ctx.lineTo(linex,liney);\n ctx.stroke();\n}", "title": "" }, { "docid": "fc2fa1bc6bb96bf39e5ad4cdb8a8cc35", "score": "0.55062973", "text": "function createObstacle(x,y, breakable)\n{\n if(breakable == false)\n {\n obstacle = game.add.sprite(x,y, 'slab_end');\n }\n else\n {\n obstacle = game.add.sprite(x,y, 'slab');\n }\n game.physics.arcade.enable(obstacle);\n obstacle.width = 80;\n obstacle.height = 20;\n\n obstacle.body.velocity.y = -OBSTACLE_SPEED;\n obstaclesGroup.add(obstacle);\n}", "title": "" }, { "docid": "3c808587ad90eb6bdd0bf0a55110ee6e", "score": "0.5495508", "text": "function draw(w,h)\n{\n\tof.Background(0,0,0);\n\tof.SetColor(250,250,250,of.Random(10,20));\n\tfor(i=0;i<this.particules.length;i++)\n\t{\n\t\tthis.particules[i].draw();\n\t}\n\n\tvar pi,pj;\n for(i=0; i < this.particules.length; i++)\n {\n \tpi =this.particules[i];\n \t for(j=i+1 ; j<this.particules.length; j++)\n \t{\n \t \tpj = this.particules[j];\n \t \tvar d = of.Dist(pi.x,pi.y,pj.x,pj.y);\n \t \tif(d<=120)\n \t \t{\n \t \t\tof.Line(pi.x,pi.y,pj.x,pj.y);\n \t \t\t\n \t \t}\n \t}\n\n\t}\n\n\n}", "title": "" }, { "docid": "6c6333faee5bfffc25363706a3aa93c0", "score": "0.54853225", "text": "constructor(startX, startY, obstacleImg, speed, widthI, heightI) {\n this.obstacle = createSprite(startX, startY, widthI, heightI)\n this.dispImg = obstacleImg;\n this.dispImg.resize(widthI, heightI);\n this.obstacle.addImage(\"normal\", this.dispImg)\n this.obstacle.changeAnimation(\"normal\")\n this.obstacle.velocity.x = -speed;\n this.obstacle.setCollider(\"rectangle\", 0, 0, widthI, heightI)\n }", "title": "" }, { "docid": "08a47ce6619b4b8f96986f29245315c9", "score": "0.5481341", "text": "drawRoad(edge, color) {\n //TODO\n }", "title": "" } ]
605f8e1a8c5bdce34531f11d313f9ba9
Safety wrapper for startTransaction for the unlikely case that transaction starts before tracing is imported if that happens we want to avoid throwing an error from profiling code. see
[ { "docid": "0a48aafcea76558bd2a0dea87915c485", "score": "0.62972796", "text": "function onProfilingStartRouteTransaction(transaction) {\n if (!transaction) {\n if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {\n utils.logger.log('[Profiling] Transaction is undefined, skipping profiling');\n }\n return transaction;\n }\n\n return wrapTransactionWithProfiling(transaction);\n}", "title": "" } ]
[ { "docid": "d7de3786579cddfcc0014b139ee0f13e", "score": "0.69179344", "text": "function __PRIVATE__wrapStartTransactionWithProfiling(startTransaction) {\n return function wrappedStartTransaction(\n\n transactionContext,\n customSamplingContext,\n ) {\n const transaction = startTransaction.call(this, transactionContext, customSamplingContext);\n if (transaction === undefined) {\n if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {\n utils.logger.log('[Profiling] Transaction is undefined, skipping profiling');\n }\n return transaction;\n }\n\n return wrapTransactionWithProfiling(transaction);\n };\n}", "title": "" }, { "docid": "aae86c81f0dbd98d50e9d7c5d1ed0eaf", "score": "0.66746914", "text": "async startTransaction () {\n if (this.inTransaction) return Promise.reject('You already started a transaction. Call `commit()` or `rollback()` to terminate it.')\n this.inTransaction = true\n return Promise.resolve()\n }", "title": "" }, { "docid": "37e55ed519cb1bbf0b18219d3545079d", "score": "0.66032594", "text": "begin () {\n this.transactionCache = {}\n this.transaction = true\n }", "title": "" }, { "docid": "c4a62291f3103d6f0dfb85dfe18e51fa", "score": "0.6510563", "text": "enterBeginTransactionStatement(ctx) {\n\t}", "title": "" }, { "docid": "165ffce87a95c4506dad7b04fd5af9da", "score": "0.6231567", "text": "startTransaction(id, metadata) {\n if (this.transaction.id) {\n throw Error(\"Nested transactions not supported\");\n }\n this.transaction.id = id;\n this.transaction.depth = 1;\n return this.emit('startTransaction', id, metadata);\n }", "title": "" }, { "docid": "76cf36b59649beff854da98f80d324db", "score": "0.6179355", "text": "constructor() {\n super('Block execution transaction is not started');\n }", "title": "" }, { "docid": "674bf0b8ea6350002f281aeb27801f5b", "score": "0.61285627", "text": "function beginTransaction(options, cb){\n datastore.beginTransaction(options)\n .execute(function(err, result) {\n if (err) {\n seneca.log.error(err);\n return;\n }\n cb(result.transaction);\n });\n}", "title": "" }, { "docid": "c38147056249b9233b37f20a47b0e894", "score": "0.5853199", "text": "function _startChild(transaction, _a) {\n var startTimestamp = _a.startTimestamp, ctx = tslib_1.__rest(_a, [\"startTimestamp\"]);\n if (startTimestamp && transaction.startTimestamp > startTimestamp) {\n transaction.startTimestamp = startTimestamp;\n }\n return transaction.startChild(tslib_1.__assign({ startTimestamp: startTimestamp }, ctx));\n}", "title": "" }, { "docid": "021d773bb2e5d191f3a6253de7d0a526", "score": "0.5756682", "text": "withTransaction(fn, options) {\n const startTime = utils_1.now();\n return attemptTransaction(this, startTime, fn, options);\n }", "title": "" }, { "docid": "0ca0a4578558e273ff35f15889dfde5f", "score": "0.5727395", "text": "enterRollbackTransactionStatement(ctx) {\n\t}", "title": "" }, { "docid": "e44e57ae8d68e6e6a4628c6ff837a10a", "score": "0.56942123", "text": "withTransaction(fn, options) {\n const startTime = (0, utils_1.now)();\n return attemptTransaction(this, startTime, fn, options);\n }", "title": "" }, { "docid": "9dbbeb589817060a77ffc34b19e9b800", "score": "0.56828547", "text": "function runTxHook (cb) {\n self.emit('beforeTx', tx, cb)\n }", "title": "" }, { "docid": "b04c15abe1ebb4151f76fa19f724b592", "score": "0.55682117", "text": "function _push_transaction() {\n _push_transaction = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref) {\n var signatures, _ref$compression, compression, serializedTransaction, serializedContextFreeData, expired;\n\n return runtime_1.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n signatures = _ref.signatures, _ref$compression = _ref.compression, compression = _ref$compression === void 0 ? 0 : _ref$compression, serializedTransaction = _ref.serializedTransaction, serializedContextFreeData = _ref.serializedContextFreeData;\n _context.prev = 1;\n _context.next = 4;\n return this.post('/v1/chain/push_transaction', {\n signatures: signatures,\n compression: compression,\n packed_context_free_data: arrayToHex$1(serializedContextFreeData || new Uint8Array(0)),\n packed_trx: arrayToHex$1(serializedTransaction)\n });\n\n case 4:\n return _context.abrupt(\"return\", _context.sent);\n\n case 7:\n _context.prev = 7;\n _context.t0 = _context[\"catch\"](1);\n\n if (_context.t0 && _context.t0.json && _context.t0.json.error) {\n expired = _context.t0.json.error.name === 'expired_tx_exception';\n\n if (expired) {\n _context.t0.json.error.message = 'Transaction Expired: Try Again';\n this.nextEndpoint();\n }\n }\n\n throw _context.t0;\n\n case 11:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this, [[1, 7]]);\n }));\n return _push_transaction.apply(this, arguments);\n}", "title": "" }, { "docid": "bbdb94295746ac5a1a2d852047b47711", "score": "0.55641633", "text": "function wrapTransactionWithProfiling(transaction) {\n // Feature support check first\n const JSProfilerConstructor = helpers.WINDOW.Profiler;\n\n if (!isJSProfilerSupported(JSProfilerConstructor)) {\n if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {\n utils.logger.log(\n '[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.',\n );\n }\n return transaction;\n }\n\n // profilesSampleRate is multiplied with tracesSampleRate to get the final sampling rate.\n if (!transaction.sampled) {\n if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {\n utils.logger.log('[Profiling] Transaction is not sampled, skipping profiling');\n }\n return transaction;\n }\n\n // If constructor failed once, it will always fail, so we can early return.\n if (PROFILING_CONSTRUCTOR_FAILED) {\n if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {\n utils.logger.log('[Profiling] Profiling has been disabled for the duration of the current user session.');\n }\n return transaction;\n }\n\n const client = core.getCurrentHub().getClient();\n const options = client && client.getOptions();\n\n // @ts-ignore not part of the browser options yet\n const profilesSampleRate = (options && options.profilesSampleRate) || 0;\n if (profilesSampleRate === undefined) {\n if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {\n utils.logger.log('[Profiling] Profiling disabled, enable it by setting `profilesSampleRate` option to SDK init call.');\n }\n return transaction;\n }\n\n // Check if we should sample this profile\n if (Math.random() > profilesSampleRate) {\n if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {\n utils.logger.log('[Profiling] Skip profiling transaction due to sampling.');\n }\n return transaction;\n }\n\n // From initial testing, it seems that the minimum value for sampleInterval is 10ms.\n const samplingIntervalMS = 10;\n // Start the profiler\n const maxSamples = Math.floor(MAX_PROFILE_DURATION_MS / samplingIntervalMS);\n let profiler;\n\n // Attempt to initialize the profiler constructor, if it fails, we disable profiling for the current user session.\n // This is likely due to a missing 'Document-Policy': 'js-profiling' header. We do not want to throw an error if this happens\n // as we risk breaking the user's application, so just disable profiling and log an error.\n try {\n profiler = new JSProfilerConstructor({ sampleInterval: samplingIntervalMS, maxBufferSize: maxSamples });\n } catch (e) {\n if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {\n utils.logger.log(\n \"[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header.\",\n );\n utils.logger.log('[Profiling] Disabling profiling for current user session.');\n }\n PROFILING_CONSTRUCTOR_FAILED = true;\n }\n\n // We failed to construct the profiler, fallback to original transaction - there is no need to log\n // anything as we already did that in the try/catch block.\n if (!profiler) {\n return transaction;\n }\n\n if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {\n utils.logger.log(`[Profiling] started profiling transaction: ${transaction.name || transaction.description}`);\n }\n\n // We create \"unique\" transaction names to avoid concurrent transactions with same names\n // from being ignored by the profiler. From here on, only this transaction name should be used when\n // calling the profiler methods. Note: we log the original name to the user to avoid confusion.\n const profileId = utils.uuid4();\n\n // A couple of important things to note here:\n // `CpuProfilerBindings.stopProfiling` will be scheduled to run in 30seconds in order to exceed max profile duration.\n // Whichever of the two (transaction.finish/timeout) is first to run, the profiling will be stopped and the gathered profile\n // will be processed when the original transaction is finished. Since onProfileHandler can be invoked multiple times in the\n // event of an error or user mistake (calling transaction.finish multiple times), it is important that the behavior of onProfileHandler\n // is idempotent as we do not want any timings or profiles to be overriden by the last call to onProfileHandler.\n // After the original finish method is called, the event will be reported through the integration and delegated to transport.\n let processedProfile = null;\n\n /**\n * Idempotent handler for profile stop\n */\n function onProfileHandler() {\n // Check if the profile exists and return it the behavior has to be idempotent as users may call transaction.finish multiple times.\n if (!transaction) {\n return;\n }\n // Satisfy the type checker, but profiler will always be defined here.\n if (!profiler) {\n return;\n }\n if (processedProfile) {\n if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {\n utils.logger.log(\n '[Profiling] profile for:',\n transaction.name || transaction.description,\n 'already exists, returning early',\n );\n }\n return;\n }\n\n profiler\n .stop()\n .then((p) => {\n if (maxDurationTimeoutID) {\n helpers.WINDOW.clearTimeout(maxDurationTimeoutID);\n maxDurationTimeoutID = undefined;\n }\n\n if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {\n utils.logger.log(`[Profiling] stopped profiling of transaction: ${transaction.name || transaction.description}`);\n }\n\n // In case of an overlapping transaction, stopProfiling may return null and silently ignore the overlapping profile.\n if (!p) {\n if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {\n utils.logger.log(\n `[Profiling] profiler returned null profile for: ${transaction.name || transaction.description}`,\n 'this may indicate an overlapping transaction or a call to stopProfiling with a profile title that was never started',\n );\n }\n return;\n }\n\n // If a profile has less than 2 samples, it is not useful and should be discarded.\n if (p.samples.length < 2) {\n return;\n }\n\n processedProfile = { ...p, profile_id: profileId };\n sendProfile.sendProfile(profileId, processedProfile);\n })\n .catch(error => {\n if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {\n utils.logger.log('[Profiling] error while stopping profiler:', error);\n }\n return null;\n });\n }\n\n // Enqueue a timeout to prevent profiles from running over max duration.\n let maxDurationTimeoutID = helpers.WINDOW.setTimeout(() => {\n if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {\n utils.logger.log(\n '[Profiling] max profile duration elapsed, stopping profiling for:',\n transaction.name || transaction.description,\n );\n }\n void onProfileHandler();\n }, MAX_PROFILE_DURATION_MS);\n\n // We need to reference the original finish call to avoid creating an infinite loop\n const originalFinish = transaction.finish.bind(transaction);\n\n /**\n * Wraps startTransaction and stopTransaction with profiling related logic.\n * startProfiling is called after the call to startTransaction in order to avoid our own code from\n * being profiled. Because of that same reason, stopProfiling is called before the call to stopTransaction.\n */\n function profilingWrappedTransactionFinish() {\n if (!transaction) {\n return originalFinish();\n }\n // onProfileHandler should always return the same profile even if this is called multiple times.\n // Always call onProfileHandler to ensure stopProfiling is called and the timeout is cleared.\n onProfileHandler();\n\n // Set profile context\n transaction.setContext('profile', { profile_id: profileId });\n\n return originalFinish();\n }\n\n transaction.finish = profilingWrappedTransactionFinish;\n return transaction;\n}", "title": "" }, { "docid": "d825cb86218c87f69fbd7a0944704688", "score": "0.55556786", "text": "function startTransaction() {\n // create an NV transaction\n logDebugMessage(\"Creating the \\\"Home Page\\\" transaction\");\n var pageTransactionConfig = {};\n pageTransactionConfig.name = \"Home Page\";\n pageTransaction = new Transaction(pageTransactionConfig);\n\n // add the NV transaction to the NV test\n logDebugMessage(\"Adding the \\\"Home Page\\\" transaction to the NV test\");\n return pageTransaction.addToTest(siteTest).\n then(function() {\n // start the NV transaction\n if (!debug) {\n spinner.stop(true);\n }\n console.log(\"Starting the \\\"Home Page\\\" transaction\");\n if (!debug) {\n spinner.start();\n }\n return pageTransaction.start();\n });\n }", "title": "" }, { "docid": "0007baa774929d3e939d47bfbf68c7b4", "score": "0.55465454", "text": "async function beginTransaction() {\n connection.beginTransaction();\n}", "title": "" }, { "docid": "6e836a5880852bd20fdf73c727715a5b", "score": "0.55447805", "text": "startTransaction(options) {\n var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\n if (this[kSnapshotEnabled]) {\n throw new error_1.MongoCompatibilityError('Transactions are not allowed with snapshot sessions');\n }\n assertAlive(this);\n if (this.inTransaction()) {\n throw new error_1.MongoTransactionError('Transaction already in progress');\n }\n if (this.isPinned && this.transaction.isCommitted) {\n this.unpin();\n }\n const topologyMaxWireVersion = utils_1.maxWireVersion(this.topology);\n if (shared_1.isSharded(this.topology) &&\n topologyMaxWireVersion != null &&\n topologyMaxWireVersion < minWireVersionForShardedTransactions) {\n throw new error_1.MongoCompatibilityError('Transactions are not supported on sharded clusters in MongoDB < 4.2.');\n }\n // increment txnNumber\n this.incrementTransactionNumber();\n // create transaction state\n this.transaction = new transactions_1.Transaction({\n readConcern: (_c = (_b = options === null || options === void 0 ? void 0 : options.readConcern) !== null && _b !== void 0 ? _b : this.defaultTransactionOptions.readConcern) !== null && _c !== void 0 ? _c : (_d = this.clientOptions) === null || _d === void 0 ? void 0 : _d.readConcern,\n writeConcern: (_f = (_e = options === null || options === void 0 ? void 0 : options.writeConcern) !== null && _e !== void 0 ? _e : this.defaultTransactionOptions.writeConcern) !== null && _f !== void 0 ? _f : (_g = this.clientOptions) === null || _g === void 0 ? void 0 : _g.writeConcern,\n readPreference: (_j = (_h = options === null || options === void 0 ? void 0 : options.readPreference) !== null && _h !== void 0 ? _h : this.defaultTransactionOptions.readPreference) !== null && _j !== void 0 ? _j : (_k = this.clientOptions) === null || _k === void 0 ? void 0 : _k.readPreference,\n maxCommitTimeMS: (_l = options === null || options === void 0 ? void 0 : options.maxCommitTimeMS) !== null && _l !== void 0 ? _l : this.defaultTransactionOptions.maxCommitTimeMS\n });\n this.transaction.transition(transactions_1.TxnState.STARTING_TRANSACTION);\n }", "title": "" }, { "docid": "4382e0cda4a5572e058f5ae6393ebc3f", "score": "0.5538793", "text": "startTransaction(options) {\n var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\n if (this[kSnapshotEnabled]) {\n throw new error_1.MongoCompatibilityError('Transactions are not supported in snapshot sessions');\n }\n if (this.inTransaction()) {\n throw new error_1.MongoTransactionError('Transaction already in progress');\n }\n if (this.isPinned && this.transaction.isCommitted) {\n this.unpin();\n }\n const topologyMaxWireVersion = (0, utils_1.maxWireVersion)(this.client.topology);\n if ((0, shared_1.isSharded)(this.client.topology) &&\n topologyMaxWireVersion != null &&\n topologyMaxWireVersion < minWireVersionForShardedTransactions) {\n throw new error_1.MongoCompatibilityError('Transactions are not supported on sharded clusters in MongoDB < 4.2.');\n }\n // increment txnNumber\n this.incrementTransactionNumber();\n // create transaction state\n this.transaction = new transactions_1.Transaction({\n readConcern: (_c = (_b = options === null || options === void 0 ? void 0 : options.readConcern) !== null && _b !== void 0 ? _b : this.defaultTransactionOptions.readConcern) !== null && _c !== void 0 ? _c : (_d = this.clientOptions) === null || _d === void 0 ? void 0 : _d.readConcern,\n writeConcern: (_f = (_e = options === null || options === void 0 ? void 0 : options.writeConcern) !== null && _e !== void 0 ? _e : this.defaultTransactionOptions.writeConcern) !== null && _f !== void 0 ? _f : (_g = this.clientOptions) === null || _g === void 0 ? void 0 : _g.writeConcern,\n readPreference: (_j = (_h = options === null || options === void 0 ? void 0 : options.readPreference) !== null && _h !== void 0 ? _h : this.defaultTransactionOptions.readPreference) !== null && _j !== void 0 ? _j : (_k = this.clientOptions) === null || _k === void 0 ? void 0 : _k.readPreference,\n maxCommitTimeMS: (_l = options === null || options === void 0 ? void 0 : options.maxCommitTimeMS) !== null && _l !== void 0 ? _l : this.defaultTransactionOptions.maxCommitTimeMS\n });\n this.transaction.transition(transactions_1.TxnState.STARTING_TRANSACTION);\n }", "title": "" }, { "docid": "59a88cbf889fa1c270fa178495b38b3d", "score": "0.5505367", "text": "enterCommitTransactionStatement(ctx) {\n\t}", "title": "" }, { "docid": "9609de8cc5deb286bc722fa2619eaa71", "score": "0.5496568", "text": "wrapTransaction(txParams) {\n return txParams;\n }", "title": "" }, { "docid": "b1a30c1a960ad2822bf62a722c36b69c", "score": "0.5486953", "text": "async beforeTransaction(ctx) {\n\t\t// Allow only the manufacturer peers to initiate any transaction on this contract\n\t}", "title": "" }, { "docid": "f12fc322d5c4a277ba8f2400887e2052", "score": "0.54436433", "text": "begin(transaction=`tx-${this.counter++}`) {\n this._transmit('BEGIN', {transaction});\n return {\n id: transaction,\n commit: this.commit.bind(this, transaction),\n abort: this.abort.bind(this, transaction)\n };\n }", "title": "" }, { "docid": "75fd68fcaeff9b5daeda9596f1ffcb0e", "score": "0.53298926", "text": "enterTransactionSettingStatement(ctx) {\n\t}", "title": "" }, { "docid": "c8aa10cfdf9bed97dfa0b5cc50a6e521", "score": "0.5320509", "text": "static async createTransaction() {\n return models.sequelize.transaction();\n }", "title": "" }, { "docid": "3c5a7cead84f4566fba55ff5275afa21", "score": "0.5318581", "text": "enterPragmaAutonomousTransaction(ctx) {\n\t}", "title": "" }, { "docid": "17dc4f759978054bacb1ada4c80fdade", "score": "0.53122663", "text": "function repoStartTransaction(repo, path, transactionUpdate, onComplete, unwatcher, applyLocally) {\n repoLog(repo, 'transaction on ' + path);\n // Initialize transaction.\n var transaction = {\n path: path,\n update: transactionUpdate,\n onComplete: onComplete,\n // One of TransactionStatus enums.\n status: null,\n // Used when combining transactions at different locations to figure out\n // which one goes first.\n order: LUIDGenerator(),\n // Whether to raise local events for this transaction.\n applyLocally: applyLocally,\n // Count of how many times we've retried the transaction.\n retryCount: 0,\n // Function to call to clean up our .on() listener.\n unwatcher: unwatcher,\n // Stores why a transaction was aborted.\n abortReason: null,\n currentWriteId: null,\n currentInputSnapshot: null,\n currentOutputSnapshotRaw: null,\n currentOutputSnapshotResolved: null\n };\n // Run transaction initially.\n var currentState = repoGetLatestState(repo, path, undefined);\n transaction.currentInputSnapshot = currentState;\n var newVal = transaction.update(currentState.val());\n if (newVal === undefined) {\n // Abort transaction.\n transaction.unwatcher();\n transaction.currentOutputSnapshotRaw = null;\n transaction.currentOutputSnapshotResolved = null;\n if (transaction.onComplete) {\n transaction.onComplete(null, false, transaction.currentInputSnapshot);\n }\n }\n else {\n validateFirebaseData('transaction failed: Data returned ', newVal, transaction.path);\n // Mark as run and add to our queue.\n transaction.status = 0 /* RUN */;\n var queueNode = treeSubTree(repo.transactionQueueTree_, path);\n var nodeQueue = treeGetValue(queueNode) || [];\n nodeQueue.push(transaction);\n treeSetValue(queueNode, nodeQueue);\n // Update visibleData and raise events\n // Note: We intentionally raise events after updating all of our\n // transaction state, since the user could start new transactions from the\n // event callbacks.\n var priorityForNode = void 0;\n if (typeof newVal === 'object' &&\n newVal !== null &&\n Object(__WEBPACK_IMPORTED_MODULE_2__firebase_util__[\"contains\"])(newVal, '.priority')) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n priorityForNode = Object(__WEBPACK_IMPORTED_MODULE_2__firebase_util__[\"safeGet\"])(newVal, '.priority');\n Object(__WEBPACK_IMPORTED_MODULE_2__firebase_util__[\"assert\"])(isValidPriority(priorityForNode), 'Invalid priority returned by transaction. ' +\n 'Priority must be a valid string, finite number, server value, or null.');\n }\n else {\n var currentNode = syncTreeCalcCompleteEventCache(repo.serverSyncTree_, path) ||\n ChildrenNode.EMPTY_NODE;\n priorityForNode = currentNode.getPriority().val();\n }\n var serverValues = repoGenerateServerValues(repo);\n var newNodeUnresolved = nodeFromJSON$1(newVal, priorityForNode);\n var newNode = resolveDeferredValueSnapshot(newNodeUnresolved, currentState, serverValues);\n transaction.currentOutputSnapshotRaw = newNodeUnresolved;\n transaction.currentOutputSnapshotResolved = newNode;\n transaction.currentWriteId = repoGetNextWriteId(repo);\n var events = syncTreeApplyUserOverwrite(repo.serverSyncTree_, path, newNode, transaction.currentWriteId, transaction.applyLocally);\n eventQueueRaiseEventsForChangedPath(repo.eventQueue_, path, events);\n repoSendReadyTransactions(repo, repo.transactionQueueTree_);\n }\n}", "title": "" }, { "docid": "b516db1ae8d5c4490c719ece7733e942", "score": "0.53023934", "text": "function repoStartTransaction(repo, path, transactionUpdate, onComplete, unwatcher, applyLocally) {\n repoLog(repo, 'transaction on ' + path);\n // Initialize transaction.\n var transaction = {\n path: path,\n update: transactionUpdate,\n onComplete: onComplete,\n // One of TransactionStatus enums.\n status: null,\n // Used when combining transactions at different locations to figure out\n // which one goes first.\n order: LUIDGenerator(),\n // Whether to raise local events for this transaction.\n applyLocally: applyLocally,\n // Count of how many times we've retried the transaction.\n retryCount: 0,\n // Function to call to clean up our .on() listener.\n unwatcher: unwatcher,\n // Stores why a transaction was aborted.\n abortReason: null,\n currentWriteId: null,\n currentInputSnapshot: null,\n currentOutputSnapshotRaw: null,\n currentOutputSnapshotResolved: null\n };\n // Run transaction initially.\n var currentState = repoGetLatestState(repo, path, undefined);\n transaction.currentInputSnapshot = currentState;\n var newVal = transaction.update(currentState.val());\n if (newVal === undefined) {\n // Abort transaction.\n transaction.unwatcher();\n transaction.currentOutputSnapshotRaw = null;\n transaction.currentOutputSnapshotResolved = null;\n if (transaction.onComplete) {\n transaction.onComplete(null, false, transaction.currentInputSnapshot);\n }\n }\n else {\n validateFirebaseData('transaction failed: Data returned ', newVal, transaction.path);\n // Mark as run and add to our queue.\n transaction.status = 0 /* RUN */;\n var queueNode = treeSubTree(repo.transactionQueueTree_, path);\n var nodeQueue = treeGetValue(queueNode) || [];\n nodeQueue.push(transaction);\n treeSetValue(queueNode, nodeQueue);\n // Update visibleData and raise events\n // Note: We intentionally raise events after updating all of our\n // transaction state, since the user could start new transactions from the\n // event callbacks.\n var priorityForNode = void 0;\n if (typeof newVal === 'object' &&\n newVal !== null &&\n (0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.contains)(newVal, '.priority')) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n priorityForNode = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.safeGet)(newVal, '.priority');\n (0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.assert)(isValidPriority(priorityForNode), 'Invalid priority returned by transaction. ' +\n 'Priority must be a valid string, finite number, server value, or null.');\n }\n else {\n var currentNode = syncTreeCalcCompleteEventCache(repo.serverSyncTree_, path) ||\n ChildrenNode.EMPTY_NODE;\n priorityForNode = currentNode.getPriority().val();\n }\n var serverValues = repoGenerateServerValues(repo);\n var newNodeUnresolved = nodeFromJSON$1(newVal, priorityForNode);\n var newNode = resolveDeferredValueSnapshot(newNodeUnresolved, currentState, serverValues);\n transaction.currentOutputSnapshotRaw = newNodeUnresolved;\n transaction.currentOutputSnapshotResolved = newNode;\n transaction.currentWriteId = repoGetNextWriteId(repo);\n var events = syncTreeApplyUserOverwrite(repo.serverSyncTree_, path, newNode, transaction.currentWriteId, transaction.applyLocally);\n eventQueueRaiseEventsForChangedPath(repo.eventQueue_, path, events);\n repoSendReadyTransactions(repo, repo.transactionQueueTree_);\n }\n}", "title": "" }, { "docid": "11894c690b4ceba3cba757795b5d4ebb", "score": "0.5297492", "text": "enterThrowStatement(ctx) {\n\t}", "title": "" }, { "docid": "bd0ce8b5db94a125fd225260db956e5f", "score": "0.5282779", "text": "async traceTransaction(transactionHash, options) {\n const transactionHashBuffer = utils_1.Data.from(transactionHash).toBuffer();\n // #1 - get block via transaction object\n const transaction = await this.transactions.get(transactionHashBuffer);\n if (!transaction) {\n throw new Error(\"Unknown transaction \" + transactionHash);\n }\n const targetBlock = await this.blocks.get(transaction.blockNumber.toBuffer());\n const parentBlock = await this.blocks.getByHash(targetBlock.header.parentHash.toBuffer());\n const newBlock = __classPrivateFieldGet(this, _prepareNextBlock).call(this, targetBlock, parentBlock, transactionHashBuffer);\n // only copy relevant transactions\n newBlock.transactions = newBlock.transactions.slice(0, 1 + transaction.index.toNumber());\n // #2 - Set state root of original block\n //\n // TODO: Forking needs the forked block number passed during this step:\n // https://github.com/trufflesuite/ganache/blob/develop/lib/blockchain_double.js#L917\n const trie = this.trie.copy();\n trie.setContext(parentBlock.header.stateRoot.toBuffer(), null, parentBlock.header.number);\n // #3 - Rerun every transaction in block prior to and including the requested transaction\n const { gas, structLogs, returnValue, storage } = await __classPrivateFieldGet(this, _traceTransaction).call(this, trie, newBlock, options);\n // #4 - Send results back\n return { gas, structLogs, returnValue, storage };\n }", "title": "" }, { "docid": "4441d00ee7998c07f23441d2557df259", "score": "0.52783597", "text": "prepareForCommit() {\n log('prepareForCommit')\n // noop\n }", "title": "" }, { "docid": "54e492af2ded04fb6c1c6a7a9fa1df88", "score": "0.5276059", "text": "exitBeginTransactionStatement(ctx) {\n\t}", "title": "" }, { "docid": "602851133e4c2ad0360ad78d860a15a3", "score": "0.5233979", "text": "begin () {\n let copy = Object.assign({}, this._getDb());\n // Push a new db copy\n this.transactions.push(copy);\n }", "title": "" }, { "docid": "0f01fd42bcf1a939c3507a507762bb0d", "score": "0.52042603", "text": "_wrapTransaction(tx, hash, startBlock) {\n if (hash != null && hexDataLength(hash) !== 32) {\n throw new Error(\"invalid response - sendTransaction\");\n }\n const result = tx;\n // Check the hash we expect is the same as the hash the server reported\n if (hash != null && tx.hash !== hash) {\n logger.throwError(\"Transaction hash mismatch from Provider.sendTransaction.\", Logger.errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });\n }\n result.wait = (confirms, timeout) => __awaiter(this, void 0, void 0, function* () {\n if (confirms == null) {\n confirms = 1;\n }\n if (timeout == null) {\n timeout = 0;\n }\n // Get the details to detect replacement\n let replacement = undefined;\n if (confirms !== 0 && startBlock != null) {\n replacement = {\n data: tx.data,\n from: tx.from,\n nonce: tx.nonce,\n to: tx.to,\n value: tx.value,\n startBlock\n };\n }\n const receipt = yield this._waitForTransaction(tx.hash, confirms, timeout, replacement);\n if (receipt == null && confirms === 0) {\n return null;\n }\n // No longer pending, allow the polling loop to garbage collect this\n this._emitted[\"t:\" + tx.hash] = receipt.blockNumber;\n if (receipt.status === 0) {\n logger.throwError(\"transaction failed\", Logger.errors.CALL_EXCEPTION, {\n transactionHash: tx.hash,\n transaction: tx,\n receipt: receipt\n });\n }\n return receipt;\n });\n return result;\n }", "title": "" }, { "docid": "db2725aa8742472b806fd2840f5d7c79", "score": "0.5202706", "text": "_wrapTransaction(tx, hash, startBlock) {\n if (hash != null && (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexDataLength)(hash) !== 32) {\n throw new Error(\"invalid response - sendTransaction\");\n }\n const result = tx;\n // Check the hash we expect is the same as the hash the server reported\n if (hash != null && tx.hash !== hash) {\n logger.throwError(\"Transaction hash mismatch from Provider.sendTransaction.\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });\n }\n result.wait = (confirms, timeout) => __awaiter(this, void 0, void 0, function* () {\n if (confirms == null) {\n confirms = 1;\n }\n if (timeout == null) {\n timeout = 0;\n }\n // Get the details to detect replacement\n let replacement = undefined;\n if (confirms !== 0 && startBlock != null) {\n replacement = {\n data: tx.data,\n from: tx.from,\n nonce: tx.nonce,\n to: tx.to,\n value: tx.value,\n startBlock\n };\n }\n const receipt = yield this._waitForTransaction(tx.hash, confirms, timeout, replacement);\n if (receipt == null && confirms === 0) {\n return null;\n }\n // No longer pending, allow the polling loop to garbage collect this\n this._emitted[\"t:\" + tx.hash] = receipt.blockNumber;\n if (receipt.status === 0) {\n logger.throwError(\"transaction failed\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.CALL_EXCEPTION, {\n transactionHash: tx.hash,\n transaction: tx,\n receipt: receipt\n });\n }\n return receipt;\n });\n return result;\n }", "title": "" }, { "docid": "7139806b5b3e88c8a3cd6b6cfffc845d", "score": "0.5193923", "text": "_wrapTransaction(tx, hash, startBlock) {\n if (hash != null && hexDataLength$1(hash) !== 32) {\n throw new Error(\"invalid response - sendTransaction\");\n }\n const result = tx;\n // Check the hash we expect is the same as the hash the server reported\n if (hash != null && tx.hash !== hash) {\n logger$2$1.throwError(\"Transaction hash mismatch from Provider.sendTransaction.\", Logger$2.errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });\n }\n result.wait = (confirms, timeout) => __awaiter$2$1(this, void 0, void 0, function* () {\n if (confirms == null) {\n confirms = 1;\n }\n if (timeout == null) {\n timeout = 0;\n }\n // Get the details to detect replacement\n let replacement = undefined;\n if (confirms !== 0 && startBlock != null) {\n replacement = {\n data: tx.data,\n from: tx.from,\n nonce: tx.nonce,\n to: tx.to,\n value: tx.value,\n startBlock\n };\n }\n const receipt = yield this._waitForTransaction(tx.hash, confirms, timeout, replacement);\n if (receipt == null && confirms === 0) {\n return null;\n }\n // No longer pending, allow the polling loop to garbage collect this\n this._emitted[\"t:\" + tx.hash] = receipt.blockNumber;\n if (receipt.status === 0) {\n logger$2$1.throwError(\"transaction failed\", Logger$2.errors.CALL_EXCEPTION, {\n transactionHash: tx.hash,\n transaction: tx,\n receipt: receipt\n });\n }\n return receipt;\n });\n return result;\n }", "title": "" }, { "docid": "27d146c036a3f413ad17b8bdf2a92f97", "score": "0.5165467", "text": "addTransaction(transaction) {\r\n // check if from and to address are not empty\r\n if (!transaction.fromAddress || !transaction.toAddress) {\r\n throw new Error('Transaction must include from and to address.');\r\n }\r\n\r\n // Validate the trasaction\r\n if (!transaction.isValid()) {\r\n throw new Error('Cannot add invalid transaction to chain.'); \r\n }\r\n\r\n this.pendingTransactions.push(transaction);\r\n }", "title": "" }, { "docid": "87e898c7555ec2c71d5d28762843f7b3", "score": "0.51608366", "text": "function testThrows_StateAcquiringScope() {\n asyncTestCase.waitForAsync('testThrows_StateAcquiringScope');\n var whenDone = tx.begin([e]);\n // 107: Invalid transaction state transition: {0} -> {1}.\n lf.testing.util.assertThrowsError(107, beginFn);\n lf.testing.util.assertThrowsError(107, attachFn);\n lf.testing.util.assertThrowsError(107, commitFn);\n lf.testing.util.assertThrowsError(107, rollbackFn);\n lf.testing.util.assertThrowsError(107, execFn);\n\n whenDone.then(function() {\n asyncTestCase.continueTesting();\n }, fail);\n}", "title": "" }, { "docid": "3a41dc236576c9ea6d5adcd18b0da24a", "score": "0.51534605", "text": "_wrapTransaction(tx, hash, startBlock) {\n if (hash != null && hexDataLength(hash) !== 32) {\n throw new Error(\"invalid response - sendTransaction\");\n }\n const result = tx;\n // Check the hash we expect is the same as the hash the server reported\n if (hash != null && tx.hash !== hash) {\n logger$3.throwError(\"Transaction hash mismatch from Provider.sendTransaction.\", Logger$1.errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });\n }\n result.wait = (confirms, timeout) => __awaiter$1(this, void 0, void 0, function* () {\n if (confirms == null) {\n confirms = 1;\n }\n if (timeout == null) {\n timeout = 0;\n }\n // Get the details to detect replacement\n let replacement = undefined;\n if (confirms !== 0 && startBlock != null) {\n replacement = {\n data: tx.data,\n from: tx.from,\n nonce: tx.nonce,\n to: tx.to,\n value: tx.value,\n startBlock\n };\n }\n const receipt = yield this._waitForTransaction(tx.hash, confirms, timeout, replacement);\n if (receipt == null && confirms === 0) {\n return null;\n }\n // No longer pending, allow the polling loop to garbage collect this\n this._emitted[\"t:\" + tx.hash] = receipt.blockNumber;\n if (receipt.status === 0) {\n logger$3.throwError(\"transaction failed\", Logger$1.errors.CALL_EXCEPTION, {\n transactionHash: tx.hash,\n transaction: tx,\n receipt: receipt\n });\n }\n return receipt;\n });\n return result;\n }", "title": "" }, { "docid": "65af8ec27dc96fd76bb0c05f55042e19", "score": "0.5145943", "text": "async start() {\n const privateProps = internal(this);\n const { tags } = privateProps;\n\n const client = new DynamoDbClient(privateProps);\n privateProps.client = client;\n\n privateProps.tableArn = await ensureTableExists(privateProps);\n if (tags) await confirmTableTags(privateProps);\n await initStreamState(this);\n }", "title": "" }, { "docid": "7574b042635f58d99a5b9e6d9afeb994", "score": "0.51437545", "text": "function testExecuteInTransaction(context, func) {\n return new Promise((resolve, reject) => {\n // start transaction\n context.db.executeInTransaction((cb) => {\n try {\n func().then(() => {\n const err = new Error('Cancel test transaction');\n err.code = 'ERR_CANCEL_TRANSACTION';\n return cb(err);\n }).catch( err => {\n return cb(err);\n });\n }\n catch (err) {\n return cb(err);\n }\n\n }, err => {\n // if error code is ERR_CANCEL_TRANSACTION\n if (err && err.code === 'ERR_CANCEL_TRANSACTION') {\n return resolve();\n }\n if (err) {\n return reject(err);\n }\n // exit\n return resolve();\n });\n });\n }", "title": "" }, { "docid": "cd4bbf2eeba276e5ed46c28572042bd7", "score": "0.51353645", "text": "createTransaction(transaction){\r\n\t\tthis.pendingTransactions.push(transaction); //Add a new transaction to the pending transactions chain\r\n\t}", "title": "" }, { "docid": "e495260b250856b715aa37372ed5a0a9", "score": "0.5128477", "text": "function routingInstrumentation(startTransaction, startTransactionOnPageLoad, startTransactionOnLocationChange) {\n if (startTransactionOnPageLoad === void 0) { startTransactionOnPageLoad = true; }\n if (startTransactionOnLocationChange === void 0) { startTransactionOnLocationChange = true; }\n instrumentationInitialized = true;\n stashedStartTransaction = startTransaction;\n stashedStartTransactionOnLocationChange = startTransactionOnLocationChange;\n if (startTransactionOnPageLoad) {\n startTransaction({\n name: window.location.pathname,\n op: 'pageload',\n });\n }\n}", "title": "" }, { "docid": "26a862ae9ecbc7780cedcd5f90bbd23b", "score": "0.5112149", "text": "enterCreateTemporaryTableStatement(ctx) {\n\t}", "title": "" }, { "docid": "2e7e6e0fd09993d2435eaa68805b63d6", "score": "0.5095241", "text": "function start() {\n db.transaction(fillDB, errorCB, successCB);\n}", "title": "" }, { "docid": "7eaf1aebac2fa10dc0fba42c12cd1887", "score": "0.5075997", "text": "function requireInTransaction(channel) {\n if (!channel.hasState('state', 'TRANSACTION')) {\n throw new Error('cannot use this command in TRANSACTION state');\n }\n}", "title": "" }, { "docid": "5ae3941d69e7a817aab7c905486bab15", "score": "0.50640917", "text": "function is_transaction_active(tx, store_name) {\n try {\n const request = tx.objectStore(store_name).get(0);\n request.onerror = (e) => {\n e.preventDefault();\n e.stopPropagation();\n };\n return true;\n } catch (ex) {\n assert_equals(\n ex.name,\n \"TransactionInactiveError\",\n \"Active check should either not throw anything, or throw \" +\n \"TransactionInactiveError\",\n );\n return false;\n }\n}", "title": "" }, { "docid": "5ae3941d69e7a817aab7c905486bab15", "score": "0.50640917", "text": "function is_transaction_active(tx, store_name) {\n try {\n const request = tx.objectStore(store_name).get(0);\n request.onerror = (e) => {\n e.preventDefault();\n e.stopPropagation();\n };\n return true;\n } catch (ex) {\n assert_equals(\n ex.name,\n \"TransactionInactiveError\",\n \"Active check should either not throw anything, or throw \" +\n \"TransactionInactiveError\",\n );\n return false;\n }\n}", "title": "" }, { "docid": "f094dfcaa60c014c3fe23a77f311a7ce", "score": "0.50502145", "text": "function hookTransaction( t1 ) {\n\n t1.on('timeout', function()\n {\n console.error('[transaction#timeout]');\n });\n\n t1.on('error', function(err)\n {\n console.error('[transaction#error] %s', err.message);\n });\n\n t1.on('response', function(response)\n {\n if (response.isException())\n {\n console.error('[transaction#response] %s', response);\n }\n else\n {\n console.log('[transaction#response] %s', response);\n }\n });\n\n t1.on('complete', function(err, response)\n {\n if (err)\n {\n console.error('[transaction#complete] %s', err.message);\n }\n else\n {\n \n console.log('[transaction#complete] %s', response);\n }\n });\n\n t1.on('cancel', function()\n {\n console.log('[transaction#cancel]');\n });\n}", "title": "" }, { "docid": "e24bfb29428e9da2f5e9f57acfc363d6", "score": "0.5031867", "text": "checkTransaction(transaction) {\n for (const key in transaction) {\n if (allowedTransactionKeys$1$1.indexOf(key) === -1) {\n logger$1$2.throwArgumentError(\"invalid transaction key: \" + key, \"transaction\", transaction);\n }\n }\n const tx = shallowCopy$1(transaction);\n if (tx.from == null) {\n tx.from = this.getAddress();\n }\n else {\n // Make sure any provided address matches this signer\n tx.from = Promise.all([\n Promise.resolve(tx.from),\n this.getAddress()\n ]).then((result) => {\n if (result[0].toLowerCase() !== result[1].toLowerCase()) {\n logger$1$2.throwArgumentError(\"from address mismatch\", \"transaction\", transaction);\n }\n return result[0];\n });\n }\n return tx;\n }", "title": "" }, { "docid": "ba5b4527a3dbcefec68d0906ed8ea58e", "score": "0.50283897", "text": "transactional(operation) {\n return begin()\n .then(operation)\n .then(result => commit().then(() => result))\n .catch(err => rollback().then(() => {\n throw err;\n }));\n }", "title": "" }, { "docid": "56e076b07574d5113655203a0d272de8", "score": "0.502509", "text": "function is_transaction_active(tx, store_name) {\n try {\n const request = tx.objectStore(store_name).get(0);\n request.onerror = e => {\n e.preventDefault();\n e.stopPropagation();\n };\n return true;\n } catch (ex) {\n assert_equals(ex.name, 'TransactionInactiveError',\n 'Active check should either not throw anything, or throw ' +\n 'TransactionInactiveError');\n return false;\n }\n }", "title": "" }, { "docid": "045c51dd6622cca9717a29adccfcd154", "score": "0.50145066", "text": "function repoStartTransaction(repo, path, transactionUpdate, onComplete, applyLocally) {\r\n repoLog(repo, 'transaction on ' + path);\r\n // Add a watch to make sure we get server updates.\r\n var valueCallback = function () { };\r\n var watchRef = new Reference(repo, path);\r\n watchRef.on('value', valueCallback);\r\n var unwatcher = function () {\r\n watchRef.off('value', valueCallback);\r\n };\r\n // Initialize transaction.\r\n var transaction = {\r\n path: path,\r\n update: transactionUpdate,\r\n onComplete: onComplete,\r\n // One of TransactionStatus enums.\r\n status: null,\r\n // Used when combining transactions at different locations to figure out\r\n // which one goes first.\r\n order: LUIDGenerator(),\r\n // Whether to raise local events for this transaction.\r\n applyLocally: applyLocally,\r\n // Count of how many times we've retried the transaction.\r\n retryCount: 0,\r\n // Function to call to clean up our .on() listener.\r\n unwatcher: unwatcher,\r\n // Stores why a transaction was aborted.\r\n abortReason: null,\r\n currentWriteId: null,\r\n currentInputSnapshot: null,\r\n currentOutputSnapshotRaw: null,\r\n currentOutputSnapshotResolved: null\r\n };\r\n // Run transaction initially.\r\n var currentState = repoGetLatestState(repo, path, undefined);\r\n transaction.currentInputSnapshot = currentState;\r\n var newVal = transaction.update(currentState.val());\r\n if (newVal === undefined) {\r\n // Abort transaction.\r\n transaction.unwatcher();\r\n transaction.currentOutputSnapshotRaw = null;\r\n transaction.currentOutputSnapshotResolved = null;\r\n if (transaction.onComplete) {\r\n // We just set the input snapshot, so this cast should be safe\r\n var snapshot = new DataSnapshot(transaction.currentInputSnapshot, new Reference(repo, transaction.path), PRIORITY_INDEX);\r\n transaction.onComplete(null, false, snapshot);\r\n }\r\n }\r\n else {\r\n validateFirebaseData('transaction failed: Data returned ', newVal, transaction.path);\r\n // Mark as run and add to our queue.\r\n transaction.status = 0 /* RUN */;\r\n var queueNode = repo.transactionQueueTree_.subTree(path);\r\n var nodeQueue = queueNode.getValue() || [];\r\n nodeQueue.push(transaction);\r\n queueNode.setValue(nodeQueue);\r\n // Update visibleData and raise events\r\n // Note: We intentionally raise events after updating all of our\r\n // transaction state, since the user could start new transactions from the\r\n // event callbacks.\r\n var priorityForNode = void 0;\r\n if (typeof newVal === 'object' &&\r\n newVal !== null &&\r\n contains(newVal, '.priority')) {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n priorityForNode = safeGet(newVal, '.priority');\r\n assert(isValidPriority(priorityForNode), 'Invalid priority returned by transaction. ' +\r\n 'Priority must be a valid string, finite number, server value, or null.');\r\n }\r\n else {\r\n var currentNode = repo.serverSyncTree_.calcCompleteEventCache(path) ||\r\n ChildrenNode.EMPTY_NODE;\r\n priorityForNode = currentNode.getPriority().val();\r\n }\r\n var serverValues = repoGenerateServerValues(repo);\r\n var newNodeUnresolved = nodeFromJSON$1(newVal, priorityForNode);\r\n var newNode = resolveDeferredValueSnapshot(newNodeUnresolved, currentState, serverValues);\r\n transaction.currentOutputSnapshotRaw = newNodeUnresolved;\r\n transaction.currentOutputSnapshotResolved = newNode;\r\n transaction.currentWriteId = repoGetNextWriteId(repo);\r\n var events = repo.serverSyncTree_.applyUserOverwrite(path, newNode, transaction.currentWriteId, transaction.applyLocally);\r\n eventQueueRaiseEventsForChangedPath(repo.eventQueue_, path, events);\r\n repoSendReadyTransactions(repo, repo.transactionQueueTree_);\r\n }\r\n }", "title": "" }, { "docid": "44ed0830f21649c16e1ed8f6f0c09366", "score": "0.5009569", "text": "checkTransaction(transaction) {\n for (const key in transaction) {\n if (allowedTransactionKeys$1.indexOf(key) === -1) {\n logger$b.throwArgumentError(\"invalid transaction key: \" + key, \"transaction\", transaction);\n }\n }\n const tx = shallowCopy(transaction);\n if (tx.from == null) {\n tx.from = this.getAddress();\n }\n else {\n // Make sure any provided address matches this signer\n tx.from = Promise.all([\n Promise.resolve(tx.from),\n this.getAddress()\n ]).then((result) => {\n if (result[0].toLowerCase() !== result[1].toLowerCase()) {\n logger$b.throwArgumentError(\"from address mismatch\", \"transaction\", transaction);\n }\n return result[0];\n });\n }\n return tx;\n }", "title": "" }, { "docid": "880722a849a26fec5ddf489de9e22f15", "score": "0.5008297", "text": "async transaction(processor) {\n return await this.useConnection(async (connection) => {\n try {\n await connection.execute(\"BEGIN\");\n const result = await processor(connection);\n await connection.execute(\"COMMIT\");\n return result;\n }\n catch (error) {\n logger_ts_4.log.info(`ROLLBACK: ${error.message}`);\n await connection.execute(\"ROLLBACK\");\n throw error;\n }\n });\n }", "title": "" }, { "docid": "6ea9cd1cbae7ce625350fd799f386f3a", "score": "0.50065327", "text": "checkTransaction(transaction) {\n for (const key in transaction) {\n if (allowedTransactionKeys$3.indexOf(key) === -1) {\n logger$w.throwArgumentError(\"invalid transaction key: \" + key, \"transaction\", transaction);\n }\n }\n const tx = shallowCopy$2(transaction);\n if (tx.from == null) {\n tx.from = this.getAddress();\n }\n else {\n // Make sure any provided address matches this signer\n tx.from = Promise.all([\n Promise.resolve(tx.from),\n this.getAddress()\n ]).then((result) => {\n if (result[0].toLowerCase() !== result[1].toLowerCase()) {\n logger$w.throwArgumentError(\"from address mismatch\", \"transaction\", transaction);\n }\n return result[0];\n });\n }\n return tx;\n }", "title": "" }, { "docid": "235e3028e4c6e54c54f028282a0f6bae", "score": "0.500469", "text": "async unknownTransaction(ctx){\n // GRADED FUNCTION\n throw new Error(\"Function name missing\")\n }", "title": "" }, { "docid": "9905ddc7171c44f32c350b194d64c3b5", "score": "0.5000014", "text": "getTransaction() {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.transaction) {\n const transaction = this.transaction;\n delete this.transaction;\n return transaction;\n }\n const transaction = this.session.transaction();\n yield transaction.begin();\n return transaction;\n });\n }", "title": "" }, { "docid": "c8c30dc07d3707b50a067c00c303bf58", "score": "0.4985512", "text": "addTransaction(transaction) {\n\n if (!transaction.fromaddress || !transaction.toaddress) {\n throw new Error('transaction must include from and to address');\n }\n if (!transaction.isValid()){\n throw new Error('cannot add invalid transaaction to chain');\n }\n if(transaction.amount<=0){\n throw new Error('cannot add invalid transaaction to chain');\n }\n if(this.getBalanceOfAddress(Transaction.fromaddress)<Transaction.amount){\n throw new Error('cannot add invalid transaaction to chain');\n }\n\n this.pendingTransactions.push(transaction);\n }", "title": "" }, { "docid": "c1a1e981b2d1dae5cdded2ff6ec056c5", "score": "0.495297", "text": "prepareForCommit() {}", "title": "" }, { "docid": "72466bb1a636f59ae7e5f3c9b81cdb69", "score": "0.49502626", "text": "start() {\n // NOTE: This is expected to fail sometimes (in the case of another tab\n // already having the persistence lock), so it's the first thing we should\n // do.\n return this.Eo().then((() => {\n if (!this.isPrimary && !this.allowTabSynchronization) \n // Fail `start()` if `synchronizeTabs` is disabled and we cannot\n // obtain the primary lease.\n throw new $(x$1.FAILED_PRECONDITION, Zi);\n return this.To(), this.Io(), this.mo(), this.runTransaction(\"getHighestListenSequenceNumber\", \"readonly\", (t => this.lo.Ki(t)));\n })).then((t => {\n this.no = new U$1(t, this.Zr);\n })).then((() => {\n this.so = !0;\n })).catch((t => (this.ho && this.ho.close(), Promise.reject(t))));\n }", "title": "" }, { "docid": "79dba1f184463e00464669afde084d74", "score": "0.49458945", "text": "createTransaction(transaction) {\n this.pendingTransactions.push(transaction);\n }", "title": "" }, { "docid": "79dba1f184463e00464669afde084d74", "score": "0.49458945", "text": "createTransaction(transaction) {\n this.pendingTransactions.push(transaction);\n }", "title": "" }, { "docid": "97591e0280e25f2c91acd2db5487780a", "score": "0.49343258", "text": "enterPragmaExceptionInit(ctx) {\n\t}", "title": "" }, { "docid": "a82b5340eb60e54b2f6fe96380a59d6d", "score": "0.4926358", "text": "async start () {\n return new Error('Classes that extend BaseDB must implement this method')\n }", "title": "" }, { "docid": "efb334b7c70d3cdffd582830d539496e", "score": "0.49041083", "text": "_setTransactionId() {\n if (this._operatorAccountId == null && this._transactionIds.isEmpty) {\n throw new Error(\n \"`transactionId` must be set or `client` must be provided with `freezeWith`\"\n );\n }\n }", "title": "" }, { "docid": "add89884e1e56d621554280204818ac6", "score": "0.48742855", "text": "function testThrows_StateExecutingQuery() {\n asyncTestCase.waitForAsync('testThrows_StateExecutingQuery');\n\n // 107: Invalid transaction state transition: {0} -> {1}.\n tx.begin([j, e]).then(function() {\n tx.attach(db.select().from(e));\n\n lf.testing.util.assertThrowsError(107, attachFn);\n lf.testing.util.assertThrowsError(107, beginFn);\n lf.testing.util.assertThrowsError(107, commitFn);\n lf.testing.util.assertThrowsError(107, rollbackFn);\n lf.testing.util.assertThrowsError(107, execFn);\n asyncTestCase.continueTesting();\n }, fail);\n}", "title": "" }, { "docid": "19db3dedb0c2b82a9709743f45af9369", "score": "0.4872313", "text": "async doStart() {\n throw new Error('Subclasses must override the doStart method.');\n }", "title": "" }, { "docid": "cd891fe57ca45122e15b827ebda58407", "score": "0.48682076", "text": "function defaultRoutingInstrumentation(startTransaction, startTransactionOnPageLoad, startTransactionOnLocationChange) {\n if (startTransactionOnPageLoad === void 0) { startTransactionOnPageLoad = true; }\n if (startTransactionOnLocationChange === void 0) { startTransactionOnLocationChange = true; }\n if (!global || !global.location) {\n utils_1.logger.warn('Could not initialize routing instrumentation due to invalid location');\n return;\n }\n var startingUrl = global.location.href;\n var activeTransaction;\n if (startTransactionOnPageLoad) {\n activeTransaction = startTransaction({ name: global.location.pathname, op: 'pageload' });\n }\n if (startTransactionOnLocationChange) {\n utils_1.addInstrumentationHandler({\n callback: function (_a) {\n var to = _a.to, from = _a.from;\n /**\n * This early return is there to account for some cases where a navigation transaction starts right after\n * long-running pageload. We make sure that if `from` is undefined and a valid `startingURL` exists, we don't\n * create an uneccessary navigation transaction.\n *\n * This was hard to duplicate, but this behavior stopped as soon as this fix was applied. This issue might also\n * only be caused in certain development environments where the usage of a hot module reloader is causing\n * errors.\n */\n if (from === undefined && startingUrl && startingUrl.indexOf(to) !== -1) {\n startingUrl = undefined;\n return;\n }\n if (from !== to) {\n startingUrl = undefined;\n if (activeTransaction) {\n utils_1.logger.log(\"[Tracing] Finishing current transaction with op: \" + activeTransaction.op);\n // If there's an open transaction on the scope, we need to finish it before creating an new one.\n activeTransaction.finish();\n }\n activeTransaction = startTransaction({ name: global.location.pathname, op: 'navigation' });\n }\n },\n type: 'history',\n });\n }\n}", "title": "" }, { "docid": "5a837cf0d77cf50addf2cc688b440e37", "score": "0.48532096", "text": "addTransaction(transaction) {\n\n // Add transaction to the pending transaction array\n this.pending.push(transaction);\n // Consider having to check its validity first?\n }", "title": "" }, { "docid": "3851a1be64277b3f572b0e926bb00ad6", "score": "0.48466378", "text": "enterCatchAtomicStatement(ctx) {\n\t}", "title": "" }, { "docid": "0ff28ce3807e56b486a10740b9f1cb42", "score": "0.4834584", "text": "static async rollbackTransaction(transaction) {\n return transaction.rollback();\n }", "title": "" }, { "docid": "17c4d92e9781ad2399eab089c701a434", "score": "0.4825741", "text": "async #withTransaction(action) {\n const { update, commit, rollback } = this.#createTransaction();\n try {\n await action(update);\n commit();\n }\n catch (error) {\n rollback();\n throw error;\n }\n }", "title": "" }, { "docid": "2a726cd789c90fd1246664a655d49e38", "score": "0.4819409", "text": "function test2(t) {\n var testid = 'test2', fl = new TC();\n //console.log(testid,'start =============================');\n \n fl.ex(\n (d) => {\n testobj.query(t,'BEGIN',fl.cber());\n },\n (d) => {\n t.error(d.error, 'no error after BEGIN');\n if (!d.error) testobj.query(t,'INSERT RETURN', fl.cber(\"key\"));\n },\n (d) => {\n t.error(d.error, 'no error after INSERT RETURN');\n if (!d.error && d.key) {\n testobj.query(t,'INSERT ' + d.key, fl.cber());\n testobj.query(t,'INSERT ' + d.key, fl.cber());\n testobj.query(t,'INSERT ' + d.key, fl.cber());\n }\n },\n (d) => {\n t.error(d.error, 'no error after INSERTs');\n if (d.error) testobj.query(t,'ROLLBACK', fl.cber());\n else testobj.query(t,'COMMIT', fl.cber());\n \n },\n (d) => {\n t.error(d.error,'no error after COMMIT');\n t.end();\n }\n );\n fl.run();\n }", "title": "" }, { "docid": "3ad192d0ed83224dbca595684fa8d341", "score": "0.48048073", "text": "signTransaction(transaction){\n return null;\n }", "title": "" }, { "docid": "c7d9e6ebfd858e427ca69d8046aec70b", "score": "0.47973037", "text": "async startStreaming() {\n if (this.finalizeStream) return\n if (!this.records.length) {\n await this.loadNextPage()\n }\n\n this.stopStreaming()\n this.finalizeStream = streamAccountTransactions({\n network: this.network,\n address: this.address,\n includeFailed: true,\n cursor: this.records[0]?.paging_token,\n onNewTx: tx => this.addNewTx(tx)\n })\n }", "title": "" }, { "docid": "9632523d6a0a09bf8acecd7e61aa92d9", "score": "0.4780616", "text": "function runTransaction(firestore, updateFunction, options) {\r\n\t firestore = cast(firestore, Firestore);\r\n\t const datastore = getDatastore(firestore);\r\n\t const optionsWithDefaults = Object.assign(Object.assign({}, DEFAULT_TRANSACTION_OPTIONS), options);\r\n\t validateTransactionOptions(optionsWithDefaults);\r\n\t const deferred = new Deferred();\r\n\t new TransactionRunner(newAsyncQueue(), datastore, optionsWithDefaults, internalTransaction => updateFunction(new Transaction(firestore, internalTransaction)), deferred).run();\r\n\t return deferred.promise;\r\n\t}", "title": "" }, { "docid": "c1aece821da4e14dffbcd6c72d5e7705", "score": "0.47655648", "text": "function createTransaction(db) {\n let transaction,\n transactionScope = [objectStoreName];\n\n transaction = db.transaction(transactionScope, 'readwrite');\n\n transaction.oncomplete = (event) => console.info('Completed transaction');\n transaction.onerror = (err) => console.error(err);\n\n return transaction;\n }", "title": "" }, { "docid": "d9556dfd04ec81b1c3e774d9e8781b4b", "score": "0.47557384", "text": "enterDialectCreateTemporaryTableStatement(ctx) {\n\t}", "title": "" }, { "docid": "476cd3613902f90efe3568ccafb22760", "score": "0.47443956", "text": "checkTransaction(transaction) {\n for (const key in transaction) {\n if (allowedTransactionKeys.indexOf(key) === -1) {\n logger.throwArgumentError(\"invalid transaction key: \" + key, \"transaction\", transaction);\n }\n }\n const tx = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.shallowCopy)(transaction);\n if (tx.from == null) {\n tx.from = this.getAddress();\n }\n else {\n // Make sure any provided address matches this signer\n tx.from = Promise.all([\n Promise.resolve(tx.from),\n this.getAddress()\n ]).then((result) => {\n if (result[0].toLowerCase() !== result[1].toLowerCase()) {\n logger.throwArgumentError(\"from address mismatch\", \"transaction\", transaction);\n }\n return result[0];\n });\n }\n return tx;\n }", "title": "" }, { "docid": "ad08de0073fab1130c358d8f05377ce2", "score": "0.47326693", "text": "_requireFrozen() {\n if (!this._isFrozen()) {\n throw new Error(\n \"transaction must have been frozen before calculating the hash will be stable, try calling `freeze`\"\n );\n }\n }", "title": "" }, { "docid": "9ae8a5bc7bac2b832982d674d8dcbfbe", "score": "0.4727943", "text": "addTransaction(transaction) {\n // ARE THERE OLD UNDONE TRANSACTIONS ON THE STACK THAT FIRST\n // NEED TO BE CLEARED OUT, i.e. ARE WE BRANCHING?\n if ((this.mostRecentTransaction < 0)|| (this.mostRecentTransaction < (this.transactions.length-1))) {\n for (let i = this.transactions.length-1; i > this.mostRecentTransaction; i--) {\n this.transactions.splice(i, 1);\n }\n }\n\n // AND NOW ADD THE TRANSACTION\n this.transactions.push(transaction);\n // AND EXECUTE IT\n // this.doTransaction(); \n }", "title": "" }, { "docid": "705caa6026fe90b4d90765a294b7adbd", "score": "0.47217587", "text": "async commitTransaction() {\n\t \n // this.yadamuLogger.trace([`${this.constructor.name}.commitTransaction()`,this.getWorkerNumber()],``)\n\n\tsuper.commitTransaction()\n await this.executeSQL(this.StatementLibrary.SQL_COMMIT_TRANSACTION);\n\t\n }", "title": "" }, { "docid": "5a8831278d171a4bf5b30557b084ee82", "score": "0.47196898", "text": "async start(params) {\n return await new Promise((resolve, reject) => {\n this.dbg.sendCommand('Tracing.start', params || {}, (error, result) => {\n this.assertError(error, 'Tracing.start');\n resolve();\n });\n });\n }", "title": "" }, { "docid": "bf802c23e6be0a70fd8ef3aa422379f2", "score": "0.4709157", "text": "function transaction(action, thisArg) {\n if (thisArg === void 0) { thisArg = undefined; }\n startBatch();\n try {\n return action.apply(thisArg);\n }\n finally {\n endBatch();\n }\n}", "title": "" }, { "docid": "bf802c23e6be0a70fd8ef3aa422379f2", "score": "0.4709157", "text": "function transaction(action, thisArg) {\n if (thisArg === void 0) { thisArg = undefined; }\n startBatch();\n try {\n return action.apply(thisArg);\n }\n finally {\n endBatch();\n }\n}", "title": "" }, { "docid": "bf802c23e6be0a70fd8ef3aa422379f2", "score": "0.4709157", "text": "function transaction(action, thisArg) {\n if (thisArg === void 0) { thisArg = undefined; }\n startBatch();\n try {\n return action.apply(thisArg);\n }\n finally {\n endBatch();\n }\n}", "title": "" }, { "docid": "bf802c23e6be0a70fd8ef3aa422379f2", "score": "0.4709157", "text": "function transaction(action, thisArg) {\n if (thisArg === void 0) { thisArg = undefined; }\n startBatch();\n try {\n return action.apply(thisArg);\n }\n finally {\n endBatch();\n }\n}", "title": "" }, { "docid": "bf802c23e6be0a70fd8ef3aa422379f2", "score": "0.4709157", "text": "function transaction(action, thisArg) {\n if (thisArg === void 0) { thisArg = undefined; }\n startBatch();\n try {\n return action.apply(thisArg);\n }\n finally {\n endBatch();\n }\n}", "title": "" }, { "docid": "bf802c23e6be0a70fd8ef3aa422379f2", "score": "0.4709157", "text": "function transaction(action, thisArg) {\n if (thisArg === void 0) { thisArg = undefined; }\n startBatch();\n try {\n return action.apply(thisArg);\n }\n finally {\n endBatch();\n }\n}", "title": "" }, { "docid": "bf802c23e6be0a70fd8ef3aa422379f2", "score": "0.4709157", "text": "function transaction(action, thisArg) {\n if (thisArg === void 0) { thisArg = undefined; }\n startBatch();\n try {\n return action.apply(thisArg);\n }\n finally {\n endBatch();\n }\n}", "title": "" }, { "docid": "bf802c23e6be0a70fd8ef3aa422379f2", "score": "0.4709157", "text": "function transaction(action, thisArg) {\n if (thisArg === void 0) { thisArg = undefined; }\n startBatch();\n try {\n return action.apply(thisArg);\n }\n finally {\n endBatch();\n }\n}", "title": "" }, { "docid": "bf802c23e6be0a70fd8ef3aa422379f2", "score": "0.4709157", "text": "function transaction(action, thisArg) {\n if (thisArg === void 0) { thisArg = undefined; }\n startBatch();\n try {\n return action.apply(thisArg);\n }\n finally {\n endBatch();\n }\n}", "title": "" }, { "docid": "bf802c23e6be0a70fd8ef3aa422379f2", "score": "0.4709157", "text": "function transaction(action, thisArg) {\n if (thisArg === void 0) { thisArg = undefined; }\n startBatch();\n try {\n return action.apply(thisArg);\n }\n finally {\n endBatch();\n }\n}", "title": "" }, { "docid": "bf802c23e6be0a70fd8ef3aa422379f2", "score": "0.4709157", "text": "function transaction(action, thisArg) {\n if (thisArg === void 0) { thisArg = undefined; }\n startBatch();\n try {\n return action.apply(thisArg);\n }\n finally {\n endBatch();\n }\n}", "title": "" }, { "docid": "ac4d405a407a1fc833e00d30d0611b3c", "score": "0.4707033", "text": "async rollbackTransaction(cause) {\n\n // this.yadamuLogger.trace([`${this.constructor.name}.rollbackTransaction()`,this.getWorkerNumber(),YadamuError.lostConnection(cause)],``)\n\n this.checkConnectionState(cause)\n\n\t// If rollbackTransaction was invoked due to encounterng an error and the rollback operation results in a second exception being raised, log the exception raised by the rollback operation and throw the original error.\n\t// Note the underlying error is not thrown unless the rollback itself fails. This makes sure that the underlying error is not swallowed if the rollback operation fails.\n\n\ttry {\n super.rollbackTransaction()\n await this.executeSQL(this.StatementLibrary.SQL_ROLLBACK_TRANSACTION);\n\t} catch (newIssue) {\n\t this.checkCause('ROLBACK TRANSACTION',cause,newIssue);\t\t\t\t\t\t\t\t \n\t}\n }", "title": "" }, { "docid": "b0dad57aa0ad03e538d17b2b77e7a6b8", "score": "0.47015974", "text": "enterSqlCallStatement(ctx) {\n\t}", "title": "" }, { "docid": "b801e857a3b2a0f6265e5e0762aa8949", "score": "0.46889564", "text": "function transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}", "title": "" }, { "docid": "cbe4699343b2bafa270afe4da484f24d", "score": "0.4682133", "text": "function testThrowSynchronouslyCallback(next) {\n console.log(\"testing throwing synchronously through callbacks\")\n var factory = new asyncBuilder.BuilderFactory()\n factory.add(\"currentUser\", withCallback(getCurrentUser), [\"req\", '_requiredFields'])\n factory.add(\"millisNow\", withCallback(getMillisNow))\n factory.add(\"secondsNow\", withCallback(getSecondsNow), [\"millisNow\"])\n factory.add(\"delimiter\", createDelimiter(factory), ['d1', 'd2', 'd3'])\n factory.add(\"userSalt\", throwSynchronously(createUserSalt), [\"currentUser.username\", \"delimiter\", \"secondsNow\"])\n .add('username', function (username){return username}, ['req.currentUser.username'])\n testFactory(factory, [new Error(\"I'm done here\")], next)\n}", "title": "" }, { "docid": "6141ea4a9fb2f5c15d5795362857e3ab", "score": "0.46737304", "text": "function killTransaction(transaction, error)\n{\n return true; // fatal transaction error\n}", "title": "" }, { "docid": "3fda91967026694557485c1114bcd398", "score": "0.4668748", "text": "call(transaction, blockTag) {\n return __awaiter$5(this, void 0, void 0, function* () {\n this._checkProvider(\"call\");\n const tx = yield resolveProperties(this.checkTransaction(transaction));\n return yield this.provider.call(tx, blockTag);\n });\n }", "title": "" } ]
9b52362b7bc8afb3e671d124a774bc1e
Tell the higher classes that this squad is ready for battle
[ { "docid": "38342a59331e3c19a48806527da3a060", "score": "0.69823724", "text": "tellImReadyForTheAttack(){\n this._eventEmmiter.emit(SQUAD_RECHARGED, {rechargedSquad: this});\n }", "title": "" } ]
[ { "docid": "2ed5c9f2765d78e9c18353c513877a72", "score": "0.7400303", "text": "unitReady() {\n\t\tif (this.ready === 0) {\n\t\t\tconsole.log(`[RECHARGE] Squad ${this.squadIndex} from army '${this.army}' is recharging`);\n\t\t}\n\t\t// Count ready units and compare to active units\n\t\tthis.ready++;\n\t\tif (this.ready >= this.getActiveUnits().length) {\n\t\t\tthis.ready = 0;\n\t\t\tconsole.log(`[RECHARGE] Squad ${this.squadIndex} from army '${this.army}' is ready`);\n\t\t\tthis.emit('attack', this);\n\t\t}\n\t\t// TODO@dvs:! You can not guarantee which unit called the method. Not sure if 2 timeouts of a single unit called the squads.unitReady\n\t\t// Not possible as units are only recharging after the attack, therefore a single unit can't do this twice.\n\t}", "title": "" }, { "docid": "1e141b8ff2285ea746307dc559b85eda", "score": "0.6271903", "text": "function SetBattleReady(sys, data) {\n if(sys.scene.scene.isSleeping(\"Battle\")) {\n // Allow a few seconds to move freely without getting into another battle, more time if having run away\n if(!data) { // Should be first time only\n Network.Emit(\"NextBattleReady\");\n return;\n }\n\n var time = data.battleWon ? Consts.BATTLE_WON_NEXT_COOLDOWN : Consts.BATTLE_RAN_NEXT_COOLDOWN;\n setTimeout(() => {\n console.log(\"Reactivating Battle readiness. (Battle scene is asleep)\");\n Network.Emit(\"NextBattleReady\");\n }, time * 1000);\n }\n else {\n // Getting sys.scene.scene.isSleeping(\"Battle\") to be true here seems to be unreliable, so check in continuously to ensure that the battle scene is truly good to go.\n setTimeout(function () {\n SetBattleReady(sys, data);\n }, 500);\n }\n }", "title": "" }, { "docid": "8f97643073b5a918965bf62052c51523", "score": "0.60788083", "text": "function readyUp() {\n enemiesService.setCurrentEnemies(vm.enemies);\n fightQueueService.buildQueue();\n alliesService.restoreAll();\n enemiesService.restoreAll();\n progressTracker.setBattleWon(false);\n progressTracker.startFight();\n fightLogService.clearLog();\n movesService.getActiveAllies();\n movesService.setSelectedMove(null);\n stateChangeService.setPlayerState('fight');\n\n // Sets up the board for the fight.\n var board = null;\n if (vm.fightType === 'story') {\n var storyProgress = progressTracker.getStoryProgress();\n var allyPositions = boardManager.initialAllyPositions[storyProgress];\n var enemyPositions = boardManager.initialEnemyPositions[storyProgress];\n board = boardManager.getBoardNumber(storyProgress);\n board.layout = boardCreator.buildBoardLayout(board);\n boardManager.placeCharacterSet(board.layout, allyPositions, alliesService.getActiveAllies());\n boardManager.placeCharacterSet(board.layout, enemyPositions, vm.enemies);\n } else if (vm.fightType === 'arena') {\n board = boardCreator.createRandomBoard(alliesService.getActiveAllies(), vm.enemies);\n }\n\n boardManager.setCurrentBoard(board);\n boardManager.clearMoveAndTarget();\n }", "title": "" }, { "docid": "15279e6ddb1ff56460d10702e4cac71f", "score": "0.60095245", "text": "function checkIfComplete() {\r\n if(isComplete == false) { //here no car has won yet\r\n isComplete = true; //a car won either car1 or car2\r\n }\r\n else {\r\n place = 'second';\r\n }\r\n }", "title": "" }, { "docid": "9c470faa46ac569ec41b918d031516f7", "score": "0.59784377", "text": "function wakeUpInYourBed(){\n\tstory(\"\");\n\tchoices = [\"Go back to bed\",\"Your mom drags you out of bed\",\"Run into the nearest forest\"];\n\tanswer = setOptions(choices);\n}", "title": "" }, { "docid": "271d685083f8cccdf0039aabba119e66", "score": "0.5923411", "text": "function clickSquad() { \n if (theSystemIsHacked === true && student.house === \"Slytherin\" && student.bloodStatus === \"Pure-blood\" ) {\n student.squad = true;\n limitedSquad();\n } else if (student.house === \"Slytherin\" && student.bloodStatus === \"Pure-blood\"){\n student.squad = !student.squad;\n } else {\n canNotBeSquad();\n }\n buildList();\n }", "title": "" }, { "docid": "f95a401fc448db28eb6f2860f1b13dd7", "score": "0.58779156", "text": "function acceptSponsorQuest() {\n\tquestSetupCards = [];\n\tallQuestInfo = [];\n\tdocument.getElementById('sponsorQuest').style.display = 'none';\n\tvar serverMsg = document.getElementById('serverMsg');\n\tserverMsg.value += \"\\n> you are sponsor, setting up quest...\";\n\tsponsor = PlayerName;\n\tvar data = JSON.stringify({\n\t\t'name' : PlayerName,\n\t\t'sponsor_quest' : true\n\t});\n\tsocketConn.send(data);\n}", "title": "" }, { "docid": "8ac439831d5305a34cfe8d7040306912", "score": "0.58732283", "text": "function SarahPlayerPunishGirls() {\n\tif (SarahShackled()) SarahUnlock();\n\tif (Amanda != null) Amanda.Stage = \"1000\";\n\tif (Sarah != null) Sarah.Stage = \"1000\";\n}", "title": "" }, { "docid": "dd8e705ed1e340af12172b290592034b", "score": "0.58650935", "text": "function C012_AfterClass_Jennifer_ReleaseBeforePunish() {\n\tActorSetPose(\"ReadyToPunish\");\n\tif (Common_PlayerRestrained || Common_PlayerGagged) {\n\t\tif (Common_PlayerNaked) {\n\t\t\tC012_AfterClass_Jennifer_CurrentStage = 3903;\t\t\n\t\t\tOverridenIntroText = GetText(\"ReleaseBeforePunishAlreadyNaked\");\n\t\t}\n\t\telse OverridenIntroText = GetText(\"ReleaseBeforePunishNotNaked\");\n\t\tPlayerReleaseBondage();\n\t\tCurrentTime = CurrentTime + 50000;\n\t} else {\n\t\tif (Common_PlayerNaked) {\n\t\t\tC012_AfterClass_Jennifer_CurrentStage = 3903;\t\t\n\t\t\tOverridenIntroText = GetText(\"PunishSinceNaked\");\n\t\t}\t\t\n\t}\n}", "title": "" }, { "docid": "8ea24bb1efd02aeeb822c0f13556bf5f", "score": "0.58386827", "text": "checkBottleAvailable() {\n if (this.bottleBar.percentage == 0) {\n this.endBoss.bottleAvailable = false;\n } else {\n this.endBoss.bottleAvailable = true;\n }\n }", "title": "" }, { "docid": "4c5a449800547139921560b3b4bc96e3", "score": "0.58373415", "text": "function toggleReady()\n{\n\tif(GameState.status!=0)\n\t{\n\t\talert(\"Game Already Start!\");\n\t\treturn;\n\t}\n\t\n\tvar _data = {ready:true};\n\tif(me.ready)\n\t{\n\t\t_data.ready=false;\n\t\tme.ready = false;\n\t}\n\telse\n\t{\n\t\tme.ready = true;\n\t}\n\t\t\n\t$.ajax({ \n\t\ttype:\"put\",\n\t\tdataType:\"json\",\n\t\tdata:_data,\n\t\turl:\"/apiv1/rooms/current\"\n\t});\n}", "title": "" }, { "docid": "cc9e15333eb8afcb1249bd2a12d676b5", "score": "0.58229375", "text": "function C012_AfterClass_Amanda_ReleaseBeforePunish() {\n\tActorSetPose(\"ReadyToPunish\");\n\tif (Common_PlayerRestrained || Common_PlayerGagged) {\n\t\tif (Common_PlayerNaked) {\n\t\t\tC012_AfterClass_Amanda_CurrentStage = 3903;\t\t\n\t\t\tOverridenIntroText = GetText(\"ReleaseBeforePunishAlreadyNaked\");\n\t\t}\n\t\telse OverridenIntroText = GetText(\"ReleaseBeforePunishNotNaked\");\n\t\tPlayerReleaseBondage();\n\t\tCurrentTime = CurrentTime + 50000;\n\t} else {\n\t\tif (Common_PlayerNaked) {\n\t\t\tC012_AfterClass_Amanda_CurrentStage = 3903;\t\t\n\t\t\tOverridenIntroText = GetText(\"PunishSinceNaked\");\n\t\t}\t\t\n\t}\n}", "title": "" }, { "docid": "016aba3266973e9f6b0ab9e537b6c55f", "score": "0.57929677", "text": "attack(squad) {\n\t\tlet squadToAttack;\n\n\t\t// Pick a strategy\n\t\tswitch (this.strategy) {\n\t\tcase 'weakest':\n\t\t\tsquadToAttack = this.simulator.getWeakestSquad(this);\n\t\t\tbreak;\n\t\tcase 'strongest':\n\t\t\tsquadToAttack = this.simulator.getStrongestSquad(this);\n\t\t\tbreak;\n\t\tcase 'random':\n\t\t\tsquadToAttack = this.simulator.getRandomSquad(this);\n\t\t\tbreak;\n\t\t// default:\n\t\t}\n\t\t// TODO@dvs: Why not create a Strategy class and avoid switches and such? Or at least encapsulate in a getStrategy method?\n\n\t\t// Get attacker and defender attack probabilities\n\t\tconst attackerProbability = squad.getAttackProbability();\n\t\tconst defenderProbability = squadToAttack.getAttackProbability();\n\n\t\tconsole.log(`[ATTACK] Squad ${squad.squadIndex} from army '${this.name}' attacking squad ${squadToAttack.squadIndex} from army '${squadToAttack.army}' with strategy ${this.strategy}`);\n\t\tconsole.log(` Probability: ${attackerProbability} > ${defenderProbability}`);\n\n\t\tif (attackerProbability > defenderProbability) {\n\t\t\tconsole.log('[ATTACK] Attack successful');\n\t\t\tsquadToAttack.receiveDamage(squad.getDamage());\n\t\t\tsquad.levelUp();\n\t\t} else {\n\t\t\tconsole.log('[ATTACK] Attack failed');\n\t\t}\n\n\t\tconst activeArmies = this.simulator.getActiveArmies();\n\t\tif (activeArmies.length === 1) {\n\t\t\t// Army won\n\t\t\tconsole.log(`[END] Army '${activeArmies[0].name}' won the battle!`);\n\t\t\tprocess.exit(0);\n\t\t\t// TODO@dvs:! Wow. process.exit? A bit harsh on the developer that is supposed to use this class?\n\t\t\t// Task documentation never mentioned that this was supposed to be a library. \n\t\t\t// Real world applications exit with 0 if they successfully complete the task\n\t\t} else {\n\t\t\t// Army did not won yet, recharge all units\n\t\t\tsquad.getActiveUnits().forEach(unit => {\n\t\t\t\tunit.rechargeUnit();\n\t\t\t});\n\t\t}\n\t}", "title": "" }, { "docid": "d4c3476b751da1ff39c8e6088161f548", "score": "0.57598203", "text": "defense() {\n this.isDefending = true;\n }", "title": "" }, { "docid": "d069e0f5637981929c2a854b47e692f2", "score": "0.57177794", "text": "function BotReady(){\n\t\t//Debug.Log(\"Ready!\");\n\t\tvar readyToGo = true;\n\t\tvar bot : BotType;\n\t\tfor( bot in WorldManager.botsList )\n\t\t\tif( bot.obj.GetComponent(Bot).IsAnimating() && !bot.obj.GetComponent(Bot).HasError() ){\n\t\t\t\treadyToGo = false;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\tif( readyToGo )\n\t\t\tfor( bot in WorldManager.botsList ){\n\t\t\t\t//if ANY bot is past their last index, slow down\n\t\t\t\tif(!bot.obj.GetComponent(Bot).FastMode())\n\t\t\t\t{\n\t\t\t\t\tanimSpeed = 2.5;\n\t\t\t\t\tfinalAnimSpeed = 2.5;\n\t\t\t\t}\n\t\t\t\tbot.obj.GetComponent(Bot).RunCommand();\n\t\t\t}\n\t\n\t}", "title": "" }, { "docid": "eb6b4ce88e44936b3b0f3d96e38557a5", "score": "0.5711899", "text": "ready(){\n this.crew.forEach(function(member) { \n if((member.job == \"Pilot\" && member.vehicle.type == \"Plane\") ||\n (member.job == \"Captain\" && member.vehicle.type == \"Boat\"))\n {\n console.log(`The ${member.vehicle.type} is ready to depart!`)\n } else {\n return false\n }\n })\n }", "title": "" }, { "docid": "3da4fb414478665477d92f9c92a27522", "score": "0.56709987", "text": "async _handleGameStart() {\n\t\tawait Promise.all( [\n\t\t\tthis.player.waitForReady(),\n\t\t\tthis.opponent.waitForReady()\n\t\t] );\n\n\t\tthis.status = 'battle';\n\t\tthis.activePlayerId = this.player.id;\n\t\tthis._socketServer.sendToRoom( this.id, 'battleStarted', { activePlayerId: this.activePlayerId } );\n\t}", "title": "" }, { "docid": "ab2928275c274f65a303960c5d054dee", "score": "0.5670949", "text": "function checkReady() {\n this.ready = true;\n playGame();\n}", "title": "" }, { "docid": "6dde4d1b852623949e56834af0f34bb0", "score": "0.5647822", "text": "onWake() {\r\n //console.log(\"in Tortuga onWake\");\r\n\r\n // update life and resource displays.\r\n //this.sys.PirateFunctions.updateHearts();\r\n //this.sys.PirateFunctions.updateTortugaDisplay();\r\n\r\n //console.log('attempting to resume audio in tortuga.');\r\n // set Tortuga ambiance\r\n this.OceanAudio.resume();\r\n this.MarketAudio.resume();\r\n\r\n\r\n\r\n // #########################################\r\n //####### FOR TESTING #######################\r\n //################################################\r\n //if (playerShip.shipType === \"Canoe\") {\r\n\r\n // playerShip = new BoatConstructor(50, 60, 75, 0, 0, 0, 0);\r\n // playerShip.gold = 600;\r\n // playerShip.iron = 10;\r\n // playerShip.wool = 10;\r\n // playerShip.wood = 0;\r\n // playerShip.food = 0;\r\n\r\n // Gold = 620;\r\n //}\r\n\r\n //console.log(\"in Tortuga Wake. Ship Type: \" + playerShip.shipType);\r\n // #################### End for testing ####################\r\n\r\n this.sys.PirateFunctions.updateTortugaDisplay();\r\n\r\n }", "title": "" }, { "docid": "2cee8c4488aaac280c5db6848b0f7f6d", "score": "0.56224644", "text": "function SarahFightSophieEnd() {\n\tSkillProgress(\"Willpower\", ((Player.KidnapMaxWillpower - Player.KidnapWillpower) + (Sophie.KidnapMaxWillpower - Sophie.KidnapWillpower)) * 2);\n\tSophie.Name = \"Mistress Sophie\";\n\tSophieFightDone = true;\n\tSophieUpsetCount = -100;\n\tSophie.AllowItem = KidnapVictory;\n\tSophie.Stage = (KidnapVictory) ? \"60\" : \"70\";\n\tif (!KidnapVictory && Player.IsNaked()) Sophie.Stage = \"50\";\n\tif (!KidnapVictory) CharacterRelease(Sophie);\n\telse CharacterRelease(Player);\n\tif (KidnapVictory) LogAdd(\"KidnapSophie\", \"Sarah\");\n\tInventoryRemove(Sophie, \"ItemHead\");\n\tInventoryRemove(Sophie, \"ItemMouth\");\n\tInventoryRemove(Player, \"ItemHead\");\n\tInventoryRemove(Player, \"ItemMouth\");\n\tCommonSetScreen(\"Room\", \"Sarah\");\n\tCharacterSetCurrent(Sophie);\n\tSophie.CurrentDialog = DialogFind(Sophie, (KidnapVictory) ? \"FightVictory\" : \"FightDefeat\");\n}", "title": "" }, { "docid": "87cbd042b45dab25c4da3e288bd4c842", "score": "0.5619219", "text": "function doneWeaponsQuestSponsor() {\n\tconsole.log(totalStages);\n\tif(totalStages == 0) {\n\t\t$('body').off('click');\n\t\tdocument.getElementById('doneQuest').style.display = \"inline\";\n\t\tdoneQuestSetup();\n\t\treturn;\n\t}\n\t$('body').off('click');\n\tsetupQuestRound();\n\tdocument.getElementById('doneQuest').style.display = \"none\";\n}", "title": "" }, { "docid": "e6d4ba222e5b82870bddbb1ee47821f3", "score": "0.56168896", "text": "function pacGotBusted() {\n clearCharactersFromBoard();\n clearIntervals();\n initPacman();\n initGhosts();\n stopGameMusic();\n\n playSound(caught_sound);\n\n removeLife();\n if (lives === 0){\n endGame(loseFunc);\n }\n else{\n draw();\n playGameMusic();\n // TODO: possible to add 'ready?' animation here\n setTimeout(setGameIntervals, 2200);\n }\n}", "title": "" }, { "docid": "48a911d0bc850c8ea37b393d815ffb2c", "score": "0.56128323", "text": "function gameWon() {\n\n // Inform other code modules that the game has been won\n Frogger.observer.publish(\"game-won\");\n }", "title": "" }, { "docid": "28e6dd613e926f5ba2a834a0bd0d4cdb", "score": "0.5601215", "text": "function checkReady(){\n this.ready=true;\n ghostImage.ready = true;\n powerUpImage.ready = true;\n playGame();\n }", "title": "" }, { "docid": "6eedb295fd67fe1c870d1b1f36665266", "score": "0.55977947", "text": "function ready() {\n if(player1 && player2) {\n $('#choose').css('opacity', 0.0);\n $('#ready').animate({opacity: 1.0}, 700);\n $('#ready').animate({opacity: 0.0}, 700);\n $('#ready').animate({opacity: 1.0}, 700);\n $('#ready').animate({opacity: 0.0}, 700);\n $('#ready').animate({opacity: 1.0}, 700);\n $('#ready').animate({opacity: 0.0}, 700);\n $('#ready').animate({opacity: 1.0}, 700);\n $('#ready').animate({opacity: 0.0}, 700);\n $('#ready').animate({opacity: 1.0}, 700);\n $('#ready').animate({opacity: 0.0}, 700);\n $('#ready').animate({opacity: 1.0}, 700);\n $('#ready').animate({opacity: 0.0}, 700);\n $('#ready').animate({opacity: 1.0}, 700);\n };\n}", "title": "" }, { "docid": "91366961783fc08bc4a67e443c729357", "score": "0.55969435", "text": "function C007_LunchBreak_Natalie_SubbieMasturbate() {\r\n CurrentTime = CurrentTime + 120000;\r\n C007_LunchBreak_Natalie_MasturbateCount++;\r\n if (C007_LunchBreak_Natalie_MasturbateCount >= 4) {\r\n OveridenIntroText = GetText(\"SubbieMasturbate\");\r\n ActorAddOrgasm();\r\n ActorChangeAttitude(1, 0);\r\n PlayerUnlockInventory(\"Ballgag\");\r\n PlayerUnlockInventory(\"Blindfold\");\r\n PlayerUnlockInventory(\"Rope\");\r\n CurrentTime = CurrentTime + 120000;\r\n C007_LunchBreak_Natalie_CurrentStage = 590;\r\n }\r\n}", "title": "" }, { "docid": "bd1cf492fa935f6c5449e52bb4be73db", "score": "0.5593805", "text": "function handleReadyButton(event) {\r\n //If the game is already past set up, the ready button does nothing\r\n if (state.phase !== 'setup') {\r\n return;\r\n }\r\n let unplacedShips = 0;\r\n for (let ship in playerShipState) {\r\n unplacedShips += playerShipState[ship].counter\r\n }\r\n if (unplacedShips !== 0) {\r\n return;\r\n } else {\r\n state.phase = 'pending';\r\n setUpEnemyBoard();\r\n state.phase = 'playing';\r\n event.target.textContent = 'PLAYING!';\r\n sinkMessageEl.textContent = ``;\r\n sinkMessageEl.style.backgroundColor = 'transparent';\r\n render();\r\n }\r\n}", "title": "" }, { "docid": "cd7729278d7f3bee4fffce7a4b48788f", "score": "0.5593061", "text": "function fighterDefeat(){\n $(\".chosenFighter\").parent().fadeTo(\"slow\", 0.1);\n minas.play();\n \n battle = false; \n\n \n}", "title": "" }, { "docid": "e3aa6756c4a2d57d6ff4e655a0da10cf", "score": "0.55903375", "text": "setReady(){\n this.ready = true;\n this.showGame = true;\n this.playerDB.update(this.props());\n }", "title": "" }, { "docid": "1ae1c785cb7932b2c7c2026be357f073", "score": "0.5571137", "text": "function buyBuildings() {\n if(game.global.world!=1 && ((game.jobs.Miner.locked && game.global.challengeActive != 'Metal') || (game.jobs.Scientist.locked && game.global.challengeActive != \"Scientist\")))\n return;\n highlightHousing();\n\n //if housing is highlighted\n if (bestBuilding !== null && game.global.buildingsQueue.length == 0) {\n //insert gigastation logic here ###############\n if (!safeBuyBuilding(bestBuilding)) {\n buyFoodEfficientHousing();\n }\n } else {\n buyFoodEfficientHousing();\n }\n \n if(getPageSetting('MaxWormhole') > 0 && game.buildings.Wormhole.owned < getPageSetting('MaxWormhole') && !game.buildings.Wormhole.locked) safeBuyBuilding('Wormhole');\n\n //Buy non-housing buildings\n if (!game.buildings.Gym.locked && (getPageSetting('MaxGym') > game.buildings.Gym.owned || getPageSetting('MaxGym') == -1)) {\n safeBuyBuilding('Gym');\n }\n if (!game.buildings.Tribute.locked && (getPageSetting('MaxTribute') > game.buildings.Tribute.owned || getPageSetting('MaxTribute') == -1)) {\n safeBuyBuilding('Tribute');\n }\n var targetBreed = parseInt(getPageSetting('GeneticistTimer'));\n //only buy nurseries if enabled, and we need to lower our breed time, or our target breed time is 0, or we aren't trying to manage our breed time before geneticists, and they aren't locked\n //even if we are trying to manage breed timer pre-geneticists, start buying nurseries once geneticists are unlocked AS LONG AS we can afford a geneticist (to prevent nurseries from outpacing geneticists soon after they are unlocked)\n if ((targetBreed < getBreedTime() || targetBreed == 0 || !getPageSetting('ManageBreedtimer') || \n (targetBreed < getBreedTime(true) && game.global.challengeActive == 'Watch') ||\n (!game.jobs.Geneticist.locked && canAffordJob('Geneticist', false))) && !game.buildings.Nursery.locked) \n {\n if ((getPageSetting('MaxNursery') > game.buildings.Nursery.owned || getPageSetting('MaxNursery') == -1) && \n (getBuildingItemPrice(game.buildings.Nursery, \"gems\", false, 1) < 0.05 * getBuildingItemPrice(game.buildings.Warpstation, \"gems\", false, 1) || game.buildings.Warpstation.locked) && \n (getBuildingItemPrice(game.buildings.Nursery, \"gems\", false, 1) < 0.05 * getBuildingItemPrice(game.buildings.Collector, \"gems\", false, 1) || game.buildings.Collector.locked || !game.buildings.Warpstation.locked))\n {\n safeBuyBuilding('Nursery');\n }\n }\n}", "title": "" }, { "docid": "62b1b1b60a47e3a36801d5afddbf4b21", "score": "0.5570486", "text": "function CheckQuestInvItems() {\n ////get dynamic amount of objects\n var countDigUpSells = Object.keys(collectItems.digUpSells).length;\n\n //reset values so fresh count\n mayorReady = 0; friarReady = 0; feliciaReady = 0; saraReady = 0;\n //loop the items and check for ones owned\n for (var i = 0; i < countDigUpSells; i++) {\n if (collectItems.digUpSells[i].owned == 1) {\n\n if (collectItems.digUpSells[i].who == 'Mayor') { mayorReady = 1; }\n else if (collectItems.digUpSells[i].who == 'Friar') { friarReady = 1; }\n else if (collectItems.digUpSells[i].who == 'Sara') { saraReady = 1; }\n else if (collectItems.digUpSells[i].who == 'Felicia' && questParams.felicia[2].completed == 0) { feliciaReady = 1; };\n };\n }\n //console.log(\"mayorReady = \" + mayorReady + \"friarReady = \" + friarReady + \" feliciaready = \" + feliciaReady + \" sara ready = \" + saraReady)\n if (mayorReady == 1) {\n //console.log(\"mayorReady IF = \" + mayorReady)\n mayorQuest.setFill(imgArrayTown[16].src);\n mayorQuest.setHidden(false); mayorQuestBtn.setHidden(false);\n //questText1.setText(questParams.mayor[ct].successText)\n goog.events.unlisten(mayorQuestBtn, [\"mousedown\", \"touchstart\"], function (e) { })\n goog.events.unlisten(mayor, [\"mousedown\", \"touchstart\"], function (e) { })\n goog.events.listen(mayorQuestBtn, [\"mousedown\", \"touchstart\"], function (e) { handleTownQuest(\"mayor\", 1); questPanel.who = 'mayor'; mayorSound.play(); });\n goog.events.listen(mayor, [\"mousedown\", \"touchstart\"], function (e) { handleTownQuest(\"mayor\", 1); questPanel.who = 'mayor'; mayorSound.play(); });\n }\n else if (mayorReady == 0) {\n //console.log(\"mayorReady else= \" + mayorReady)\n var randomSpeech1 = Math.round(Math.random() * 6);\n if (randomSpeech1 < 1) { randomSpeech1 = 1 };\n if (randomSpeech1 > 6) { randomSpeech1 = 6 };\n mayorQuest.setFill(imgArrayTown[15].src);\n\n goog.events.unlisten(mayorQuestBtn, [\"mousedown\", \"touchstart\"], function (e) { })\n goog.events.unlisten(mayor, [\"mousedown\", \"touchstart\"], function (e) { })\n goog.events.listen(mayorQuestBtn, [\"mousedown\", \"touchstart\"], function (e) { handleTownQuest(\"mayor\", 0); questText1.setText(questParams.mayor[randomSpeech1].text); questPanel.who = 'mayor'; mayorSound.play(); });\n goog.events.listen(mayor, [\"mousedown\", \"touchstart\"], function (e) { handleTownQuest(\"mayor\", 0); questText1.setText(questParams.mayor[randomSpeech1].text); questPanel.who = 'mayor'; mayorSound.play(); });\n }\n\n if (friarReady > 0) {\n\n //console.log(\"friarReady If= \" + friarReady)\n monkQuest.setFill(imgArrayTown[16].src);\n monkQuest.setHidden(false); monkQuestBtn.setHidden(false);\n goog.events.unlisten(monkQuestBtn, [\"mousedown\", \"touchstart\"], function (e) { });\n goog.events.unlisten(monk, [\"mousedown\", \"touchstart\"], function (e) { });\n goog.events.listen(monkQuestBtn, [\"mousedown\", \"touchstart\"], function (e) { handleTownQuest(\"monk\", 1); questPanel.who = 'monk'; sellItemsBtn.setHidden(false); });\n goog.events.listen(monk, [\"mousedown\", \"touchstart\"], function (e) { handleTownQuest(\"monk\", 1); questPanel.who = 'monk'; sellItemsBtn.setHidden(false); });\n }\n else {\n //console.log(\"friarReady Else= \" + friarReady)\n var randomSpeech2 = Math.round(Math.random() * 5);\n if (randomSpeech2 < 1) { randomSpeech2 = 1 };\n if (randomSpeech2 > 5) { randomSpeech2 = 5 };\n monkQuest.setFill(imgArrayTown[15].src);\n\n goog.events.unlisten(monkQuestBtn, [\"mousedown\", \"touchstart\"], function (e) { })\n goog.events.unlisten(monk, [\"mousedown\", \"touchstart\"], function (e) { })\n goog.events.listen(monkQuestBtn, [\"mousedown\", \"touchstart\"], function (e) { handleTownQuest(\"monk\", 0); questPanel.who = 'monk'; questText1.setText(questParams.monk[randomSpeech2].text); });\n goog.events.listen(monk, [\"mousedown\", \"touchstart\"], function (e) { handleTownQuest(\"monk\", 0); questPanel.who = 'monk'; questText1.setText(questParams.monk[randomSpeech2].text); });\n }\n\n if (saraReady > 0) {\n saraQuest.setFill(imgArrayTown[16].src);\n goog.events.unlisten(saraQuestBtn, [\"mousedown\", \"touchstart\"], function (e) { })\n goog.events.unlisten(sara, [\"mousedown\", \"touchstart\"], function (e) { })\n goog.events.listen(saraQuestBtn, [\"mousedown\", \"touchstart\"], function (e) {\n handleTownQuest(\"sara\", 1); questPanel.who = 'sara'; saraQuest.setHidden(false); saraQuestBtn.setHidden(false); saraSound.play();\n });\n\n goog.events.listen(sara, [\"mousedown\", \"touchstart\"], function (e) { handleTownQuest(\"sara\", 1); questPanel.who = 'sara'; saraQuest.setHidden(false); saraQuestBtn.setHidden(false); saraSound.play(); });\n }else {\n saraQuest.setFill(imgArrayTown[15].src);\n questText1.setText(questParams.sara[1].text);\n goog.events.unlisten(saraQuestBtn, [\"mousedown\", \"touchstart\"], function (e) { })\n goog.events.unlisten(sara, [\"mousedown\", \"touchstart\"], function (e) { })\n goog.events.listen(saraQuestBtn, [\"mousedown\", \"touchstart\"], function (e) { handleTownQuest(\"sara\", 0); questPanel.who = 'sara'; saraQuest.setHidden(false); saraQuestBtn.setHidden(false); saraSound.play(); });\n goog.events.listen(sara, [\"mousedown\", \"touchstart\"], function (e) { handleTownQuest(\"sara\", 0); questPanel.who = 'sara'; saraQuest.setHidden(false); saraQuestBtn.setHidden(false); saraSound.play(); });\n }\n\n\n if (feliciaReady > 0) {\n feliciaQuest.setFill(imgArrayTown[16].src);\n goog.events.unlisten(feliciaQuestBtn, [\"mousedown\", \"touchstart\"], function (e) { })\n goog.events.unlisten(felicia, [\"mousedown\", \"touchstart\"], function (e) { })\n goog.events.listen(feliciaQuestBtn, [\"mousedown\", \"touchstart\"], function (e) { handleTownQuest(\"felicia\", 1); questPanel.who = 'felicia'; feliciaSound.play(); }, { passive: false });\n goog.events.listen(felicia, [\"mousedown\", \"touchstart\"], function (e) { handleTownQuest(\"felicia\", 1); questPanel.who = 'felicia'; feliciaSound.play(); }, { passive: false });\n }else {\n feliciaQuest.setFill(imgArrayTown[15].src);\n questText1.setText(questParams.felicia[1].text);\n questPanelItemImg.setHidden(true);\n goog.events.unlisten(feliciaQuestBtn, [\"mousedown\", \"touchstart\"], function (e) { })\n goog.events.unlisten(felicia, [\"mousedown\", \"touchstart\"], function (e) { })\n goog.events.listen(feliciaQuestBtn, [\"mousedown\", \"touchstart\"], function (e) { handleTownQuest(\"felicia\", 0); questPanel.who = 'felicia'; feliciaSound.play(); });\n goog.events.listen(felicia, [\"mousedown\", \"touchstart\"], function (e) { handleTownQuest(\"felicia\", 0); questPanel.who = 'felicia'; feliciaSound.play(); });\n }\n }", "title": "" }, { "docid": "8a3f045b14358b920719238970d19a66", "score": "0.5561984", "text": "function onReadyClick() {\n if (status === \"SETUP\") {\n\n //Check if all boats are placed\n if (boats.length !== boatSettings.length) {\n if (confirm(\"You have not placed all boats. Do you want to place the rest randomly?\")) {\n //If not, place all the remaining boats randomly\n for (let i = 0; i < boatSettings.length; i++) {\n //Check if the boat is already placed, if so, continue.\n if ($(\"#setup\").children().eq(i).css(\"display\") === \"none\") continue;\n let boatSetting = boatSettings[i];\n //Keep generating random positions, and check if the position is valid\n loop1:\n while (true) {\n let x = Math.floor(Math.random() * 10);\n let y = Math.floor(Math.random() * 10);\n let rot = Math.random() >= 0.5 ? \"HORIZONTAL\" : \"VERTICAL\";\n let newboat = new BoatLocation(boatSetting, rot, x, y);\n\n //Check if new boat is within boundaries\n if (rot === \"HORIZONTAL\") {\n if (x + boatSetting.length - 1 >= 10) {\n continue;\n }\n }\n //Else vertical rotation\n else {\n if (y + boatSetting.length - 1 >= 10) {\n continue;\n }\n }\n\n //Check if new boat is overlapping with an existing one\n for (let i = 0; i < boats.length; i++) {\n let boat = boats[i];\n if (boat.overlapsWith(newboat)) {\n continue loop1\n }\n }\n\n //The boat is valid, add it\n boats.push(newboat);\n\n //Go out of loop\n break;\n }\n }\n //Visually update the board\n updateBoard(boats);\n //Clear the setup\n $(\"#setup\").html(\"\");\n } else {\n return;\n }\n }\n status = \"SETUP-READY\";\n READY(boats);\n $(\"#ready\").html(\"You are ready\");\n $(\"#ready\").toggleClass(\"changed\");\n }\n}", "title": "" }, { "docid": "67991a49279492b341a1c52b9205b687", "score": "0.5549787", "text": "function ready(gameId) {\n for(var i = 0; i < games.length ; i++) {\n if(games[i].gameId == gameId) {\n games[i].readyCount++;\n //console.log(games[i]);\n if(games[i].readyCount == games[i].playerCount && games[i].playerCount != 1) {\n sendHintGiver(gameId,i);\n // io.sockets.in(gameId).emit('startGame');\n break;\n }\n break;\n }\n\n }\n}", "title": "" }, { "docid": "e9ac88ee39c11d02e8eff45a79618ba3", "score": "0.55298525", "text": "waiting() {\n if (this.currentlyWaiting == false) {\n this.currentlyWaiting = true;\n let customer = this;\n setTimeout(function () {\n if (customer.state == CUSTOMER_SITUATION.WAITING || CUSTOMER_SITUATION.QUEUE) {\n customer.mood = customer.mood + 1;\n customer.currentlyWaiting = false;\n if (customer.mood == CUSTOMER_MOOD.FURIOUS) { // Customer leaves after not getting food in time\n customer.state = CUSTOMER_SITUATION.LEAVING;\n setTimeout(function () {\n customer.removeFromCustomers();\n }, 3000);\n }\n customer.waiting();\n }\n }, 15000);\n }\n }", "title": "" }, { "docid": "763014b0cc0998b532e194764684e976", "score": "0.55224913", "text": "function C012_AfterClass_Bed_StartMasturbate() {\n\tif (!Common_PlayerRestrained) {\n\t\tif (C012_AfterClass_Dorm_Guest.length == 0) {\n\t\t\tif (Common_PlayerNaked) OverridenIntroText = GetText(\"LayNaked\");\n\t\t\telse OverridenIntroText = GetText(\"StripNaked\");\n\t\t\tPlayerClothes(\"Naked\");\n\t\t\tC012_AfterClass_Bed_CurrentStage = 100;\n\t\t\tCurrentTime = CurrentTime + 50000;\t\t\t\n\t\t} else OverridenIntroText = GetText(\"CannotMasturbateWithGuest\");\n\t}\n}", "title": "" }, { "docid": "1af624a3cc9c3e2ca4cedfa53a28d477", "score": "0.55218977", "text": "function isChallenging(battleId) {\r\n renewDash = false;\r\n challangeable = true;\r\n clearInterval(dashboardTime);\r\n checkRequest = true;\r\n $(\".right\").html('<pre>You have challenged an opponent</pre>');\r\n requestCheck(battleId);\r\n checkRequestTime = setInterval(\"requestCheck(battleId)\", 3000);\r\n }", "title": "" }, { "docid": "f4bb381e74a8a93eb2d8ae23ad8d71c3", "score": "0.55038357", "text": "checkStartFight()\n {\n const shouldStartFight = Math.random() < store.getState().game.battleFrequency;\n\n debug(`Start a fight? ${shouldStartFight}`);\n\n return shouldStartFight;\n }", "title": "" }, { "docid": "b12738dbcc8c8e5c9aa49829428c5e8a", "score": "0.54938716", "text": "function doneAllInstructions() {\r\n submitted=true;\r\n if (iControlBots) {\r\n for (var i = 1; i <= numPlayers; i++) {\r\n if (!activePlayers[i]) { // for the inactive player\r\n submitBotSolution(i);\r\n }\r\n }\r\n }\r\n \r\n submit('<startup best=\"'+showBest+'\" teamModulo=\"'+showTeamModulo+'\" forceBots=\"'+forceBots+'\" botType=\"'+botType+'\" showScore=\"'+showScore+'\" showMap=\"'+showMap+'\"/>');\r\n \r\n $(\"#waiting\").show();\r\n}", "title": "" }, { "docid": "4baec66b0942a6b1821bb03f99246d95", "score": "0.5491066", "text": "function BuyAndActivateUpgrade(upg) {\r\n upg.BuyUpgrade = player.currency.Currency.cmp(upg.CostToBuy);\r\n if (upg.isBought && !upg.hasFunctRan) {\r\n upg.upgradeEffectFunction();\r\n upg.hasFunctRan = true;\r\n console.log(\"upg effect has been run\");\r\n }\r\n}", "title": "" }, { "docid": "5b84e39669ae6a0950a56592b2fe284c", "score": "0.54885393", "text": "function C010_Revenge_SidneyJennifer_EndFight(Victory) {\n\t\n\t// Change the girls attitude depending on the victory or defeat\n\tActorSpecificChangeAttitude(\"Sidney\", 0, Victory ? 2 : -2);\n\tActorSpecificChangeAttitude(\"Jennifer\", -1, Victory ? 2 : -2);\n\tActorSpecificSetPose(\"Sidney\", \"Angry\");\n\tActorSpecificSetPose(\"Jennifer\", \"Angry\");\n\tC010_Revenge_SidneyJennifer_FightVictory = Victory;\n\tC010_Revenge_SidneyJennifer_AllowFight = false;\n\t\n\t// If this was the hallway fight\n\tif (C010_Revenge_SidneyJennifer_CurrentStage <= 100) {\n\n\t\t// On a victory Sidney runs away, on a defeat we show a custom text\n\t\tif (Victory) {\n\t\t\tOverridenIntroText = GetText(\"FightVictorySidneyRun\");\n\t\t\tActorLoad(\"Jennifer\", \"\");\n\t\t\tLeaveIcon = \"\";\n\t\t\tC010_Revenge_SidneyJennifer_SidneyGone = true;\n\t\t\tC010_Revenge_SidneyJennifer_CurrentStage = 32;\n\t\t} else {\n\t\t\tOverridenIntroText = GetText(\"FightDefeatHallway\");\n\t\t\tC010_Revenge_SidneyJennifer_CurrentStage = 40;\n\t\t}\n\t\t\n\t}\n\n}", "title": "" }, { "docid": "d5754588b965612f00e8ce47bd503dd3", "score": "0.54845333", "text": "async battle_phase_end() {\n for (let i = 0; i < this.on_going_effects.length; ++i) {\n const effect = this.on_going_effects[i];\n effect.char.remove_effect(effect);\n effect.char.update_all();\n }\n if (this.allies_defeated) {\n this.battle_log.add(this.allies_info[0].instance.name + \"' party has been defeated!\");\n } else {\n this.battle_log.add(this.enemies_party_data.name + \" has been defeated!\");\n await this.wait_for_key();\n const total_exp = this.enemies_info.map(info => info.instance.exp_reward).reduce((a, b) => a + b, 0);\n this.battle_log.add(`You got ${total_exp.toString()} experience points.`);\n await this.wait_for_key();\n for (let i = 0; i < this.allies_info.length; ++i) {\n const info = this.allies_info[i];\n const char = info.instance;\n if (!char.has_permanent_status(permanent_status.DOWNED)) {\n const change = char.add_exp(info.entered_in_battle ? total_exp : total_exp >> 1);\n if (change.before.level !== change.after.level) {\n this.battle_log.add(`${char.name} is now a level ${char.level} ${char.class.name}!`);\n await this.wait_for_key();\n const gained_abilities = _.difference(change.after.abilities, change.before.abilities);\n for (let j = 0; j < gained_abilities.length; ++j) {\n const ability = abilities_list[gained_abilities[j]];\n this.battle_log.add(`Mastered the ${char.class.name}'s ${ability.name}!`);\n await this.wait_for_key();\n }\n for (let j = 0; j < change.before.stats.length; ++j) {\n const stat = Object.keys(change.before.stats[j])[0];\n const diff = change.after.stats[j][stat] - change.before.stats[j][stat];\n if (diff !== 0) {\n let stat_text;\n switch (stat) {\n case \"max_hp\": stat_text = \"Maximum HP\"; break;\n case \"max_pp\": stat_text = \"Maximum PP\"; break;\n case \"atk\": stat_text = \"Attack\"; break;\n case \"def\": stat_text = \"Defense\"; break;\n case \"agi\": stat_text = \"Agility\"; break;\n case \"luk\": stat_text = \"Luck\"; break;\n }\n this.battle_log.add(`${stat_text} rises by ${diff.toString()}!`);\n await this.wait_for_key();\n }\n }\n }\n }\n }\n const total_coins = this.enemies_info.map(info => info.instance.coins_reward).reduce((a, b) => a + b, 0);\n this.battle_log.add(`You got ${total_coins.toString()} coins.`);\n await this.wait_for_key();\n for (let i = 0; i < this.enemies_info.length; ++i) {\n const enemy = this.enemies_info[i].instance;\n if (enemy.item_reward && Math.random() < enemy.item_reward_chance) {\n //add item\n const item = items_list[enemy.item_reward];\n if (item !== undefined) {\n this.battle_log.add(`You got a ${item.name}.`);\n await this.wait_for_key();\n } else {\n this.battle_log.add(`${enemy.item_reward} not registered...`);\n await this.wait_for_key();\n }\n }\n }\n }\n this.unset_battle();\n }", "title": "" }, { "docid": "4889364abe0a268bd91daeb92722e474", "score": "0.5478285", "text": "function battleWinner() {\n\t$(\".defendant\").empty();\n\tconsole.log(gameState);\n\t$(\".results\").html(\"You beat \" + gameState.enemyCharacters.name + \" Choose another character too attack.\");\n\n\t// selectAnother();\n}", "title": "" }, { "docid": "e49fd2895cac91acc2de1385a1a2d054", "score": "0.54768234", "text": "setIsReady() {\n this.isReady_ = true;\n this.flushQueue_();\n }", "title": "" }, { "docid": "1b9bbb5c8cd7530dad9b26e73a944687", "score": "0.54596084", "text": "function setPlayerNotReadyForNextRound() {\n GameLobby.unreadyPlayers();\n}", "title": "" }, { "docid": "75e0fc71f2976eacbe302d60831490e8", "score": "0.54555696", "text": "function goodQuestAvailable() {\n var EndlessBossType = defaultFor(QuestType.ENDLESS_BOSSKILL, \"UNDEFINED\");\n var checkBossQuests = false;\n if (canFarm(game.player.level, MonsterRarity.BOSS)) {\n //If we can farm bosses, include those quests\n checkBossQuests = true;\n }\n return game.questsManager.quests.filter(function(x) { return x.type == QuestType.KILL || (checkBossQuests && x.type == EndlessBossType); }).length > 0;\n}", "title": "" }, { "docid": "d64285ec1dc50355a8358d8b972f22cd", "score": "0.54543835", "text": "notifyWinner(winnerAddress, bid) {\n addAlertElement(\"<strong>\" + winnerAddress + \"</strong> won!\",\"success\");\n\n if(auctioneer.auctionContract.type == \"VickreyAuction\"){\n $(\"#finalizeSuccess\").show();\n }\n }", "title": "" }, { "docid": "db9737661898ff3f976b721b310e1045", "score": "0.5448128", "text": "async afterTurn() {\n await super.afterTurn();\n // <<-- Creer-Merge: after-turn -->>\n this.updateSpawnedCowboys();\n this.game.currentPlayer.siesta = Math.max(0, this.game.currentPlayer.siesta - 1);\n this.updateCowboys();\n this.advanceBottles();\n this.resetPianoPlaying();\n this.applyHazardDamage();\n utils_1.filterInPlace(this.game.cowboys, (c) => !c.isDead);\n utils_1.filterInPlace(this.game.furnishings, (f) => !f.isDestroyed);\n utils_1.filterInPlace(this.game.bottles, (b) => !b.isDestroyed);\n this.game.currentPlayer.youngGun.update();\n // <<-- /Creer-Merge: after-turn -->>\n }", "title": "" }, { "docid": "d5e3098620a201122e5cea5df4f22b12", "score": "0.5444968", "text": "function PendingPlayerState() { }", "title": "" }, { "docid": "34b8c67ef65b68447ee8064503795149", "score": "0.54375935", "text": "function doesItContainClass() {\n if (count.contains(\"started\")) {\n NavPeo.start();\n NavPer.start();\n SBBPeo.start();\n SBBPer.start();;\n }\n}", "title": "" }, { "docid": "26eb480dc1ef219212635d285ee78c61", "score": "0.5436767", "text": "function startBattle() {\n sortByInitiative();\n $(\"#unsortedTable\").slideUp(500);\n $(\".newChar\").slideUp(500);\n // todo: Implement stuff here\n // Start doing things (turn display, waiting in initiative, delete from tbl)\n // Maybe change button characteristics to a next turn button\n // with diff. functionality (unhide, and hide start battle btn)\n}", "title": "" }, { "docid": "c7efbc5ae140e4bb6b5e13b405f3348e", "score": "0.5416859", "text": "function SarahSophiePunishGirls() {\n\n\t// Sets the correct stage & dialog\n\tif ((SophiePunishmentStage % 2 == 0) && !SarahInside && !AmandaInside) SophiePunishmentStage++;\n\tSophie.CurrentDialog = DialogFind(Sophie, \"PlayerPunishmentStage\" + SophiePunishmentStage.toString());\n\n}", "title": "" }, { "docid": "78c3e82461e831878e78c20eb8fe1bfa", "score": "0.5415949", "text": "checkComplete() {\n let result = true;\n for (let i = 0; i < this.solution.length; i++) {\n result = result && this.solution[i] === this.inputGates[i];\n }\n let oldComplete = this.complete;\n this.complete = result;\n if ((this.complete !== oldComplete) && this.complete) {\n bing.play();\n }\n }", "title": "" }, { "docid": "e31f3a64e250e9eddcdd4e0eb0685cd0", "score": "0.54081285", "text": "function partyOn()\n{\n\tvar sperms = SPADGOS.getSperms(),\n\t\ti = 0, l = sperms.length,\n\t\tcolor;\n\n\t// let's randomise counts sometimes too why not\n\tif (Math.random() <= NEW_PARTY_PROB && ((new Date) - LAST_RANDOM_SPERM > NEW_PARTY_TIMEOUT)) {\n\t\tSPADGOS.randomiseSperms(MIN_PARTY_SPERMS, MAX_PARTY_SPERMS);\n\t\tLAST_RANDOM_SPERM = new Date;\n\t}\n\n\tfor (; i < l; ++i) {\n\t\tcolor = PARTY_COLORS[Math.floor(Math.random() * PARTY_COLORS.length)];\n\n\t\tsperms[i].spriteImage = PARTY_SPRITES[colorHex(color)];\n\n\t\tcolor = PARTY_COLORS[Math.floor(Math.random() * PARTY_COLORS.length)];\n\t\tsperms[i].color = colorHex(color);\n\t}\n\n\t// and the background\n\tSPADGOS.BG_COLOR = colorHex(PARTY_COLORS[Math.floor(Math.random() * PARTY_COLORS.length)]);\n}", "title": "" }, { "docid": "ee8fbb9f523a2810a56124d6c33d4455", "score": "0.54033583", "text": "function C012_AfterClass_Amanda_TestSubmit() {\n\tif (Common_PlayerOwner != \"\") {\n\t\tOverridenIntroText = GetText(\"AlreadyOwned\");\n\t} else {\n\t\tif (ActorIsRestrained()) {\n\t\t\tOverridenIntroText = GetText(\"UnrestrainFirst\");\n\t\t} else {\n\t\t\tif (ActorIsChaste()) {\n\t\t\t\tOverridenIntroText = GetText(\"UnchasteFirst\");\n\t\t\t} else {\n\t\t\t\tif (PlayerHasLockedInventory(\"Collar\")) {\n\t\t\t\t\tOverridenIntroText = GetText(\"PlayerUncollarFirst\");\t\t\t\t\t\n\t\t\t\t} else {\t\t\t\t\t\n\t\t\t\t\tif (Common_PlayerRestrained) {\n\t\t\t\t\t\tOverridenIntroText = GetText(\"PlayerUnrestrainFirst\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tC012_AfterClass_Amanda_CurrentStage = 330;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "002fb06813d82c724c4339ea53dec369", "score": "0.5399595", "text": "function playerReady() {\n if (game) {\n game.playerReady(player);\n // all the game events\n subscribe('unit.move', unitMove);\n subscribe('unit.attack', unitAttack);\n subscribe('unit.skip', unitSkip);\n console.log( \"playerReady\" );\n }\n }", "title": "" }, { "docid": "d68724035a6ec44cdba8fc3daf0aefed", "score": "0.5398828", "text": "function beginBattle(){\n\tif(battleState === true){\n\t\t\n\thpCheck();\n\n\tif(blindDeBuff=true){pTurn==false}\n\n\tif(pTurn==false){\n\n\t\tsetTimeout(function(){\n\n\t\t\tswitch (currentBattle){\n\t\t\t\t\tcase wildmagikarp :\n\t\t\t\t\t\twildmagikarp.AI();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase \" \" :\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase \" \" :\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t}; },2000);\t\t\n\n\t}else{};\n\n\t}\n\t\n\t\n\t// Tell me how to get the story moving again!\t\n\t// Also, tell me which, if any, variables should be \"reset\" so that the next battle begins without a hitch!\t\n\n}", "title": "" }, { "docid": "bf3e3e0b3d578946926e2051344181c7", "score": "0.5391433", "text": "function C002_FirstClass_Outro_Load() {\n\t\n\t// Time is always 9:15:00 in the outro\n\tStopTimer(9 * 60 * 60 * 1000);\n\tC002_FirstClass_Outro_Restrained = Common_PlayerRestrained;\n\tActorSpecificClearInventory(\"Sidney\", false);\n\tActorSpecificClearInventory(\"Amanda\", false);\n\tActorSpecificClearInventory(\"Sarah\", false);\n\tActorSpecificClearInventory(\"Mildred\", false);\n\n}", "title": "" }, { "docid": "bf3e3e0b3d578946926e2051344181c7", "score": "0.5391433", "text": "function C002_FirstClass_Outro_Load() {\n\t\n\t// Time is always 9:15:00 in the outro\n\tStopTimer(9 * 60 * 60 * 1000);\n\tC002_FirstClass_Outro_Restrained = Common_PlayerRestrained;\n\tActorSpecificClearInventory(\"Sidney\", false);\n\tActorSpecificClearInventory(\"Amanda\", false);\n\tActorSpecificClearInventory(\"Sarah\", false);\n\tActorSpecificClearInventory(\"Mildred\", false);\n\n}", "title": "" }, { "docid": "10f11f7d4b28bd19c758220e4d7564e3", "score": "0.5385805", "text": "function playerTakeSword() {\r\n if(currentLocation === 7 && playerHasSword===false) {\r\n playerHasSword=true;\r\n updateText(Item [0].notTaken);\r\n }\r\n else if(currentLocation === 7 && playerHasSword===true) {\r\n updateText(Item [0].taken);\r\n }\r\n }", "title": "" }, { "docid": "f88b76523996b945a79fb5a8b9513608", "score": "0.5385528", "text": "function C012_AfterClass_Jennifer_TestSub() {\n\tif (!ActorIsGagged()) {\n\t\tif (!ActorIsRestrained() && !Common_PlayerRestrained) {\n\t\t\tif (ActorGetValue(ActorSubmission) <= -20) {\n\t\t\t\tif (Common_PlayerOwner == \"\") {\n\t\t\t\t\tif (!PlayerHasLockedInventory(\"Collar\")) {\n\t\t\t\t\t\tC012_AfterClass_Jennifer_CurrentStage = 300;\n\t\t\t\t\t\tif (ActorGetValue(ActorCloth) != \"Clothed\") OverridenIntroText = GetText(\"ChangeForDommeSpeech\");\n\t\t\t\t\t\telse OverridenIntroText = \"\";\n\t\t\t\t\t\tActorSetCloth(\"Clothed\");\n\t\t\t\t\t\tActorSetPose(\"Dominant\");\n\t\t\t\t\t\tLeaveIcon = \"\";\n\t\t\t\t\t} else OverridenIntroText = GetText(\"PlayerUncollarFirst\");\n\t\t\t\t} else OverridenIntroText = GetText(\"AlreadyOwned\");\n\t\t\t}\n\t\t} else OverridenIntroText = GetText(\"CantDateWhileRestrained\");\n\t} else C012_AfterClass_Jennifer_GaggedAnswer();\n}", "title": "" }, { "docid": "40bf9429c2751f386ce9cab5971d62fc", "score": "0.5385271", "text": "startBuildUnit(unitType, kingdom, game){\n\n var unitInfo = kingdom.getUnitInfo(unitType);\n\n //if the building can create the unit, and has the gold to create it, then creates the unit\n if(this.getUnitProduced() === unitType && this.getState() === \"Idle\"){\n if(unitInfo.cost <= kingdom.getGold()){\n\n //if this is the player object tint it to green\n if(this.isPlayerObj()){\n this.tint = 0x00FF00;\n }\n\n //set the state to build\n this.setState(\"Build\");\n\n kingdom.removeGold(unitInfo.cost);\n\n //creates the unit after 10 seconds\n var buildingEvent = game.time.addEvent({ delay: 10000, callback: this.finishBuildUnit,\n callbackScope: this, loop: false, args: [unitInfo, kingdom, game] });\n } else if (unitInfo.cost > kingdom.getGold()){ notEnoughGold = 1; }\n }\n\n }", "title": "" }, { "docid": "34874032aee46d913acc1b892a0d7ed5", "score": "0.5382566", "text": "function battleMapTowerBuildStarted() {\n let tempTowerSlotToBuild = store.getState().towerSlotToBuild.split('_')[2];\n let tempTowerToBuild = store.getState().towerToBuild;\n let tempActualTower = ('tower_slot_' + tempTowerSlotToBuild);\n let tempData = 0;\n mainSfxController(towerBuildingSfxSource);\n\n if(tempTowerSlotToBuild == 7) {\n battleMap1BuildHereTextid.classList.add('nodisplay');\n }\n\n let tempParameters = [tempTowerSlotToBuild, tempTowerToBuild];\n\n for (let i = 0; i < store.getState().animationendListened.length; i++) {\n if (store.getState().animationendListened[i][0] == tempActualTower && store.getState().animationendListened[i][1] == 'animationend') {\n tempData = 1;\n }\n }\n\n if (tempData !== 1){\n towerSlotEventListenerWatcherStateChangeStarter(tempActualTower, 'animationend');\n addEvent(battleMap1TowerPlaceList[tempTowerSlotToBuild - 1], 'animationend', battleMapTowerBuildFinished, tempParameters);\n }\n }", "title": "" }, { "docid": "7247dd0057293c8dfbf63db6aa092b28", "score": "0.5379527", "text": "BunnyAtExit() {\n if (this.UpdatePoppedEggCount()) {\n this.Complete();\n } else {\n ui.AlarmEggCount();\n ui.Tip(\"You haven't got all the eggs yet - go back in\");\n }\n }", "title": "" }, { "docid": "5c8301d117ef3c0b05b09ece5eb8b067", "score": "0.53762597", "text": "isReady(){\n if(this.role === \"animator\"){\n return this.isAnimReady;\n }else{\n return this.question !== ''; // player is ready when he has defined his question\n }\n }", "title": "" }, { "docid": "e8c253d9d095d4d30516bee92125bea9", "score": "0.53676355", "text": "tryDefend (tDest, nbUnits) {\n var cDest = getContinentOf(tDest)\n console.log('tDest' + tDest)\n console.log('tDest soldiers :')\n console.log(THIS.map[cDest][tDest].soldiers)\n console.log('nb units = ' + nbUnits)\n\n /* check if the territory has the number of units */\n if (THIS.map[cDest][tDest].soldiers < nbUnits) {\n console.log('Action not permitted: not enough units')\n return -1\n }\n\n /* check if the player owns the territory ? */\n\n /* notify server */\n var data = {\n units: nbUnits\n }\n\n THIS.sendToServer(new Packet('DEFEND', data))\n\n return 0\n }", "title": "" }, { "docid": "3fd6aadfcf6b45cc13fc65078883f73b", "score": "0.5367405", "text": "function C012_AfterClass_Amanda_StartPunishment() {\n\tC012_AfterClass_Amanda_CurrentStage = EventRandomPlayerPunishment();\n}", "title": "" }, { "docid": "c25df29c8df4e7dcd3bb3f1319d9202e", "score": "0.53617173", "text": "finishBuildUnit(unitInfo, kingdom, game){\n\n //if unit is still alive and still has their state set to build, build the building\n if(this.getState() === \"Build\" && this.health > 0){\n var unit = new Unit(unitInfo, this.x+75, this.y, game, kingdom.isPlayer(), kingdom, 0);\n //once the unit has been built, add it to the kingdom and increase the unitamount\n\n kingdom.units.push(unit);\n kingdom.unitAmount++;\n\n this.setState(\"Idle\");\n\n //if this is the player object make it normal colored again as build is finished\n if(this.isPlayerObj()){\n this.tint = 0xFFFFFF;\n }\n\n if(kingdom === player){\n currentPopulation++;\n gameMessage = 1;\n }\n }\n else{\n\n //if the building was destroyed before the unit was built, give the money back to the kingdom\n kingdom.addGold(unitInfo.cost);\n\n\n }\n }", "title": "" }, { "docid": "d4af5c6c76111804e97b62c11b4dd087", "score": "0.5361472", "text": "update() {\r\n ////console.log(\"in update shipConstruction\");\r\n if (this.gameOver) {\r\n //console.log(\"game is over??\");\r\n return;\r\n }\r\n\r\n\r\n if (sleepTortuga) {\r\n return;\r\n }\r\n\r\n\r\n }", "title": "" }, { "docid": "87b051fa2d4de98201dfee2d7565f5eb", "score": "0.53471005", "text": "async battle_phase_combat() {\n if (!this.turns_actions.length) {\n this.battle_phase = battle_phases.ROUND_END;\n this.check_phases();\n return;\n }\n const action = this.turns_actions.pop();\n if (action.caster.has_permanent_status(permanent_status.DOWNED)) { //check whether this char is downed\n this.check_phases();\n return;\n }\n if (action.caster.is_paralyzed()) { //check whether this char is paralyzed\n if (action.caster.temporary_status.has(temporary_status.SLEEP)) {\n await this.battle_log.add(`${action.caster.name} is asleep!`);\n } else if (action.caster.temporary_status.has(temporary_status.STUN)) {\n await this.battle_log.add(`${action.caster.name} is paralyzed and cannot move!`);\n }\n await this.wait_for_key();\n this.check_phases();\n return;\n }\n if (action.caster.fighter_type === fighter_types.ENEMY && !abilities_list[action.key_name].priority_move) { //reroll enemy ability\n Object.assign(action, EnemyAI.roll_action(action.caster, party_data.members, this.enemies_info.map(info => info.instance)));\n }\n let ability = abilities_list[action.key_name];\n let item_name = \"\";\n if (action.caster.fighter_type === fighter_types.ALLY && ability !== undefined && ability.can_switch_to_unleash) { //change the current ability to unleash ability from weapon\n if (action.caster.equip_slots.weapon && items_list[action.caster.equip_slots.weapon.key_name].unleash_ability) {\n const weapon = items_list[action.caster.equip_slots.weapon.key_name];\n if (Math.random() < weapon.unleash_rate) {\n item_name = weapon.name;\n action.key_name = weapon.unleash_ability;\n ability = abilities_list[weapon.unleash_ability];\n }\n }\n }\n if (ability === undefined) {\n await this.battle_log.add(`${action.key_name} ability key not registered.`);\n await this.wait_for_key();\n this.check_phases();\n return;\n }\n if (action.caster.has_temporary_status(temporary_status.SEAL) && ability.ability_category === ability_categories.PSYNERGY) { //check if is possible to cast ability due to seal\n await this.battle_log.add(`But the Psynergy was blocked!`);\n await this.wait_for_key();\n this.check_phases();\n return;\n }\n if (ability.pp_cost > action.caster.current_pp) { //check if char has enough pp to cast ability\n await this.battle_log.add(`... But doesn't have enough PP!`);\n await this.wait_for_key();\n this.check_phases();\n return;\n } else {\n action.caster.current_pp -= ability.pp_cost;\n }\n let djinn_name = action.djinn_key_name ? djinni_list[action.djinn_key_name].name : undefined;\n await this.battle_log.add_ability(action.caster, ability, item_name, djinn_name);\n if (ability.ability_category === ability_categories.DJINN) {\n if (ability.effects.some(effect => effect.type === effect_types.SET_DJINN)) {\n djinni_list[action.djinn_key_name].set_status(djinn_status.SET, action.caster);\n } else {\n djinni_list[action.key_name].set_status(djinn_status.STANDBY, action.caster);\n }\n } else if (ability.ability_category === ability_categories.SUMMON) { //some summon checks\n const requirements = _.find(this.data.summons_db, {key_name: ability.key_name}).requirements;\n const standby_djinni = Djinn.get_standby_djinni(MainChar.get_active_players(MAX_CHARS_IN_BATTLE));\n const has_available_djinni = _.every(requirements, (requirement, element) => {\n return standby_djinni[element] >= requirement;\n });\n if (!has_available_djinni) { //check if is possible to cast a summon\n await this.battle_log.add(`${action.caster.name} summons ${ability.name} but`);\n await this.battle_log.add(`doesn't have enough standby Djinn!`);\n await this.wait_for_key();\n this.check_phases();\n return;\n } else { //set djinni used in this summon to recovery mode\n Djinn.set_to_recovery(MainChar.get_active_players(MAX_CHARS_IN_BATTLE), requirements);\n }\n }\n this.battle_menu.chars_status_window.update_chars_info();\n if (ability.type === ability_types.UTILITY) {\n await this.wait_for_key();\n }\n if (this.animation_manager.animation_available(ability.key_name)) {\n const caster_sprite = action.caster.fighter_type === fighter_types.ALLY ? this.allies_map_sprite[action.caster.key_name] : this.enemies_map_sprite[action.caster.key_name];\n const target_sprites = action.targets.map(info => info.target.sprite);\n const group_caster = action.caster.fighter_type === fighter_types.ALLY ? this.battle_stage.group_allies : this.battle_stage.group_enemies;\n const group_taker = action.caster.fighter_type === fighter_types.ALLY ? this.battle_stage.group_enemies : this.battle_stage.group_allies;\n await this.animation_manager.play(ability.key_name, caster_sprite, target_sprites, group_caster, group_taker, this.battle_stage);\n this.battle_stage.prevent_camera_angle_overflow();\n this.battle_stage.set_stage_default_position();\n } else {\n await this.battle_log.add(`Animation for ${ability.key_name} not available...`);\n await this.wait_for_key();\n }\n //apply ability damage\n if (![ability_types.UTILITY, ability_types.EFFECT_ONLY].includes(ability.type)) {\n await this.apply_damage(action, ability);\n }\n //apply ability effects\n for (let i = 0; i < ability.effects.length; ++i) {\n const effect = ability.effects[i];\n if (!effect_usages.ON_USE) continue;\n const end_turn = await this.apply_effects(action, ability, effect);\n if (end_turn) {\n this.battle_phase = battle_phases.ROUND_END;\n this.check_phases();\n return;\n }\n }\n //summon after cast power buff\n if (ability.ability_category === ability_categories.SUMMON) {\n const requirements = _.find(this.data.summons_db, {key_name: ability.key_name}).requirements;\n for (let i = 0; i < ordered_elements.length; ++i) {\n const element = ordered_elements[i];\n const power = BattleFormulas.summon_power(requirements[element]);\n if (power > 0) {\n action.caster.add_effect({\n type: \"power\",\n quantity: power,\n operator: \"plus\",\n attribute: element\n }, ability, true);\n await this.battle_log.add(`${action.caster.name}'s ${element_names[element]} Power rises by ${power.toString()}!`);\n await this.wait_for_key();\n }\n }\n }\n //check for poison damage\n const poison_status = action.caster.is_poisoned();\n if (poison_status) {\n let damage = BattleFormulas.battle_poison_damage(action.caster, poison_status);\n if (damage > action.caster.current_hp) {\n damage = action.caster.current_hp;\n }\n action.caster.current_hp = _.clamp(action.caster.current_hp - damage, 0, action.caster.max_hp);\n const poison_name = poison_status === permanent_status.POISON ? \"poison\" : \"venom\";\n await this.battle_log.add(`The ${poison_name} does ${damage.toString()} damage to ${action.caster.name}!`);\n this.battle_menu.chars_status_window.update_chars_info();\n await this.wait_for_key();\n await this.check_downed(action.caster);\n }\n if (action.caster.has_temporary_status(temporary_status.DEATH_CURSE)) {\n const this_effect = _.find(action.caster.effects, {\n status_key_name: temporary_status.DEATH_CURSE\n });\n if (action.caster.get_effect_turns_count(this_effect) === 1) {\n action.caster.current_hp = 0;\n action.caster.add_permanent_status(permanent_status.DOWNED);\n await this.battle_log.add(`The Grim Reaper calls out to ${action.caster.name}`);\n await this.wait_for_key();\n }\n }\n this.check_phases();\n }", "title": "" }, { "docid": "808396c67b47d4288d1321b398c34ed9", "score": "0.53461194", "text": "function setPlayerReadyForNextRound(sockID) {\n GameLobby.setPlayerReady(sockID);\n}", "title": "" }, { "docid": "ee811b3267e35bf2c5ef0ff04e8009f8", "score": "0.5340279", "text": "function MaidQuartersBecomMaid() {\n\tInventoryAdd(Player, \"MaidOutfit1\", \"Cloth\");\n\tInventoryAdd(Player, \"MaidHairband1\", \"Hat\");\n\tInventoryWear(Player, \"MaidOutfit1\", \"Cloth\", \"Default\");\n\tInventoryWear(Player, \"MaidHairband1\", \"Hat\", \"Default\");\n\tCharacterAppearanceValidate(Player);\n\tLogAdd(\"JoinedSorority\", \"Maid\");\n\tReputationProgress(\"Dominant\", MaidQuartersDominantRep);\n\tMaidQuartersCanBecomeMaid = false;\n\tMaidQuartersIsMaid = true;\n}", "title": "" }, { "docid": "3ba840cb6db11aa4b0e2af05d9b9549a", "score": "0.5338459", "text": "function win() {\r\n if(playerHasSword===true && playerHasSelfConfidence===true && playerHasShortBlade===true && playerHasWD40===true && currentlocation===10) {\r\n var msg = \"You crawl through the ductwork and see your target. Quickly jumping down, you wound him with the short blade. He lashes out and strikes you back while drawing his sword. You draw the Sword of Aquilius and attack. After a brief battle, LaFontanue knocks the sword from your hand and prepares to run your through. At the last second, you extend your hidden blade and plunge it into his throat, killing him. Your mission is complete. Congratulations.\";\r\n updateText(msg);\r\n }\r\n }", "title": "" }, { "docid": "8fae9822b76d2ebe72dd959b57b979f1", "score": "0.5337331", "text": "function C007_LunchBreak_Natalie_DomMasturbate() {\r\n if (!ActorHasInventory(\"Rope\")) {\r\n OveridenIntroText = GetText(\"NoMasturbate\");\r\n }\r\n if (ActorHasInventory(\"Rope\")) {\r\n CurrentTime = CurrentTime + 60000;\r\n C007_LunchBreak_Natalie_MasturbateCount++;\r\n if (ActorHasInventory(\"VibratingEgg\")) {\r\n C007_LunchBreak_Natalie_MasturbateCount++;\r\n }\r\n if ((C007_LunchBreak_Natalie_MasturbateCount >= 5) && (C007_LunchBreak_Natalie_OrgasmDone < 1)) {\r\n OveridenIntroText = GetText(\"NatalieOrgasm1\");\r\n ActorAddOrgasm();\r\n ActorChangeAttitude(0, 1);\r\n C007_LunchBreak_Natalie_OrgasmDone++;\r\n }\r\n if ((C007_LunchBreak_Natalie_MasturbateCount >= 9) && (C007_LunchBreak_Natalie_OrgasmDone < 2)) {\r\n OveridenIntroText = GetText(\"NatalieOrgasm2\");\r\n ActorAddOrgasm();\r\n ActorChangeAttitude(2, 1);\r\n C007_LunchBreak_Natalie_OrgasmDone++;\r\n }\r\n }\r\n C007_LunchBreak_Natalie_TimeLimit()\r\n}", "title": "" }, { "docid": "0c56f81bb51af8d104294b0fb77e7ec5", "score": "0.5331356", "text": "startNewBattle() {\n if (this.player.agility > this.currentEnemy.agility) {\n this.isPlayerTurn = true;\n } else {\n this.isPlayerTurn = false;\n }\n\n console.log('Your stats are as follows:');\n console.table(this.player.getStats());\n console.log(this.currentEnemy.getDescription());\n\n this.battle();\n }", "title": "" }, { "docid": "002e547863de2a92a115910e36362ad6", "score": "0.5327279", "text": "function C012_AfterClass_Jennifer_Fight(AutoLose) {\n\tCurrentTime = CurrentTime + 50000;\n\tvar P = 25 + (PlayerGetSkillLevel(\"Fighting\") * 25) + (ActorGetValue(ActorSubmission) * 2);\n\tif ((Math.floor(Math.random() * 100) < P) && !AutoLose) {\n\t\tif (C012_AfterClass_Jennifer_CurrentStage < 590) C012_AfterClass_Jennifer_CurrentStage = 560;\n\t\tif (C012_AfterClass_Jennifer_CurrentStage >= 590) C012_AfterClass_Jennifer_CurrentStage = 593;\n\t\tOverridenIntroText = GetText(\"WinFightAgainstJennifer\");\n\t\tif (!GameLogQuery(CurrentChapter, CurrentActor, \"UnlockTraining\")) ActorChangeAttitude(0, 2);\n\t}\n}", "title": "" }, { "docid": "4e2afde3f6403092386965ecc8a8106b", "score": "0.532681", "text": "waitingState(){\n\n // If there are more than 1 player (DummyPlayer doesnt count) and the game isn't started or starting\n\n if(this.playerPool.activePlayers.length >2){\n\n this.gameState = STATE_COUNT_DOWN;\n console.log(\"Game starting.\");\n let game = this;\n this.gameStartTime = new Date().getTime();\n setTimeout(function(){\n game.lastTroopIncTime = new Date().getTime();\n game.gameState = STATE_RUNNING;\n game.gameSocket.emit('startGame');\n }, TIME_TILL_START, game);\n }\n }", "title": "" }, { "docid": "e769c8bf07f2dc70b125258f16937c14", "score": "0.5325193", "text": "function gameReady() {\r\n const user_name = document.querySelector('#user_account_name').value;\r\n gameChatSocket.send(JSON.stringify({\r\n 'ready': user_name\r\n }));\r\n // clear previous state\r\n $(\"#my-cards\").empty()\r\n $(\"#opponent-cards\").empty()\r\n $(\"#id_result_div\").empty()\r\n\r\n // disable ready btn\r\n $(\"#game-ready\").addClass(\"disabled\")\r\n // update ready status\r\n me_ready = true\r\n\r\n if (me_ready && opponent_ready && !hasStart) {\r\n gameStart()\r\n hasStart = true\r\n }\r\n}", "title": "" }, { "docid": "8376f6d2d780b5a8515bbc1e904b3b57", "score": "0.5324156", "text": "isFinished() {\n if(this.noMoreTurns()||this.getWinner()!==null)\n return true;\n else\n return false;\n\n }", "title": "" }, { "docid": "21209e46d169098210fe051aa23a0cee", "score": "0.5321913", "text": "function ifComplete() {\r\n\t\t\t\t\tif (isFinished == false) {\r\n\t\t\t\t\t\tisFinished = true;\r\n\r\n\t\t\t\t\t\t// show the flag animation when a car reaches the finish line\r\n\t\t\t\t\t\tfinishedImage.attr('src', 'Assets/img/finish.gif');\r\n\r\n\t\t\t\t\t\t// add a background shadow effect while the flag animation is on\r\n\t\t\t\t\t\t$('#raceTrack').addClass('shadow');\r\n\r\n\t\t\t\t\t\t// timeout function for removal of flag animation and enable the buttons\r\n\t\t\t\t\t\tsetTimeout(function () {\r\n\r\n\t\t\t\t\t\t\t// remove flag animation and background shadow\r\n\t\t\t\t\t\t\tfinishedImage.attr('src', '');\r\n\t\t\t\t\t\t\t$('#raceTrack').removeClass('shadow');\r\n\r\n\t\t\t\t\t\t\t// set buttons to enable when the animation and race finish\r\n\t\t\t\t\t\t\traceBtn.prop(\"disabled\", false);\r\n\t\t\t\t\t\t\trestartBtn.prop(\"disabled\", false);\r\n\t\t\t\t\t\t}, 3500);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tfinishedIn = 'second';\r\n\t\t\t\t\t}\r\n\t\t\t\t}", "title": "" }, { "docid": "b8ed81569c25df4f373612302442a228", "score": "0.53158754", "text": "function C007_LunchBreak_Natalie_EndLunch() {\r\n C007_LunchBreak_ActorSelect_NatalieAvail = false;\r\n}", "title": "" }, { "docid": "9a6c09d7514892cb330c2f52ef446aeb", "score": "0.53146", "text": "function C012_AfterClass_Bed_MasturbateUp() {\n\tCurrentTime = CurrentTime + 50000;\t\t\n\tif (CurrentTime >= C012_AfterClass_Bed_NextPossibleOrgasmTime) C012_AfterClass_Bed_PleasureUp++;\n\telse OverridenIntroText = GetText(\"NotInTheMood\");\n}", "title": "" }, { "docid": "475a0566f264f68647142d290b90f095", "score": "0.53142756", "text": "function congratulate(player)\r\n {\r\n if(player == _BOTH)\r\n {\r\n message = \"We have a draw. You both are good players.\";\r\n $(\".result\").css('color', 'white');\r\n }\r\n else\r\n {\r\n symbol = playerSymbol(player);\r\n message = 'Congratulations! <span class=' + symbol + '> Player' + player + '</span> won the game.';\r\n $(\".result\").css('color', 'gold');\r\n }\r\n\r\n $(\".result\").html('<p>' + message + '</p>');\r\n $(\".result\").css('visibility', 'visible');\r\n $(\".result\").effect('slide');\r\n }", "title": "" }, { "docid": "2c326e08af064e54658a1f90ec899ca4", "score": "0.53101903", "text": "function C012_AfterClass_Bed_MasturbateDown() {\n\tCurrentTime = CurrentTime + 50000;\n\tif (CurrentTime >= C012_AfterClass_Bed_NextPossibleOrgasmTime) {\n\t\tif (Common_PlayerChaste) OverridenIntroText = GetText(\"Chaste\");\n\t\telse {\n\t\t\tC012_AfterClass_Bed_PleasureDown++;\n\t\t\tif ((C012_AfterClass_Bed_PleasureUp >= C012_AfterClass_Bed_MasturbationRequired) && (C012_AfterClass_Bed_PleasureDown >= C012_AfterClass_Bed_MasturbationRequired)) {\n\t\t\t\tC012_AfterClass_Bed_CurrentStage = 110;\n\t\t\t\tOverridenIntroText = GetText(\"GettingClose\");\n\t\t\t}\n\t\t}\n\t}\n\telse OverridenIntroText = GetText(\"NotInTheMood\");\n}", "title": "" }, { "docid": "e60fac3017d6616347baf0e40f573e12", "score": "0.530935", "text": "function hasWon() {\n\t\tcontext.fillStyle = \"#F9C328\";\n\t\tcontext.textAlign=\"center\";\n\t\tcontext.shadowOffsetX = quantum/5\n\t\tcontext.shadowOffsetY = quantum/5\n\t\tcontext.shadowColor = \"black\"\n\t\tcontext.shadowBlur = quantum/5\n\t\tcontext.font = 2*quantum + \"px Bangers, cursive\";\n\t\tcontext.fillText(\"You scored \" + pacmans[0].score + \" points.\",context.canvas.width/2,context.canvas.height/2 + 2.5*quantum);\n\t\tcontext.font = \"bold \" + 3.5*quantum + \"px Bangers, cursive\";\n\t\tcontext.fillText(\"YOU WON !! \",context.canvas.width/2, context.canvas.height/2 - 3*quantum);\n\t}", "title": "" }, { "docid": "8f181275d35157a27456a149bd3cd91e", "score": "0.530899", "text": "allQuestCompleted() {\n return !this.incompleteQuests().length;\n }", "title": "" }, { "docid": "3089580328779f639e52331b24c7c62b", "score": "0.53045416", "text": "function weaponSystem()\n{\n if(battle===true)\n {\n buttonStart_ControlRoom.style.display='none'\n buttonWeaponSystem_ControlRoom.style.display='block'\n advanceTalkCounter=920;\n advanceTalk();\n }\n else\n {\n advanceTalkCounter=916;\n advanceTalk();\n }\n}", "title": "" }, { "docid": "4f0cfde00423d3c58d099e367c8b2d6f", "score": "0.53017205", "text": "function swordQuest() { // Quest ID: 2\n\tif (CDs[2].t < 0 && gold >= CDs[2].price) {\n\t\tgold -= CDs[2].price;\n\t\tswords.bias = Math.floor( swords.bias * 1.12);\n\t\tCDs[2].t = 45;\n\t}\n}", "title": "" }, { "docid": "406641949099c4bc817338398d32c942", "score": "0.5301005", "text": "function fight(){\n\t\t//Inside the fight function\n\t\tconsole.log(\"Fight Function Starts Here!\");\n\t\t\t\t\tif(results === \"No Winner!\"){\n\t\t\t\t\t\n\t\t//This calls the Kabal object for its health and name \n\t\tfighterOne_txt.innerHTML = Kabal[0].name + \": \" + Kabal[0].health;\n\t\n\t\t//This calls the Kratos object for its health and name \n\t\tfighterTwo_txt.innerHTML = Kratos[0].name + \": \" + Kratos[0].health;\n\t\t}else{\n\t\tfighterOne_txt.innerHTML = results;\n\t\tfighterTwo_txt.innerHTML = \"\";\n\t\t\n\t\t//This disables the button so it stops being clickable\n\t\tbutton.removeEventListener(\"click\", fight, false);\n\t\t\n\t\t//This uses querySelector to find the button\n\t\tdocument.querySelector(\".buttonblue\").innerHTML = \"Finished!\";\n\t\t\n\t\t}//End of else \n\t}", "title": "" }, { "docid": "4ec70c5642f55de73de7f0d823815fea", "score": "0.53007853", "text": "function C012_AfterClass_Amanda_TestBedSarah() {\n\tif (!ActorSpecificIsRestrained(\"Amanda\") && !ActorSpecificIsRestrained(\"Sarah\") && !ActorSpecificIsGagged(\"Amanda\") && !ActorSpecificIsGagged(\"Sarah\") && !GameLogQuery(CurrentChapter, \"Amanda\", \"NextPossibleOrgasm\") && !GameLogQuery(CurrentChapter, \"Sarah\", \"NextPossibleOrgasm\")) {\n\t\tOverridenIntroText = GetText(\"AcceptGoToBedWithSarah\");\n\t\tC012_AfterClass_Amanda_CurrentStage = 823;\n\t}\n}", "title": "" }, { "docid": "ef821507c8c2b0e962d8188f59ae1513", "score": "0.52983075", "text": "function C012_AfterClass_Roommates_Knock() {\n\t\n\t// Amanda is available after 21:00\n\tCurrentTime = CurrentTime + 50000;\n\tif ((CurrentTime >= 21 * 60 * 60 * 1000) && !GameLogQuery(CurrentChapter, \"Amanda\", \"EnterDormFromLibrary\") && !GameLogQuery(CurrentChapter, \"Amanda\", \"EnterDormFromRoommates\")) {\n\t\tOverridenIntroText = \"\";\n\t\tActorLoad(\"Amanda\", \"Dorm\");\n\t\tLeaveIcon = \"\";\n\t\tif (ActorGetValue(ActorLove) >= 10) ActorSetPose(\"Happy\");\n\t\tif (ActorGetValue(ActorLove) <= -10) ActorSetPose(\"Angry\");\n\t\tActorSetCloth(\"Pajamas\");\n\t\tC012_AfterClass_Roommates_CurrentStage = 100;\n\t}\n\n\t// Sarah is available before 20:00\n\tif ((CurrentTime < 20 * 60 * 60 * 1000) && !GameLogQuery(CurrentChapter, \"Sarah\", \"EnterDormFromRoommates\"))\n\t\tif (!GameLogQuery(CurrentChapter, \"Sarah\", \"IsolationStranded\") || GameLogQuery(CurrentChapter, \"Sarah\", \"IsolationRescue\")) {\n\t\t\tOverridenIntroText = \"\";\n\t\t\tActorLoad(\"Sarah\", \"Dorm\");\n\t\t\tLeaveIcon = \"\";\n\t\t\tif (ActorGetValue(ActorLove) >= 10) ActorSetPose(\"Happy\");\n\t\t\tif (ActorGetValue(ActorLove) <= -10) ActorSetPose(\"Angry\");\n\t\t\tif (ActorGetValue(ActorSubmission) >= 10) ActorSetPose(\"Shy\");\n\t\t\tif (ActorGetValue(ActorSubmission) <= -10) ActorSetPose(\"Cocky\");\n\t\t\tActorSetCloth(\"BrownDress\");\n\t\t\tC012_AfterClass_Roommates_CurrentStage = 200;\n\t\t}\n\t\n}", "title": "" }, { "docid": "269d29c93745f3fa44f092919b6218d3", "score": "0.5297958", "text": "function C010_Revenge_SidneyJennifer_MasturbateJennifer() {\n\n\t// Doesn't work if she's wearing a chastity belt, with the egg and 3 tries, she will orgasm\n\tCurrentTime = CurrentTime + 50000;\n\tOverridenIntroImage = \"\";\n\tif (!ActorIsChaste()) {\n\t\tC010_Revenge_SidneyJennifer_MastubateCount++;\n\t\tif (ActorHasInventory(\"VibratingEgg\")) {\n\t\t\tif ((C010_Revenge_SidneyJennifer_MastubateCount >= 3) && !C010_Revenge_SidneyJennifer_OrgasmDone) {\n\t\t\t\tActorAddOrgasm();\n\t\t\t\tActorChangeAttitude(1, 0);\n\t\t\t\tC010_Revenge_SidneyJennifer_OrgasmDone = true;\n\t\t\t\tOverridenIntroImage = \"HallwayFloorOrgasm.jpg\";\n\t\t\t\tOverridenIntroText = GetText(\"MasturbateJenniferOrgasm\");\n\t\t\t} else OverridenIntroText = GetText(\"MasturbateJenniferEgg\");\n\t\t} else OverridenIntroText = GetText(\"MasturbateJenniferNoEgg\");\n\t}\n\n}", "title": "" }, { "docid": "8484a8bdc4725aed9f588ce796885c2b", "score": "0.529753", "text": "function C010_Revenge_SidneyJennifer_StartFight() {\n\t\t\n\t// Sets the fight difficulty\n\tvar SidneyDifficulty = \"Hard\";\n\tvar JenniferDifficulty = \"Normal\";\n\tif (ActorSpecificGetValue(\"Jennifer\", ActorSubmission) < 0) JenniferDifficulty = \"Hard\";\n\n\t// Launch the double fight\n\tC010_Revenge_SidneyJennifer_IntroText = \"\";\n\tDoubleFightLoad(\"Sidney\", SidneyDifficulty, \"Punch\", \"Jennifer\", JenniferDifficulty, \"Punch\", \"Hallway\", \"C010_Revenge_SidneyJennifer_EndFight\");\n\t\n}", "title": "" }, { "docid": "c35e6908c9ea122f3f45d61bb271d1c7", "score": "0.5297366", "text": "function doThings(){\n //gui.writePlayerLoc(\"Player loc: \" + tempPoint);\n gui.writePlayerLoc(\"Fought: \" + fought[xPosPlayer][yPosPlayer]);\n gui.writePlayerPos(\"Player pos: \" + xPosPlayer + \",\" + yPosPlayer);\n \n //a touch ticker, acts as a delay, so that events aren't constantly being fired\n touchTicker++;\n \n //loops through the city array to check if the player is in a city\n for(var i=0;i<cityArr.length;i++){\n if(xPosPlayer=== cityArr[i][0] && yPosPlayer === cityArr[i][1])\n {\n inCity = true;\n //break since we're in a city and need to fight, no use checking the rest\n break;\n }else{\n inCity = false;\n } \n }\n\n //check if the player is in a city\n if(inCity){\n gui.writeBattleStatus(\"In city\");\n gui.hideDebug();\n //check if the battle variable is null(has never been started)\n if(battle){\n //check if there is already a battle underway\n if(!battle.hasStarted()){\n //check if a battle can start\n if(battle.canStart()){\n //check if the player has already fought here\n if(fought[xPosPlayer][yPosPlayer]){\n \n }else{\n //make a new enemy\n enemy = new Enemy();\n //give the enemy random stats\n enemy.ranStats();\n //make a new battle\n battle = new Battle();\n //hide the overworld\n world.hideOverworld();\n //set the input as in a battle, so that the player does not move around in the overworld\n input.intoBattle();\n //start the battle\n battle.start();\n //pause the main music\n music.pause();\n //set the main music to 0(start)\n music.currentTime = 0;\n //play the battle music\n battleMusic.play();\n }\n }\n }\n }else{\n //check if the player has fought on the current tile\n if(fought[xPosPlayer][yPosPlayer]){\n \n }else{\n //make a new enemy\n enemy = new Enemy();\n //give the enemy random stats\n enemy.ranStats();\n //make a new battle\n battle = new Battle();\n //hide the overworld\n world.hideOverworld();\n //set the input as in a battle, so that the player does not move around in the overworld\n input.intoBattle();\n //start the battle\n battle.start();\n //pause the main music\n music.pause();\n //set the main music to 0(start)\n music.currentTime = 0;\n //play the battle music\n battleMusic.play();\n }\n }\n //check if the battle variable null\n if(battle){\n //check if the enemy is not undefined\n if(typeof enemy !== 'undefined'){\n //check if the enemy is dead\n if(enemy.isDead()){\n //set the current tile as fought\n fought[xPosPlayer][yPosPlayer] = true;\n //if a battle has been started\n if(battle.hasStarted()){\n //set the battle as ended\n battle.setEnded();\n //set the input as out of battle, to let the player move around\n input.outOfBattle();\n //set the main musi's time to 0(start)\n music.currentTime = 0;\n }\n //play the main music\n music.play();\n //pause the battle music\n battleMusic.pause();\n //set the battle music's time to 0\n battleMusic.currentTime = 0;\n //\n }else{\n //show the battle GUI\n battle.showGUI();\n //refresh the battle GUI's active button\n battle.refreshActiveBtn();\n //tick the player's action timer\n battle.tickTimer();\n //tick the enemy's action timer\n battle.tickEnemyTimer();\n //cycle through the enemies AI loop\n enemy.enemyLoop();\n }\n }\n }\n }else{\n }\n\n //check if the tick is higher than or equal to defined walk speed\n if(canWalkTick >= walkSpeed){\n //set walk to true\n walk = true;\n //console.log(\"can walk now\");\n }else{\n //set walk to false and increment the tick\n walk = false;\n canWalkTick++;\n }\n gui.writeWalkTick(\"Walk tick: \" + canWalkTick);\n\n//check if the mouse if down\n if(mouseDown){\n //do whatever the actions are\n input.doKeyActions();\n }else{\n //reset the direction boxes\n upBox.graphics.clear();\n leftBox.graphics.clear();\n downBox.graphics.clear();\n rightBox.graphics.clear();\n actionBox.graphics.clear();\n upBox.graphics.beginFill(boxFillCol).drawRoundRect(0,0,boxW,boxH,boxRound);\n upBox.graphics.setStrokeStyle(boxStrokeTh, \"round\").beginStroke(boxStrokeCol).drawRoundRect(0,0,boxW,boxH,boxRound);\n leftBox.graphics.beginFill(boxFillCol).drawRoundRect(0,0,boxW,boxH,boxRound);\n leftBox.graphics.setStrokeStyle(boxStrokeTh, \"round\").beginStroke(boxStrokeCol).drawRoundRect(0,0,boxW,boxH,boxRound);\n downBox.graphics.beginFill(boxFillCol).drawRoundRect(0,0,boxW,boxH,boxRound);\n downBox.graphics.setStrokeStyle(boxStrokeTh, \"round\").beginStroke(boxStrokeCol).drawRoundRect(0,0,boxW,boxH,boxRound);\n rightBox.graphics.beginFill(boxFillCol).drawRoundRect(0,0,boxW,boxH,boxRound);\n rightBox.graphics.setStrokeStyle(boxStrokeTh, \"round\").beginStroke(boxStrokeCol).drawRoundRect(0,0,boxW,boxH,boxRound);\n actionBox.graphics.beginFill(boxFillCol).drawRoundRect(0,0,boxW,boxH,boxRound);\n actionBox.graphics.setStrokeStyle(boxStrokeTh, \"round\").beginStroke(boxStrokeCol).drawRoundRect(0,0,boxW,boxH,boxRound);\n //part of the reference for sprite sheets\n //would stop the sprite animtion\n //animation.stop();\n return;\n }\n}", "title": "" }, { "docid": "9172b7e437d0f17ec2f8882267b3212c", "score": "0.52931273", "text": "function conclusionConditions() {\n //If you score 6 points, you win\n if (bubblePoints >= 6) {\n state = `poppinChampion`;\n }\n //If your lives reaches 0, game over\n if (lives <= 0) {\n state = `bubblePoppinBaby`;\n }\n}", "title": "" }, { "docid": "c7c3501173b76d2af9dbb026861c5a81", "score": "0.5287193", "text": "function tie() {\n hero.classList.add('defendRun');\n heroBlockSound.play();\n monsta.classList.add('monstaDefend');\n disallowDefendClick();\n setTimeout(function() {\n hero.classList.remove('defendRun');\n monsta.classList.remove('monstaDefend');\n allowDefendClick();\n }, 1400);\n}", "title": "" }, { "docid": "21fe4f81481a9e32f6175a6a0c702e89", "score": "0.528626", "text": "function onReady() {\n\t\t\t \tsendNowPlaying();\n\t\t\t \tsendCurState();\t\n\t\t\t }", "title": "" }, { "docid": "e09c3d6f6135a8dcafb0be4ab0a505f3", "score": "0.528527", "text": "function playTurn() {\r\n\tif(battleInProgress == 0) {\r\n\t\tvar playbutton = document.getElementById('app377144924760_playbutton');\t\r\n\t\tclickElement(playbutton);\r\n\t\tbattleInProgress = 1;\r\n\t\t// Start loop to check for battle status after 3 seconds\r\n\t\t// There is a loop within this to check if AJAX has loaded\r\n\t\tsetTimeout(loopWhileBattle, 3000);\r\n\t}\r\n}", "title": "" }, { "docid": "bad07cfe5e77dc1a1b23fe8aa0b63026", "score": "0.5284949", "text": "function SarahFightSophie() {\n\tSophie.Name = \"Sophie\";\n\tKidnapStart(Sophie, SarahBackground, 10, \"SarahFightSophieEnd()\");\n}", "title": "" }, { "docid": "bed3734c11a31aa5b8cd3f7b6b308c01", "score": "0.5282763", "text": "function completeMasturbatePhase () {\n /* strip the player with the lowest hand */\n startMasturbation(recentLoser);\n}", "title": "" }, { "docid": "c246abe46c71f4560f18eb142f12631e", "score": "0.5281875", "text": "function C007_LunchBreak_Natalie_Ungag() {\r\n CurrentTime = CurrentTime + 60000;\r\n ActorRemoveInventory(\"TapeGag\");\r\n if (ActorHasInventory(\"Ballgag\")) {\r\n ActorRemoveInventory(\"Ballgag\");\r\n PlayerAddInventory(\"Ballgag\", 1);\r\n }\r\n if (ActorHasInventory(\"ClothGag\")) {\r\n ActorRemoveInventory(\"ClothGag\");\r\n PlayerAddInventory(\"ClothGag\", 1);\r\n }\r\n C007_LunchBreak_Natalie_IsGagged = false;\r\n C007_LunchBreak_Natalie_TimeLimit()\r\n}", "title": "" } ]
45e760b6170803b873485b5468a127fc
Pushes a card into the deck.
[ { "docid": "145c16dba4fe9240382f3c556fb28310", "score": "0.7329471", "text": "add(card) {\n this.card.push(card);\n }", "title": "" } ]
[ { "docid": "eb7eb2c327dea00a1b06259f96db92d2", "score": "0.76826245", "text": "addCard(card) {\n\t\tthis.decks.new.push(card);\n\t}", "title": "" }, { "docid": "caff9a8d3e8080e293732570566987f8", "score": "0.7552048", "text": "function decksCard (clickCard) {\n activeDeck.push(clickCard);\n}", "title": "" }, { "docid": "5bde0940ad57b6f4fc6733b32fcfb24c", "score": "0.7492213", "text": "add(card) {\n\t\tthis.cards.push(card);\n\t}", "title": "" }, { "docid": "6e9cbcd0debba25349c2045f91bff455", "score": "0.74596065", "text": "place(_card) {\n\t\tthis._cards.push(_card);\n\t}", "title": "" }, { "docid": "bf34fcacb48ca71b13aecccdc50d80b3", "score": "0.74199605", "text": "function addCard(cardToPush) {\n openList.push(cardToPush);\n }", "title": "" }, { "docid": "5ae4fc4a4d6706aa8611e4fc5cb3bc36", "score": "0.73517317", "text": "addCard(card) {\n this.hand.push(card);\n this.cardsLeft++;\n }", "title": "" }, { "docid": "b5606ed44ce7f43c66c1c440fe5145ed", "score": "0.71172327", "text": "function addCardToHand(deck, card) {\n deck.push(card)\n if(card.rank == 'Ace' && getPoints(deck) > 21) {\n card.switched = true\n }\n return deck;\n}", "title": "" }, { "docid": "98188b6b814839333106d440749b7d9e", "score": "0.70357025", "text": "function add(card) {\n card.id = ++storage.maxId;\n storage.cards.push(card);\n }", "title": "" }, { "docid": "95c08b4d1b577379969f745cabbc72b6", "score": "0.6924521", "text": "addToHand(card) {\n this.hand.push(card);\n }", "title": "" }, { "docid": "53b08a274bf055556eed713fe536ece1", "score": "0.6914823", "text": "function nextCard() {\n var card = deck.pop();\n players[currentPlayer].Hand.push(card);\n\n printCard(card, currentPlayer);\n printCardTotal();\n cardsLeft();\n losingHand();\n}", "title": "" }, { "docid": "447016458959b648cc9d7a243eae3f0b", "score": "0.69057566", "text": "add(card){\r\n this.cards.push(card)\r\n }", "title": "" }, { "docid": "447016458959b648cc9d7a243eae3f0b", "score": "0.69057566", "text": "add(card){\r\n this.cards.push(card)\r\n }", "title": "" }, { "docid": "83999bf41cc5ad95e2cff44836a205eb", "score": "0.68926615", "text": "draw(card) {\n let newHand = this._hand\n newHand.push(card)\n this._hand = newHand\n }", "title": "" }, { "docid": "a1fbfa07e7a53b2b1898e1d499c7d9c9", "score": "0.6842932", "text": "function drawCard(deck, hand) {\n let card = deck.shift();\n hand.push(card);\n}", "title": "" }, { "docid": "f36f97900e29fd3a7d4fe8e66aebe9a7", "score": "0.68424726", "text": "function drawCard()\n{\t\n\t//hand gets the last card from the deck\n\thand.push(deck.pop());\n}", "title": "" }, { "docid": "0e16ef6b474ae83f70426cb22f925dd4", "score": "0.6804058", "text": "function addcard() {\n if (!fillornotfill()) {\n window.confirm(\"Tu n'as remplie aucune carte !!\");\n }\n else {\n deckname.readOnly = true;\n console.log(cmaindeck);\n\n\t\t\tvar carte = new Flash(terme.value, def.value, false, deckname.value);\n\n\t\t\tdeckname.style = \"border: #282A36\";\n\t\t\tcmaindeck.children.item(1).textContent = carte.deck;\n\t\t\tterme.value = \"\";\n\t\t\tdef.value = \"\";\n\t\t\tnum.textContent = \"No.\" + (deck.length + 2);\n\t\t\tcmaindeck.children.item(2).textContent = deck.length + 1;\n\n\t\t\tif (selected) {\n\t\t\t\tconsole.log(\"yeah\");\n\t\t\t\tmemdeck[yugi].push(carte);\n\t\t\t\tconsole.log(memdeck);\n\t\t\t\tupload();\n\t\t\t} else {\n\t\t\t\tdeck.push(carte);\n\t\t\t}\n\n\t\t\t//console.log(yugi);\n }\n\n\t\t\t\n\t\t\t\n\t\t\n}", "title": "" }, { "docid": "f8dfdb72451caae392eef0238b43eb2f", "score": "0.67662275", "text": "queueShuffle(_card) {\n\t\tthis._toShuffle.push(_card);\n\t}", "title": "" }, { "docid": "7409899f355f3a21f33a14cc03aa7733", "score": "0.67585427", "text": "push(element) {\n this.cardsData.push(cardsDataFactory(element, this.limits))\n return super.push(element)\n }", "title": "" }, { "docid": "d7dee19fc6d440f257ef361d7031c0ea", "score": "0.6680684", "text": "function newCard() {\n if (snapDeck.length === 0) {\n endGame()\n }\n const newCard = snapDeck.pop()\n currentCard.innerHTML = `Current card is ${newCard.rank} and suit ${newCard.suit}`\n if (snapPot.length >= 1) {\n const last = snapPot.length - 1\n lastCard.innerHTML = `Last card is ${snapPot[last].rank} and suit ${snapPot[last].suit}`\n }\n snapPot.push(newCard)\n deckNum.innerHTML = snapDeck.length\n snapPotNum.innerHTML = snapPot.length\n error.innerHTML = ''\n }", "title": "" }, { "docid": "290d3c4af4d9665e2567f1a265be12d7", "score": "0.6668057", "text": "addCard(card,i) {\n this.stacks[i].push(card);\n }", "title": "" }, { "docid": "2879716422d362c92ed75162049396ff", "score": "0.6667315", "text": "newCard() {\n var order = this.get('backlog').get('length');\n var createdCard = this.get('store').createRecord('card', {\n title: 'Story #' + (order + 1),\n order: order\n });\n createdCard.save();\n this.get('backlog').pushObject(createdCard);\n }", "title": "" }, { "docid": "742492e7d4bebd9c30de5aa9f882ef27", "score": "0.65686107", "text": "queueDiscard(_card) {\n\t\tthis._toDiscard.push(_card);\n\t}", "title": "" }, { "docid": "3b69eb7326e40fd3b46311e3cf451193", "score": "0.6565996", "text": "addCard(card, handNumber) {\r\n this.hands[handNumber].addCard(card);\r\n }", "title": "" }, { "docid": "444fc4b5957f6517efa60547a5703692", "score": "0.6565178", "text": "function addCard(card, cardPrototype){\n cardPrototype.find('.card-title').text(card.title);\n cardPrototype.find('.card-text').text(card.text);\n let viewCardButton = cardPrototype.find('.view-card-button');\n viewCardButton.click(cardClickHandler);\n viewCardButton.data(\"cid\", card.cid);\n let collabCardButton = cardPrototype.find('.collaborate-card-button');\n collabCardButton.data(\"cid\", card.cid);\n collabCardButton.click(collabClickHandler);\n cardPrototype.data(\"cid\", card.cid);\n cardPrototype.data(\"triage\", card.triage);\n cardPrototype.draggable({ cursor : 'grabbing', helper: 'clone', appendTo : '#body-container' });\n cards.push(cardPrototype);\n cardPrototype.appendTo(triageContainers[card.triage]);\n}", "title": "" }, { "docid": "49030c8d3e9fbabc8a20ef13c8d45277", "score": "0.64993703", "text": "addAt(card, index){\r\n // Remove 0 items from the array at the index position, then insert\r\n this.cards.splice(index, 0, card);\r\n }", "title": "" }, { "docid": "9614e7f61b890c4042ea4ba9c4b36eaf", "score": "0.64975566", "text": "addCard(card){\r\n let slot = this.newSlot();\r\n slot.placeCard(card);\r\n }", "title": "" }, { "docid": "b932b1702d0076d19b7a7da8ec2ac06c", "score": "0.647877", "text": "addCard(card) {\n this.cards = [...this.cards, card];\n }", "title": "" }, { "docid": "a845ff85311646c07e1bb3e16348d5bc", "score": "0.6464712", "text": "function addToOpenCardList(card){\n openCards.push(card);\n}", "title": "" }, { "docid": "2ca73c0b285f5ade25e22cd32bb37af9", "score": "0.6450828", "text": "addCard() {}", "title": "" }, { "docid": "6735f27d88c52e9edf4543fcf211e150", "score": "0.642225", "text": "function addCardToQueue(card){\r\n\t\tconsole.log('new card name: ' + card);\r\n\r\n\t\t// Position the new card\r\n\t\tvar spacing = $(\".draggable\").outerHeight(true); // spcaing between cards in px, same for all cards\r\n\t\t\r\n\t\t// Move all the cards down\r\n\t\t$(\".undropped_card\").each(function(){\r\n\t\t\tvar o_offset = $(this).offset();\r\n\t\t\t$(this).offset({ top: o_offset.top + spacing, left: o_offset.left})\r\n\t\t})\r\n\t\t\r\n\t\t// Create new card and prepend to list\t\r\n\t\t// Use underscore templates to clean this up\r\n\t\tvar ncard = '<tr><td><textarea>' + card + '</textarea></td><td><div class=\"draggable ui-widget-content undropped_card shadow\"></div></td></tr>';\r\n\t\tvar added = $(ncard).prependTo($('#cards_container'));\r\n\t\tadded.find(\"div\").draggable({ revert: \"invalid\" });\r\n\t\t\r\n\t\t// Realign\r\n\t\t// This doesn't seem to be working here like it does in the command line\r\n\t\t$('#cards_container div').each(function(k,v){v.style.top = 0});\r\n\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\tconsole.log(\"n_undropped = \" + $(\".undropped_card\").length)\r\n\t}", "title": "" }, { "docid": "13cca859d32b4d018c2f2275cccd2e53", "score": "0.63581294", "text": "insert(_card, _index) {\n\t\tthis._cards.splice(_index, 0, _card);\t\t\n\t}", "title": "" }, { "docid": "14ccf6a0981da9df34805f6970f86ccb", "score": "0.6329296", "text": "addCard(card) {\n console.log(this);\n this.cards.push(card);\n }", "title": "" }, { "docid": "b063066c1ad484cd4c2c70a07e0c3629", "score": "0.6308277", "text": "drawCard() {\n let card = this.randomCard(this.activePlayer);\n this.hands[this.activePlayer].push(card);\n }", "title": "" }, { "docid": "01bba5542d07efda7f477291757ad5cd", "score": "0.62929255", "text": "function add_card(card) {\n let node = document.createElement('div');\n node.className = `card ${card}`;\n node.addEventListener('click', on_card_click);\n for (let c of player_hand.children) {\n if (card_comparator(card, get_card_name(c)) < 0) {\n // Found the first card that comes after this card\n return player_hand.insertBefore(node, c);\n }\n }\n // Card goes at end\n return player_hand.appendChild(node);\n}", "title": "" }, { "docid": "164f9f42bae7a212df3db00cc431c785", "score": "0.6283093", "text": "function addCard(db, front, back, tags, idDeckFK, callback) {\n var sql = \"INSERT INTO `card` (`front`, `back`, `tags`, `state`, `idDeckFK`) VALUES (?, ?, ?, 'New', ?)\";\n db.run(sql, [front, back, tags, idDeckFK], callback);\n }", "title": "" }, { "docid": "6c4e24097d759dfb26ff3533106e5e61", "score": "0.6281464", "text": "replace(){\r\n this.deck.unshift(this.dealt_cards.shift());\r\n }", "title": "" }, { "docid": "b78a8c4fd8c1a4e2088003e82654fe23", "score": "0.62803966", "text": "draw(game_deck) {\n // Adds card to hand and removes card from deck\n // let card = game_deck[0];\n // this.hand.push(card);\n // game_deck.shift();\n this.hand.push(game_deck.getCard());\n \n this.checkBust();\n }", "title": "" }, { "docid": "583e39a4f45adc265d399a6ff2e18d49", "score": "0.62708837", "text": "function handleAddCard() {\n // Create the card object\n const card = {};\n card.deckId = deckID;\n card.id = id;\n card.question = cardQuestion;\n card.answer = cardAnswer;\n // Dispatch action\n dispatch(saveCard(card));\n // Return to deck view\n navigation.push(\"Deck\", { id: deckID });\n }", "title": "" }, { "docid": "7add65161335eefcfcb00138949f68a7", "score": "0.62570953", "text": "function addToHand(numCards) { \n console.log(`Adding ${numCards} to decision deck.`) \n for(let i = 0; i < numCards; i++) {\n let card = gamestate.proxyAutomaState.deck.pop();\n gamestate.proxyAutomaState.hand.push(card);\n };\n}", "title": "" }, { "docid": "0a720d7985af4ca017b8e17841dab089", "score": "0.62523675", "text": "addCardPlayer(state, value) {\n state.currentCardPlayer.push(value);\n }", "title": "" }, { "docid": "cfcc89ba160a6eed43daebd1899af468", "score": "0.62480044", "text": "async addCard(cardName) {\n const body = {\n name: cardName\n }\n try {\n await api.post('/api/cards', body)\n this.getDeckList()\n } catch (error) {\n logger.error(error)\n }\n }", "title": "" }, { "docid": "f2aa55a513d581a1aa664c53ed4745d5", "score": "0.6243558", "text": "function addCardToHand(card, playerId) {\n var handList = $('.hand-list[player=' + playerId + ']');\n renderCard(card, handList, false, playerId);\n}", "title": "" }, { "docid": "986f711a9d36c8be21ab4198dd1f7ae4", "score": "0.6162959", "text": "function draw(){\n let randomCard = Math.floor(Math.random() * myDeck.deck.length)\n let drawnCard = myDeck.deck.splice(randomCard, 1)\n activePlayerHand.push(drawnCard)\n}", "title": "" }, { "docid": "e99ed4c7dc3b50c329bdef7e97b2a5d9", "score": "0.6146788", "text": "function insertToListOfCardsToFlush(cardToFlush){\n ListOfCardsToFlush.push(cardToFlush);\n}", "title": "" }, { "docid": "8c0d3b322c8c54def366223b7a29f89e", "score": "0.612875", "text": "push(cards, orientation = FACE_UP) {\n for (let i = 0; i < cards.length; i++) {\n let card = cards[i];\n\n card.setOrientation(orientation);\n card.setPos(this.anchorX, this.anchorY);\n\n Array.prototype.push.call(this, card);\n }\n }", "title": "" }, { "docid": "f3533e0d9ac1466e4b4cae5f17848402", "score": "0.612591", "text": "addNewCard(card, listIndex) {\n this.trelloDataStore.addNewCard(card, listIndex);\n this.refreshData();\n }", "title": "" }, { "docid": "118e0dd70a797a26eb5bcf9342e7f22f", "score": "0.60964316", "text": "function cardStack(){\n this.cardData = [];\n this.add = push;\n this.draw = pop;\n this.top = 0;\n}", "title": "" }, { "docid": "720200464bdbfa82098df8f3c21ec0e6", "score": "0.6071652", "text": "function dealCard(arg){\n var max = liveDeck.length-1;\n var cID = Math.round(Math.random()*max);\n var card = liveDeck[cID];\n liveDeck.splice(cID,1);\n hands[arg].cards.push(card);\n }", "title": "" }, { "docid": "0dca3edf27a23ebbf078f49c3519a456", "score": "0.6063734", "text": "function dealPlayerCard() {\n console.log(shuffledDeck);\n let playerCard = shuffledDeck.pop();\n player.push(playerCard);\n playerCards.appendChild(playerHand)\n checkForAces();\n}", "title": "" }, { "docid": "98abbcd46dcacebbd01d3b5d9dba0c32", "score": "0.60498327", "text": "deal() {\n for (let i = 0; i < 26; i++) {\n let card1 = this.newDeck.cards.shift()\n let card2 = this.newDeck.cards.shift()\n this.player1.hand.push(card1)\n this.player2.hand.push(card2)\n }\n }", "title": "" }, { "docid": "4e2a9e9a9bbd3591f19ac6ad13c73ca3", "score": "0.60354584", "text": "function AddCard(card) {\n $('#deck').append(`<li class=\"card animated\"><i class=\"fa ${card}\"></i></li>`);\n }", "title": "" }, { "docid": "3a9802b33f4a8965444bbcc247f0bcee", "score": "0.60354495", "text": "handleAddCardClick() {\n const newCard = {\n id: null,\n term: '',\n definition: '',\n imageurl: ''\n }\n\n let cards = this.state.cards;\n cards.push(newCard);\n\n this.setState({\n cards\n });\n}", "title": "" }, { "docid": "8f6aa2f251ea26b111fdd323eb52a3cd", "score": "0.6013535", "text": "function drawCard(handContext){\r\n if (!drawEmpty){ // while the draw pile isn't empty\r\n //add a card from the draw pile to the given hand\r\n handContext.push(draw.cards.shift())\r\n //update the draw pile and arrows\r\n updatePiles()\r\n }\r\n return handContext\r\n}", "title": "" }, { "docid": "0dbddb76c90def8d2c9bbd90847667af", "score": "0.59959066", "text": "function cardPick(hand, element, hidden) {\n if (game.deck.length === 0) {\n cardDeck();\n };\n let temp = game.deck.shift();\n hand.push(temp);\n showCard(temp, element);\n if (hidden) {\n game.cardBack = $('<div>').addClass('cardB');\n element.append(game.cardBack);\n }\n }", "title": "" }, { "docid": "37c7bd58a741c819e2832dc4b92665a4", "score": "0.5995105", "text": "function pushCharacter(ch) {\n stack.push(ch);\n}", "title": "" }, { "docid": "3e6b9bb83c3ed24e930ab053f52776d2", "score": "0.5986239", "text": "addCard() {\n this.props.addCard(this.state.selectedCard);\n }", "title": "" }, { "docid": "b58fd442c66764b7a06d2f014b9ace2c", "score": "0.59723306", "text": "function pushCards() {\n setTimeout(function() {\n let popped = cards.splice(getRandomInt(), 1)\n $('#dc').append(`<div class = \"card large fade-in ${popped[0].card} deleteCards\"></div>`)\n dealerCards.push(popped[0]);\n dealerTotal = addDealerCards()\n dAce(dNumAces()) \n dealCards.play()\n if (dealerTotal < 17) {\n pushCards()\n }\n winner = checkWinner()\n }, 750)\n}", "title": "" }, { "docid": "81ddfdf74606a984fb1312d9a9522439", "score": "0.5934671", "text": "function returnCardsToDeck() {\n deck.push(player1Card);\n deck.push(player2Card);\n}", "title": "" }, { "docid": "695d94ebf586fbad3ad174e928f4a614", "score": "0.5913003", "text": "function add_flip_Card(card_select) {\n\n flipped.push(card_select);\n}", "title": "" }, { "docid": "93c64112d2f89d2872670c75679699ec", "score": "0.59047365", "text": "function drawCards(\n { state, dispatch },\n { cards = [], moreCardsCanBeDrawn, currentPhase }\n ) {\n state.playerCardsOnHand.push(...cards);\n if (!moreCardsCanBeDrawn) {\n dispatch(\"goToNextPhase\", { currentPhase });\n }\n }", "title": "" }, { "docid": "c3645f3f68c23cdb9bfe139daeff907c", "score": "0.5900811", "text": "function Deck() {\n this.deck = new Array();\n for (var i = 0; i < SUITS.length; i++) {\n for (var j = 0; j < RANKS.length; j++) {\n var card_to_add = new Card(SUITS[i], RANKS[j]);\n this.deck.push(card_to_add.getCard());\n }\n }\n}", "title": "" }, { "docid": "a60e8a288538844c2005a0be9029b52e", "score": "0.58880025", "text": "function dealCard(hand, elementID) {\n var card = deck.pop();\n hand.push(card);\n var imageUrl = getCardImageUrl(card);\n //var cardHtml = '<div class=\"card\">' + card.point + \" of \" + card.suit + '</div>';\n // images/' +card.point + '_of_' + card.suit+ '.png\n var cardHtml = '<img class=\"card\" src=\"' + imageUrl + '\"/>';\n $(elementID).append(cardHtml);\n}", "title": "" }, { "docid": "16e76a6ec6ca87f4f34ea096524240b0", "score": "0.58817816", "text": "function update(card) {\n let index = getIndexForId(card.id);\n\n if (index === null) {\n throw 'Cannot update, card not found';\n } else {\n let begin = storage.cards.slice(0, index),\n end = storage.cards.slice(index + 1);\n\n begin.push(angular.copy(card));\n storage.cards = begin.concat(end);\n }\n }", "title": "" }, { "docid": "a19df7444c9d7a24053fb54619515eaa", "score": "0.58754325", "text": "function drawCard() {\n return deck.shift();\n}", "title": "" }, { "docid": "84755224033b5d7047b12f52efb25e90", "score": "0.58482146", "text": "function saveCard(card) {\n\t\t\tif(typeof($localStorage.favList) == 'undefined'){\n\t\t\t\t$localStorage.favList = [];\n\t\t\t}\n\t\t\t$localStorage.favList.push(card);\n\n\t\t}", "title": "" }, { "docid": "9710bd8f670f6ace0b12a92fba2a51e3", "score": "0.5846978", "text": "function addToggledCard(clickTarget) {\r\n toggledCards.push(clickTarget);\r\n //console.log(toggledCards);\r\n}", "title": "" }, { "docid": "016e6e54e0033a67659301d7157a5a4d", "score": "0.5845367", "text": "function getNextCard() {\n return deck.shift();\n}", "title": "" }, { "docid": "b6a9dde14550654304589648d90f8a9c", "score": "0.5844203", "text": "play_card(card) {\n if (this._coreStateManager) {\n this._coreStateManager.submit_action('alg_play_acard', [this._player_name, card])\n }\n }", "title": "" }, { "docid": "bfa6bab12d814fdb66dd3bd9814d7acd", "score": "0.5839883", "text": "function moveCard(card, prevOwner, newOwner) {\n\tremoveCard(card, prevOwner)\n\thands[newOwner].push(card);\n\tif(prevOwner=='p1') {\n\t\tplay = [];\n\t}\n}", "title": "" }, { "docid": "31e7638cbbb92a4f6dd57ec70f639216", "score": "0.58390695", "text": "function addToCardList(cardIndex) {\n cardList.unshift(cardIndex);\n }", "title": "" }, { "docid": "62ecec3680c65d00c2cf47f8d759f342", "score": "0.5838656", "text": "function addCard(column, title, description, position) {\n // position = position || column.cards.length;\n var card = {title: title, description: description };\n $.ajax({\n method: \"POST\",\n url: \"/api/boards/\" +board.id +\"/columns/\" + column.id + \"/cards\",\n data: JSON.stringify(card),\n contentType: 'application/json',\n success: function(data, success) {\n column.cards = column.cards || [];\n column.cards.push(data);\n renderCard(data);\n }\n });\n // column.cards.push(card);\n // renderCard(card);\n return card;\n }", "title": "" }, { "docid": "e8f29d521102fef5acca59805d55e6a4", "score": "0.5837939", "text": "function push(stack, item) {\n if (stack.size < stack.capacity) {\n stack.storage.push(item);\n stack.size++;\n }\n}", "title": "" }, { "docid": "bd0dd39d747fe24d90314e4a549af20d", "score": "0.5833206", "text": "draw() {\n let currentArray = [...this.props.deck]\n let newCard = currentArray.shift();\n this.setState({ \n cards: [...this.state.cards, newCard]\n })\n }", "title": "" }, { "docid": "7946d674bbdb8d8717f7b2cd0f26a8e1", "score": "0.58310866", "text": "function dealCard(){\n\trandomNumberSuits();\n\trandomNumberDeck();\n\t// console.log(randomNumberSuitsOutput);\n\t// console.log(randomNumberDeckOutput);\n\tvar card = deck[randomNumberDeckOutput] + suits[randomNumberSuitsOutput];\n\ttempStorage.push(card);\n\t// console.log(card);\n\t// console.log(tempStorage[0]);\n\t// console.log(tempStorage);\n\t// $.each(deckStorage,function(i,value){\n\t\t// console.log(i)\n// console.log(deckStorage);\n// console.log(tempStorage);\n}", "title": "" }, { "docid": "e7d60e1783a072b586af093df60706c5", "score": "0.5827834", "text": "addCard(id) {\n var card = new Card(id);\n var cardSearch = this.findCard(id);\n\n if(cardSearch === null) {\n // card does not exist, add card to deck\n this.cards.push(card);\n console.log(\"Decklist.addCard(\"+ id + \") > '\" + card.name + \"' added to Decklist.cards\");\n } else if(cardSearch.amount === 1 && cardSearch.color === 'bronze') {\n // card does exist and is a bronze card increase amount to 2 (maximum)\n cardSearch.amount = 2;\n console.log(\"Decklist.addCard(\"+ id + \") > card.amount increased by 1\");\n } else {\n // card does exist but is a gold\n console.log(\"Decklist.addCard(\"+ id + \") > card.amount limit reached\");\n }\n this.renderDeck();\n }", "title": "" }, { "docid": "62c0969c22dd537f3602ba99ba6a81b5", "score": "0.5823217", "text": "function refillDeck() {\n // Zwischenspeichern der obersten Karte des Ablagestapels.\n let topCard = discardPileArray[discardPileArray.length - 1];\n discardPileArray.pop();\n // Alle Karten des Ablagestapels werden in das Deck geschrieben und dann aus dem Ablagestapel gelöscht.\n while (discardPileArray.length > 0) {\n deckArray.push(discardPileArray[discardPileArray.length - 1]);\n discardPileArray.pop();\n }\n discardPileArray.push(topCard);\n console.log('Ablagestapel wurde zum neuen Deck');\n shuffleDeck();\n updateHTML();\n}", "title": "" }, { "docid": "79073057c9ea59430e1621a3d12f4c81", "score": "0.577844", "text": "dealCards() {\n newDeck.deal(this.cardsInHand);\n }", "title": "" }, { "docid": "e4eebe2145167b283e3cae0898702421", "score": "0.5766711", "text": "push(item) {\n\t\tthis.stack.push(item);\n\t}", "title": "" }, { "docid": "f23d56316f9d58a8bfe846767fbfd368", "score": "0.5763879", "text": "addCard({ name, link }) {\n return fetch(this._baseUrl + '/cards', {\n headers: this._headers,\n method: \"POST\",\n body: JSON.stringify({\n name: name, \n link: link\n })\n })\n .then(res => res.ok ? res.json() : Promise.reject('Error! ' + res.statusText))\n }", "title": "" }, { "docid": "54df4b7bd09e8c307ef44d66222e80eb", "score": "0.57600284", "text": "function drawCard(e){\n e.preventDefault(); //we need this so the page does not refresh\n if(5<(myHand.length)){\n alert(\"hand is full\");\n }else{\n myHand.push(myDeck.shift()); //this removes the head and returns the head Array\n console.log(\"myHand is\");\n console.log(myHand);\n console.log(\"myDeck is\");\n console.log(myDeck);\n updateBoardHand();\n updateBoardMonsters();\n summonSound.play();\n\n }\n}", "title": "" }, { "docid": "b8aff1e03ee8389178f0a1b3ccccb7ee", "score": "0.57538295", "text": "addCardToDeck(obj, destination){\n\t\tlet cards = null;\n\t\tif (destination === \"user\") {\n\t\t\tcards = this.getUsersCards()\n\t\t}\n\t\telse if (destination === \"opponent\") {\n\t\t\tcards = this.getOpponentsCards();\n\t\t}\n\t\telse{\n\t\t\t//destination faulty\n\t\t\treturn false;\n\t\t}\n\n\t\tfor (var i = cards.length - 1; i >= 0; i--) {\n\t\t\tif (cards[i].cardId === obj.cardId) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tcards.push(obj);\n\t\tif (destination === \"opponent\") {\n\t\t\tthis.setOpponentsCardsLocalStorage();\n\t\t}\n\t\tthis.notifyObservers();\n\t}", "title": "" }, { "docid": "5d49f15104d9ba5b3475b667239cb24a", "score": "0.5751861", "text": "function addThreeCards(){\n if(this.deck.get_size() > 0){\n for(var i = 0; i < 3; i++){\n currentDeal.push(this.deck.draw_Card());\n }\n }\n}", "title": "" }, { "docid": "808ba71089ba819ac9b73aa52e93686f", "score": "0.57515496", "text": "push() {\n push();\n }", "title": "" }, { "docid": "c195995ea33f396d3f60cb98c69bab9e", "score": "0.5744035", "text": "function swapCard(){\n //empty deck invokes restock\n if (cardStack.length < 1) {\n restock_shuffle();\n }\n //reveal definition of card\n let nextCard = cardStack.shift();\n document.getElementById(\"cardCount\").innerText = `Cards Remaining: ${cardStack.length}`\n document.getElementById(\"term\").innerText = nextCard.term;\n document.getElementById(\"definition\").style.display = \"none\";\n document.getElementById(\"definition\").innerText = nextCard.definition;\n document.querySelector(\"#eye\").setAttribute(\"class\",close_eye);\n}", "title": "" }, { "docid": "7c522a739c7de97b20f385053d373fdb", "score": "0.574329", "text": "function gainCard(player, card) {\n if (countInPlay(card) > 0) {\n player.discard.push(card)\n --cardsInPlay[pileIndex(card)].count\n return true\n }\n return false\n}", "title": "" }, { "docid": "6f4e4f3b71ce8cd5828b776cbf4b21ad", "score": "0.572706", "text": "function addToOpenCards(element) {\n selectedCards.push(element.id);\n}", "title": "" }, { "docid": "06ddd1807a2198955eabbe7f5f7329ca", "score": "0.5718856", "text": "addCardToDeck(obj, destination){\n\t\tlet cards = null;\n\t\tif (destination === \"user\") {\n\t\t\tcards = this.getUsersCards()\n\t\t}\n\t\telse if (destination === \"opponent\") {\n\t\t\tcards = this.getOpponentsCards();\n\t\t}\n\t\telse{\n\t\t\t//destination faulty\n\t\t\treturn false;\n\t\t}\n\n\t\tfor (var i = cards.length - 1; i >= 0; i--) {\n\t\t\tif (cards[i].cardId === obj.cardId) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tcards.push(obj);\n\t\tthis.notifyObservers();\n\t}", "title": "" }, { "docid": "bd750c030dffbb60b592773d64c72029", "score": "0.5705465", "text": "push(item) {\n this.stack.push(item);\n }", "title": "" }, { "docid": "590f66b6d14246b613618eb4e88a2e87", "score": "0.57020575", "text": "function pushToStack(stack, element) {\n stack.push(element);\n}", "title": "" }, { "docid": "b42e1374d0cdb479114266b098106b8f", "score": "0.569276", "text": "function hit() {\n if(winner !== 0) return;\n let popped = cards.splice(getRandomInt(), 1)\n dealCards.play()\n $('#pc').append(`<div class = \"card large fade-in ${popped[0].card} deleteCards\"></div>`)\n player.playerCards.push(popped[0]);\n player.playerTotal = addCards()\n $playersHand.text(`(${player.playerTotal})`)\n pAce(pNumAces())\n winner = checkBust()\n\n}", "title": "" }, { "docid": "49fd33d240e2a84adedffef60202f391", "score": "0.56757396", "text": "function addCard(el) {\n el.className = 'card show open';\n openCards.push(el);\n}", "title": "" }, { "docid": "bcb645913794483bdee631a894c4c3a2", "score": "0.5672988", "text": "function draw(cardToDraw) {\n\tPlayers[currentPlayer].cards.push(cardToDraw);\n\t\n\tif (GameDeck.length == 0) {\n\t\tGameDeck = DiscardPile;\n\t\tshuffle();\n\t\tGameDeck.pop();\n\t}\n\tdisplayCards();\n\t\n\t\n\tpoints.innerHTML = calculatePoints(Players[currentPlayer].cards).points + \" \" + calculatePoints(Players[currentPlayer].cards).suit;\n\t//addEventListenersToDiscard();\n\n\t\n\n}", "title": "" }, { "docid": "0cb9bf08455697ceaa1c48c55f741310", "score": "0.5667176", "text": "function placeCard(card, player, slot) {\n\tvar currId = player + \"-card-\" + slot;\n\tvar element = document.getElementById(currId);\n\n\t// place card in html element\n\telement.classList.remove(\"empty\")\n\telement.innerHTML = card;\n\n\t// calc dealer total and check if they busted\n\tdealerTotal = calculateTotal(dealerHand, 'dealer');\n\tdealerBust = bust(dealerTotal);\n\n\t// calc player total and check if they busted\n\tplayerTotal = calculateTotal(playerHand, 'player');\n\tplayerBust = bust(playerTotal);\n\n\tcheckWin();\n}", "title": "" }, { "docid": "dcf85efdda0e3eae5818e02af1213740", "score": "0.566193", "text": "function addCardToFlippedCards(card) {\n\t flippedCards.push(card);\n\t}", "title": "" }, { "docid": "e5ad9839169792c48fdb4e0975a060db", "score": "0.5660435", "text": "addCard({ name, link }) {\n return fetch(`${this.baseUrl}/cards`, {\n headers: this.headers,\n method: \"POST\",\n body: JSON.stringify({ name, link }),\n }).then((res) => this._getResponseData(res));\n }", "title": "" }, { "docid": "c696fcf381e4c81fe5cc21c3ace2f138", "score": "0.5655418", "text": "push(value) {\n // Adding the value to the top of the stack\n this._storage[this._length] = value;\n // Since we added the value we should also increment by 1\n this._length++;\n }", "title": "" }, { "docid": "dcca393a174e9cb55c248fc9c3fcdcaa", "score": "0.5652635", "text": "function createCard(card) {\n $('#deck').append(`<li class=\"card animated\"><i class=\"${card}\"></i></li>`);\n}", "title": "" }, { "docid": "62829212aa23250b8d4ef52040363035", "score": "0.5651199", "text": "addcard(){\n console.log(\"enter details pressed\");\n Actions.addcard();\n }", "title": "" }, { "docid": "e98e78544da4e3200fc714076d620539", "score": "0.56457895", "text": "pushMove(move){\n\n this.moveQueue.push(move);\n this.checkIfGameover(move);\n move.piece.setHasMoved();\n this.moveCount++;\n }", "title": "" }, { "docid": "70f59fde3a016d48acd09aed456dc1e7", "score": "0.56384534", "text": "function addOpen(card) {\n var cardClass = obtainCard(card);\n open.push({ card: cardClass, match: false });\n\n}", "title": "" } ]
7dbe614f290e48b5d1ddebe6c9b0b117
You are given a string of letters and an array of numbers. The numbers indicate positions of letters that must be removed, in order, starting from the beginning of the array. After each removal the size of the string decreases (there is no empty space). Return the only letter left. Example: let str = "zbk", arr = [0, 1] str = "bk", arr = [1] str = "b", arr = [] return 'b' Notes The given string will never be empty. The length of the array is always one less than the length of the string. All numbers are valid. There can be duplicate letters and numbers.
[ { "docid": "ed4443474d52f6699cc331d587e2e3d9", "score": "0.0", "text": "function lastSurvivor(letters, coords) {\n letters = letters.split(\"\");\n for (let i = 0; i < coords.length; i++) {\n letters.splice(coords[i], 1);\n }\n return letters.join(\"\");\n}", "title": "" } ]
[ { "docid": "bb7019d1ba133cbd53e838ab754d014d", "score": "0.73255944", "text": "function fearNotLetter(str) {\n let missing = [];\n let strArr = str.split(\"\");\n // console.log(JSON.stringify(strArr));\n let criteria = \"abcdefghijklmnopqrstuvwxyz\".split(\"\");\n // console.log(JSON.stringify(criteria));\n let miniArr = criteria.splice(criteria.indexOf(strArr[0]), strArr.length + 1);\n // console.log(miniArr);\n for(let i = 0; i < strArr.length; i++){\n if(miniArr.indexOf(strArr[i]) >= 0)\n miniArr.splice(miniArr.indexOf(strArr[i]), 1);\n // console.log(miniArr);\n }\n\n return miniArr[0];\n}", "title": "" }, { "docid": "3182ae90f440b9a4ea533e5ed40fcc01", "score": "0.70539993", "text": "function remove (letters) {\n // take in a string and split the letters to get an array\n const x = letters.split('')\n // set the counter to a string to get concated together at the end\n let counter = ''\n\n // loop though the arr\n for (let i = 0; i < x.length; i++) {\n // each letter starts at 1\n let count = 1\n // store the current value or variable \n let current = x[i]\n // while i is less than the lenth -1 and the current letter is equal to the next letter add one to the count and keep moving right in the arr \n while(i<x.length-1 && x[i] === x[i+1]) { \n count++\n i++\n }\n // concat the current and the count together\n counter += current + count\n }\n return counter\n}", "title": "" }, { "docid": "71a7437c805f6edbbb3ddaae2d572c64", "score": "0.7049612", "text": "function fearNotLetter(str) {\n var arr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v'\n , 'w', 'x', 'y', 'z']\n\n function firstCharIndex(inputChar) {\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] === inputChar) {\n if (i > 0) {\n return i--;\n } else\n return 0;\n } else\n return -1\n }\n }\n\n var firstChar = firstCharIndex(str.charAt(0));\n if (firstChar < 0)\n str = 'undefined';\n else {\n var temparr = [];\n for (var firstcharidx = 0; firstcharidx < str.length; firstcharidx++) {\n temparr.push(arr[firstcharidx]);\n }\n for (var k = 0; k < temparr.length; k++) {\n if (temparr[k] !== str[k]) {\n return temparr[k];\n }\n }\n }\n return str;\n}", "title": "" }, { "docid": "a1061478e8708faf2a10dd2dc161e8e9", "score": "0.7026031", "text": "function fearNotLetter(str) {\n let res = '';\n arr = str.split('');\n let start = arr[0].charCodeAt();\n\n for(let i = 0; i < arr.length; i++) {\n let currentChar = arr[i].charCodeAt();\n if(currentChar !== start) {\n res = String.fromCharCode(currentChar - 1);\n break;\n }\n start++;\n }\n return res;\n}", "title": "" }, { "docid": "8e7859afc15fadecd096319d0635f232", "score": "0.69883484", "text": "function fearNotLetter(str) {\n let alphabet = \"abcdefghijklmnopqrstuvwxyz\".split('');\n str = str.split('');\n\n let temp = (alphabet.slice(alphabet.indexOf(str[0]), alphabet.indexOf(str[str.length - 1]) + 1)).filter(val => !str.includes(val));\n\n return temp[0];\n}", "title": "" }, { "docid": "c2a42973ed098943ef2db31cc194edf4", "score": "0.69698125", "text": "function fearNotLetter(str) {\n let alphabet = \"abcdefghijklmnopqrstuvwxyz\";\n let begin = alphabet.indexOf(str[0]);\n let end = Number(alphabet.indexOf(str[str.length-1])) + 1;\n let fixedPiece = alphabet.slice(begin, end);\n\n fixedPiece = fixedPiece.split('');\n str = str.split('');\n \n let newStr = fixedPiece.filter((x) => !str.includes(x));\n if (newStr == ''){\n newStr = undefined;\n }else{\n return newStr.join('');\n }\n}", "title": "" }, { "docid": "d44df883d4326f503fd2db91d05a0e6f", "score": "0.6959559", "text": "function fearNotLetter(str) {\n\n let alph = 'abcdefghijklmnopqrstuvwxyz';\n let arr = alph.split('');\n let newArr = str.split('');\n let a = newArr[0];\n let index = arr.indexOf(a);\n\n for(let i=0;i<newArr.length;i++){\n\n if(arr[index]!==newArr[i]){\n return arr[index]\n } \n index++\n }\n \n return undefined\n \n \n}", "title": "" }, { "docid": "7183c3cd4c8e1417f1850125811c5de7", "score": "0.688483", "text": "function fearNotLetter(str) {\n \n let flag = null;\n const arrMin = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];\n let position = 0;\n const lengthStri = str.length\n let cont = 0;\n\n for (let i = 0; i < arrMin.length; i++) {\n const element = arrMin[i];\n if ( str[0] === element ) {\n position = i;\n i = arrMin.length\n }\n }\n for (let i = position; i < position + lengthStri + 1; i++) {\n const element = arrMin[i];\n const element1 = str[cont]\n\n if ( element === element1 ) {\n flag = true\n }else {\n return element\n }\n cont ++\n }\n return undefined\n}", "title": "" }, { "docid": "38cdce7b62c8189f387d9890b2f2950e", "score": "0.68558466", "text": "function fearNotLetter(str) {\n const alpha = [\"a\",\"b\",\"c\",\"d\",\"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\"];\n let alphax = alpha.splice(alpha.indexOf(str[0]), str.length+1);\n str = str.split(\"\");\n if (str.length !== alphax.length) {\n return alphax.filter(item => {\n return (!str.includes(item));\n }).join('');\n }\n return;\n}", "title": "" }, { "docid": "96c053e8cecb1b489c73af578bd23504", "score": "0.68171704", "text": "function findLetter(array) {\n let string = array.join(\"\");\n for (let i = 0; i < string.length; i++) {\n if (string.charCodeAt(i + 1) - string.charCodeAt(i) !== 1) {\n return String.fromCharCode(string.charCodeAt(i) + 1);\n }\n }\n}", "title": "" }, { "docid": "83ce4edaf728d328ca9bb727e96e442e", "score": "0.67250293", "text": "function remains(string, arr) {\n var array = [];\n for (var j in string) {\n array.push(string[j]);\n }\n \n for (var i in array) {\n var pos = arr.indexOf(array[i]);\n\n if (pos >= 0) {\n arr.splice(pos, 1);\n }\n }\n var newArr = arr.slice(0);\n\n return newArr;\n}", "title": "" }, { "docid": "c14eb4f82f1a4fc4f549b240951fa870", "score": "0.66804713", "text": "function fearNotLetter(str) {\r\n\r\n\tvar letters = str.split(\"\");\r\n\tvar letterCode = [];\r\n\tfor(var i = 0; i < letters.length; i++) {\r\n\t\tletterCode.push(letters[i].charCodeAt(0));\r\n\t}\r\n\tconsole.log(letterCode);\r\n\tvar start = letterCode[0];\r\n\tvar resPos = 0;\r\n\tfor(var i = 1; i < letterCode.length; i++) {\r\n\t\tif(++start != letterCode[i]) {\r\n\t\t\tresPos = start;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tconsole.log(String.fromCharCode(resPos));\r\n\t if(!resPos) {\r\n return undefined;\r\n }\r\n\treturn String.fromCharCode(resPos);\r\n}", "title": "" }, { "docid": "8bf9de332fc0fe069eb551ffba48fc3e", "score": "0.6642842", "text": "function findTheMissingLeter(array) {\n let toUpperCase = false;\n if (array[0] === array[0].toUpperCase()) {\n toUpperCase = true;\n }\n\n let str = \"abcdefghijklmnopqrstuvwxyz\";\n let alphabet = `${\n toUpperCase ? str.toLocaleUpperCase().split(\" \") : str.split(\" \")\n }`;\n\n let statingPoint = alphabet.indexOf(array[0]);\n let length = array.length + statingPoint;\n\n for (let i = statingPoint; i < length; i++) {\n if (alphabet[i] != array[i - statingPoint]) {\n return alphabet[i];\n }\n }\n}", "title": "" }, { "docid": "dc184269dde399186a4ec8b27c87bc49", "score": "0.66413355", "text": "function removeChars(input) {\n let letterStack = [];\n for (let letter of input) {\n if (letterStack.length && letter === 'c' && letterStack[letterStack.length - 1] === 'a') {\n letterStack.pop();\n continue;\n }\n if (letter !== 'b') letterStack.push(letter);\n }\n return letterStack.join('');\n}", "title": "" }, { "docid": "a14c31174f834762923355de0954c0c3", "score": "0.6622374", "text": "function fearNotLetter(str) {\n var arr=str.split(\"\");\n var result=[];\n var initial=str.charCodeAt(0);\n var end=str.charCodeAt(arr.length-1);\n var point;\n \n //fromCharCode can only transfer a char every time, not a string,not a array!\n for(var index=initial;index<=end;index++){\n result.push(String.fromCharCode(index));//result is string\n } \n //console.log(result);\n \n for(var i=0;i<result.length;i++){\n if(result[i]!==arr[i]){\n point=i;\n break;\n }\n }\n \n \n console.log(result[point]);\n \n // var x_str=result.join(\"\");\n return result[point];\n}", "title": "" }, { "docid": "e6f84e1e512403e7a88876eeb6bf8338", "score": "0.66109914", "text": "function fearNotLetter(str) {\n var arrStr = str.split('');\n \n for (var i = 0; i < (arrStr.length - 1); i++){\n if (arrStr[(i + 1)].charCodeAt(0) - arrStr[i].charCodeAt(0) > 1){\n return String.fromCharCode((arrStr[i].charCodeAt(0) + 1));\n }\n }\n\n return undefined;\n}", "title": "" }, { "docid": "de69ace97041c6a8ca6ee2894bde2236", "score": "0.66035205", "text": "function fearNotLetter(str) {\n var alphabet = [\n 'a',\n 'b',\n 'c',\n 'd',\n 'e',\n 'f',\n 'g',\n 'h',\n 'i',\n 'j',\n 'k',\n 'l',\n 'm',\n 'n',\n 'o',\n 'p',\n 'q',\n 'r',\n 's',\n 't',\n 'u',\n 'v',\n 'w',\n 'x',\n 'y',\n 'z'\n ];\n \n var startingPoint = alphabet.indexOf(str[0]);\n \n for(var i = 0; i < str.length; i++){\n if(str[i] !== alphabet[i + startingPoint]){\n return alphabet[i + startingPoint];\n }\n }\n return undefined;\n}", "title": "" }, { "docid": "897a4a2f534329fa4eea1e6ff7984e18", "score": "0.6574989", "text": "function findMissingLetter(array) {\n\n /* Write the minimum required code PRUEBAS UNITARIAS */\n // Cuando al menos un elemento del arreglo tiene mas de un caracter\n for ( let i = 0; i<array.length; i++){\n if(array[i].length >1)\n return 'Estas introduciendo letras de mas';\n else if(!isNaN(array[i]))\n return 'Alguno no pertenece al \"abecedario\"';\n }\n //Fin de exclusion de un caracter \n //Cuando el abecedario esta completo\n if( array.length >=26){\n return('El abecedario esta completo');\n }\n var mayus = false;\n var min = '';\n if(array[0].charCodeAt(0) >=65 && array[0].charCodeAt(0) <= 90 ){\n mayus = true;\n let abc = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\".split('');\n let first = abc.indexOf(array[0]);\n //console.log( abc.indexOf(first));\n\n let tamUser = array.length;\n\n let comp = abc.splice(first, (tamUser));\n /*hasta aqui ya tenemos el pedazo de abcdario correcto */\n // coomparar con el arreglo del usuario si es igual al correcto\n\n let letra = comp.filter((item, index)=> {\n if(item === array[index]){\n return false;\n }else{\n return true;\n }\n });\n \n return letra[0] ;\n \n }\n \n /*var min = array.join('').toLowerCase();\n return min;*/\n var abc = \"abcdefghijklmnopqrstuvwxyz\".split('');\n var first = abc.indexOf(array[0]);\n //console.log( abc.indexOf(first));\n\n var tamUser = array.length;\n\n var comp = abc.splice(first, (tamUser));\n /*hasta aqui ya tenemos el pedazo de abcdario correcto */\n // coomparar con el arreglo del usuario si es igual al correcto\n\n var letra = comp.filter((item, index)=> {\n if(item === array[index]){\n return false;\n }else{\n return true;\n }\n });\n \n return letra[0] ;\n \n }", "title": "" }, { "docid": "b727a175a2d2b560e900f24349ca85ae", "score": "0.6526885", "text": "function removeChar(str, s){\n var arr_str = Array.from(str);\n for(let i = 0; i <= 0; i++){\n if (arr_str[i] === s){\n arr_str[i]= \"\";\n break;\n }\n }\n console.log(arr_str.join(\"\"));\n}", "title": "" }, { "docid": "4f5a1eead76b49da5ba53d29d259f652", "score": "0.6521631", "text": "function findMissingLetter(array) {\n\tlet first = array[0].charCodeAt(0);\n\tfor (let i = 1; i < array.length; i++) {\n\t\tif (first + i !== array[i].charCodeAt(0)) {\n\t\t\treturn String.fromCharCode(first + i);\n\t\t}\n\t}\n\tthrow new Error('Invalid input');\n}", "title": "" }, { "docid": "29db0323f4b3d968eb547be4f2b2e357", "score": "0.6517034", "text": "function fearNotLetter(str) {\n var result;\n for(var i=1; i<str.length; i++){\n if(str[i].charCodeAt() - str[i-1].charCodeAt() > 1 ){\n result = String.fromCharCode(str[i-1].charCodeAt() + 1);\n break;\n }\n }\n return result;\n}", "title": "" }, { "docid": "a06e36dfa3fcd01fd6b26487bab83560", "score": "0.6493313", "text": "function removeShort(strArr, val) {\n var strArr = str.split(\" \");\n for (var ind = strArr.length-1; ind >= 0; ind--) {\n if (strArr[ind].length < val) {\n for (var i = ind; i < strArr.length-1; i++){\n var temp = strArr[i];\n strArr[i] = strArr[i+1];\n strArr[i+1] = temp;\n }\n strArr.pop();\n }\n }\n return strArr;\n}", "title": "" }, { "docid": "a57ae3587426409561a337c9509cc19f", "score": "0.6471285", "text": "function fearNotLetter(str) {\n for(var i=0;i<str.length;i++){\n var code = str.charCodeAt(i);\n if(code != str.charCodeAt(0)+i){\n return String.fromCharCode(code-1);\n }\n }\n \n\n return undefined;\n}", "title": "" }, { "docid": "c60c6fe7a51028ef718dbec9da28e328", "score": "0.6423388", "text": "function fearNotLetter(str) {\n let previousValue = str[0].charCodeAt(0) - 1;\n let newValue;\n for (let i = 0; i < str.length; i++) {\n newValue = str[i].charCodeAt(0);\n if ((newValue - previousValue) !== 1) {\n return String.fromCharCode(newValue - 1)\n }\n previousValue = newValue;\n }\n\n}", "title": "" }, { "docid": "5165a9a2ddf6a1666ba0dacf88d57764", "score": "0.64063686", "text": "function removeCharacter(string, target)\n{\n var arr_string = Array.from(string)\n for(let i = 0; i<arr_string.length; i++)\n {\n if(arr_string[i] === target)\n {\n arr_string[i] = \"\";\n break;\n }\n\n }\n console.log(arr_string.join(\"\"))\n}", "title": "" }, { "docid": "a3cb730ae47674e6eee55e4d1222c13d", "score": "0.6397357", "text": "function removeShort(strArr, val) {\n for (var ind = strArr.length-1; ind >= 0; ind--) {\n if (strArr[ind].length < val) {\n for (var i = ind; i < strArr.length-1; i++){\n var temp = strArr[i];\n strArr[i] = strArr[i+1];\n strArr[i+1] = temp;\n }\n strArr.pop();\n }\n }\n return strArr;\n}", "title": "" }, { "docid": "5c9a32dc4bfbf6a0c0bdfa782b352d01", "score": "0.63962334", "text": "function missingLetter(str){\n for(var i = 0; i < str.length; i++){\n var letter = str.charCodeAt(i);\n if (letter !== str.charCodeAt(0) + i){\n return String.fromCharCode(letter - 1);\n } \n }\n return undefined;\n }", "title": "" }, { "docid": "53f06114fbf3e6c3b2435b6da8efe2fb", "score": "0.63945395", "text": "function fearNotLetter(str) {\n for (let i = 0 ; i< str.length; i++) {\n let code = str.charCodeAt(i);\n if(code!==str.charCodeAt(0) +i){\n return String.fromCharCode(code -1);\n }\n\n }\n\n return undefined;\n }", "title": "" }, { "docid": "e2f6e091591f9459166c0e0cd55b9c61", "score": "0.63553685", "text": "function fearNotLetter(str) {\n for (let i = 1; i < str.length; ++i) {\n if (str.charCodeAt(i) - str.charCodeAt(i-1) > 1) {\n return String.fromCharCode(str.charCodeAt(i - 1) + 1);\n }\n }\n}", "title": "" }, { "docid": "1c16f6f52b8afec3f4106faa323cccc9", "score": "0.6346672", "text": "function dedupe(str) {\n let newStr = \"\";\n for (let letter of str) {\n // console.log(letter)\n if (!newStr.includes(letter)){\n newStr += letter\n }\n }\n return newStr;\n}", "title": "" }, { "docid": "cd3a7be5072b3f3957c387ba0034a2ec", "score": "0.63436264", "text": "function fearNotLetter(str) {\n for (let i = 1; i < str.length; ++i) {\n if (str.charCodeAt(i) - str.charCodeAt(i - 1) > 1) {\n return String.fromCharCode(str.charCodeAt(i - 1) + 1);\n }\n }\n }", "title": "" }, { "docid": "9f34953116756f69b497e87ba295ccb3", "score": "0.6336859", "text": "function fearNotLetter(str) {\n\n for (let i = 0; i < str.length; i++) {\n let current = str.charCodeAt(i);\n\n if (str.charCodeAt(0) + i !== current) {\n return String.fromCharCode(current -1);\n }\n }\n\n return undefined;\n}", "title": "" }, { "docid": "a1ae04ae7aa4b3c064a8502a3cb98b4c", "score": "0.6329757", "text": "function fearNotLetter(str) {\n \"use strict\";\n var alphabet = 'abcdefghijklmnopqrstuvwxyz';\n var start = alphabet.search(str[0]);\n for (var i = 0; i < str.length; i++) {\n if (str[i] != alphabet[start+i]) {\n return alphabet[start+i]; \n }\n }\n}", "title": "" }, { "docid": "a79901a221ff885a1ff080a274ea3a6f", "score": "0.6301849", "text": "function longestPrefix(arr) {\n const sArr =arr.sort((a,b) => a.length - b.length);\n let fStr = sArr[0];\n for(let i = 1; i < sArr.length; i++) {\n while(sArr[i].indexOf(fStr) === -1) {\n fStr = fStr.substr(0, fStr.length - 1); //reassign the substr back\n if(fStr.length === 0) {\n console.log(\"empty str\")\n }\n }\n }\n\n return fStr;\n\n}", "title": "" }, { "docid": "af730926890c2ef67337500347e2ecd7", "score": "0.62726665", "text": "function removeChar(str){\n var arr = str.slice(1);\n var fin = arr.slice(0,-1);\n return fin;\n }", "title": "" }, { "docid": "ad70697c2cb355d4e64e2a31ef43cccc", "score": "0.62685776", "text": "function deleteWords(arr) {\n var result = [];\n\n for (var i = 0; i < arr.length; i++) {\n var arrLetter = arr[i].split('');\n\n if (arrLetter[0] != arrLetter[arrLetter.length - 1]) {\n console.log(arrLetter);\n result.push(arr[i]);\n }\n }\nconsole.log(result);\n}", "title": "" }, { "docid": "a9733cb69e3f85f302de9735d2478889", "score": "0.6250637", "text": "function fearNotLetter2(str) {\n const alphabet = 'abcdefghijklmnopqrstuvwxyz';\n if(alphabet.indexOf(str) !== -1) {\n return undefined;\n } else {\n const completeSegment = alphabet.substr(alphabet.indexOf(str.charAt(0)), str.length + 1);\n console.log(completeSegment);\n for(let i = 0; i < completeSegment.length; i++) {\n if( str.indexOf(completeSegment.charAt(i)) === -1 ) {\n return completeSegment.charAt(i); \n }\n }\n } \n}", "title": "" }, { "docid": "965355dc4946b2969b41d1fb27be118b", "score": "0.6243732", "text": "function fearNotLetter(str) {\n var tempStr = str;\n var num = tempStr.length -1;\n var missingChar;\n var currentChar;\n var nextChar;\n var nextNum = 1;\n \n for(var char = 0; char < tempStr.length; char++){\n currentChar = tempStr.charCodeAt(char) ; \n if(char < num){ \n nextChar = tempStr.charCodeAt(nextNum); \n if(nextChar - currentChar !== 1){\n \n currentChar++;\n missingChar = String.fromCharCode(currentChar); \n } \n } \n nextNum++;\n }\n str = missingChar;\n return str;\n }", "title": "" }, { "docid": "6391aad73df8b92702a254c3629a72b5", "score": "0.62366104", "text": "function fearNotLetter(str) {\n let code = str.charCodeAt(0);\n let splitArr = str.split('');\n\n for (let letter of splitArr) {\n if (letter.charCodeAt(0) !== code)\n return String.fromCharCode(code);\n code++;\n }\n}", "title": "" }, { "docid": "bea8316c17472706c5646ea1c35505b4", "score": "0.6235135", "text": "function fearNotLetter(str) {\n //Store first value\n var asciiNumber = str.charCodeAt(0);\n \n //Search each item in array\n for (let i = 0; i<str.length; i++){\n console.log(str.charCodeAt(i));\n console.log(asciiNumber + \"Ascii\");\n if (asciiNumber !== str.charCodeAt(i)){\n var missingChar = String.fromCharCode(str.charCodeAt(i-1)+1);\n break;\n }\n asciiNumber++;\n }\n return missingChar;\n}", "title": "" }, { "docid": "74a9dc22f937206e7179e4d80785db67", "score": "0.6224495", "text": "function fearNotLetter(str) {\n let start = str.slice(0, 1);\n let end = str.slice(str.length - 1);\n let alphabet = 'abcdefghijklmnopqrstuvwxyz';\n let comparison = '';\n for (let i = 0; i < alphabet.length; i++) {\n if (alphabet[i] == start) {\n comparison = alphabet.slice(i);\n break;\n }\n }\n for (let i = 0; i < comparison.length; i++) {\n if (comparison[i] == end) {\n comparison = comparison.slice(0, i + 1);\n break;\n }\n }\n for (let letter of comparison) {\n if (!str.includes(letter)) {\n return letter;\n }\n }\n}", "title": "" }, { "docid": "4ba4a1d44cd5858d83dcf3d56756fe88", "score": "0.6208377", "text": "function fearNotLetter(str) {\n for(let i = 0; i<str.length-1; i++){\n if(str.charCodeAt(i+1) - str.charCodeAt(i)>1){\n let missingLetter = str.charCodeAt(i+1) - 1\n console.log(String.fromCharCode(missingLetter));\n }\n }\n return undefined;\n}", "title": "" }, { "docid": "fce43ae73a1a4f921993d33d39605d9c", "score": "0.6181307", "text": "function fearNotLetter(str) {\n\n //loops through str\n for (var i = 1; i < str.length; i++) {\n //if there is a missing letter, return it\n if (str.charCodeAt(i) !== (str.charCodeAt(i - 1) + 1)) {\n return String.fromCharCode(str.charCodeAt(i - 1) + 1);\n }\n }\n //otherwise return undefined\n return undefined;\n}", "title": "" }, { "docid": "a35986d18d57b450469f52a34017d06f", "score": "0.6158398", "text": "function Solution24(){\nfunction fearNotLetter(str) {\n\tvar missingLetters=\"\";\n\tfor(var i=0; i<str.length-1;i++){\n\t\tif(str.charCodeAt(i+1)-str.charCodeAt(i)!=1){\n\t\t\tmissingLetters+=String.fromCharCode(str.charCodeAt(i)+1);\n\t\t}\n\t}\n\tconsole.log(missingLetters);\n\tif(missingLetters){return missingLetters;}\n\telse {return undefined}\n}\n\nfearNotLetter('abce');\n}", "title": "" }, { "docid": "491e2ec5efeacc4b248470ca14890261", "score": "0.6145438", "text": "function getShortestSubstring2(arr, str) {\n let headIndex = 0\n let uniqueCounter = 0 // counts whether all the characters in arr are present in current substring\n let countMap = {}\n\n let output = \"\"\n\n for (let i = 0; i < arr.length; i++) {\n let char = arr[i]\n countMap[char] = 0\n }\n\n for (let tailIndex = 0; tailIndex < str.length; tailIndex++) {\n let tailChar = str[tailIndex]\n\n if (countMap[tailChar] !== undefined) {\n if (countMap[tailChar] === 0) {\n uniqueCounter += 1\n }\n countMap[tailChar] += 1\n }\n\n while (uniqueCounter === arr.length) { // once you've got all the necessary characters,\n // see if you've hit jackpot and short circuit, or adjust output\n let tempLength = tailIndex - headIndex + 1 // Then, start moving headIndex and testing what you've got in while loop\n if (tempLength === arr.length) {\n output = str.substring(headIndex, tailIndex + 1)\n return output\n }\n\n if (output > tempLength || output === \"\") {\n output = str.substring(headIndex, tailIndex + 1)\n }\n\n let headChar = str[headIndex]\n if (countMap[headChar] !== undefined) {\n if (countMap[headChar] === 1) {\n uniqueCounter -= 1\n }\n countMap[headChar] -= 1\n }\n\n headIndex += 1\n }\n\n }\n\n return output\n}", "title": "" }, { "docid": "04f4feeba0e5cb07fe20aa2cef680b4f", "score": "0.6134562", "text": "function firstNonRepeatedCharacter(str) {\n // YOUR CODE HERE\n str = str.split(\"\");\n let char = str[0];\n for (let i = 0; i < str.length; i) {\n str.shift();\n if (!str.includes(char)) {\n return char;\n } else {\n str.push(char);\n char = str[i];\n }\n }\n}", "title": "" }, { "docid": "fe608fb52bdc6654d1c7c98177a05746", "score": "0.61114705", "text": "function firstNonRepeatingLetter(str) {\n let temp = str.toLowerCase();\n for (let i = 0; i < temp.length; i++)\n if (temp.indexOf(temp[i]) === temp.lastIndexOf(temp[i]))\n return str[i];\n return \"\";\n}", "title": "" }, { "docid": "cacf63d81702d77e083ce4a4bd07851d", "score": "0.6109436", "text": "function fearNotLetter(str) {\n let i = 0;\n while (i < str.length - 1) {\n let currentCharCode = str.charCodeAt(i);\n i++;\n let nextCharCode = str.charCodeAt(i);\n if (currentCharCode + 1 !== nextCharCode) {\n return String.fromCharCode(currentCharCode + 1);\n }\n }\n return undefined;\n}", "title": "" }, { "docid": "6985f39421d2323ae54d48d204b06a8a", "score": "0.6098532", "text": "function removeChar(str){\n return str.slice(1, str.length -1);\n}", "title": "" }, { "docid": "0d43435aea20cfdb82e7e5c6a3ebc394", "score": "0.6087199", "text": "function filterLetters(arr, letter){\n let temp = arr.filter(function(character){\n if (character.toLowerCase() === letter) return true;\n });\n return temp.length; \n}", "title": "" }, { "docid": "bc8952aad9c11ad61b726f3ead8111ae", "score": "0.6079164", "text": "function firstNonRepeatingLetter(s) {\n s = s.split('')\n .filter(el => s.toLowerCase().indexOf(el.toLowerCase()) === s.toLowerCase().lastIndexOf(el.toLowerCase()));\n return (s.length === 0)? '' : s[0];\n}", "title": "" }, { "docid": "18f3fddd5543b025817434519c26d0dd", "score": "0.6072129", "text": "function removeChar(str) {\n\t//You got this!\n\t// convert the str into an array\n\n\t// slice out first element\n\t// slice out second element\n\t// return the array and change it back to string\n\treturn str.split('').slice(1, -1).join('');\n}", "title": "" }, { "docid": "cc0faa20cf5ad0c059ec9c0aee6c2749", "score": "0.6066443", "text": "function remove(str){\n let strArray = str.split(\"\")\n strArray = strArray.splice(1 , strArray.length -2).join(\"\")\n \n return strArray\n}", "title": "" }, { "docid": "fd599b267329924fa36dee4c414a7f3a", "score": "0.60439146", "text": "function deleteOne(str, bl){\n return bl?str.slice(1):str.slice(0,-1)\n}", "title": "" }, { "docid": "ef1c5bfeec722aa3ca1c197396500fab", "score": "0.60403246", "text": "function superReducedString(s) {\n let arr = s.split('')\n for(let i = 0; i < arr.length - 1;){\n if(arr[i] === arr[i + 1]){\n arr.splice(i, 2)\n i = 0 \n }else{\n i++\n }\n }\n\n if(!arr.join(\"\")){\n return 'Empty String'\n }else{\n return arr.join('')\n }\n \n \n\n\n}", "title": "" }, { "docid": "e2493e73743812cd1e6ffae0c60b7ac5", "score": "0.6034883", "text": "function letterChecker(str) {\n let result = \"\"\n // 97 - 122 is the alphabet, from A-Z\n for(let i = 0; i < str.length; i++) {\n let firstLetter = str.charCodeAt(0)\n let currentLetter = str.charCodeAt(i)\n\n //console.log(i + firstLetter, currentLetter, result)\n if(currentLetter != i + firstLetter) {\n result += String.fromCharCode(i + firstLetter);\n str = (str.substring(0, i) + String.fromCharCode(i + firstLetter) + (str.substring(i, str.length)))\n //console.log(String.fromCharCode(i + firstLetter), result)\n }\n }\n\n if(result == \"\") {\n result = \"no missing letters\";\n }\n\n //console.log(str,\"Final result: \", result)\n return result\n}", "title": "" }, { "docid": "153afcf844f62cf7e4e6d9341c810855", "score": "0.60321766", "text": "function missingLetters(str) {\n let compare = str.charCodeAt(0);\n // charCodeAt return the ascii value and the parameter is charset\n // i.e 0 means first character set\n //console.log(compare); // returns 97 which ascii value of a\n let missing;\n //let now split string to array using split method\n str.split(\"\").map((char, i) => {\n if (str.charCodeAt(i) === compare) {\n ++compare;\n } else {\n missing = String.fromCharCode(compare); // return back from ascii to string\n }\n });\n return missing;\n}", "title": "" }, { "docid": "3261a8580d9a0af83300fdcc7797d90e", "score": "0.6028272", "text": "function noOfCharToDeleteFromSequence(input){\n var arr = input.split('')\n var arr1 = arr.sort()\n var count = 0\n var dupes = []\n \n for(var i=0; i<arr1.length-1; i++){\n if(arr1[i] === arr1[i+1] && !dupes.includes(arr[i+1])){\n count++ \n dupes.push(arr1[i+1])\n }\n }\n \n console.log(\"The number of characters to remove \"+count)\n console.log(dupes)\n }", "title": "" }, { "docid": "1d6864665d5e0fb3ec3717b9ca3982b1", "score": "0.6026916", "text": "function solve(arr){\n let letters = 'abcdefghijklmnopqrstuvwxyz';\n return arr.map(a => a.toLowerCase().split('').filter((b, i) => i === letters.indexOf(b)).length);\n}", "title": "" }, { "docid": "d7dd344de5fa12448022b0457dd02c8b", "score": "0.60146993", "text": "function removeChar(str){\n return str.slice(1, -1)\n}", "title": "" }, { "docid": "e39ab4479b902cd8bf149a6157c94951", "score": "0.6013502", "text": "function onlyLetters(str) {\r\n // splitting the string into an array\r\n let arrayOfChar = str.split('');\r\n // initializing an empty array ready to receive the letters \r\n let arrayOfStrings = [];\r\n for (i = 0; i < arrayOfChar.length; i++) {\r\n // parseInt runned over a string should return NaN\r\n // isNaN return true if the the argument is not a number\r\n if (isNaN(parseInt(arrayOfChar[i]))) {\r\n // if it's NaN, then it's string, so push in the array\r\n arrayOfStrings.push(arrayOfChar[i])\r\n }\r\n };\r\n return arrayOfStrings.join('')\r\n}", "title": "" }, { "docid": "d6aba77ab34a091849e5dddfd05a9244", "score": "0.59916914", "text": "function filterLetters(arr, letter){\n let count = 0;\n let newArr = arr.map(function(val){\n return val.toLowerCase()\n });\n \n newLetter = letter.toLowerCase();\n\n newArr.reduce(function(acc,val){\n if(val === letter){\n return acc + count++;\n }\n }, \"\")\n \n return count;\n}", "title": "" }, { "docid": "684fa583ef61885fa2296a83c0af7a4e", "score": "0.5975692", "text": "function keepFirst (str){\n let string = str.slice(0, 2);\n return string;\n}", "title": "" }, { "docid": "b449c93d322c4fa892ca5cc7cae3260d", "score": "0.59736514", "text": "function SUP(arr) {\n\tvar result = [];\n\n\tarr.forEach(function(val, index){\n\t\tvar min = 0;\n\n\t\tarr.forEach(function(val2, index2){\n\t\t\tif (index === index2) return;\n\n\t\t\tvar i = 0;\n\t\t\twhile (val[i] === val2[i]) {\n\t\t\t\tif (i >= min)\n\t\t\t\t\tmin = i + 1;\n\t\t\t\ti++;\n\t\t\t}\n\t\t});\n\n\t\tresult[index] = val.substr(0, min + 1);\n\t});\n\n\treturn result;\n}", "title": "" }, { "docid": "f72ea6dcfa355e57dc6f02ed4e66c9a9", "score": "0.59367245", "text": "function keepFirst(str) {\n return str.slice(0, 2); \n}", "title": "" }, { "docid": "77a64a2b2190da644cff880a351b943a", "score": "0.59338385", "text": "function firstNonRepeatingChar(string){\n\n}", "title": "" }, { "docid": "13b7badfbc6c8b541019aad0b89a1e28", "score": "0.5933485", "text": "function remove_all(str) {\n let arr = str.split('');\n let result = [];\n\n for (let i = 0; i < arr.length; i++) {\n if (arr.indexOf(arr[i]) === arr.lastIndexOf(arr[i])) result.push(arr[i]);\n }\n\n return result.join('');\n}", "title": "" }, { "docid": "0429b072c94ddb32024968bf0fd9554c", "score": "0.5927871", "text": "function keepFirst(s){\n let l=s.length;\n if (l>=2){\n s = s.substring(0,2);\n } \n return s;\n}", "title": "" }, { "docid": "5e9f286f197451862ce876abbeb31270", "score": "0.59083724", "text": "function fearNotLetter(str) {\n const regex = buildRegex(str);\n return (str.match(regex)[0] !== matchAlphabet(regex)[0]) \n ? matchAlphabet(regex)[0]\n .split(\"\")\n .filter(item => !str.includes(item))\n .join() \n : undefined\n}", "title": "" }, { "docid": "dc15f639e22e459916ee87420a42bfa8", "score": "0.59064335", "text": "function removeChar(str1, str2) {\n let tempArr = [],\n newStr = [],\n newStrMod = \"\";\n let index = 0,\n j = 0;\n\n for (let i = 0; i < str2.length; i++) {\n index = Math.abs(str2[i].charCodeAt() - \"a\".charCodeAt());\n if (!tempArr[index]) {\n tempArr[index] = 1;\n }\n }\n for (let i = 0; i < str1.length; i++) {\n index = Math.abs(str1[i].charCodeAt() - \"a\".charCodeAt());\n if (!tempArr[index]) {\n newStr[j++] = str1[i];\n }\n }\n for (let i = 0; i < newStr.length; i++) {\n newStrMod += newStr[i];\n }\n return newStrMod;\n}", "title": "" }, { "docid": "d602bb64cf3cff5db43f3dfc66b6eaeb", "score": "0.5903407", "text": "function needler(haystack, needle) {\n if (needle.length === 0) return 0;\n if (needle.length > haystack.length) return -1;\n\n let savedIndex = -1;\n let tempString = '';\n let window = needle.length;\n\n // first loop to grab initial tempString\n for (let i = 0; i < needle.length; i++) {\n tempString += haystack[i];\n }\n\n if (tempString === needle) return 0;\n\n // loop over haystack, haystack[i]\n for (let j = window; j < haystack.length + 1; j++) {\n // remove first letter and add new letter of temp string\n console.log(tempString, j);\n if (tempString === needle) {\n return j - window;\n }\n tempString = tempString.slice(1, window);\n tempString += haystack[j];\n }\n return savedIndex;\n}", "title": "" }, { "docid": "f66ccbb086d270b5af041fcc29863190", "score": "0.58994925", "text": "function deleteFirstAndLast(str) {\n return str.slice(1, -1);\n}", "title": "" }, { "docid": "12cb8c1eadb37c8f9f0e4926e7e9eb76", "score": "0.5897239", "text": "function keepFirst(str) {\n str = str.slice(0, 2); \n return str\n}", "title": "" }, { "docid": "f6f44ca192378854cc0fa00e3b1847f2", "score": "0.58895653", "text": "function opt0(str) {\n // Split string into an array of letters.\n const splittedString = str.split('');\n\n // Reverse the order of letters in the Array\n const reversedArray = splittedString.reverse();\n\n // Join reversed array back into a string (of letters).\n const joinedArray = reversedArray.join('');\n\n return joinedArray;\n}", "title": "" }, { "docid": "6c5ba9f4059c790eee0a7a56bae9098b", "score": "0.5885617", "text": "function removeShorterStrings(arr,val){\n for (var i = 0; i < arr.length; i++){\n if (arr[i].length < val){\n arr.splice(i,1);\n i--;\n }\n }\n return arr;\n}", "title": "" }, { "docid": "2ca36f8fd29911dbcbab05284beeae3b", "score": "0.58799696", "text": "function keepFirst(str){\n return str.substring(0,2)\n}", "title": "" }, { "docid": "23036f9180960d4dd0c806e4a7dac860", "score": "0.58631295", "text": "function destroyer(arr) {\n var args = Array.from(arguments);\n\n for (var i = 1; i < arguments.length; i++) {\n while (args[0].indexOf(args[i]) != -1) {\n var index = args[0].indexOf(args[i]);\n // console.log(args[0]);\n args[0].splice(index, 1);\n }\n }\n return args[0];\n}", "title": "" }, { "docid": "c1d0c6ecf15088f0149e5c5b47f6e5c6", "score": "0.5860802", "text": "function firstNonRepeatingCharacter(string) {\n let letters = {};\n for (let i = 0; i < string.length; i++) {\n if (letters[string[i]] === undefined) {\n letters[string[i]] = 1;\n } else {\n letters[string[i]] += 1;\n }\n }\n for (let j = 0; j < string.length; j++) {\n if (letters[string[j]] === 1) {\n return j;\n }\n }\n return -1;\n}", "title": "" }, { "docid": "01c8c680ce7560424c3244ebeb48b88b", "score": "0.58489054", "text": "function fearNotLetter(str) {\n const charCode = str\n .split('')\n .map(letter => letter.charCodeAt(0))\n .find((code, i, arr) => code + 1 !== arr[i + 1])\n\n if (charCode === str.charCodeAt(str.length - 1)) return undefined; // no missing letter\n return String.fromCharCode(charCode + 1);\n}", "title": "" }, { "docid": "0fa028716444910846ed179bc92f0f53", "score": "0.5844878", "text": "function firstNotRepeatingCharacter(s) {\r\n let c='';\r\n for (let i = 0; i < s.length; i++) {\r\n c=s.charAt(i);\r\n if (s.indexOf(c)==i && s.indexOf(c,i+1) ==-1)return c;\r\n }\r\n return ;\r\n}", "title": "" }, { "docid": "542782530d973d598854b8f6db836ca8", "score": "0.5844234", "text": "function removeChar(str){\n if(str.length > 2){\n let arr = str.split('');\n arr.shift();\n arr.pop();\n return arr.join('');\n }\n}", "title": "" }, { "docid": "772486597e742370ee7221c7969a09a4", "score": "0.58346206", "text": "function removeShortStrings(strArr, length){\n for (var i = 0; i < strArr.length; i++){\n if(strArr[i].length < length){\n strArr.splice(i, 1);\n }\n }\n console.log(strArr);\n}", "title": "" }, { "docid": "796eecc348e7e4763dad539ae7565e18", "score": "0.58345765", "text": "function firstNonRepeatedCharacter(string) {\n let first;\n if(string.length === 0){\n first = ''\n } else if (string.length === 1){\n first = string[0]\n }\n\n string.split('').some(function (character, index, obj) {\n if(obj.indexOf(character) === obj.lastIndexOf(character)) {\n first = character;\n return true;\n }\n\n return '';\n });\n\n return first;\n}", "title": "" }, { "docid": "5e62c7d0f18e0174887e3348f70cdcce", "score": "0.58216155", "text": "function dupeRemove(str){\n // use hash\n\n // check for valid input\n if(typeof str !== 'string' || !str){\n return \"invalid input, please provide a valid string\"\n }\n\n // instantiate hash map\n var allChars = {};\n\n // instantiate str\n var noDupes = \"\";\n\n // split string into array of letters\n var letters = str.split(\"\");\n\n\n for (var i = 0; i < letters.length; i++){\n // add key if not already there\n if(!allChars[letters[i]]){\n allChars[letters[i]] = 1;\n }\n // if dupe, do nothing\n else{}\n }\n\n // for each key in hash map, add to new string\n for (var key in allChars){\n // add letter to string \n noDupes += key;\n }\n\n return noDupes;\n}", "title": "" }, { "docid": "38112892f2e8689844050100f968e86e", "score": "0.5817713", "text": "function beesWax(str) {\n //remove all non-alphabetical letters\n\n //sort the words in alphabetical order\n\n //return the first word\n}", "title": "" }, { "docid": "c494f37f7f13f3d6c3a937f4dae65b2d", "score": "0.5815069", "text": "function findLeft(str) { // searching left number\n let i = str.length - 1;\n while ((!isFirst(str[i]))&&(!isSecond(str[i]))) {\n i--;\n if (i == -1) break;\n }\n return str.length - i - 1;\n }", "title": "" }, { "docid": "efec530bfd2af4fb5a230bf167dfcd52", "score": "0.5800534", "text": "function firstNonRepeatedChar(word) {\n if (word.length == 0) {\n return word;\n }\n // Define some auxiliary variable\n var size = word.length - 1;\n var auxiliary = size;\n var result = \"\";\n var task = false;\n // Execute loop until when size is less than zero\n while (size >= 0) {\n // Skip similar adjacent characters\n while (size >= 0 && word.charAt(auxiliary) == word.charAt(size)) {\n size--;\n }\n if (size + 1 == auxiliary) {\n // When adjacent are not same \n // Then add new character at beginning of result\n result = word.charAt(auxiliary) + result;\n } else {\n // This is indicate string is modified\n task = true;\n }\n // Get new index\n auxiliary = size;\n }\n if (task) {\n return this.firstNonRepeatedChar(result);\n }\n return result;\n}", "title": "" }, { "docid": "55f74adaf035405cff85102b55cbc4f1", "score": "0.5796872", "text": "function firstLetters(str){\n let first3 = str.slice(0, 3);\n return first3;\n }", "title": "" }, { "docid": "efeda0a1a664e11cf4fc1f17336e5e0b", "score": "0.57962805", "text": "function disemvowel(str) {\n var arr = str.split(\"\");\n var trolls = ['U','e','i','o','u','A','E','I','O','a'];\n \n for (let i = 0; i < arr.length; i++) {\n for (let j = 0; j < trolls.length; j++) {\n if (arr[i] === trolls[j]) {\n arr.splice(i,1);\n }\n }\n }\n return arr.join('');\n}", "title": "" }, { "docid": "d723c4046423d7f4e0757677d1a39dd7", "score": "0.57934237", "text": "function firstNonRepeatingLetter (s) {\n // Add your code here\n let obj = {}\n let str = s.toLowerCase()\n\n // Change the array input into object with counter for each char appearance\n for (let i = 0; i < str.length; i++) {\n if (!obj[str[i]]) {\n obj[str[i]] = 1\n } else {\n obj[str[i]] += 1\n }\n }\n // console.log(obj)\n\n // Check the lowest counter for each key-value pair\n for (let key in obj) {\n if (obj[key] === 1) {\n return s[str.indexOf(key)]\n }\n }\n return ''\n}", "title": "" }, { "docid": "7ddfd8c334d5013513636cfe7cb65f0c", "score": "0.5792242", "text": "function firstNonRepeatedChar(str) {\n for (var i = 0; i < str.length; i++) {\n var c = str.charAt(i);\n if (str.indexOf(c) == i && str.indexOf(c, i + 1) == -1) {\n console.log(c)\n return c;\n \n }\n }\n return null;\n}", "title": "" }, { "docid": "acb4916790ccee1c6e3711b1635dbab6", "score": "0.57889795", "text": "function removeChars(str) {\n let arr = str.split('');\n let newResult = [];\n let final = [];\n let vowels = ['a', 'e', 'i', 'o', 'u'];\n // for (let i = 0; i < arr.length; i++) {\n // for (let j = 0; j < vowels.length; j++) {\n // if (arr[i] === vowels[j]) {\n // arr.splice(1, arr[i])\n // }\n // }\n // }\n // return arr.join('')\n for (let i = 0; i < arr.length; i++) {\n if (!vowels.includes(arr[i])) {\n newResult.push(arr[i])\n }\n }\n\n for (let i = 0; i < newResult.length; i++) {\n if (i % 2 === 0) {\n final.push(newResult[i])\n }\n }\n return final.join('')\n}", "title": "" }, { "docid": "0577f2b4b1195404207c39200d244cbb", "score": "0.5774808", "text": "function removeChar(str) {\n return str.slice(1, -1);\n}", "title": "" }, { "docid": "fb075fa3aad710a78a57f537ab94a314", "score": "0.5774374", "text": "function doCleaning (rawArr, arr, rem){ //Raw array, Clean array, number to remove by\n for (let i = 0; i < rawArr.length; i++){\n let str = rawArr[i];\n str = str.substring(0, str.length - rem);\n arr.push(str);\n }\n}", "title": "" }, { "docid": "96ad22ca157820b02567dc304d58e943", "score": "0.57608974", "text": "function removeChar(str) {\r\n\treturn str.slice(1, -1);\r\n}", "title": "" }, { "docid": "b0de649c215b679d35e4bd4d059bcc76", "score": "0.57589316", "text": "function remove_char_at_index(i, str){\n if(str.length == 1){ // if the length is one just return the empty string\n return \"\";\n } else if(i == str.length - 1){ // if the index we want to remove is the last position return substring before that index\n return str.substring(0, i);\n }else if (i == 0){ // if the index we want to remove is the first index create the substring after the first index\n return str.substring(i + 1);\n } else{ // otherwise create two substrings one after and one before the index and combine the result\n return str.substring(0, i) + str.substring(i + 1);\n }\n}", "title": "" }, { "docid": "bbe5a98b7e6c10b27ed37605d8e83560", "score": "0.5757329", "text": "function removeShortStrings(arr,min)\r\n{\r\n for (let index = 0; index < arr.length; index++) {\r\n if( arr[index].length < min )\r\n {\r\n arr.splice(index,1);\r\n index = index - 1;\r\n }\r\n }\r\n return arr\r\n}", "title": "" }, { "docid": "9d0cd17edb3b17a550810c38115911e3", "score": "0.5756343", "text": "function letterChecker(str) {\n for (let i = 0; i < str.length - 1; i++) {\n const charCode = str.charCodeAt(i);\n if ((charCode + 1) != str.charCodeAt(i + 1)) {\n let retString = String.fromCharCode(charCode + 1);\n return retString;\n }\n }\n return 'no missing letters'\n}", "title": "" }, { "docid": "6d48285727f67026648c0d4ce7774cb7", "score": "0.5755899", "text": "function findShort(s){\n s = s.split(\" \")\n let letters = s[0].length;\n \n for (let i = 1; i < s.length; i++) {\n if (s[i].length < letters) {\n letters = s[i].length\n }\n }\n return letters\n}", "title": "" }, { "docid": "7a46ed4a849432be05cf79a858e11b24", "score": "0.5755879", "text": "function removeLettersGuessed(alphabetLetters, guessedLetters) {\n var index = 0;\n while (index < guessedLetters.length) {\n var letter = guessedLetters[index]\n var letterIndex = alphabetLetters.indexOf(letter)\n alphabetLetters.splice(letterIndex, 1);\n index++\n }\n return alphabetLetters;\n}", "title": "" }, { "docid": "d114528fe396e1249bd23dfc9d607fe1", "score": "0.5754337", "text": "function smallestDistinctWindow(str){\n\t\tvar lettersSeen = [];\n\t\tvar uniqLetters = [];\n\t\tfor(var i = 0; i < str.length; i++){\n\t\t\tif(!lettersSeen[str[i]]){\n\t\t\t\tlettersSeen[str[i]] = true;\n\t\t\t\tuniqLetters.push(str[i]);\n\t\t\t}\n\t\t}\n\t\t//init memo, a little unorthodox since we're starting at substrs of uniqLetter.length and not building it up from size 1\n\t\tmemo = new Array(str.length - uniqLetters.length + 1);\n\n\t\tvar currSubSeq, pastSubSeq;\n\t\tvar charDiscarded, charAdded\n\t\tcurrSubSeq = lettersMissing(uniqLetters, str.substring(0,uniqLetters.length));\n\t\tif(currSubSeq.missing.length == 0) return uniqLetters.length;\n\n\t\tmemo[uniqLetters.length] = currSubSeq;\n\t\tfor(var windowSize = uniqLetters.length; windowSize < str.length ;windowSize++){\n\t\t\tfor(var windowStart = 0, windowEnd = windowSize; windowEnd <= str.length; windowStart++, windowEnd++ ){\n\t\t\t\t\t// very first iteration, we already inited \n\t\t\t\t\tif(windowSize == uniqLetters.length && windowStart == 0)\n\t\t\t\t\t\tcontinue; \n\n\t\t\t\t\tpastSubSeq = memo[windowEnd-1];\n\t\t\t\t\tcurrSubSeq = {missing: pastSubSeq.missing.slice(), freq: copy(pastSubSeq.freq)};\n\t\t\t\t\tcharDiscarded = str[windowStart-1];\n\t\t\t\t\tcharAdded = str[windowEnd-1];\n\t\t\t\t\n\t\t\t\t\tif(pastSubSeq.freq[charAdded] == undefined || pastSubSeq.freq[charAdded] == 0){ \n\t\t\t\t\t\tcurrSubSeq.missing = pastSubSeq.missing.filter(function(ele){ return ele != charAdded ? true : false;});\n\t\t\t\t\t\t//need to pop off charAdded from pastSubSeq missing list if it's in it\n\t\t\t\t\t}\n\t\t\t\t\t//each first inner loop needs to only add, not discard since window size has increased\n\t\t\t\t\tif(windowStart != 0){\n\t\t\t\t\t\tif(pastSubSeq.freq[charDiscarded] <= 1){\n\t\t\t\t\t\t\tcurrSubSeq.missing.push(charDiscarded);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// update curSubSeq's freq list for the char added and removed\n\t\t\t\t\t\tcurrSubSeq.freq[charDiscarded]--;\n\t\t\t\t\t}\n\t\t\t\t\tcurrSubSeq.freq[charAdded] = ( currSubSeq.freq[charAdded] == undefined) ? 1 : currSubSeq.freq[charAdded]+1;\n\t\t\t\t\t\n\t\t\t\t\tif(currSubSeq.missing.length == 0) \n\t\t\t\t\t\treturn windowSize;\n\t\t\t\t\tmemo[windowEnd] = currSubSeq;\n\t\t\t}\n\t\t}\n\t}", "title": "" } ]
6a7461e32904ebac3e840808daaaa17c
Adds dp noise to training points, exposed to use with dpslider;
[ { "docid": "85e96975685159b361194e96abf54540", "score": "0.7117844", "text": "function calcDpNoise(xOrig, dpNoise, modelSettings){\n return xOrig\n .map((d, i) => d + (dpNoise[i] - d)*modelSettings.dpNoise/5)\n .map(d => d3.clamp(pad*2, d, 1 - pad*2))\n }", "title": "" } ]
[ { "docid": "c17aeb022d55dfcbe027f42c061453af", "score": "0.5946774", "text": "function Noise(seed) {\n function Grad(x, y, z) {\n this.x = x; this.y = y; this.z = z;\n }\n\n Grad.prototype.dot2 = function(x, y) {\n return this.x*x + this.y*y;\n };\n\n Grad.prototype.dot3 = function(x, y, z) {\n return this.x*x + this.y*y + this.z*z;\n };\n\n this.grad3 = [new Grad(1,1,0),new Grad(-1,1,0),new Grad(1,-1,0),new Grad(-1,-1,0),\n new Grad(1,0,1),new Grad(-1,0,1),new Grad(1,0,-1),new Grad(-1,0,-1),\n new Grad(0,1,1),new Grad(0,-1,1),new Grad(0,1,-1),new Grad(0,-1,-1)];\n\n this.p = [151,160,137,91,90,15,\n 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,\n 190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,\n 88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166,\n 77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,\n 102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196,\n 135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123,\n 5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,\n 223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9,\n 129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228,\n 251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107,\n 49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254,\n 138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180];\n // To remove the need for index wrapping, double the permutation table length\n this.perm = new Array(512);\n this.gradP = new Array(512);\n\n this.seed(seed || 0);\n }", "title": "" }, { "docid": "c17aeb022d55dfcbe027f42c061453af", "score": "0.5946774", "text": "function Noise(seed) {\n function Grad(x, y, z) {\n this.x = x; this.y = y; this.z = z;\n }\n\n Grad.prototype.dot2 = function(x, y) {\n return this.x*x + this.y*y;\n };\n\n Grad.prototype.dot3 = function(x, y, z) {\n return this.x*x + this.y*y + this.z*z;\n };\n\n this.grad3 = [new Grad(1,1,0),new Grad(-1,1,0),new Grad(1,-1,0),new Grad(-1,-1,0),\n new Grad(1,0,1),new Grad(-1,0,1),new Grad(1,0,-1),new Grad(-1,0,-1),\n new Grad(0,1,1),new Grad(0,-1,1),new Grad(0,1,-1),new Grad(0,-1,-1)];\n\n this.p = [151,160,137,91,90,15,\n 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,\n 190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,\n 88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166,\n 77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,\n 102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196,\n 135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123,\n 5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,\n 223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9,\n 129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228,\n 251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107,\n 49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254,\n 138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180];\n // To remove the need for index wrapping, double the permutation table length\n this.perm = new Array(512);\n this.gradP = new Array(512);\n\n this.seed(seed || 0);\n }", "title": "" }, { "docid": "e866b48fc986ae872aa0f7de673064c1", "score": "0.5846988", "text": "setNoiseSuppression(ns) {\n this.devManager.setNoiseSuppression(ns);\n }", "title": "" }, { "docid": "41f8fcd4907b764516d6799df4cf82b0", "score": "0.58419794", "text": "function updateNoiseSlider() {\n\t\tvar r = 1 - this.value;\n\t\tif (r < 0) {\n\t\t\tr = 0;\n\t\t} else if (r > 1) {\n\t\t\tr = 1;\n\t\t}\n\t\t$('.js-range-slider-noise').data(\"ionRangeSlider\").update({ from: r });\n\t\tonNoiseSelectionChanged();\n\t}", "title": "" }, { "docid": "d2e6533937cac4b1ff5c7f0d6b092cca", "score": "0.57116205", "text": "function setup() {\n createCanvas(800, 800);\n noiseDetail(8, detail);\n makeNoise();\n}", "title": "" }, { "docid": "3a26572bc7f1d05477e653711a3fb85e", "score": "0.5610971", "text": "function PerlinNoise(seed) {\n const rnd =\n seed !== undefined ? new Marsaglia(seed) : Marsaglia.createRandomized();\n\n // http://www.noisemachine.com/talk1/17b.html\n // http://mrl.nyu.edu/~perlin/noise/\n // generate permutation\n const p = new Array(512);\n for (let i = 0; i < 256; ++i) {\n p[i] = i;\n }\n for (let i = 0; i < 256; ++i) {\n const t = p[(j = rnd.nextInt() & 0xff)];\n p[j] = p[i];\n p[i] = t;\n }\n // copy to avoid taking mod in p[0];\n for (let i = 0; i < 256; ++i) {\n p[i + 256] = p[i];\n }\n\n function grad3d(i, x, y, z) {\n const h = i & 15; // convert into 12 gradient directions\n const u = h < 8 ? x : y,\n v = h < 4 ? y : h === 12 || h === 14 ? x : z;\n return ((h & 1) === 0 ? u : -u) + ((h & 2) === 0 ? v : -v);\n }\n\n function grad2d(i, x, y) {\n const v = (i & 1) === 0 ? x : y;\n return (i & 2) === 0 ? -v : v;\n }\n\n function grad1d(i, x) {\n return (i & 1) === 0 ? -x : x;\n }\n\n function lerp(t, a, b) {\n return a + t * (b - a);\n }\n\n this.noise3d = function(x, y, z) {\n const X = Math.floor(x) & 255,\n Y = Math.floor(y) & 255,\n Z = Math.floor(z) & 255;\n x -= Math.floor(x);\n y -= Math.floor(y);\n z -= Math.floor(z);\n const fx = (3 - 2 * x) * x * x,\n fy = (3 - 2 * y) * y * y,\n fz = (3 - 2 * z) * z * z;\n const p0 = p[X] + Y,\n p00 = p[p0] + Z,\n p01 = p[p0 + 1] + Z,\n p1 = p[X + 1] + Y,\n p10 = p[p1] + Z,\n p11 = p[p1 + 1] + Z;\n return lerp(\n fz,\n lerp(\n fy,\n lerp(fx, grad3d(p[p00], x, y, z), grad3d(p[p10], x - 1, y, z)),\n lerp(fx, grad3d(p[p01], x, y - 1, z), grad3d(p[p11], x - 1, y - 1, z))\n ),\n lerp(\n fy,\n lerp(\n fx,\n grad3d(p[p00 + 1], x, y, z - 1),\n grad3d(p[p10 + 1], x - 1, y, z - 1)\n ),\n lerp(\n fx,\n grad3d(p[p01 + 1], x, y - 1, z - 1),\n grad3d(p[p11 + 1], x - 1, y - 1, z - 1)\n )\n )\n );\n };\n\n this.noise2d = function(x, y) {\n const X = Math.floor(x) & 255,\n Y = Math.floor(y) & 255;\n x -= Math.floor(x);\n y -= Math.floor(y);\n const fx = (3 - 2 * x) * x * x,\n fy = (3 - 2 * y) * y * y;\n const p0 = p[X] + Y,\n p1 = p[X + 1] + Y;\n return lerp(\n fy,\n lerp(fx, grad2d(p[p0], x, y), grad2d(p[p1], x - 1, y)),\n lerp(fx, grad2d(p[p0 + 1], x, y - 1), grad2d(p[p1 + 1], x - 1, y - 1))\n );\n };\n\n this.noise1d = function(x) {\n const X = Math.floor(x) & 255;\n x -= Math.floor(x);\n const fx = (3 - 2 * x) * x * x;\n return lerp(fx, grad1d(p[X], x), grad1d(p[X + 1], x - 1));\n };\n }", "title": "" }, { "docid": "087042b38ef79f2e98188b8da2a2357b", "score": "0.560459", "text": "function PerlinNoise(seed) {\n var rnd = seed !== undefined ? new Marsaglia(seed) : Marsaglia.createRandomized();\n var i, j;\n // http://www.noisemachine.com/talk1/17b.html\n // http://mrl.nyu.edu/~perlin/noise/\n // generate permutation\n var p = new Array(512); \n for(i=0;i<256;++i) { p[i] = i; }\n for(i=0;i<256;++i) { var t = p[j = rnd.nextInt() & 0xFF]; p[j] = p[i]; p[i] = t; }\n // copy to avoid taking mod in p[0];\n for(i=0;i<256;++i) { p[i + 256] = p[i]; } \n \n function grad3d(i,x,y,z) { \n\tvar h = i & 15; // convert into 12 gradient directions\n\tvar u = h<8 ? x : y, \n\t\tv = h<4 ? y : h===12||h===14 ? x : z;\n\treturn ((h&1) === 0 ? u : -u) + ((h&2) === 0 ? v : -v);\n }\n\t\t\n function grad2d(i,x,y) { \n\tvar v = (i & 1) === 0 ? x : y;\n\treturn (i&2) === 0 ? -v : v;\n }\n \n function grad1d(i,x) { \n\treturn (i&1) === 0 ? -x : x;\n }\n \n function lerp(t,a,b) { return a + t * (b - a); }\n\t\n this.noise3d = function(x, y, z) {\n\tvar X = Math.floor(x)&255, Y = Math.floor(y)&255, Z = Math.floor(z)&255;\n\tx -= Math.floor(x); y -= Math.floor(y); z -= Math.floor(z);\n\tvar fx = (3-2*x)*x*x, fy = (3-2*y)*y*y, fz = (3-2*z)*z*z;\n\tvar p0 = p[X]+Y, p00 = p[p0] + Z, p01 = p[p0 + 1] + Z, p1 = p[X + 1] + Y, p10 = p[p1] + Z, p11 = p[p1 + 1] + Z;\n\treturn lerp(fz, \n\t lerp(fy, lerp(fx, grad3d(p[p00], x, y, z), grad3d(p[p10], x-1, y, z)),\n\t\t\t lerp(fx, grad3d(p[p01], x, y-1, z), grad3d(p[p11], x-1, y-1,z))),\n\t lerp(fy, lerp(fx, grad3d(p[p00 + 1], x, y, z-1), grad3d(p[p10 + 1], x-1, y, z-1)),\n\t\t\t lerp(fx, grad3d(p[p01 + 1], x, y-1, z-1), grad3d(p[p11 + 1], x-1, y-1,z-1))));\n };\n \n this.noise2d = function(x, y) {\n\tvar X = Math.floor(x)&255, Y = Math.floor(y)&255;\n\tx -= Math.floor(x); y -= Math.floor(y);\n\tvar fx = (3-2*x)*x*x, fy = (3-2*y)*y*y;\n\tvar p0 = p[X]+Y, p1 = p[X + 1] + Y;\n\treturn lerp(fy, \n\t lerp(fx, grad2d(p[p0], x, y), grad2d(p[p1], x-1, y)),\n\t lerp(fx, grad2d(p[p0 + 1], x, y-1), grad2d(p[p1 + 1], x-1, y-1)));\n };\n\t\t\n this.noise1d = function(x) {\n\tvar X = Math.floor(x)&255;\n\tx -= Math.floor(x);\n\tvar fx = (3-2*x)*x*x;\n\treturn lerp(fx, grad1d(p[X], x), grad1d(p[X+1], x-1));\n };\n}", "title": "" }, { "docid": "bab50fa71b3d99efa6664deabc5d5f19", "score": "0.55722195", "text": "generateNoise (x, y) {\n let nx = x / this.canvas.width - 0.5\n let ny = y / this.canvas.height - 0.5\n\n // mix things up with varied frquencies and octaves\n let frequency = 1.5\n let value = (\n 1* this.simplex.noise2D(frequency * nx, frequency * ny) +\n 0.5 * this.simplex.noise2D(2 * frequency * nx, 2 * frequency * ny) +\n 0.25 * this.simplex.noise2D(4 * frequency * nx, 4 * frequency * ny) +\n 0.125 * this.simplex.noise2D(8 * frequency * nx, 8 * frequency * ny)\n )\n value = Math.pow(value, 2)\n\n // Higher values at center\n let distance = Math.hypot(this.canvas.width / 2 - x, this.canvas.height / 2 - y) / 255\n // calibration constants, came of with these by playing around\n // roughly regulate island size\n let a = 0.5\n let b = 0.6\n let c = 0.6\n value = (value + a) * (1 - b * Math.pow(distance, c))\n value *= 255\n return value\n }", "title": "" }, { "docid": "acbd9bd9f8bbef27bb572f4160487e5f", "score": "0.5556093", "text": "function PerlinNoise(seed) {\n var rnd = seed !== undefined ? new Marsaglia(seed) : Marsaglia.createRandomized();\n var i, j;\n // http://www.noisemachine.com/talk1/17b.html\n // http://mrl.nyu.edu/~perlin/noise/\n // generate permutation\n var p = new Array(512); \n for(i=0;i<256;++i) { p[i] = i; }\n for(i=0;i<256;++i) { var t = p[j = rnd.nextInt() & 0xFF]; p[j] = p[i]; p[i] = t; }\n // copy to avoid taking mod in p[0];\n for(i=0;i<256;++i) { p[i + 256] = p[i]; } \n \n function grad3d(i,x,y,z) { \n var h = i & 15; // convert into 12 gradient directions\n var u = h<8 ? x : y, \n v = h<4 ? y : h===12||h===14 ? x : z;\n return ((h&1) === 0 ? u : -u) + ((h&2) === 0 ? v : -v);\n }\n\n function grad2d(i,x,y) { \n var v = (i & 1) === 0 ? x : y;\n return (i&2) === 0 ? -v : v;\n }\n \n function grad1d(i,x) { \n return (i&1) === 0 ? -x : x;\n }\n \n function lerp(t,a,b) { return a + t * (b - a); }\n \n this.noise3d = function(x, y, z) {\n var X = Math.floor(x)&255, Y = Math.floor(y)&255, Z = Math.floor(z)&255;\n x -= Math.floor(x); y -= Math.floor(y); z -= Math.floor(z);\n var fx = (3-2*x)*x*x, fy = (3-2*y)*y*y, fz = (3-2*z)*z*z;\n var p0 = p[X]+Y, p00 = p[p0] + Z, p01 = p[p0 + 1] + Z, p1 = p[X + 1] + Y, p10 = p[p1] + Z, p11 = p[p1 + 1] + Z;\n return lerp(fz, \n lerp(fy, lerp(fx, grad3d(p[p00], x, y, z), grad3d(p[p10], x-1, y, z)),\n lerp(fx, grad3d(p[p01], x, y-1, z), grad3d(p[p11], x-1, y-1,z))),\n lerp(fy, lerp(fx, grad3d(p[p00 + 1], x, y, z-1), grad3d(p[p10 + 1], x-1, y, z-1)),\n lerp(fx, grad3d(p[p01 + 1], x, y-1, z-1), grad3d(p[p11 + 1], x-1, y-1,z-1))));\n };\n \n this.noise2d = function(x, y) {\n var X = Math.floor(x)&255, Y = Math.floor(y)&255;\n x -= Math.floor(x); y -= Math.floor(y);\n var fx = (3-2*x)*x*x, fy = (3-2*y)*y*y;\n var p0 = p[X]+Y, p1 = p[X + 1] + Y;\n return lerp(fy, \n lerp(fx, grad2d(p[p0], x, y), grad2d(p[p1], x-1, y)),\n lerp(fx, grad2d(p[p0 + 1], x, y-1), grad2d(p[p1 + 1], x-1, y-1)));\n };\n\n this.noise1d = function(x) {\n var X = Math.floor(x)&255;\n x -= Math.floor(x);\n var fx = (3-2*x)*x*x;\n return lerp(fx, grad1d(p[X], x), grad1d(p[X+1], x-1));\n };\n}", "title": "" }, { "docid": "6f79980c12b17bd6b7efab5946120d74", "score": "0.5478116", "text": "function PerlinNoise(seed) {\n var rnd = (seed !== undefined) ? new Marsaglia(seed) : Marsaglia.createRandomized();\n var i, j;\n // generate permutation\n var p = new Array(512); \n for (i = 0; i<256; ++i) { \n p[i] = i; \n }\n for (i = 0; i<256; ++i) { \n j = rnd.nextInt();\n var t = p[j & 0xFF]; \n p[j] = p[i]; \n p[i] = t; \n }\n // copy to avoid taking mod in p[0];\n for (i = 0; i<256; ++i) { \n p[i + 256] = p[i]; \n }\n function grad3d(i, x, y, z) { \n var h = i & 15; // convert into 12 gradient directions\n var u = h < 8 ? x : y, \n v = h < 4 ? y : h === 12 || h === 14 ? x : z;\n return ((h & 1) === 0 ? u : -u) + ((h & 2) === 0 ? v : -v);\n }\n function grad2d(i, x, y) { \n var v = (i & 1) === 0 ? x : y;\n return (i & 2) === 0 ? -v : v;\n }\n function grad1d(i, x) { \n return (i & 1) === 0 ? -x : x;\n }\n function lerp(t, a, b) { \n return a + t * (b - a); \n }\n this.noise3d = function(x, y, z) {\n var X = Math.floor(x) & 255, \n Y = Math.floor(y) & 255, \n Z = Math.floor(z) & 255;\n\n x -= Math.floor(x); \n y -= Math.floor(y); \n z -= Math.floor(z);\n\n var fx = (3 - 2*x)*x*x, \n fy = (3 - 2*y)*y*y, \n fz = (3 - 2*z)*z*z;\n\n var p0 = Y + p[X], \n p1 = Y + p[X + 1], \n p00 = Z + p[p0], \n p01 = Z + p[p0 + 1], \n p10 = Z + p[p1], \n p11 = Z + p[p1 + 1];\n\n return lerp(fz, \n lerp(fy, \n lerp(fx, grad3d(p[p00], x, y, z), grad3d(p[p10], x-1, y, z)),\n lerp(fx, grad3d(p[p01], x, y-1, z), grad3d(p[p11], x-1, y-1,z))\n ),\n lerp(fy, \n lerp(fx, grad3d(p[p00 + 1], x, y, z-1), grad3d(p[p10 + 1], x-1, y, z-1)),\n lerp(fx, grad3d(p[p01 + 1], x, y-1, z-1), grad3d(p[p11 + 1], x-1, y-1,z-1))\n )\n );\n };\n\n this.noise2d = function(x, y) {\n var X = Math.floor(x) & 255, \n Y = Math.floor(y) & 255;\n\n x -= Math.floor(x); \n y -= Math.floor(y);\n\n var fx = (3 - 2*x)*x*x, \n fy = (3 - 2*y)*y*y;\n\n var p0 = Y + p[X], \n p1 = Y + p[X + 1];\n\n return lerp(fy, \n lerp(fx, grad2d(p[p0], x, y), grad2d(p[p1], x-1, y)),\n lerp(fx, grad2d(p[p0 + 1], x, y-1), grad2d(p[p1 + 1], x-1, y-1))\n );\n };\n\n this.noise1d = function(x) {\n var X = Math.floor(x) & 255;\n x -= Math.floor(x);\n\n var fx = (3 - 2*x)*x*x;\n return lerp(fx, grad1d(p[X], x), grad1d(p[X+1], x-1));\n };\n}", "title": "" }, { "docid": "f815c3bd1fb9521b5814ae734e9c8ee1", "score": "0.5418678", "text": "function PerlinNoise(seed) {\n var rnd = seed !== undef ? new Marsaglia(seed, (seed<<16)+(seed>>16)) : Marsaglia.createRandomized();\n var i, j;\n // http://www.noisemachine.com/talk1/17b.html\n // http://mrl.nyu.edu/~perlin/noise/\n // generate permutation\n var perm = new Uint8Array(512);\n for(i=0;i<256;++i) { perm[i] = i; }\n for(i=0;i<256;++i) {\n // NOTE: we can only do this because we've made sure the Marsaglia generator\n // gives us numbers where the last byte in a pseudo-random number is\n // still pseudo-random. If no 2nd argument is passed in the constructor,\n // that is no longer the case and this pair swap will always run identically.\n var t = perm[j = rnd.intGenerator() & 0xFF];\n perm[j] = perm[i];\n perm[i] = t;\n }\n // copy to avoid taking mod in perm[0];\n for(i=0;i<256;++i) { perm[i + 256] = perm[i]; }\n\n function grad3d(i,x,y,z) {\n var h = i & 15; // convert into 12 gradient directions\n var u = h<8 ? x : y,\n v = h<4 ? y : h===12||h===14 ? x : z;\n return ((h&1) === 0 ? u : -u) + ((h&2) === 0 ? v : -v);\n }\n\n function grad2d(i,x,y) {\n var v = (i & 1) === 0 ? x : y;\n return (i&2) === 0 ? -v : v;\n }\n\n function grad1d(i,x) {\n return (i&1) === 0 ? -x : x;\n }\n\n function lerp(t,a,b) { return a + t * (b - a); }\n\n this.noise3d = function(x, y, z) {\n var X = Math.floor(x)&255, Y = Math.floor(y)&255, Z = Math.floor(z)&255;\n x -= Math.floor(x); y -= Math.floor(y); z -= Math.floor(z);\n var fx = (3-2*x)*x*x, fy = (3-2*y)*y*y, fz = (3-2*z)*z*z;\n var p0 = perm[X]+Y, p00 = perm[p0] + Z, p01 = perm[p0 + 1] + Z,\n p1 = perm[X + 1] + Y, p10 = perm[p1] + Z, p11 = perm[p1 + 1] + Z;\n return lerp(fz,\n lerp(fy, lerp(fx, grad3d(perm[p00], x, y, z), grad3d(perm[p10], x-1, y, z)),\n lerp(fx, grad3d(perm[p01], x, y-1, z), grad3d(perm[p11], x-1, y-1,z))),\n lerp(fy, lerp(fx, grad3d(perm[p00 + 1], x, y, z-1), grad3d(perm[p10 + 1], x-1, y, z-1)),\n lerp(fx, grad3d(perm[p01 + 1], x, y-1, z-1), grad3d(perm[p11 + 1], x-1, y-1,z-1))));\n };\n\n this.noise2d = function(x, y) {\n var X = Math.floor(x)&255, Y = Math.floor(y)&255;\n x -= Math.floor(x); y -= Math.floor(y);\n var fx = (3-2*x)*x*x, fy = (3-2*y)*y*y;\n var p0 = perm[X]+Y, p1 = perm[X + 1] + Y;\n return lerp(fy,\n lerp(fx, grad2d(perm[p0], x, y), grad2d(perm[p1], x-1, y)),\n lerp(fx, grad2d(perm[p0 + 1], x, y-1), grad2d(perm[p1 + 1], x-1, y-1)));\n };\n\n this.noise1d = function(x) {\n var X = Math.floor(x)&255;\n x -= Math.floor(x);\n var fx = (3-2*x)*x*x;\n return lerp(fx, grad1d(perm[X], x), grad1d(perm[X+1], x-1));\n };\n }", "title": "" }, { "docid": "407d842c6b3a18355c516bf8d80bb01b", "score": "0.53767085", "text": "function makeNoiseTab() {\n\t\t// slider:\n\t\tvar $R = $(\".js-range-slider-noise\");\n\t\t$R.ionRangeSlider({\n\t\t\ttype: \"single\",\n\t\t\tgrid: true,\n\t\t\tmin: 0,\n\t\t\tmax: 1,\n\t\t\tfrom: 0,\n\t\t\tstep: 0.01,\n\t\t\tonChange: function (data) {\n\t\t\t\tupdateBottomBlochSphere();\n\t\t\t},\n\t\t\tprettify: function (num) {\n\t\t\t\treturn sliceDecimals(1 - num);\n\t\t\t}\n\t\t});\n\n\t\tonNoiseSelectionChanged();\n\t}", "title": "" }, { "docid": "fb129be9f4bce0c0d484bf2e5eb4bad1", "score": "0.532204", "text": "function laplace_noise(budget, sensitivity ) {\n return laplace(0.0, (sensitivity / budget));\n}", "title": "" }, { "docid": "e4333be47ea8ca951e65fbc58a17310c", "score": "0.51709825", "text": "function onNoiseSelectionChanged() {\n\t\t$(\"#noise_r\").val(1 - $(\"#noise_slider\").val());\n\n\t\tvar x = $(\"#noise-select\").val();\n\t\tvar r = 1 - parseFloat($(\"#noise_slider\").val());\n\t\tvar s_r = Math.sqrt(r);\n\t\tvar s_emr = Math.sqrt(1 - r);\n\n\t\t$(\"#noise-equation-img\").removeClass(\"invisible\");\n\t\t$(\"#noise-update_button\").addClass(\"invisible\");\n\t\t$('#input_noise_E1_a').prop('disabled', true);\n\t\t$('#input_noise_E1_b').prop('disabled', true);\n\t\t$('#input_noise_E1_c').prop('disabled', true);\n\t\t$('#input_noise_E1_d').prop('disabled', true);\n\t\t$('#input_noise_E2_a').prop('disabled', true);\n\t\t$('#input_noise_E2_b').prop('disabled', true);\n\t\t$('#input_noise_E2_c').prop('disabled', true);\n\t\t$('#input_noise_E2_d').prop('disabled', true);\n\n\n\t\tif (x == \"D\") { // depolarizing\n\t\t\t$(\"#noise-equation-img\").attr('src', \"img/noiseEq_D.png\");\n\t\t\tsetNoiseMatrices([[s_r, 0], [0, s_r]], [[0, 0], [0, 0]]);\n\t\t}\n\t\telse if (x == \"PhX\") { // dephase x\n\t\t\t$(\"#noise-equation-img\").attr('src', \"img/noiseEq_PhX.png\");\n\t\t\tsetNoiseMatrices([[s_r, 0], [0, s_r]], [[0, s_emr], [s_emr, 0]]);\n\t\t}\n\t\telse if (x == \"PhZ\") { // dephase y\n\t\t\t$(\"#noise-equation-img\").attr('src', \"img/noiseEq_PhZ.png\");\n\t\t\tsetNoiseMatrices([[s_r, 0], [0, s_r]], [[s_emr, 0], [0, -1 * s_emr]]);\n\t\t}\n\t\telse if (x == \"A\") { // amplitude damping\n\t\t\t$(\"#noise-equation-img\").attr('src', \"img/noiseEq_A.png\");\n\t\t\tsetNoiseMatrices([[1, 0], [0, s_r]], [[0, s_emr], [0, 0]]);\n\t\t}\n\t\telse if (x == \"user\") { // user defined function\n\t\t\t$(\"#noise-update_button\").removeClass(\"invisible\");\n\t\t\t$(\"#noise-equation-img\").addClass(\"invisible\");\n\t\t\t$('#input_noise_E1_a').prop('disabled', false);\n\t\t\t$('#input_noise_E1_b').prop('disabled', false);\n\t\t\t$('#input_noise_E1_c').prop('disabled', false);\n\t\t\t$('#input_noise_E1_d').prop('disabled', false);\n\t\t\t$('#input_noise_E2_a').prop('disabled', false);\n\t\t\t$('#input_noise_E2_b').prop('disabled', false);\n\t\t\t$('#input_noise_E2_c').prop('disabled', false);\n\t\t\t$('#input_noise_E2_d').prop('disabled', false);\n\t\t} // if\n\t}", "title": "" }, { "docid": "56a931c62f7fd5bcac7d5a8def0ce8ed", "score": "0.5130582", "text": "jitter(){\n var endTime = new Date();\n var timeElapsed = endTime - startTime;\n var xNoise = noise(timeElapsed * this.force/10) * round(random(-1, 1)) * this.force;\n var yNoise = noise(timeElapsed * this.force/10) * round(random(-1, 1)) * this.force;\n this.end.x += xNoise ;\n this.end.y += yNoise;\n }", "title": "" }, { "docid": "2f45a33bdaa4528664261b81c0cbde21", "score": "0.5035876", "text": "function setup() {\n createCanvas(400, 400);\n noise = new OpenSimplexNoise(Date.now());\n cols = 1 + width / res;\n rows = 1 + height / res;\n arr = gen2DArr(cols, rows);\n}", "title": "" }, { "docid": "d865986aa141abdfdf55f8e1c21c09b6", "score": "0.49808097", "text": "function SimplexNoise(iRandomPoolSize) { // Simplex noise in 2D, 3D and 4D\n var grad3 = [ [ 1, 1, 0], [-1, 1, 0], [ 1,-1, 0], [-1,-1, 0],\n [ 1, 0, 1], [-1, 0, 1], [ 1, 0,-1], [-1, 0,-1],\n [ 0, 1, 1], [ 0,-1, 1], [ 0, 1,-1], [ 0,-1,-1] ];\n var grad4 = [ [ 0, 1, 1, 1], [ 0, 1, 1,-1], [ 0, 1,-1, 1], [ 0, 1,-1,-1],\n [ 0,-1, 1, 1], [ 0,-1, 1,-1], [ 0,-1,-1, 1], [ 0,-1,-1,-1],\n [ 1, 0, 1, 1], [ 1, 0, 1,-1], [ 1, 0,-1, 1], [ 1, 0,-1,-1],\n [-1, 0, 1, 1], [-1, 0, 1,-1], [-1, 0,-1, 1], [-1, 0,-1,-1],\n [ 1, 1, 0, 1], [ 1, 1, 0,-1], [ 1,-1, 0, 1], [ 1,-1, 0,-1],\n [-1, 1, 0, 1], [-1, 1, 0,-1], [-1,-1, 0, 1], [-1,-1, 0,-1],\n [ 1, 1, 1, 0], [ 1, 1,-1, 0], [ 1,-1, 1, 0], [ 1,-1,-1, 0],\n [-1, 1, 1, 0], [-1, 1,-1, 0], [-1,-1, 1, 0], [-1,-1,-1, 0] ];\n // A lookup table to traverse the simplex around a given point in 4D.\n // Details can be found where this table is used, in the 4D noise method.\n var simplex = [ [0,1,2,3],[0,1,3,2],[0,0,0,0],[0,2,3,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,3,0],\n [0,2,1,3],[0,0,0,0],[0,3,1,2],[0,3,2,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,3,2,0],\n [0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],\n [1,2,0,3],[0,0,0,0],[1,3,0,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,3,0,1],[2,3,1,0],\n [1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,3,0],\n [0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],\n [2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0],\n [2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0] ];\n if (!iRandomPoolSize) iRandomPoolSize = 1024;\n var aiRnd = new Array(iRandomPoolSize * 3);\n for (var i = 0; i < iRandomPoolSize; i++) {\n aiRnd[i] = aiRnd[i + iRandomPoolSize] = aiRnd[i + 2*iRandomPoolSize] = Math.floor(Math.random() * iRandomPoolSize);\n }\n // <snip> floor function </snip>\n function dot2(g, x, y) {\n return g[0]*x + g[1]*y;\n }\n function dot3(g, x, y, z) {\n return g[0]*x + g[1]*y + g[2]*z;\n }\n function dot4(g, x, y, z, w) {\n return g[0]*x + g[1]*y + g[2]*z + g[3]*w;\n }\n // 2D simplex noise\n var F2 = 0.5*(Math.sqrt(3)-1);\n var G2 = (3-Math.sqrt(3))/6;\n this.noise2 = function (xin, yin) {\n var n0, n1, n2; // Noise contributions from the three corners\n // Skew the input space to determine which simplex cell we're in\n var s = (xin+yin)*F2; // Hairy factor for 2D\n var i = Math.floor(xin+s);\n var j = Math.floor(yin+s);\n var t = (i+j)*G2;\n var X0 = i-t; // Unskew the cell origin back to (x,y) space\n var Y0 = j-t;\n var x0 = xin-X0; // The x,y distances from the cell origin\n var y0 = yin-Y0;\n // For the 2D case, the simplex shape is an equilateral triangle.\n // Determine which simplex we are in.\n var i1, j1; // Offsets for second (middle) corner of simplex in (i,j) coords\n if (x0>y0) {\n i1=1; j1=0; // lower triangle, XY order: (0,0)->(1,0)->(1,1)\n } else {\n i1=0; j1=1; // upper triangle, YX order: (0,0)->(0,1)->(1,1)\n }\n // A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and\n // a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where\n // c = (3-sqrt(3))/6\n var x1 = x0 - i1 + G2; // Offsets for middle corner in (x,y) unskewed coords\n var y1 = y0 - j1 + G2;\n var x2 = x0 - 1 + 2 * G2; // Offsets for last corner in (x,y) unskewed coords\n var y2 = y0 - 1 + 2 * G2;\n // Work out the hashed gradient indices of the three simplex corners\n var ii = i % iRandomPoolSize;\n var jj = j % iRandomPoolSize;\n var gi0 = aiRnd[ii+aiRnd[jj]] % 12;\n var gi1 = aiRnd[ii+i1+aiRnd[jj+j1]] % 12;\n var gi2 = aiRnd[ii+1+aiRnd[jj+1]] % 12;\n // Calculate the contribution from the three corners\n var n = 0;\n var t0 = 0.5 - x0*x0-y0*y0;\n if (t0<0) {\n n0 = 0;\n } else {\n t0 *= t0;\n n0 = t0 * t0 * dot2(grad3[gi0], x0, y0); // (x,y) of grad3 used for 2D gradient\n }\n var t1 = 0.5 - x1*x1-y1*y1;\n if(t1<0) {\n n1 = 0;\n } else {\n t1 *= t1;\n n1 = t1 * t1 * dot2(grad3[gi1], x1, y1);\n }\n var t2 = 0.5 - x2*x2-y2*y2;\n if (t2<0) {\n n2 = 0;\n } else {\n t2 *= t2;\n n2 = t2 * t2 * dot2(grad3[gi2], x2, y2);\n }\n // Add contributions from each corner to get the final noise value.\n // The result is scaled to return values in the interval [-1,1].\n return 70 * (n0 + n1 + n2);\n }\n // 3D simplex noise\n var F3 = 1/3;\n var G3 = 1/6;\n this.noise3 = function(xin, yin, zin) {\n var n0, n1, n2, n3; // Noise contributions from the four corners\n // Skew the input space to determine which simplex cell we're in\n var s = (xin+yin+zin)*F3; // Very nice and simple skew factor for 3D\n var i = Math.floor(xin+s);\n var j = Math.floor(yin+s);\n var k = Math.floor(zin+s);\n var t = (i+j+k)*G3; \n var X0 = i-t; // Unskew the cell origin back to (x,y,z) space\n var Y0 = j-t;\n var Z0 = k-t;\n var x0 = xin-X0; // The x,y,z distances from the cell origin\n var y0 = yin-Y0;\n var z0 = zin-Z0;\n // For the 3D case, the simplex shape is a slightly irregular tetrahedron.\n // Determine which simplex we are in.\n var i1, j1, k1; // Offsets for second corner of simplex in (i,j,k) coords\n var i2, j2, k2; // Offsets for third corner of simplex in (i,j,k) coords\n if(x0>=y0) {\n if(y0>=z0) {\n i1=1; j1=0; k1=0; i2=1; j2=1; k2=0; // X Y Z order\n } else if(x0>=z0) {\n i1=1; j1=0; k1=0; i2=1; j2=0; k2=1; // X Z Y order\n } else {\n i1=0; j1=0; k1=1; i2=1; j2=0; k2=1; // Z X Y order\n }\n } else { // x0<y0\n if(y0<z0) {\n i1=0; j1=0; k1=1; i2=0; j2=1; k2=1; // Z Y X order\n } else if(x0<z0) {\n i1=0; j1=1; k1=0; i2=0; j2=1; k2=1; // Y Z X order\n } else {\n i1=0; j1=1; k1=0; i2=1; j2=1; k2=0; // Y X Z order\n }\n }\n // A step of (1,0,0) in (i,j,k) means a step of (1-c,-c,-c) in (x,y,z),\n // a step of (0,1,0) in (i,j,k) means a step of (-c,1-c,-c) in (x,y,z), and\n // a step of (0,0,1) in (i,j,k) means a step of (-c,-c,1-c) in (x,y,z), where\n // c = 1/6.\n var x1 = x0 - i1 + G3; // Offsets for second corner in (x,y,z) coords\n var y1 = y0 - j1 + G3;\n var z1 = z0 - k1 + G3;\n var x2 = x0 - i2 + 2*G3; // Offsets for third corner in (x,y,z) coords\n var y2 = y0 - j2 + 2*G3;\n var z2 = z0 - k2 + 2*G3;\n var x3 = x0 - 1 + 3*G3; // Offsets for last corner in (x,y,z) coords\n var y3 = y0 - 1 + 3*G3;\n var z3 = z0 - 1 + 3*G3;\n // Work out the hashed gradient indices of the four simplex corners\n var ii = i % iRandomPoolSize; if (ii < 0) ii += iRandomPoolSize;\n var jj = j % iRandomPoolSize; if (jj < 0) jj += iRandomPoolSize;\n var kk = k % iRandomPoolSize; if (kk < 0) kk += iRandomPoolSize;\n // Calculate the contribution from the four corners\n var n = 0;\n var t = 0.6 - x0*x0 - y0*y0 - z0*z0;\n if(t>0) {\n var gi0 = aiRnd[ii+aiRnd[jj+aiRnd[kk]]] % 12;\n n += (t *= t) * t * dot3(grad3[gi0], x0, y0, z0);\n }\n var t = 0.6 - x1*x1 - y1*y1 - z1*z1;\n if(t>0) {\n var gi1 = aiRnd[ii+i1+aiRnd[jj+j1+aiRnd[kk+k1]]] % 12;\n n += (t *= t) * t * dot3(grad3[gi1], x1, y1, z1);\n }\n var t = 0.6 - x2*x2 - y2*y2 - z2*z2;\n if(t>0) {\n var gi2 = aiRnd[ii+i2+aiRnd[jj+j2+aiRnd[kk+k2]]] % 12;\n n += (t *= t) * t * dot3(grad3[gi2], x2, y2, z2);\n }\n var t = 0.6 - x3*x3 - y3*y3 - z3*z3;\n if(t>0) {\n var gi3 = aiRnd[ii+1+aiRnd[jj+1+aiRnd[kk+1]]] % 12;\n n += (t *= t) * t * dot3(grad3[gi3], x3, y3, z3);\n }\n // Add contributions from each corner to get the final noise value.\n // The result is scaled to stay just inside [-1,1]\n return 32*n;\n }\n // 4D simplex noise\n var F4 = (Math.sqrt(5)-1)/4;\n var G4 = (5-Math.sqrt(5))/20;\n this.noise4 = function(x, y, z, w) {\n var n0, n1, n2, n3, n4; // Noise contributions from the five corners\n // Skew the (x,y,z,w) space to determine which cell of 24 simplices we're in\n var s = (x + y + z + w) * F4; // Factor for 4D skewing\n var i = Math.floor(x + s);\n var j = Math.floor(y + s);\n var k = Math.floor(z + s);\n var l = Math.floor(w + s);\n var t = (i + j + k + l) * G4; // Factor for 4D unskewing\n var X0 = i - t; // Unskew the cell origin back to (x,y,z,w) space\n var Y0 = j - t;\n var Z0 = k - t;\n var W0 = l - t;\n var x0 = x - X0; // The x,y,z,w distances from the cell origin\n var y0 = y - Y0;\n var z0 = z - Z0;\n var w0 = w - W0;\n // For the 4D case, the simplex is a 4D shape I won't even try to describe.\n // To find out which of the 24 possible simplices we're in, we need to\n // determine the magnitude ordering of x0, y0, z0 and w0.\n // The method below is a good way of finding the ordering of x,y,z,w and\n // then find the correct traversal order for the simplex we’re in.\n // First, six pair-wise comparisons are performed between each possible pair\n // of the four coordinates, and the results are used to add up binary bits\n // for an integer index.\n var c1 = (x0 > y0) ? 32 : 0;\n var c2 = (x0 > z0) ? 16 : 0;\n var c3 = (y0 > z0) ? 8 : 0;\n var c4 = (x0 > w0) ? 4 : 0;\n var c5 = (y0 > w0) ? 2 : 0;\n var c6 = (z0 > w0) ? 1 : 0;\n var c = c1 + c2 + c3 + c4 + c5 + c6;\n var i1, j1, k1, l1; // The integer offsets for the second simplex corner\n var i2, j2, k2, l2; // The integer offsets for the third simplex corner\n var i3, j3, k3, l3; // The integer offsets for the fourth simplex corner\n // simplex[c] is a 4-vector with the numbers 0, 1, 2 and 3 in some order.\n // Many values of c will never occur, since e.g. x>y>z>w makes x<z, y<w and x<w\n // impossible. Only the 24 indices which have non-zero entries make any sense.\n // We use a thresholding to set the coordinates in turn from the largest magnitude.\n // The number 3 in the \"simplex\" array is at the position of the largest coordinate.\n i1 = simplex[c][0]>=3 ? 1 : 0;\n j1 = simplex[c][1]>=3 ? 1 : 0;\n k1 = simplex[c][2]>=3 ? 1 : 0;\n l1 = simplex[c][3]>=3 ? 1 : 0;\n // The number 2 in the \"simplex\" array is at the second largest coordinate.\n i2 = simplex[c][0]>=2 ? 1 : 0;\n j2 = simplex[c][1]>=2 ? 1 : 0;\n k2 = simplex[c][2]>=2 ? 1 : 0;\n l2 = simplex[c][3]>=2 ? 1 : 0;\n // The number 1 in the \"simplex\" array is at the second smallest coordinate.\n i3 = simplex[c][0]>=1 ? 1 : 0;\n j3 = simplex[c][1]>=1 ? 1 : 0;\n k3 = simplex[c][2]>=1 ? 1 : 0;\n l3 = simplex[c][3]>=1 ? 1 : 0;\n // The fifth corner has all coordinate offsets = 1, so no need to look that up.\n var x1 = x0 - i1 + G4; // Offsets for second corner in (x,y,z,w) coords\n var y1 = y0 - j1 + G4;\n var z1 = z0 - k1 + G4;\n var w1 = w0 - l1 + G4;\n var x2 = x0 - i2 + 2*G4; // Offsets for third corner in (x,y,z,w) coords\n var y2 = y0 - j2 + 2*G4;\n var z2 = z0 - k2 + 2*G4;\n var w2 = w0 - l2 + 2*G4;\n var x3 = x0 - i3 + 3*G4; // Offsets for fourth corner in (x,y,z,w) coords\n var y3 = y0 - j3 + 3*G4;\n var z3 = z0 - k3 + 3*G4;\n var w3 = w0 - l3 + 3*G4;\n var x4 = x0 - 1 + 4*G4; // Offsets for last corner in (x,y,z,w) coords\n var y4 = y0 - 1 + 4*G4;\n var z4 = z0 - 1 + 4*G4;\n var w4 = w0 - 1 + 4*G4;\n // Work out the hashed gradient indices of the five simplex corners\n var ii = i % iRandomPoolSize;\n var jj = j % iRandomPoolSize;\n var kk = k % iRandomPoolSize;\n var ll = l % iRandomPoolSize;\n var gi0 = aiRnd[ii+aiRnd[jj+aiRnd[kk+aiRnd[ll]]]] % 32;\n var gi1 = aiRnd[ii+i1+aiRnd[jj+j1+aiRnd[kk+k1+aiRnd[ll+l1]]]] % 32;\n var gi2 = aiRnd[ii+i2+aiRnd[jj+j2+aiRnd[kk+k2+aiRnd[ll+l2]]]] % 32;\n var gi3 = aiRnd[ii+i3+aiRnd[jj+j3+aiRnd[kk+k3+aiRnd[ll+l3]]]] % 32;\n var gi4 = aiRnd[ii+1+aiRnd[jj+1+aiRnd[kk+1+aiRnd[ll+1]]]] % 32;\n // Calculate the contribution from the five corners\n var t0 = 0.6 - x0*x0 - y0*y0 - z0*z0 - w0*w0;\n if(t0<0) {\n n0 = 0;\n } else {\n t0 *= t0;\n n0 = t0 * t0 * dot4(grad4[gi0], x0, y0, z0, w0);\n }\n var t1 = 0.6 - x1*x1 - y1*y1 - z1*z1 - w1*w1;\n if(t1<0) {\n n1 = 0;\n } else {\n t1 *= t1;\n n1 = t1 * t1 * dot4(grad4[gi1], x1, y1, z1, w1);\n }\n var t2 = 0.6 - x2*x2 - y2*y2 - z2*z2 - w2*w2;\n if(t2<0) {\n n2 = 0;\n } else {\n t2 *= t2;\n n2 = t2 * t2 * dot4(grad4[gi2], x2, y2, z2, w2);\n }\n var t3 = 0.6 - x3*x3 - y3*y3 - z3*z3 - w3*w3;\n if(t3<0) {\n n3 = 0;\n } else {\n t3 *= t3;\n n3 = t3 * t3 * dot4(grad4[gi3], x3, y3, z3, w3);\n }\n var t4 = 0.6 - x4*x4 - y4*y4 - z4*z4 - w4*w4;\n if(t4<0) {\n n4 = 0;\n } else {\n t4 *= t4;\n n4 = t4 * t4 * dot4(grad4[gi4], x4, y4, z4, w4);\n }\n // Sum up and scale the result to cover the range [-1,1]\n return 27 * (n0 + n1 + n2 + n3 + n4);\n }\n}", "title": "" }, { "docid": "75fa18c1b3ed1a482be7c273fd252204", "score": "0.49436712", "text": "meander(){\n \tthis.acceleration.x += map(noise(this.xoff),0,1,-3,3);\n this.acceleration.y += map(noise(this.yoff),0,1,-3,3);\n // Take the next step through our perlin field\n this.xoff += 0.01;\n\t\t\tthis.yoff += 0.01;\n }", "title": "" }, { "docid": "5c5c81fcee2c90bd2b9c68af33391520", "score": "0.4941131", "text": "function UpdateSliders()\n{\n var value = noiseScaleSlider.value();\n perlinNoiseFlowField.SetNoiseScale(value);\n value = vectorFieldOffsetSlider.value();\n perlinNoiseFlowField.SetVectorFieldOffset(value);\n value = flowFieldRotationAngleSlider.value();\n perlinNoiseFlowField.SetRotationalAngleOffset(value);\n UpdateElements();\n}", "title": "" }, { "docid": "06b2b58ca71de792513a27004f6cbe66", "score": "0.49373004", "text": "get noise() {\n return this.resources.noiseUniforms.uniforms.uNoise;\n }", "title": "" }, { "docid": "1260024d293ede2652ad264ec8092d30", "score": "0.4930131", "text": "addNoiseWords(noiseWords) {\n //@TODO\n nWords = noiseWords.split(/\\s+/);\n return nWords;\n }", "title": "" }, { "docid": "abc6cacdec3419d0e6cac087899bdef3", "score": "0.49269897", "text": "function Dog(noise) {\n this.noise = noise\n}", "title": "" }, { "docid": "8b06a71f39ec5e07836a3446dbbb001c", "score": "0.4922655", "text": "function setupPrey() {\n // Here we just need to generate a random starting Perlin noise value for the prey's movement\n // because it's position depends on that value\n pX = random(0, 100);\n pY = random(0, 100);\n preyHealth = preyMaxHealth;\n}", "title": "" }, { "docid": "fec200c164a967f83986c852d51c8aeb", "score": "0.49112472", "text": "function addToDeltaBias(n : double){\r\n _bias.Delta += n\r\n }", "title": "" }, { "docid": "b31080fde9a36334db2823a54680062f", "score": "0.49043953", "text": "enableDiopter(){\n var _this=this;\n function addDiopterDrag(ocularPart, power) {\n var val = power;\n $(ocularPart)\n .mousedown(function() {\n isDown = true;\n })\n .mousemove(function(event) {\n if (isDown) {\n if (prevX > event.pageX) {\n if (_this.diopterPosition > sm_orig[\"MIN_DIOPTER\"]) {\n _this.diopterPosition -= power;\n _this.slideBlur2 -= 1; \n }\n } else if ((prevX < event.pageX)) {\n if (_this.diopterPosition < sm_orig[\"MAX_DIOPTER\"]) {\n _this.diopterPosition += power;\n _this.slideBlur2 += 1;\n }\n }\n prevX = event.pageX;\n _this.update();\n }\n })\n .mouseup(function() {\n isDown = false;\n })\n .mouseleave(function() {\n isDown = false;\n });\n }\n addDiopterDrag(\"#friend\", 0.5);\n }", "title": "" }, { "docid": "0ef0f37459cb798560f66f54b45dbd83", "score": "0.49010044", "text": "function SimplexNoise(seed) {\n let i;\n if (!seed) seed = Math.random();\n this.grad3 = [[1, 1, 0], [-1, 1, 0], [1, -1, 0], [-1, -1, 0],\n [1, 0, 1], [-1, 0, 1], [1, 0, -1], [-1, 0, -1],\n [0, 1, 1], [0, -1, 1], [0, 1, -1], [0, -1, -1]];\n this.p = [];\n for (i = 0; i < 256; i++) {\n this.p[i] = Math.floor(seed * 256);\n }\n // To remove the need for index wrapping, double the permutation table length\n this.perm = [];\n for (i = 0; i < 512; i++) {\n this.perm[i] = this.p[i & 255];\n }\n}", "title": "" }, { "docid": "5b84119df9363e655ba35007e4c76072", "score": "0.48733333", "text": "function makeNoise(){\n console.log(\"meow!\");\n}", "title": "" }, { "docid": "beb79f0a8323c2a01246d60ef53faca7", "score": "0.48690525", "text": "startOfToss(p) {\n\t\t\t\tSoundUtil.playSound('crowd_noise', 0.6);\n\t\t\t}", "title": "" }, { "docid": "8dcbf845a3ad1c4f485bbd3659f3deaa", "score": "0.48639598", "text": "function generateNoise(level) {\n\t\tvar noise = '', x, y, xEnd;\n\t\tfor(var i=0; i<level * 25; i++) {\n\t\t\tx = randomIntFromInterval(10, width-10);\n\t\t\ty = randomIntFromInterval(0, height);\n\t\t\txEnd = x + 1;\n\t\t\tnoise += '<line x1=\"' + x + '\" y1=\"' + y + '\" x2=\"' + xEnd + '\" y2=\"' + y + '\" style=\"stroke:rgb(0,0,0);stroke-width:2\" />';\n\t\t}\n\t\treturn noise;\n\t}", "title": "" }, { "docid": "d3e21c7dc248c0355496bdb53c6703dc", "score": "0.48603112", "text": "function predictionAddDataPoint() {\n // add a new data point to the dataset\n\n dataset.add({\n x: arguments[3],\n y: arguments[4],\n label: {\n content: arguments[5],\n className: \"lb_predicted\",\n xOffset: -7,\n yOffset: -10\n },\n group: 0\n });\n\n // Lower bound\n dataset.add({\n x: arguments[3],\n y: arguments[6],\n group: 2\n });\n\n // Upper bound\n dataset.add({\n x: arguments[3],\n y: arguments[7],\n group: 3\n });\n\n dataset.add({\n x: arguments[0],\n y: arguments[1],\n label: {\n content: arguments[2],\n className: \"lb_actual\",\n xOffset: -7,\n yOffset: -10\n },\n group: 1\n });\n\n // remove all data points which are no longer visible\n var range = graph2d.getWindow();\n var interval = range.end - range.start;\n var oldIds = dataset.getIds({\n filter: function (item) {\n var jstime = new Date(item.x);\n return jstime < range.start - interval ;\n }\n });\n\n dataset.remove(oldIds);\n }", "title": "" }, { "docid": "1fd4f5a5ba2a037708b5c9f3f4c8fe3c", "score": "0.48452374", "text": "function makeNoise() {\n this.sound.currentTime = 0;\n this.sound.play();\n}", "title": "" }, { "docid": "d6b853995b64519ef887f50751d7bfcc", "score": "0.4838607", "text": "function updateLRFromDegree(pd){\n switch(pd){ //Chosen manually from trial and error\n case 1:\n learningRate = 0.09;\n break;\n case 2:\n learningRate = 0.007;\n break;\n case 3:\n learningRate = 0.0004;\n break;\n case 4:\n learningRate = 0.00002;\n break;\n case 5:\n learningRate = 0.000001;\n break;\n case 10:\n learningRate = 0.0000000000001;\n break;\n }\n}", "title": "" }, { "docid": "a7c456860b462f2a29e284a9178dafb8", "score": "0.48304382", "text": "function drawPoints() {\n stroke(0);\n fill(0);\n for (var i = 0; i < training.length; i++) {\n // Map points to pixel space\n var x = map(training[i].chirps, minX, maxX, 0, width);\n var y = map(training[i].temp, minY, maxY, height, 0);\n ellipse(x, y, 4, 4);\n }\n}", "title": "" }, { "docid": "35d2392f39eadeb6b38b105f7d3d2a46", "score": "0.4823697", "text": "function drawPrey() {\n fill(preyFill, 0 , 0);\n noStroke();\n ellipse(preyX,preyY,map(noise(preySize), 0, 1, preyRadius*2, preyRadius*3));\n preySize += 1;\n}", "title": "" }, { "docid": "b67ee9c7c75037e32f48f8d19dd1be75", "score": "0.48005486", "text": "function getPoint(i, numPoints) {\n // this is dependent on a function i wrote calle periodicNoise, defined in perlin.js\n // basically allows to generate a set of perlin-noise based values which end up at the same place they started smoothly\n var x = view.size.width * noise.periodicNoise(i / smoothness, xSeed, numPoints / smoothness);\n var y = view.size.height * noise.periodicNoise(i / smoothness, ySeed, numPoints / smoothness);\n return new Point(x, y);\n }", "title": "" }, { "docid": "b43db2c6e7f7c5473770f2c495de77b2", "score": "0.47987688", "text": "function drawPoints() {\n stroke(0);\n fill(0);\n for (var i = 0; i < training.length; i++) {\n ellipse(training[i].x * width, training[i].y * height, 4, 4);\n }\n}", "title": "" }, { "docid": "fa7407d2ed504a42107b4ab2ece6659f", "score": "0.4782994", "text": "constructor(width, height, scale, noiseType, convolution) {\n this.width = width;\n this.height = height;\n this.scale = scale;\n this.noiseType = noiseType || NoiseType.Perlin2D;\n this.convolution = convolution;\n\n this.grad3 = [\n new Grad(1, 1, 0), new Grad(-1, 1, 0), new Grad(1, -1, 0), new Grad(-1, -1, 0),\n new Grad(1, 0, 1), new Grad(-1, 0, 1), new Grad(1, 0, -1), new Grad(-1, 0, -1),\n new Grad(0, 1, 1), new Grad(0, -1, 1), new Grad(0, 1, -1), new Grad(0, -1, -1),\n ];\n\n this.p = [\n 151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30,\n 69, 142, 8, 99, 37, 240, 21, 10, 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94,\n 252, 219, 203, 117, 35, 11, 32, 57, 177, 33, 88, 237, 149, 56, 87, 174, 20, 125, 136,\n 171, 168, 68, 175, 74, 165, 71, 134, 139, 48, 27, 166, 77, 146, 158, 231, 83, 111, 229,\n 122, 60, 211, 133, 230, 220, 105, 92, 41, 55, 46, 245, 40, 244, 102, 143, 54, 65, 25,\n 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208, 89, 18, 169, 200, 196, 135, 130, 116,\n 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217, 226, 250, 124, 123, 5, 202,\n 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58, 17, 182, 189, 28,\n 42, 223, 183, 170, 213, 119, 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155, 167, 43,\n 172, 9, 129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232, 178, 185, 112, 104, 218,\n 246, 97, 228, 251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145,\n 235, 249, 14, 239, 107, 49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115,\n 121, 50, 45, 127, 4, 150, 254, 138, 236, 205, 93, 222, 114, 67, 29, 24, 72, 243, 141,\n 128, 195, 78, 66, 215, 61, 156, 180,\n ];\n\n // To remove the need for index wrapping, double the permutation table length\n this.perm = new Array(512);\n this.gradP = new Array(512);\n\n // Skewing and unskewing factors for 2, 3, and 4 dimensions\n this.F2 = 0.5 * (Math.sqrt(3) - 1);\n this.G2 = (3 - Math.sqrt(3)) / 6;\n\n this.F3 = 1 / 3;\n this.G3 = 1 / 6;\n\n this.seed(0);\n }", "title": "" }, { "docid": "6cbf30e0f23c1a645023e1d54cdf29ca", "score": "0.4780291", "text": "function simplexData(n, noise) {\r\n noise = noise || 0.5;\r\n var points = [];\r\n for (var i = 0; i < n; i++) {\r\n var p = [];\r\n for (var j = 0; j < n; j++) {\r\n p[j] = i == j ? 1 + noise * normal() : 0;\r\n }\r\n points.push(new Point(p));\r\n }\r\n return points;\r\n}", "title": "" }, { "docid": "22f4ae3610b5f76d7a8b642150212a6f", "score": "0.47777146", "text": "function noise2D( x, y ) {\n return getSimplex().noise2D( x, y )\n }", "title": "" }, { "docid": "828e0ef9928c90d3a5837acdb1626f8a", "score": "0.47632363", "text": "function createDataPoints(layers, nP, seed, property, prop_sub, crossValSeed) {\n prop_sub = ee.String('random ').cat(prop_sub);\n var multipoly2poly = function (feature) {\n var multipoly = feature.geometry();\n var size = multipoly.coordinates().size();\n var polylist = ee.List.sequence(0, size.add(-1), 1)\n .map(function (listelem) {\n return ee.Feature(feature)\n .setGeometry(ee.Geometry.Polygon(multipoly.coordinates().get(listelem)));\n });\n return ee.FeatureCollection(polylist).randomColumn('random', crossValSeed, 'uniform');\n };\n var trainingObjects = layers.filter(\n function (l) {\n if (l.getEeObject().name() === 'Feature') return l;\n });\n var land_features = ee.FeatureCollection(trainingObjects.map(\n function (f) {\n var poly_ = f.getEeObject();\n poly_ = multipoly2poly(poly_);\n var randomSample70 = poly_.filter(prop_sub);\n var lc_dic = { land_class: randomSample70.first().get('land_class') };\n var m_poly = randomSample70.geometry();\n return ee.Feature(m_poly, lc_dic);\n }));\n var landClassImage = ee.Image().byte().paint(land_features, property).rename(property);\n var stratified = landClassImage.addBands(ee.Image.pixelLonLat())\n .stratifiedSample({\n seed: seed,\n numPoints: nP,\n classBand: property,\n scale: 1,\n region: land_features.geometry()\n }).map(function (f) {\n return f.setGeometry(ee.Geometry.Point([f.get('longitude'), f.get('latitude')]));\n });\n return stratified;\n}", "title": "" }, { "docid": "da51d9886baec7221ce1afe3c378c7f2", "score": "0.47303605", "text": "function updateDots() {\n\n // precalculations for state 'groupX':\n var gLength = groupings.length;\n var groupingOffset = 12;\n var groupInc = (abundancePlot.panels.groupX.currentWidth - groupingOffset) / (gLength + 1);\n\n\n var alldots = panels.selectAll(\".dots\").data(function (d) {\n if (d.jxn.state == 'std') {\n var randomizer = helper.getPseudoRandom()\n res = d.jxn.weights.map(function (w) {\n return {x: (d.jxn.w * 3 / 8 + randomizer() * d.jxn.w / 4), w: w}\n })\n return res;\n\n }\n else if (d.jxn.state == 'scatter') {\n var res = [];\n if (!sampleOrder.valid) {\n res = d.jxn.weights.map(function (w, i) {\n return {\n x: 6 + (i / allSampleLength * (abundancePlot.panels.scatter.currentWidth - 12)),\n w: w\n }\n })\n } else {\n res = d.jxn.weights.map(function (w, i) {\n return {\n x: 6 + (sampleOrder.order.indexOf(w.sample) / allSampleLength * (abundancePlot.panels.scatter.currentWidth - 12)),\n w: w\n }\n })\n }\n\n return res;\n\n }\n else if (d.jxn.state == 'mini') {\n res = d.jxn.weights.map(function (w) {\n return {x: abundancePlot.panels.mini.currentWidth / 2, w: w}\n })\n return res;\n }\n else if (d.jxn.state == 'groupX') {\n\n if (groupings.length > 0) {\n\n var mapIDtoI = {}\n groupings.forEach(function (group, i) {\n group.samples.forEach(function (sample) {\n mapIDtoI[sample] = i;\n });\n })\n\n\n res = d.jxn.weights.map(function (w) {\n var x = mapIDtoI[w.sample];\n if (x == null) x = groupings.length;\n return {\n x: (groupingOffset + (x + .5) * groupInc + abundancePlot.panels.std.boxPlotWidth / 2),\n w: w\n }\n })\n } else {\n res = d.jxn.weights.map(function (w) {\n return {x: (d.jxn.w / 2), w: w}\n })\n }\n\n return res;\n\n }\n\n }, function (d) {\n return d.w.sample;\n })\n\n alldots.exit().remove();\n\n alldots.enter().append(\"circle\").attr({\n class: \"dots\",\n r: 2\n }).on({\n \"mouseover\": function (d) {\n event.fire(\"sampleHighlight\", d.w.sample, true);\n event.fire(\"highlightJxn\", d3.select(this.parentNode).data()[0].key, true);\n },\n \"mouseout\": function (d) {\n event.fire(\"sampleHighlight\", d.w.sample, false);\n event.fire(\"highlightJxn\", d3.select(this.parentNode).data()[0].key, false);\n },\n 'click': function (d) {\n if (d3.select(this).classed(\"selected\")) {\n //deselect\n d3.select(this).classed(\"selected\", null);\n event.fire(\"sampleSelect\", d.w.sample, false)\n } else {\n //select\n d3.select(this).classed(\"selected\", true);\n event.fire(\"sampleSelect\", d.w.sample, true)\n }\n\n }\n\n }).append(\"title\").text(function (d) {\n return d.w.sample +'\\n'+ d.w.weight;\n })\n\n alldots.transition().attr({\n cx: function (d) {\n return d.x;\n },\n cy: function (d) {\n return weightScale(d.w.weight);\n }\n })\n\n\n }", "title": "" }, { "docid": "bb022efc2689496444ba02b775e4092f", "score": "0.47295198", "text": "constructor(n) { // n = # inputs\n this.weights = []; //initialize weights as an array<float> of size n\n this.numWeights = n;\n this.c = 0.01;\n\n console.log(\"#PERCEPTRON INPUTS: \" + this.numWeights);\n\n\n for(var i = 0; i < this.numWeights; i++) {\n this.weights[i] = random(-1, 1); //fill weights[] with random values between -1, 1\n }\n }", "title": "" }, { "docid": "c654112b61aa2f55100988140cb3e1bf", "score": "0.47230273", "text": "addDensity(x,y,amount){\r\n this.density[x][y]+=amount;\r\n }", "title": "" }, { "docid": "da29fa25a7bbdfb89068ada7a0d27f22", "score": "0.47129968", "text": "update() {\n // scale the x and y coordinates of the agent\n let scaleX = this.coordinates.x * noiseScale;\n let scaleY = this.coordinates.y * noiseScale;\n // get the noise value\n let noiseVal = p.noise(scaleX, scaleY);\n // map the noise value to an angle between 0 and TWO_PI and scale by noise strength\n this.angle = p.map(noiseVal, 0, 1, 0, p.TWO_PI) * noiseStrength;\n // move the agent\n this.coordinates.x += p.cos(this.angle) * stepSize;\n this.coordinates.y += p.sin(this.angle) * stepSize;\n // decrease the agent's health\n this.health -= this.lifeSpan;\n }", "title": "" }, { "docid": "10391704b4d3eb3f0fcbbcdc24a5c8a3", "score": "0.46999994", "text": "addPoint() {\n this.points.push({\n x: this.p.random(Math.ceil(this.canv.x_axis.start), Math.floor(this.canv.x_axis.end)),\n y: this.p.random(Math.ceil(this.canv.y_axis.start), Math.floor(this.canv.y_axis.end))\n })\n this.update(this.out());\n }", "title": "" }, { "docid": "c4888080a64fdce9dc3d9eded3b8e0e5", "score": "0.4689125", "text": "function simplexData(n, noise) {\n noise = noise || 0;\n var points = [];\n for (var i = 0; i < n; i++) {\n var p = [];\n for (var j = 0; j < n; j++) {\n p[j] = i == j ? 1 + noise * normal() : 0;\n }\n points.push(new Point(p));\n }\n return points;\n}", "title": "" }, { "docid": "ca24bc68e3aaa7b74b38d07fe8e2fd55", "score": "0.46813163", "text": "function WaterSyatem(seaResolution,noiseScale,heightScale)\n {\n this.seaResolution = seaResolution;//波纹分辨率\n this.noiseScale = noiseScale;//噪声范围\n this.heightScale = heightScale;//浮动大小\n\n this.widthNormalize = width / seaResolution;//width canvas.width\n this.heightNormalize = height / seaResolution;////height canvas.height\n\n this.positionArrXpos = new Array(seaResolution*seaResolution);//上一帧的位置数组\n this.positionArrYpos = new Array(seaResolution*seaResolution);//上一帧的位置数组\n\n for (var h = 0; h<this.seaResolution;h++)\n {\n for(var w = 0;w<this.seaResolution;w++)\n {\n this.positionArrXpos[h*seaResolution+w] = 0;\n this.positionArrYpos[h*seaResolution+w] = 0;\n }\n }\n\n this.dotSize = 4;//元素大小\n this.perlinNoiseAnimX = 0.02;//噪声取值时间轴\n this.perlinNoiseAnimY = 0.02;\n\n this.update = function () {\n for (var h = 0; h<this.seaResolution;h++)\n {\n for(var w = 0;w<this.seaResolution;w++)\n {\n var xPos = noise( -w * this.noiseScale + this.perlinNoiseAnimY,-h * this.noiseScale + this.perlinNoiseAnimX,frameCount*0.01);\n var dotX = w * this.widthNormalize+h%2*this.widthNormalize*0.5+xPos * this.heightScale*0.5 - 160;\n var doty = h * this.heightNormalize + xPos * this.heightScale*0.5-80;\n\n if(dotX > this.positionArrXpos[h*this.seaResolution+w]) {\n var lastPoint = createVector(this.positionArrXpos[h*this.seaResolution+w],this.positionArrYpos[h*this.seaResolution+w]);\n \n this.drawDot(dotX, doty,lastPoint);\n }\n this.positionArrXpos[h*this.seaResolution+w] = dotX;\n this.positionArrYpos[h*this.seaResolution+w] = doty; \n }\n }\n this.perlinNoiseAnimX += xSpeed;\n this.perlinNoiseAnimY += ySpeed;\n }\n\n this.drawDot = function(x,y,lastPoint)\n {\n if (x < - this.dotSize) {\n x = width+this.dotSize;\n return;\n }\n if (x > width + this.dotSize) {\n x = -this.dotSize;\n return;\n }\n if (y < -this.dotSize) {\n y = height+this.dotSize;\n return;\n }\n if (y > height+this.dotSize) {\n y = -this.dotSize;\n return;\n }\n var v = createVector(x - lastPoint.x,y - lastPoint.y);\n var precent;\n var max = this.heightScale ;\n var mag = v.mag()*40;\n if (mag > max) {\n precent = 1;\n } else {\n precent = map(mag,0,max,0,1) * multipleForDensity; \n }\n if (precent < 0.1) {\n return;\n }\n stroke(255,precent*255);\n strokeWeight(2*precent);\n line(x,y,x-maxLength*precent ,y-maxLength*precent);\n }\n}", "title": "" }, { "docid": "3b625310caa77f58f7b815ed86f294b0", "score": "0.46780342", "text": "function privatize_array(vars, epsilon) {\n return vars.map( function(a) {\n return a + laplace_noise(epsilon, 1);\n });\n}", "title": "" }, { "docid": "070e04d5d6efd7960ce1300fc7300529", "score": "0.46752706", "text": "function trainedNN(input) {\n return {\n 'LOFI':1/(1+1/Math.exp((-21.401443481445312+24.35832405090332*1/(1+1/Math.exp((-8.392271995544434+7.710432529449463*(input['danceability']||0)+4.483984470367432*(input['acousticness']||0)-17.352312088012695*(input['energy']||0)+12.887937545776367*(input['instrumentalness']||0)+4.8691792488098145*(input['valence']||0))))+16.992862701416016*1/(1+1/Math.exp((-2.5020105838775635+0.4075414538383484*(input['danceability']||0)+0.40179166197776794*(input['acousticness']||0)+0.8510603308677673*(input['energy']||0)+169.41151428222656*(input['instrumentalness']||0)-2.196516752243042*(input['valence']||0))))-23.76111602783203*1/(1+1/Math.exp((3.755976915359497-36.59063720703125*(input['danceability']||0)+14.076555252075195*(input['acousticness']||0)-16.976600646972656*(input['energy']||0)+3.229679584503174*(input['instrumentalness']||0)+8.240936279296875*(input['valence']||0))))))),\n 'EDM':1/(1+1/Math.exp((-95.17872619628906-32.41843032836914*1/(1+1/Math.exp((-8.392271995544434+7.710432529449463*(input['danceability']||0)+4.483984470367432*(input['acousticness']||0)-17.352312088012695*(input['energy']||0)+12.887937545776367*(input['instrumentalness']||0)+4.8691792488098145*(input['valence']||0))))+95.63311767578125*1/(1+1/Math.exp((-2.5020105838775635+0.4075414538383484*(input['danceability']||0)+0.40179166197776794*(input['acousticness']||0)+0.8510603308677673*(input['energy']||0)+169.41151428222656*(input['instrumentalness']||0)-2.196516752243042*(input['valence']||0))))-26.20052146911621*1/(1+1/Math.exp((3.755976915359497-36.59063720703125*(input['danceability']||0)+14.076555252075195*(input['acousticness']||0)-16.976600646972656*(input['energy']||0)+3.229679584503174*(input['instrumentalness']||0)+8.240936279296875*(input['valence']||0))))))),\n 'RAP':1/(1+1/Math.exp((-5.983826160430908+0.5373189449310303*1/(1+1/Math.exp((-8.392271995544434+7.710432529449463*(input['danceability']||0)+4.483984470367432*(input['acousticness']||0)-17.352312088012695*(input['energy']||0)+12.887937545776367*(input['instrumentalness']||0)+4.8691792488098145*(input['valence']||0))))-18.70572853088379*1/(1+1/Math.exp((-2.5020105838775635+0.4075414538383484*(input['danceability']||0)+0.40179166197776794*(input['acousticness']||0)+0.8510603308677673*(input['energy']||0)+169.41151428222656*(input['instrumentalness']||0)-2.196516752243042*(input['valence']||0))))-0.6679232120513916*1/(1+1/Math.exp((3.755976915359497-36.59063720703125*(input['danceability']||0)+14.076555252075195*(input['acousticness']||0)-16.976600646972656*(input['energy']||0)+3.229679584503174*(input['instrumentalness']||0)+8.240936279296875*(input['valence']||0))))))),\n 'CLASSICAL':1/(1+1/Math.exp((-20.523542404174805-25.32865333557129*1/(1+1/Math.exp((-8.392271995544434+7.710432529449463*(input['danceability']||0)+4.483984470367432*(input['acousticness']||0)-17.352312088012695*(input['energy']||0)+12.887937545776367*(input['instrumentalness']||0)+4.8691792488098145*(input['valence']||0))))+16.27237892150879*1/(1+1/Math.exp((-2.5020105838775635+0.4075414538383484*(input['danceability']||0)+0.40179166197776794*(input['acousticness']||0)+0.8510603308677673*(input['energy']||0)+169.41151428222656*(input['instrumentalness']||0)-2.196516752243042*(input['valence']||0))))+33.79419708251953*1/(1+1/Math.exp((3.755976915359497-36.59063720703125*(input['danceability']||0)+14.076555252075195*(input['acousticness']||0)-16.976600646972656*(input['energy']||0)+3.229679584503174*(input['instrumentalness']||0)+8.240936279296875*(input['valence']||0))))))),\n 'POP':1/(1+1/Math.exp((-10.174331665039062-3.8872437477111816*1/(1+1/Math.exp((-8.392271995544434+7.710432529449463*(input['danceability']||0)+4.483984470367432*(input['acousticness']||0)-17.352312088012695*(input['energy']||0)+12.887937545776367*(input['instrumentalness']||0)+4.8691792488098145*(input['valence']||0))))+10.095831871032715*1/(1+1/Math.exp((-2.5020105838775635+0.4075414538383484*(input['danceability']||0)+0.40179166197776794*(input['acousticness']||0)+0.8510603308677673*(input['energy']||0)+169.41151428222656*(input['instrumentalness']||0)-2.196516752243042*(input['valence']||0))))-3.5891551971435547*1/(1+1/Math.exp((3.755976915359497-36.59063720703125*(input['danceability']||0)+14.076555252075195*(input['acousticness']||0)-16.976600646972656*(input['energy']||0)+3.229679584503174*(input['instrumentalness']||0)+8.240936279296875*(input['valence']||0))))))),\n 'RnB':1/(1+1/Math.exp((-2.867238998413086-34.049747467041016*1/(1+1/Math.exp((-8.392271995544434+7.710432529449463*(input['danceability']||0)+4.483984470367432*(input['acousticness']||0)-17.352312088012695*(input['energy']||0)+12.887937545776367*(input['instrumentalness']||0)+4.8691792488098145*(input['valence']||0))))+3.3303561210632324*1/(1+1/Math.exp((-2.5020105838775635+0.4075414538383484*(input['danceability']||0)+0.40179166197776794*(input['acousticness']||0)+0.8510603308677673*(input['energy']||0)+169.41151428222656*(input['instrumentalness']||0)-2.196516752243042*(input['valence']||0))))+1.6304932832717896*1/(1+1/Math.exp((3.755976915359497-36.59063720703125*(input['danceability']||0)+14.076555252075195*(input['acousticness']||0)-16.976600646972656*(input['energy']||0)+3.229679584503174*(input['instrumentalness']||0)+8.240936279296875*(input['valence']||0))))))),\n 'COUNTRY':1/(1+1/Math.exp((3.388113021850586-78.80740356445312*1/(1+1/Math.exp((-8.392271995544434+7.710432529449463*(input['danceability']||0)+4.483984470367432*(input['acousticness']||0)-17.352312088012695*(input['energy']||0)+12.887937545776367*(input['instrumentalness']||0)+4.8691792488098145*(input['valence']||0))))-10.57968521118164*1/(1+1/Math.exp((-2.5020105838775635+0.4075414538383484*(input['danceability']||0)+0.40179166197776794*(input['acousticness']||0)+0.8510603308677673*(input['energy']||0)+169.41151428222656*(input['instrumentalness']||0)-2.196516752243042*(input['valence']||0))))+1.7033580541610718*1/(1+1/Math.exp((3.755976915359497-36.59063720703125*(input['danceability']||0)+14.076555252075195*(input['acousticness']||0)-16.976600646972656*(input['energy']||0)+3.229679584503174*(input['instrumentalness']||0)+8.240936279296875*(input['valence']||0)))))))};\n }", "title": "" }, { "docid": "61f0151c7786dc63c9a102fdf08ac236", "score": "0.46745056", "text": "function generateNoiseMap(seed, width, height, xOffset = 0, yOffset = 0) {\n var map = [];\n\n noise.seed(seed);\n var canvas = document.getElementById('noiseCanvas');\n canvas.width = width;\n canvas.height = height;\n var ctx = canvas.getContext('2d');\n var image = ctx.createImageData(width, height);\n var data = image.data;\n for (var x = 0; x < width; x++) {\n for (var y = 0; y < height; y++) {\n var value = Math.abs((noise.perlin2((x + xOffset) / 10, (y + yOffset) / 10)+1)/2);\n value *= 256;\n var cell = (x + y * canvas.width) * 4;\n data[cell] = data[cell + 1] = data[cell + 2] = value;\n data[cell] += Math.max(0, (25 - value) * 8);\n data[cell + 3] = 255; // alpha.\n }\n }\n\n ctx.fillColor = 'black';\n ctx.fillRect(0, 0, 100, 100);\n ctx.putImageData(image, 0, 0);\n\n for (var y = 0; y < height; y++) {\n for (var x = 0; x < width; x++) {\n var data = ctx.getImageData(x,y,1,1).data;\n var val = (data[0]+data[1]+data[2]) / 3;\n map.push(val/255);\n }\n }\n\n return map;\n}", "title": "" }, { "docid": "69f95c1a10c9e8a6be5cb8d64b6b209f", "score": "0.464506", "text": "function initPoints(nbPoints, opt, profile, threeDModel) {\r\n\tif ((profile === profiles['sphere'])|| (profile === profiles['torus'])||(profile === profiles['tetrahedron'])){\r\n\t\tread(nbPoints, profile, opt);\r\n\t}\t\r\n else{\r\n\t\tvar points = profile.getPoints(nbPoints, threeDModel);\r\n\t\tdists = distanceMatrix(points);\r\n\t\ttsne = new tsnejs.tSNE(opt); // create a tSNE instance\r\n\t\ttsne.initDataDist(dists);\r\n\t\tfor (var i = 0; i < points.length; i++) {\r\n\t\t\tvar color = points[i].color;\r\n\t\t\tvar material = new THREE.MeshBasicMaterial({color: color});\r\n\t\t\tvar mesh = new THREE.Mesh(cubesGeometry, material);\r\n\t\t\tmesh.position.x = points[i].coords[0] * ratio;\r\n\t\t\tmesh.position.y = points[i].coords[1] * ratio;\r\n\t\t\tmesh.position.z = points[i].coords[2] * ratio;\r\n\t\t\tstars.push(mesh);\r\n\t\t\tscene.add(mesh);\r\n\t\t}\r\n\t}\r\n\r\n}", "title": "" }, { "docid": "f9227be82a3bee7b83bcef4ea69bc705", "score": "0.46422875", "text": "function RndProductionPoints(x)\n{\n\tvar t = Math.random();\n\tif (t == 0) return 0;\n\treturn x * Math.exp( -Math.log((1/t)-1) / 15 );\n}", "title": "" }, { "docid": "fc1a1f5bfc2c590d437c1d3a75cdf68f", "score": "0.46351242", "text": "function bnpDAddOffset(n,w) {\nif(n == 0) return;\nwhile(this.t <= w) this.data[this.t++] = 0;\nthis.data[w] += n;\nwhile(this.data[w] >= this.DV) {\n this.data[w] -= this.DV;\n if(++w >= this.t) this.data[this.t++] = 0;\n ++this.data[w];\n}\n}", "title": "" }, { "docid": "fc1a1f5bfc2c590d437c1d3a75cdf68f", "score": "0.46351242", "text": "function bnpDAddOffset(n,w) {\nif(n == 0) return;\nwhile(this.t <= w) this.data[this.t++] = 0;\nthis.data[w] += n;\nwhile(this.data[w] >= this.DV) {\n this.data[w] -= this.DV;\n if(++w >= this.t) this.data[this.t++] = 0;\n ++this.data[w];\n}\n}", "title": "" }, { "docid": "fc1a1f5bfc2c590d437c1d3a75cdf68f", "score": "0.46351242", "text": "function bnpDAddOffset(n,w) {\nif(n == 0) return;\nwhile(this.t <= w) this.data[this.t++] = 0;\nthis.data[w] += n;\nwhile(this.data[w] >= this.DV) {\n this.data[w] -= this.DV;\n if(++w >= this.t) this.data[this.t++] = 0;\n ++this.data[w];\n}\n}", "title": "" }, { "docid": "fc1a1f5bfc2c590d437c1d3a75cdf68f", "score": "0.46351242", "text": "function bnpDAddOffset(n,w) {\nif(n == 0) return;\nwhile(this.t <= w) this.data[this.t++] = 0;\nthis.data[w] += n;\nwhile(this.data[w] >= this.DV) {\n this.data[w] -= this.DV;\n if(++w >= this.t) this.data[this.t++] = 0;\n ++this.data[w];\n}\n}", "title": "" }, { "docid": "ccffc86d479c3d38bf14893a1b37d491", "score": "0.463416", "text": "function GenerateDots()\n{\n for(var i=0; i<dotCount; i++)\n {\n //Get random position on screen\n const x = GetRandomInt(pointRadius, (window.innerWidth - pointRadius));\n \n const y = GetRandomInt(pointRadius, (window.innerHeight - pointRadius));\n\n //Calculate random direction between 0 and 1\n //X\n let dirX = GetRandomFloat(-1, 1);\n dirX = (dirX < minDir && dirX > -minDir) ? minDir : dirX; //if direction is too close to 0 point is too slow, so clamp direction\n\n //Y\n let dirY = GetRandomFloat(-1, 1);\n dirY = (dirY < minDir && dirY > -minDir) ? -minDir : dirY;\n\n //Random speed per dot\n const speed = GetRandomInt(10, 20);\n\n //Draw dots at random positions\n DrawDot(x, y);\n\n //Add dot to the array\n dots.push([x, y, dirX, dirY, speed]);\n }\n}", "title": "" }, { "docid": "a5c6c0083b57fab8e0ef823338422beb", "score": "0.46278602", "text": "function bnpDAddOffset(n, w) {\n if (n == 0) return;\n while (this.t <= w) {\n this.data[this.t++] = 0;\n }this.data[w] += n;\n while (this.data[w] >= this.DV) {\n this.data[w] -= this.DV;\n if (++w >= this.t) this.data[this.t++] = 0;\n ++this.data[w];\n }\n }", "title": "" }, { "docid": "79854c9cbbe6a299c3fa51d795c8bad2", "score": "0.4619499", "text": "function new_set() {\n points = [];\n gen = 0;\n ml_error = 0;\n document.getElementById('err').innerText = ml_error.toPrecision(4);\n document.getElementById('gen').innerText = gen;\n get_points(1000);\n pseudo_line.angle = rand(0, 2 * PI);\n pseudo_line.intercept = rand(0, r);\n pseudo_line.col = 'black';\n color_points();\n draw();\n window.cancelAnimationFrame(animFrame);\n is_training = false;\n // train();\n}", "title": "" }, { "docid": "a209dad26a2721d5dab5877611dff915", "score": "0.4616005", "text": "set Discrete(value) {}", "title": "" }, { "docid": "a209dad26a2721d5dab5877611dff915", "score": "0.4616005", "text": "set Discrete(value) {}", "title": "" }, { "docid": "23f53fa3d5770bf37df3bd614631fdfc", "score": "0.46107885", "text": "function bnpDAddOffset(n,w) {\n\t if(n == 0) return;\n\t while(this.t <= w) this[this.t++] = 0;\n\t this[w] += n;\n\t while(this[w] >= this.DV) {\n\t this[w] -= this.DV;\n\t if(++w >= this.t) this[this.t++] = 0;\n\t ++this[w];\n\t }\n\t }", "title": "" }, { "docid": "df90ded8018413fd3b72eb4e8857b91f", "score": "0.46072993", "text": "sample(point){\n\n\t\t//calculate corners of the grid cell that the point falls into\n\t\tvar gridCorners=[]\n\t\tfor (const dim of point){\n \t\tconst min_=Math.floor(dim);\n \t\tconst max_=min_+1\n \t\tgridCorners.push([min_,max_])\n\t\t} \n\t\t//cartesian(...grid_corners) produces each point' coordinates of the grid cell\n\t\tvar dots=[]\n\t\tfor(const gridCoords of cartesian(...gridCorners)){\n\t\t\t//get gradient vector from grid\n\t\t\tvar gradient=this.grid.get(gridCoords)\n\n\t\t\t//calculate offset vector by subtracting grid point from the point we sample\n\t\t\tvar offset=[]\n\t\t\tfor(var i=0; i<point.length; i++){\n\t\t\t\toffset.push(point[i]-gridCoords[i])\n\t\t\t}\n\t\t\t//console.log(dotProduct(gradient,offset))\n\n\t\t\t//save results of dot product to an array\n\t\t\tdots.push(dotProduct(gradient,offset))\n\t\t\t\n\t\t}\n\n\t\t/*\n\t\tcartesian function produces results in a way that şast dimension of the lists fluctuate the most like\n\t\t[0,0,0] first element of first four lists is same and first element of last four lists is same\n\t\t[0,0,1] \n\t\t[0,1,0]\n\t\t[0,1,1] for second element it changes once per two lists\n\t\t[1,0,0]\t\n\t\t[1,0,1] last element changes in each list 0->1->0->1...\n\t\t[1,1,0]\n\t\t[1,1,1]\n\n\n\t\thence we can interpolate wrt to first dimension by splitting list into two and zip them \n\t\tand then linear interpolate each points that corresponds to each other.\n\n\t\tWe do this process for each dimension once.Hence we can say that this while loops for dim times.\n\t\t*/ \n\t\tvar dim=-1\n\t\twhile (dots.length!=1){\n\t\t\tdim+=1\n\t\t\tconst half=(dots.length)/2\n\t\t\tconst s=smoothStep(point[dim]-Math.floor(point[dim]) )\n\n\t\t\tlet new_dots=[]\n\t\t\tfor(const x of zipWith((x,y)=>[x,y], dots.slice(0,half), dots.slice(half) )){\n\t\t\t\tnew_dots.push(lerp(s, x[0], x[1]))\n\t\t\t}\n\t\t\tdots=new_dots\n\n\t\t}\n\t\t//return interpolated result\n\t\treturn dots[0]*this.scaleFactor\n\t}", "title": "" }, { "docid": "3e280d27d2c41d76977871f8b8683d94", "score": "0.45988375", "text": "update() {\n // Scale the x and y coordinates of the agent\n let scaleX = this.coordinates.x*noiseScale;\n let scaleY = this.coordinates.y*noiseScale;\n // Get the noise value \n let noiseVal = noise(scaleX, scaleY);\n // Map the noise value to an angle between 0 and TWO_PI and scale by noise strength\n this.angle = map(noiseVal, 0, 1, 0, TWO_PI) * noiseStrength;\n // Move the agent \n this.coordinates.x += cos(this.angle) * stepSize;\n this.coordinates.y += sin(this.angle) * stepSize;\n // Decrease the agent's health \n this.health -= this.lifeSpan;\n }", "title": "" }, { "docid": "0c2bccc365fa4d64343eedca176a6c56", "score": "0.45961314", "text": "function drawPoint(canvasContext, point, dp) {\n\t\t\t\t\tvar i, x, y, a, b;\n\t\t\t\t\ti = point*2;\n\t\t\t\t\tx = meanShape[i/2][0];\n\t\t\t\t\ty = meanShape[i/2][1];\n\t\t\t\t\tfor (var j = 0;j < numParameters;j++) {\n\t\t\t\t\t\tx += model.shapeModel.eigenVectors[i][j]*dp[j+4];\n\t\t\t\t\t\ty += model.shapeModel.eigenVectors[i+1][j]*dp[j+4];\n\t\t\t\t\t}\n\t\t\t\t\ta = dp[0]*x - dp[1]*y + dp[2];\n\t\t\t\t\tb = dp[0]*y + dp[1]*x + dp[3];\n\t\t\t\t\tx += a;\n\t\t\t\t\ty += b;\n\t\t\t\t\tcanvasContext.beginPath();\n\t\t\t\t\tcanvasContext.arc(x, y, 1, 0, Math.PI*2, true);\n\t\t\t\t\tcanvasContext.closePath();\n\t\t\t\t\tcanvasContext.fill();\n\t\t\t\t}", "title": "" }, { "docid": "3d426064a70818bb02904c896117a8a3", "score": "0.45951924", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this.data[this.t++] = 0;\n this.data[w] += n;\n while(this.data[w] >= this.DV) {\n this.data[w] -= this.DV;\n if(++w >= this.t) this.data[this.t++] = 0;\n ++this.data[w];\n }\n}", "title": "" }, { "docid": "3d426064a70818bb02904c896117a8a3", "score": "0.45951924", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this.data[this.t++] = 0;\n this.data[w] += n;\n while(this.data[w] >= this.DV) {\n this.data[w] -= this.DV;\n if(++w >= this.t) this.data[this.t++] = 0;\n ++this.data[w];\n }\n}", "title": "" }, { "docid": "3d426064a70818bb02904c896117a8a3", "score": "0.45951924", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this.data[this.t++] = 0;\n this.data[w] += n;\n while(this.data[w] >= this.DV) {\n this.data[w] -= this.DV;\n if(++w >= this.t) this.data[this.t++] = 0;\n ++this.data[w];\n }\n}", "title": "" }, { "docid": "0b590345849424fc9e76c09e08cfd8f8", "score": "0.4594014", "text": "function bnpDAddOffset(n,w) {\n\t if(n == 0) return;\n\t while(this.t <= w) this[this.t++] = 0;\n\t this[w] += n;\n\t while(this[w] >= this.DV) {\n\t this[w] -= this.DV;\n\t if(++w >= this.t) this[this.t++] = 0;\n\t ++this[w];\n\t }\n\t}", "title": "" }, { "docid": "0b590345849424fc9e76c09e08cfd8f8", "score": "0.4594014", "text": "function bnpDAddOffset(n,w) {\n\t if(n == 0) return;\n\t while(this.t <= w) this[this.t++] = 0;\n\t this[w] += n;\n\t while(this[w] >= this.DV) {\n\t this[w] -= this.DV;\n\t if(++w >= this.t) this[this.t++] = 0;\n\t ++this[w];\n\t }\n\t}", "title": "" }, { "docid": "2067ad6d3ea9905675303f0a63bea19c", "score": "0.45916897", "text": "function update(){\n // Update rule for position\n x = (x + 10) % width; \n // Update rule for pitch \n prevp = p; // assign pitch to prevp\n p = p + int(round(random(-jitterP,jitterP))); // add random jitter\n p = constrain(p, middleC-24, middleC+24); // constrain to 4-octave range\n}", "title": "" }, { "docid": "977b201b28044cb3914da8bd99f39585", "score": "0.45908564", "text": "_genPoints() {\n return d3.range(this.npoints).map(() => {\n return [\n // X\n Math.random() * this.width,\n // Y\n Math.random() * this.height,\n // X vector\n Math.random() * this.speed * this.total * (\n Math.floor(Math.random() * 2) == 1\n ? 1\n : -1),\n // Y vector\n Math.random() * this.speed * this.total * (\n Math.floor(Math.random() * 2) == 1\n ? 1\n : -1)\n ];\n });\n }", "title": "" }, { "docid": "a79e1ee387c1fd41cc5591ae1713c9e7", "score": "0.45814112", "text": "function bnpDAddOffset(n, w) {\n\t if (n == 0) return;\n\t while (this.t <= w) this[this.t++] = 0;\n\t this[w] += n;\n\t while (this[w] >= this.DV) {\n\t this[w] -= this.DV;\n\t if (++w >= this.t) this[this.t++] = 0;\n\t ++this[w];\n\t }\n\t}", "title": "" }, { "docid": "94b5681925c4dba57a960df14c655cd5", "score": "0.4581321", "text": "function drawPoint(canvasContext, point, dp) {\n\t\t\t\tvar i, x, y, a, b;\n\t\t\t\ti = point*2;\n\t\t\t\tx = meanShape[i/2][0];\n\t\t\t\ty = meanShape[i/2][1];\n\t\t\t\tfor (var j = 0;j < numParameters;j++) {\n\t\t\t\t\tx += model.shapeModel.eigenVectors[i][j]*dp[j+4];\n\t\t\t\t\ty += model.shapeModel.eigenVectors[i+1][j]*dp[j+4];\n\t\t\t\t}\n\t\t\t\ta = dp[0]*x - dp[1]*y + dp[2];\n\t\t\t\tb = dp[0]*y + dp[1]*x + dp[3];\n\t\t\t\tx += a;\n\t\t\t\ty += b;\n\t\t\t\tcanvasContext.beginPath();\n\t\t\t\tcanvasContext.arc(x, y, 1, 0, Math.PI*2, true);\n\t\t\t\tcanvasContext.closePath();\n\t\t\t\tcanvasContext.fill();\n\t\t\t}", "title": "" }, { "docid": "41daaea8237cf9e9c7833e34bc2a4e16", "score": "0.4578539", "text": "draw_pkmn_evols() { // Everything is in memory, not optimal.\n var t = this.svg.transition().duration(750);\n var pointSize = (this.x(1) - this.x(0)) / 2;\n // Axis\n this.svg.select(\".x_axis\").transition(t).call(this.xAxis);\n this.svg.select(\".y_axis\").transition(t).call(this.yAxis);\n\n // We have multiple sets of PNGs to use.\n function sizeToPixel(pointSize) {\n if(pointSize <= 16) return 32;\n if(pointSize <= 32) return 120;\n return 256;\n }\n\n function visibility_sliders(d) {\n var slider_total = d3.select(\"#slider_total\").property(\"value\");\n if(d.Total < slider_total) return \"hidden\";\n // We did not have time to test them all.\n // var slider_hp = d3.select(\"#slider_hp\").property(\"value\");\n // if(d.HP < slider_hp) return \"hidden\";\n\n\n // var slider_attack = d3.select(\"#slider_attack\").property(\"value\");\n // if(d.Attack < slider_attack) return \"hidden\";\n\n\n // var slider_defense = d3.select(\"#slider_defense\").property(\"value\");\n // if(d.Defense < slider_defense) return \"hidden\";\n\n\n // var slider_spatk = d3.select(\"#slider_spatk\").property(\"value\");\n // if(d.Sp_Atk < slider_spatk) return \"hidden\";\n\n\n // var slider_spdef = d3.select(\"#slider_spdef\").property(\"value\");\n // if(d.Sp_Def < slider_spdef) return \"hidden\";\n\n\n // var slider_speed = d3.select(\"#slider_speed\").property(\"value\");\n // if(d.Speed < slider_speed) return \"hidden\";\n\n\n // var slider_generation = d3.select(\"#slider_generation\").property(\"value\");\n // if(d.Generation < slider_generation) return \"hidden\";\n\n\n return \"visible\";\n }\n\n // Draw Pokémon\n if(pointSize <= 5) { // Use circles\n this.data_points.selectAll(\"image\")\n .transition(t)\n .attr(\"visibility\", \"hidden\")\n .attr(\"x\", p => this.getXpos(p, 5 * pointSize))\n .attr(\"y\", p => this.getYpos(p, 5 * pointSize))\n .attr(\"width\", 5 * Math.round(pointSize))\n .attr(\"height\", 5 * Math.round(pointSize))\n .attr(\"xlink:href\", p => addressMake(p, sizeToPixel(pointSize)))\n this.data_points.selectAll(\"circle\")\n .transition(t)\n .attr(\"visibility\", visibility_sliders)\n .attr(\"cx\", p => this.getXpos(p, pointSize))\n .attr(\"cy\", p => this.getYpos(p, pointSize))\n .attr(\"r\", pointSize)\n } else { // Use images\n this.data_points.selectAll(\"circle\")\n .transition(t)\n .attr(\"visibility\", \"hidden\")\n .attr(\"cx\", p => this.getXpos(p, pointSize))\n .attr(\"cy\", p => this.getYpos(p, pointSize))\n .attr(\"r\", pointSize)\n this.data_points.selectAll(\"image\")\n .transition(t)\n .attr(\"visibility\", visibility_sliders)\n .attr(\"x\", p => this.getXpos(p, 5 * pointSize))\n .attr(\"y\", p => this.getYpos(p, 5 * pointSize))\n .attr(\"width\", 5 * Math.round(pointSize))\n .attr(\"height\", 5 * Math.round(pointSize))\n .attr(\"xlink:href\", p => addressMake(p, sizeToPixel(pointSize)))\n }\n\n // Draw evolutions\n this.links\n .transition(t)\n .attr(\"x1\", d => {\n for (var i = 0; i < this.points.length; i++) {\n if (this.points[i].Id == d.source) {\n return this.getXpos(this.points[i], pointSize)\n }\n }\n })\n .attr(\"y1\", d => {\n for (var i = 0; i < this.points.length; i++) {\n if (this.points[i].Id == d.source) {\n return this.getYpos(this.points[i], pointSize)\n }\n }\n })\n .attr(\"x2\", d => {\n for (var i = 0; i < this.points.length; i++) {\n if (this.points[i].Id == d.target) {\n return this.getXpos(this.points[i], pointSize)\n }\n }\n })\n .attr(\"y2\", d => {\n for (var i = 0; i < this.points.length; i++) {\n if (this.points[i].Id == d.target) {\n return this.getYpos(this.points[i], pointSize)\n }\n }\n })\n .attr(\"stroke-width\", pointSize/4);\n }", "title": "" }, { "docid": "1c34f788bf99a3d341c966f368c88dd9", "score": "0.45694938", "text": "function drawPoint(canvasContext, point, dp) {\n\t\t\tvar i, x, y, a, b;\n\t\t\ti = point*2;\n\t\t\tx = meanShape[i/2][0];\n\t\t\ty = meanShape[i/2][1];\n\t\t\tfor (var j = 0;j < numParameters;j++) {\n\t\t\t\tx += model.shapeModel.eigenVectors[i][j]*dp[j+4];\n\t\t\t\ty += model.shapeModel.eigenVectors[i+1][j]*dp[j+4];\n\t\t\t}\n\t\t\ta = dp[0]*x - dp[1]*y + dp[2];\n\t\t\tb = dp[0]*y + dp[1]*x + dp[3];\n\t\t\tx += a;\n\t\t\ty += b;\n\t\t\tcanvasContext.beginPath();\n\t\t\tcanvasContext.arc(x, y, 1, 0, Math.PI*2, true);\n\t\t\tcanvasContext.closePath();\n\t\t\tcanvasContext.fill();\n\t\t}", "title": "" }, { "docid": "b349181257929b0d4f5be274d4550441", "score": "0.4557514", "text": "function renderKarplusStrong(\n seedNoiseStart,\n seedNoiseEnd,\n targetArrayStart,\n targetArrayEnd,\n sampleRate, hz, velocity,\n smoothingFactor, stringTension,\n pluckDamping,\n pluckDampingVariation,\n characterVariation\n ) {\n seedNoiseStart = seedNoiseStart|0;\n seedNoiseEnd = seedNoiseEnd|0;\n targetArrayStart = targetArrayStart|0;\n targetArrayEnd = targetArrayEnd|0;\n sampleRate = sampleRate|0;\n hz = +hz;\n velocity = +velocity;\n smoothingFactor = +smoothingFactor;\n stringTension = +stringTension;\n pluckDamping = +pluckDamping;\n pluckDampingVariation = +pluckDampingVariation;\n characterVariation = +characterVariation;\n\n var period = 0.0;\n var periodSamples = 0;\n var sampleCount = 0;\n var lastOutputSample = 0.0;\n var curInputSample = 0.0;\n var noiseSample = 0.0;\n var skipSamplesFromTension = 0;\n var curOutputSample = 0.0;\n var pluckDampingMin = 0.0;\n var pluckDampingMax = 0.0;\n var pluckDampingVariationMin = 0.0;\n var pluckDampingVariationMax = 0.0;\n var pluckDampingVariationDifference = 0.0;\n var pluckDampingCoefficient = 0.0;\n\n // the (byte-addressed) index of the heap as a whole that\n // we get noise samples from\n var heapNoiseIndexBytes = 0;\n // the (Float32-addressed) index of the portion of the heap\n // that we'll be writing to\n var targetIndex = 0;\n // the (byte-addressed) index of the heap as a whole where\n // we'll be writing\n var heapTargetIndexBytes = 0;\n // the (byte-addressed) index of the heap as a whole of\n // the start of the last period of samples\n var lastPeriodStartIndexBytes = 0;\n // the (byte-addressed) index of the heap as a whole from\n // where we'll be taking samples from the last period, after\n // having added the skip from tension\n var lastPeriodInputIndexBytes = 0;\n\n period = 1.0/hz;\n periodSamples = ~~(+round(period * +(sampleRate>>>0)));\n sampleCount = (targetArrayEnd-targetArrayStart+1)|0;\n\n /*\n |- pluckDampingMax\n |\n | | - pluckDampingVariationMax | -\n | | (pluckDampingMax - pluckDamping) * |\n | | pluckDampingVariation | pluckDamping\n |- pluckDamping | - | Variation\n | | (pluckDamping - pluckDampingMin) * | Difference\n | | pluckDampingVariation |\n | | - pluckDampingVariationMin | -\n |\n |- pluckDampingMin\n */\n pluckDampingMin = 0.1;\n pluckDampingMax = 0.9;\n pluckDampingVariationMin =\n pluckDamping -\n (pluckDamping - pluckDampingMin) * pluckDampingVariation;\n pluckDampingVariationMax =\n pluckDamping +\n (pluckDampingMax - pluckDamping) * pluckDampingVariation;\n pluckDampingVariationDifference =\n pluckDampingVariationMax - pluckDampingVariationMin;\n pluckDampingCoefficient =\n pluckDampingVariationMin +\n (+random()) * pluckDampingVariationDifference;\n\n for (targetIndex = 0;\n (targetIndex|0) < (sampleCount|0);\n targetIndex = (targetIndex + 1)|0) {\n\n heapTargetIndexBytes = (targetArrayStart + targetIndex) << 2;\n\n if ((targetIndex|0) < (periodSamples|0)) {\n // for the first period, feed in noise\n // remember, heap index has to be bytes...\n heapNoiseIndexBytes = (seedNoiseStart + targetIndex) << 2;\n noiseSample = +heap[heapNoiseIndexBytes >> 2];\n // create room for character variation noise\n noiseSample = noiseSample * (1.0 - characterVariation);\n // add character variation\n noiseSample = noiseSample +\n characterVariation * (-1.0 + 2.0 * (+random()));\n // also velocity\n noiseSample = noiseSample * velocity;\n // by varying 'pluck damping', we can control the spectral\n // content of the input noise\n curInputSample =\n +lowPass(curInputSample, noiseSample,\n pluckDampingCoefficient);\n } else if (stringTension != 1.0) {\n // for subsequent periods, feed in the output from\n // about one period ago\n lastPeriodStartIndexBytes =\n (heapTargetIndexBytes - (periodSamples << 2))|0;\n skipSamplesFromTension =\n ~~floor(stringTension * (+(periodSamples>>>0)));\n lastPeriodInputIndexBytes =\n (lastPeriodStartIndexBytes +\n (skipSamplesFromTension << 2))|0;\n curInputSample = +heap[lastPeriodInputIndexBytes >> 2];\n } else {\n // if stringTension == 1.0, we would be reading from the\n // same sample we were writing to\n // ordinarily, this would have the effect that only the first\n // period of noise was preserved, and the rest of the buffer\n // would be silence, but because we're reusing the heap,\n // we'd actually be reading samples from old waves\n curInputSample = 0.0;\n }\n\n // the current period is generated by applying a low-pass\n // filter to the last period\n curOutputSample =\n +lowPass(lastOutputSample, curInputSample, smoothingFactor);\n\n heap[heapTargetIndexBytes >> 2] = curOutputSample;\n lastOutputSample = curOutputSample;\n }\n }", "title": "" }, { "docid": "b349181257929b0d4f5be274d4550441", "score": "0.4557514", "text": "function renderKarplusStrong(\n seedNoiseStart,\n seedNoiseEnd,\n targetArrayStart,\n targetArrayEnd,\n sampleRate, hz, velocity,\n smoothingFactor, stringTension,\n pluckDamping,\n pluckDampingVariation,\n characterVariation\n ) {\n seedNoiseStart = seedNoiseStart|0;\n seedNoiseEnd = seedNoiseEnd|0;\n targetArrayStart = targetArrayStart|0;\n targetArrayEnd = targetArrayEnd|0;\n sampleRate = sampleRate|0;\n hz = +hz;\n velocity = +velocity;\n smoothingFactor = +smoothingFactor;\n stringTension = +stringTension;\n pluckDamping = +pluckDamping;\n pluckDampingVariation = +pluckDampingVariation;\n characterVariation = +characterVariation;\n\n var period = 0.0;\n var periodSamples = 0;\n var sampleCount = 0;\n var lastOutputSample = 0.0;\n var curInputSample = 0.0;\n var noiseSample = 0.0;\n var skipSamplesFromTension = 0;\n var curOutputSample = 0.0;\n var pluckDampingMin = 0.0;\n var pluckDampingMax = 0.0;\n var pluckDampingVariationMin = 0.0;\n var pluckDampingVariationMax = 0.0;\n var pluckDampingVariationDifference = 0.0;\n var pluckDampingCoefficient = 0.0;\n\n // the (byte-addressed) index of the heap as a whole that\n // we get noise samples from\n var heapNoiseIndexBytes = 0;\n // the (Float32-addressed) index of the portion of the heap\n // that we'll be writing to\n var targetIndex = 0;\n // the (byte-addressed) index of the heap as a whole where\n // we'll be writing\n var heapTargetIndexBytes = 0;\n // the (byte-addressed) index of the heap as a whole of\n // the start of the last period of samples\n var lastPeriodStartIndexBytes = 0;\n // the (byte-addressed) index of the heap as a whole from\n // where we'll be taking samples from the last period, after\n // having added the skip from tension\n var lastPeriodInputIndexBytes = 0;\n\n period = 1.0/hz;\n periodSamples = ~~(+round(period * +(sampleRate>>>0)));\n sampleCount = (targetArrayEnd-targetArrayStart+1)|0;\n\n /*\n |- pluckDampingMax\n |\n | | - pluckDampingVariationMax | -\n | | (pluckDampingMax - pluckDamping) * |\n | | pluckDampingVariation | pluckDamping\n |- pluckDamping | - | Variation\n | | (pluckDamping - pluckDampingMin) * | Difference\n | | pluckDampingVariation |\n | | - pluckDampingVariationMin | -\n |\n |- pluckDampingMin\n */\n pluckDampingMin = 0.1;\n pluckDampingMax = 0.9;\n pluckDampingVariationMin =\n pluckDamping -\n (pluckDamping - pluckDampingMin) * pluckDampingVariation;\n pluckDampingVariationMax =\n pluckDamping +\n (pluckDampingMax - pluckDamping) * pluckDampingVariation;\n pluckDampingVariationDifference =\n pluckDampingVariationMax - pluckDampingVariationMin;\n pluckDampingCoefficient =\n pluckDampingVariationMin +\n (+random()) * pluckDampingVariationDifference;\n\n for (targetIndex = 0;\n (targetIndex|0) < (sampleCount|0);\n targetIndex = (targetIndex + 1)|0) {\n\n heapTargetIndexBytes = (targetArrayStart + targetIndex) << 2;\n\n if ((targetIndex|0) < (periodSamples|0)) {\n // for the first period, feed in noise\n // remember, heap index has to be bytes...\n heapNoiseIndexBytes = (seedNoiseStart + targetIndex) << 2;\n noiseSample = +heap[heapNoiseIndexBytes >> 2];\n // create room for character variation noise\n noiseSample = noiseSample * (1.0 - characterVariation);\n // add character variation\n noiseSample = noiseSample +\n characterVariation * (-1.0 + 2.0 * (+random()));\n // also velocity\n noiseSample = noiseSample * velocity;\n // by varying 'pluck damping', we can control the spectral\n // content of the input noise\n curInputSample =\n +lowPass(curInputSample, noiseSample,\n pluckDampingCoefficient);\n } else if (stringTension != 1.0) {\n // for subsequent periods, feed in the output from\n // about one period ago\n lastPeriodStartIndexBytes =\n (heapTargetIndexBytes - (periodSamples << 2))|0;\n skipSamplesFromTension =\n ~~floor(stringTension * (+(periodSamples>>>0)));\n lastPeriodInputIndexBytes =\n (lastPeriodStartIndexBytes +\n (skipSamplesFromTension << 2))|0;\n curInputSample = +heap[lastPeriodInputIndexBytes >> 2];\n } else {\n // if stringTension == 1.0, we would be reading from the\n // same sample we were writing to\n // ordinarily, this would have the effect that only the first\n // period of noise was preserved, and the rest of the buffer\n // would be silence, but because we're reusing the heap,\n // we'd actually be reading samples from old waves\n curInputSample = 0.0;\n }\n\n // the current period is generated by applying a low-pass\n // filter to the last period\n curOutputSample =\n +lowPass(lastOutputSample, curInputSample, smoothingFactor);\n\n heap[heapTargetIndexBytes >> 2] = curOutputSample;\n lastOutputSample = curOutputSample;\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" }, { "docid": "ce5994839a908b266a6bdcf2ffa3334b", "score": "0.45533857", "text": "function bnpDAddOffset(n,w) {\n if(n == 0) return;\n while(this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while(this[w] >= this.DV) {\n this[w] -= this.DV;\n if(++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n }", "title": "" } ]
2f8cf9f32a2463b4fd49e74dfbaf1a27
================================================================== Project dashboard start ===================================================================
[ { "docid": "a99ea200abb07f24eda303cc39569de2", "score": "0.0", "text": "function getDeliverManagerProjects()\n{\n \n \n document.getElementById(\"noteLableForProject\").style.display='none';\n var tableId = document.getElementById(\"tblDMProjects\");\n clearTable(tableId);\n \n var startDate = document.getElementById(\"startDate\").value;\n var endDate = document.getElementById(\"endDate\").value;\n var teamMemberId = document.getElementById(\"managerTeamMember\").value;\n var state = document.getElementById(\"status\").value;\n \n // alert(startDate+\" \"+endDate+\" \"+teamMemberId+\" \"+state);\n var checkResult = compareDates(startDate,endDate);\n if(!checkResult) {\n return false;\n }\n \n var req = newXMLHttpRequest();\n req.onreadystatechange = function() {\n if (req.readyState == 4) {\n if (req.status == 200) { \n document.getElementById(\"loadProjectMessage\").style.display = 'none';\n displayManagerProjectDashBoard(req.responseText); \n } \n }else {\n document.getElementById(\"loadProjectMessage\").style.display = 'block';\n }\n }; \n var url = CONTENXT_PATH+\"/getPreSalesProjectDashBoard.action?startDate=\"+startDate+\"&endDate=\"+endDate+\"&state=\"+state+\"&teamMemberId=\"+teamMemberId+\"&dummy=\"+new Date().getTime();\n req.open(\"GET\",url,\"true\");\n req.setRequestHeader(\"Content-Type\",\"application/x-www-form-urlencoded\");\n req.send(null);\n}", "title": "" } ]
[ { "docid": "d280d5cdfe456a157d9b7831c3e8e074", "score": "0.68133324", "text": "function start() {\n console.log(\"\");\n console.log(\"______________________________________\");\n console.log(\"\");\n console.log(\"Welcome to BAMAZON\");\n console.log(\"\");\n console.log(\"______________________________________\");\n console.log(\"\");\n console.log(\"Manager's view\");\n console.log(\"\");\n console.log(\"______________________________________\");\n console.log(\"\");\n}", "title": "" }, { "docid": "9f9fab90e9bab5cc98d61915f6b2e4dd", "score": "0.66556585", "text": "initializing() {\n this.log(\n chalk.magenta(\n `\\n欢迎使用 Matman 脚手架来创建 project!\\n`\n )\n );\n }", "title": "" }, { "docid": "7fe981ed0c91d76fa9c51c5ac1ce2cef", "score": "0.655595", "text": "function startDashboard() {\n // scrollTo('#data-dashboard');\n //\n // setTimeout(function() {\n // $('#year-review').css('display', 'none');\n // $('#begin').css('display', 'none');\n // }, 1000);\n // document.getElementById('control').style = \"opacity: 0;\";\n // window.hideControl = setTimeout(function() {\n // document.getElementById('control').style = \"display: none;\";\n // }, 1000);\n\n ipcRenderer.send('dashboard-open');\n}", "title": "" }, { "docid": "dbd40db58540c58ffa97a547058e28ac", "score": "0.65306324", "text": "function generateDashboard(){\n\tgetReadinessActivities();\n\tgetVerificationStatus();\n\tgetIssueStatus();\n\tgetOngoingActivities();\n}", "title": "" }, { "docid": "bd4f6734bc1f2f3e8638b2e4e32d2255", "score": "0.6528703", "text": "function Main() {\n console.log(`%c App Started...`, \"font-weight: bold; font-size: 20px;\"); \n \n insertHTML(\"/Views/partials/header.html\", \"header\");\n\n let sourceURL = \"\";\n switch (document.title) {\n case \"COMP125 - Assignment Three : Biography Page\":\n sourceURL = \"/Views/content/bio.html\";\n break;\n case \"COMP125 - Assignment Three : Project Page\":\n sourceURL = \"/Views/content/projects.html\";\n break;\n case \"COMP125 - Assignmnet Three : Contact Page\":\n sourceURL = \"/Views/content/contact.html\";\n break;\n }\n\n setPageContent(sourceURL);\n insertHTML(\"/Views/partials/footer.html\", \"footer\");\n }", "title": "" }, { "docid": "541f15eb4c3fe42f07f31d8555a0e761", "score": "0.6481689", "text": "start() {\n\n // Instantiate modules.\n for (let moduleName of wxPIM.registeredModules) {\n wxPIM.modules[moduleName] = new wxPIM.moduleClasses[moduleName]();\n }\n\n // The base layout of the page.\n webix.ui(this.getBaseLayoutConfig());\n\n // Augment main base with a ProgressBar so it can be masked during server calls.\n webix.extend($$(\"baseLayout\"), webix.ProgressBar);\n\n // Sidemenu.\n webix.ui(this.getSideMenuConfig());\n\n // Retrieve serer address from Local Storage. If not present, prompt for it.\n const serverAddress = localStorage.getItem(\"serverAddress\");\n if (!serverAddress) {\n wxPIM.promptForServerAddress();\n } else {\n // Get all data from server.\n wxPIM.getAllData();\n }\n\n }", "title": "" }, { "docid": "e11e5be5787ba9c08e121d72a0fe54c2", "score": "0.6408936", "text": "function main() {\n\t\t\thtmlModule = new htmlUtil(); // View creation / HTML logic\n\t\t\tarrModule = new arrMethods(); // Array Method shortcuts\n\t\t\tmsg = htmlModule.msg; // Logging\n\t\t\tmsg.set(\"Starting Module\");\n\n\t\t\t// Setup Form.\n\t\t\tmultipleForm();\n\n\t\t}", "title": "" }, { "docid": "0a264317b350477f81a21d80ba6948d6", "score": "0.63629204", "text": "function main() {\n\t\t\thtmlModule = new htmlUtil(); // View creation / HTML logic\n\t\t\tarrModule = new arrMethods(); // Array Method shortcuts\n\t\t\tmsg = htmlModule.msg; // Logging\n\t\t\tmsg.set(\"Starting Module\");\n\t\t\thtmlModule.outputToContentDiv(\"Grading\");\n\t\t\t// Setup Form.\n\t\t\tgraderForm();\n\t\t}", "title": "" }, { "docid": "d207ff56814e7be821181b32ca42cfc5", "score": "0.6335246", "text": "function main() {\n\n // Step 1: Load Your Model Data\n // The default code here will load the fixtures you have defined.\n // Comment out the preload line and add something to refresh from the server\n // when you are ready to pull data from your server.\n //ViewBuilder.server.preload(ViewBuilder.FIXTURES) ;\n\n // TODO: refresh() any collections you have created to get their records.\n // ex: ViewBuilder.contacts.refresh() ;\n\n // Step 2: Instantiate Your Views\n // This default code simply finds your main pane and adds makes it visible\n // on the page. This will usually do everything you need, though you could\n // choose to show other views here as well, such as palettes.\n ViewBuilder.getPath('mainPage.mainPane').append(); \n\n // Step 3. Set the content property on your primary controller.\n // This will make your app come alive!\n \n}", "title": "" }, { "docid": "e1bc0718bc0fa0be236362713d9fb057", "score": "0.6284549", "text": "function start() {\n\n gw_job_process.UI();\n\n }", "title": "" }, { "docid": "e1bc0718bc0fa0be236362713d9fb057", "score": "0.6284549", "text": "function start() {\n\n gw_job_process.UI();\n\n }", "title": "" }, { "docid": "e1bc0718bc0fa0be236362713d9fb057", "score": "0.6284549", "text": "function start() {\n\n gw_job_process.UI();\n\n }", "title": "" }, { "docid": "e1bc0718bc0fa0be236362713d9fb057", "score": "0.6284549", "text": "function start() {\n\n gw_job_process.UI();\n\n }", "title": "" }, { "docid": "e1bc0718bc0fa0be236362713d9fb057", "score": "0.6284549", "text": "function start() {\n\n gw_job_process.UI();\n\n }", "title": "" }, { "docid": "e1bc0718bc0fa0be236362713d9fb057", "score": "0.6284549", "text": "function start() {\n\n gw_job_process.UI();\n\n }", "title": "" }, { "docid": "e1bc0718bc0fa0be236362713d9fb057", "score": "0.6284549", "text": "function start() {\n\n gw_job_process.UI();\n\n }", "title": "" }, { "docid": "e1bc0718bc0fa0be236362713d9fb057", "score": "0.6284549", "text": "function start() {\n\n gw_job_process.UI();\n\n }", "title": "" }, { "docid": "e1bc0718bc0fa0be236362713d9fb057", "score": "0.6284549", "text": "function start() {\n\n gw_job_process.UI();\n\n }", "title": "" }, { "docid": "e1bc0718bc0fa0be236362713d9fb057", "score": "0.6284549", "text": "function start() {\n\n gw_job_process.UI();\n\n }", "title": "" }, { "docid": "e1bc0718bc0fa0be236362713d9fb057", "score": "0.6284549", "text": "function start() {\n\n gw_job_process.UI();\n\n }", "title": "" }, { "docid": "e1bc0718bc0fa0be236362713d9fb057", "score": "0.6284549", "text": "function start() {\n\n gw_job_process.UI();\n\n }", "title": "" }, { "docid": "e1bc0718bc0fa0be236362713d9fb057", "score": "0.6284549", "text": "function start() {\n\n gw_job_process.UI();\n\n }", "title": "" }, { "docid": "e1bc0718bc0fa0be236362713d9fb057", "score": "0.6284549", "text": "function start() {\n\n gw_job_process.UI();\n\n }", "title": "" }, { "docid": "e1bc0718bc0fa0be236362713d9fb057", "score": "0.6284549", "text": "function start() {\n\n gw_job_process.UI();\n\n }", "title": "" }, { "docid": "e1bc0718bc0fa0be236362713d9fb057", "score": "0.6284549", "text": "function start() {\n\n gw_job_process.UI();\n\n }", "title": "" }, { "docid": "e1bc0718bc0fa0be236362713d9fb057", "score": "0.6284549", "text": "function start() {\n\n gw_job_process.UI();\n\n }", "title": "" }, { "docid": "e1bc0718bc0fa0be236362713d9fb057", "score": "0.6284549", "text": "function start() {\n\n gw_job_process.UI();\n\n }", "title": "" }, { "docid": "201851a058cc8a5165ba34ed778ad23c", "score": "0.6260623", "text": "function appStart() {\n htmlGenerate();\n addTeamMember();\n}", "title": "" }, { "docid": "9745c0ff0ebfef608ceac1d32f6151ee", "score": "0.6233145", "text": "function main() {\n\tlog.verbose( 'main', 'Begin' );\n\tmodel.init({\n\t\tMovies: new MoviesModel(),\n\t\tSeries: new SeriesModel()\n\t});\n\tui.init({\n\t\tmain: VideosMenu,\n\t\ttheme: {\n\t\t\tbgColor: \"rgb(44,44,44)\",\n\t\t\tfgColor: \"rgb(65,65,65)\",\n\t\t\tfocusColor: \"rgb(128,128,128)\"\n\t\t}\n\t});\n}", "title": "" }, { "docid": "1621a3adb39f0505dab4d3f3240ea492", "score": "0.61929995", "text": "function start() {\n\ttaskProcessed++;\n\tconsole.log('Task Processed: ' + taskProcessed + ' | ' + 'Number Of Tasks : ' + NUMBER_OF_TASKS);\n\tif(taskProcessed === NUMBER_OF_TASKS) {\n\t\ttaskProcessed = 0;\n\t\tNUMBER_OF_TASKS = 0;\n\n\t\t/** Load Table */\n\t\tconstructRankingTable();\n\n\t\t/** Initialise Graphics */\n\t\tinit();\n\t\tanimate();\n\n\t\t/** Initialise Interactions */\n\t\trankFilesOnClick();\n\t\taffectedFoldersOnClick();\n\t\tfilesOnClick();\n\t\t/** Launch Page */\n\t\tlaunchPage();\n\t\tmenuButonListener();\n\t}\n}", "title": "" }, { "docid": "01dedb604c1c590a476e3a947ce8e941", "score": "0.6189441", "text": "function start () {\n header = \"# \" + data.repoTitle + \"\\n \\n\" + \"![Repo Size](https://img.shields.io/github/repo-size/\" + data.username + \"/\" + data.repoTitle +\") <br> \\n\";\n title(header);\n setTimeout(() => {\n title(\"## Description \" + \"<span id=\\\"d\\\"></span> \\n\" + data.repoDescript + \"\\n \\n\");\n }, 40);\n setTimeout(() => {\n title(\"## Table of Contents \\n <ul><li><a href=\\\"#i\\\">Installation</a></li><li><a href=\\\"#u\\\">Usage</a></li><li><a href=\\\"#l\\\">License</a></li><li><a href=\\\"#c\\\">Contributing</a></li><li><a href=\\\"#t\\\">Tests</a></li></ul> \\n \\n\");\n }, 50);\n setTimeout(() => {\n title(\"## Installation \" + \"<span id=\\\"i\\\"></span> \\n\" + data.install + \" \\n \\n\");\n }, 60);\n setTimeout(() => {\n title(\"## Usage \" + \"<span id=\\\"u\\\"></span> \\n\" + data.use + \" \\n \\n\");\n }, 70);\n setTimeout(() => {\n title(\"## License \" + \"<span id=\\\"l\\\"></span> \\n\" + data.stack + \" \\n \\n\");\n }, 80);\n setTimeout(() => {\n title(\"## Contributing \" + \"<span id=\\\"c\\\"></span> \\n\" + data.contributer + \" \\n \\n\");\n }, 90);\n setTimeout(() => {\n title(\"## Tests \" + \"<span id=\\\"t\\\"></span> \\n\" + data.test + \" \\n \\n\");\n }, 100);\n if (obj.data[0].payload.action === \"started\") {\n setTimeout(() => {\n title(\"## Author Info \\n Email: \" + email + \"<br>\" + \"\\n Name: \" + username2 + \"<br>\" + \"\\n Profile Picture: <br> ![](\" + obj.data[0].actor.avatar_url + \") \\n \\n\");\n }, 110);\n } else {\n setTimeout(() => {\n title(\"## Author Info \\n Email: \" + obj.data[0].payload.commits[0].author.email + \"<br>\" + \"\\n Name: \" + obj.data[0].payload.commits[0].author.name + \"<br>\" + \"\\n Profile Picture: <br> ![](\" + obj.data[0].actor.avatar_url + \") \\n \\n\");\n }, 110);\n }\n }", "title": "" }, { "docid": "869d4a5789cb9dffc365c898567fd223", "score": "0.6184585", "text": "function startPage() {\n\t injectTableCode();/*Create the Go game board*/\n fitSize();/*Fit the container of the Go game board fit the size of the window*/\n editGrid();\n updateWholeBoard();\n dbToDiv(restartAutoUpdat);\n realtimeupdate();\n // The order of these functions are important. You can't operate on code that hasn't been generated.\n}", "title": "" }, { "docid": "3e1a41293ae962b835d169b7f6e7889d", "score": "0.6150225", "text": "function startup() {\n\t\n}", "title": "" }, { "docid": "469a8d2488982183256ea22f0d593a41", "score": "0.61462194", "text": "function index() {\n createMainWin().open();\n }", "title": "" }, { "docid": "83114b1200cf0e849a44e402ec8e77dd", "score": "0.6135261", "text": "Start() {\n }", "title": "" }, { "docid": "b657a0162df4b4872b0f5a999cd609e8", "score": "0.6115904", "text": "function start(){\n \n connection.connect(function(err) {\n if (err) throw err;\n console.log(`\n =================================================================================================== \n Welcome to BAMAZON Management Portal\n =================================================================================================== \n `.red);\n \n mgmtOptions();\n \n \n });\n}", "title": "" }, { "docid": "79ecca7c8abb8a1afebb07255cbfafb3", "score": "0.6110215", "text": "function init() {\n\t\tconsole.log(\"super-mario-galaxy page init\");\n\t\thideRefreshButton();\n\t\t\n\t\t\n\t}", "title": "" }, { "docid": "87f44869754d181d98e8402432b9c9e5", "score": "0.61085427", "text": "start() {\n var urlsRepository = new _UrlsRepository.default(this.args);\n var htmlRepository = new _HtmlRepository.default(this.args.getProjectPath());\n var contentRepository = new _ContentRepository.default(this.args.getProjectPath());\n var crawlStatesRepository = new _SqliteCrawlStatesRepository.default(this.args.getProjectPath());\n var urls = urlsRepository.findAll().filter(url => {\n return !(0, _fs.existsSync)((0, _path.join)(contentRepository.getProjectsContentFolder(), url.name + \".json\"));\n });\n var progress = new _Progress.default(null, urls.length);\n this.emitStart(progress);\n urls.forEach(url => {\n var html = htmlRepository.read(url);\n var data = (0, _unfluff.default)(html);\n contentRepository.save(url, data).then();\n crawlStatesRepository.update(url.name, data.title, data.text);\n progress.update(url);\n this.emitProgress(progress);\n });\n progress.update(null);\n this.emitComplete(progress);\n }", "title": "" }, { "docid": "94f84bef7727c43e9c86049efeafd448", "score": "0.6103309", "text": "function dashboard(username) {\n // before I load dashboard, I need to clear the dom container in order to get rid of login/registration information when new user created\n const myDiv = document.createElement(\"div\");\n myDiv.setAttribute(\"class\", \"dashboard\");\n document.querySelector(\"body\").appendChild(myDiv);\n // clear loginClass container\n document.querySelector(\".loginClass\").innerHTML = \"\";\n\n // clear DOM information from welcome/registration/login\n const child = document.querySelector(\".loginClass\");\n child.parentNode.removeChild(child)\n\n // create the logo for dashboard\n const logo = document.createElement(\"img\");\n // I'm thinking images for live dist need to be in dist folder. is this so? Ask Steve. Had issues with it in other folders and probably because Grunt file isn't copying those over to dist\n logo.setAttribute(\"src\", \"squirrelNutshell.png\");\n logo.setAttribute(\"width\", \"100\");\n logo.setAttribute(\"height\", \"100\");\n logo.setAttribute(\"alt\", \"Nutshell\");\n logo.setAttribute(\"class\", \"logo\");\n const scriptRef = document.querySelector(\"script\");\n const dashboardRef = document.querySelector(\".dashboard\");\n // insert dashboard container before script tag but after image\n dashboardRef.appendChild(logo);\n document.querySelector(\"body\").insertBefore(dashboardRef, scriptRef);\n const p = document.createElement(\"p\");\n // using username argument for custom welcome\n p.innerHTML = `<h2>Welcome to your dashboard, ${username}!</h2>`;\n document.querySelector(\".dashboard\").appendChild(p);\n\n // logout button for dashboard needs event listener to clear session storage\n const logoutBtn = document.createElement(\"button\");\n logoutBtn.setAttribute(\"class\", \"logoutButton\");\n const logoutTextNode = document.createTextNode(\"logout\");\n logoutBtn.appendChild(logoutTextNode);\n dashboardRef.appendChild(logoutBtn);\n\n logoutBtn.addEventListener(\"click\", function logout() {\n // clear session storage and call welcome() after clearing page\n sessionStorage.removeItem(\"session\");\n location.reload();\n });\n\n // create a container div for all of the modules to be targeted by flexbox styling\n const moduleContainer = document.createElement(\"div\");\n moduleContainer.setAttribute(\"class\", \"moduleContainer\");\n dashboardRef.appendChild(moduleContainer);\n\n /**\n * Divs for respective modules here\n */\n\n // task div -- in startTask() function, append everything to .taskDiv\n const taskDiv = document.createElement(\"div\");\n taskDiv.setAttribute(\"class\", \"taskDiv\");\n taskDiv.textContent = \"Tasks\";\n moduleContainer.appendChild(taskDiv);\n \n // chat div\n const chatDiv = document.createElement(\"div\");\n chatDiv.setAttribute(\"class\", \"chatDiv\");\n // chatDiv.textContent = \"chatterbox\";\n moduleContainer.appendChild(chatDiv);\n\n // article div\n const articleDiv = document.createElement(\"div\");\n articleDiv.setAttribute(\"class\", \"articleDiv\");\n // articleDiv.textContent = \"articles\";\n moduleContainer.appendChild(articleDiv);\n\n // event div\n const eventDiv = document.createElement(\"div\");\n eventDiv.setAttribute(\"class\", \"eventDiv\");\n moduleContainer.appendChild(eventDiv);\n\n // users div\n const usersDiv = document.createElement(\"div\");\n usersDiv.setAttribute(\"class\", \"usersDiv\");\n usersDiv.textContent = \"users\";\n moduleContainer.appendChild(usersDiv);\n\n // friends div\n const friendsDiv = document.createElement(\"div\");\n friendsDiv.setAttribute(\"class\", \"friendsDiv\");\n friendsDiv.textContent = \"friends\";\n moduleContainer.appendChild(friendsDiv);\n\n // messages div\n const messagesDiv = document.createElement(\"div\");\n messagesDiv.setAttribute(\"class\", \"messagesDiv\");\n messagesDiv.textContent = \"messages\";\n moduleContainer.appendChild(messagesDiv);\n\n//_______________________________________________INIT DANIEL'S CHAT__________________________________________\n chat.createWindow();\n chatListeners.postButton();\n chatListeners.deleteButton();\n chatListeners.editButton();\n chatListeners.saveEditButton();\n event();\n startTask();\n article();\n //_______________________________________________END OF CHAT__________________________________________\n\n}", "title": "" }, { "docid": "7cd7499b4d34d0d0ea5be2a155f0e54b", "score": "0.6077914", "text": "async run() {\n const progress = this.__spinner();\n const files = await glob(\n [this.templatePath('**/*'), `!${this.templatePath('scripts')}`],\n { directories: false }\n );\n\n const templatePrefix = this.templatePath();\n const rootPrefix = config.root();\n\n progress.tick('initializing new project');\n await pMap(files, async (source) => {\n const destination = _.replace(source, templatePrefix, rootPrefix);\n if (await exist(destination)) {\n return;\n }\n\n await copy(source, destination);\n });\n\n await this.addScripts();\n\n await this.setPackageFiles();\n progress.success('norska project initialized');\n\n await this.enableNetlify();\n }", "title": "" }, { "docid": "91d387421b9da33b471595a63e470b17", "score": "0.6065429", "text": "function start() {\n\n gw_job_process.UI();\n v_global.logic.proj_no = gw_com_api.getPageParameter(\"proj_no\");\n gw_com_api.setValue(\"frmOption\", 1, \"proj_no\", v_global.logic.proj_no);\n processRetrieve({});\n\n }", "title": "" }, { "docid": "be316a4bfb18b61857ad539e2209fdce", "score": "0.6026427", "text": "function onOpen() {\n var ui = SpreadsheetApp.getUi();\n // Or DocumentApp or FormApp.\n ui.createMenu('Schedule Engine')\n .addSeparator()\n .addSubMenu(ui.createMenu('Import')\n .addItem('Pull Banner Courses and Seat Availability', 'pullBannerClassScheduleData'))\n .addSubMenu(ui.createMenu('Debug')\n .addItem('Show Logs (not implemented)', 'showLogs'))\n .addToUi();\n}", "title": "" }, { "docid": "17f69ff53e9c41db0b368a91a490c7ee", "score": "0.6024435", "text": "function initialStart() {\n\tdisplayHobbies(setHobbies());\n\tgetNews(\"news/news.json\");\n\tdisplayItems();\n}", "title": "" }, { "docid": "35114944614f9abbd1c8a9acf3d16877", "score": "0.60209334", "text": "start () {\n //DO BEFORE START APP CONFIGURATION\n super.start();\n }", "title": "" }, { "docid": "f56d6cd9370e7277f1ca82525e8dbb14", "score": "0.60197484", "text": "function Start() {\n console.log(\"App started...\");\n\n // Call corresponding render functions based on title of current page using switch statement\n switch (document.title) {\n case \"Home\":\n displayHome();\n break;\n case \"About\":\n displayAbout();\n break;\n case \"Projects\":\n displayProjects();\n break;\n case \"Services\":\n displayServices();\n break;\n case \"Contact\":\n displayContact();\n break;\n }\n }", "title": "" }, { "docid": "0ba861236f0611b6bb039490c86e7174", "score": "0.60170084", "text": "function DashboardService() {\n }", "title": "" }, { "docid": "0bff0ed3218dfe13abfdafa1c9c79a93", "score": "0.59943384", "text": "function loadIndex() {\n\tvar user = Parse.User.current();\n\tif (user !== null) {\n\t\t$.ui.loadContent('#panel-home', true, false);\n\t}\n}", "title": "" }, { "docid": "fd164d1f3bca4dc1f19b8d60d9b0b2cf", "score": "0.59777135", "text": "function start()\n{\n\tCONNECTION.connect();\n\tsupervisorMenu();\n}//end start()", "title": "" }, { "docid": "a770be84f38750a28be1039554c1dcca", "score": "0.59740186", "text": "async start() {\n if(!existsSync('./data')) {\n fs.mkdirSync('./data')\n }\n await this.setupStoryblokClient()\n try {\n await this.getWebsites()\n await this.import()\n } catch(err) {\n console.log('Import failed because of an error:')\n console.log(err)\n } \n }", "title": "" }, { "docid": "44668a1c278d6c46574f1e60c799740e", "score": "0.5972571", "text": "function pageSetup() {\n\tnavbar();\n\tstatusBoxes();\n}", "title": "" }, { "docid": "0e85285668105288870e364edfafc637", "score": "0.5971972", "text": "function start() {\n \t// Get Zendesk profile\n \tapp.sdkConfig.userType = app.userTypes[HelpCenter.user.role];\n \tsdk = InbentaSearchSDK.createFromDomainKey(app.sdkAuth.domainKey, app.sdkAuth.publicKey, app.sdkConfig);\n var components = app.appConfig;\n\n buildHTML(components);\n initSDK(sdk, components);\n initCustomEvents(sdk, components);\n }", "title": "" }, { "docid": "63d6a415eddcb9daa3735e8d77c06aec", "score": "0.59715074", "text": "run() {\n APP.Model.ACTIONS = APP.ACTIONS;\n // run application step by step\n APP.initLogs();\n APP.initModulesAndPlugins();\n APP.catchErrors();\n APP.runMainModulesAndPlugins();\n }", "title": "" }, { "docid": "51584ccbd691f99f9e82a9aecaaecf86", "score": "0.5965985", "text": "function initializeDashboard() {\n\tdebug('Initialising dashboard');\n\n\tdebug('Initialising companies');\n\tfor (var i=0; i<user_companies.length; ++i) {\n\t\t//console.log(\"looking for: \"+user_companies[i]);\n\t\tvar b = $(\".company-panel[company=\"+user_companies[i]+\"]\");\n\t\tb = b.find(\".company-checkbox\");\n\t\tb.addClass(\"checked\");\n\t}\n\t\n\t// When you click on a company name\n\t$('.company-panel').on('click', function(e) {\n\t\tvar id = $(this).attr('company');\n\t\tdebug('click company:'+id);\n\t\te.preventDefault();\n\t\tshowChartFor(id,$(this).text());\n\t});\n\n\t// When you click on a company checkbox\n\t$('.company-checkbox').on('click', function(e) {\n\t\te.preventDefault();\n\t\tvar p = $(this).closest(\".company-panel\");\n\t\tvar id = p.attr('company');\n\t\tdebug('click checkbox: '+id);\n\t\t$(this).toggleClass(\"checked\");\n\t\treturn false;\n\t});\n\t//showChartFor(104,\"Telefonica\");\n}", "title": "" }, { "docid": "58192df52199ec035e6317891d39c0ea", "score": "0.59608793", "text": "function main() {\n\n application = new Application();\n if (jsonSettings) {\n application.settings = JSON.parse(specialCharsToHtml(jsonSettings));\n\n var settValue = application.settingsValueForKey(\"is_always_debugger\");\n if (settValue) {\n var isAlwaysDebugger = parseInt(settValue);\n if (!isNaN(isAlwaysDebugger)) {\n application.isAlwaysDebugger = !!isAlwaysDebugger;\n }\n }\n \n } \n \n // section: new area, properties, items list\n setSection(0);\n setEventOfSection();\n \n //removeAllCookies();displayAllCookies(); \n //$(\"#menu_list_container\").tooltip(); \n \n // get & set set list of screens (ajax)\n getScreenList({\n async: false,\n data: {\n app_id: appId\n }, \n success: function(resultJSON) {\n console.log(resultJSON);\n var resultData = resultJSON;\n if (!resultData || !application) {\n return;\n }\n var screenData = JSON.parse(resultData);\n if (screenData) {\n application.setScreenListFromServer(screenData.screens); \n application.showSelectScreen();\n //application.boardName = application.getScreenParamByParam(\"name\",\"id\",boardId);\n }\n }\n });\n \n //getSwipegroupsList();\n\n var isPortrait = (orientation == \"portrait\")?true:false;\n canvas = new Canvas('canvas', false);\n \n var pathBoardBackground;\n if (boardBackground == \"None\" || boardBackground == \"\" || boardBackground == \"-\") {\n boardBackground = \"\";\n pathBoardBackground = defaultBackgroundOfCanvas();\n updateBoard(boardId, boardBackground, boardSound);\n } else {\n pathBoardBackground = pathSystem+\"/media/upload/\"+appId+\"/img/\"+boardBackground;\n }\n if (boardSound == \"None\" || boardSound == \"\"|| boardSound == \"-\") {\n boardSound = \"\"; \n updateBoard(boardId, boardBackground, boardSound); \n }\n canvas.setResolution({x:750,y:520}); \n canvas.setBackground(28,20, pathBoardBackground); \n\t\tcanvas.setWorkspaceMargin(20, 8, 0, 0); //20, 20, 20, 22\n canvas.setBackground(28,20, pathBoardBackground); \n \n activeElement = new ActiveElement(canvas.id); \n activeElement.setCallback(activeElement.CALLBACK_ELEMENT_NOT_ACTIVE, callbackElementNotActive);\n properties = new Properties('properties');\n \n\t\tpopupsContainer = new PopupsContainer();\n\t\t\n grid = new Grid(canvas,\"checkbox_show_grid\",\"checkbox_drag_to_grid\",\"input_grid_size\");\n //grid.show();grid.setDrag(true);\n \t\t\n\t\tglobalChange = new GlobalChange();\n \n // actions\n\t\tvar optionsActions = { id_actions: \"actions\", \n\t\t\t\t\t\t\t id_actions_header: \"actions_header\",\n\t\t\t\t\t\t\t id_actions_tree: \"actions_tree\",\n\t\t\t\t\t\t\t id_actions_tree_option_prefix: \"actions_tree_option\",\n\t\t\t\t\t\t\t id_actions_tree_element_delete: \"actions_tree_element_delete\",\n\t\t\t\t\t\t\t id_actions_parameters: \"actions_parameters\",\n\t\t\t\t\t\t\t id_actions_available: \"actions_available\", \n\t\t\t\t\t\t\t list_actions_available: new Array(ACTIONS_ONCLICK,/*ACTIONS_ONDROP,*/\n\t\t\t\t\t\t\t\t\t//ACTIONS_SHOW_ELEMENT,ACTIONS_HIDE_ELEMENT,\n\t\t\t\t\t\t\t\t\tACTIONS_RUN_XML, \n\t\t\t\t\t\t\t\t\tACTIONS_SHOW_TPOPUP, \n\t\t\t\t\t\t\t\t\t//ACTIONS_ITEM_SHOW_TPOPUP,\n\t\t\t\t\t\t\t\t\tACTIONS_PLAY_MP3//, ACTIONS_STOP_MP3\n\t\t\t\t\t\t\t\t\t//ACTIONS_SHOW_IMAGE,ACTIONS_INITIATE_CONVERSATION,\n\t\t\t\t\t\t\t\t\t//ACTIONS_TAKE_ITEM, ACTIONS_DROP_ITEM\n\t\t\t\t\t\t\t\t\t), \n\t\t\t\t\t\t\t }\t\t\n actions = new Actions(optionsActions);\n actions.propertyLiClass = \"action_property\";\n actions.callbackChangeActions = callbackChangeActions;\n //actions.refresh();\n\t\t$(\"#actions\").corner();\n\t\t$(\"#actions_parameters\").corner();\n\t\t\n\t\t//swipegroups = new Swipegroups(\"swipegroups\");\n\t\t//selectSwipegroup(swipegroups.activeElem);\n\t\t\t\t\t\t\n\t\tmessageDialog = new MessageDialog(\"messageDialog\");\n\t\t\n $( \"#dialog_resources\" ).dialog({\n autoOpen: false,\n resizable: false,\n\t\t\ttitle: '<img src=\"'+pathSystem+'/media/img/library_title_icon.png\" style=\"vertical-align:top;margin-top:6px;\" /> <span class=\"title\">LIBRARY</span>',\n modal: true,\n width: 720,\n height: 620,\n close: function( event, ui ) {\n selectElement(activeElement.elementSelected);\n }, \n });\n $(\"#dialog_resources_open\").click(function(){\n var isFind = false;\n EventsNotification.exe(SequencesSystemEvents.EVENT_CLICK_ELEMENT, {id: $(this)[0].id}, function(r){ if (r) isFind = true;}); if (!isFind) {Messages.tutorialWrong();return;} \n\n openResourcesDialog(); \n }); \n resourcesUpload[0] = new ResourcesUpload(\"uploadImage\",\"resources_upload_image\",{accept_file: \"image/*\",type_data:RESOURCES_TYPE_IMAGES}); \n resourcesUpload[1] = new ResourcesUpload(\"uploadMusic\",\"resources_upload_sound\",{accept_file: \"audio/*\",type_data:RESOURCES_TYPE_SOUNDS}); \n \n\t\tmapsContainer = new MapsContainer();\n \n $( \"#dialog_export\" ).dialog({\n autoOpen: false,\n resizable: false,\n width: 330,\n height: 150, \n }); \n \n // set list for properties & resource upload\n getUploadedFilesByType(\"image\");\n getUploadedFilesByType(\"sound\"); \n \n publishCode = new PublishCode(); \n \n // Set the tabs to be switchable\n $( \"#tabs\" ).tabs({\n collapsible: true\n });\n \n $( \"#tabs_resources\" ).tabs({\n collapsible: false \n }); \n \n codeEditor = new CodeEditor();\n // open & close to create instance of tab\n //codeEditor.openEditor();\n //codeEditor.closeEditor();\n\n browserEmulator = new BrowserEmulator();\n browserEmulator.displayEmulator(false);\n browserEmulator.displayBoard({}); // default empty board \n \n sequencesSystem = new SequencesSystem();\n \n $(\"#back_to_previous\").click(function() {\n application.backToPrevious();\n }); \n\n if (isEditStart != \"True\") {\n //$(\"#startingAddingBubbles\").css(\"display\", \"none\");\n } else { \n $(\"#header1_buttons\").append('<input id=\"startingAddingBubbles\" style=\"cursor: pointer;font-size: 10px;width:120px;white-space: normal;\" type=\"button\" value=\"Click this button if you have finished editing starting project and would like to start adding bubbles.\">'); \n $(\"#startingAddingBubbles\").click(function() {\n function setProjectAsFinal() {\n AjaxTutorial.ajaxCopyToEndProject({\n data:{\n lesson_id: lessonId,\n project_id: appId\n },\n success: function() {\n \n AjaxTutorial.ajaxFinishedEditingStarting({\n data:{\n lesson_id: lessonId,\n },\n success: function() {\n window.location.assign(pathSystem+'/editend/'+lessonId+\"/\");\n },\n error: function() {\n messageDialog.show(\"Project\", \"Error.\", \"OK\");\n }\n }); \n },\n error: function() {\n messageDialog.show(\"Project\", \"Error.\", \"OK\");\n } \n });\n }\n messageDialog.showWithTwoButtons(\"Project\", \"Are you sure?\",\"Tak\", \"Nie\", setProjectAsFinal); \n });\n }\n\n $(document).keyup(function(e) {\n if(e.keyCode == 13) { // ENTER\n if (browserEmulator && browserEmulator.isDebugger && codeEditor.isOpen() && !browserEmulator.isNextStep) {\n codeEditor.nextStepDebugger();\n }\n } \n if(e.keyCode == 46) { // DELETE\n callbackPropertyDeleteElement();\n }\n /*if(e.keyCode == 113) { // F2\n if (!adminEditor.isOpen()) {\n adminEditor.show();\n } else {\n adminEditor.hide();\n }\n } */ \n if(e.keyCode == 115) { // F4\n console.log(\"printCodesToConsole\");\n codeEditor.printCodesToConsole(); \n } \n if(e.keyCode == 118) { // F7\n \n //if (!codeEditor.isOpen()) {\n codeEditor.openEditor(); \n //} else {\n //codeEditor.closeEditor();\n //}\n } \n\n\n }); \n \n \n //OnLoad functionality here\n draggableItemsMenu = document.getElementsByClassName('menu_item'); \n // manage menu & elements items\n setDraggableMenuItems();\n setCanvasDroppable();\n setEditables(); \n \n \n var pJSCode = new ParserJSCode();\n pJSCode.testUnit();\t\t\n }", "title": "" }, { "docid": "35198ed8713991773378c973fb9ac089", "score": "0.59578115", "text": "function Start() {\n let title = document.title;\n\n console.log(\"App Started!\");\n console.log(\"----------------------------\");\n console.log(\"Title: \" + title);\n\n // Based on the current page, call the corresponding function\n switch (title) {\n case \"COMP125 - a01 - Bio\":\n BioContent();\n break;\n\n case \"COMP125 - a01 - Projects\":\n ProjectsContent();\n break;\n\n case \"COMP125 - a01 - Contact\":\n ContactContent();\n break;\n\n default:\n break;\n }\n }", "title": "" }, { "docid": "a741c83c891dd1c73ebfbe64b22b7603", "score": "0.5957493", "text": "function initProject() {\n\t\t//Add the app listeners\n\t\tSitoolsDesk.app.addListener(\"allJsIncludesDone\", _onAllJsIncludesDone);\n\t\tSitoolsDesk.app.addListener(\"ready\", desktopReady);\n\t\tSitoolsDesk.app.addListener(\"modulesLoaded\", _onModulesLoaded);\n\n sql2ext.load(loadUrl.get('APP_URL') + \"/conf/sql2ext.properties\");\n\n\t\t//handle windowResize event \n\t\tExt.EventManager.onWindowResize(fireResize, SitoolsDesk);\n\n\t\tprojectGlobal.initProject(callbackRESTCreateProject);\n\n\t\t// Ext.QuickTips.init();\n\n\t\t// Apply a set of config properties to the singleton\n Ext.apply(Ext.QuickTips.getQuickTip(), {\n maxWidth : 200,\n minWidth : 100,\n showDelay : 50,\n trackMouse : true\n });\n\t}", "title": "" }, { "docid": "5b9ea00f7c50a916172744fa0d69edcf", "score": "0.5948025", "text": "function start()\n{ \n buildCharts();\n //make title text for segments visible\n makeTitleTextVisible();\n // make matrix png visible\n makeMatrixVisible();\n// console.log(\"==========\");\n}", "title": "" }, { "docid": "2db82d3567c200d3c36228279ed6db8e", "score": "0.59277827", "text": "function initializePage(){\n addUsers();\n let startID = '940'\n buildBar(startID);\n buildBubble(startID);\n buildMetadata(startID);\n buildGauge(startID);\n}", "title": "" }, { "docid": "e5bda88603073ac77d20053f4fc37515", "score": "0.59276074", "text": "function init(){\n\t\tshowPage(\"about\");\n\t\tshowExport(\"false\");\n\t}", "title": "" }, { "docid": "352c20658609c6d430291e3a9e2a5b2e", "score": "0.5926767", "text": "function main() {\n\t\n\tdocument.title = 'CollegeWikis Administration';\n\n // Step 1: Load Your Model Data\n // The default code here will load the fixtures you have defined.\n // Comment out the preload line and add something to refresh from the server\n // when you are ready to pull data from your server.\n Admin.server.preload(Admin.FIXTURES);\n\n // TODO: refresh() any collections you have created to get their records.\n // ex: Admin.contacts.refresh() ;\n\n // Step 2: Instantiate Your Views\n // The default code just activates all the views you have on the page. If\n // your app gets any level of complexity, you should just get the views you\n // need to show the app in the first place, to speed things up.\n SC.page.awake();\n\n // Step 3. Set the content property on your primary controller.\n // This will make your app come alive!\n\n // TODO: Set the content property on your primary controller\n // ex: Admin.contactsController.set('content',Admin.contacts);\n\n\tvar topics = Admin.Topic.collection();\n\tAdmin.topicsController.set('content', topics);\n\ttopics.refresh();\n\n\tvar groups = Admin.Group.collection();\n\tAdmin.groupsController.set('content', groups);\n\tgroups.refresh();\n\n\tvar networks = Admin.Network.collection();\n\tAdmin.networksController.set('content', networks);\n\tnetworks.refresh();\n\n\n\tvar topic_features = Admin.TopicFeature.collection();\n\tAdmin.topicFeaturesController.set('content', topic_features);\n\ttopic_features.refresh();\n\n\tvar group_features = Admin.GroupFeature.collection();\n\tAdmin.groupFeaturesController.set('content', group_features);\n\tgroup_features.refresh();\n\n\tvar network_features = Admin.NetworkFeature.collection();\n\tAdmin.networkFeaturesController.set('content', network_features);\n\tnetwork_features.refresh();\n\n}", "title": "" }, { "docid": "212516680dbdb99180957fb051128f0f", "score": "0.59099555", "text": "function runApp() {\n app = new AppViewMobile();\n initializeLayout(app);\n // Load images for initial server-side dom\n panel.fade_to_page(window.staticSettings.config.pageNumber);\n}", "title": "" }, { "docid": "d8339c2329bcfac4c06ab172b9bc6f78", "score": "0.590321", "text": "function initLogs( currentPath ){\n switch( currentPath ){\n case '/view-logs':\n fetchLogs();\n initLogsTable(); \n break;\n }\n }// initDashboard", "title": "" }, { "docid": "39599e53d8bbe09394ebb53ceb9899a0", "score": "0.5894956", "text": "function main () {\n \"use strict\"\n\n view.run();\n\n // I used this for tests\n //controller.registerUser(constants.URL_USER, 'json', 'PeshoPesho', 'PeshoPesho');\n //controller.logInUser(constants.URL_LOG_IN, 'json', 'PeshoPesho', 'PeshoPesho');\n //controller.getMessages(constants.URL_POST, 'json');\n //controller.getMessagesFilteredByName(constants.URL_FILTER_BY_USER_NAME, ('PeshoPesho'.toLowerCase()));\n //controller.getMessagesFilteredByPattern(constants.URL_FILTERED_BY_PATTERN, 'test');\n //controller.getMessagesFilteredByNameAndPattern(constants.URL_FILTERED_BY_PATTERN, 'PeshoPesho', 'test');\n //controller.sendMessage(constants.URL_POST, 'json', 'PeshoPesho', 'Ako raboti, mi ostava UI-a...', '22fpjddqZLvLYYIbhMuVxCfdRnwndZjxWxHeEniFOwXaqwUjpm')\n //controller.logOutUser(constants.URL_USER, 'json', '22DqghsjTprllkjlbHisidqweTevYUJdPigblvwifNjuJEOvNy');\n //controller.getMessages(constants.URL, 'json');\n}", "title": "" }, { "docid": "689155dfd9c767fb40208b772ec9b2db", "score": "0.58929396", "text": "static init() {\n const activeProjectsList = new ProjectList('active');\n const finishedProjectsList = new ProjectList('finished');\n }", "title": "" }, { "docid": "6b32540596c828e049dd3ada86c04e55", "score": "0.58840317", "text": "start() {\r\n \r\n }", "title": "" }, { "docid": "c30ddf55daf7a021533d69dea6a21717", "score": "0.58839566", "text": "function setDashboard() {\n $('#portfolio-name').html(portfolio.name);\n $('#portfolio-value').html(formatMoney(portfolio.value));\n $('#view-link').append(`<a href=\"/portfolio/${portfolio.link}\">Dashboard</a>`);\n $('#chart-link').append(`<a href=\"/portfolio/${portfolio.link}/charts\">Charts</a>`);\n $('#trade-link').append(`<a href=\"/portfolio/${portfolio.link}/trade\">Trade</a>`);\n}", "title": "" }, { "docid": "2c9fbd0da85ce296bcd1e0908bd1add8", "score": "0.5883405", "text": "function pageOnLoad(){\n\n //Create default \"Misc. Tasks\" project\n projectHandler.createMiscTasks();\n //Display existing projects on page load\n displayOnLoad();\n //Display tasks of \"Misc. Tasks\" project\n displayTasks();\n //Add \"selectedProject\" class to \"Misc. Tasks\"\n let miscTasks = document.querySelector(\".project\");\n miscTasks.classList.add(\"selectedProject\");\n}", "title": "" }, { "docid": "76aba3d4adc4df6b8e70d9e59d42dbbc", "score": "0.58764356", "text": "startup() { }", "title": "" }, { "docid": "e68d4ff36d71100aaac04e08e0b2be29", "score": "0.58755344", "text": "function _init() {\n\t\t\tPage.setTitle(admin.title);\n\n\t\t\t_activate();\n\t\t}", "title": "" }, { "docid": "f7b6306c11a3f56bb48cb7862d84bf45", "score": "0.5875105", "text": "function createDashBoard(featureSet){\n\n\t\t\t\t//Runs only if the click/query has any results\n // => Won't start if user clicks outside the thematic map boundary or clicks between features\n if (featureSet.features.length > 0){\n //Temporarily assigns a class to the left panel that makes it disappear\n $(\"#leftPanel\").addClass(\"fadeOut\");\n \n //Assigns the query result to a global variable so we can use it in other functions as well\n actFeatureSet = featureSet;\n \n //If this was the first click switches to dashboard layout\n if (firstClick){\n firstClick = false;\n setLayout();\n }\n \n //Puts the clicked geometry on the map\n selectFeature(actFeatureSet.features[0]);\n \n //Gets the features of the current year\n searchCurrentYear(actFeatureSet);\n \n //Replaces the hint text with the current feature's name and the current year\n $(\"#placeYear\").html(actAreaName+ \" - \" + currYear);\n\n //Decides which charts will be needed in the dashboard\n chooseChart(0);\n }\t\t\t\n }", "title": "" }, { "docid": "aad7782b7311714d580f5e75b1413725", "score": "0.58577794", "text": "function startup() {\n\n\t\tloadDatabaseData();\n\t\t\n\t \t\n\t\t} //end of function", "title": "" }, { "docid": "e0f76371f17b988ceb7ef777ede52702", "score": "0.58494145", "text": "function initDashBoard(evt){\n\n\n //Gets the geometry on which the user clicked and gives it to the query as a parameter\n dataQuery.geometry = evt.mapPoint;\n //Runs the query using the geometry on which the user clicked and creates the dashboard\n dataQueryTask.execute(dataQuery, createDashBoard);\n }", "title": "" }, { "docid": "e5ae9090ff21b1d3c818fbacdd7fc020", "score": "0.5845446", "text": "function start() {\n\tapp.getView( {} ).render('terminal/ui');\n}", "title": "" }, { "docid": "a29e9c1ad6b8e44761502c74c7a8ffd2", "score": "0.58400136", "text": "function init(){\n\t\t//MBP.hideUrlBar();\n\n\t\tif(iScroll) $('body').addClass('iScrollEnabled');\n\n\t\t$LAB\n\t\t.script(on.path.js + 'app/views.js?' + on.env.v)\n\t\t.wait()\n\t\t.script(on.path.js + 'app/app.js?' + on.env.v)\n\t\t.wait(function(){console.log('1. app loaded')});\n\t}", "title": "" }, { "docid": "19c15402ddd37ca34ada1f1b135cea35", "score": "0.58281565", "text": "loadWelcomeProject() {\n if (self.projects().length === 0) {\n self.history.replace(`/remix/glitch-hello-node`);\n } else {\n self.history.replace(`/${self.projects()[0].domain()}`);\n }\n }", "title": "" }, { "docid": "e72214c3266e965faa95a4e1c6628b81", "score": "0.5827709", "text": "function start() {\r\n setOutput('start', stateConstants.START.START);\r\n}", "title": "" }, { "docid": "ad6392dc36195669543412ef5cd72f89", "score": "0.5820959", "text": "function initialPages($) {\n\t\tslidesModules();\n\t\tcheckedModules();\n\t\tonCheckHndlr();\n\t\tUpdateModule();\n\t}", "title": "" }, { "docid": "626915940d1d4a43b4a76168681918c1", "score": "0.5815158", "text": "function getReposDashboard() {\n getRepos(setDashboardInformation);\n // Setup UI from repository\n\t//setDashboardInformation(repository);\n\t\n}", "title": "" }, { "docid": "444d393381187b23e68801235bd44e5a", "score": "0.58108723", "text": "function start() {\n\n gw_job_process.UI();\n\n v_global.logic.proj_no = gw_com_api.getPageParameter(\"proj_no\");\n gw_com_api.setValue(\"frmOption\", 1, \"proj_no\", v_global.logic.proj_no);\n //gw_com_api.setValue(\"frmOption\", 1, \"proj_no\", \"SE16PE013\");\n\n processRetrieve({});\n\n }", "title": "" }, { "docid": "0e5f3002d5e72f65423523f40a2362b7", "score": "0.58042246", "text": "function initDashboardCharts() {\n\n /**\n * initialize dashboard components and widgets\n */\n\n //re-render activity-time-series\n //initDashboardActivityTimeline();\n reloadDashboardActivityTimeline();\n\n //re-render entity analytics\n reloadDashboardEntityEmail();\n //re-render topic analytics\n reloadDashboardTopicEmail()\n\n //re-render domain analytics\n reloadDashboardDomain();\n //re-render community analytics\n reloadDashboardCommunity();\n //re-render rank analytics\n reloadDashboardRankEmail();\n //re-render attachment-file analytics\n reloadDashboardFileTypeAttachment();\n\n}", "title": "" }, { "docid": "c7cdff84b9b141668cc50868954e4a43", "score": "0.5802931", "text": "function start() {\n // The firstScreen is opposite because screenChooser.switchScreens swaps it.\n // Main Screen\n \"use strict\";\n \n if (scormHandler.exists()) {\n var currentHours = scormHandler.getCurrentHours(),\n totalHours = scormHandler.getTotalHours(),\n percentage = currentHours / totalHours;\n \n entryHandler.setEntries(scormHandler.getEntries());\n entryHandler.displayEntries();\n \n if (percentage === null || percentage === undefined || isNaN(percentage)) {\n percentage = 0;\n }\n \n progressMap.startup(\"map\", percentage);\n \n screenChooser.setFirstScreen(true);\n } else {\n screenChooser.setFirstScreen(false);\n }\n \n screenChooser.switchScreens();\n}", "title": "" }, { "docid": "608b256dcceab8fc2534f1d00241338d", "score": "0.5800482", "text": "function createProject() {\n TaskService.CreateProjectModal();\n }", "title": "" }, { "docid": "95eab20517b30012157b5d9d66650735", "score": "0.57999694", "text": "function start() {\n\n gw_job_process.UI();\n gw_job_process.procedure();\n //----------\n gw_com_module.startPage();\n\n }", "title": "" }, { "docid": "3e26053f7fb6be64f95a86d49df0c016", "score": "0.57994413", "text": "function dashboardPage(){\r\n var dashBoard = new dashBoardView();\r\n}", "title": "" }, { "docid": "f63687a7a5b2cecf3e2cf00c94886aa7", "score": "0.57921875", "text": "start()\n {\n\n console.log(this.title + \" starting.\\n\");\n }", "title": "" }, { "docid": "6214a388afe8e7d74eff7c3d6b9c2b07", "score": "0.5785609", "text": "function Project() {\n }", "title": "" }, { "docid": "affdae093a8da507199a1ed6e7858e81", "score": "0.57663774", "text": "start() {\n\n\t}", "title": "" }, { "docid": "1a71ecdbf8d8cfaa37829047040ddece", "score": "0.576597", "text": "function main() {\n selectedCategories = [];\n fetchAllResources();\n const queryBtn = id(\"query-btn\");\n queryBtn.addEventListener(\"click\", searchByName);\n const updateResourceBtn = id(\"update-resource-btn\");\n updateResourceBtn.addEventListener(\"click\", submitResourceUpdate);\n $(function () {\n $('[data-toggle=\"tooltip\"]').tooltip();\n });\n $(function () {\n $('#expire-picker').datetimepicker({\n format: 'YYYY-MM-DD'\n });\n });\n fetchCategories();\n }", "title": "" }, { "docid": "3517733df8681db9db57a9996193e430", "score": "0.5762589", "text": "startProd() {\n this.forestFires();\n this.checkNewCoronaReports();\n this.checkUpdatesCoronaReports();\n this.warnings();\n this.fireRisk();\n this.getTweets();\n this.getFacebookPosts();\n this.sendWeatherReport();\n this.checkNewDecrees();\n Jobs.clearDecreesDb();\n Jobs.warningsMeteoAlarm();\n Jobs.clearMeteoAlarmDb();\n Jobs.scheduleVostEuTweets();\n Jobs.checkMedeaMessages();\n }", "title": "" }, { "docid": "94c8d08a8b4f5948cf988e6619afaed2", "score": "0.57624143", "text": "_start() {\n\n this._menuView = new MenuView(\n document.getElementsByClassName('menu-view')[0],\n this.config\n );\n\n for (var key in this.config) {\n this.DEFAULT_SKETCH = key;\n break;\n }\n\n this._setupScroll();\n this._setupWindow();\n this._onHashChange();\n }", "title": "" }, { "docid": "f8e141856a74a2d6b6e1a87aee2afd96", "score": "0.57560706", "text": "function main(body) {\n loggedIn(function() {\n $.loadCSS('static/css/index.css');\n buildTemplate();\n buildHome();\n });\n}", "title": "" }, { "docid": "a7533ca1f93956140fc63c5e3a228e79", "score": "0.57542485", "text": "function startPage() {\n showPastEvents();\n // Functions reliant on DOM elements must be sent to the bottom of the call stack when not using the document.onReady function or similar\n setTimeout(() => { \n getStatusFromQstring();\n setDatePickerToToday(); \n watchUploadSubmit(); \n }, 0);\n}", "title": "" }, { "docid": "5ce3df2f003f8df349a03135342ff187", "score": "0.575386", "text": "function build(){\n\t//Concatinating and minifying all common js files and libraries\n\tfileUtils.concatJs({\n\t\tsrc:[\n\t\t\tWORKPATH+\"assets/js/jquery.js\",\t\t\t\n\t\t\tWORKPATH+\"assets/js/bootstrap.js\",\t\t\t\n\t\t\tWORKPATH+\"assets/js/modalBox.js\",\n\t\t\tWORKPATH+\"assets/js/contextMenu.js\",\n\t\t\tWORKPATH+\"assets/js/base.js\"\n\t\t],\n\t\tdest:BUILDPATH+\"assets/js/base.js\",\n\t\tminify:globalSetting.minify\n\t},\n\t//to copy other js files and minify them(page specifi js files)\n\t{\n\t\tsrc:[\n\t\t\tWORKPATH+\"assets/js/home.js\",\n\t\t],\n\t\tdest:BUILDPATH+\"assets/js/home.js\",\n\t\tminify:globalSetting.minify\n\t},\n\t//for other project page\n\t{\n\t\tsrc:[\n\t\t\tWORKPATH+\"assets/js/projects.js\",\n\t\t],\n\t\tdest:BUILDPATH+\"assets/js/projects.js\",\n\t\tminify:globalSetting.minify\n\t});\n\t\n\t\n\n\n\n\tvar projectsData= JSON.parse(fileUtils.getData(WORKPATH+\"data/projects.json\"));\n\t\n\t//to create layouts\n\t//create index page\n\tlayoutUtil.compile({\n\t\t\tlayout:{\n\t\t\t\t\tbody:WORKPATH+\"home.html\",\n\t\t\t\t\tpageScripts:WORKPATH+\"includes/homeScript.html\",\n\t\t\t\t},\n\t\t\ttemplateData:{\n\t\t\t\ttitle:\"Demo project\",\n\t\t\t\tactive:\"Home\",\n\t\t\t\tpageCss:\"assets/css/home.css\"\n\t\t\t},\n\t\t\tsrc :WORKPATH+\"layout.html\",\n\t\t\tdest:BUILDPATH+\"index.html\",\n\t\t\textend: \"baseLayout\"\n\t\t},\n\t//create projects page\n\t\t{\n\t\t\tlayout:{\n\t\t\t\t\tbody:WORKPATH+\"projects.html\",\n\t\t\t\t\tpageScripts:WORKPATH+\"includes/homeScript.html\",\n\t\t\t\t},\n\t\t\ttemplateData:{\n\t\t\t\ttitle:\"Other projects\",\n\t\t\t\tprojects:projectsData.projects,\n\t\t\t\tactive:\"Other\",\n\t\t\t\tpageCss:\"assets/css/project.css\"\n\t\t\t},\n\t\t\tsrc :WORKPATH+\"layout.html\",\n\t\t\tdest:BUILDPATH+\"project.html\",\n\t\t\textend: \"baseLayout\"\n\t\t},\t\t\n\t//create page1\n\t\t{\n\t\t\tlayout:{\n\t\t\t\t\tbody:WORKPATH+\"page1.html\"\n\t\t\t\t},\n\t\t\ttemplateData:{\n\t\t\t\ttitle:\"Demo page\",\n\t\t\t\tactive:\"Page1\"\n\t\t\t},\n\t\t\tsrc :WORKPATH+\"layout.html\",\n\t\t\tdest:BUILDPATH+\"page1.html\",\n\t\t\textend: \"baseLayout\"\n\t\t},\t\t\n\t//create page2\n\t\t{\n\t\t\tlayout:{\n\t\t\t\t\tbody:WORKPATH+\"page2.html\"\n\t\t\t\t},\n\t\t\ttemplateData:{\n\t\t\t\ttitle:\"Demo page2\",\n\t\t\t\tactive:\"Page2\"\n\t\t\t},\n\t\t\tsrc :WORKPATH+\"layout.html\",\n\t\t\tdest:BUILDPATH+\"page2.html\",\n\t\t\textend: \"baseLayout\"\n\t\t});\n\t\n\n\t//function to copy file\n\t//function to copy all images \n\t\n\tfileUtils.copy({\n\t\t\tsrcFolder:WORKPATH+\"assets/images\",\n\t\t\tdestFolder:BUILDPATH+\"assets/images\"\n\t\t});\n\t\n\n\t\n\t//to create css files from less files\n\tlessUtils.compile(\n\t\t//compile common less to css\n\t\t{\n\t\t\tsrc:WORKPATH+\"assets/less/base.less\",\n\t\t\tdest:BUILDPATH+\"assets/css/base.css\",\n\t\t\tminify:globalSetting.minify\n\t\t},\n\t\t//compile page specific less to css\n\t\t{\n\t\t\tsrc:WORKPATH+\"assets/less/home.less\",\n\t\t\tdest:BUILDPATH+\"assets/css/home.css\",\n\t\t\tminify:globalSetting.minify\n\t\t},\n\t\t{\n\t\t\tsrc:WORKPATH+\"assets/less/project.less\",\n\t\t\tdest:BUILDPATH+\"assets/css/project.css\",\n\t\t\tminify:globalSetting.minify\n\t\t}\n\t\t);\n\t\n}", "title": "" }, { "docid": "d6961d0b0da45ec398eff9125cd7fd8d", "score": "0.5748773", "text": "constructor() {\n super();\n this.configDarkTheme();\n this.runDataTable();\n this.createData();\n this.refresh();\n }", "title": "" }, { "docid": "9cf911d1abcf7151da8ae5953af78bb8", "score": "0.57465094", "text": "function start() {\n\n gw_job_process.UI();\n gw_job_process.procedure();\n //----------\n gw_com_module.startPage();\n //----------\n }", "title": "" }, { "docid": "7fd781225bd8f1fdb2bd9029e7d1f720", "score": "0.5746207", "text": "function LoadAccountDashboard() {\n\n}", "title": "" }, { "docid": "0de8a6ebdd9363958e63b27ba031c0b8", "score": "0.57458586", "text": "function init() {\n // document.querySelectorAll(\"[data-swup-transition='project']\").forEach(link => new HoverImgF(link));\n\n\n document.querySelectorAll('[data-swup-preload]').forEach(link => {\n const url = link.getAttribute(\"href\");\n swup.preloadPage(url);\n })\n\n ScrollTrigger.refresh();\n\n lastScrollTop = 0;\n\n if (projectLink != null) {\n gsap.to(projectLink, 0.5, {\n alpha: 0,\n delay: 0.5,\n onComplete: () => {\n projectLink.remove();\n enableBodyScroll();\n }\n })\n } else {\n enableBodyScroll();\n }\n menu.showBar();\n}", "title": "" }, { "docid": "c08ba69c12ee1dd542fe26dc4f60d3d4", "score": "0.57419914", "text": "function prepareDashboard() {\r\n//dashboard body div is created here\r\n $(\"#dashboard-body\").remove();\r\n $(\"#mainPanelDiv\").append(\"<div class='contentpanel' id='dashboard-body' />\");\r\n// prepareCharts();\r\n\r\n//\r\n// prepareCommonPrivileges();\r\n// prepareUserManagement();\r\n// preparePatientManagement();\r\n// preparePhysicianPreference();\r\n// getOrgPreferences();\r\n\r\n}", "title": "" }, { "docid": "0d6f2b7dcdd7bbd7432b10fb7d1926e2", "score": "0.5738784", "text": "function startUI(rootstxx) {\n\tUIContext = new CIQ.UI.Context(\n\t\trootstxx,\n\t\tdocument.querySelector(\"#chart-grid[cq-context]\")\n\t);\n\tUILayout = new CIQ.UI.Layout(UIContext);\n\tUIContext.advertiseAs(chartLinker, \"Linker\");\n\tUIContext.advertiseAs({ changeTheme }, \"Theme\");\n\t// Inject linker functions into global UI web components\n\tif (firstRun) {\n\t\tfirstRun = false;\n\t\tlet linkerFeatureInjector = new LinkerFeatureInjector();\n\t\tlinkerFeatureInjector.injectStudyMenuRenderer();\n\t\tlinkerFeatureInjector.injectStudyUpdate();\n\t\tlinkerFeatureInjector.injectStudyLegendRenderer();\n\t}\n\t// StudyEdit\n\tUIStudyEdit = new CIQ.UI.StudyEdit(null, UIContext);\n\t// Study Legend\n\tdocument.querySelector(\".header cq-study-legend\").begin();\n\t// Custom Themes\n\tUIStorage = new CIQ.NameValueStore();\n\tUIThemes = document.querySelector(\"cq-themes\");\n\tif (UIThemes)\n\t\tUIThemes.initialize({\n\t\t\tbuiltInThemes: { \"ciq-day\": \"Day\", \"ciq-night\": \"Night\" },\n\t\t\tdefaultTheme: \"ciq-night\",\n\t\t\tnameValueStore: UIStorage\n\t\t});\n\t//Crosshair Toggle\n\tdocument.querySelector(\".header .ciq-CH\").registerCallback(function (value) {\n\t\tvalue = value || false;\n\t\tchartLinker.showCrosshair(value);\n\t\tif (value !== false) this.node.addClass(\"active\");\n\t\telse this.node.removeClass(\"active\");\n\t});\n\t//Symbol Lookup\n\t// Create a custom lookup driver to limit the available exchanges to those with NYSE compatible hours\n\tCIQ.ChartEngine.Driver.Lookup.ChartIQ = function (exchanges) {\n\t\tthis.exchanges = [\"XNYS\", \"XASE\", \"XNAS\", \"XASX\", \"ARCX\"];\n\t\tthis.url =\n\t\t\t\"https://symbols.chartiq.com/chiq.symbolserver.SymbolLookup.service\";\n\t\tthis.requestCounter = 0; //used to invalidate old requests\n\t};\n\t//Inherits all of the base Look Driver's properties via `CIQ.inheritsFrom()`\n\tCIQ.inheritsFrom(\n\t\tCIQ.ChartEngine.Driver.Lookup.ChartIQ,\n\t\tCIQ.ChartEngine.Driver.Lookup\n\t);\n\tCIQ.ChartEngine.Driver.Lookup.ChartIQ.prototype.acceptText = function (\n\t\ttext,\n\t\tfilter,\n\t\tmaxResults,\n\t\tcb\n\t) {\n\t\tif (filter == \"FX\") filter = \"FOREX\";\n\t\tif (isNaN(parseInt(maxResults, 10))) maxResults = 100;\n\t\tlet url =\n\t\t\tthis.url + \"?t=\" + encodeURIComponent(text) + \"&m=\" + maxResults + \"&x=[\";\n\t\tif (this.exchanges) {\n\t\t\turl += this.exchanges.join(\",\");\n\t\t}\n\t\turl += \"]\";\n\t\tif (filter && filter.toUpperCase() != \"ALL\") {\n\t\t\turl += \"&e=\" + filter;\n\t\t}\n\t\tlet counter = ++this.requestCounter;\n\t\tlet self = this;\n\t\tfunction handleResponse(status, response) {\n\t\t\tif (counter < self.requestCounter) return;\n\t\t\tif (status != 200) return;\n\t\t\ttry {\n\t\t\t\tresponse = JSON.parse(response);\n\t\t\t\tlet symbols = response.payload.symbols;\n\t\t\t\tlet results = [];\n\t\t\t\tfor (let i = 0; i < symbols.length; i++) {\n\t\t\t\t\tlet fields = symbols[i].split(\"|\");\n\t\t\t\t\tlet item = {\n\t\t\t\t\t\tsymbol: fields[0],\n\t\t\t\t\t\tname: fields[1],\n\t\t\t\t\t\texchDisp: fields[2]\n\t\t\t\t\t};\n\t\t\t\t\tresults.push({\n\t\t\t\t\t\tdisplay: [item.symbol, item.name, item.exchDisp],\n\t\t\t\t\t\tdata: item\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tcb(results);\n\t\t\t} catch (e) {}\n\t\t}\n\t\tCIQ.postAjax({ url: url, cb: handleResponse });\n\t};\n\tUIContext.setLookupDriver(new CIQ.ChartEngine.Driver.Lookup.ChartIQ());\n\tUIContext.UISymbolLookup = document.querySelector(\".ciq-search cq-lookup\");\n\tif (UIContext.UISymbolLookup)\n\t\tUIContext.UISymbolLookup.setCallback(function (data) {\n\t\t\tlet targetSymbol = data.symbol || false;\n\t\t\tif (targetSymbol) {\n\t\t\t\t// Get the market name for the target symbol\n\t\t\t\tlet symbolData = CIQ.Market.Symbology.factory({ symbol: targetSymbol });\n\t\t\t\t// Restrict symbols to markets with compatible hours\n\t\t\t\tif (symbolData.name === activeMarket) {\n\t\t\t\t\t// If there's only one chart, there's no need to select it\n\t\t\t\t\tif (chartLinker.charts.size === 1) {\n\t\t\t\t\t\tdocument.getElementById(\"chart0\").context.changeSymbol(data);\n\t\t\t\t\t} else if (activeChart) {\n\t\t\t\t\t\tactiveChart.context.changeSymbol(data);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tCIQ.alert(\n\t\t\t\t\t\t\t\"To set a chart symbol, first click on a chart to select.\"\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tCIQ.alert(\n\t\t\t\t\t\t\"The symbol \" +\n\t\t\t\t\t\t\ttargetSymbol +\n\t\t\t\t\t\t\t\" in market \" +\n\t\t\t\t\t\t\tsymbolData.name +\n\t\t\t\t\t\t\t\" does not share the same hours as the current grid.\"\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\trestoreSettings();\n\tchartLinker.setUI(UIContext, UILayout);\n\tCIQ.UI.begin();\n}", "title": "" }, { "docid": "08ca53c87005ae786ced107aea7681d3", "score": "0.57255304", "text": "function setUpUI() {\n\t\t\n\t\t//Things to do once everything else has loaded\n\t\t\n\t\t\n\t\t\n\t}", "title": "" }, { "docid": "96003c9f9789da40d46d5b61c5a47fba", "score": "0.5716765", "text": "initGui() {\n // GUI\n this.gui = new Dat.GUI();\n //this.gui.add(appConfig, 'debug');\n }", "title": "" } ]
d681ffb66b49463e682519c2d63b3c3e
Get year and index of month this method passed to: CalendarMarkup.js and CalendarNotes.js it's allowing us to get valid year and month from calendar attributes (datamonth and datayear)
[ { "docid": "71cb2d45539d6aed2e9c5369cfa5e71d", "score": "0.7797682", "text": "monthYear(key) {\n const monthYear = {\n \"monthIndex\": this.getCalendar.getAttribute(\"data-month\"),\n \"yearIndex\": this.getCalendar.getAttribute(\"data-year\")\n }\n return monthYear[key];\n }", "title": "" } ]
[ { "docid": "2b02822a6662cfb331ffc791596b92dc", "score": "0.6891387", "text": "function extract_year_month()\n{\n\tconsole.log(\"******** step 0 ********** \");\n\tconsole.log(\"Entering extract_year_month\");\n\n\tconsole.log(v_year + '#' +v_month);\n\tgenerate_dates(v_year,v_month);\n}", "title": "" }, { "docid": "64c0239e3f1cceb09cde19e67840bfdd", "score": "0.6800063", "text": "ssaBirthMonth() {\n return this.ssaBirthdate().monthIndex();\n }", "title": "" }, { "docid": "e24d53ea7232bfa420ed32fccd614f84", "score": "0.6646831", "text": "function get_month_year(date) {\n return {\n month: date.substring(\"2016-\".length, \"2016-10\".length),\n year: date.substring(\"\".length, \"2016\".length)\n }\n}", "title": "" }, { "docid": "0d31e47b84cf13f4934884c2b6da6644", "score": "0.6493545", "text": "monthIndex() {\n\t return this.month - 1;\n\t }", "title": "" }, { "docid": "cd7a06a1b3533b1b7d3abf758bf52171", "score": "0.64381534", "text": "function GetMonthIndex(mon)\r\n{\r\n\tif(mon==\"Jan\")\r\n\t\treturn 0;\r\n\telse if(mon==\"Feb\")\r\n\t\treturn 1;\r\n\telse if(mon==\"Mar\")\r\n\t\treturn 2;\r\n\telse if(mon==\"Apr\")\r\n\t\treturn 3;\r\n\telse if(mon==\"May\")\r\n\t\treturn 4;\r\n\telse if(mon==\"Jun\")\r\n\t\treturn 5;\r\n\telse if(mon==\"Jul\")\r\n\t\treturn 6;\r\n\telse if(mon==\"Aug\")\r\n\t\treturn 7;\r\n\telse if(mon==\"Sep\")\r\n\t\treturn 8;\r\n\telse if(mon==\"Oct\")\r\n\t\treturn 9;\r\n\telse if(mon==\"Nov\")\r\n\t\treturn 10;\r\n\telse if(mon==\"Dec\")\r\n\t\treturn 11;\r\n}", "title": "" }, { "docid": "98f36b6dd0d4d21e1f1122879c45ee03", "score": "0.628184", "text": "monthsForYear(yearNum) {\n var year = moment(''+yearNum, 'YYYY'); // using ''+yearNum to coerce int to string.\n return range(12).map(index => {\n return year.clone().add(index, 'month');\n });\n }", "title": "" }, { "docid": "266853ad8b97a545bf04735ee61a3eed", "score": "0.6168741", "text": "months() {\n\t return _monthLabels.map((ml, i) => ({\n\t label: ml,\n\t label_1: ml.substring(0, 1),\n\t label_2: ml.substring(0, 2),\n\t label_3: ml.substring(0, 3),\n\t number: i + 1,\n\t }));\n\t }", "title": "" }, { "docid": "b5dada326b75ff730157ec7344b880d0", "score": "0.6150284", "text": "function Calendar.getCurrentYear() {\n\treturn this.year;\n}", "title": "" }, { "docid": "37e02cc5a568965569cdbfac65e1448c", "score": "0.6112027", "text": "get year() { return this.backbone.getUTCFullYear() }", "title": "" }, { "docid": "49dcb7d3c454dcaf11a668bb6a54145a", "score": "0.6098214", "text": "function get_month(index){\n\tswitch (index)\n\t{\n\t\tcase 1: return \"JAN\";\n\t\tcase 2: return \"FEB\";\n\t\tcase 3: return \"MAR\";\n\t\tcase 4: return \"APR\";\n\t\tcase 5: return \"MAY\";\n\t\tcase 6: return \"JUN\";\n\t\tcase 7: return \"JUL\";\n\t\tcase 8: return \"AUG\";\n\t\tcase 9: return \"SEP\";\n\t\tcase 10: return \"OCT\";\n\t\tcase 11: return \"NOV\";\n\t\tcase 12: return \"DEC\";\t\t\t\t\t\t\t\t\n\t}\n\treturn \"\";\n}", "title": "" }, { "docid": "8669ae250be4e957c485dbd86482931e", "score": "0.6077994", "text": "get monthView() {\n const view = RenderView.MONTH;\n const currentYear = toDateSegment(this.view).year;\n const columnCount = MONTH_VIEW.columnCount;\n const monthCount = 12;\n const totalCount = MONTH_VIEW.totalCount;\n const monthsNames = this.monthsNames;\n const before = (totalCount - monthCount) / 2;\n const startIdx = monthCount - before % monthCount;\n const after = before + monthCount;\n const months = [];\n const rows = [];\n let cell;\n let cells = [];\n for (let i = 0; i < totalCount; i += 1) {\n if (i % columnCount === 0) {\n cells = [];\n rows.push({\n cells\n });\n }\n const month = (startIdx + i) % monthCount; /* 0 for Jan, 11 for Dev */\n const year = currentYear + Math.floor((i - before) / monthCount);\n const segment = { year, month, day: 1 };\n const value = utcFormat(segment, DateFormat.yyyyMMdd);\n const idle = i < before || i >= after;\n cell = Object.assign({ view, text: monthsNames[month], value: utcFormat(segment, DateFormat.yyyyMM), idle, now: isThisMonth(value) }, this.getCellSelection(value, isSameMonth));\n cells.push(cell);\n months.push(cell);\n }\n months[0].firstDate = true;\n months[months.length - 1].lastDate = true;\n return html `${this.renderRows(rows)}`;\n }", "title": "" }, { "docid": "5537feea4dd58c80b427f62a40e55236", "score": "0.607364", "text": "function getMonth(month) {\n \tif(typeof(month) !== 'number') {\n\t\tthrow new Error('Invalid Input');\n\t}\n\n\tif((month < 1) || (month > 12)) {\n\t\tthrow new Error('Invalid Input');\n\t}\n\n \tvar monthsOfYear = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];\n \treturn monthsOfYear[month - 1];\n\n }", "title": "" }, { "docid": "0124ed588fd2b573c4fe0e1f09c5aeeb", "score": "0.60687304", "text": "function getYearForMonth(passedMonthName) {\n const monthNames = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n ];\n let monthInt, year;\n monthNames.map((monthName, i) => {\n if (passedMonthName == monthName) {\n monthInt = i + 1;\n if (i >= new Date().getMonth()) {\n year = new Date().getFullYear();\n } else {\n year = new Date().getFullYear() + 1;\n }\n }\n });\n return [monthInt, year];\n}", "title": "" }, { "docid": "cfe64fde1d0ceb5b9a2f38ac08a108a1", "score": "0.60658586", "text": "function monthYear(number) {\n const start = contract.start_date\n const year = getYear(parseISO(start))\n const month = (getMonth(parseISO(start)) + number)\n console.tron.log(years)\n let monthWord;\n let newmonth = month;\n let newyear = year;\n let stringyear;\n let concatyear;\n let parsedconcatyear = parseISO(start);\n\n if (month > 11) {\n newmonth = month - 12;\n newyear = year + 1;\n stringyear = JSON.stringify(newyear);\n concatyear = stringyear.concat('-10-10');\n parsedconcatyear = parseISO(concatyear);\n console.tron.log(parsedconcatyear)\n }\n if (month > 23) {\n newmonth = month - 23;\n newyear = year + 2;\n }\n if (newmonth == 0) {\n monthWord = 'Jan'\n } else if (newmonth == 1) {\n monthWord = 'Fev'\n } else if (newmonth == 2) {\n monthWord = 'Mar'\n } else if (newmonth == 3) {\n monthWord = 'Abr'\n } else if (newmonth == 4) {\n monthWord = 'Maio'\n } else if (newmonth == 5) {\n monthWord = 'Jun'\n } else if (newmonth == 6) {\n monthWord = 'Jul'\n } else if (newmonth == 7) {\n monthWord = 'Ago'\n } else if (newmonth == 8) {\n monthWord = 'Set'\n } else if (newmonth == 9) {\n monthWord = 'Out'\n } else if (newmonth == 10) {\n monthWord = 'Nov'\n } else if (newmonth == 11) {\n monthWord = 'Dez'\n }\n\n return [String(`${monthWord} / ${newyear}`), parsedconcatyear ]\n }", "title": "" }, { "docid": "1126e677f572b789f48d616be312a46e", "score": "0.60468954", "text": "birthMonth() {\n // +1 becuase getMonth is zero indexed\n return this.dob.getMonth() + 1;\n }", "title": "" }, { "docid": "d82a14e747eb0f85f91e477736bb1585", "score": "0.6008877", "text": "layBirthMonth() {\n return this.birthdate_.getMonth();\n }", "title": "" }, { "docid": "f9d77e5bf6dd4af2921b3c4276a8e5ce", "score": "0.5986675", "text": "get month() {\n return this.date.getMonth();\n }", "title": "" }, { "docid": "925c0e402837280c37c3d354a1c2a917", "score": "0.5967586", "text": "function getYear(d){\n return d.Year.getFullYear();\n }", "title": "" }, { "docid": "c4467f74dedfbe9dc593011504be26a4", "score": "0.5956678", "text": "function getYear() {\n var now = parseInt(moment().format('YYYY'));\n return now;\n }", "title": "" }, { "docid": "1c60437ca81e60b1c5f17f9f559594bb", "score": "0.5954546", "text": "daysInMonth(year=this._year, month=this._month){ \n return new Date(year, month, 0).getDate();\n }", "title": "" }, { "docid": "326661e716465ce1ad4aeaf67ded7f99", "score": "0.5949826", "text": "function date(d){ return d.year; }", "title": "" }, { "docid": "59f71792fe04646949079182bb4e0f58", "score": "0.5908977", "text": "get year() {\n return this.date.getFullYear();\n }", "title": "" }, { "docid": "5a74db92f5304609e4ff720b7995d5e1", "score": "0.5897638", "text": "header() {\n\t const month = this.months[this.monthIndex];\n\t return {\n\t month,\n\t year: this.year.toString(),\n\t shortYear: this.year.toString().substring(2, 4),\n\t label: month.label + ' ' + this.year,\n\t };\n\t }", "title": "" }, { "docid": "376230797b8a170d7b6f46b40955213d", "score": "0.5894036", "text": "function getValidMonth(){\r\n\treturn 4;\r\n}", "title": "" }, { "docid": "0b4e4e38496f757fd5a0caaf8f217400", "score": "0.5892317", "text": "function from_yyyymm(yyyymm) { return {\n p: parseInt(yyyymm.split(\"-\")[1], 10),\n y: parseInt(yyyymm.split(\"-\")[0], 10)\n }}", "title": "" }, { "docid": "b64ac0eee905ba7981a4cb9b259fdfff", "score": "0.5885471", "text": "get month() { return this.backbone.getUTCMonth() }", "title": "" }, { "docid": "deaafb5fa41dfe04f320e2426e7fcf23", "score": "0.58831924", "text": "getYear() {\r\n return this._today.getFullYear();\r\n }", "title": "" }, { "docid": "c84d69dad151cd2e0adc30abfe461e7e", "score": "0.58454853", "text": "function year(d) {\n\n return $app.x(d.year);\n }", "title": "" }, { "docid": "1749e962b587ee35eba557512d336322", "score": "0.58449215", "text": "function loadMonth(month, year) {\r\n currentMonth = month;\r\n currentYear = year;\r\n \r\n clearCalendar();\r\n buildCalendar(month, year);\r\n}", "title": "" }, { "docid": "76e164d005ef2e5347e8a1f1607de34f", "score": "0.58328503", "text": "getMonthAndYear(time) {\n let date = new Date(time);\n return {\n year: date.getFullYear(),\n month: date.getMonth()\n }\n }", "title": "" }, { "docid": "c8b99d584ad5c2ab793fa14eae7c95b1", "score": "0.5831558", "text": "function getCurrentMonth() {\n appendTitle();\n return getDaysInMonth(map.month, map.year)\n}", "title": "" }, { "docid": "f1700c30492ea1e9fd448bc73f173e9b", "score": "0.58216035", "text": "getDate(dateStr) {\n const currentYear = new Date().getFullYear()\n const released = new Date(dateStr);\n const year = released.getFullYear()\n const month = released.getMonth()\n \n return (year == currentYear) ? config.monthNames[month] : year\n }", "title": "" }, { "docid": "6a8a5ee859147c43da9016684fd7a238", "score": "0.5815752", "text": "get yearView() {\n const view = RenderView.YEAR;\n const currentYear = toDateSegment(this.view).year;\n const startIdx = Math.floor(currentYear / YEARS_PER_YEAR_VIEW) * YEARS_PER_YEAR_VIEW;\n const years = [];\n const rows = [];\n let cells = [];\n let cell;\n for (let i = 0; i < YEAR_VIEW.totalCount; i += 1) {\n if (i % YEAR_VIEW.columnCount === 0) {\n cells = [];\n rows.push({\n cells\n });\n }\n const year = startIdx + i;\n const value = utcFormat({ year, month: 0, day: 1 }, DateFormat.yyyyMMdd);\n cell = Object.assign({ view, text: year > 0 ? `${year}` : year === 0 ? '1' : `${Math.abs(year - 1)}`, value: `${year}`, now: isThisYear(value) }, this.getCellSelection(value, isSameYear));\n cells.push(cell);\n years.push(cell);\n }\n years[0].firstDate = true;\n years[years.length - 1].lastDate = true;\n return html `${this.renderRows(rows)}`;\n }", "title": "" }, { "docid": "3398aabd846fb0af048a0d60e5583665", "score": "0.5810006", "text": "function get_year(params) {\n var d = get_date(params);\n var matches = d.match(/([0-9]{4})/);\n if (matches && matches.length > 0) {\n return matches[1];\n } else {\n var year = $('#sfx_year').text();\n if (year) {\n return year;\n } else {\n return '';\n }\n }\n }", "title": "" }, { "docid": "049295c9d359d95d424c91f22ae6d982", "score": "0.58060235", "text": "getMonthComps(month, year) {\n const key = `${month}-${year}`;\n let comps = this.monthData[key];\n\n if (!comps) {\n const inLeapYear = year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;\n const firstWeekday = new Date(year, month - 1, 1).getDay() + 1;\n const days = month === 2 && inLeapYear ? 29 : daysInMonths[month - 1];\n const weeks = Math.ceil((days + Math.abs(firstWeekday - this.firstDayOfWeek)) / daysInWeek);\n comps = {\n firstDayOfWeek: this.firstDayOfWeek,\n inLeapYear,\n firstWeekday,\n days,\n weeks,\n month,\n year\n };\n this.monthData[key] = comps;\n }\n\n return comps;\n }", "title": "" }, { "docid": "4979c47834748dd5a4103bf070d7e0ee", "score": "0.5803752", "text": "function dagenInMaand(month, year) {\n return new Date(year, month, 0).getDate();\n }", "title": "" }, { "docid": "e0c5a234a5597335fe6cdf84727849a4", "score": "0.58015925", "text": "function setMonthAndYear() {\n const monthsList = [\n \"Januari\",\n \"Februari\",\n \"Mars\",\n \"April\",\n \"Maj\",\n \"Juni\",\n \"Juli\",\n \"Augusti\",\n \"September\",\n \"Oktober\",\n \"November\",\n \"December\",\n ];\n\n const monthText = document.getElementById(\"currentMonth\").innerText;\n const month = monthsList.indexOf(monthText) + 1;\n const year = document.getElementById(\"currentYear\").innerText;\n\n getHolidaysAPI(month, year);\n}", "title": "" }, { "docid": "a49cd803789da60a0885e69889194849", "score": "0.57689846", "text": "function print_year_and_month(date_year, date_month) {\n const date = date_object(date_year, date_month);\n document.getElementById(\"year_title\").innerText = date.year;\n document.getElementById(\"month_title\").innerText = date.month_name;\n}", "title": "" }, { "docid": "9998cbacbb233d4ff9fd840bd365874e", "score": "0.5763348", "text": "function getDaysinMonth()\r\n {\t\t\r\n\t\treturn 32 - new Date(year, month, 32).getDate();\r\n\r\n }", "title": "" }, { "docid": "6c9347c9386f12ae762b6c9c8b1c974e", "score": "0.5741123", "text": "getReferenceMonth() {\n\n let year = this.props.year ? this.props.year : moment().format('YYYY');\n let month = this.props.month ? this.props.month : moment().format('MM');\n\n return moment(year + month + '01', 'YYYYMMDD');\n }", "title": "" }, { "docid": "ba579b79aadb84fb26ae9f09fb4a0149", "score": "0.5740399", "text": "function Calendar.getCurrentMonth() {\n\treturn this.month;\n}", "title": "" }, { "docid": "0a0746ba60fbd632961415428d3800d5", "score": "0.5723234", "text": "dateHelper(mo, yr) {\n var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\n return (months[mo - 1] + '-' + yr);\n }", "title": "" }, { "docid": "c9bf28fa1503a332a62d86e5222ce8bc", "score": "0.5698797", "text": "function getYear(date){\r\n\tvar year = date.substr(0, 4);\r\n return year;\r\n}", "title": "" }, { "docid": "ec2fefc4079b3332cf10dc3d35236165", "score": "0.56886417", "text": "function get_month(params) {\n var month_array = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];\n var month_index = $('#sfx_month').text();\n if (month_index) {\n return month_array[parseInt(month_index) - 1];\n }\n return ''; \n }", "title": "" }, { "docid": "840e2ac9534b321834ff1e779913b3ad", "score": "0.56838816", "text": "function setDate(month,year){\n curr_month = month;\n fullyear = year;\n}", "title": "" }, { "docid": "d27ff9b7a387047a45908ffc6e98f3b4", "score": "0.5657439", "text": "function createYearCD(cdMonth, cdDay, cdYear)\r\n{\r\n\tthis.formatter = new CalendarFormatter();\r\n\t\r\n\tvar r;\r\n\tvar c;\r\n\tvar incr = 0;\r\n\t\r\n\tthis.formatter.setupCalendarYear();\r\n\t\r\n\tfor (r=0; r<3; r++)\r\n\t{\r\n\t\tthis.formatter.startRow();\r\n\t\t\r\n\t\tfor (c=0; c<4; c++)\r\n\t\t{\r\n\t\t\tthis.formatter.startColumn();\r\n\t\t\tvar dd = (cdMonth == incr) ? cdDay : NO_DAY_CALENDAR;\r\n\t\t\tthis.createMonthInternal(incr, dd, cdYear);\r\n\t\t\tthis.formatter.endColumn();\r\n\t\t\tincr++;\r\n\t\t}\r\n\t\t\r\n\t\tthis.formatter.endRow();\r\n\t}\r\n\t\r\n\tthis.formatter.concludeCalendarYear();\r\n\t\r\n\tif (this.openIsOn)\r\n\t{\r\n\t\t// setup navigation\r\n\t\tvar prefixFormatter = new CalendarFormatter();\r\n\t\tif (this.navigationIsOn && !this.errorThrown)\r\n\t\t{\r\n\t\t\tvar aYear = this.yearValidated;\r\n\t\t\tprefixFormatter.addNavigationYear(aYear, this.name);\r\n\t\t}\r\n\t\r\n\t\tvar settings = \"scrollbars=yes,menubar=yes,resizable=yes,width=\" + this.windowWidthYear + \",height=\" + this.windowHeightYear;\r\n\t\tvar calendarWindowYear = window.open(\"\",\"CalendarWindowYear\", settings);\r\n\t\tcalendarWindowYear.document.open();\r\n\t\tcalendarWindowYear.document.writeln(\"<HTML><HEAD><TITLE>Calendar</TITLE></HEAD>\");\r\n\t\tcalendarWindowYear.document.writeln(\"<BODY onLoad='self.focus()'>\");\r\n\t\tcalendarWindowYear.document.writeln(prefixFormatter.results);\t\r\n\t\tcalendarWindowYear.document.writeln(this.formatter.results);\r\n\t\tcalendarWindowYear.document.writeln(\"</BODY></HTML>\");\r\n\t\tcalendarWindowYear.document.close();\r\n\t}\r\n\r\n\treturn this.formatter.results;\r\n}", "title": "" }, { "docid": "03652e31ada24044f3e70e846e96ec7c", "score": "0.56514305", "text": "dobYears() {\n var now = 2016\n return _.map(buildFullArray(now - 121, now - 18), year => {\n return {value: year, label: year}\n })\n }", "title": "" }, { "docid": "a5f945f4ca8acc2aa9421914d3f6fc2d", "score": "0.56344616", "text": "get yearsList() {\n let startYear = this.min.getFullYear();\n let endYear = this.max.getFullYear();\n\n return [...Array(endYear - startYear + 1).keys()].map((x) => {\n let year = x + startYear;\n return { label: year, value: year };\n });\n }", "title": "" }, { "docid": "dcb6470a7b82e51c04dd87c20dfc4541", "score": "0.5626246", "text": "function getMonth(date) {\n\n if ( ~ date.indexOf('Jan'))\n return '01'\n\n if ( ~ date.indexOf('Feb'))\n return '02'\n\n if ( ~ date.indexOf('Mar'))\n return '03'\n\n if ( ~ date.indexOf('Apr'))\n return '04'\n\n if ( ~ date.indexOf('May'))\n return '05'\n\n if ( ~ date.indexOf('Jun'))\n return '06'\n\n if ( ~ date.indexOf('Jul'))\n return '07'\n\n if ( ~ date.indexOf('Aug'))\n return '08'\n\n if ( ~ date.indexOf('Sep'))\n return '09'\n\n if ( ~ date.indexOf('Oct'))\n return '10'\n\n if ( ~ date.indexOf('Nov'))\n return '11'\n\n if ( ~ date.indexOf('Dec'))\n return '12'\n}", "title": "" }, { "docid": "abc71aaec3d9114126e6c0289a4fb5f4", "score": "0.56165177", "text": "getYearList() {\n const url = `/common/reference/year`;\n return Method.dataGet(url, token);\n }", "title": "" }, { "docid": "34000e4ffa1cbdcd25aef01feb58fb4e", "score": "0.5602075", "text": "createYear(data) {\n const { endDate, weekCount, leftToRight } = this.props;\n const rawDate = endOfWeek(endDate);\n const year = [];\n for (let i = 0; i < weekCount; i++) {\n const subbedDate = subWeeks(rawDate, i);\n const formattedDate = format(subbedDate, 'YYYY-MM-DD');\n if (leftToRight) {\n year.push(this.createWeek(data, formattedDate));\n } else {\n year.unshift(this.createWeek(data, formattedDate));\n }\n }\n return year;\n }", "title": "" }, { "docid": "e2c499fdd810d3f2c1bc8b428f7cfd10", "score": "0.55934155", "text": "getMinimunYear() {\n\t\treturn -1;\n\t}", "title": "" }, { "docid": "22618233614c3a932b6a2c9294e9a121", "score": "0.5585191", "text": "function mesAnterior()\n{\n var newMonth = parseInt(month)-1;\n if (newMonth == 0){\n newMonth = 12;\n year = parseInt(year)-1;\n } else if (newMonth.length == 1){\n newMonth = '0'+newMonth;\n }//if\n month = newMonth;\n renderCalendar(year, month);\n}//fn", "title": "" }, { "docid": "ae8e9c884b1d1fadf66dbfdc1d9f18bb", "score": "0.5582589", "text": "function stringToMonthNumber(monthYear) {\n\t\t\t\tvar parts = monthYear.split(/\\s*,\\s*/);\n\t\t\t\tvar month = monthNumber[parts[0]];\n\t\t\t\tvar year = parts[1] - 1;\n\t\t\t\treturn year * 12 + month;\n\t\t\t}", "title": "" }, { "docid": "760b1ee532b99009fa9cdd3587f8513e", "score": "0.5580176", "text": "function getNumericMonth(month){\r\n switch (month){\r\n case \"Jan\":\r\n return 0;\r\n case \"Feb\":\r\n return 1;\r\n case \"Mar\":\r\n return 2;\r\n case \"Apr\":\r\n return 3;\r\n case \"May\":\r\n return 4;\r\n case \"Jun\":\r\n return 5;\r\n case \"Jul\":\r\n return 6;\r\n case \"Aug\":\r\n return 7;\r\n case \"Sep\":\r\n return 8;\r\n case \"Oct\":\r\n return 9;\r\n case \"Nov\":\r\n return 10;\r\n case \"Dec\":\r\n return 11;\r\n }\r\n}", "title": "" }, { "docid": "7c02a1397b921bf9182a6b09d8a94a54", "score": "0.55768985", "text": "getMonthLabel(date) {\n return `${this.getMonthFullName(date.month, date.year)} ${this.getYearNumerals(date.year)}`;\n }", "title": "" }, { "docid": "67f14c1f7e77a9a57678b7f69dfd9630", "score": "0.55646837", "text": "function setMonthYearTitle(m, y) {\n\t\tlet monthNames = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\",\n \t\t\t\"July\", \"August\", \"September\", \"October\", \"November\", \"December\"];\n\t\tdocument.getElementById(\"monthTitle\").innerHTML = monthNames[m];\n\t\tdocument.getElementById(\"yearTitle\").innerHTML = y.toString();\n\t}", "title": "" }, { "docid": "bff24b6e620d66c9a9495300cb992692", "score": "0.55522484", "text": "function getThreeDigitMonth(m) {\n\tvar m = m.toLowerCase();\n\tvar mLen = m.length;\n\tif(m.length !== 3) {\t\t\n\t\tm = '01';\n\t} else {\n\t\tif(m in monthObj) {\n\t\t\tm = monthObj[m];\n\t\t} else {\t\t\t\n\t\t\tm = '01';\n\t\t}\n\t}\n\n\treturn m;\n}", "title": "" }, { "docid": "6ba3ad86c765755b718f53fe40d64a70", "score": "0.5550043", "text": "YEAR(n) {\n\t\t\t\t\tswitch(identify(n)) {\n\t\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\t\treturn 1000 * 60 * 60 * 24 * 365 * n\n\t\t\t\t\t\t\tbreak\n\n\t\t\t\t\t\tcase \"date\":\n\t\t\t\t\t\t\treturn n.getYear() + 1900\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}", "title": "" }, { "docid": "1d117533b8d107ff17b628c078efc3ca", "score": "0.55498147", "text": "function myMonth() {\n if (todaydate.getMonth() == 0) {\n return themonth[0];\n } else if (todaydate.getMonth() == 1) {\n return themonth[1];\n } else if (todaydate.getMonth() == 2) {\n return themonth[2];\n } else if (todaydate.getMonth() == 3) {\n return themonth[3];\n } else if (todaydate.getMonth() == 4) {\n return themonth[4];\n } else if (todaydate.getMonth() == 5) {\n return themonth[5];\n } else if (todaydate.getMonth() == 6) {\n return themonth[6];\n } else if (todaydate.getMonth() == 7) {\n return themonth[7];\n } else if (todaydate.getMonth() == 8) {\n return themonth[8];\n } else if (todaydate.getMonth() == 9) {\n return themonth[9];\n } else if (todaydate.getMonth() == 10) {\n return themonth[10];\n } else {\n return themonth[11];\n }\n }", "title": "" }, { "docid": "6e30e6bd22c6b94cf30e87f684528a0c", "score": "0.5547705", "text": "function recupereMoisActuel() {\n /* Entrez le code ici */\n var objdate = new Date();\n\n return objdate.getMonth();\n}", "title": "" }, { "docid": "41714731ee77cb3f634949369525df73", "score": "0.5534286", "text": "daysInMonth() {\n\t // Check for February in a leap year\n\t if (this.month === 2 && this.isLeapYear) return 29;\n\t // ...Just a normal month\n\t return _daysInMonths[this.monthIndex];\n\t }", "title": "" }, { "docid": "2adc700ec2a084b70f131db024444a9c", "score": "0.5528945", "text": "getMonthDays(year, month) {\n let leapYear =\n year % 4 === 0 &&\n (year % 100 !== 0 || (year % 100 === 0 && year % 400 === 0))\n ? true\n : false;\n if (leapYear && month === 1) {\n return this.state.monthDays[month] + 1; // add 1 day to Feburary\n }\n return this.state.monthDays[month];\n }", "title": "" }, { "docid": "3ac2f0a5c645e0176ad1d88878c691e2", "score": "0.55284506", "text": "function getMonthNameFromArrayIndex(index){\n return month[index];\n}", "title": "" }, { "docid": "07fea128c23c486d3dccfa5fae22ad58", "score": "0.552086", "text": "function BuildMonths(now = new Date()) {\n var thisYear = now.getFullYear(),\n dayTracker = new Date(now.getFullYear(), 0, 1),\n dataIndex = 0,\n dataIndexDate = new Date(Data[dataIndex].Date);\n\n \n if (DatesStructure.hasOwnProperty(thisYear))\n return;\n\n DatesStructure[thisYear] = {};\n\n // we're starting the year at 0 month (January) and running through December\n // to generate the whole year for our year object we'll need to populate\n // for our other thing.\n for (var i = 0; i < 12; ++i)\n {\n var month = {\n year: dayTracker.getFullYear(),\n month: MonthNames[i],\n days: new Array()\n };\n\n while (dayTracker.getMonth() == i)\n {\n if (!(dataIndex >= Data.length) && Compare(dayTracker, dataIndexDate) == 0)\n {\n month.days.push(\n {\n Date: new Date(dayTracker),\n StartTime: Data[dataIndex].StartTime,\n EndTime: Data[dataIndex].EndTime,\n OneThreeFiveHours: Data[dataIndex][\"135Hours\"],\n Comments: Data[dataIndex].Comments\n }\n );\n dataIndex++;\n if (!(dataIndex >= Data.length))\n {\n dataIndexDate = new Date(Data[dataIndex].Date);\n }\n }\n else\n {\n month.days.push(\n {\n Date: new Date(dayTracker),\n StartTime: null,\n EndTime: null,\n OneThreeFiveHours: 0,\n Comments: ''\n }\n );\n dayTracker.setDate(dayTracker.getDate() + 1);\n }\n }\n DatesStructure[thisYear][MonthNames[i]] = month;\n monthsInYear.push(month);\n }\n}", "title": "" }, { "docid": "c322e3006066b3c5174f792137a6956b", "score": "0.55195475", "text": "function getDaysInMonth(month,year){\n if ((month==1)&&(year%4==0)&&((year%100!=0)||(year%400==0))){\n return 29;\n }else{\n return daysInMonth[month];\n }\n }", "title": "" }, { "docid": "379f4d5e2d9eb1e837b428046532ee44", "score": "0.55152345", "text": "function get_table_date() {\n const table_year = parseInt(document.getElementById(\"year_title\").innerText);\n const table_month = month_name_in_number(\n document.getElementById(\"month_title\").innerText\n );\n return date_object(table_year, table_month);\n}", "title": "" }, { "docid": "3b0fe894f7ae446a922115e798feeb51", "score": "0.5513365", "text": "$year(val) {\n return moment.unix(val).year()\n }", "title": "" }, { "docid": "c3b8fa6d0615021adde4d0a7be456314", "score": "0.551167", "text": "ssaBirthdate() {\n const ebd = this.englishBirthdate();\n return new utils.MonthDate().initFromYearsMonths(\n ebd.getFullYear(), ebd.getMonth());\n }", "title": "" }, { "docid": "d465eb4edbefa5f2659ee29acd45604b", "score": "0.55079997", "text": "function getYear() {\n /* Variables */\n let $area = $(\"#year\");\n let d = new Date;\n\n /* Displaying Year */\n $area.html(d.getFullYear());\n}", "title": "" }, { "docid": "45d8cbf54547293fecd4d066d8ef529f", "score": "0.55078983", "text": "function buildCalendar(month, year) {\r\n buildCalendarTitle(month, year);\r\n buildCalendarGrid(month, year);\r\n populateCalendarEvents(month, year);\r\n}", "title": "" }, { "docid": "2a12fc9fab59bf6dce0484e4cff64960", "score": "0.5505951", "text": "getBirthYear() {\r\n return this.dateOfBirth.getFullYear();\r\n }", "title": "" }, { "docid": "0797aa527fa8a80c148c90b8966a400d", "score": "0.5500507", "text": "initializeState() {\n let date = new Date();\n let defaultValue = this.props.value ? this.props.value.split(\"-\") : null;\n\n\t\tlet year = date.getFullYear();\n\t\tlet month = date.getMonth() + 1;\n\n\t\tif (defaultValue){\n\t\t\tyear = defaultValue ? parseInt(defaultValue[0]) : year,\n\t\t\tmonth = defaultValue && defaultValue[1] ? parseInt(defaultValue[1]): month\n\t\t}\n\n this.props.onChange(this.props.name, `${year}-${month}`);\n\n\t\treturn { year, month };\n }", "title": "" }, { "docid": "c8dd46d9e96b4080c27f4d92be7fc8f7", "score": "0.5497241", "text": "function setYears(data, i) {\n return data.toString();\n}", "title": "" }, { "docid": "88b0c7a64e09096e10a542bd4c6563c6", "score": "0.5493927", "text": "function parseYear(year, data) {\n var temp = parseFloat(data[year].value, 10);\n // Each year in the data set ends in 12. This removes it.\n var currentYear = parseInt(year.slice(0, -2), 10);\n var parsedData = { year: currentYear, temp: temp };\n return parsedData;\n}", "title": "" }, { "docid": "43c64d6351a3f6459343b6008028ffa0", "score": "0.5492655", "text": "nextMonthComps() {\n\t if (this.month === 12) return {\n\t days: _daysInMonths[0],\n\t month: 1,\n\t year: this.year + 1,\n\t };\n\t return {\n\t days: (this.month === 1 && this.isLeapYear) ? 29 : _daysInMonths[this.monthIndex + 1],\n\t month: this.month + 1,\n\t year: this.year,\n\t };\n\t }", "title": "" }, { "docid": "0c5c3b3dff140a61bc283c1ba882cb7a", "score": "0.54829377", "text": "function monthName(monthNum) {\n\n}", "title": "" }, { "docid": "9b4b4c352f090a3a671c05631895f090", "score": "0.5478507", "text": "function nodeYearPos(d) {\n return yearCenters[d.year].x;\n }", "title": "" }, { "docid": "9b4b4c352f090a3a671c05631895f090", "score": "0.5478507", "text": "function nodeYearPos(d) {\n return yearCenters[d.year].x;\n }", "title": "" }, { "docid": "9aa6e1d8fd37b84035ea589267957030", "score": "0.546128", "text": "function getYearFromDateParam(date) {\r\n var dateVals = date.split(\"-\");\r\n var year = dateVals[0];\r\n return year;\r\n}", "title": "" }, { "docid": "3fc2b22b4915e12b68d722ac73627b7f", "score": "0.54566336", "text": "showUnitYear() {\n if (this.unitCode && this.unitCode !== 'zzNO_UNIT') {\n return `${this.unitCode} ${moment(this.createdAt).format('YYYY')}`;\n }\n return moment(this.createdAt).format('MMM YYYY');\n }", "title": "" }, { "docid": "727da12606f413951fbdad5bedf2e391", "score": "0.54542077", "text": "_yearSelected(event) {\n const year = event.value;\n this.yearSelected.emit(this._dateAdapter.createDate(year, 0, 1));\n let month = this._dateAdapter.getMonth(this.activeDate);\n let daysInMonth = this._dateAdapter.getNumDaysInMonth(this._dateAdapter.createDate(year, month, 1));\n this.selectedChange.emit(this._dateAdapter.createDate(year, month, Math.min(this._dateAdapter.getDate(this.activeDate), daysInMonth)));\n }", "title": "" }, { "docid": "727da12606f413951fbdad5bedf2e391", "score": "0.54542077", "text": "_yearSelected(event) {\n const year = event.value;\n this.yearSelected.emit(this._dateAdapter.createDate(year, 0, 1));\n let month = this._dateAdapter.getMonth(this.activeDate);\n let daysInMonth = this._dateAdapter.getNumDaysInMonth(this._dateAdapter.createDate(year, month, 1));\n this.selectedChange.emit(this._dateAdapter.createDate(year, month, Math.min(this._dateAdapter.getDate(this.activeDate), daysInMonth)));\n }", "title": "" }, { "docid": "727da12606f413951fbdad5bedf2e391", "score": "0.54542077", "text": "_yearSelected(event) {\n const year = event.value;\n this.yearSelected.emit(this._dateAdapter.createDate(year, 0, 1));\n let month = this._dateAdapter.getMonth(this.activeDate);\n let daysInMonth = this._dateAdapter.getNumDaysInMonth(this._dateAdapter.createDate(year, month, 1));\n this.selectedChange.emit(this._dateAdapter.createDate(year, month, Math.min(this._dateAdapter.getDate(this.activeDate), daysInMonth)));\n }", "title": "" }, { "docid": "727da12606f413951fbdad5bedf2e391", "score": "0.54542077", "text": "_yearSelected(event) {\n const year = event.value;\n this.yearSelected.emit(this._dateAdapter.createDate(year, 0, 1));\n let month = this._dateAdapter.getMonth(this.activeDate);\n let daysInMonth = this._dateAdapter.getNumDaysInMonth(this._dateAdapter.createDate(year, month, 1));\n this.selectedChange.emit(this._dateAdapter.createDate(year, month, Math.min(this._dateAdapter.getDate(this.activeDate), daysInMonth)));\n }", "title": "" }, { "docid": "727da12606f413951fbdad5bedf2e391", "score": "0.54542077", "text": "_yearSelected(event) {\n const year = event.value;\n this.yearSelected.emit(this._dateAdapter.createDate(year, 0, 1));\n let month = this._dateAdapter.getMonth(this.activeDate);\n let daysInMonth = this._dateAdapter.getNumDaysInMonth(this._dateAdapter.createDate(year, month, 1));\n this.selectedChange.emit(this._dateAdapter.createDate(year, month, Math.min(this._dateAdapter.getDate(this.activeDate), daysInMonth)));\n }", "title": "" }, { "docid": "656ff1a882f62b49991cecc4894acd7e", "score": "0.54521334", "text": "layBirthYear() {\n return this.birthdate_.getFullYear();\n }", "title": "" }, { "docid": "e87da9d4608adc7e3796df8a86b8a050", "score": "0.5444739", "text": "function getYear(date){\n if (date == \"0000-00-00\") {\n return \" not relevent for this person.\"\n } else {\n return date.substr(0,4)}\n}", "title": "" }, { "docid": "9fb5263b645c19de4bf6f60b25a3b2ed", "score": "0.54437894", "text": "function getMonthIdx(monthName) {\n\tvar months = {\n\t\t'Jan.':0, 'Feb.':1, 'March':2, 'April':3, 'May':4, 'June':5, 'July':6, 'Aug.':7, 'Sept.':8, 'Oct.':9, 'Nov.':10, 'Dec.':11\n\t};\n\treturn months[monthName];\n}", "title": "" }, { "docid": "0eb8ca7f21d3616d27f16fdf9e566972", "score": "0.54348475", "text": "function filtYear(val) {\n\td3.select('#hide-alert1').style(\"display\",\"none\");\n\ta = document.getElementById('month').textContent.split(',')\n\tdocument.getElementById('month').textContent = a[0].slice(0,-4) + val + \",\" + a[1];\n}", "title": "" }, { "docid": "cb6245a9c5f6e03aa8aee50b59d6a380", "score": "0.54343385", "text": "getMonth() {\r\n // Array list of month names\r\n var month = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December', ];\r\n\r\n // Returns month name\r\n return month[this._today.getMonth()];\r\n }", "title": "" }, { "docid": "a486fad7af1b2b0f7bcf793933b77c5a", "score": "0.54261535", "text": "function mesSiguiente()\n{\n var newMonth = parseInt(month)+1;\n if (newMonth == 13){\n newMonth = 1;\n year = parseInt(year)+1;\n } else if (newMonth.length == 1){\n newMonth = '0'+newMonth;\n }//if\n month = newMonth;\n renderCalendar(year, month);\n}//fn", "title": "" }, { "docid": "5669ddb90dfffdd735dd6d05cd75e921", "score": "0.54247063", "text": "function getMon(index) {\n var month = new Array();\n month[0] = \"January\";\n month[1] = \"February\";\n month[2] = \"March\";\n month[3] = \"April\";\n month[4] = \"May\";\n month[5] = \"June\";\n month[6] = \"July\";\n month[7] = \"August\";\n month[8] = \"September\";\n month[9] = \"October\";\n month[10] = \"November\";\n month[11] = \"December\";\n\n return month[index];\n}", "title": "" }, { "docid": "a45274a1a95987c5353f7a0b01e5c55b", "score": "0.5420771", "text": "buildMonth(month, year) {\n var momentMonth = year ? moment(`${month}-${year}`, 'M-YYYY') : moment(month, 'M') ;\n var weeks = this.weeksForMonth(momentMonth)\n .map(weekStart => {\n return this.buildWeek(weekStart.year(), weekStart.week());\n });\n // TODO: Return an immutable record\n return {\n name: moment.localeData().months(momentMonth),\n year,\n weeks: Immutable.List(weeks)\n };\n }", "title": "" }, { "docid": "20ebec754fd001b337b6e88a9e71f48c", "score": "0.5417684", "text": "constructor(year, month) {\n // if year and month not specified - use current month\n if(!year || !month) {\n const today = new Date()\n this.year = getYear(today)\n this.month = getMonth(today)\n }\n else {\n // add error handling\n this.year = year\n this.month = month\n }\n\n this.events = []\n // array of arrays of events - an array for each day of the month\n for(let i = 0; i < getDaysInMonth(new Date(year, month, 1)); i++) {\n (this.events).push([])\n }\n\n Object.defineProperties(this, {\n\t\t\tyear: { writable: false },\n\t\t\tmonth: { writable: false },\n\t\t\tevents: { writable: false }\n\t\t});\n }", "title": "" }, { "docid": "2d22d92c5dc9c85178da15d54c072b88", "score": "0.5413083", "text": "function onYearChange(ev){\n setYear(ev.target.value);\n }", "title": "" }, { "docid": "2d22d92c5dc9c85178da15d54c072b88", "score": "0.5413083", "text": "function onYearChange(ev){\n setYear(ev.target.value);\n }", "title": "" }, { "docid": "d00d72b549c230ccab8540a6f5e27902", "score": "0.5412924", "text": "setCurrentDate() {\n this.getCalendar.setAttribute(\n \"data-month\",\n this.monthIndex\n );\n this.getCalendar.setAttribute(\n \"data-year\",\n this.getYear\n );\n }", "title": "" }, { "docid": "cea408b92d4387723385584a9f48d635", "score": "0.5408807", "text": "function getMonthFromString(mon) {\n return new Date(Date.parse(mon + \" 1, 2012\")).getMonth() + 1\n}", "title": "" }, { "docid": "cea408b92d4387723385584a9f48d635", "score": "0.5408807", "text": "function getMonthFromString(mon) {\n return new Date(Date.parse(mon + \" 1, 2012\")).getMonth() + 1\n}", "title": "" } ]
0d75d12b71645b2cd72ddb5050e6f710
Handle action of submit button
[ { "docid": "62e02425d6e711f329715dc5eb74c326", "score": "0.0", "text": "submit() {\r\n this.validate(this._form);\r\n\r\n if (this._valid.length !== this._fields.length) return;\r\n\r\n this.title.value = this._formContainer.querySelector('#title').value;\r\n this.date.value = this._formContainer.querySelector('#date').value;\r\n \r\n this.createTask();\r\n this.createFragment();\r\n this.close();\r\n }", "title": "" } ]
[ { "docid": "53bbb1a189f113a67e22e146763c7b59", "score": "0.7737044", "text": "handleSubmit(){\n\t\tthis.handleButtonClick();\n\t}", "title": "" }, { "docid": "6d778c2d65d0a578160f186ec78ec050", "score": "0.75708234", "text": "function handleSubmitButton(e) {\n var btn = e.currentTarget;\n if (btn.id && lab.submitBtnActions[btn.id]) { // safety net; should always be true.\n lab.submitBtnActions[btn.id]();\n } else {\n console.log('handleSubmitButton failed for', btn);\n }\n }", "title": "" }, { "docid": "1ac878eb5aad8022063e2cf661609a5c", "score": "0.7162235", "text": "function handleSubmitClick() {\n\t\tprops.handleSubmit();\n\t}", "title": "" }, { "docid": "77cbfa6a855e426ef8a76ad2220474a7", "score": "0.70835304", "text": "function formSubmitHandler(event) {\n event.preventDefault();\n buttonSubmitHandler(deck);\n }", "title": "" }, { "docid": "8abd65d36e9141f86ff663350271044e", "score": "0.70596135", "text": "function submitHandler() {\n if (validForm) {\n actionHandler(formValues);\n } else {\n touchAll();\n }\n }", "title": "" }, { "docid": "ad2218c42e5a4ea367c688370d7d2728", "score": "0.70588404", "text": "handleModalSubmit(event) {\n this.submitButton.click();\n }", "title": "" }, { "docid": "de0e52a037f101b348acbb615c9ab145", "score": "0.7039005", "text": "function submit()\n{\n\tvar data;\n\n\tif (vm.isFormSubmissible)\n\t{\n\t\t// Organize the data that will need to be sent over the wire\n\t\tdata =\n\t\t{\n\t\t\tname: vm.name,\n\t\t\torderId: vm.orderId,\n\t\t\temail: vm.email,\n\t\t\tareaCode: vm.areaCode,\n\t\t\tphoneOne: vm.phoneOne,\n\t\t\tphoneTwo: vm.phoneTwo,\n\t\t\tcomments: vm.comments\n\t\t};\n\n\t\t// Save the data\n\t\taxios.post(SEND_REQUEST_URL, data, true).then(() =>\n\t\t{\n\t\t\t// Prevent the button from being clicked again\n\t\t\t_submitButton.disabled = true;\n\n\t\t\t// Show a message indicating that a request has been sent to us\n\t\t\tnotifier.showSuccessMessage(SUCCESS_MESSAGE);\n\n\t\t\t// If successful, put up a success banner and let's take the user back to the home page after\n\t\t\t// about 5 seconds\n\t\t\twindow.setTimeout(() =>\n\t\t\t{\n\t\t\t\twindow.location.href = HOME_URL;\n\t\t\t}, 7500);\n\n\t\t}, () =>\n\t\t{\n\t\t\tnotifier.showGenericServerError();\n\t\t});\n\t}\n}", "title": "" }, { "docid": "ed911973e094ff9ee929136478247c9b", "score": "0.70304435", "text": "submit() {\n this.submitBtn.click()\n }", "title": "" }, { "docid": "ab75edc6c38c4bedcc8d8c5427e5dcb5", "score": "0.70014316", "text": "function handleSubmitButton() {\n if (inputContainerValue !== inputContainerIdNode.value) {\n inputContainerValue = inputContainerIdNode.value;\n sendSubmitEvent(inputContainerIdNode.value);\n collectionPageNumber = 0;\n }\n }", "title": "" }, { "docid": "7c8d1da7e2302dc302f11062c29f619c", "score": "0.70004565", "text": "handleSubmit(e) {\n e.preventDefault();\n \n this.handleClick();\n }", "title": "" }, { "docid": "627f0d728845690318bbfa4b846507fc", "score": "0.68247795", "text": "function handleSubmit(event) {\n event.preventDefault();\n submit();\n }", "title": "" }, { "docid": "2f91daeb53823291d5c54eff14484fc8", "score": "0.6823515", "text": "function submit() {\n\t\tvar $button = $( button ),\n\t\t\t$form = $button.parents('form').first(),\n\t\t\turl = $form.attr('action'),\n\t\t\tdata = $form.serialize();\n\n\t\t// Add the clicked button to the sent data\n\t\tdata = data + '&' + encodeURIComponent($button.attr('name')) + '=' + encodeURIComponent($button.val());\n\n\t\t// Send the submission over AJAX\n ajaxObj = {\n\t\t\ttype: \"POST\",\n\t\t\turl: url,\n\t\t\tdata: data\n\t\t};\n if( options.json )\n ajaxObj.dataType = 'json';\n\t\treturn $.ajax(ajaxObj);\n\t}", "title": "" }, { "docid": "6ead6839e92a472de392eb2a3c1f4cad", "score": "0.67822826", "text": "handleSubmit(e){\n alert(\"you click submit\")\n}", "title": "" }, { "docid": "c3d11bdd2d8f8137ee574b8a83e27ff9", "score": "0.6756517", "text": "hanlerClick() {\n if (this.isActive) {\n /**\n * The event fired when the publisher submit data.\n *\n * @event\n * @name submit\n * @param {string} value The input value.\n * @public\n */\n const selectedEvent = new CustomEvent('submit', {\n detail: {\n value: this._value\n }\n });\n this.dispatchEvent(selectedEvent);\n\n this.isActive = false;\n this._value = '';\n } else {\n this.isActive = true;\n }\n }", "title": "" }, { "docid": "4a26d07d7530bf38a1625ea5ba7170ae", "score": "0.67401385", "text": "onClick(e) {\n\n // Prevent the button to submit form if the button is disabled.\n if (this._submitButton.classList.contains('disabled')) {\n e.preventDefault();\n }\n }", "title": "" }, { "docid": "82b45290a625885ad634d5cb2a078fa5", "score": "0.6712043", "text": "function submitbutton(pressbutton) {\n\tsubmitform(pressbutton);\n}", "title": "" }, { "docid": "82b45290a625885ad634d5cb2a078fa5", "score": "0.6712043", "text": "function submitbutton(pressbutton) {\n\tsubmitform(pressbutton);\n}", "title": "" }, { "docid": "877248784828e4c3a1d6941e6efbe8b7", "score": "0.66746587", "text": "function handleSubmit(event) {\n event.preventDefault();\n submit();\n }", "title": "" }, { "docid": "5076a22e0e391105806b717079cad0a8", "score": "0.6672301", "text": "submit(e) {\n e.preventDefault();\n this.set('submitted', true);\n if (this.get('model').validate && this.get('validate')) {\n this.get('model').validate()\n .then((isValid) => {\n if (isValid) {\n this.sendAction('action', this.get('model'));\n }\n });\n } else {\n this.sendAction('action', this.get('model'));\n }\n }", "title": "" }, { "docid": "2fa297a1981ed8608641680d655bc9ed", "score": "0.66375995", "text": "function handleSubmitButton() {\n $('form').on('submit', function(event) {\n event.preventDefault();\n //determine if next button or results button\n if (round < STORE.length) {\n changeToNextButton();\n changeRounds();\n checkAnswer();\n }\n else {\n changeToResultsButton();\n changeRounds();\n checkAnswer();\n };\n });\n}", "title": "" }, { "docid": "ca6cdde4a90dc5bf05702a2d245d29e1", "score": "0.66149527", "text": "function onsubmit(event) {\n\t\t$dispatch($search, `${data.prefix}:submit`, {\n\t\t\tvalue: $control.value,\n\t\t\tevent\n\t\t});\n\t}", "title": "" }, { "docid": "21607b930c109a19fea0879d745442fc", "score": "0.66105336", "text": "onSubmitAction() {\n this.getForm().on('submit', (e) => this.validate() || e.preventDefault());\n }", "title": "" }, { "docid": "ff2baf5991a3f47db709c173f54704d0", "score": "0.6608923", "text": "function submitHandler(e) {\n\n // prevent the default behavior of the form button\n e.preventDefault();\n\n // perform a new search for users\n const newCursor = {\n primary: \"null\",\n secondary: \"null\"\n };\n\n props.onSearch(newCursor);\n\n }", "title": "" }, { "docid": "891041ba0bfc7fe6cdc73dc4a53a3d5c", "score": "0.6587233", "text": "submit() {\n this.element.requestSubmit();\n }", "title": "" }, { "docid": "3bcf01b26bf307aeb7f17a85aaf99090", "score": "0.65744716", "text": "clickSubmit() {\n this.submit.waitForDisplayed();\n this.submit.click();\n }", "title": "" }, { "docid": "c949f582dc9f6495998941b5e93992f1", "score": "0.657286", "text": "function submitHandler(e) {\n // prevent the default behavior of the form button\n e.preventDefault();\n\n // perform a new search for users\n const newCursor = {\n primary: \"null\",\n secondary: \"null\",\n };\n\n props.onSearch(newCursor);\n }", "title": "" }, { "docid": "a174e19c2635be7a5341524ea4564e89", "score": "0.6560616", "text": "function handleSubmit() {\n dispatch({ type: \"SUBMIT\" });\n setTimeout(() => {\n dispatch({ type: \"SUBMISSION_RECEIVED\" });\n }, 1500);\n }", "title": "" }, { "docid": "bf4e25083cf5e3437bd8b64fd57c8b05", "score": "0.65237826", "text": "handleSubmit(event) {\n // prevending default type sumbit of record edit form\n event.preventDefault();\n\n // querying the record edit form and submiting fields to form\n this.template.querySelector('lightning-record-edit-form').submit(event.detail.fields);\n\n // closing modal\n this.bShowModal = false;\n\n // showing success message\n this.dispatchEvent(new ShowToastEvent({\n title: 'Success!!',\n message:' Sub Todo updated Successfully!!.',\n variant: 'success'\n }),);\n\n }", "title": "" }, { "docid": "cc03991cde8326c17f601e6428eada03", "score": "0.6522546", "text": "function submitForm(){\n console.log('form submitted');\n }", "title": "" }, { "docid": "5e82f35ab74dd843ba96455f478a3cfc", "score": "0.6509093", "text": "submit(){\n this.props.submitValue(this.refs.input.getValue());\n this.dismiss();\n }", "title": "" }, { "docid": "533e29d5a3c410adb0ac57919fb23a6d", "score": "0.6486998", "text": "function triggerSubmit () {\n\n // click the button\n $('.filters').submit();\n\n }", "title": "" }, { "docid": "e96b086c657d8c091509c80ae407fdc1", "score": "0.64755064", "text": "function vm_submitButton(pressbutton, frmName, pageName) {\n\tvm_submitForm(pressbutton, frmName, pageName);\n}", "title": "" }, { "docid": "0a48a1b0fbbdb29a0622783d7713737c", "score": "0.6449559", "text": "function handleSubmit(event) {\n event.preventDefault();\n // console.log(formObject);\n API.saveItem(formObject)\n .then(res => {\n displayAll();\n alert(\"Your item has been added!\");\n window.location.reload(false);\n })\n .catch(err => console.log(err))\n }", "title": "" }, { "docid": "ea808a0233de9946acc92fed386cd087", "score": "0.64478177", "text": "function handleSubmit() {\n hideModal()\n if (props.handleSubmit) props.handleSubmit()\n }", "title": "" }, { "docid": "2a0500c76e9b8f01bf7a25bfc7482ba7", "score": "0.6436406", "text": "function userSubmits(message, buttonElement) {\n buttonElement.submit();\n}", "title": "" }, { "docid": "55a89ce384077db6b1356954e548bbc0", "score": "0.6423689", "text": "function _submitHandler () {\n _filter($filter.find('select'));\n\n return false;\n }", "title": "" }, { "docid": "7bb5774673b98862d42359c0f9b95a3d", "score": "0.640066", "text": "function handleSubmit(event){\n /* Saving Answer. */\n __saveResults(true);\n\n /* Marking Answers. */\n if (activityAdaptor.showAnswers) {\n __markAnswers();\n }\n\n $('input[id^=option]').attr(\"disabled\", true);\n }", "title": "" }, { "docid": "6d2e5b6ad394e7ce94427917e5564116", "score": "0.63943624", "text": "submit() {\n if (this.passive) { return; }\n\n if (this.validate()) {\n if (this.handler) {\n this.shade.activate();\n if (typeof this.handler === 'function') {\n this.handler(this, (results) => {\n if ((this.handlercallback) && (typeof this.handlercallback === 'function')) {\n this.handlercallback(this, results);\n this.shade.deactivate();\n } else {\n this.handleResults(results);\n }\n });\n } else { // its an API url\n this.doAjax((results) => {\n if ((this.handlercallback) && (typeof this.handlercallback === 'function')) {\n this.handlercallback(this, results);\n this.shade.deactivate();\n } else {\n this.handleResults(results);\n }\n });\n }\n } else if (this.url) {\n this.form.submit();\n } else if (this.action) {\n this.action();\n } else {\n console.log(`No handler defined for form ${this.id} :: ${this.name}`);\n }\n }\n }", "title": "" }, { "docid": "7a9752485e23762e8b20381b8e1fc526", "score": "0.6388215", "text": "handleSubmit (e) {\n e.preventDefault()\n console.log('submit button fired')\n this.handleValidate()\n }", "title": "" }, { "docid": "4027269475efe4f25118dcb9336173d6", "score": "0.6380204", "text": "function submit(e) {\n e.preventDefault();\n const form = $(this).get(0);\n if (dagRunId || executionDate) {\n if (form.dag_run_id) {\n form.dag_run_id.value = dagRunId;\n }\n if (form.execution_date) {\n form.execution_date.value = executionDate;\n }\n form.origin.value = window.location;\n if (form.task_id) {\n form.task_id.value = taskId;\n }\n if (form.map_index && mapIndex >= 0) {\n form.map_index.value = mapIndex;\n } else if (form.map_index) {\n form.map_index.remove();\n }\n form.action = $(this).data(\"action\");\n form.submit();\n }\n }", "title": "" }, { "docid": "9345ffe57117c26f8c9c0dab19ecb7a9", "score": "0.63778126", "text": "function handleSubmit(event) {\n event.preventDefault(); // When event happens page refreshed, this function prevents the default reaction\n const currentValue = input.value;\n paintGreeting(currentValue);\n saveName(currentValue);\n}", "title": "" }, { "docid": "737c0991b2b489daa647adffab12ac9d", "score": "0.6371708", "text": "handleFinish(event) {\n console.log('inside handle finish');\n this.template.querySelector('lightning-record-edit-form').submit();\n this.displayMode = 'View';\n }", "title": "" }, { "docid": "f6b002aaf16f3ab97c020833d354f484", "score": "0.6368903", "text": "function handleSubmit(event) {\n\n // TODO: Prevent the page from reloading\n event.preventDefault();\n\n // Do all the things ...\n addSelectedItemToCart();\n saveCartToLocalStorage();\n updateCounter();\n updateCartPreview();\n\n}", "title": "" }, { "docid": "ed1a8fa1948f4eab4207c3523ad7d012", "score": "0.63597447", "text": "function Submit(){\n\t\tprogressBar();\n\t\tgraficasCumplimiento();\n\t\tgraficasEjecucion();\n\t\ttablaHorarios();\n\t}", "title": "" }, { "docid": "20c0e5269f756e193c3c6404d73b6d5c", "score": "0.6358852", "text": "function submitform(pressbutton){\n\tif(pressbutton == 'export'){\n\t\turl_current = window.location.href;\n\t\turl_current = url_current.replace('#','');\n\t\twindow.open(url_current+'&task=export');\n\t\treturn;\n\t}\t\n\tif (pressbutton) {\n\t\tdocument.adminForm.task.value=pressbutton;\n\t}\n\tif (typeof document.adminForm.onsubmit == \"function\") {\n\t\tdocument.adminForm.onsubmit();\n\t}\n\tdocument.adminForm.submit();\n}", "title": "" }, { "docid": "5718f66bb71a0624464f9301b83ea548", "score": "0.63545537", "text": "function submitform(pressbutton){\n\tdocument.adminForm.task.value=pressbutton;\n\ttry {\n\t\tif (document.adminForm.onsubmit && pressbutton.indexOf('cancel') == -1) {\n\t\t\tif (document.adminForm.onsubmit()) {\n\t\t\t\tdocument.adminForm.submit();\n\t\t\t}\n\t\t} else {\n\t\t\tdocument.adminForm.submit();\n\t\t}\n\t} catch(e){\n\t\twindow.alert(e);\n\t}\n}", "title": "" }, { "docid": "a5381d83289a71cf72f314349b667e51", "score": "0.6353356", "text": "function handleSubmit() {\n\t$(\".js-search-form\").submit( function(event) {\n\t\tevent.preventDefault();\n\t\tconsole.log('handleSubmit ran')\n\t\tpageNumber = 1;\n\t\tconst searchTarget = $(event.currentTarget).find('.js-query');\n\t\tsearchItem = searchTarget.val();\n\t\tconsole.log(searchItem);\n\t\tsearchTarget.val(\" \");\n\t\tgetApiData(\"\", searchItem, displayData);\n\t});\n}", "title": "" }, { "docid": "acf4cacfcabfc750706ec098fb2793c7", "score": "0.63529426", "text": "submit() {\n this.pl.submitForm();\n }", "title": "" }, { "docid": "a8b249d8bb9736f9933ce263ca30c0cd", "score": "0.6352196", "text": "function handleClick() {\n setHeadingText(\"Submitted\");\n }", "title": "" }, { "docid": "31df4d6e24b7a0c603fcb562e18623c1", "score": "0.6347381", "text": "function handleSubmit(event) {\n // TODO: Prevent the page from reloading\n event.preventDefault(); // prevents the page from reloading\n\n // Do all the things ...\n addSelectedItemToCart();\n cart.saveToLocalStorage();\n updateCounter();\n updateCartPreview();\n}", "title": "" }, { "docid": "bb9b01b77da2100e42a8bc4e06cca578", "score": "0.63448125", "text": "function handleOnButtonClick(asBtn) {\r\n switch (asBtn) {\r\n case 'SAVE':\r\n submitSave(\"saveAllTailQuote\");\r\n break;\r\n }\r\n}", "title": "" }, { "docid": "2ceca2f546ed132d64dce14ded499756", "score": "0.63365066", "text": "function handleClickSubmit(event) {\n event.preventDefault();\n const inputType = \"1\";\n if (input && householdIncome && householdSize) {\n loadData(inputType, input, householdIncome, householdSize);\n setErrorMessage(false); \n setDisplayResults(true);\n } else {\n setErrorMessage(true);\n setDisplayResults(false);\n }\n }", "title": "" }, { "docid": "c55173092fb41cbc148c9071a4305cef", "score": "0.6334197", "text": "function formSubmit() {\n $('.js-submit').click(function(e) {\n e.preventDefault();\n $('.hidden').show();\n var text = $('textarea').val();\n createReport (removeReturns(text));\n // wordCount(input);\n // averageLength(input);\n // uniqueCount(input);\n });\n}", "title": "" }, { "docid": "bdd2e56f1184e5deffe94843d34540e8", "score": "0.6331129", "text": "function halSubmit(e) {\n var form, query, nodes, i, x, args, url, method, template, accept;\n \n args = {};\n form = e.target;\n query = form.action;\n query = query.replace(/%7B/,'{').replace(/%7D/,'}'); // hack\n template = UriTemplate.parse(query);\n method = form.getAttribute(\"halmethod\")||form.method;\n accept = form.getAttribute(\"type\")||g.ctype;\n \n // gather inputs\n nodes = d.tags(\"input\", form);\n for(i=0, x=nodes.length;i<x;i++) {\n if(nodes[i].name && nodes[i].name!=='') {\n args[nodes[i].name] = nodes[i].value;\n }\n }\n\n // resolve any URITemplates\n url = template.expand(args);\n\n // use app/json for bodies \n if(method!==\"get\" && method!==\"delete\") {\n req(url, method, JSON.stringify(args), \"application/json\", accept);\n }\n else {\n req(url, method ,null, null, accept);\n }\n return false;\n }", "title": "" }, { "docid": "212dbf7bc2387b6c7d178d8ab39cc6c2", "score": "0.6315114", "text": "handleFormSubmit(event) {\n\t\tevent.preventDefault();\n\n\t\tvar isCorrect = this.cleanseAnswer(this.inputElement.value) === this.cleanseAnswer(this.currentClue.answer);\n\t\tif (isCorrect) {\n\t\t\tthis.updateScore(this.currentClue.value);\n\t\t}\n\n\t\t//Show answer\n\t\tthis.revealAnswer(isCorrect);\n\t}", "title": "" }, { "docid": "d32acbcbab09a08df4f612fa4e1434fc", "score": "0.631398", "text": "function handleSubmit(event) {\n\n // TODO: Prevent the page from reloading\n event.preventDefault();\n\n // Do all the things ...\n addSelectedItemToCart();\n saveToLocalStorage();\n updateCounter();\n updateCartPreview();\n\n}", "title": "" }, { "docid": "77bc3aeb9ba599e74ec345ca49382ad5", "score": "0.6309779", "text": "function goSubmitMr() {\n closeAllchildren();\n saveCurrenData();\n\tif (auditSubmitData()) {\n\t\t$(\"action\").value = \"submit\";\n\t\t//prepare grid for data sending\n\t\tmygrid.parentFormOnSubmit();\n \tdocument.genericForm.submit();\n\t\tshowTransitWin(\"\");\n\t}else {\n\t\treturn false;\n\t}\n}", "title": "" }, { "docid": "90f01040d40fa1f5c9ff5edc295c5d6e", "score": "0.6309438", "text": "function handleSubmit(event) {\n // TODO: Prevent the page from reloading\n event.preventDefault();\n // Do all the things ...\n addSelectedItemToCart();\n cart.saveToLocalStorage();\n updateCounter();\n updateCartPreview();\n\n}", "title": "" }, { "docid": "9b3ef40806cae33ca6973a21592fc5f6", "score": "0.6303344", "text": "function handleSubmit(event) {\n \n\n // TODO: Prevent the page from reloading\n event.preventDefault();\n\n // Do all the things ...\n addSelectedItemToCart();\n saveCartToLocalStorage();\n updateCounter();\n updateCartPreview();\n\n}", "title": "" }, { "docid": "41f263d8829a0e9a6b3dc75d9674ceaf", "score": "0.6302985", "text": "function formSubmitHandler() {\n // If we let the form mechanism to submit data and we redirect here directly, the redirect happens too fast\n // and sometimes the newly created item is not visible in the console. Submitting the form using ajax allows\n // us to know when the server finished processing the request and redirect after that happens. This way the\n // newly created item is always visible in the console after redirect.\n $.ajax({\n url: formElement.attr('action'),\n type: 'POST',\n data: formElement.serialize(),\n success: () => {\n document.location.href = Granite.HTTP.externalize(redirectLocation);\n },\n error: () => {\n nameCoralTextfieldComponent.invalid = true;\n }\n });\n return false; // prevent the form from submitting because we do that from JS.\n }", "title": "" }, { "docid": "075e03fb50a84457d432ba527260fc75", "score": "0.6301001", "text": "function questionSubmitButton() {\n $('.js-main').submit('.js-question-page-submit', (evt) => {\n evt.preventDefault();\n if (!$('form input[type=radio]:checked').val()) {\n noAnswerDisplay();\n } else if ($('form input[type=radio]:checked').val() === STORE.questions[STORE.questionNumber].correctAnswer) {\n STORE.score++;\n STORE.correct = true;\n postQuestionDisplay();\n } else {\n STORE.correct = false;\n postQuestionDisplay();\n }\n });\n}", "title": "" }, { "docid": "898108a61a6be8644ddcc67d94f0a1c5", "score": "0.6292174", "text": "function addSubmit(evt) {\n}", "title": "" }, { "docid": "64e7bf9f4bd33ee235adf947ccbeaa83", "score": "0.6285837", "text": "function afterSubmit(self) {\n var redirect = self.redirect;\n var success = self.success;\n\n // Redirect to a success url if defined\n if (success && redirect) {\n\tWebflow.location(redirect);\n\treturn;\n }\n\n // Show or hide status divs\n showhide(self.done,success)\n showhide(self.fail,!success)\n\n // Hide form on success\n showhide(self.form,!success)\n\n // Reset data and enable submit button\n reset(self);\n}", "title": "" }, { "docid": "7a3b0a14c3f6dc4cbd99402b893890cc", "score": "0.6285584", "text": "function contactSubmit() {\n $(this).submit();\n }", "title": "" }, { "docid": "994fef109a4c6f3ed20ea4d3d3a97a35", "score": "0.62849224", "text": "submit () {\n this.$emit('submit');\n }", "title": "" }, { "docid": "994fef109a4c6f3ed20ea4d3d3a97a35", "score": "0.62849224", "text": "submit () {\n this.$emit('submit');\n }", "title": "" }, { "docid": "994fef109a4c6f3ed20ea4d3d3a97a35", "score": "0.62849224", "text": "submit () {\n this.$emit('submit');\n }", "title": "" }, { "docid": "87101235e2a624f6449815f859436acf", "score": "0.6279092", "text": "submitForm( e ) {\n // ignore all keypress except ENTER\n if ( e.type === 'keypress' && e.which !== 13 ) return false;\n \n // send new task's data to 'global' event handler\n this.data.pubsub.emit('new task', {\n id: this.data.taskIndex + 1,\n title: this.DOM.taskInput.value,\n status: 'unstarted',\n description: 'no description'\n });\n\n // clear field after submitting\n this.DOM.taskInput.value = '';\n }", "title": "" }, { "docid": "a1b8de480a0aeb02ccfd5f0fa174b06f", "score": "0.6273975", "text": "function submit() {\n document.querySelector('button').onclick = () => {\n makeRequest(document.querySelector('input').value);\n }\n}", "title": "" }, { "docid": "3d97fc9a83f58270af8d5b95c63450c9", "score": "0.62738776", "text": "function submit(e) {\n dispatch(signIn(formInput));\n e.preventDefault(); // prevents page from reloading\n }", "title": "" }, { "docid": "743f65cebb346f5c9f982823b94dd9dd", "score": "0.62696517", "text": "function do_submit(me)\n{\n\tif(form_debug != false) console.log('DO FORM SUBMIT ->');\n\t\t// Get id of form that was submitted.\n\t\tvar form_id = me.$element.attr(\"id\");\n\t\tconsole.log('DO:' + form_id);\n\t\t\n\t\tvar xreq = new x_app();\n\t\t// Set form id of form to submit\n\t\txreq.form_id = '#' + form_id;\n\t\t// Blank form inputs after request\n\t\txreq.reset_form = true;\n\t\t// Submit form\n\t\txreq.form_submit();\n}", "title": "" }, { "docid": "b63fbb1a3eac53403725e4d3492d8604", "score": "0.62617177", "text": "function submit()\n{\n\tlet data = {};\n\n\t// Submit the form only if all required information has been filled out\n\tif (vm.isFormValid)\n\t{\n\t\tdata =\n\t\t{\n\t\t\tcompany : COMPANY_NAME,\n\t\t\tcustomerName : vm.customerName,\n\t\t\tprojectManager : vm.projectManager,\n\t\t\taddress : vm.address,\n\t\t\tcity : vm.city,\n\t\t\tstate : vm.state,\n\t\t\tdesign : vm.design,\n\t\t\tquestions : vm.questions,\n\t\t\tdueDate : vm.dueDate\n\t\t};\n\n\t\t// Disable the button to ensure the order is not accidentally sent multiple times\n\t\t_submitButton.disabled = true;\n\n\t\taxios.post(SAVE_REQUEST_INFO, data, true).then(() =>\n\t\t{\n\t\t\tnotifier.showSuccessMessage(SUCCESS_MESSAGE);\n\n\t\t\t_submitButton.disabled = false;\n\t\t}, () =>\n\t\t{\n\t\t\tnotifier.showGenericServerError();\n\n\t\t\t_submitButton.disabled = false;\n\t\t});\n\t}\n}", "title": "" }, { "docid": "af5dbeb77fe71ac809dd38aee8e7d846", "score": "0.62484956", "text": "function formSubmit(actionName){\n document.forms[1].action=actionName;\n document.forms[1].submit();\n }", "title": "" }, { "docid": "2c489c9eab29152b8df51078219acdc3", "score": "0.62344927", "text": "function submit_handler(form) {\n return false;\n}", "title": "" }, { "docid": "3203173aa967be1a6e2381f8f312b2ed", "score": "0.6233462", "text": "onClickSubmit()\n {\n var that = this;\n this._ui.submit.addEventListener('click', function(e){\n e.preventDefault();\n return that.login(); \n });\n }", "title": "" }, { "docid": "209509c2f8e204be58b7394935ecd49a", "score": "0.6230385", "text": "if(e.keyCode === 13) {\n \t\treturn 'submit';\n \t}", "title": "" }, { "docid": "5665e26018f15cbe8ce5b9c86ecf980c", "score": "0.6226172", "text": "submitHandler(e) {\n this.trigger('submit', e);\n //FormValidator.triggerCallback(this.submit, e);\n // Prevent form submit if validation failed\n if (!this.allowSubmit && !this.validate()) {\n e.preventDefault();\n }\n else {\n this.allowSubmit = false;\n }\n }", "title": "" }, { "docid": "a56ccc2349a85f4be213a92ce477e7fc", "score": "0.6224535", "text": "handleFormSubmit(e){\n \n }", "title": "" }, { "docid": "508e90c804cdfa45b857aafd6c9ae394", "score": "0.6222465", "text": "function submitHandler(e) {\n e.preventDefault();\n\n // atspausdinti ivesta lauka konsolej\n if (input) {\n // console.log(input);\n onEmailSubmit(input);\n setInput('');\n }\n // nespausdinti jei tuscias\n // siusti ta reiksme su props i virsu\n }", "title": "" }, { "docid": "f34739dc915227c42c5914683a2345d8", "score": "0.6221344", "text": "function handleOnButtonClick(btn) {\r\n switch (btn) {\r\n case 'SEARCH':\r\n document.forms[0].process.value = \"loadAllDividendRule\";\r\n submitFirstForm();\r\n break;\r\n default:break;\r\n }\r\n}", "title": "" }, { "docid": "3666b5da1450f1ffb8d45ade369f7788", "score": "0.62204254", "text": "function handleFormSubmit(event) {\n event.preventDefault();\n\n if (front) {\n googleTranslate.translate(front, selectedLanguage, function (err, res) {\n setOutputLanguage(res.translatedText);\n setFlashcards({\n ...flashcards,\n Back: res.translatedText,\n });\n });\n }\n }", "title": "" }, { "docid": "c43ae4722ac3674e4dcef7ead56da5e2", "score": "0.6215418", "text": "function confirmSubmit() {\n\n}", "title": "" }, { "docid": "065002f6857c38b6a9a2d49feff737e1", "score": "0.6195286", "text": "async function handleSubmit() {\n // Validate the fields before sending the request to the server\n if (validateSubmit() === false) return;\n\n // Body to pass to the fetch request\n let body = { \"username\": firstField };\n\n // Grab the response from the request\n let response = await actionFetch(\n `https://csi420-02-vm6.ucd.ie/users/${currentUser.pk}/`,\n \"PUT\",\n body,\n props.setError,\n props.setIsPending,\n props.setOkMessage\n );\n\n // If the response is ok, logout and send the user to the loging page\n if (response.ok) {\n setTimeout(() => {\n logout();\n history.push(\"/login\");\n }, 1000);\n }\n }", "title": "" }, { "docid": "751fe396cf483effbdc3b681c11c872b", "score": "0.61932373", "text": "function submit_handler(e) {\n e.preventDefault();\n var file_input = $(this).siblings('input.cors-file-upload-file');\n // Make sure we are sending a file to be uploaded\n if (file_input[0].files[0] != undefined) {\n RackspaceCF.upload_file(file_input, 0, ajax_upload_button.attr('name'));\n } else {\n alert('Please upload a file before saving!');\n }\n }", "title": "" }, { "docid": "3e52f87da806a670aaa50adeaed84b91", "score": "0.6188748", "text": "function nameSubmit(){\n\t\t$('#submitNameBtn').click(function(){\n\t\t\twindow.location = 'gender';\n\t\t})\n\t}", "title": "" }, { "docid": "1f5f561af2ec48ca8b9566ab70cfa08b", "score": "0.61879265", "text": "function afterSubmit(data) {\n\t var form = data.form;\n\t var wrap = form.closest('div.w-form');\n\t var redirect = data.redirect;\n\t var success = data.success;\n\n\t // Redirect to a success url if defined\n\t if (success && redirect) {\n\t Webflow.location(redirect);\n\t return;\n\t }\n\n\t // Show or hide status divs\n\t data.done.toggle(success);\n\t data.fail.toggle(!success);\n\n\t // Hide form on success\n\t form.toggle(!success);\n\n\t // Reset data and enable submit button\n\t reset(data);\n\t }", "title": "" }, { "docid": "7128a4e7e447a8c5a050f5fb6bd5c92f", "score": "0.61829436", "text": "function submitCustom() {\n\treset(this);\n\n\tpreventDefault(this);\n\n\tvar payload={}\n var status = findFields(this.form, payload);\n if (status) return __.dialogs.alert(status);\n\n\t// Disable submit button\n\tdisableBtn(this);\nvar self=this\n\t// {'Content-Type':'application/x-www-form-urlencoded'}\n\t__.ajax('POST',this.form.action,__.querystring(payload),{headers:{'Content-Type':'application/x-www-form-urlencoded'}}, function(err,code){\n\t\tif (4 !== code) return\n\t\tself.success=!err\n\t\tafterSubmit(self)\n\t})\n}", "title": "" }, { "docid": "9391c83873ef8880e8bb328c753caa06", "score": "0.61776465", "text": "function handleSubmit(event) {\n event.preventDefault();\n // TODO: Prevent the page from reloading\n // console.log('ITEAM VALUE', event.target.value);\n // Do all the things ...\n addSelectedItemToCart(event);\n cart.saveToLocalStorage();\n updateCounter();\n updateCartPreview();\n\n}", "title": "" }, { "docid": "45475fb509d1c6069b7f606fd22ffba5", "score": "0.6177206", "text": "function handleSubmit(event) {\n event.preventDefault();\n\n // Do all the things ...\n addSelectedItemToCart();\n cart.saveToLocalStorage();\n updateCounter();\n updateCartPreview();\n\n}", "title": "" }, { "docid": "69041d8fccbee22eae65dca68f076058", "score": "0.6176462", "text": "function triggerSubmit (e) {\n var $this = $(this), preview_widget = $('.widget-preview', context);\n if (!preview_widget.hasClass('panopoly-magic-loading')) {\n preview_widget.addClass('panopoly-magic-loading');\n $this.find('.ctools-auto-submit-click').click();\n }\n }", "title": "" }, { "docid": "6c53364dad000121dfb0084c79448d0d", "score": "0.6175985", "text": "function submitForm(e){\n\t// Stop object from submitting to file\n\te.preventDefault();\n\tconst task = document.querySelector('#task').value;\n\t//Sends task to main.js\n\tipcRenderer.send('task:add', task);\n}", "title": "" }, { "docid": "57e09ae7ae01606f42100dc9afb46080", "score": "0.6172031", "text": "handleFormSubmit() {\n const form = this.dom.querySelector('form');\n form.addEventListener('submit', this.save);\n }", "title": "" }, { "docid": "04c3c1bbe196747950b15411b26b1d73", "score": "0.61692786", "text": "function submit() {\n var btn = $('<button>');\n btn.attr('id', 'submit');\n btn.append('Submit');\n\n $('#subBtn').append(btn);\n }", "title": "" }, { "docid": "a66440d82d8bb0e3003db86041ce0e52", "score": "0.61684394", "text": "function customFormSubmit(event,buttonToPress){\n\tvar k = event.which || event.keyCode;\n\tif(k==13){\n\t\t$('#' + buttonToPress).click();\n\t};\n}", "title": "" }, { "docid": "bf47c5c70ead2b6994dad6ae069dc833", "score": "0.61640525", "text": "function AddBIButtonSubmitClickEvent() {\n AddBIButtonSubmitClick();\n}", "title": "" }, { "docid": "dbc658734545bf2fe5819934ad37e39c", "score": "0.6155895", "text": "function submitHandler(e) {\n e.preventDefault();\n if (name === \"\") {\n alert(`Please Enter a ${props.item} Name!`)\n }else{\n props.onAdd(name);\n setName(\"\"); \n } \n }", "title": "" }, { "docid": "6b07cf65adf9d8c0b86b60bb499554a8", "score": "0.6152312", "text": "function handleCalculatorSubmit(event) {\n event.preventDefault();\n if (allValidationResults() == false) {\n console.log(\"stay on the page calculator form\");\n\n } else {\n console.log(\"all good to go\");\n calulatorForm.submit();\n }\n\n}", "title": "" }, { "docid": "f784684c88d0a1a9f5c34f452872402f", "score": "0.6151589", "text": "function submitForm(e){\r\n e.preventDefault();\r\n var year =getInputVal('year');\r\n readResults(year);\r\n \r\n }", "title": "" }, { "docid": "35a5455ea5f5a75123f904fca2ed9ae5", "score": "0.6150694", "text": "handleSubmit(event) {\n alert(\"Thanks for choosing Ace Deals!\");\n event.preventDefault();\n }", "title": "" }, { "docid": "e62c17490ab1b2ae7a9fcb58e0b8a95a", "score": "0.61432135", "text": "function submitForm(event){\n event.preventDefault();\n var date = new Date();\n var gettimestamp = date.getTime();\n // get values\n var items = getInputVal(\"items\");\n var needbydate = getInputVal(\"needbydate\");\n var message = getInputVal(\"message\");\n var timestamp = gettimestamp;\n var postrequester_uid = currentUser;\n var status = \"pending\";\n\n //save request post\n savePost(items, needbydate, message, timestamp, postrequester_uid, status);\n }", "title": "" }, { "docid": "e056b3669b0ca9cb8efc42ff648bdbec", "score": "0.6142362", "text": "_submit() {\n window.dispatchEvent(new CustomEvent(\"submit\", {detail: this.editableNode.innerHTML}));\n }", "title": "" } ]
a840ff632e279b5ff8922df6ff5ddaae
Monkey patch express to support removal of routes
[ { "docid": "61e4af2b379b664f0b53981b0c3f010f", "score": "0.63976103", "text": "function unmount(routeToRemove) {\n\tvar routes = express._router.stack;\n\troutes.forEach(removeMiddlewares);\n\tfunction removeMiddlewares(route, i, routes) {\n\t if (route.path === routeToRemove) {\n\t \troutes.splice(i, 1);\n\t }\n\t if (route.route) {\n\t route.route.stack.forEach(removeMiddlewares);\n\t }\n\t}\n}", "title": "" } ]
[ { "docid": "eef005102dce8ddae94ba867d8a20427", "score": "0.6343394", "text": "function router() {\n var preRouteHandlers = [];\n var result = express.Router();\n result.__hasParentApp = false;\n result.voidHandler = function (handler) {\n preRouteHandlers.push(void_handler_1.VoidHandlerUtil.toSafeRequestVoidHandler(handler));\n return result;\n };\n result.errorVoidHandler = function (handler) {\n preRouteHandlers.push(void_handler_1.VoidHandlerUtil.toSafeErrorVoidHandler(handler));\n return result;\n };\n result.valueHandler = function (handler) {\n preRouteHandlers.push(value_handler_1.ValueHandlerUtil.toSafeRequestVoidHandler(handler));\n return result;\n };\n result.errorValueHandler = function (handler) {\n preRouteHandlers.push(value_handler_1.ValueHandlerUtil.toSafeErrorVoidHandler(handler));\n return result;\n };\n result.asyncVoidHandler = function (handler) {\n preRouteHandlers.push(async_void_handler_1.AsyncVoidHandlerUtil.toSafeRequestVoidHandler(handler));\n return result;\n };\n result.asyncErrorVoidHandler = function (handler) {\n preRouteHandlers.push(async_void_handler_1.AsyncVoidHandlerUtil.toSafeErrorVoidHandler(handler));\n return result;\n };\n result.asyncValueHandler = function (handler) {\n preRouteHandlers.push(async_value_handler_1.AsyncValueHandlerUtil.toSafeRequestVoidHandler(handler));\n return result;\n };\n result.asyncErrorValueHandler = function (handler) {\n preRouteHandlers.push(async_value_handler_1.AsyncValueHandlerUtil.toSafeErrorVoidHandler(handler));\n return result;\n };\n result.createRoute = function (routeDeclaration) {\n var newRoute = route_1.route(routeDeclaration, result, preRouteHandlers);\n return newRoute;\n };\n var originalUse = result.use.bind(result);\n result.use = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {\n var arg = args_1[_a];\n if (arg != undefined && arg.__hasParentApp === true) {\n throw new Error(\"Attempt to use sub-app/router already used by an app\");\n }\n }\n return originalUse.apply(void 0, args);\n };\n return result;\n}", "title": "" }, { "docid": "1bfa73163ad6a0c3a0d89ce2ab947af3", "score": "0.6305121", "text": "function expressroutes(router, options) {\n var routes, mountpath;\n\n routes = options.routes || [];\n options.docspath = utils.prefix(options.docspath || '/api-docs', '/');\n options.api.basePath = utils.prefix(options.api.basePath || '/', '/');\n mountpath = utils.unsuffix(options.api.basePath, '/');\n\n router.get(mountpath + options.docspath, function (req, res) {\n res.json(options.api);\n });\n\n routes.forEach(function (route) {\n var args, path, before;\n\n path = route.path.replace(/{([^}]+)}/g, ':$1');\n args = [mountpath + utils.prefix(path, '/')];\n before = [];\n\n route.validators.forEach(function (validator) {\n var parameter, validate;\n\n parameter = validator.parameter;\n validate = validator.validate;\n\n before.push(function validateInput(req, res, next) {\n var value, isPath;\n\n switch (parameter.in) {\n case 'path': \n case 'query':\n isPath = true;\n value = req.params[parameter.name]; \n break;\n case 'header':\n value = req.get(parameter.name);\n break;\n case 'body':\n case 'formData':\n value = req.body;\n }\n\n validate(value, function (error, newvalue) {\n if (error) {\n res.statusCode = 400;\n next(error);\n return;\n }\n\n if (isPath) {\n req.params[parameter.name] = newvalue;\n }\n\n next();\n });\n });\n });\n\n if (thing.isArray(route.handler)) {\n if (route.handler.length > 1) {\n Array.prototype.push.apply(before, route.handler.slice(0, route.handler.length - 1));\n }\n route.handler = route.handler[route.handler.length - 1];\n }\n\n Array.prototype.push.apply(args, before);\n args.push(route.handler);\n router[route.method].apply(router, args);\n });\n}", "title": "" }, { "docid": "e562d16a76a8730de84b094fcb83d8da", "score": "0.6297226", "text": "function appUsedFunction() {\r\n expressJson();\r\n expressUrlencoded();\r\n expressStatic();\r\n expressApiRoutes();\r\n expressHtmlRoutes();\r\n}", "title": "" }, { "docid": "19e49937de9b8c6d9c3c23c2bdb62be6", "score": "0.6220195", "text": "ignoreRoute(req, res) {\n return false;\n }", "title": "" }, { "docid": "1d5bbcd54d246c63f89e56c6c0e8f5a3", "score": "0.6214435", "text": "function appRouting(key, req, res) {\n update(key, 'res', res);\n}", "title": "" }, { "docid": "8e4ebcc6815240b5ac91f3b780cccd5b", "score": "0.6181256", "text": "static getOtherRoutes(compiler) {\n\t\tvar router = express.Router();\n\n\t\t// Every other non-mapped route.\n\t\trouter.use((req, res, next) => {\n\n\t\t\t// No watcher for production.\n\t\t\tif ( process.env.NODE_ENV === 'production' ) {\n\t\t\t\tres.sendFile(path.join(__dirname, '../../dist/index.html'));\n\t\t\t} else {\n\t\t\t\tcompiler.outputFileSystem.readFile(path.join(__dirname, '../../dist/index.html'), (err, result) => {\n\t\t\t\t\tif (err) {\n\t\t\t\t\t\treturn next(err);\n\t\t\t\t\t}\n\t\t\t\t\tres.set('content-type', 'text/html');\n\t\t\t\t\tres.send(result);\n\t\t\t\t\tres.end();\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\t// Handle error routes\n\t\trouter.use((err, req, res, next) => {\n\t\t\tconsole.log('Error: ' + err.message);\n\t\t\tnext();\n\t\t});\n\n\t\treturn router;\n\t}", "title": "" }, { "docid": "4b75000e9a89352628ebb80b78444f4b", "score": "0.61785007", "text": "function expressInit( req, res, next ) { // jshint ignore:line\n req.next = next;\n // patching this according to how express does it\n /* jshint ignore:start */\n req.__proto__ = expreq;\n res.__proto__ = expres;\n /* jshint ignore:end */\n next();\n}", "title": "" }, { "docid": "a0b42b27f938d547289c086158f1d5f6", "score": "0.6162075", "text": "initRoutes() {\n this.express.use(require(\"./routes\"));\n }", "title": "" }, { "docid": "8bb18a0ba0ea546553e33a4692d9f08e", "score": "0.61471367", "text": "before(app){\n app.use((req,res,next) => {\n\t\t\t if(req.url === '/'){\n\t\t\t\treq.url = '/';\n\t\t\t }\n next();\n });\n }", "title": "" }, { "docid": "3739d3a086aeeca80268c97b5bfa54b2", "score": "0.6123459", "text": "exitRoute (req) {\n req._datadog.paths.pop()\n }", "title": "" }, { "docid": "45b3030f1563baeca405cbe462363e75", "score": "0.61056983", "text": "function serveRoutes(req, res, next) {\n this._zygo.route(req.url, req.headers, req.method)\n .then((html) => {\n res.writeHead(200, { 'Content-Type': 'text/html' });\n res.write(html);\n res.end();\n })\n .catch((error) => {\n console.log(\"Error while routing \" + req.url + \" :\\n\" + error);\n res.writeHead(404, { 'Content-Type': 'text/plain' });\n res.write(\"404 not found\");\n res.end();\n\n throw error;\n });\n}", "title": "" }, { "docid": "8a4144cda9bab42b1a56a99e13496a72", "score": "0.6096365", "text": "function initRoutes(app) {\n app.use('/api', require('./routes'));\n}", "title": "" }, { "docid": "cb80ec1665d2e851aa0470af016c5566", "score": "0.6067646", "text": "serve() {\n // a no-op, these are absolute URLs\n return function (req, res, next) { next(); };\n }", "title": "" }, { "docid": "58f842af5f4954c1bd0c5ea7b811e8e3", "score": "0.6042836", "text": "appRoutes() {\n const v1 = express.Router();\n this.app.use('/api', v1);\n v1.use('/ps', require('./parkingSlot'));\n v1.use('/user', require('./user'));\n }", "title": "" }, { "docid": "4f8c709651b1869298dd7fee0560e532", "score": "0.5995898", "text": "routes() {\n this.server.use(routes);\n }", "title": "" }, { "docid": "4f8c709651b1869298dd7fee0560e532", "score": "0.5995898", "text": "routes() {\n this.server.use(routes);\n }", "title": "" }, { "docid": "6ae826d6468eb11e0cd9f5b80c33aa89", "score": "0.5995379", "text": "function unsecuredRoute(seneca, options, context, method, middleware, route) {\n const routeArgs = [route.path].concat(middleware).concat([\n (request, reply, next) => {\n handleRoute(seneca, options, request, reply, route, next)\n }\n ])\n\n context[method].apply(context, routeArgs)\n}", "title": "" }, { "docid": "6c0f2e3cc87e32c938d6673a7bcc610d", "score": "0.59723115", "text": "function unifiedServer (req, res) {\n // Get URL and parse it.\n let parsedUrl = url.parse(req.url, true);\n\n // Get path from URL.\n let path = parsedUrl.pathname;\n let trimmedPath = path.replace(/^\\/+|\\/+$/g, '');\n\n // Get query string as an object.\n let queryStringObject = parsedUrl.query;\n\n // Get HTTP method.\n let method = req.method.toLowerCase();\n\n // Get headers as an object.\n let headers = req.headers;\n\n // Get payload if there is any.\n let decoder = new StringDecoder('utf-8');\n let buffer = '';\n\n req.on('data', data => {\n buffer += decoder.write(data);\n });\n\n req.on('end', () => {\n buffer += decoder.end();\n\n // Choose handler this request should go to.\n let chosenHandler = typeof(router[trimmedPath]) !== 'undefined' ? router[trimmedPath] : handlers.notFound;\n\n // Construct data object to send to handler.\n let data = {\n trimmedPath: trimmedPath,\n queryStringObject: queryStringObject,\n method: method,\n headers: headers,\n payload: buffer\n };\n\n // Route request to handler specified in the router.\n chosenHandler(data, (statusCode, payload) => {\n // Use the status code called back to the handler or default to 200.\n statusCode = typeof statusCode === 'number' ? statusCode : 200;\n\n // Use the payload called back by the handler, or default to an empty object.\n payload = typeof payload === 'object' ? payload : {};\n\n // Convert payload to string.\n let payloadString = JSON.stringify(payload);\n\n // Return response.\n res.setHeader('Content-Type', 'application/json');\n res.writeHead(statusCode);\n res.end(payloadString);\n\n // Log request path.\n console.log('Returning this response:', statusCode, payloadString);\n });\n });\n}", "title": "" }, { "docid": "94483e6486ff50113431c2c4688ae6de", "score": "0.5949923", "text": "init() {\n moduleUtils$1.patchModule(\n 'express',\n 'init',\n expressWrapper,\n express$$1 => express$$1.application\n );\n moduleUtils$1.patchModule(\n 'express',\n 'listen',\n expressListenWrapper,\n express$$1 => express$$1.application\n );\n moduleUtils$1.patchModule(\n 'express',\n 'use',\n useWrapper,\n express$$1 => express$$1.Router\n );\n // Loop over http methods and patch them all with method wrapper\n for (let i = 0; i < methods$1.length; i += 1) {\n moduleUtils$1.patchModule(\n 'express',\n methods$1[i],\n methodWrapper,\n express$$1 => express$$1.Route.prototype\n );\n }\n }", "title": "" }, { "docid": "c0223bc69e4f74a72b0860b7c42dc4d3", "score": "0.59447014", "text": "function defineRoutes(){\n app.get(\"/\", function(req, res){\n res.writeHead(200, {\"Content-Type\": \"text/plain\"});\n res.write(\"Hey, you are an awesome developer!\");\n res.end();\n });\n\n app.use(function(req, res, next){\n if (/^\\/\\d+/.test(req.url)) {\n req.url = req.url + \".html\";\n }\n next();\n });\n\n app.use(express.static(__dirname));\n\n}", "title": "" }, { "docid": "6e1cffe2e248d8b0942c09ff7b6f8734", "score": "0.5922705", "text": "function main(app) {\n app.use('/foo', fooRoutes);\n\n // Don't forget to link your additonal routes here\n}", "title": "" }, { "docid": "7f9ef78f9ab8c46d63bafef488e5531b", "score": "0.5907787", "text": "function expressHtmlRoutes() {\r\n app.use(\"/\", htmlRoutes);\r\n}", "title": "" }, { "docid": "0f91fd346581218da004cfeba6e59f39", "score": "0.58956647", "text": "function interceptExpress (express) {\n var expressWrapper = function () {\n var app = express.apply(this, arguments);\n\n app.use(glimpseMiddleware);\n\n return app;\n };\n for (var k in express) {\n expressWrapper[k] = express[k];\n }\n return expressWrapper;\n}", "title": "" }, { "docid": "ac5d5aba0235ac8566dec88bbf6848dd", "score": "0.58947754", "text": "chooseRoute(req, res) {\n let method = req.method;\n let pathToSkip = req.pathname;\n // if(path.extname(pathToSkip)) {\n // pathToSkip = req.pathname.replace(/\\.[^.]*$/, \"\");\n // }\n // console.log(pathToSkip, req.pathname)\n let foundStaticRoute = this.statics.find(route => {\n let regexResult = route.routePattern.match(pathToSkip);\n if (regexResult) {\n return route;\n }\n });\n // check if found staticsroute is exist\n if (foundStaticRoute) {\n return foundStaticRoute.handle({ Router: this, req, res });\n }\n else {\n let matchedRoute;\n switch (method) {\n case \"get\":\n matchedRoute = this.statics.find(route => route.routePattern.match(pathToSkip));\n case \"get\":\n matchedRoute = this.getRouters.find(route => route.routePattern.match(pathToSkip));\n break;\n case \"post\":\n matchedRoute = this.postRouters.find(route => route.routePattern.match(pathToSkip));\n break;\n case \"delete\":\n matchedRoute = this.deleteRouters.find(route => route.routePattern.match(pathToSkip));\n break;\n case \"put\":\n matchedRoute = this.putRouters.find(route => route.routePattern.match(pathToSkip));\n break;\n case \"patch\":\n matchedRoute = this.patchRouters.find(route => route.routePattern.match(pathToSkip));\n break;\n default:\n res.status(404);\n return this.errorPage(req, res);\n }\n if (matchedRoute) {\n let params = matchedRoute.routePattern.match(pathToSkip);\n req.params = params;\n // call handle function\n return matchedRoute.handle({ Router: this, req: req, res: res });\n }\n else {\n res.status(404);\n // return error page\n return this.errorPage(req, res);\n }\n }\n }", "title": "" }, { "docid": "86b45a576440e8435370b4477812abdb", "score": "0.5866435", "text": "function middleware(req, res, next) {\n const ns = namespace();\n ns.run(() => next());\n}", "title": "" }, { "docid": "9910417dd618a2810de8666760bf31f1", "score": "0.5850584", "text": "routes() {\n this.app.use(indexRoutes_2.default);\n // this.app.use('/api/query', queryRoutes);\n }", "title": "" }, { "docid": "8c3e6b9fda633e197ac61f78321dd3b8", "score": "0.58331674", "text": "useRoutes(routes) {\n routes.forEach(route => {\n this.app.use('/api', this.allowCrossDomain, route.router);\n });\n }", "title": "" }, { "docid": "ac4422460f9e221d7987818a8c0adc41", "score": "0.5816841", "text": "setupRoutes() {\n let expressRouter = express.Router()\n\n for (let route of this.router) {\n let methods\n let middleware\n if(typeof(route[1]) === 'string') {\n methods = route[1].toLowerCase().split(',')\n middleware = route.slice(2)\n } else {\n methods = ['get']\n middleware = route.slice(1)\n }\n for (let method of methods) {\n expressRouter[method.trim()](route[0], middleware.map(this.errorWrapper))\n }\n }\n this.app.use(this.config.mountPoint, expressRouter)\n }", "title": "" }, { "docid": "61db02f642ce729b382c4170ef1878df", "score": "0.58021975", "text": "appRoutes() {\n this.app.get('/v1.0/users/testapi', routeHandler.testApi);\n }", "title": "" }, { "docid": "2c0d3a4ac07dcdfa655eee9deea874fe", "score": "0.57998425", "text": "routes() {\n\n\n /* // get \n this.app.get('/api', (req, res) => {\n // res.send('Hello World');\n res.json({\n msg:'get API'\n });\n });\n\n // put \n this.app.put('/api', (req, res) => {\n // res.send('Hello World');\n res.status(400).json({\n msg:'put API'\n });\n });\n\n // post \n this.app.post('/api', (req, res) => {\n // res.send('Hello World');\n res.status(201).json({\n msg:'post API'\n });\n });\n\n // delete \n this.app.delete('/api', (req, res) => {\n // res.send('Hello World');\n res.json({\n msg:'delete API'\n });\n }); */\n\n this.app.use(this.usuariosPath, require('../routes/usuarios'));\n }", "title": "" }, { "docid": "240f8666bfe2ea2ef0fe692bde58e592", "score": "0.57980174", "text": "baseMiddleware(req, res, next) {\n req.message = 'This middleware runs for every route';\n next();\n }", "title": "" }, { "docid": "29f7b1afe1d794c3734eb92e540f95f0", "score": "0.57970196", "text": "routes() {\n const router = Reflect.getMetadata('$router.router', router_1.default);\n const routePath = Reflect.getMetadata('$router.path', router_1.default);\n this.app.use(routePath, router);\n const pathToClient = path.join(__dirname, '../../../client/src');\n this.app.use(express.static(pathToClient));\n // tslint:disable-next-line\n this.app.get('*', function catchAll(req, res) {\n res.sendFile(path.join(pathToClient, 'index.html'));\n });\n }", "title": "" }, { "docid": "6bd5e5a23b2940ed628c15c1e50836f1", "score": "0.5792007", "text": "static getMiddlewareRoutes(port) {\n\t\tvar router = express.Router();\n\n\t\t// Allow CORS.\n\t\trouter.use(cors({\n\t\t\torigin: `http://localhost:${port}`\n\t\t}));\n\n\t\t// Static Routes.\n\t\trouter.use('/assets', express.static(path.join(__dirname, '../public')));\n\t\trouter.use('/dist', express.static(path.join(__dirname, '../dist')));\n\t\trouter.use(bodyParser.urlencoded({\n\t\t\textended: true\n\t\t}));\n\n\t\t// Cookie Parser creates req.session in express-session.\n\t\tlet secure = process.env.URL.includes('https') ? true : false;\n\t\trouter.use(bodyParser.json());\n\t\trouter.use(cookieParser());\n\t\tif (mongoose.connection !== undefined) {\n\t\t\trouter.use(session({\n\t\t\t\tsecret: process.env.SESSION_SECRET,\n\t\t\t\tresave: false,\n\t\t\t\tsaveUninitialized: false,\n\t\t\t\tcookie: {\n\t\t\t\t\tsecure,\n\t\t\t\t\tmaxAge: 2 * 60 * 60 * 1000\n\t\t\t\t},\n\t\t\t\tstore: new MongoStore({\n\t\t\t\t\tmongooseConnection: mongoose.connection\n\t\t\t\t})\n\t\t\t}));\n\t\t}\n\t\treturn router;\n\t}", "title": "" }, { "docid": "bc9a594ee85679fee45960026df72313", "score": "0.5790377", "text": "function expressInit(app) {\n //aditional app Initializations\n app.use(bodyParser.urlencoded({\n extended: false\n }));\n app.use(bodyParser.json());\n app.use(methodOverride());\n app.use(cookieParser());\n // Initialize passport and passport session\n app.use(passport.initialize());\n //initialize morgan express logger\n // NOTE: all node and custom module requests\n if (true) {\n app.use(morgan('dev', {\n skip: function (req, res) { return res.statusCode < 400; }\n }));\n }\n app.use(session({\n secret: config_1.default.sessionSecret,\n saveUninitialized: true,\n resave: false,\n store: new MongoStore({\n mongooseConnection: mongoose.connection\n })\n }));\n //sets the routes for all the API queries\n routes_1.default(app);\n var dist = fs.existsSync('dist');\n //exposes the client and node_modules folders to the client for file serving when client queries \"/\"\n app.use('/node_modules', express.static('node_modules'));\n app.use('/custom_modules', express.static('custom_modules'));\n app.use(express.static(\"\" + (dist ? 'dist/client' : 'client')));\n app.use('/public', express.static('public'));\n //exposes the client and node_modules folders to the client for file serving when client queries anything, * is a wildcard\n app.use('*', express.static('node_modules'));\n app.use('*', express.static('custom_modules'));\n app.use('*', express.static(\"\" + (dist ? 'dist/client' : 'client')));\n app.use('*', express.static('public'));\n // starts a get function when any directory is queried (* is a wildcard) by the client, \n // sends back the index.html as a response. Angular then does the proper routing on client side\n if (false)\n app.get('*', function (req, res) {\n res.sendFile(path.join(process.cwd(), \"/\" + (dist ? 'dist/client' : 'client') + \"/index.html\"));\n });\n return app;\n}", "title": "" }, { "docid": "6aa5c903f79ffb4282ba3d7e202828f1", "score": "0.57662416", "text": "removeMiddleware (stack, route) {\r\n const index = stack.findIndex(mw => mw.route === route)\r\n stack.splice(index, 1)\r\n }", "title": "" }, { "docid": "f32ca9a3388629193fa93de4e086e03f", "score": "0.575205", "text": "function addRouteMethods(app) {\n METHODS.forEach(function(method) {\n var methodName = method === 'DELETE' ? 'del' : method.toLowerCase()\n routes[method] = []\n\n app.__proto__[methodName] = function() {\n var path = arguments[0]\n , fns = Array.prototype.slice.call(arguments, 1)\n , params = []\n , regexp = path\n .replace(/\\//g, '\\\\/')\n .replace(/:(\\w+)/g, function(match, $1) {\n params.push($1)\n return '([^\\\\/]+)'\n })\n\n if (regexp[regexp.length-1] !== '/') regexp += '\\\\/'\n regexp = '^' + regexp + '$'\n\n routes[method].push({\n fns : fns,\n path : path,\n regexp : new RegExp(regexp, 'i'),\n method : method,\n params : params\n })\n } \n })\n }", "title": "" }, { "docid": "ca1a652f8eea8a576215e1d4113ac141", "score": "0.57461524", "text": "function app() {\n var preRouteHandlers = [];\n var result = express();\n result.__hasParentApp = false;\n result.voidHandler = function (handler) {\n preRouteHandlers.push(void_handler_1.VoidHandlerUtil.toSafeRequestVoidHandler(handler));\n return result;\n };\n result.errorVoidHandler = function (handler) {\n preRouteHandlers.push(void_handler_1.VoidHandlerUtil.toSafeErrorVoidHandler(handler));\n return result;\n };\n result.valueHandler = function (handler) {\n preRouteHandlers.push(value_handler_1.ValueHandlerUtil.toSafeRequestVoidHandler(handler));\n return result;\n };\n result.errorValueHandler = function (handler) {\n preRouteHandlers.push(value_handler_1.ValueHandlerUtil.toSafeErrorVoidHandler(handler));\n return result;\n };\n result.asyncVoidHandler = function (handler) {\n preRouteHandlers.push(async_void_handler_1.AsyncVoidHandlerUtil.toSafeRequestVoidHandler(handler));\n return result;\n };\n result.asyncErrorVoidHandler = function (handler) {\n preRouteHandlers.push(async_void_handler_1.AsyncVoidHandlerUtil.toSafeErrorVoidHandler(handler));\n return result;\n };\n result.asyncValueHandler = function (handler) {\n preRouteHandlers.push(async_value_handler_1.AsyncValueHandlerUtil.toSafeRequestVoidHandler(handler));\n return result;\n };\n result.asyncErrorValueHandler = function (handler) {\n preRouteHandlers.push(async_value_handler_1.AsyncValueHandlerUtil.toSafeErrorVoidHandler(handler));\n return result;\n };\n result.createSubApp = function (path) {\n var subApp = app();\n result.use((typeof path == \"string\") ?\n path\n .replace(/\\/{2,}/g, \"/\")\n .replace(/\\/$/g, \"\") :\n \"/\", subApp);\n for (var _i = 0, preRouteHandlers_1 = preRouteHandlers; _i < preRouteHandlers_1.length; _i++) {\n var handler = preRouteHandlers_1[_i];\n if (void_handler_1.VoidHandlerUtil.isSafeRequestVoidHandler(handler)) {\n subApp.voidHandler(handler);\n }\n else {\n subApp.errorVoidHandler(handler);\n }\n }\n return subApp;\n };\n result.createRouter = function (path) {\n var r = router_1.router();\n result.use((typeof path == \"string\") ?\n path\n .replace(/\\/{2,}/g, \"/\")\n .replace(/\\/$/g, \"\") :\n \"/\", r);\n for (var _i = 0, preRouteHandlers_2 = preRouteHandlers; _i < preRouteHandlers_2.length; _i++) {\n var handler = preRouteHandlers_2[_i];\n if (void_handler_1.VoidHandlerUtil.isSafeRequestVoidHandler(handler)) {\n r.voidHandler(handler);\n }\n else {\n r.errorVoidHandler(handler);\n }\n }\n return r;\n };\n result.createRoute = function (routeDeclaration) {\n return route_1.route(routeDeclaration, result, preRouteHandlers);\n };\n var originalUse = result.use.bind(result);\n result.use = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {\n var arg = args_1[_a];\n if (arg != undefined && arg.__hasParentApp === true) {\n throw new Error(\"Attempt to use sub-app/router already used by an app\");\n }\n }\n return originalUse.apply(void 0, args);\n };\n return result;\n}", "title": "" }, { "docid": "abd7f371cc956100fdc17c21abd50b19", "score": "0.57436913", "text": "function router (req, res, next) { // 13 // 601\n //XXX this assumes no other routers on the parent stack which we should probably fix // 14 // 602\n router.dispatch(req.url, { // 15 // 603\n request: req, // 16 // 604\n response: res // 17 // 605\n }, next); // 18 // 606\n } // 19 // 607", "title": "" }, { "docid": "53b35e67fceef1c912c11d96705f888c", "score": "0.5738134", "text": "function applicationRoutes() {\n app.get('/login', login);\n\n app.get('/adminClient', (req, res) => renderAdminClient(res, 'we will have result here'));\n\n app.get('/adminApi', (req, res) => {\n let render = renderAdminClient.bind(null, res);\n adminClient[req.query.api]()\n .then(render)\n .catch(render);\n });\n\n //get all permissions\n app.get('/permissions', (req, res) => {\n keyCloak.getAllPermissions(req)\n .then(json => res.json(json))\n .catch(error => res.end('error ' + error));\n });\n\n // check a specified permission\n app.get('/checkPermission', (req, res) => {\n keyCloak.checkPermission(req, 'res:customer', 'scopes:create')\n .then(() => res.end('permission granted'))\n .catch(error => res.end('error ' + error));\n });\n}", "title": "" }, { "docid": "8b0b8ee260bbabd48681bec7e37059f6", "score": "0.5732139", "text": "function routes(req, res) {\n const path = req.url;\n let path = require('path');\n\n}", "title": "" }, { "docid": "4c28e43a944f2d2ae602b1a49b81d13b", "score": "0.5722772", "text": "function patchMiddleware(router, method) {\n var originalCallback = router[method];\n router[method] = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return originalCallback.call.apply(originalCallback, (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__spread)([this], wrapMiddlewareArgs(args, method)));\n };\n return router;\n}", "title": "" }, { "docid": "0550104f6ac9bf2ae79c79275227042d", "score": "0.5719383", "text": "function page40() {\n var app = require('express')();\n require('express-reverse')(app);\n app.get('test', '/hello', function (req, res) {\n res.end('hello');\n });\n app.listen(3000);\n}", "title": "" }, { "docid": "ad5af0d88b0a04187055b0b82dab7e2b", "score": "0.5717631", "text": "function resetUriRouteHandlers() {\n /**\n * URIs can point to many different things, and this list will probably grow.\n * @type {[{when: RegExp, html: function, json: function}]}\n */\n uriRoutes = [\n {\n when: /\\/pages\\//,\n html: function (uri, res) {\n\n // ignore version if they are editing; default to 'published'\n if (!res.req.query.edit) {\n uri = references.replaceVersion(uri, uri.split('@')[1] || 'published');\n }\n\n return renderPage(uri, res);\n },\n json: getPageData\n }, {\n when: /\\/components\\//,\n html: renderComponent,\n json: components.get\n }, {\n when: /\\/uris\\//,\n html: renderUri,\n json: db.get\n }];\n}", "title": "" }, { "docid": "41be319bd5dc983505b7d9ec525fb27c", "score": "0.57130027", "text": "routes() {\n this.app.use('/api/categoria',categoria);\n this.app.use('/api/usuario',usuario); \n this.app.use('/api/articulo',articulo); \n this.app.use('/api/compra',compra); \n this.app.use('/api/persona',persona); \n this.app.use('/api/venta',venta); \n }", "title": "" }, { "docid": "aee192c72605e652f825126d8b410090", "score": "0.5710618", "text": "async function middleware(ctx, next) {\n\t// Reutrn 404 on reserved routes.\n\tif (checkUrl(ctx, '/api')) return;\n\tif (checkUrl(ctx, '/api-explorer')) return;\n\tif (checkUrl(ctx, '/koa-oai-router')) return;\n\n\t// Reutrn 404 for public and web folders.\n\tif (checkUrl(ctx, '/uploads')) return;\n\n\t// Proceed for other routes.\n\tawait next();\n}", "title": "" }, { "docid": "4bab62e576ff1e3f80be46b00d128cfa", "score": "0.5705656", "text": "initRoutes(expressApp) {\n //Register, update, or delete user\n this.expressRouter.put('/', (req, res) => __awaiter(this, void 0, void 0, function* () { return this.registerNewUser(req, res); }));\n this.expressRouter.head('/:username', (req, res) => __awaiter(this, void 0, void 0, function* () { return this.isUsernameAvailable(req, res); }));\n this.expressRouter.get('/:identifier', (req, res) => __awaiter(this, void 0, void 0, function* () { return this.findUser(req, res); }));\n expressApp.use('/users/', this.expressRouter);\n }", "title": "" }, { "docid": "eead0ff6456947c7e9266fb5795e37b1", "score": "0.57027483", "text": "function App() {\n if (!(this instanceof App)) return new App();\n EE.call(this);\n\n var app = this;\n this.__middleware = [];\n this.__routes = [];\n this.__wshandlers = [];\n this.fixedHeader = {};\n\n // The request handler\n this.on('request', function(req, res) {\n var mqueue = app.__middleware.slice(),\n rqueue = app.__routes.slice(),\n probe = req.method.toLowerCase() === 'options';\n Object.assign(req,url.parse(req.url));\n Object.keys(app.fixedHeader).forEach(function(key) {\n res.setHeader(key,app.fixedHeader[key]);\n });\n req.body = [];\n req.on('data', function(chunk) {\n req.body.push(chunk);\n }).on('end', function() {\n var params = decodeQuery(req.query||''),\n handlerParams = {},\n allowedMethods = [];\n if ( req.body.length ) {\n req.body = Buffer.concat(req.body);\n } else {\n req.body = new Buffer(0);\n }\n var bodyParams;\n try {\n bodyParams = JSON.parse(req.body.toString());\n } catch(e) {\n try {\n bodyParams = decodeQuery(req.body.toString());\n } catch(e) {\n bodyParams = {};\n }\n }\n Object.assign(params,bodyParams);\n (function next() {\n var handler = mqueue.shift(),\n mw = !!handler;\n handler = handler || rqueue.shift();\n if(!handler) {\n if ( probe && !res.finished ) {\n allowedMethods = [].concat.apply([],allowedMethods.map(toUpperCase));\n allowedMethods = allowedMethods.filter(function(item,pos) {\n return allowedMethods.indexOf(item) === pos;\n });\n if(!allowedMethods.length) {\n allowedMethods = ['GET','POST','PUT','DELETE'];\n }\n res.setHeader('Access-Control-Allow-Headers', '*');\n res.setHeader('Access-Control-Allow-Origin' , '*');\n res.setHeader('Access-Control-Allow-Method' , allowedMethods);\n res.end();\n }\n return;\n }\n if ( res.finished ) return;\n if ( 'function' === typeof handler ) handler = { callback: handler };\n if ( 'function' !== typeof handler.callback ) return next();\n if ( Array.isArray(handler.methods) && (!probe) ) {\n if ( handler.methods.indexOf(req.method.toLowerCase()) < 0 ) {\n return next();\n }\n }\n if ( handler.route ) {\n if ( handler.route instanceof Route ) {\n handlerParams = handler.route.match(req.pathname);\n if ( handlerParams === false ) return next();\n } else if ( handler.route instanceof RegExp ) {\n if ( !handler.route.test(req.pathname) ) return next();\n }\n }\n req.params = Object.assign({},params,handlerParams);\n if ( probe && !mw ) {\n allowedMethods.push( Array.isArray(handler.methods) ? handler.methods : ['get','post','put','delete'] );\n next();\n } else if (!res.finished) {\n var result = handler.callback( req, res, next );\n if ( result && result.then ) return result.then(next);\n }\n })();\n });\n });\n\n // Act on new sockets\n // Attaches all event listeners to the socket\n this.on('websocket', function(socket) {\n app.__wshandlers.forEach(function( handler ) {\n socket.on(handler.event,handler.callback.bind(undefined,socket));\n });\n });\n}", "title": "" }, { "docid": "6194d71df57e61678a0350bcbe218496", "score": "0.5698112", "text": "setGetLogoutRouter(app) {\n // Logout router\n app.get('/logout', function(req, res) {\n req.session.reset();\n res.redirect('/login');\n });\n\n }", "title": "" }, { "docid": "69ca767e5704047ef5985c7f62547c9f", "score": "0.5685222", "text": "delete(req, res) {\n\n }", "title": "" }, { "docid": "72a5a13698d25cd5b4c64d301829f875", "score": "0.56851006", "text": "function handleRoute (req, resp){\n console.log(req.method, req.url);\n \n var parsedUrl = url.parse(req.url);\n var pathname = parsedUrl.pathname;\n \n if(req.method.toUpperCase() === 'GET'){\n // assume is a resource static file. ///////\n return function(done){\n done = done || function(){};\n var file = pathname === '/' ? 'index.html' : pathname;\n \n // test if we have a file to serve \n if(!/\\..+$/g.test(file)){\n resp.writeHead(404); \n return resp.end(`resource ${file} not found.`);\n }\n \n respWriteFile(file, resp, done);\n };\n }\n \n resp.writeHead(404); \n resp.end(`invalid route ${pathname}`);\n}", "title": "" }, { "docid": "70f3933e617e04c394df7ddbdb009a84", "score": "0.5684636", "text": "appRoutes(){\n\n\t\tthis.app.post('/singup', (request, response) => {\n\t\t\trouteHandler.singupRouteHandler(request, response);\n\t\t});\n\t}", "title": "" }, { "docid": "bcfc1e37de39c3ae43409942cb7e03a4", "score": "0.56703126", "text": "function _preventAccess(req, res, next) {\n\t\tnext(new oars.restify.NotAcceptableError());\n\t}", "title": "" }, { "docid": "6ff0140e8c7add23733ad668975f3b3e", "score": "0.56696177", "text": "function patchMiddleware(router, method) {\n var originalCallback = router[method];\n\n router[method] = function () {\n var args = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n\n return originalCallback.call.apply(originalCallback, (0, _tslib.__spread)([this], wrapMiddlewareArgs(args, method)));\n };\n\n return router;\n}", "title": "" }, { "docid": "8c16bf6134d2d7061ac56c265df7cffd", "score": "0.5665893", "text": "initGlobalMiddleware() {\n this.express.use(express.json());\n }", "title": "" }, { "docid": "7c67ec3d6432e5e900c1837d8453a9ff", "score": "0.56618667", "text": "function requestRouter (req, res) {\n\n var route = req.method.toUpperCase() + ':' + $url.parse(req.url).pathname;\n self.logger.debug('Checking route: ' + route);\n\n if (routes.direct.hasOwnProperty(route)) {\n invokeRoute(routes.direct[route], req, res);\n }\n else {\n var match;\n var handler;\n for (var idx = 0; idx < routes.pattern.length && !match; idx++) {\n match = routes.pattern[idx].match(route);\n if (match) {\n handler = routes.pattern[idx].handler;\n }\n }\n\n if (typeof handler !== 'undefined') {\n invokeRoute(handler, req, res, match);\n }\n else {\n res.writeHead(404, 'Not found', {\n 'Access-Control-Allow-Origin': '*'\n });\n res.write('Could not open ' + req.url, function () {\n res.end();\n });\n }\n }\n\n }", "title": "" }, { "docid": "94b91f10b461d278190be6187ea5af71", "score": "0.56520694", "text": "function attachLegacyRoute({\n expressApp,\n method,\n path,\n controllerFile,\n features,\n}) {\n expressApp[method](path, function endpointHandler(req, res) {\n req.mergedParams = { ...req.params, ...req.query };\n\n return controllerFile.controller(req, req.mergedParams, res, features);\n });\n}", "title": "" }, { "docid": "4e3b9032432add6b6c313769099a1ba0", "score": "0.5647404", "text": "function noop(req, res, next) {\n next();\n}", "title": "" }, { "docid": "d5da2343a9f9ffa31629d1a9c7383e50", "score": "0.56415814", "text": "handleNotFound() {\n\t\tconst { app } = this;\n\t\tapp.use(function(req, res, next){\n\t\t\tconst err = new Error('Not Found');\n\t\t err.status = 404;\n\t\t next(err);\n\t\t})\n\t}", "title": "" }, { "docid": "9c8e3358b7e1a291d7df61f4616691b7", "score": "0.5603945", "text": "function addRoute(path, event){\n app.get(path, function(req, res){\n piEmitter.emit('send', {event: event});\n res.send();\n }); \n}", "title": "" }, { "docid": "049ac3d305048873fe0c21eb71aa9386", "score": "0.5601042", "text": "use (route, fn, verb) {\r\n return this.server.use(route, fn, verb)\r\n }", "title": "" }, { "docid": "e991e377cb44824294a3b82dfb38a5cf", "score": "0.5600175", "text": "deleteRoutes() {\n const {\n app,\n api: {\n utils: { debug },\n },\n } = this;\n let startIndex = null;\n let endIndex = null;\n app._router.stack.forEach((item, index) => {\n if (item.name === 'MOCK_START') startIndex = index;\n if (item.name === 'MOCK_END') endIndex = index;\n });\n if (startIndex !== null && endIndex !== null) {\n app._router.stack.splice(startIndex, endIndex - startIndex + 1);\n }\n debug(\n `routes after changed: ${app._router.stack\n .map(item => item.name || 'undefined name')\n .join(', ')}`,\n );\n }", "title": "" }, { "docid": "6478f798314117f6f6218479773b2fba", "score": "0.5587473", "text": "[wrapWithExpressNext](handler) {\n if (handler instanceof Promise) {\n throw new ContentError('Express handlers need to be (req, res, next) or aysnc (req, res, next)')\n }\n\n if (handler.constructor.name !== 'AsyncFunction') {\n return handler\n }\n\n return (req, res, nextOriginal) => {\n // preventing double call on next()\n let nextCalled = false\n const next = (...args) => {\n if (nextCalled === true) {\n return\n }\n nextCalled = true\n\n nextOriginal(...args)\n }\n\n // express can't take in a promise (async func), so have to proxy it\n const handlerProxy = async callback => {\n try {\n await handler(req, res, callback)\n } catch(err) {\n callback(err)\n }\n }\n\n handlerProxy(err => next(err))\n }\n }", "title": "" }, { "docid": "0363e3070aae68f0d1a9cf77a6ab4605", "score": "0.55838466", "text": "appRoutes(){\n\t\tthis.app.post('/usernameAvailable', routeHandler.userNameCheckHandler);\n\n\t\tthis.app.post('/register', routeHandler.registerRouteHandler);\n\n\t\tthis.app.post('/login', routeHandler.loginRouteHandler);\n\n\t\tthis.app.post('/userSessionCheck', routeHandler.userSessionCheckRouteHandler);\n\n\t\tthis.app.post('/getMessages', routeHandler.getMessagesRouteHandler);\n\n\t\tthis.app.get('*', routeHandler.routeNotFoundHandler);\t\t\n\t}", "title": "" }, { "docid": "ea3ec452ea82e1340bf4cc33f41ca179", "score": "0.55638194", "text": "function handleRouterMethods(router) {\n overrideMethod(router, \"use\", routerMiddleware);\n overrideMethod(router, 'get', routerHttpMethods);\n overrideMethod(router, 'post', routerHttpMethods);\n overrideMethod(router, 'put', routerHttpMethods);\n overrideMethod(router, 'delete', routerHttpMethods);\n }", "title": "" }, { "docid": "ef97073126df102a725939b7c9105d8f", "score": "0.5558505", "text": "function handleRouting(req, res, next){\n\n let location = new Location(req.path, req.query);\n let store = finalCreateStore( composedReducers );\n let childRoutes = routes(store);\n\n Router.run( childRoutes, location, (error, initialState, transition) => {\n\n // 如果找不到 match 的 route,也可噴錯,丟出去給外層處理\n // return next('err msg: route not found');\n\n // 找不到 match 的 routing,就丟出去給外層處理\n /*if(transition.isCancelled){\n return next();\n }*/\n\n var markup = ReactDOM.renderToString(\n <Provider store={store}>\n <Router {...initialState} />\n </Provider>,\n );\n\n\n let state = JSON.stringify(store.getState());\n\n var str = index\n .replace('${markup}', markup)\n .replace('${state}', state);\n\n // console.log( '\\n生成 markup:\\n', str );\n\n // 將組合好的 html 字串返還,request 處理至此完成\n res.send(str);\n });\n\n\n}", "title": "" }, { "docid": "3208e15667864f18d17b886da66fe4ef", "score": "0.5540999", "text": "function patchMiddleware(app, method) {\n var originalAppCallback = app[method];\n app[method] = function () {\n // eslint-disable-next-line prefer-rest-params\n return originalAppCallback.apply(this, wrapUseArgs(arguments));\n };\n return app;\n}", "title": "" }, { "docid": "205a259d5f7db510f5f0b827d7bd27b1", "score": "0.55166596", "text": "async applyMiddleware(app) {\n let { pathPrefix } = this._adapter;\n if (pathPrefix) {\n pathPrefix = `/${pathPrefix.replace(/^\\/|\\/$/, '')}`;\n }\n const paramParser = (req, res, next) => {\n const [, id] = req.path.split('/');\n req.param = req.params = { id };\n next();\n };\n const requestHandler = this._createHandleRequest();\n if (pathPrefix) {\n app.use(pathPrefix, paramParser, requestHandler);\n }\n else {\n app.use(paramParser, requestHandler);\n }\n // stub to fix subscription registration\n this._currentListenerPort = -1;\n }", "title": "" }, { "docid": "892163ac74f28d4847b8d81473ad4f11", "score": "0.5504876", "text": "function redirectUnmatched(req, res) {\n res.redirect(\"/\");\n}", "title": "" }, { "docid": "892163ac74f28d4847b8d81473ad4f11", "score": "0.5504876", "text": "function redirectUnmatched(req, res) {\n res.redirect(\"/\");\n}", "title": "" }, { "docid": "d50f061142fb5f7993cf8af9823a018f", "score": "0.55041194", "text": "function dispatchRequest (req, res) {\n const parsedUrl = url.parse(req.url);\n const method = req.method.toLowerCase();\n\n const route = routes.find( route => {\n return route.rex.test(parsedUrl.pathname);\n });\n\n if (route) {\n // Only if route.methods[method] is falsy in the JavaScript sense, we respond with 405\n const handler = route.methods[method] || get405;\n handler(req, res);\n } else {\n get404(req, res);\n }\n}", "title": "" }, { "docid": "2d205b050c07926ab0fbbd55a2487980", "score": "0.5502124", "text": "routes() {\n // estou dizendo para ser usada as rotas que estao oriundas do arquivo routes.js\n this.server.use(routes);\n }", "title": "" }, { "docid": "7437c3701be06fb4f53746152656ac2b", "score": "0.5472952", "text": "initializeExpress() {\n // Attach basics Middleware\n\n if (this.config.env === 'dev') {\n this.expressApp.use(errorHandler());\n }\n\n // Body parser\n this.expressApp.use(bodyParser.json());\n this.expressApp.use(bodyParser.urlencoded({ extended: false }));\n\n // Cors\n this.expressApp.use(cors());\n\n // Logging\n this.expressApp.use(morgan('combined', { stream: logger.stream }));\n\n this.expressApp.use(passport.initialize());\n\n // Api docs\n this.expressApp.use('/apidoc', express.static('apidoc'));\n\n // Attach app routes\n this.expressApp.use(router);\n\n this.attachRoutingIssueMiddleware();\n }", "title": "" }, { "docid": "831917b9a99813a132e8e66f20225187", "score": "0.5468104", "text": "function testBadHandler() {\n APP.use(\"/some_dir\", function (req, res, next) {\n throw new Error(\"bad handler was called - as expected\");\n });\n\n var origPath = OPTIONS.path;\n\n OPTIONS.path = \"/some_dir/some_file\";\n generateRequest(function () {});\n\n OPTIONS.path = origPath;\n}", "title": "" }, { "docid": "63a1be2d90f22cf0c091526484b9eaf0", "score": "0.5461688", "text": "function InversifyExpressServer(container, customRouter, routingConfig, customApp) {\n this._container = container;\n this._router = customRouter || express.Router();\n this._routingConfig = routingConfig || {\n rootPath: constants_1.DEFAULT_ROUTING_ROOT_PATH\n };\n this._app = customApp || express();\n }", "title": "" }, { "docid": "4a103e953918530e58f0c290756dd4bc", "score": "0.5459659", "text": "routes(app) {\n app.route('/').get((req, res) => {\n res.status(200).send({\n message: 'GET resquest successfull'\n });\n });\n /********************* Elastic Search routes **********************/\n app.route('/users').get(this.userController.getUsers);\n app.route('/users/user').get(this.userController.getUser);\n app.route('/teams/team').get(this.teamController.getTeam);\n app.route('/teams/team').post(this.teamController.postTeam);\n // app.route('/tl-availability').post(this.eventController.setAvailability);\n /********************* Authentication routes **********************/\n app.route('/api/register').post(this.authController.register); // to handle new users registering\n app.route('/api/login').post(this.authController.login); // to handle returning users logging in\n // app.route('/api/profile/USERID').get();\n // app.get('/profile', auth, this.profileController.profileRead);\n }", "title": "" }, { "docid": "6870b6a2298ea5cdf584525ff3349e2f", "score": "0.5454172", "text": "function bindRoutes() {\n\tcreatePlainRoutes.call(\n\t\tthis, this.apiRoutes.get, this.app.get, this.app\n\t);\n\tcreateContentRoutes.call(\n\t\tthis, this.apiRoutes.post, this.app.post,this.app\n\t);\n\tcreateContentRoutes.call(\n\t\tthis, this.apiRoutes.put, this.app.put, this.app\n\t);\n\tcreateContentRoutes.call(\n\t\tthis, this.apiRoutes.patch, this.app.patch, this.app\n\t);\n\tcreatePlainRoutes.call(\n\t\tthis, this.apiRoutes.del, this.app.del, this.app\n\t);\n}", "title": "" }, { "docid": "8d5539b6f691059a45f4b9ebcfe3219c", "score": "0.54537755", "text": "function historyAPIFallback(req, res, next) {\n\tif (req.method === 'GET' && req.accepts('html')) {\n\t\tres.render('index.html')\n\t} else {\n\t\tnext()\n\t}\n}", "title": "" }, { "docid": "a34d80847ae4ad4c43bed60c0123052c", "score": "0.5451341", "text": "baseExampleMiddleware(req, res, next) {\n req.message += '<br>This middleware only runs from /example<br>';\n next();\n }", "title": "" }, { "docid": "c65325162890acedc32aa5b884475f5d", "score": "0.54501057", "text": "function appRoot(req, res)\n{\n res.send(\"<h1>Hello Bourse Route World!</h1>\")\n}", "title": "" }, { "docid": "6e80687854d129121436b759b1540fd8", "score": "0.54322934", "text": "function addRoutes(api) {\n api.delete('/tests/:id', dropData);\n}", "title": "" }, { "docid": "363d2001a734349ab8285d7da4120c02", "score": "0.5422204", "text": "function globalRouter(req, res) {\n if(req.url === \"/favicon.ico\") return res.end();\n\n var inputMessage = req.url.split(\"/\")\n console.log(inputMessage)\n let webInput = normaliseWebInput(inputMessage);\n input.emit(\"input\", webInput);\n module.exports = input;\n \n if (req.url === \"/\") homeRoute(req, res);\n else exchangeRoute(req,res)\n}", "title": "" }, { "docid": "1341270776dbf9a2e7b4848b3bf36a04", "score": "0.54212415", "text": "routes(){\n this.app.use(this.path.categorias, require('../routes/categorias'));\n this.app.use(this.path.productos, require('../routes/productos'));\n }", "title": "" }, { "docid": "9802ad2bbd94d17a843a1cde72b8abc3", "score": "0.5413063", "text": "function add() {\n var args = [];\n for (var k in arguments){\n if (arguments.hasOwnProperty(k)) {\n args.push(arguments[k]);\n }\n }\n\n var method = args[0];\n var app = args[1];\n var name;\n var path;\n var offset;\n var middlewares;\n\n if (typeof args[3] === 'string') {\n // Name is provided\n name = args[2];\n path = args[3];\n offset = 4;\n\n if (!helper.isValidName(name)) {\n throw new Error('Invalid route name: ' + name);\n }\n } else {\n // No name provided\n path = args[2];\n offset = 3;\n }\n middlewares = helper.flattenDeep(args.slice(offset));\n\n if (!app.routeTraversal) {\n // Singleton for each app\n app.routeTraversal = [];\n }\n\n // Prepare to get deeper\n if (typeof name == 'string') {\n app.routeTraversal.push({\n operation: PUSH,\n name: name,\n path: path\n });\n }\n\n // Method will be null if we use addMapping()\n if (method) {\n // Register this for express to do its stuff\n app[method](path, middlewares);\n\n var routeController = middlewares[middlewares.length - 1];\n if (Array.isArray(routeController.routeTraversal)) {\n /*\n As with our function signature, the last element of the middlewares is assumed to be\n the \"handler\" for the controller logic.\n Even if it is not (could be just a middleware for login guard), then routeController.routeTraversal\n is guaranteed to be undefined, it won't even enter this loop\n */\n for (var i = 0; i < routeController.routeTraversal.length; i++) {\n app.routeTraversal.push(routeController.routeTraversal[i]);\n }\n }\n }\n\n // Finished this stack, prepare to backtrack\n if (typeof name == 'string') {\n app.routeTraversal.push({\n operation: POP,\n name: name,\n path: path\n });\n }\n}", "title": "" }, { "docid": "2b26abb93df315b56780b5c6e030ca1b", "score": "0.5407719", "text": "function initModulesServerRoutes(app) {\n config.files.server.routes.forEach(routePath => {\n require(path.resolve(routePath))(app);\n });\n\n app.route('/*').get(core.renderIndex);\n\n}", "title": "" }, { "docid": "47c684bec083181356fbae5e51c77e05", "score": "0.54071087", "text": "async function route(req){\n routes.add(\n 'GET', \n '/mock', \n async function(){\n return {\n id: 1,\n first: 'Jane',\n last: 'Smith'\n }\n });\n \n return routes.process(\n req\n );\n}", "title": "" }, { "docid": "5eca299950bfb0bbb6e1778cbab1e053", "score": "0.54017407", "text": "use(callback, ...args) {\n this._express.use(callback, ...args);\n }", "title": "" }, { "docid": "2972ff1d7423c46accd21ea3922960d0", "score": "0.5389505", "text": "function routeNotFoundHandler(req, res) {\n\tres.status(HTTP_RESPONSES.NOT_FOUND.code)\n\t\t.send(new FailureAPIResult('not found..!', ERROR_CODES.NOT_FOUND));\n}", "title": "" }, { "docid": "c65bbe870b08a6746985d998feb97523", "score": "0.5384913", "text": "registerRoute(method, route, schema, action) {\n method = method.toLowerCase();\n if (method == 'delete')\n method = 'del';\n // Hack!!! Wrapping action to preserve prototyping context\n let actionCurl = (req, res) => {\n // Perform validation\n if (schema != null) {\n let params = _.extend({}, req.params, { body: req.body });\n let correlationId = params.correlaton_id;\n let err = schema.validateAndReturnException(correlationId, params, false);\n if (err != null) {\n HttpResponseSender_1.HttpResponseSender.sendError(req, res, err);\n return;\n }\n }\n // Todo: perform verification?\n action(req, res);\n };\n // Wrapping to preserve \"this\"\n let self = this;\n this._server[method](route, actionCurl);\n }", "title": "" }, { "docid": "abd16c24080d21107b84924c254b6a9f", "score": "0.53803694", "text": "static getApiRoutes() {\n\t\tvar router = express.Router();\n\t\tvar DBHandler = require('./DBHandler');\n\n\t\tvar dir = fs.readdirSync(path.join(__dirname, './routes'));\n\t\tvar routes = {};\n\t\tdir.forEach(r => {\n\t\t\tvar endpoint = r.replace('.js', '');\n\t\t\trouter.use(`/${endpoint}`, require(`./routes/${r}`));\n\t\t});\n\t\t\n\t\trouter.use((req, res, next) => {\n\t\t\tif ( req.session && 'user' in req.session ) {\n\t\t\t\treq.user = req.session.user.username;\n\t\t\t}\n\t\t\t// res.status(200);\n\t\t\tnext();\n\t\t});\n\n\t\treturn router;\n\t}", "title": "" }, { "docid": "3236f2492bc49ffa2fc143bc3506f2b4", "score": "0.5376365", "text": "routes(){\n this.app.use(this.usersRoute,require('../routes/user.routes'))\n }", "title": "" }, { "docid": "d57ede2a4f92b97496b7ae63cba6f625", "score": "0.5371867", "text": "function apiRoutes() {\n let resourceFiles = fs.readdirSync(path.join(__dirname, resourceDir));\n resourceFiles.forEach(file => {\n if (file !== self) {\n let route = '/' + path.basename(file, '.js');\n let resourceFile = './' + path.join(resourceDir, file);\n let resource = require(resourceFile);\n if (resource.isPrivate) router.use(route, isLoggedIn, resource.router);\n else router.use(route, resource.router);\n register(route, resource.router);\n }\n })\n router.use((req, res, next)=> {\n res.status(404).jsonApi('resource not found');\n })\n// error handler\n router.use(function (err, req, res, next) {\n res.status(500).jsonApi(err)\n });\n return router;\n}", "title": "" }, { "docid": "917d83a14467f19677f2defc2d11e5fd", "score": "0.5365764", "text": "createApp() {\n // Create a new express app\n this.app = express();\n // Log the requests\n this.app.use(function logger(req, res, next) {\n console.log('serving ' + req.url);\n next(); // Passing the request to the next handler in the stack.\n });\n // Configure the static files\n this.app.use(express.static('../app'));\n }", "title": "" }, { "docid": "7a4933ef0894120712142eed23b8d206", "score": "0.5363268", "text": "initMiddleware() {\n const cookieConfig = environmentConfig.get('cookie');\n\n // eslint-disable-next-line no-underscore-dangle\n this.app.use(cookieParser(cookieConfig.signSecret));\n\n this.setupHTTPSHeader();\n\n if (process.env.NODE_ENV !== 'production') {\n headersRoute(this.app);\n setRenderMode(this.app);\n this.app.use(responseTime());\n }\n this.logRequests();\n\n let afterStoreHook = this.afterStoreHook;\n\n this.appRouter.use('/', (req, res, next) => {\n // patch redirect to work with this mounted route\n const orgRedirect = res.redirect;\n /* eslint-disable no-param-reassign */\n res.redirect = (code, url) => {\n if (typeof code === 'string') {\n url = code;\n code = 302;\n }\n\n if (url.startsWith('/')) {\n url = req.baseUrl + url;\n }\n\n orgRedirect.call(res, code, url);\n };\n /* eslint-enable no-param-reassign */\n\n /* eslint-disable max-len */\n if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'localhost') {\n // TODO: find a better way to do this\n // here we can test Account API calls that are normally passed by Edge\n afterStoreHook = (store, req_) => {\n this.afterStoreHook && this.afterStoreHook(store, req_);\n if (typeof req.query.mock !== 'undefined') {\n try {\n this.debug(`Loading \"${req.path}${req.query.mock ? `.${req.query.mock}` : ''}\" mock`);\n } catch (error) {\n console.log(error); // eslint-disable-line no-console\n // ignore\n }\n }\n };\n }\n /* eslint-enable max-len */\n\n this.pageRenderer.handleRequest(req, res, next, {\n afterStoreHook,\n });\n });\n\n this.app.use(WP_DEFINE_PUBLIC_PATH || '/', this.appRouter);\n\n if (serverConfig.useRaven && this.ravenConfig) {\n this.setupRavenErrorHandler();\n }\n\n /* eslint-disable no-unused-vars */\n this.app.use((err, req, res, next) => {\n this.debug('Error during request: ');\n this.debug(err);\n res.sendStatus(HTTP_INTERNAL_SERVER_ERROR);\n });\n /* eslint-enable */\n }", "title": "" }, { "docid": "fe0461956a4db14f7dbb1deb69ab18fd", "score": "0.5358492", "text": "static methodNotAllowed(req, res) {\n res.status(405).json(ResponseHelper.defaultResponse());\n }", "title": "" }, { "docid": "e62eafba44ce764b70419992ae582939", "score": "0.53494245", "text": "router() {\r\n let router = express.Router();\r\n router.post('/add', this.addTask.bind(this));\r\n router.post('/getusers', this.getusers.bind(this));\r\n router.post('/getid', this.getid.bind(this));\r\n router.post('/getdetail', this.getDetails.bind(this));\r\n router.delete('/remove', this.deleteTask.bind(this));\r\n router.put('/adduser', this.addUser.bind(this));\r\n router.put('/removeuser', this.remUser.bind(this));\r\n router.put('/amendname', this.amendName.bind(this));\r\n router.put('/amenddesc', this.amendDesc.bind(this));\r\n router.put('/changelabel', this.changeLabel.bind(this));\r\n router.put('/startproject', this.startProject.bind(this));\r\n router.put('/archiveproject', this.archiveProject.bind(this));\r\n router.put('/phasechange', this.phaseChange.bind(this));\r\n router.put('/amendduedate', this.amendDuedate.bind(this));\r\n router.put('/taskcomplete', this.markCompleted.bind(this));\r\n router.put('/phasecheck', this.phaseCheck.bind(this));\r\n\r\n return router;\r\n }", "title": "" }, { "docid": "2e84171f7082670cf93f12d975c7c214", "score": "0.53417575", "text": "function do404(app) {\n return async function(req, res) {\n const message = `${req.method} not supported for ${req.originalUrl}`;\n const result = {\n status: NOT_FOUND,\n error: { code: 'NOT_FOUND', message, },\n };\n res.status(404).\n\tjson(result);\n };\n}", "title": "" }, { "docid": "2e84171f7082670cf93f12d975c7c214", "score": "0.53417575", "text": "function do404(app) {\n return async function(req, res) {\n const message = `${req.method} not supported for ${req.originalUrl}`;\n const result = {\n status: NOT_FOUND,\n error: { code: 'NOT_FOUND', message, },\n };\n res.status(404).\n\tjson(result);\n };\n}", "title": "" }, { "docid": "fd42091799dc84b62757461af1b795fb", "score": "0.5321505", "text": "addListenStopRoute() {\n this.addJsonRoute('listen/stop', (request, response) => {\n const token = request.body.token;\n const collection = request.body.collection;\n if (!collection) {\n response.status(400).json({\n error: 'Missing collection name'\n });\n\n return;\n }\n\n this.isTokenValid(token).then(valid => {\n if (!valid) {\n response.status(500).json({\n error: 'Invalid token ' + token\n });\n\n return;\n }\n\n const filter = request.body.filter;\n const id = request.body.id;\n this.emit('listen-stop:' + token + ',' + JSON.stringify([collection, id || '', filter || '']));\n\n response.status(200).json({status: 'success'});\n });\n });\n }", "title": "" }, { "docid": "1394176611c69e6df2fd5a812d84b268", "score": "0.53210205", "text": "routes() {\n this.app.use(this.paths.auth, require('../routers/authRouter'));\n this.app.use(this.paths.category, require('../routers/categoriaRouter'));\n this.app.use(this.paths.search, require('../routers/buscadorRouter'));\n this.app.use(this.paths.products, require('../routers/productosRouter'));\n this.app.use(this.paths.user, require('../routers/userRouter'));\n this.app.use(this.paths.upload, require('../routers/uploadRouter'));\n }", "title": "" }, { "docid": "3929f6f07871f9fb9f616127bce09cda", "score": "0.5319172", "text": "function app() {\r\n var args = toArray(arguments)\r\n , type = vartype(args[0])\r\n , re_route = /^(?:([A-Z]+)\\:)?(\\/.*)$/\r\n , matches;\r\n //Shorthand for req.router.addRoute()\r\n if (type == 'regex' || (matches = args[0].match(re_route))) {\r\n var verb;\r\n if (matches) {\r\n verb = matches[1];\r\n args[0] = matches[2];\r\n }\r\n return req.router.addRoute(verb,args[0],args[1]);\r\n }\r\n //Shorthand for server.appvars()\r\n return server.appvars.apply(this,args);\r\n }", "title": "" } ]
e17185dca49376aff3c50c9460a0cf2d
Start section: command_properties End section: command_properties
[ { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.0", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" } ]
[ { "docid": "bd60d896c2b69b374ad0286f33dd97bb", "score": "0.6172143", "text": "get commandJSON() {\n return {\n name: this.commandName,\n description: this.description,\n default_permission: this.defaultPermission,\n ...(this.options ? { options: this.options } : {})\n };\n }", "title": "" }, { "docid": "804a77d68c676aaee6488e01b6fa9301", "score": "0.59094095", "text": "properties(){}", "title": "" }, { "docid": "71a54033aa8984be2ea19ce3abc01f0f", "score": "0.5834599", "text": "setupProperties() {\n }", "title": "" }, { "docid": "5f37fa38b5bd905369ce12213d2bb6ae", "score": "0.5818938", "text": "function Properties(CodeMirror) {\n CodeMirror.defineMode(\"properties\", function() {\n return {\n token: function(stream, state) {\n var sol = stream.sol() || state.afterSection;\n var eol = stream.eol();\n\n state.afterSection = false;\n\n if (sol) {\n if (state.nextMultiline) {\n state.inMultiline = true;\n state.nextMultiline = false;\n } else {\n state.position = \"def\";\n }\n }\n\n if (eol && ! state.nextMultiline) {\n state.inMultiline = false;\n state.position = \"def\";\n }\n\n if (sol) {\n while(stream.eatSpace()) {}\n }\n\n var ch = stream.next();\n\n if (sol && (ch === \"#\" || ch === \"!\" || ch === \";\")) {\n state.position = \"comment\";\n stream.skipToEnd();\n return \"comment\";\n } else if (sol && ch === \"[\") {\n state.afterSection = true;\n stream.skipTo(\"]\"); stream.eat(\"]\");\n return \"header\";\n } else if (ch === \"=\" || ch === \":\") {\n state.position = \"quote\";\n return null;\n } else if (ch === \"\\\\\" && state.position === \"quote\") {\n if (stream.eol()) { // end of line?\n // Multiline value\n state.nextMultiline = true;\n }\n }\n\n return state.position;\n },\n\n startState: function() {\n return {\n position : \"def\", // Current position, \"def\", \"quote\" or \"comment\"\n nextMultiline : false, // Is the next line multiline value\n inMultiline : false, // Is the current line a multiline value\n afterSection : false // Did we just open a section\n };\n }\n\n };\n });\n\n CodeMirror.defineMIME(\"text/x-properties\", \"properties\");\n CodeMirror.defineMIME(\"text/x-ini\", \"properties\");\n\n }", "title": "" }, { "docid": "755ec12134dfb02e11b2b411c7a5a78b", "score": "0.5803472", "text": "function Commands() {\n this.comment = '//';\n this.prefix = 'prefix';\n this.entity = 'entity';\n this.activity = 'activity';\n this.used = 'used';\n this.generation = 'wasGeneratedBy';\n this.assocation = 'wasAssociatedWith';\n this.agent = 'agent';\n this.attributed = 'wasAttributedTo';\n this.derived = 'wasDerivedFrom';\n this.specialised = 'specializationOf';\n this.alternate = 'alternateOf';\n this.group = 'group';\n this.member = 'memberOf';\n this.acted = 'actedOnBehalfOf';\n}", "title": "" }, { "docid": "15cda26ec2db06e43047c4d5dcf15bbc", "score": "0.5797859", "text": "static get properties() {\n return {\n toolParams: {\n type: Object,\n },\n opencgaSession: {\n type: Object,\n },\n title: {\n type: String,\n }\n };\n }", "title": "" }, { "docid": "5c12e4f66ffab7649c4fa83fc13412d7", "score": "0.5757566", "text": "static get properties() {\n return {\n /**\n * the text of the prompt, as in \"Link href\" or \"Image src\"\n */\n prompt: {\n name: \"prompt\",\n type: String,\n value: \"Value\"\n },\n /**\n * the text of the prompt, as in \"Link href\" or \"Image src\"\n */\n target: {\n name: \"target\",\n type: Object,\n value: null\n },\n /**\n * Eco-json-schema of the prompt.\n */\n schema: {\n type: Object,\n value: {\n $schema: \"http://json-schema.org/schema#\",\n title: \"Link\",\n type: \"Object\",\n properties: {\n href: {\n title: \"Href\",\n type: \"Input\",\n value: null\n },\n target: {\n title: \"Target\",\n type: \"Input\",\n value: null\n }\n }\n }\n }\n };\n }", "title": "" }, { "docid": "d25acb9882e320a9fce21430bfe4c9f8", "score": "0.56969017", "text": "static get properties() {\n return {\n /**\n * fields for the prompt popover.\n */\n fields: {\n type: Array,\n value: [\n {\n property: \"text\",\n title: \"Text\",\n description: \"The link text\",\n inputMethod: \"textfield\"\n }\n ]\n },\n /**\n * the tag that will wrap the selection\n */\n tag: {\n name: \"tag\",\n type: String,\n value: \"span\"\n },\n /**\n * The prefilled value of the prompt\n */\n value: {\n type: Object,\n value: {\n link: null\n }\n },\n /**\n * the prompt that pops up when button is pressed\n */\n __prompt: {\n name: \"__prompt\",\n type: Object,\n value: null\n },\n /**\n * the highlight surrounding the selected range\n */\n __selection: {\n name: \"__selection\",\n type: Object,\n value: null\n },\n /**\n * the contents node inside the selected range\n */\n __selectionContents: {\n name: \"__selectionContents\",\n type: Object,\n value: null\n },\n /**\n * the contents node inside the selected range\n */\n __revertContents: {\n name: \"__revertContents\",\n type: Object,\n value: null\n }\n };\n }", "title": "" }, { "docid": "13328759f79e7368e4502935337045fb", "score": "0.5691849", "text": "get properties() {\n\t\treturn [\"allowDrag\",\"animation\",\"applyMode\",\"customOperations\",\"disabled\",\"dropDownWidth\",\"fields\",\"fieldsMode\",\"formatStringDate\",\"formatStringDateTime\",\"getDynamicField\",\"icons\",\"locale\",\"localizeFormatFunction\",\"messages\",\"operatorPlaceholder\",\"propertyPlaceholder\",\"rightToLeft\",\"showIcons\",\"theme\",\"unfocusable\",\"value\",\"valueFormatFunction\",\"valuePlaceholder\"];\n\t}", "title": "" }, { "docid": "de2c2428bfdd7246d5f202c18c3c0935", "score": "0.56454116", "text": "get Command() {return this.#command;}", "title": "" }, { "docid": "faa2798056c82533252d5bb232c3c714", "score": "0.5585204", "text": "function showProperties() {\n\n\t['isSupported', 'isPaired', 'isWatchAppInstalled', 'isComplicationEnabled', 'isReachable', 'recentApplicationContext'].forEach(function (property) {\n\t\tshowProperty(property);\n\t});\n}", "title": "" }, { "docid": "fe2a32f6cf436411835dd64cccc9c1ae", "score": "0.55710375", "text": "static get properties() {\n return {\n color: {\n attribute: \"color\",\n type: String,\n },\n };\n }", "title": "" }, { "docid": "3aec55187f86abe538e817049bc2412d", "score": "0.54920346", "text": "static get properties() {\n return {\n arrow: { type: String },\n text: { type: String },\n error: { type: Boolean }\n };\n }", "title": "" }, { "docid": "a5ba975650f3602b0bfe6f984a03a272", "score": "0.5484965", "text": "_populatePropertySpecs() {\n super._populatePropertySpecs(controlType.verticalLine, 'Static');\n this._addPropertySpecs();\n }", "title": "" }, { "docid": "08be53ed65b0ec731cbc297cbeef65d0", "score": "0.54777914", "text": "function printProperties() {\n Logger.log(JSON.stringify(PropertiesService.getScriptProperties().getProperties()))\n}", "title": "" }, { "docid": "ef8cf4057208e051536f10e53b259953", "score": "0.5476708", "text": "function cfnClusterExecuteCommandConfigurationPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnCluster_ExecuteCommandConfigurationPropertyValidator(properties).assertSuccess();\n return {\n KmsKeyId: cdk.stringToCloudFormation(properties.kmsKeyId),\n LogConfiguration: cfnClusterExecuteCommandLogConfigurationPropertyToCloudFormation(properties.logConfiguration),\n Logging: cdk.stringToCloudFormation(properties.logging),\n };\n}", "title": "" }, { "docid": "45867cf276724f87efa17a0c64b1071f", "score": "0.5469275", "text": "function EfwServerProperties() {\n}", "title": "" }, { "docid": "080fe72ffa48d30515e5f3103b4b431d", "score": "0.54427814", "text": "function properties() {\n var elm, coll;\n var segment, table, tr;\n \n elm = d.find(\"properties\");\n d.clear(elm);\n segment = d.node(\"div\");\n segment.className = \"ui segment\";\n if(g.hal && g.hal.id) {\n links = d.node(\"div\");\n links.id = g.hal.id;\n d.push(links,segment);\n }\n \n table = d.node(\"table\");\n table.className = \"ui very basic collapsing celled table\";\n\n for(var prop of g.fields[g.context]) {\n if(g.hal[prop]) {\n tr = d.data_row({className:\"property \"+prop,text:prop+\"&nbsp;\",value:g.hal[prop]+\"&nbsp;\"});\n d.push(tr,table);\n }\n } \n\n d.push(table,segment);\n d.push(segment,elm);\n\n if (table.hasChildNodes()) {\n elm.style.display = \"block\";\n } else {\n elm.style.display = \"none\";\n }\n\n // emit any item-level links\n if(g.hal && g.hal.id) {\n selectLinks(\"item\",g.hal.id, g.hal);\n }\n }", "title": "" }, { "docid": "64b7862583b8664bb6051f1a767385f7", "score": "0.54409647", "text": "get properties() {\n\t\treturn [\"animation\",\"dataSource\",\"disabled\",\"expandedIndexes\",\"expandMode\",\"locale\",\"localizeFormatFunction\",\"messages\",\"readonly\",\"reorder\",\"rightToLeft\",\"theme\",\"unfocusable\"];\n\t}", "title": "" }, { "docid": "a34a9002a1350604f2ad468101b428b0", "score": "0.5426056", "text": "get properties() { return this._properties; }", "title": "" }, { "docid": "16fcea7f9ef3bdb06ebfdb1a7b10d88c", "score": "0.54203224", "text": "configure() {\n super.configure();\n this.startIds = this.command.startIds;\n this.stopIds = this.command.stopIds;\n }", "title": "" }, { "docid": "c47ef09b530e99f5f718132c7c6c3fd8", "score": "0.5381959", "text": "function ShellCommand() \n{\n // Properties\n this.command = \"\";\n this.description = \"\";\n this.function = \"\";\n}", "title": "" }, { "docid": "c47ef09b530e99f5f718132c7c6c3fd8", "score": "0.5381959", "text": "function ShellCommand() \n{\n // Properties\n this.command = \"\";\n this.description = \"\";\n this.function = \"\";\n}", "title": "" }, { "docid": "fba26ba3a3044882affb82ff32117f2e", "score": "0.53757554", "text": "_buildPropertyProps(properties = {}) {\n const props = {};\n for (const propertyName in properties) {\n const property = properties[propertyName];\n const propData = NOTION_PAGE_PROPERTIES[property.type];\n\n if (!propData) continue;\n\n props[propertyName] = {\n type: propData.type,\n label: propertyName,\n description: this._buildPropDescription(property.type, propData.example),\n options: propData.options(property),\n optional: true,\n };\n }\n return props;\n }", "title": "" }, { "docid": "c733a9ff789e368fe1f7ea8a0b40c5a1", "score": "0.53590924", "text": "updated(changedProperties) {\n changedProperties.forEach((oldValue, propName) => {\n if (propName === \"type\" && this[propName] === \"science\") {\n this.myIcon = \"beaker\";\n }\n\n this.style.setProperty(\"--header-height\",this.height);\n this.style.setProperty(\"--header-width\",this.width);\n this.style.backgroundColor = \"var(--simple-colors-default-theme-\"+this.color+\"-6)\";\n\n\n });\n }", "title": "" }, { "docid": "bea505d52d08b74a591a804427a23ab5", "score": "0.53555477", "text": "function showProperties(e, obj) {\n var node = obj.part.adornedPart;\n var msg = \"Context clicked: \" + node.data.key + \". \";\n msg += \"Selection includes:\";\n myDiagram.selection.each(function (part) {\n msg += \" \" + part.toString();\n });\n document.getElementById(\"myStatus\").textContent = msg;\n }", "title": "" }, { "docid": "8a3cb7cfe348e2cd514a2c644254eb49", "score": "0.5333564", "text": "get properties() {\n\t\treturn [\"animation\",\"autoFocusOnMouseenter\",\"checkable\",\"checkboxes\",\"checkMode\",\"dataSource\",\"disabled\",\"displayLoadingIndicator\",\"displayMember\",\"dropDownAppendTo\",\"dropDownOverlay\",\"dropDownPosition\",\"enableMouseWheelAction\",\"filterable\",\"filterInputPlaceholder\",\"filterMode\",\"grouped\",\"itemsMember\",\"loadingIndicatorPlaceholder\",\"loadingIndicatorPosition\",\"locale\",\"localizeFormatFunction\",\"messages\",\"minimizeIconTemplate\",\"minimizeWidth\",\"overflow\",\"readonly\",\"rightToLeft\",\"scrollMode\",\"theme\",\"unfocusable\",\"valueMember\"];\n\t}", "title": "" }, { "docid": "0406db8c177e5562a759b9281c641544", "score": "0.53335255", "text": "assignProperties() {\n this.assignComponentProperties(this.properties, ['name', 'value', 'unwind', 'required', 'readOnly', 'disabled']);\n }", "title": "" }, { "docid": "8d176611e479e59ded7a0026452385f2", "score": "0.53117126", "text": "static get properties() {\n return {\n target: {\n type: String,\n reflect: true\n }\n };\n }", "title": "" }, { "docid": "2464d4c67ca3894d25d9ea1fc2789350", "score": "0.53115517", "text": "function CfnCluster_ExecuteCommandConfigurationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('kmsKeyId', cdk.validateString)(properties.kmsKeyId));\n errors.collect(cdk.propertyValidator('logConfiguration', CfnCluster_ExecuteCommandLogConfigurationPropertyValidator)(properties.logConfiguration));\n errors.collect(cdk.propertyValidator('logging', cdk.validateString)(properties.logging));\n return errors.wrap('supplied properties not correct for \"ExecuteCommandConfigurationProperty\"');\n}", "title": "" }, { "docid": "3be02a29ff1f054731bdc049af13a034", "score": "0.53060097", "text": "static get properties() {\n return {\n /** The PDB ID for the protein structure. */\n pdbId: {\n type: String,\n value: \"4LUC\",\n notify: true,\n },\n\n /** The type of molecule. */\n moleculeType: { type: String, value: \"bio\" },\n\n /** The size of the molecule image. */\n size: { type: String, value: \"250\" },\n };\n }", "title": "" }, { "docid": "fca84035f0ba0a1b83559762652a20cb", "score": "0.5303013", "text": "_populatePropertySpecs() {\n super._populatePropertySpecs(controlType.horizontalLine, 'Static');\n this._addPropertySpecs();\n }", "title": "" }, { "docid": "500a914e800d7db14e057824733669be", "score": "0.5257376", "text": "function displayProperties() {\n return `I am a ${this.type} ${this.instrument} made by ${\n this.manufacturer\n } and my model is: ${this.model}`;\n}", "title": "" }, { "docid": "4edf7ebb94a4e5bbabb6a8f82042ea22", "score": "0.52560467", "text": "function cfnJobJobCommandPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnJob_JobCommandPropertyValidator(properties).assertSuccess();\n return {\n Name: cdk.stringToCloudFormation(properties.name),\n PythonVersion: cdk.stringToCloudFormation(properties.pythonVersion),\n ScriptLocation: cdk.stringToCloudFormation(properties.scriptLocation),\n };\n}", "title": "" }, { "docid": "5ae25376f702a3ec7bb7aca992032543", "score": "0.52551645", "text": "static get properties() {\n return {\n \n };\n }", "title": "" }, { "docid": "6c82ee14ff5126e6d5f89dfc9b984bbc", "score": "0.5254681", "text": "static get properties() {\n return {\n color: {\n type: String,\n value: '#ffffffff'\n },\n\n style: {\n type: String,\n computed: '__computeStyle(color)'\n }\n };\n }", "title": "" }, { "docid": "00d0da13429fa4b7f8cd7f04038747d8", "score": "0.52460593", "text": "get properties() {\n\t\treturn [\"animation\",\"contentHandler\",\"dataSource\",\"disabled\",\"itemTemplate\",\"locale\",\"localizeFormatFunction\",\"messages\",\"rightToLeft\",\"theme\",\"unfocusable\"];\n\t}", "title": "" }, { "docid": "d7ef55bf4389c0a2dffaee8491fcf8ce", "score": "0.524313", "text": "_populatePropertySpecs() {\n super._populatePropertySpecs(controlType.strokeButton, 'StrokeButton');\n this._addPropertySpecs();\n }", "title": "" }, { "docid": "a3478011d3bd6039ad8f84310fe47216", "score": "0.5235889", "text": "get properties () {\n return [\n 'animation',\n 'autoSwitchToMinutes',\n 'disabled',\n 'footer',\n 'footerTemplate',\n 'format',\n 'locale',\n 'localizeFormatFunction',\n 'messages',\n 'minuteInterval',\n 'name',\n 'readonly',\n 'rightToLeft',\n 'selection',\n 'theme',\n 'unFocusable',\n 'value',\n 'view',\n ];\n }", "title": "" }, { "docid": "ffeb01b154432ec1e728ce67db227edf", "score": "0.5230839", "text": "static get properties() {\n return {\n ...super.properties,\n /**\n * active manifest index, key to location in the manifest itemsarray\n */\n activeManifestIndex: {\n type: Number,\n attribute: \"active-manifest-index\",\n },\n /**\n * Manifest, JSON Outline Schema object\n */\n manifest: {\n type: Object,\n },\n editMode: {\n type: Boolean,\n reflect: true,\n attribute: \"edit-mode\",\n },\n prevChanged: {\n type: String,\n },\n nextChanged: {\n type: String,\n },\n prevTitle: {\n type: String,\n },\n nextTitle: {\n type: String,\n },\n };\n }", "title": "" }, { "docid": "6b793071ce77f6a72363bfb6814d69eb", "score": "0.5212784", "text": "static get properties () {\n return {\n // Simple public properties/attributes\n one: { type: String },\n two: { type: Boolean },\n three: { type: Array },\n // If the property is multiple words and thus camelCase, you can force the default linked attribute to be kebab-case like this:\n fooBarBaz: { type: String, attribute: 'foo-bar-baz' },\n // Setting `reflect: true` will automatically update the attribute value when the property is changed.\n // This way, if you use a CSS attribute selector like this `:host([enabled])`, you can have your styles react to property changes.\n enabled: { type: Boolean, reflect: true },\n // Private properties are prefixed with `_`\n // If it's described here, a change will trigger render().\n // Use state: true for private properties.\n _privateFoobar: { type: Boolean, state: true },\n };\n }", "title": "" }, { "docid": "c79f4f372f521088ae618fce4c3e247a", "score": "0.5211099", "text": "_populatePropertySpecs() {\n super._populatePropertySpecs(controlType.toolbar, 'ToolbarWindow32');\n this._addPropertySpecs();\n }", "title": "" }, { "docid": "046d16789e96f41fc21a126bac3b2bc5", "score": "0.5208109", "text": "get commands() {\n return this.commandList;\n }", "title": "" }, { "docid": "ed06db7af0b47887d9c24421ca0eccb6", "score": "0.5206781", "text": "_populatePropertySpecs(ctrlType, ctrlResourceClass) {\n if (typeof ctrlType === 'undefined' || typeof ctrlResourceClass === 'undefined') {\n throw new Error('Invalid arguments. Need control type and resource class');\n }\n\n this._propertySpecs.set(\n propertyLabel.ctrlType,\n new IdentifierPropertySpec({\n label: propertyLabel.ctrlType,\n displayedLabel: 'Control Type',\n required: true,\n nullable: false,\n defaultValue: ctrlType,\n context: cred.editContext.globalOnly,\n modifiable: false,\n localized: false,\n writeLabeled: false,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false\n })\n );\n this._propertySpecs.set(\n propertyLabel.id,\n new IdentifierPropertySpec({\n label: propertyLabel.id,\n displayedLabel: 'Identifier',\n required: true,\n nullable: false,\n defaultValue: 'PLEASE_ENTER_ID',\n context: cred.editContext.globalOnly,\n modifiable: true,\n localized: false,\n writeLabeled: true,\n writeAsStringWhenLabeled: true,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false,\n tags: [semanticPropertyTag.id]\n })\n );\n this._propertySpecs.set(\n propertyLabel.left,\n new IntegerPropertySpec({\n label: propertyLabel.left,\n displayedLabel: 'Left',\n required: true,\n nullable: false,\n defaultValue: 0,\n context: cred.editContext.localOnly,\n modifiable: true,\n localized: false,\n writeLabeled: true,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false,\n tags: [semanticPropertyTag.bounds]\n })\n );\n this._propertySpecs.set(\n propertyLabel.top,\n new IntegerPropertySpec({\n label: propertyLabel.top,\n displayedLabel: 'Top',\n required: true,\n nullable: false,\n defaultValue: 0,\n context: cred.editContext.localOnly,\n modifiable: true,\n localized: false,\n writeLabeled: true,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false,\n tags: [semanticPropertyTag.bounds]\n })\n );\n this._propertySpecs.set(\n propertyLabel.width,\n new IntegerPropertySpec({\n label: propertyLabel.width,\n displayedLabel: 'Width',\n required: true,\n nullable: false,\n defaultValue: 1,\n context: cred.editContext.localOnly,\n modifiable: true,\n localized: false,\n writeLabeled: true,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false,\n tags: [semanticPropertyTag.bounds]\n })\n );\n this._propertySpecs.set(\n propertyLabel.height,\n new IntegerPropertySpec({\n label: propertyLabel.height,\n displayedLabel: 'Height',\n required: true,\n nullable: false,\n defaultValue: 1,\n context: cred.editContext.localOnly,\n modifiable: true,\n localized: false,\n writeLabeled: true,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false,\n tags: [semanticPropertyTag.bounds]\n })\n );\n this._propertySpecs.set(\n propertyLabel.resourceClass,\n new IdentifierPropertySpec({\n label: propertyLabel.resourceClass,\n displayedLabel: 'Resource Class',\n required: true,\n nullable: false,\n defaultValue: ctrlResourceClass,\n context: cred.editContext.globalOnly,\n modifiable: false,\n localized: false,\n writeLabeled: false,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false\n })\n );\n this._propertySpecs.set(\n propertyLabel.styleFlags,\n new FlagsPropertySpec({\n label: propertyLabel.styleFlags,\n displayedLabel: 'Style Flags',\n required: true,\n nullable: true,\n defaultValue: 0,\n context: cred.editContext.globalDefault,\n modifiable: true,\n localized: false,\n writeLabeled: false,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false,\n flags: [\n {\n textValue: 'WS_CHILD',\n numericValue: 1073741824,\n display: 'WS_CHILD'\n },\n {\n textValue: 'WS_CLIPCHILDREN',\n numericValue: 33554432,\n display: 'WS_CLIPCHILDREN'\n },\n {\n textValue: 'WS_GROUP',\n numericValue: 131072,\n display: 'WS_GROUP'\n },\n {\n textValue: 'WS_TABSTOP',\n numericValue: 65536,\n display: 'WS_TABSTOP'\n },\n {\n textValue: 'WS_VISIBLE',\n numericValue: 268435456,\n display: 'WS_VISIBLE'\n }\n ]\n })\n );\n this._propertySpecs.set(\n propertyLabel.extStyleFlags,\n new FlagsPropertySpec({\n label: propertyLabel.extStyleFlags,\n displayedLabel: 'Extended Style Flags',\n required: true,\n nullable: true,\n defaultValue: 0,\n context: cred.editContext.globalDefault,\n modifiable: true,\n localized: false,\n writeLabeled: false,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false,\n flags: [\n {\n textValue: 'WS_EX_CONTROLPARENT',\n numericValue: 65536,\n display: 'WS_EX_CONTROLPARENT'\n },\n {\n textValue: 'WS_EX_STATICEDGE',\n numericValue: 131072,\n display: 'WS_EX_STATICEDGE'\n }\n ]\n })\n );\n this._propertySpecs.set(\n propertyLabel.anchorLeft,\n new IntegerPropertySpec({\n label: propertyLabel.anchorLeft,\n displayedLabel: 'Anchor Left',\n required: true,\n nullable: false,\n defaultValue: 0,\n context: cred.editContext.localDefault,\n modifiable: true,\n localized: false,\n writeLabeled: true,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false\n })\n );\n this._propertySpecs.set(\n propertyLabel.anchorTop,\n new IntegerPropertySpec({\n label: propertyLabel.anchorTop,\n displayedLabel: 'Anchor Top',\n required: true,\n nullable: false,\n defaultValue: 0,\n context: cred.editContext.localDefault,\n modifiable: true,\n localized: false,\n writeLabeled: true,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false\n })\n );\n this._propertySpecs.set(\n propertyLabel.anchorRight,\n new IntegerPropertySpec({\n label: propertyLabel.anchorRight,\n displayedLabel: 'Anchor Right',\n required: true,\n nullable: false,\n defaultValue: 0,\n context: cred.editContext.localDefault,\n modifiable: true,\n localized: false,\n writeLabeled: true,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false\n })\n );\n this._propertySpecs.set(\n propertyLabel.anchorBottom,\n new IntegerPropertySpec({\n label: propertyLabel.anchorBottom,\n displayedLabel: 'Anchor Bottom',\n required: true,\n nullable: false,\n defaultValue: 0,\n context: cred.editContext.localDefault,\n modifiable: true,\n localized: false,\n writeLabeled: true,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false\n })\n );\n this._propertySpecs.set(\n propertyLabel.enabled,\n new BooleanPropertySpec({\n label: propertyLabel.enabled,\n displayedLabel: 'Enabled',\n required: false,\n nullable: false,\n defaultValue: 1,\n context: cred.editContext.globalDefault,\n modifiable: true,\n localized: false,\n writeLabeled: true,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false\n })\n );\n this._propertySpecs.set(\n propertyLabel.group,\n new BooleanPropertySpec({\n label: propertyLabel.group,\n displayedLabel: 'Group',\n required: false,\n nullable: false,\n defaultValue: 1,\n context: cred.editContext.globalDefault,\n modifiable: true,\n localized: false,\n writeLabeled: true,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false\n })\n );\n this._propertySpecs.set(\n propertyLabel.killPopup,\n new BooleanPropertySpec({\n label: propertyLabel.killPopup,\n displayedLabel: 'Kill Popup',\n required: true,\n nullable: false,\n defaultValue: 1,\n context: cred.editContext.globalDefault,\n modifiable: true,\n localized: false,\n writeLabeled: true,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false\n })\n );\n this._propertySpecs.set(\n propertyLabel.tabStop,\n new BooleanPropertySpec({\n label: propertyLabel.tabStop,\n displayedLabel: 'Tab Stop',\n required: false,\n nullable: false,\n defaultValue: 1,\n context: cred.editContext.globalDefault,\n modifiable: true,\n localized: false,\n writeLabeled: true,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false\n })\n );\n this._propertySpecs.set(\n propertyLabel.visible,\n new BooleanPropertySpec({\n label: propertyLabel.visible,\n displayedLabel: 'Visible',\n required: true,\n nullable: false,\n defaultValue: 1,\n context: cred.editContext.globalDefault,\n modifiable: true,\n localized: false,\n writeLabeled: true,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false\n })\n );\n this._propertySpecs.set(\n propertyLabel.tooltip,\n new LocalizedStringPropertySpec({\n label: propertyLabel.tooltip,\n displayedLabel: 'Tooltip',\n required: true,\n nullable: true,\n defaultValue: '',\n context: cred.editContext.localDefault,\n modifiable: true,\n localized: true,\n writeLabeled: true,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false\n })\n );\n }", "title": "" }, { "docid": "ec01807b71fa2772855b7ca32951facf", "score": "0.5205699", "text": "get properties() {\n\t\treturn [\"animation\",\"appendTo\",\"autoClose\",\"autoCloseDelay\",\"autoOpen\",\"disabled\",\"iconClass\",\"itemClass\",\"itemTemplate\",\"locale\",\"localizeFormatFunction\",\"messages\",\"modal\",\"position\",\"readonly\",\"rightToLeft\",\"showCloseButton\",\"theme\",\"type\",\"unfocusable\",\"value\"];\n\t}", "title": "" }, { "docid": "3fc31be314eac1b100745e113fe03c53", "score": "0.52049196", "text": "_populatePropertySpecs() {\n super._populatePropertySpecs(controlType.menuButton, 'MenuButton');\n this._addPropertySpecs();\n }", "title": "" }, { "docid": "6fa0b861e7778d1acfc3193f917f22e1", "score": "0.5204897", "text": "_populatePropertySpecs() {\n super._populatePropertySpecs(controlType.pushButton, 'Button');\n this._addPropertySpecs();\n this._addStyleFlags();\n }", "title": "" }, { "docid": "71e47b0cd38603dc7ab8034b95051356", "score": "0.5202523", "text": "static get properties () {\n\t\treturn [\n\t\t\t...this.access,\n\t\t\t...this.activate,\n\t\t\t...this.ammunition,\n\t\t\t...this.area,\n\t\t\t...this.bulk,\n\t\t\t...this.cast,\n\t\t\t...this.cost,\n\t\t\t...this.duration,\n\t\t\t...this.effect,\n\t\t\t...this.frequency,\n\t\t\t...this.onset,\n\t\t\t...this.prerequisites,\n\t\t\t...this.price,\n\t\t\t...this.range,\n\t\t\t...this.requirements,\n\t\t\t...this.savingThrow,\n\t\t\t...this.shieldData,\n\t\t\t...this.targets,\n\t\t\t...this.traditions,\n\t\t\t...this.traditionsSubclasses,\n\t\t\t...this.trigger,\n\t\t\t...this.category,\n\t\t\t...this.usage,\n\t\t]\n\t}", "title": "" }, { "docid": "adbb91b7a619afe20f801b8e56732e5d", "score": "0.5192543", "text": "static get properties() {\n return {\n _config: {},\n hass: {}\n };\n }", "title": "" }, { "docid": "f770e7272a8784089c7736513bf46c88", "score": "0.51924145", "text": "function CfnJob_JobCommandPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));\n errors.collect(cdk.propertyValidator('pythonVersion', cdk.validateString)(properties.pythonVersion));\n errors.collect(cdk.propertyValidator('scriptLocation', cdk.validateString)(properties.scriptLocation));\n return errors.wrap('supplied properties not correct for \"JobCommandProperty\"');\n}", "title": "" }, { "docid": "4ddd10102d641ba18e5bdb0a4155c000", "score": "0.51852983", "text": "_definePropertyDisplayOrder() {\n super._definePropertyDisplayOrder();\n\n this._propertyDisplayOrder.push(propertyLabel.toolBarLike);\n this._propertyDisplayOrder.push(propertyLabel.ownerDrawn);\n this._propertyDisplayOrder.push(propertyLabel.imageSizeType);\n this._propertyDisplayOrder.push(propertyLabel.imageNormal);\n this._propertyDisplayOrder.push(propertyLabel.imagePressed);\n this._propertyDisplayOrder.push(propertyLabel.imageDisabled);\n this._propertyDisplayOrder.push(propertyLabel.imageHot);\n this._propertyDisplayOrder.push(propertyLabel.imageChecked);\n this._propertyDisplayOrder.push(propertyLabel.imageCheckedPressed);\n this._propertyDisplayOrder.push(propertyLabel.imageCheckedDisabled);\n this._propertyDisplayOrder.push(propertyLabel.imageCheckedHot);\n this._propertyDisplayOrder.push(propertyLabel.imageTriState);\n this._propertyDisplayOrder.push(propertyLabel.imageTriStatePressed);\n this._propertyDisplayOrder.push(propertyLabel.imageTriStateDisabled);\n this._propertyDisplayOrder.push(propertyLabel.imageTriStateHot);\n }", "title": "" }, { "docid": "4ddd10102d641ba18e5bdb0a4155c000", "score": "0.51852983", "text": "_definePropertyDisplayOrder() {\n super._definePropertyDisplayOrder();\n\n this._propertyDisplayOrder.push(propertyLabel.toolBarLike);\n this._propertyDisplayOrder.push(propertyLabel.ownerDrawn);\n this._propertyDisplayOrder.push(propertyLabel.imageSizeType);\n this._propertyDisplayOrder.push(propertyLabel.imageNormal);\n this._propertyDisplayOrder.push(propertyLabel.imagePressed);\n this._propertyDisplayOrder.push(propertyLabel.imageDisabled);\n this._propertyDisplayOrder.push(propertyLabel.imageHot);\n this._propertyDisplayOrder.push(propertyLabel.imageChecked);\n this._propertyDisplayOrder.push(propertyLabel.imageCheckedPressed);\n this._propertyDisplayOrder.push(propertyLabel.imageCheckedDisabled);\n this._propertyDisplayOrder.push(propertyLabel.imageCheckedHot);\n this._propertyDisplayOrder.push(propertyLabel.imageTriState);\n this._propertyDisplayOrder.push(propertyLabel.imageTriStatePressed);\n this._propertyDisplayOrder.push(propertyLabel.imageTriStateDisabled);\n this._propertyDisplayOrder.push(propertyLabel.imageTriStateHot);\n }", "title": "" }, { "docid": "e24ffc5e01ebd39c5ad9946ec7ddb2dc", "score": "0.5181494", "text": "newPropertiesSheet() {\n this.properties_sheet = new DataIntegrationWorkspaceProperties(this.artefact)\n }", "title": "" }, { "docid": "820450348fae88c16468f1dd8d7a0bc5", "score": "0.51767087", "text": "static get inputProperties() {\n\t\treturn [\n\t\t\t'--avatar-seed',\n\t\t\t...colorProps\n\t\t];\n\t}", "title": "" }, { "docid": "2cec2752cc34f2f668be2a5a02393bb9", "score": "0.5175329", "text": "static get properties() {\n return {};\n }", "title": "" }, { "docid": "71a4ccb51b579fbbeb6fbdf708afc6a8", "score": "0.5172908", "text": "static get properties() {\n return {\n multiTarget: {\n type: String,\n reflect: true\n }\n };\n }", "title": "" }, { "docid": "0781c10e06ef9b1b9a3840e833c164ba", "score": "0.5164695", "text": "static getProperties(properties) {\n let list = [];\n for (const property in properties) {\n if (properties[property] !== void 0) {\n list.push(`${property.toLowerCase()}=\"${this.escape(properties[property])}\"`);\n }\n }\n return list.join(' ');\n }", "title": "" }, { "docid": "b03e28d3a81d2f7f9d227f196975ba8b", "score": "0.51598626", "text": "function getProperties (properties) {\n var content = '';\n for (var key in properties){\n \n //console.log(key + ' = ' + properties[key]);\n content = content + '<strong>' + key + '</strong>: ' + properties[key] + '<br>';\n }\n \n return content;\n}", "title": "" }, { "docid": "dd6fdd7760145468869ba22e43e2e676", "score": "0.5132823", "text": "static get properties() {\n return {\n ...super.properties,\n inverted: { type: Boolean },\n imgSource: { type: String, attribute: \"img-source\", reflect: true },\n imgKeyword: { type: String, attribute: \"img-keyword\" },\n status: { type: String, reflect: true },\n };\n }", "title": "" }, { "docid": "7510d9fbdb3fb7d8e3d581d5018afdf2", "score": "0.5128393", "text": "assignProperties() {\n this.assignComponentProperties(this.properties, ['name', 'value', 'disabled']);\n this.states.caption = this.captionSlot.assignedNodes({ flatten: true })[0];\n }", "title": "" }, { "docid": "4b5ecfe8d00daca7b4c7b738aec5948c", "score": "0.5124613", "text": "function generatePropertyList(properties){\n return properties.join('\\n');\n }", "title": "" }, { "docid": "63b4889faf7754287193f864016594a3", "score": "0.5122585", "text": "properties() {\n return this._db.request({ path: `/_api/view/${this.name}/properties` }, (res) => res.body);\n }", "title": "" }, { "docid": "b95019876e0e9edc1d3493da7630026c", "score": "0.5112375", "text": "static get properties() {\r\n return {\r\n };\r\n }", "title": "" }, { "docid": "c94972da5dd416ce1288fa37404eb3bc", "score": "0.5106994", "text": "static get properties() {\n return {\n /**\n * Language ISO Code. e.g. `en` for English. `hi` for Hindi.\n * This property is mainly for the output property, it's set/changed as per the `i18next` configuration.\n * In most of the cases, this isn't need to be used by anyone. But, it's declared as property as re-render\n * is triggered automatically, when it's changed.\n */\n _language: {\n type: String,\n reflect: true,\n attribute: \"lang\",\n },\n\n /**\n * `true` when text-resources are loaded.\n */\n _textReady: { type: Boolean },\n\n /**\n * When it's `true`, do not delay rendering.\n */\n doNotDelayRendering: { type: Boolean },\n\n /**\n * Input property.\n * Its mandatory for SSR.\n */\n request: { type: Object },\n };\n }", "title": "" }, { "docid": "c65f0afd2598284bb2d9d6c5d36f49fe", "score": "0.51031363", "text": "function getBuildProp(){\n\tvar string = run(\"adb -s \" + choosenDevice + \" shell getprop\");\n\tvar newString = string.replace(/\\r/g, \"\");\n\tvar props = newString.split(\"\\n\");\n\treturn props;\n}", "title": "" }, { "docid": "682dec3d3f6935df948fc9dceab53f9a", "score": "0.509396", "text": "static get properties() {\n return {\n id: {\n attribute: 'tableid',\n type: String\n },\n subscriptions: {\n type: Array,\n converter: value => value ? value.split(',') : []\n },\n prependTemplates: {\n type: Array,\n converter: value => value ? value.split(',') : []\n },\n appendTemplates: {\n type: Array,\n converter: value => value ? value.split(',') : []\n },\n headers: {\n type: Array,\n converter: value => value ? value.split(',') : []\n },\n dataKeys: {\n type: Array,\n converter: value => value ? value.split(',') : []\n },\n remoteUrl: {\n attribute: 'remoteurl',\n type: String\n },\n storeDataKey: {\n attribute: 'storedatakey',\n type: String\n },\n derivation: {\n attribute: 'derivation',\n type: String\n },\n primaryKeyColumn: {\n attribute: 'primarykeycolumn',\n type: String\n }\n }\n }", "title": "" }, { "docid": "6b09289afcf7c07dfb5950b275028515", "score": "0.50924486", "text": "static get properties(){let props={size:{name:\"size\",type:\"String\",value:\"normal\",reflectToAttribute:!0,observer:\"_sizeChanged\"}};if(super.properties){props=Object.assign(props,super.properties)}return props}", "title": "" }, { "docid": "b4164110fc499fe8971e445de32f5171", "score": "0.5090196", "text": "static get properties() {\n return {};\n }", "title": "" }, { "docid": "1b8225792294985771928393d19ec69f", "score": "0.50844914", "text": "get properties() {\n return this._properties;\n }", "title": "" }, { "docid": "96f2989744fd65a0f343576fe5299b10", "score": "0.50827014", "text": "static get properties() {\n return {\n selected: {\n type: String,\n notify: true\n }\n };\n }", "title": "" }, { "docid": "b54d606785f7580e168031cbe2d2bf8a", "score": "0.5075795", "text": "constructor() {\n super(...arguments);\n /**\n * Create an observed property. Triggers update on change.\n */\n this.accession = \"G00029MO\";\n this.imagestyle = \"extended\";\n this.format = \"png\";\n this.notation = \"cfg\";\n }", "title": "" }, { "docid": "e8d19b6ab8a96ced0d17049a1159ace8", "score": "0.5072467", "text": "_populatePropertySpecs() {\n super._populatePropertySpecs(controlType.imageCheckBox, 'IMAGEBUTTON');\n this._addPropertySpecs();\n }", "title": "" }, { "docid": "c53d34569e1bccc80f2ddfcce1ec5f99", "score": "0.5065417", "text": "_definePropertyDisplayOrder() {\n this._propertyDisplayOrder.push(propertyLabel.ctrlType);\n // The cv resource class cannot be changed. We could display it as\n // pure information. For now don't show.\n //this._propertyDisplayOrder.push(propertyLabel.resourceClass);\n this._propertyDisplayOrder.push(propertyLabel.id);\n this._propertyDisplayOrder.push(propertyLabel.tooltip);\n this._propertyDisplayOrder.push(propertyLabel.left);\n this._propertyDisplayOrder.push(propertyLabel.top);\n this._propertyDisplayOrder.push(propertyLabel.width);\n this._propertyDisplayOrder.push(propertyLabel.height);\n this._propertyDisplayOrder.push(propertyLabel.visible);\n this._propertyDisplayOrder.push(propertyLabel.enabled);\n this._propertyDisplayOrder.push(propertyLabel.tabStop);\n this._propertyDisplayOrder.push(propertyLabel.group);\n this._propertyDisplayOrder.push(propertyLabel.killPopup);\n this._propertyDisplayOrder.push(propertyLabel.anchorLeft);\n this._propertyDisplayOrder.push(propertyLabel.anchorTop);\n this._propertyDisplayOrder.push(propertyLabel.anchorRight);\n this._propertyDisplayOrder.push(propertyLabel.anchorBottom);\n // Don't show the style and ext style flags for now. Their settings are\n // duplicated in other properties, e.g. Visible, Group, etc.\n //if (this._havePropertyFlags(propertyLabel.styleFlags)) {\n // this._propertyDisplayOrder.push(propertyLabel.styleFlags);\n //}\n //if (this._havePropertyFlags(propertyLabel.extStyleFlags)) {\n // this._propertyDisplayOrder.push(propertyLabel.extStyleFlags);\n //}\n }", "title": "" }, { "docid": "839ef95e9625552b9088d594fbc4f180", "score": "0.50652313", "text": "_populatePropertySpecs() {\n super._populatePropertySpecs(controlType.imagePushButton, 'IMAGEBUTTON');\n this._addPropertySpecs();\n }", "title": "" }, { "docid": "1434314031eeb44bae1224108e1aba49", "score": "0.5053126", "text": "_populatePropertySpecs() {\n super._populatePropertySpecs(controlType.checkBox, 'Button');\n this._addPropertySpecs();\n }", "title": "" }, { "docid": "31e90a58ab3e580a346cad854052a0e8", "score": "0.50494146", "text": "static get properties() {\n\t\treturn {\n\t\t\taddress : {\n\t\t\t\ttype : Object,\n\t\t\t\tvalue : { address : \"\", name : \"\"},\n\t\t\t},\n\t\t\tpeoplelist : {\n\t\t\t\ttype : Array,\n\t\t\t\tobserver : '_onPeopleListChanged'\n\t\t\t},\n\t\t\treadonly : {\n\t\t\t\ttype : Boolean,\n\t\t\t\tvalue : true\n\t\t\t},\n\t\t\tshowcopy : {\n\t\t\t\ttype : Boolean,\n\t\t\t\tvalue : true\n\t\t\t},\n\t\t}\n\t}", "title": "" }, { "docid": "b27f08ac4e6dae9f5ea62ec870755d6c", "score": "0.504844", "text": "function ruleResourceRunCommandParametersPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n RuleResource_RunCommandParametersPropertyValidator(properties).assertSuccess();\n return {\n RunCommandTargets: cdk.listMapper(ruleResourceRunCommandTargetPropertyToCloudFormation)(properties.runCommandTargets),\n };\n }", "title": "" }, { "docid": "3bdbad39f8e36d3cb419234daa582b72", "score": "0.5037905", "text": "function saveAsPreviousCommandDetails(command){\n User.setProperty('previousCommand', command,'Object');\n}", "title": "" }, { "docid": "527a15696b6fc0b947bc5e8f62d8035c", "score": "0.5036711", "text": "set prop3( value ) {\n }", "title": "" }, { "docid": "a3ac6f59907d18e3180277c98fdcc2cf", "score": "0.503275", "text": "static get properties(){return{/**\n * Emoji types types to include\n */emojiTypes:{name:\"emojiTypes\",type:Array,value:[\"emotions\",\"people\",\"nature\",\"food\",\"travel\",\"activities\",\"objects\",\"symbols\",\"flags\"]},/**\n * An optional JSON file with default options.\n */optionsSrc:{name:\"optionsSrc\",type:String,value:\"data/emojis.js\"},/**\n * Renders html as title. (Good for titles with HTML in them.)\n */titleAsHtml:{name:\"titleAsHtml\",type:Boolean,value:!0,readOnly:!0}}}", "title": "" }, { "docid": "8c7c8565f07cf17cc2fe85cd07c9db32", "score": "0.5032346", "text": "bindProperties() {\n this.bindComponentProperties(this.skeleton, [\n 'name',\n 'value',\n 'unwind',\n 'empty',\n 'selected',\n 'required',\n 'readOnly',\n 'disabled',\n 'addPage',\n 'insertPage',\n 'removePage',\n 'clear'\n ]);\n }", "title": "" }, { "docid": "04921179083533dcc5790efcc8ff5509", "score": "0.5030749", "text": "configureCommand() {\n const list = (l) => l.split(',').map(parseInt);\n this.command.option('--start-ids <ids>', 'Event IDs for system start', list, [1, 12]);\n this.command.option('--stop-ids <ids>', 'Event IDs for system stop', list, [107, 13]);\n }", "title": "" }, { "docid": "f647f3b1ff601cba7c4fab6e4d96c879", "score": "0.5015498", "text": "static _createPropertySpecs() {\n return new Map([\n [\n propertyLabel.id,\n new IdentifierPropertySpec({\n label: propertyLabel.id,\n displayedLabel: 'Identifier',\n required: true,\n nullable: false,\n defaultValue: 'PLEASE_ENTER_ID',\n context: cred.editContext.globalOnly,\n modifiable: true,\n localized: false,\n writeLabeled: true,\n writeAsStringWhenLabeled: true,\n writeSerialized: false,\n writeAsStringWhenSerialized: true,\n writeSerializedCaption: false,\n tags: [semanticPropertyTag.id]\n })\n ],\n [\n propertyLabel.left,\n new IntegerPropertySpec({\n label: propertyLabel.left,\n displayedLabel: 'Left',\n required: true,\n nullable: false,\n defaultValue: 0,\n context: cred.editContext.localOnly,\n modifiable: false,\n localized: false,\n writeLabeled: false,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false,\n tags: [semanticPropertyTag.bounds]\n })\n ],\n [\n propertyLabel.top,\n new IntegerPropertySpec({\n label: propertyLabel.top,\n displayedLabel: 'Top',\n required: true,\n nullable: false,\n defaultValue: 0,\n context: cred.editContext.localOnly,\n modifiable: false,\n localized: false,\n writeLabeled: false,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false,\n tags: [semanticPropertyTag.bounds]\n })\n ],\n [\n propertyLabel.width,\n new IntegerPropertySpec({\n label: propertyLabel.width,\n displayedLabel: 'Width',\n required: true,\n nullable: false,\n defaultValue: 1,\n context: cred.editContext.localOnly,\n modifiable: true,\n localized: false,\n writeLabeled: true,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false,\n tags: [semanticPropertyTag.bounds]\n })\n ],\n [\n propertyLabel.height,\n new IntegerPropertySpec({\n label: propertyLabel.height,\n displayedLabel: 'Height',\n required: true,\n nullable: false,\n defaultValue: 1,\n context: cred.editContext.localOnly,\n modifiable: true,\n localized: false,\n writeLabeled: true,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false,\n tags: [semanticPropertyTag.bounds]\n })\n ],\n [\n propertyLabel.text,\n new LocalizedStringPropertySpec({\n label: propertyLabel.text,\n displayedLabel: 'Title',\n required: true,\n nullable: true,\n defaultValue: '',\n context: cred.editContext.localOnly,\n modifiable: true,\n localized: true,\n writeLabeled: true,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false\n })\n ],\n [\n propertyLabel.resourceClass,\n new StringPropertySpec({\n label: propertyLabel.resourceClass,\n displayedLabel: 'Resource Class',\n required: true,\n nullable: false,\n defaultValue: 'FancyDialogBoxClass',\n context: cred.editContext.globalOnly,\n modifiable: true,\n localized: false,\n writeLabeled: false,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false\n })\n ],\n [\n propertyLabel.font,\n new StringPropertySpec({\n label: propertyLabel.font,\n displayedLabel: 'Font',\n required: true,\n nullable: true,\n defaultValue: '',\n context: cred.editContext.localDefault,\n modifiable: true,\n localized: false,\n writeLabeled: false,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false\n })\n ],\n [\n propertyLabel.fontSize,\n new IntegerPropertySpec({\n label: propertyLabel.fontSize,\n displayedLabel: 'Font Size',\n required: true,\n nullable: true,\n defaultValue: 0,\n context: cred.editContext.localDefault,\n modifiable: true,\n localized: false,\n writeLabeled: false,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false\n })\n ],\n [\n propertyLabel.killPopup,\n new BooleanPropertySpec({\n label: propertyLabel.killPopup,\n displayedLabel: 'Kill Popup',\n required: true,\n nullable: false,\n defaultValue: 1,\n context: cred.editContext.globalDefault,\n modifiable: true,\n localized: false,\n writeLabeled: true,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false\n })\n ],\n [\n propertyLabel.paddingType,\n new EnumPropertySpec({\n label: propertyLabel.paddingType,\n displayedLabel: 'Padding Type',\n required: true,\n nullable: false,\n defaultValue: 'ACDSystems::UI::DialogPaddingTypes::Default',\n context: cred.editContext.globalDefault,\n modifiable: true,\n localized: false,\n writeLabeled: true,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false,\n enums: [\n {\n value: 'ACDSystems::UI::DialogPaddingTypes::Default',\n display: 'Default'\n },\n {\n value: 'ACDSystems::UI::DialogPaddingTypes::Modal',\n display: 'Modal'\n },\n {\n value: 'ACDSystems::UI::DialogPaddingTypes::Palette',\n display: 'Palette'\n },\n {\n value: 'ACDSystems::UI::DialogPaddingTypes::None',\n display: 'None'\n }\n ]\n })\n ],\n [\n propertyLabel.styleFlags,\n new FlagsPropertySpec({\n label: propertyLabel.styleFlags,\n displayedLabel: 'Style Flags',\n required: true,\n nullable: false,\n defaultValue: 0,\n context: cred.editContext.globalDefault,\n modifiable: true,\n localized: false,\n writeLabeled: false,\n writeAsStringWhenLabeled: false,\n writeSerialized: false,\n writeAsStringWhenSerialized: false,\n writeSerializedCaption: false,\n flags: [\n {\n textValue: 'WS_CHILD',\n numericValue: 1073741824,\n display: 'WS_CHILD'\n },\n {\n textValue: 'WS_VISIBLE',\n numericValue: 268435456,\n display: 'WS_VISIBLE'\n }\n ]\n })\n ]\n ]);\n }", "title": "" }, { "docid": "9b32822949da6044866939576ea70982", "score": "0.50097185", "text": "function _addStandardProperties() {\n this.autofocus = false;\n //--------------------------- modified\n this.defaultChecked = this.defaultSetting;\n //----------------------------\n this.checked = this.defaultChecked;\n this.defaultValue = 'on';\n this.disabled = false;\n this.form = '';\n this.indeterminate = false;\n this.name = '';\n this.requried = false;\n this.type = 'checkbox';\n this.value = this.defaultValue;\n }", "title": "" }, { "docid": "58f3d8261ca0095aa170086095e36d68", "score": "0.49971506", "text": "function getPropertiesCB(result) \n{\n var id = result.dbId;\n var name = result.name;\n\t\n\tUpdateCommandLine(\"Getting Properties of object \" + name + \" (dbId = \" + id + \")\");\n\n // Get the properties table\n var propertiesTable = htmlDoc.getElementById('PropertiesTable')\n\n // Clear the properties table\n while (propertiesTable.hasChildNodes()) \n {\n propertiesTable.removeChild(propertiesTable.firstChild);\n }\n\n // Populate the table with the properties\n for (i = 0; i < result.properties.length; i++) \n {\n var property = result.properties[i];\n var disName = property.displayName;\n var disValue = property.displayValue;\n\n var row = propertiesTable.insertRow(i);\n\n var cell0 = row.insertCell(0);\n var cell1 = row.insertCell(1);\n\n cell0.innerHTML = disName;\n cell1.innerHTML = disValue;\n }\n}", "title": "" }, { "docid": "21333437eaa48307c39571014c9c78f7", "score": "0.4995787", "text": "function RuleResource_RunCommandParametersPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n errors.collect(cdk.propertyValidator('runCommandTargets', cdk.requiredValidator)(properties.runCommandTargets));\n errors.collect(cdk.propertyValidator('runCommandTargets', cdk.listValidator(RuleResource_RunCommandTargetPropertyValidator))(properties.runCommandTargets));\n return errors.wrap('supplied properties not correct for \"RunCommandParametersProperty\"');\n }", "title": "" }, { "docid": "a400721d76bb85dd23afc2e75ef682ef", "score": "0.49924344", "text": "function build_properties(obj,tag,data){\r\n\t\tvar keys=tag.keys,vals=tag.vals,kl=keys.length;\r\n\t\twhile(kl--){\r\n\t\t\tvar k=keys[kl];\r\n\t\t\tif(k instanceof snow.Text){\r\n\t\t\t\tvar x=vals[kl].visit(this,data);\r\n\t\t\t\tif(x!==COMMENT){\r\n\t\t\t\t\tobj[k.value]=x;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tthrow new XONError(\r\n\t\t\t\t\t\"Object keys must be textual\",k.line,k.col\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn obj;\r\n\t}", "title": "" }, { "docid": "bb5973d6c4454e7d7b2d707e3b1c4022", "score": "0.49905476", "text": "function helpCommands() {\n return {\n init: \"Command: *_init travis <owner>/<repository>_* -- Initialize a travis/coveralls integration for a channel\",\n reset: \"Command: *_reset travis_* -- Remove the travis/coveralls integration from a channel\",\n configure: \"Command: *_configure yaml <owner>/<repository>_* -- If you chose not to create a .yaml file whith the command *_init travis_*, you may use this command to generate the file later. The operation will fail if the .yaml file already exists.\",\n issue: \"Command: *_create issue_* -- Create an issue for a repository that has been initialized\",\n coveralls: \"Command: [*_set coverage threshold_*/*_set threshold_*] *_to <number>_* -- Set the coveralls threshold to a specific number. You will be alerted when coverage falls below this.\",\n token: `Command: *_add-token_* *_<owner>=<token>_* -- Register a token with the bot to enable repositories under a specific owner. You will not be able to initialize repos under an owner until a token has been registered for them. Note: To prevent others from seeing your token, this command can *_ONLY_* be used in a direct chat with @${bot.identity.name} !`\n }\n}", "title": "" }, { "docid": "d8811ebf159a6fb50daeab28ccc303b6", "score": "0.4990434", "text": "_definePropertyDisplayOrder() {\n super._definePropertyDisplayOrder();\n\n this._propertyDisplayOrder.push(propertyLabel.pushButtonLike);\n this._propertyDisplayOrder.push(propertyLabel.splitButtonLike);\n this._propertyDisplayOrder.push(propertyLabel.toolBarLike);\n this._propertyDisplayOrder.push(propertyLabel.ownerDrawn);\n this._propertyDisplayOrder.push(propertyLabel.imageSizeType);\n this._propertyDisplayOrder.push(propertyLabel.imageNormal);\n this._propertyDisplayOrder.push(propertyLabel.imagePressed);\n this._propertyDisplayOrder.push(propertyLabel.imageDisabled);\n this._propertyDisplayOrder.push(propertyLabel.imageHot);\n this._propertyDisplayOrder.push(propertyLabel.imageChecked);\n this._propertyDisplayOrder.push(propertyLabel.imageCheckedPressed);\n this._propertyDisplayOrder.push(propertyLabel.imageCheckedDisabled);\n this._propertyDisplayOrder.push(propertyLabel.imageCheckedHot);\n this._propertyDisplayOrder.push(propertyLabel.imageTriState);\n this._propertyDisplayOrder.push(propertyLabel.imageTriStatePressed);\n this._propertyDisplayOrder.push(propertyLabel.imageTriStateDisabled);\n this._propertyDisplayOrder.push(propertyLabel.imageTriStateHot);\n }", "title": "" }, { "docid": "d392590af016829e49e4b1f00e9ad3ea", "score": "0.4988889", "text": "function updateProperties() {\n var voltage = (219.5 + Math.random()).toFixed(3); // #H\n updateProperty ('voltage',voltage);\n\n var current = (Math.random()*10).toFixed(3); // #I\n if (status==false) current = 0.001;\n updateProperty ('current',current);\n\n var power = (voltage * current * (0.6+Math.random()/10)).toFixed(3); // #J\n updateProperty ('power',power);\n}", "title": "" }, { "docid": "14a536c764e2a126faeecc21acad2d8d", "score": "0.49884865", "text": "get autoGenerateDesiredProperties() {\n return this.i.f;\n }", "title": "" }, { "docid": "309c42bcaba36b1c5da3052fddc32663", "score": "0.49838385", "text": "function ruleResourceRunCommandTargetPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n RuleResource_RunCommandTargetPropertyValidator(properties).assertSuccess();\n return {\n Key: cdk.stringToCloudFormation(properties.key),\n Values: cdk.listMapper(cdk.stringToCloudFormation)(properties.values),\n };\n }", "title": "" }, { "docid": "f2635134156d26b9cf704c6be09c11f0", "score": "0.49816227", "text": "function cfnClusterExecuteCommandLogConfigurationPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnCluster_ExecuteCommandLogConfigurationPropertyValidator(properties).assertSuccess();\n return {\n CloudWatchEncryptionEnabled: cdk.booleanToCloudFormation(properties.cloudWatchEncryptionEnabled),\n CloudWatchLogGroupName: cdk.stringToCloudFormation(properties.cloudWatchLogGroupName),\n S3BucketName: cdk.stringToCloudFormation(properties.s3BucketName),\n S3EncryptionEnabled: cdk.booleanToCloudFormation(properties.s3EncryptionEnabled),\n S3KeyPrefix: cdk.stringToCloudFormation(properties.s3KeyPrefix),\n };\n}", "title": "" }, { "docid": "10aa6df42f5e1eecd88da89055ddf746", "score": "0.49811637", "text": "function propertyInfo() {\n\t'use strict';\n\n\t(function() { document.getElementById('pi-output').innerHTML = ''; })();\n\tvar selProp = document.getElementById('properties');\n\t\n\tvar prop = [ document, window, navigator ];\n\n\tfor (var i = 0; i < selProp.options.length; i++) {\n\n\t\tif (selProp.options[i].selected) {\n\n\t\t\tgetPropInfo(prop[i]);\n\t\t}\n\t}\n}", "title": "" }, { "docid": "17aca7aeaf1db38523914e5e0503049c", "score": "0.49805915", "text": "static get properties() {\n return {\n // Holds the currently selected message\n selectedMessage: {\n type: Object,\n readOnly: false,\n notify: true\n }\n };\n }", "title": "" }, { "docid": "323524c08d9ddae0ff483c096895aa45", "score": "0.49793512", "text": "newPropertiesSheet() {\n this.properties_sheet = new NodePoolProperties(this.artefact)\n }", "title": "" }, { "docid": "fddb869da71a47a16991440bbb3a9626", "score": "0.49736607", "text": "function registerScriptProperty(){\n PropertiesService.getScriptProperties().deleteAllProperties;\n registerScriptPropertyInputSsInfo1();\n registerScriptPropertySheetInfo();\n}", "title": "" }, { "docid": "fe06d2d78e8e26faee889df46103bcc7", "score": "0.4969391", "text": "ownProperties(){}", "title": "" }, { "docid": "12f26471870ba728f98bd449b5df5491", "score": "0.49684715", "text": "static get properties() { \n return { \n id: { \n attribute: 'mapid'\n },\n derivation: {\n attribute: 'derivation',\n type: String\n }\n }\n }", "title": "" }, { "docid": "796bf08f59a8ed244c41bdfe990eb296", "score": "0.49645633", "text": "function property(type){\n if (type == \"variable\") {mark(\"csharp-property\"); cont();}\n }", "title": "" }, { "docid": "5dc1e379f42d1f1e3fa81ddcec5a4f00", "score": "0.4963868", "text": "static get properties() {\r\n return {\r\n action: {\r\n type: String,\r\n value: 'List'\r\n },\r\n userData: {\r\n type: Array,\r\n value: []\r\n }\r\n };\r\n }", "title": "" } ]
159b2734b43efcd023ae8e8587e6d0d0
render product to cart
[ { "docid": "2674c3ba5a17277e0589f79de31ff0c4", "score": "0.7084349", "text": "function renderProductToCart(paramProduct, paramIndex, paramOrderDetail) {\n let vResult = `\n\t\t\t<tr>\n\t\t\t\t<td class=\"si-pic\">\n\t\t\t\t\t<img style=\"width:72px; height:72px\"\n\t\t\t\t\t\tsrc=\"${paramProduct.urlImage}\"\n\t\t\t\t\t\talt=\"product\"\n\t\t\t\t\t/>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"si-text\">\n\t\t\t\t\t<div class=\"product-selected\">\n\t\t\t\t\t\t<p>${paramProduct.buyPrice.toLocaleString()} VNĐ x ${paramOrderDetail.quantityOrder}</p>\n\t\t\t\t\t\t<h6>${paramProduct.productName} </h6>\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"si-close\">\n\t\t\t\t\t<i data-index=\"${paramIndex}\" class=\"ti-close\"></i>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t`;\n $('.select-items tbody').append(vResult);\n }", "title": "" } ]
[ { "docid": "da219386d8a4b6c3659994ed86931b5f", "score": "0.74330497", "text": "function renderCart() {\n loadCart();\n // clearCart();\n showCart();\n}", "title": "" }, { "docid": "85b09e02d2c0e383de183d75bc8c6a56", "score": "0.74101454", "text": "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "title": "" }, { "docid": "85b09e02d2c0e383de183d75bc8c6a56", "score": "0.74101454", "text": "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "title": "" }, { "docid": "85b09e02d2c0e383de183d75bc8c6a56", "score": "0.74101454", "text": "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "title": "" }, { "docid": "85b09e02d2c0e383de183d75bc8c6a56", "score": "0.74101454", "text": "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "title": "" }, { "docid": "85b09e02d2c0e383de183d75bc8c6a56", "score": "0.74101454", "text": "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "title": "" }, { "docid": "85b09e02d2c0e383de183d75bc8c6a56", "score": "0.74101454", "text": "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "title": "" }, { "docid": "85b09e02d2c0e383de183d75bc8c6a56", "score": "0.74101454", "text": "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "title": "" }, { "docid": "85b09e02d2c0e383de183d75bc8c6a56", "score": "0.74101454", "text": "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "title": "" }, { "docid": "85b09e02d2c0e383de183d75bc8c6a56", "score": "0.74101454", "text": "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "title": "" }, { "docid": "85b09e02d2c0e383de183d75bc8c6a56", "score": "0.74101454", "text": "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "title": "" }, { "docid": "85b09e02d2c0e383de183d75bc8c6a56", "score": "0.74101454", "text": "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "title": "" }, { "docid": "85b09e02d2c0e383de183d75bc8c6a56", "score": "0.74101454", "text": "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "title": "" }, { "docid": "85b09e02d2c0e383de183d75bc8c6a56", "score": "0.74101454", "text": "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "title": "" }, { "docid": "39f709ca57e13dbab9879191ff86a020", "score": "0.73442507", "text": "function renderCart() {\r\n loadCart();\r\n clearCart();\r\n showCart();\r\n}", "title": "" }, { "docid": "b2615aee0d602471e51a3d79211fe33a", "score": "0.7327252", "text": "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "title": "" }, { "docid": "07dbba4a94f3f1d5d747302aa1e1b269", "score": "0.7323575", "text": "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n\n}", "title": "" }, { "docid": "2fe1a1c2afac6d01b04950bdc9075d78", "score": "0.7249229", "text": "function renderCart() {\n let items = cart.getItems();\n let total = items.length ? items.reduce((a, {\n price\n }) => a + price, 0) : 0;\n return ` <div class=\"cart\">\n <div class=\"cart-header\">\n <h2> <i class=\"fa fa-shopping-cart\"></i> My Cart</h2>\n </div>\n <div class=\"cart-body\">\n ${items.length ? items.map(i => `\n <div class=\"cart-product\">\n <img src=\"static/0.png\" />\n <h4>${i.title}</h4>\n <span>$ ${i.price}</span>\n <a data-sku=\"${i.sku}\" class=\"remove-product\">X</a>\n </div>`\n ).join(\"\") : \"<div class='placeholder'>Your cart is empty</div>\"}\n </div>\n <div class=\"cart-footer\">\n <div class=\"cart-summary\"><div>Total:</div> <span id=\"total\">$ ${total}</span></div>\n <button class=\"checkout\" ${items.length ? \"\" : \"disabled\"} id=\"checkout\">Checkout</button>\n </div>\n </div>`;\n }", "title": "" }, { "docid": "a006bfb8782df6f4b849c6bbd612a0ac", "score": "0.7206769", "text": "function runRender() {\n shoppingCart.addProduct(productList[0]);\n shoppingCart.addProduct(productList[1]);\n shoppingCart.addProduct(productList[2]);\n shoppingCart.renderProducts();\n}", "title": "" }, { "docid": "ea0c45979a91710844f67444e1ded603", "score": "0.7187361", "text": "function renderCart() {\n\tif (cartStorage) {\n\t\tlet items = \"\"\n\t\t// create a new line with data for each product in the cart\n\t\tfor (i in cartStorage) {\n\t\t\tlet item = cartStorage[i]\n\t\t\titems += `\n <tr class=\"align-middle\">\n <td>\n <div class=\"media text-left align-middle\">\n <a class=\"thumbnail\" href=\"product.html#${item.Id}\"><img class=\"media-object product-img-order\" src=\"${item.imageUrl}\"></a>\n </div>\n </td>\n <td class=\"text-left align-middle\">${item.name}</td>\n <td class=\"text-center align-middle\" >\n <input type=\"number\" class=\"form-control\" id=\"itemQuantity-${i}\" oninput=\"updatePrice(value, ${i}), validity.valid||(value=' ')\" value=\"${item.quantity}\" min=\"${minQuantity}\" max=\"${maxQuantity}\" required>\n <small id=\"errorMessage-${i}\" class=\"form-text text-muted\"></small>\n\n </td>\n <td class=\"text-center align-middle\" id=\"updated-price-${i}\">${item.totalPrice / 100} €</td>\n <td class=\"text-center\"> \n <button onclick=\"deleteItemFromCart(${i})\" class=\"btn btn-outline-danger deleteItemBtn\" id=\"deleteItemBtn\">\n <img src=\"./assets/icons/corbeille.svg\" width=\"13px\"alt=\"bouton supprimer produit\">\n </button>\n </td>\n </tr>\n `\n\t\t}\n\t\treturn items\n\t} else {\n\t\treturn `\n <tr class=\"align-middle\">\n <td colspan=\"5\" class=\"text-center align-middle\" height=\"100px\">Votre panier est vide</td>\n </tr>\n `\n\t}\n}", "title": "" }, { "docid": "76ba2b4c093d36eaa1b56a0d7a0cfbf4", "score": "0.7182268", "text": "function renderCart () {\n\n\t\t// Get variables.\n\t\tvar cartEl = document.querySelector('#cart .cart__content'),\n\t\t\tcartItem = '',\n\t\t\titems = '';\n\n\t\tcart.items.forEach(function (item) {\n\n\t\t\t// Use template literal to create our cart item content.\n\t\t\tcartItem = `<div id=\"item${item.id}\" class=\"cart__row cart-item text--black\">\n\t\t\t\t<div class=\"cart-col--1 flex align-center\">\n\t\t\t\t\t<img src=\"${item.image}\" alt=\"${item.name}\" class=\"cart-item__image\">\n\t\t\t\t\t<h3 class=\"cart-item__heading\">${item.name}</h3>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"cart-col--2\">\n\t\t\t\t\t<span class=\"cart-item__price\">$${item.price}</span>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"cart-col--3\">\n\t\t\t\t\t<div class=\"increment flex justify-between\">\n\t\t\t\t\t\t<button class=\"button button--outline text--aluminum minus\" type=\"button\">&minus;</button>\n\t\t\t\t\t\t<label for=\"cart-${item.id}\" class=\"hide-text\">Quantity</label>\n\t\t\t\t\t\t<input class=\"qty\" type=\"number\" id=\"cart-${item.id}\" name=\"cart-${item.id}\" value=\"${item.quantity}\">\n\t\t\t\t\t\t<button class=\"button button--outline text--aluminum plus\" type=\"button\">&plus;</button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"cart-col--4\">\n\t\t\t\t\t<span class=\"cart-item__total\">$${item.quantity * item.price}</span>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"cart-col--5\">\n\t\t\t\t\t<button type=\"button\" class=\"button button--close button--remove\">\n\t\t\t\t\t\t<span class=\"hide-text\">Remove</span>\n\t\t\t\t\t\t<span class=\"close close--1\"></span>\n\t\t\t\t\t\t<span class=\"close close--2\"></span>\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t</div>`;\n\n\t\t\titems += cartItem;\n\t\t} );\n\n\t\t// Add the item to the cart.\n\t\tcartEl.innerHTML = items;\n\t}", "title": "" }, { "docid": "27e8ed68c8e674da856141b735065bdd", "score": "0.71300226", "text": "render() {\n\t\treturn (\n <div>\n <div className=\"products\">\n {this.props.list.map(product => \n <div className=\"product-div\" key={product.id}>\n <img className=\"preview-image\" src={product.image} alt={product.name}/>\n <Typography variant='h6' > <Box fontWeight=\"fontWeightBold\">{product.name}</Box></Typography>\n <Typography> Main Flavor: &nbsp; {product.flavor}</Typography>\n <Typography> Type: &nbsp; {product.type}</Typography>\n <Typography> Price: &nbsp; ${product.price}</Typography>\n <div className=\"button\">\n <Button onClick={() => this.props.addToCart(product)} variant=\"contained\">Add 1 to Cart</Button>\n </div>\n </div>\n )}\n </div>\n </div>\n\t\t);\n\t}", "title": "" }, { "docid": "e11c131b73bec6cfb5ee106c0d3f896c", "score": "0.7095955", "text": "function displayCart(){\n\tgetTotalCost();\n\tif( productsInCart){\n\t\t$(\".products-container\").html(\"\");\n Object.values(productsInCart).map(item => {\n\t\t\t$(\".products-container\").append(` \n <div class=\"product\">\n\t\t\t <button style=\"font-size:30px; color:darkcyan;\" class=\"btn rounded-circle\" id=${item.id}>\n\t\t\t <i class=\"fa fa-times-circle\"></i></button>\n <img src=\"${item.photo}\" width=\"200px\" height=\"200px\">\n </div>\n <div class=\"price\"> EGP${item.productPrice},00 </div>\n <div class=\"quantity\">\n <span>${item.amount}</span>\n </div>\n <div class=\"total\">\n EGP${item.amount * item.productPrice},00\n </div>`)\n\t\t});\n// to remove item from cart by clicking the button\n\t\t$(\".product button\").click(function()\n\t\t{\n\t\t\t// console.log( $(\".product button\"));\n\t\t\tprodId = $(this).attr(\"id\");\n\t\t\tconsole.log(prodId);\n\t\t\tremoveItembyId(prodId);\n\t });\n\t\t$(\".products-container\").append(` \n <div class=\"basketTotalContainer\">\n <h5 class=\"basketTotalTitle\">Total Cost</h5>\n <h5 class=\"basketTotal\"> EGP${totalCost},00</h5>\n\t\t</div>`);\n\t\t\n\t\t$(\"#checkcart\").show();\n\n\t}else{\n\t\t$(\"#checkcart\").hide();\n\t}\n\tif(document.querySelector('.cart span')) {\n\t\tdocument.querySelector('.cart span').textContent = cartItems;\n\t}\n\t\n}", "title": "" }, { "docid": "19cc46987399625d345947bcb0111fea", "score": "0.7056548", "text": "function renderProductToCart(paramProduct, paramIndex, paramOrderDetail) {\n let vResult = `\n\t\t\t<tr>\n\t\t\t\t<td class=\"si-pic\">\n\t\t\t\t\t<img style=\"width:72px; height:72px\"\n\t\t\t\t\t\tsrc=\"${paramProduct.urlImage}\"\n\t\t\t\t\t\talt=\"product\"\n\t\t\t\t\t/>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"si-text\">\n\t\t\t\t\t<div class=\"product-selected\">\n\t\t\t\t\t\t<p>${paramProduct.buyPrice.toLocaleString()} VNĐ x ${\n paramOrderDetail.quantityOrder\n }</p>\n\t\t\t\t\t\t<h6>${paramProduct.productName} </h6>\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"si-close\">\n\t\t\t\t\t<i data-index=\"${paramIndex}\" class=\"ti-close\"></i>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t`;\n $('.select-items tbody').append(vResult);\n }", "title": "" }, { "docid": "07671385ccde33c991b52f80d7365003", "score": "0.7027814", "text": "populateCartItem() {\n\t\tthis.cart.forEach(item => this.renderCartItem(item));\n\t}", "title": "" }, { "docid": "6197ad5b4ea50f43b4bded6e1e2b5fa4", "score": "0.7007065", "text": "function displayCart(){\n let cartItems = localStorage.getItem(\"productsInCart\");\n cartItems = JSON.parse(cartItems);\n let productContainer = document.querySelector(\".product-container\");\n if(cartItems && productContainer){\n productContainer.innerHTML = '';\n Object.values(cartItems).map(item=>{\n productContainer.innerHTML += `\n <div class=\"product\">\n <i class=\"fas fa-times-circle\"></i>\n <img src=\"./images/${item.tag}.PNG\">\n <span>${item.name}</span>\n </div>\n `\n }); \n }\n}", "title": "" }, { "docid": "32a92897fc6117412cb6bb9c9f4c5422", "score": "0.6963084", "text": "function renderCart() {\r\n const getProducts = JSON.parse(localStorage.getItem(\"cartItems\"));\r\n\r\n getProducts.forEach((element) => {\r\n document.getElementById(\r\n \"productsInCart\"\r\n ).innerHTML += `<tr class=\"table-default\">\r\n <td scope=\"row\">${element.title}</td>\r\n <td scope=\"row\">${element.price} $</td>\r\n <td>\r\n <button type=\"button\" class=\"btn btn-success\" onclick=\"addOneProduct(${\r\n element.id\r\n })\">+</button>\r\n <button type=\"button\" class=\"btn btn-light\">${element.quantity}</button>\r\n <button type=\"button\" class=\"btn btn-success\" onclick=\"removeOneProduct(${\r\n element.id\r\n })\">-</button>\r\n </td>\r\n <td id=\"total\">${(element.price * element.quantity).toFixed(\r\n 2\r\n )} $</td> \r\n \r\n </tr>`;\r\n });\r\n}", "title": "" }, { "docid": "eff834c061ce3b4ccb6f251175b16ac6", "score": "0.6950866", "text": "renderProducts(products) {\n console.log(products);\n let result = '';\n products.forEach(product => {\n result += `\n <article class=\"product\">\n <div class=\"img-container\">\n <img src=${product.imgUrl} alt=\"product\" class=\"product-img\">\n </div>\n <button class=\"bag-btn\" data-id=${product.id}>\n <i class=\"fas fa-shopping-cart\"></i>add to cart</button>\n <h3>${product.name}</h3>\n <h4>€ ${product.price}</h4>\n </article> \n `;\n });\n productDOM.innerHTML = result;\n }", "title": "" }, { "docid": "0559dfcdf65b06541686142dfd2180ae", "score": "0.6942501", "text": "displayProducts(products) {\n\t\tlet result = \"\";\n\t\tproducts.forEach((item) => {\n\t\t\tresult += `<section class=\"sect_cart\">\n\t\t\t\t<nav class=\"cart\">\n\t\t\t\t\t<nav>\n\t\t\t\t\t\t<img src=\"${item.imageUrl}\" class=\"img_product\"/>\n\t\t\t\t\t</nav>\n\t\t\t\t\t<nav class=\"text_cart\">\n\t\t\t\t\t\t<nav>\n\t\t\t\t\t\t\t<p>$ ${item.price}</p>\n\t\t\t\t\t\t\t<p>${item.title}</p>\n\t\t\t\t\t\t</nav>\n\t\t\t\t\t\t<nav>\n\t\t\t\t\t\t\t<button data-id=${item.id} class=\"btn add_cart\">Add</button>\n\t\t\t\t\t\t</nav>\n\t\t\t\t\t</nav>\n\t\t\t\t</nav>\n\t\t\t</section>`;\n\t\t\tsection_cart.innerHTML = result;\n\t\t});\n\t}", "title": "" }, { "docid": "80bdc6ef7e8e4a84059084193a430e02", "score": "0.69377255", "text": "renderProducts() {\n this.products.forEach(product => {\n const productEl = document.createElement(\"div\");\n productEl.className = \"store__item\";\n productEl.id = `prod-${product.id}`;\n productEl.innerHTML = `\n <div class=\"store__item-img\">\n <img src=${product.imageUrl} alt=${product.name}>\n </div>\n <p class=\"store__item-name\">\n ${product.name}\n </p>\n <p class=\"store__item-price\">\n $${product.price}\n </p>\n <button class=\"store__item-cart-btn\" type=\"button\" data-id=\"prod-${product.id}\">\n Add to Cart\n </button>\n <p class=\"store__item-added__alert\">\n Item added to the Cart\n </p>\n `;\n this.storeContainer.insertAdjacentElement(\"beforeend\", productEl);\n });\n }", "title": "" }, { "docid": "545de6f19d946946a9ab2d36b35f6e0b", "score": "0.6936625", "text": "function componentCartCard(product) {\n return `<div class=\"card id=\"cart-${product.id}\" mb-3\">\n <div class=\"card-header text-end\">\n <button type=\"button\" value=\"${product.id}\" class=\"btn btnremove btn-outline-danger btn-sm\">\n <i class=\"bi bi-x-square\"></i>\n Remove\n </button>\n \n </div>\n <div class=\"row g-0 align-items-center\">\n <div class=\"col-md-4\" >\n <img src=\"${product.image}\" class=\"img-fluid img-thumbnail rounded-start\" alt=\"...\">\n </div>\n <div class=\"col-md-8\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">${product.name}</h5>\n <h6 class=\"card-text\">Price: €${product.price}</h6>\n <h6 class=\"card-text\">Quantity: ${product.quantity}</h6> \n \n </div>\n </div>\n </div>\n </div>`;\n}", "title": "" }, { "docid": "7aaab7d255b1fa75735528408f0c0477", "score": "0.69158554", "text": "function renderCart(shoppingCart) {\n // si no lo vacio se duplica\n cleanCart()\n shoppingCart.forEach((product) => {\n const row = document.createElement('div')\n row.innerHTML = `\n <div class=\"row cart-detail\">\n <div class=\"col-lg-4 col-sm-4 col-4 cart-detail-img\">\n <img src=\"${product.imagen}\" width=100>\n </div>\n <div class=\"col-lg-8 col-sm-8 col-8 cart-detail-product\">\n <p>${product.titulo}</p>\n <span class=\"price text-info\">${product.precio}</span>\n <span class=\"count\">${product.cantidad}</span>\n <button class=\"btn btn-danger rounded ml-5\" onClick=\"deleteProduct(${product.id})\">\n <i id=\"trash\" class=\"far fa-trash-alt delete text-white\"></i>\n </button>\n </div>\n </div>\n `\n contenedorCarrito.appendChild(row)\n })\n}", "title": "" }, { "docid": "94e91324c01e93e3a186fcb5da6dcf13", "score": "0.6887867", "text": "function renderCart(cartItems) {\n let cartContainer = document.querySelector(\"#cart\");\n cartContainer.innerHTML = \"\";\n if (cartItems.length > 0) {\n cartItems.map((cartItem) => {\n cartContainer.innerHTML += `\n <div class = \"products\">\n <img src=\"${cartItem.product_image}\" class = \"product-image\">\n <div class = \"product-content\"> \n <h4 class = \"product-title\"> ${cartItem.product_name}</h4>\n <p class = \"product-quantity\"> ${cartItem.quantity}</p>\n <p class = \"product-price\">R${cartItem.price} </p>\n <button class =\"revome_cart\" onclick=\"removeItem(${cartItems.order_id})\">Remove item</button>\n </div>\n \n </div>\n \n \n `;\n });\n let totalPrice = cartItems.reduce((total, item) => total + item.price, 0);\n cartContainer.innerHTML += `<h3> Your total is: ${totalPrice} </h3>`;\n } else {\n cartContainer.innerHTML = \"<h2> No items in cart</h2>\";\n }\n}", "title": "" }, { "docid": "e82d29a9ff609947a46b0103c871c68f", "score": "0.68739796", "text": "function renderCart() {\n\n // Taking out main from html\n let main = document.getElementsByTagName(\"main\")[0]\n \n // Will not make a duplicate when clearing the cart from local Storage / Victor, var det så här du menade? \n main.innerHTML = \"\";\n\n\n // container to cart title and button \n let titleContainer = document.createElement(\"div\")\n titleContainer.classList.add(\"titleContainer\")\n main.appendChild(titleContainer)\n\n // Create cart Icon\n let cartIcon = document.createElement(\"div\")\n cartIcon.classList.add(\"cartIcon\")\n titleContainer.appendChild(cartIcon)\n cartIcon.innerHTML = '<i class=\"fas fa-shopping-cart\"></i>'\n\n // Create Title \"Kundvagn\"\n let title = document.createElement(\"h1\")\n title.classList.add(\"cartTitle\")\n title.innerText = \"Kundvagn\"\n titleContainer.appendChild(title)\n\n // Container that wraps all the shopping items together\n let wrapper = document.createElement(\"div\")\n wrapper.classList.add(\"wrapper\")\n main.appendChild(wrapper)\n\n if(cart == null) {\n loggedIn();\n }\n\n // Loop for the list with added items into the shopping cart \n for(let i = 0 ; i < cart.length ; i++ ) {\n\n let cartItem = cart[i] \n\n // Container to added item\n let div = document.createElement(\"div\")\n div.classList.add(\"containerAddedItem\")\n wrapper.appendChild(div)\n\n // Container to image \n let imageContainer = document.createElement(\"div\")\n imageContainer.classList.add(\"imageContainer\")\n div.appendChild(imageContainer)\n\n // Image // Add the list to source! \n let productImg = document.createElement(\"img\")\n productImg.classList.add(\"productImg\")\n productImg.src=\"./assets/\" + cartItem.product.image \n imageContainer.appendChild(productImg)\n\n // PhoneModel \n let phoneModelText = document.createElement(\"h2\")\n phoneModelText.innerText = cartItem.product.title\n div.appendChild(phoneModelText)\n\n\n // Price on phone \n let priceItem = document.createElement(\"h3\")\n priceItem.innerText = cartItem.product.price + \" kr\" + \" x \" + cartItem.quantity\n div.appendChild(priceItem)\n\n\n // Container to \"ta bort\"-button\n let buttonContainer = document.createElement(\"div\")\n buttonContainer.classList.add(\"buttonContainer\")\n buttonContainer.style = \"cursor:pointer\" \n buttonContainer.title = cartItem.product.title;\n buttonContainer.onclick = function() {\n deleteItem(this.title); \n }; \n\n div.appendChild(buttonContainer)\n \n // div to trashcan in buttoncontainer\n let trashIcon = document.createElement(\"div\")\n trashIcon.classList.add(\"trashIcon\")\n buttonContainer.appendChild(trashIcon)\n trashIcon.innerHTML = '<i class=\"far fa-trash-alt\"></i>'\n\n // Container to text in buttoncontainer // Onödig? \n let divButtonText = document.createElement(\"div\")\n divButtonText.classList.add(\"divButtonText\")\n buttonContainer.appendChild(divButtonText)\n\n // ButtonText\n let buttonText = document.createElement(\"p\")\n buttonText.innerText = \"Ta bort\"\n divButtonText.appendChild(buttonText)\n\n }\n\n // Summing the total price of the products in the cart \n let totalSum = cart.reduce((sum,item) => sum + item.product.price * item.quantity, 0);\n\n // totalPrice . Fetching the sum from \"totalSum\"\n let totalPrice = document.createElement(\"h3\")\n totalPrice.innerText = \"Totalt pris: \" + totalSum + \" kr\" \n totalPrice.classList.add(\"totalPrice\") \n main.appendChild(totalPrice)\n\n // ButtonCompletePurchase\n let buttonCompletePurchase = document.createElement(\"div\")\n buttonCompletePurchase.classList.add(\"buttonCompletePurchase\")\n main.appendChild(buttonCompletePurchase)\n buttonCompletePurchase.addEventListener(\"click\", completeTheOrder) \n buttonCompletePurchase.style = \"cursor:pointer\" \n\n // Container to check-icon \n let divComplete = document.createElement(\"div\")\n divComplete.classList.add(\"divComplete\")\n divComplete.innerHTML = ('<i class=\"fas fa-check\"></i>')\n buttonCompletePurchase.appendChild(divComplete)\n\n // ButtonCompletePurchaseText \n let buttonCompletePurchaseText = document.createElement(\"p\")\n buttonCompletePurchaseText.innerText = \"Slutför ditt köp\"\n buttonCompletePurchase.appendChild(buttonCompletePurchaseText) \n\n loggedIn();\n}", "title": "" }, { "docid": "c59eb9b14f38733a34e5331a1c7db3c3", "score": "0.684967", "text": "function renderProducts(cart) {\n // ....... dynamic cart starts here ...................\n const total_product = cart.map((item) => {\n return `<div class=\"col-md-3 col-6 shop_images1\">\n <div class=\"image-container image_clicked\" data-prodid=\"${item.id}\">\n <a href=\"shopping_cart_details4.html\"><img src=\"${item.img}\" alt=\"image not found\" class=\"image\" style=\"width:100%\" height=\"100%\"></a>\n <div class=\"middle add_to_cart\">\n \n <p class=\"text\" id=\"btn1\" data-toggle=\"modal\" data-target=\"#modalAbandonedCart\"><a style=\"color: white;\">Add to Cart</a>\n </p>\n </div>\n \n </div>\n <a href=\"shopping_cart_details4.html\" style=\"color: black !important;\"><h5 class=\"product_name image_clicked\" data-prodid=\"${item.id}\" style=\"font-weight: bold;padding-top: 10px;\">${item.title}</h5></a>\n <a href=\"shopping_cart_details4.html\" style=\"color: #f3b239 !important;\"><h6 class=\"image_clicked\" data-prodid=\"${item.id}\"><span style=\"font-weight: normal;font-size: 1em;\">${item.price}/-</h6></a>\n</div>`\n }).join('');\n\n const shopping_product1 = document.querySelector(\".shopping_product1\");\n shopping_product1.innerHTML = total_product;\n // return total_product;\n\n let image_clicked1 = document.querySelectorAll(\".image_clicked\");\n image_clicked1.forEach((e) => {\n e.addEventListener('click', (e) => {\n let prod_id = e.currentTarget.dataset.prodid;\n localStorage.setItem(\"id\", prod_id);\n });\n })\n}", "title": "" }, { "docid": "3de95dc152c913e4086f4c7fd99fe929", "score": "0.68223333", "text": "renderCartItem(item) {\n\t\t// DEFINE A SINGLE ITEM (using the CART ITEM data)\n\t\tconst element = CartItem(item);\n\t\t// CART ITEM \"DOM\" APPENDS \"ELEMENT\"\n\t\tCART_CONTENT.innerHTML += element;\n\t}", "title": "" }, { "docid": "658bfdbad673a0aba2c9c96f557fb594", "score": "0.6821959", "text": "render() {\n const productsInCart = this.renderProductsInCart();\n\n return (\n <div>\n <h1>Your order has been placed</h1>\n <h3>\n {this.props.itemsInCart}{' '}\n {this.props.itemsInCart === 1 ? ' item' : ' items'} for a Total Cost\n of ${this.props.totalCost}\n </h3>\n {productsInCart}\n </div>\n );\n }", "title": "" }, { "docid": "7c11e75c784fe81556c961e2cac3948a", "score": "0.6818501", "text": "showProductInCart() {\n let output = \"\";\n let cart = JSON.parse(localStorage.getItem(\"cart\")); //getting the cart from local storage\n\n //cart must have at least one item; go through the cart array of products and map each product to the output\n if (cart) {\n for (let i = 0; i <= cart.length - 1; i++) {\n output += `<tr class=\"cart-table-row\">\n <td class=\"cart-table-data td-img\">\n <img\n style=\"width: 2.5rem\"\n src=\"${cart[i].image}\"\n />\n </td>\n <td class=\"cart-table-data\">\n <a href=\"details.html?id=${cart[i].id}\" class=\"admin-title-link\">\n ${cart[i].title}</a\n >\n <p class=\"card-text\">\n <small class=\"text-muted\">${cart[i].author}</small>\n </p>\n </td>\n <td class=\"cart-table-data stock\" data-value=\"${cart[i].stock}\">Stock: ${cart[i].stock}</td>\n <td class=\"cart-table-data\">\n <div class=\"form-group field-product-quantity\">\n <input\n class=\"form-control form-control-sm quantity\"\n id=\"${cart[i].id}\"\n min=\"1\"\n max=\"${cart[i].stock}\"\n name=\"quantity\"\n value=\"${cart[i].qt}\"\n type=\"number\"\n />\n </div>\n </td>\n <td class=\"cart-table-data product-price\" data-value=\"${cart[i].price}\">€ ${cart[i].price}</td>\n <td class=\"cart-table-data\">\n <button type=\"button\" class=\"delete-product\" id=\"${cart[i].id}\">\n <i class=\"fas fa-trash-alt delete-product-from-cart\" id=\"${cart[i].id}\"></i>\n </button>\n </td>\n </tr>`;\n this.cartTableBody.innerHTML = output;\n }\n }\n }", "title": "" }, { "docid": "8472e9b66a6f4247fa7ab90e5b64b7fb", "score": "0.6781568", "text": "function renderCart() {\n if (shoppingCart.length == 0) {\n hideCart()\n } else {\n showCart()\n renderCartItems()\n }\n}", "title": "" }, { "docid": "445af983ddc60483071b72dd02c74932", "score": "0.674721", "text": "function paintInCart(productData) {\n const row = document.createElement('tr');\n row.innerHTML = `\n <td>\n <img src=\"${productData.image}\" width=100>\n </td>\n <td>${productData.tittle}</td>\n <td class= \"price\">${productData.price}</td>\n <td>\n <a href=\"#\" class=\"quit-item\" data-id=\"${productData.id}\">X</a>\n </td>\n `;\n cartList.appendChild(row);\n saveProductLocalStorage(productData);\n}", "title": "" }, { "docid": "46df4e8a0592cdad33be7598b01d43f3", "score": "0.67361706", "text": "function showCart() {\n $(\"#checkoutBtn\").addClass(\"d-none\");\n $('#cart-content').empty();\n total = 0;\n let row = '<div class=\"row\"></div>';\n let cartImage = '<div class=\"col-4\"></div>';\n let divColum = '<div class=\"col\"></div>';\n let cartsProducts = [];\n for (let i = 0; i < cart.length; i++) {\n let obj = products.find(({ id }) => id === cart[i].productId);\n obj.cart = cart[i]\n cartsProducts.push(obj);\n }\n for (let j = 0; j < cartsProducts.length; j++) {\n total += cartsProducts[j].cart.quantity * cartsProducts[j].price;\n let piece = cartsProducts[j].cart.quantity > 1 ? \" Items\" : \" Item\";\n $('#cart-content').append(\n $(row).attr('data-id', cartsProducts[j].id)\n .append($(cartImage).append('<img class=\"img-thumbnail\" src=\"' + baseImgUrl + cartsProducts[j].image + '\" />'))\n .append($(divColum)\n .append($('<h6>', { text: cartsProducts[j].name }))\n .append($('<h6>', { text: cartsProducts[j].price.toFixed(2) + '£' + \"/\" + cartsProducts[j].quantity + cartsProducts[j].units }))\n .append($('<span>', { text: cartsProducts[j].cart.quantity })\n .append($('<span>', { text: piece }))\n .append($('<i id=\"remove-item\" class=\"fas fa-trash float-right\"></i>').attr('data-product', JSON.stringify(cartsProducts[j]))\n .append($())\n )\n )\n )\n ).append($('<hr class=\"col-xs-12\">'));\n }\n $('#cart-total').text(total.toFixed(2) + '£');\n if (isLoggedIn) {\n $(\"#checkoutBtn\").removeClass(\"d-none\");\n }\n}", "title": "" }, { "docid": "3d5637cc597b7f1c4a71b04b55ee24c1", "score": "0.6710782", "text": "function renderProducts() {\n let html = productList.map(i =>\n `<section class=\"card\">\n <a class=\"product-img\" data-sku=\"${i.sku}\"><img class=\"product-img\" data-sku=\"${i.sku}\" title=\"${i.title}\" alt=\"${i.description}\" src=\"static/${Math.floor(Math.random() * 9)}.png\" /></a>\n <h3 class=\"product-description\">${i.title}</h3>\n <div class=\"product-price\">$ ${i.price}</div>\n <a class=\"product-cta\" data-sku=\"${i.sku}\">Add to Cart</a>\n </section>`).join(\"\");\n document.getElementById(\"content-details\").innerHTML = html;\n eventHandler();\n }", "title": "" }, { "docid": "a0f37f030902ebda074b5851aee0b7d6", "score": "0.67043936", "text": "function showProduct() {\n $(\"#addCartBtn\").removeClass(\"d-none\");\n let pid = $(event.target).data(\"productId\");\n let product = products.find(({ id }) => id === pid);\n let cartItem = cart.find(({ productId }) => productId === pid);\n let qty = 1;\n if (cartItem) {\n $(\"#addCartBtn\").addClass(\"d-none\");\n qty = cartItem.quantity;\n }\n $(\"#product_details_header h2\").remove();\n $(\".img-thumbnail\").removeClass(\"border-info\");\n $(\"#productQnt\").text(qty);\n $(\"#detailsMainImg\").attr(\"src\", baseImgUrl + product.image).data(\"productId\", pid);\n $(\"#details_title\").text(product.name);\n $(\"#details_price\").text(`${product.price.toFixed(2)} £/${product.quantity} ${product.units}`);\n}", "title": "" }, { "docid": "6578992604d24a8da8b748737eeaddd2", "score": "0.66427743", "text": "function createCard(product) {\n let div = $(`<div class=\"card\"></div>`);\n let img = $(`<img class=\"card-img-top\" src=${product.image_url} alt=\"Card image cap\"></img>`);\n let cardBody = $(`<div class=\"card-body\"></div>`);\n let cardDetails = $(`<h6 class=\"card-title\">${product.name}</h6>\n <p class=\"card-text\">Price: <b>₹ ${product.price}</p>\n `);\n\n let addtoCartButton = $(`<button type = \"button\" id = \"${product._id}\" class=\"btn btn-primary\"> Add to Cart</button>`);\n\n cardBody.append(cardDetails);\n div.append(img);\n div.append(cardBody);\n div.append(addtoCartButton);\n\n addtoCartButton.click((event) => {\n event.preventDefault();\n\n $.ajax({\n url: \"http://localhost:5555/user/cart/\" + product._id,\n method: 'POST',\n }).done(() => window.location.replace(\"http://localhost:5555/user/cart\"));\n });\n\n return div;\n }", "title": "" }, { "docid": "ad868027e04433781c40e3871a96ee3c", "score": "0.6629116", "text": "function displayCart(){\n let cartItems = localStorage.getItem('productsincart')\n cartItems = JSON.parse(cartItems)\n console.log(cartItems);\n\n let prodectContaner = document.querySelector('.products')\n let cartCost = localStorage.getItem('cost')\n if (cartItems && prodectContaner) {\n prodectContaner.innerHTML = '';\n Object.values(cartItems).map(item => {\n prodectContaner.innerHTML += `\n <div class=\"product\">\n <ion-icon name=\"close-circle\"></ion-icon>\n <img src=\"../img/women-dress-imgs/${item.name}.jpg\">\n <span>${item.name}</span> \n\n </div>\n\n\n <div class=\"price sm-hide\">${item.price}</div>\n <div class=\"quantity\">\n <ion-icon class=\"decrease \" name=\"arrow-dropleft-circle\"></ion-icon>\n <span>${item.incart}</span>\n <ion-icon class=\"increase\" name=\"arrow-dropright-circle\"></ion-icon> \n <ion-icon name=\"add-outline\"></ion-icon>\n </div>\n <div class=\"total\">${item.incart * item.price}</div>`\n\n\n\n \n \n }\n )\n prodectContaner.innerHTML += `\n <div class=\"basketTotalContainer\">\n <h4 class=\"basketTotalTitle\"> Total</h4>\n <h4 class=\"basketTotal\">$${cartCost},00</h4>\n </div>`\n\n \n\n}\n}", "title": "" }, { "docid": "8e4b3e737798c94b11a41e469bbb2dcb", "score": "0.66238505", "text": "function renderInCart (items) {\n inCartEl.innerHTML = '';\n var newItem;\n for (var i = 0; i < items.length; i++) {\n newItem = getListItemEl(items[i]);\n inCartEl.appendChild(newItem);\n };\n }", "title": "" }, { "docid": "837ea650d6e4c20dddce53af75d07943", "score": "0.66002667", "text": "SAVE_PRODUCT_TO_CART(state, product) {\n state.cart.push(product);\n }", "title": "" }, { "docid": "a8a3133d36073aaffede79614ad30485", "score": "0.6598409", "text": "function renderItems() {\n var productsHTML = \"\";\n var shoppingCartProducts = \"\";\n var i = 0;\n\n //Hide or show Empty Cart Button:\n showEmptyCart();\n\n //Render all selected items\n for (i; i < shoppingCartArr.length; i++)\n shoppingCartProducts += getHtmlFormat(shoppingCartArr[i], i, true);\n\n //Render all stock items\n for (i = 0; i < products.length; i++)\n productsHTML += getHtmlFormat(products[i], i, false);\n\n //Update the Html page:\n $('#shoppingCart').html(shoppingCartProducts);\n $('#products').html(productsHTML);\n}", "title": "" }, { "docid": "182fcd333a13304d6af40098a4ac0b2c", "score": "0.6580811", "text": "addCartProducts(theProduct) {\n const div = document.createElement(\"div\");\n div.classList.add(\"cart-item\");\n div.innerHTML = `\n <div class=\"cart-imageContainer\">\n <img src=${theProduct.image} alt=${theProduct.title} />\n </div>\n <div class=\"cartItem-details\">\n <h4 class=\"cartItem-name\">${theProduct.title}</h4>\n <h5 class=\"cartItem-price\">$${theProduct.price}</h5>\n <span class=\"remove-item\" data-id = ${theProduct.id}><i class=\"fas fa-trash\"></i> remove</span>\n </div>\n <div class=\"item-quantity\">\n <i class=\"fas fa-chevron-up\"data-id = ${theProduct.id}></i>\n <h4 class=\"product-quantity\" data-id = ${theProduct.amount}>1</h4>\n <i class=\"fas fa-chevron-down\"data-id = ${theProduct.id}></i>\n </div>\n `;\n cartProducts.appendChild(div);\n console.log(cartProducts);\n }", "title": "" }, { "docid": "dadf3a5fc0331f97da51ae09241adcc6", "score": "0.6574022", "text": "function ShoppingCart(props){\n const productDetails = props.cart.map((p,i)=>{\n return <ProductDetail \n addToCart={props.addToCart}\n key={i} \n product={p} />\n })\n return(\n <div className=\"row\">\n {productDetails}\n <button>Checkout</button>\n </div>\n )\n}", "title": "" }, { "docid": "cee8822c0f0fea4826852e877b403c43", "score": "0.65661496", "text": "render(){\n return (\n <div className='py-5'>\n <div className='container'>\n <h3>Our Products</h3>\n <div className='row'>\n { this.props.products.map(product => <Product key={product.id} product={product} handleDetail={this.props.handleDetail} addToCart={this.props.addToCart}/>) }\n </div>\n </div>\n </div>\n\n )\n }", "title": "" }, { "docid": "aa2f003009503976bcf1a30de85f5fcc", "score": "0.6564419", "text": "function renderCartItems() {\n let cart_arr = JSON.parse(localStorage.getItem(\"cart\"));\n let html = \"\";\n\n if (cart_arr && cart_arr.length > 0) {\n let subtotal = 0;\n\n $.each(cart_arr, function(i, item) {\n let total;\n\n if (item.discount) {\n total = item.discount * item.qty;\n } else {\n total = item.price * item.qty;\n }\n\n html += `\n <tr>\n <td class=\"product-col\" width=\"45%\">\n <div class=\"product\">\n <figure class=\"product-cart-media\">\n <a href=\"\">\n <img src=\"${item.photo}\"\n alt=\"${item.name}\">\n </a>\n </figure>\n \n <h3 class=\"product-cart-title\">\n <a href=\"\">${item.name}</a>\n </h3>\n </div>\n </td>\n <td class=\"price-col\">${\n item.discount\n ? item.discount.toLocaleString()\n : item.price.toLocaleString()\n } Ks</td>\n <td class=\"quantity-col\">\n <div id=\"product-cart-quantity\" class=\"cart-product-quantity\">\n <input type=\"number\" class=\"form-control qty-input\" data-key=\"${\n item.id\n }\" value=\"${\n item.qty\n }\" min=\"1\" max=\"10\" step=\"1\" data-decimals=\"0\"\n required>\n </div>\n </td>\n <td class=\"total-col\">${total.toLocaleString()} Ks</td>\n <td class=\"remove-col\"><button class=\"btn-remove\" data-id=\"${\n item.id\n }\"><i class=\"icon-close\"></i></button></td>\n </tr>\n `;\n\n subtotal += total;\n });\n\n $(\"#cart-tbody\").html(html);\n $(\".subtotal\").html(`${subtotal.toLocaleString()} Ks`);\n $(\".total\").html(`${subtotal.toLocaleString()} Ks`);\n\n // Initialize Qty Input Btns\n if ($.fn.inputSpinner) {\n $(\"#product-cart-quantity .qty-input\").inputSpinner({\n decrementButton: '<i class=\"icon-minus\"></i>',\n incrementButton: '<i class=\"icon-plus\"></i>',\n groupClass: \"input-spinner\",\n buttonsClass: \"btn-spinner\",\n buttonsWidth: \"26px\"\n });\n }\n } else {\n html += `\n <div class=\"container\">\n <div class=\"text-center\">\n <h3 class=\"mb-3\">YOUR CART IS EMPTY.</h3>\n <p>Before proceed to checkout you must add some products to your shopping cart.</p>\n <p class=\"mb-3\">You will find a lot of interesting products on our \"Shop\" page.</p>\n <a href=\"/\" class=\"btn btn-outline-dark-2 btn-inline mb-3\">RETURN TO SHOP</a>\n </div>\n </div>\n `;\n\n $(\".cart\").html(html);\n // $(\"#shoppingcart-table\").html(html);\n // $(\".subtotal\").html(\"0 Ks\");\n }\n}", "title": "" }, { "docid": "69bf4a778cbb3719c0cd8169c923c74f", "score": "0.6560031", "text": "function displayCart(){\r\n let itemsInCart = localStorage.getItem(\"productsInCart\");\r\n itemsInCart = JSON.parse(itemsInCart);\r\n\r\n let productContainer = document.querySelector(\".product-cart\");\r\n if(itemsInCart && productContainer){\r\n productContainer.innerHTML = '';\r\n Object.values(itemsInCart).map(item =>{\r\n productContainer.innerHTML += \r\n `<div class=\"prod-name\">\r\n <p>Produkt: ${item.name} - Pris: ${item.price}kr <br> Antal: ${item.inCart}\r\n </p></div>`\r\n \r\n })\r\n } \r\n}", "title": "" }, { "docid": "0dae4da1abc79b3c58f725afbb767aa5", "score": "0.65549946", "text": "function view_cart() {\n\t\n\tvar self = this;\n\tvar eshop = self.module('eshop');\n\n\teshop.cart_list(self, function(products, price, count) {\n\t\tself.view('shoppingcart', { products: products, price: price, count: count });\n\t});\n}", "title": "" }, { "docid": "0a93aa15fce332d698ee5b5fc12b7b08", "score": "0.653579", "text": "function displayCart() {\n let cartItems = localStorage.getItem(\"cart\");\n cartItems = JSON.parse(cartItems);\n let cartContainer = document.getElementById(\"cart-items\");\n let cartCheckout = document.querySelector(\".cart-buttons\");\n\n if (cartItems && cartContainer) {\n cartContainer.innerHTML = ``;\n cartCheckout.innerHTML = ``;\n\n Object.values(cartItems).map((item, index) => {\n cartContainer.innerHTML += `\n <div class=\"single-item\">\n <div class=\"item-image\">\n <a href=\"product-${item.id}.html\">\n <figure>\n <img src=\"images/products/product-${item.id}.jpg\" title=\"${item.title}\" alt=\"${item.title}\">\n </figure>\n </a>\n </div>\n <div class=\"item-info\">\n <div class=\"item-name\">\n <a href=\"product-${item.id}.html\">\n <p>${item.title}</p>\n </a>\n </div>\n <div class=\"item-options\">\n <p>${item.color}</p>\n <p class=\"item-options-divider\">/</p>\n <p>${item.size}</p>\n </div> \n </div>\n <div class=\"item-cost\">\n <p>${item.price}</p>\n <p class=\"remove-item\">Remove</p>\n </div>\n </div>\n `;\n });\n\n cartCheckout.innerHTML += `\n <div class=\"checkout-button\">\n <a href=\"#\">\n <p>checkout</p>\n </a>\n </div>\n <div>\n <a href=\"products.html\">\n <p>continue shopping</p>\n </a>\n </div>\n `;\n\n removeItem();\n storeCart();\n\n\n } else {\n cartContainer.innerHTML += `\n <div class=\"no-cart\">\n <p>You don't have any items in your cart.</p>\n </div>\n `;\n }\n}", "title": "" }, { "docid": "247e55b78d913bb3200f3c83b2eb9792", "score": "0.65138966", "text": "function componentCardShop(product) {\n const soldout = product.stock === 0;\n const btnbuy = soldout\n ? `<button id=\"${product.id}\" type=\"button\" class=\"btn btn-danger btnbuy\" disabled>Out of Stock</button>`\n : `<button id=\"${product.id}\" type=\"button\" class=\"btn btn-primary btnbuy\">Add to Cart</button>`;\n\n return `<div class=\"col-sm-6 col-md-4 col-lg-3\">\n <div class=\"product-card card\">\n <img\n class=\"card-img-top\"\n src=\"${product.image}\"\n alt=\"Emotions domino\"\n />\n <div class=\"card-body\">\n <h5 class=\"card-title\">\n ${product.name} \n </h5>\n <p class=\"product-info visually-hidden card-text text-justify\">${product.description}</p>\n <h6 class=\"product-info visually-hidden\">Age range: +${product.age}</h6>\n <h4>€${product.price}</h4>\n ${btnbuy}\n </div>\n </div>\n </div>`;\n}", "title": "" }, { "docid": "d87c0e4015482e24edb5bbf95abcbdbd", "score": "0.6513793", "text": "displayProducts(products) {\n // console.log(products);\n let result = \"\";\n products.forEach(product => {\n // console.log(result);\n result += `\n <!-- Single Product -->\n <article class=\"product\">\n \n <div class=\"img-container\">\n <h3 class=\"product-title\">${product.title}</h3>\n <img\n src=\"${product.image}\"\n alt=\"product\"\n class=\"product-img\"\n />\n <button class=\"bag-btn\" data-id=${product.id}>\n <i class=\"fas fa-shopping-cart\"></i>\n add to cart\n </button>\n </div>\n \n <h4>$${product.price}</h4>\n </article>\n <!-- END Single Product -->\n `;\n });\n // console.log(result);\n productsDOM.innerHTML = result;\n }", "title": "" }, { "docid": "dbc139be496b90888a48988e7575efab", "score": "0.65068364", "text": "showCoffeeProducts(products) {\n let output = \"\";\n products.forEach((product) => {\n if (product.category == \"coffee\") {\n output += `\n <div class=\"card m-3\" style=\"width: 13rem;\">\n <div class=\"card-body\">\n <img src=\"${product.image}\" class=\"card-img-top\" alt=\"...\">\n <h6 class=\"card-title\">${product.title}</h6>\n <h5 class=\"card-price\">€ ${product.price}</h5>\n <a class=\"btn btn-outline-success details\" href=\"details.html?id=${product.id}\" id=\"${product.id}\"><i class=\"fas fa-info-circle\"></i> DETAILS</a>\n </div>\n </div>`;\n this.productContainer.innerHTML = output;\n }\n });\n }", "title": "" }, { "docid": "e19cdbb1fda680316611bb8e85b0928d", "score": "0.6479674", "text": "displayProducts(products) {\n\t\t// console.log('products', products)\n\n\t\t// for (const product of products) {\n\t\t// console.log(product)\n\t\t// }\n\n\t\tlet result = '';\n\t\tproducts.forEach((product) => {\n\t\t\tresult += `\n <!--Product-->\n <div class=\"col-sm-6 col-md-3 mb-3\">\n <div class=\"card product\">\n <img src=${product.image} class=\"card-img-top product-img\" alt=\"...\">\n <div class=\"card-body text-center\">\n <h5 class=\"card-title\">${product.title}</h5>\n <p class=\"card-text mb-0\">Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusantium, velit dolor totam facilis <a href=\"product.html?id=${product.id}\"> Read More ...</a></p>\n <p class=\" mt-3\">Price : <span class=\"card-price\"> ${product.price} </span> EGP</p>\n </div>\n <button class=\"btn btn-warning bag-btn\" data-id=\"${product.id}\">Add To Cart <i class=\"fa fa-cart-plus\" aria-hidden=\"true\"></i></button>\n </div>\n </div>\n <!-- End of Product -->\n `;\n\t\t});\n\t\tproductsDOM.innerHTML = result;\n\t}", "title": "" }, { "docid": "e1a37cca5cc0ef795d704150f1875ed3", "score": "0.64715743", "text": "function shoppingCart__render() {\n shoppingCart.forEach(function (elem) {\n let total = 0;\n total += parseFloat(elem.product__price);\n });\n document.querySelector('.nav__cont').innerText = shoppingCart.length;\n \n }", "title": "" }, { "docid": "334d31fb439fc837c88fe9cfec7a1c89", "score": "0.6471383", "text": "function renderProductModal(sku) {\n let product = getItemByProperty(productList, \"sku\", sku);\n return ` <div class=\"product\">\n <div class=\"product-media\">\n <img src=\"static/0.png\" />\n </div>\n <div class=\"product-details\">\n <div class=\"product-head\"><i class=\"fa fa-star text-red\"></i><i class=\"fa fa-star text-red\"></i><i class=\"fa fa-star text-red\"></i>\n <i class=\"fa fa-star text-red\"></i>\n <i class=\"fa fa-star-o\"></i>\n <div><small class=\"text-gray\">${product.rating} reviews</small></div>\n </div>\n <div class=\"product-body\">\n <h1 class=\"product-title\">${product.title}</h1>\n <div class=\"product-stats\">\n <span class=\"product-price\">$ ${product.price}</span>\n <span class=\"product-quantity text-gray\">${product.price * 10}ml</span>\n </div>\n <button class=\"button product-cta\" data-sku=\"${product.sku}\">Add To Cart</button>\n <p class=\"text-gray product-description\">${product.description}</p>\n </div>\n </div>\n </div>\n <div class=\"more\"><a>More Details</a></div>`;\n }", "title": "" }, { "docid": "148214754acb958a65264dbfc68900dd", "score": "0.6465481", "text": "render() {\n const { product } = this.state;\n return (\n product && (\n <div className=\"Content2 d-flex container justify-content-center mt-5\">\n <div className=\"l-side mt-5\">\n <div className=\"carousel-img\">\n {this.checkImages(product.image)}\n </div>\n <div className=\"product-price mt-3 mr-4\">\n <h3>${product.price} HKD</h3>\n </div>\n <div className=\"in-stock ml-1\">\n <h6>\n In Stock:{\" \"}\n {product.available ? (\n <span role=\"img\" aria-label=\"available\">\n {\" \"}\n ✅\n </span>\n ) : (\n <span role=\"img\" aria-label=\"unvailable\">\n {\" \"}\n ❌\n </span>\n )}\n </h6>\n </div>\n <div className=\"product-buttons d-flex align-items-center mt-3\">\n {product.available ? <AddToCart product={product} /> : null}\n <br></br>\n <Link to={`/all_products`}>\n <Button\n style={{ backgroundColor: \"#000000\" }}\n size=\"md\"\n className=\"back-to-product-btn back-to-products\"\n >\n Back to Product page\n </Button>\n </Link>\n </div>\n </div>\n <div className=\"r-side mt-5 ml-4\">\n <div className=\"ProductTitle\">\n <h1>{product.title}</h1>\n </div>\n <div className=\"ProductDescription mt-3\">\n <h2>Health Benefits:</h2>\n <p>{product.description}</p>\n </div>\n </div>\n </div>\n )\n );\n }", "title": "" }, { "docid": "89a2e54358cd0515a5f2db6de889a5d8", "score": "0.6464411", "text": "function Product({title, price, rating, image, category, reviews, id, description}) {\n return (\n <div className=\"product\">\n \n <p className=\"product_title\">\n {title}\n </p>\n\n <p className=\"product_price\">\n <small>₹</small>\n <strong className=\"product_price_tag\">{price}</strong>\n </p>\n\n <p className=\"product_rating\">\n {rating}\n\n </p>\n\n <img src={image} alt=\"Product Image\" className=\"product_image\"/>\n\n <p className=\"product_category\">\n {category} \n </p>\n\n <p className=\"product_reviews\">\n {reviews}\n </p>\n\n <p className=\"product_id\">\n View: <a href={\"/products/\" + id}>{id}</a>\n </p>\n\n <button>Add to Cart</button>\n <button>Wishlist Item</button> \n\n </div>\n )\n}", "title": "" }, { "docid": "811da5e925311e0c9fa6c1ce0ae26809", "score": "0.6462774", "text": "function generateProduct() {\r\n let result = '';\r\n for (let i = 0; i < product.length; i++) {\r\n result += `<div class=\"card text-white\">\r\n <div class=\"card-header bg-success\">\r\n <h6>${product[i].name}</h6>\r\n </div>\r\n <div class=\"card-body bg-info\">\r\n <h5 class=\"card-title pricing-card-title\">Rp. ${product[i].price}</h5>\r\n <button type=\"submit\" class=\"btn btn-sm btn-outline-success bg-success text-white\" onclick=\"addCart(${product[i].id})\">Add to cart</button>\r\n </div>\r\n </div>`\r\n }\r\n document.getElementById('dataProduct').innerHTML = result;\r\n return result;\r\n}", "title": "" }, { "docid": "ec53829dde22b4f07d698679b39148c6", "score": "0.64620936", "text": "render() {\n\n const { cartData } = this.props;\n\n return <div className=\"cart-wrapper\">\n\n {\n cartData.length ?\n\n <div>\n\n <h1 className=\"title\"> Your Cart </h1>\n\n\n <div className=\"container\">\n {\n\n cartData.map((item, index) => {\n\n return <div className=\"cart-unit\" key={index}>\n\n <div className=\"image-wrapper\">\n <img src={`/img/${item.title}/${item.name}/img-1.jpeg`} alt=\"\" />\n </div>\n\n <div className=\"content\">\n <h1> {item.name} </h1>\n <p className=\"price\"> ${item.price} </p>\n <p className=\"size\">Size: {item.size} </p>\n <p className=\"quantity\">QTY: <span>{item.quantity}</span> </p>\n\n <button onClick={() => this.props.dispatch(removeItem({ ...item, index }))}>Remove</button>\n </div>\n\n </div>\n })\n }\n\n <div className=\"text-wrapper\">\n <h1>Total</h1>\n <h2> ${this.renderTotal()} </h2>\n </div>\n\n <div className=\"button-wrapper\">\n <Link to=\"/checkout\" >Go To CheckOut</Link>\n <button className=\"clear\" onClick={() => this.props.dispatch(clearCart())}>Clear Cart</button>\n </div>\n </div>\n\n </div>\n : <div className=\"cart-wrapper\">\n <div className=\"container\">\n <h1 className=\"cart-message\"> Your cart is empty </h1>\n </div>\n </div>\n }\n\n </div>\n }", "title": "" }, { "docid": "af92c20e70f7d26902c60f8806287380", "score": "0.6441478", "text": "renderCart() {\n const tbody = this.tableCart.getElementsByTagName('tbody')[0];\n const tfoot = this.tableCart.getElementsByTagName('tfoot')[0];\n \n //Clean the table\n tbody.innerHTML = '';\n tfoot.innerHTML = '';\n\n //Show a row for each item\n for (const item of this.cart.items) {\n const row = tbody.insertRow();\n row.setAttribute('id', item.idProduct)\n row.classList.add('table-cart-row');\n row.innerHTML = `\n <td class=\"table-cart-description\">\n <span>${item.nameProduct}</span>\n <img src=\"${item.image}\" alt=\"${item.nameProduct}\" class=\"table-cart-image\">\n </td>\n <td class=\"table-cart-item\">${item.quantity}</td>\n <td class=\"table-cart-item\">$ ${item.price}</td>\n <td class=\"table-cart-item\">$ ${item.subtotal}</td>\n <td class=\"table-cart-item\"><button class=\"table-btn-delete\">X</button></td>\n `;\n }\n\n //Hidden the buttons clean and buy if cart is empty\n let buttonIsHidden = true;\n if (Array.isArray(this.cart.items) && this.cart.items.length) {\n buttonIsHidden = false;\n }else {\n buttonIsHidden = true;\n }\n\n //Show the tfoot\n tfoot.innerHTML = `\n <tr class=\"table-cart-row-footer\">\n <td colspan=\"4\" class=\"table-cart-total table-cart-footer\">TOTAL</td>\n <td colspan=\"1\" class=\"table-cart-footer\">$ ${this.cart.total}</td>\n </tr>\n <tr class=\"table-btn\">\n <td colspan=\"4\"><button id=\"btn-clean\" class=\"table-btn-button ${buttonIsHidden ? 'hidden' : ''}\">VACIAR</button></td>\n <td><button id=\"btn-pay\" class=\"table-btn-button ${buttonIsHidden ? 'hidden' : ''}\">PAGAR</button></td>\n </tr>\n `;\n \n //Updated the show Quantity at header\n this.showQuantity();\n }", "title": "" }, { "docid": "68092ef9c5cb9c65a389c84fb7d054e7", "score": "0.6441214", "text": "render() {\n return (\n <Card className=\"productPage\">\n <CardContent>\n <Typography color=\"textSecondary\">\n {this.productType}\n </Typography>\n <Typography variant=\"textSecondary\" component=\"h2\">\n {this.product.name}\n </Typography>\n </CardContent>\n <CardActions>\n <Button size=\"small\" onClick={() => this.onAddedProduct(this.product)}>Add to Cart</Button>\n </CardActions>\n </Card>)\n }", "title": "" }, { "docid": "b8b9eef544334d6bd6a0789d5bfef698", "score": "0.64406323", "text": "function renderCartContent() {\n cartItemContainer.innerHTML = \"\";\n\n cart.cartContent.forEach((cartItem, index) => {\n cartItemTemplate(cartItem, index); //fonction déclarée dans le dossier \"templates\", fichier \"cartItemTemplate\"\n\n removeButton(index);\n\n setQuantityInputListeners(index);\n });\n\n displayTotalPrice();\n\n //si le panier est vide, pas de formulaire, et affichage de la phrase \"Votre panier est vide\"\n if (cart.isCartEmpty()) {\n document.querySelector(\"#empty-cart\").classList.remove(\"d-none\");\n document.querySelector(\".form-container\").classList.add(\"d-none\");\n }\n}", "title": "" }, { "docid": "c0931fba1563b3f4d01aa3acdec74312", "score": "0.64317703", "text": "function renderCart(product){\n\n var $cartRow = document.createElement('tr')\n var $itemCount = document.createElement('td')\n var $cartItem = document.createElement('td')\n var $removeHolder = document.createElement('td')\n var $removeButton = document.createElement('button')\n\n $removeButton.addEventListener('click', function(){\n $cartRow.textContent = ''\n counter = counter - 1\n priceHolder = priceHolder - product.price\n $totalPrice.textContent = Math.round(priceHolder)\n if(counter === 0){\n $circleIcon.classList.remove('fa', 'fa-circle')\n }\n })\n\n $itemCount.textContent = 1\n $totalPrice.textContent = '$ ' + Math.round(priceHolder)\n $cart.classList.add('card', 'pop-out-cart', 'disappear')\n $cartItem.textContent = null\n $cartItem.textContent = $cartItem.textContent + product.name\n $removeButton.classList.add('btn', 'btn-default')\n $removeButton.textContent = 'Remove'\n\n\n $cartIcon.appendChild($cart)\n $cart.appendChild($cartTable)\n $cartTable.appendChild($cartRow)\n $cartTable.appendChild($priceRow)\n $priceRow.appendChild($spaceHolder)\n $priceRow.appendChild($priceName)\n $priceRow.appendChild($totalPrice)\n $cartRow.appendChild($itemCount)\n $cartRow.appendChild($cartItem)\n $cartRow.appendChild($removeHolder)\n $removeHolder.appendChild($removeButton)\n\n return $cart\n}", "title": "" }, { "docid": "c9b714c5a9ba6a94512623c63a8b7129", "score": "0.6424727", "text": "renderProducts(products) {\n\t\t// FOR EVERY SINGLE PRODUCT\n\t\tproducts.forEach((product, index) => {\n\t\t\t// DEFINE A SINGLE PRODUCT (using the products data)\n\t\t\tconst element = Product(product, index);\n\t\t\t// PRODUCTS \"DOM\" APPENDS \"ELEMENT\"\n\t\t\tPRODUCTS.innerHTML += element;\n\t\t});\n\t\t// GET PRODUCTS FROM STORAGE\n\t\tproducts = Storage.GetItem(\"products\") || products;\n\t\t// GET ALL ADD TO CART BUTTONS\n\t\tthis.getAddToCartButtons(products);\n\t\t// FUNCTIONALITIES FOR REMOVING CART ITEMS\n\t\tthis.cartLogic();\n\t}", "title": "" }, { "docid": "d08189cd4338d38884c043fa67105ade", "score": "0.6423091", "text": "function addToCart(prod,q,redirect) {\n saveProducts();\n if(productsInCart!= null){\n if(`${prod.ProductId}` in productsInCart )\n {\n productsInCart[prod.ProductId].amount +=q;\n }else\n {\n let product ={\n\t\t\t\tid:prod.ProductId,\n productName:prod.Name,\n amount:q,\n productPrice:prod.Price,\n productCat:prod.Category,\n supplierName:prod.SupplierName,\n photo:prod.ProductPicUrl\n }\n productsInCart={\n ...productsInCart,\n [prod.ProductId]:product\n }\n }\n\t}\n\t\n else{ // in case it is the first product i put in cart\n productsInCart={\n [prod.ProductId]:{\n\t\t\t\tid:prod.ProductId,\n\t\t\t\tproductName:prod.Name,\n\t\t\t\tamount:q,\n\t\t\t\tproductPrice:prod.Price,\n\t\t\t\tproductCat:prod.Category,\n\t\t\t\tsupplierName:prod.SupplierName,\n\t\t\t\tphoto:prod.ProductPicUrl\n\t\t\t}\n }\n }\n\tcartItems=cartItems+q;\n localStorage.setItem('productInCart', JSON.stringify(productsInCart));\n\tlocalStorage.setItem('cartNumbers', cartItems);\n\tif(document.querySelector('.cart span')) {\n\t\tdocument.querySelector('.cart span').textContent=cartItems; \n\t}\n\n\tgetTotalCost(); \n\t$(\"#side\").html(`${cartItems} items , EGP${totalCost} <a href='his.html' id='checked'>Checkout</a>`); \n\t\n\tif(redirect) {\n\t\twindow.location = \"cart.html\";\n\t} \n}", "title": "" }, { "docid": "aef768d89665e7da31d46ba2782bd21f", "score": "0.64085674", "text": "function displayCart() {\n let cartItems = localStorage.getItem(\"productsInCart\");\n cartItems = JSON.parse(cartItems);\n let productContainer = document.querySelector(\".cart-list\");\n let cartCost = localStorage.getItem('totalCost');\n const contactForm = document.querySelector('.wrapperForm');\n\n if(cartItems && productContainer) {\n contactForm.style.display = 'block';\n productContainer.innerHTML = '';\n cartItems.forEach(product => {\n productContainer.innerHTML += `\n <div class=\"cart-product\">\n <img src=\"${product.imageUrl}\" class=\"image\">\n <div><span>${product.name}</span></div>\n <div class=\"price\">${product.price/100},00€</div>\n </div>\n `;\n });\n\n productContainer.innerHTML += `\n <div class=\"basketTotalContainer\">\n <h4 class=\"cart-total\">\n Total Panier: &nbsp;\n ${cartCost/100},00€\n </h4>\n </div>\n <button class=\"suppress-btn\"> Vider le panier </button>\n `;\n\n } else {\n productContainer.innerHTML += `<h1> Votre panier est vide </h1>`;\n contactForm.style.display = 'none';\n }\n}", "title": "" }, { "docid": "9c89cd66f488806b12e515396a3bf365", "score": "0.64045084", "text": "function addCard(product){\r\n let str = \"\";\r\n str += \"<div class='col-sm-4'>\";\r\n str += \"<a class='linkProduct' href='product.html?_id=<?=\"+product._id.$oid+\"'>\";\r\n str += \"<div class='card text-center' href='product.html?id=\"+product._id.$oid+\"'>\";\r\n str += \"<img class='card-img-top' src='\"+product.image_url+\"' alt='\"+product.brand + \" \" + product.model+\"'>\";\r\n str += \"<div class='card-body'>\";\r\n str += \"<h4>\" + product.brand + \" \" + product.model + \"</h4>\";\r\n str += \"<p>Price: &euro; \" + product.price + \"</p>\";\r\n str += \"<a class='btn btn-purchase btn-buynow btn-md' href='#'>Buy now</a>\";\r\n str += \"<a class='btn btn-purchase btn-addtocart btn-md' href='#'>Add to cart</a>\";\r\n str += \"</div>\";\r\n str += \"</div>\";\r\n str += \"</a>\";\r\n str += \"</div>\";\r\n return str;\r\n}", "title": "" }, { "docid": "9922ebe3ab55b69a95bc836c6f2d0fae", "score": "0.6400737", "text": "function Catalog(props) {\n const history = useHistory();\n const products = props.products.map(product => (\n <div\n key={product.id}\n onClick={() => {\n history.push(`/product/${product.id}`);\n }}\n >\n <ProductPreview key={product.id} product={product} />\n </div>\n ));\n return <div>{products}</div>;\n}", "title": "" }, { "docid": "6e3bf0812114c9aff17131b337361f84", "score": "0.6388053", "text": "function showCartProducts() {\n\n let cartProducts = []; //adding all localSctorage products into array\n let totalBill = 0; //set initial bill to 0\n let totalQuantity = 0;\n\n cartProducts = JSON.parse(localStorage.getItem(\"products\"));\n\n /* sort cart items, so order \n should always be same, when \n edit / delete the items from cart\n */\n if (cartProducts !== null && cartProducts.length > 0) {\n cartProducts.sort((a, b) => {\n return a.product_id - b.product_id;\n });\n\n // set the table head when no products are in cart\n document.querySelector(\".user-cart-head\").innerHTML =\n `<tr>\n <th scope=\"col\" class=\"border-0\">\n <div class=\"p-2 px-3 text-uppercase\">Product</div>\n </th>\n <th scope=\"col\" class=\"border-0 price\">\n <div class=\"py-2 text-uppercase\">Price</div>\n </th>\n <th scope=\"col\" class=\"border-0\">\n <div class=\"py-2 text-uppercase\">Quantity</div>\n </th>\n </tr>`;\n\n // set the array values in user cart table\n document.querySelector(\".user-cart-table\").innerHTML = cartProducts.map(product => {\n\n totalBill += product.total_price; //add - all cart products prices\n totalQuantity += product.product_quantity; //sum of all products quantity\n return `<tr>\n <th scope=\"row\" class=\"border-0\">\n <div class=\"p-2\">\n <img src=\"${product.product_image}\" alt=\"\"\n width=\"70\" class=\"img-fluid rounded shadow-sm\">\n <div class=\"ml-3 d-inline-block align-middle\">\n <h5 class=\"mb-0\"> <a href=\"product_detail.html?p_id=${product.product_id}\"\n class=\"text-dark d-inline-block align-middle\">${product.product_name}\n </a></h5><span class=\"text-muted font-weight-normal font-italic d-block\">\n Category: ${product.category_name}</span>\n <div class=\"price-sm\"><strong>RS. ${product.product_price} x ${product.product_quantity}</strong></div>\n </div>\n </div>\n </th>\n <td class=\"border-0 align-middle price\"><strong>RS. ${product.product_price} x ${product.product_quantity}</strong></td>\n <td class=\"border-0 align-middle\">\n <div class=\"d-flex flex-lg-row\">\n <input type=\"button\" class=\"sub-product edit-product\" id=\"sub-${product.product_id}\" value=\"-\">\n <input class=\"cart-edit product-quantity\" type=\"text\" name=\"quantity\" id=\"quantity-${product.product_id}\" value=\"${product.product_quantity}\" disabled>\n <input type=\"button\" class=\"add-product edit-product\" id=\"add-${product.product_id}\" value=\"+\">\n </div>\n </td>\n </tr>`;\n }).join('');\n\n //*** set the sub-total and total bill in order summary ***\n document.querySelector(\".sub-total-bill\").innerHTML = totalBill + \" RS.\";\n document.querySelector(\".total-bill\").innerHTML = totalBill + \" RS.\";\n\n //*** set the sub-total and total bill in checkout popup ***\n document.querySelector(\".checkout-quantity\").innerHTML = totalQuantity;\n document.querySelector(\".checkout-total-bill\").innerHTML = totalBill + \" RS.\";\n let discountBill = totalBill - ((totalBill * 10) / 100); // calculating discount\n document.querySelector(\".checkout-discount-bill\").innerHTML = discountBill + \" RS.\";\n\n /********************* edit cart functionality ********************/\n\n // get all button of table\n let editProducts = document.querySelectorAll(\".edit-product\");\n\n for (let i = 0; i < editProducts.length; i++) {\n //for identify the event listner and call updateCart function\n editProducts[i].addEventListener('click', updateCart, false);\n }\n }\n else {\n // remove the order summary and personal data form wen no item at cart\n document.querySelector(\".order-details\").style.display = \"none\";\n\n // show cart empty msg with return o back option\n document.querySelector(\".user-cart-table\").innerHTML =\n `<div class=\"col-lg-12 d-flex justify-content-center\">\n <div>\n <h5 class=\"my-2\">Your cart is currently empty.</h5>\n <div class=\"d-flex justify-content-center\">\n <a href=\"../index.html#shop-by-category\" class=\"btn d-inline-block align-middle mt-2\">RETURN TO SHOP</a> \n </div>\n </div>\n </div>`;\n }\n\n // setting the total quantity on UI - cart icon\n document.querySelector(\".total-quantity\").innerHTML = `<span>${totalQuantity}</span>`;\n}", "title": "" }, { "docid": "e16e3cf1df53b4be8465825bb4105f43", "score": "0.6375008", "text": "function renderCartItems(){\n ShoppingCartitems.innerHTML = '';\n for(let item of cart){\n ShoppingCartitems.innerHTML += `\n <li class=\"clearfix\">\n <img class=\"cart-img\" src='${item.img}'/>\n <span class=\"item-name\">${item.title}</span>\n <span class=\"item-price\">${item.price}</span>\n <span id=${item.id} class=\"item-delete\"><i onclick=\"removeItem(window.event)\" class=\"fas fa-trash-alt\"></i></span>\n </li>`\n }\n itemsAmount.innerHTML = '';\n itemsAmount.innerHTML = cart.length;\n\n let totalPrice = cart.reduce((accum, item) => { return accum + item.price} ,0)\n total.innerHTML = '';\n total.innerHTML = totalPrice.toFixed(2);\n}", "title": "" }, { "docid": "53c424892b2e790a614e26fdeff23597", "score": "0.6373209", "text": "render() {\n if(this.props.cart.cart.totalQuantity>0) {\n return(\n <div>\n <ul className=\"cart-box cart-box-pages active\">\n {/* */}\n {this.props.cart.cart.items.map((item,index) => <HeaderCartItem key={index} itemDetails={item} addItem={this.onClickAdd} removeItem={this.onClickRemove}></HeaderCartItem>)}\n <li className=\"cart-subtotal text-right\">Total: ${this.props.cart.cart.totalPrice}</li>\n <li className=\"cart-footer\">\n <div className=\"row\">\n <div className=\"col-xs-6\">\n <Link to=\"/\" className=\"btn btn-default\">View Cart</Link>\n </div>\n <div className=\"col-xs-6\">\n <Link to='/' className=\"btn btn-default\">Checkout</Link>\n </div>\n </div>\n </li>\n </ul>\n </div>\n );\n }\n else {\n return(\n <div>\n <ul className=\"cart-box cart-box-pages active\">\n <li className=\"cart-content\">\n Your cart is empty.\n </li>\n <li className=\"cart-subtotal text-right\">Total: $0</li>\n <li className=\"cart-footer\">\n <div className=\"row\">\n <div className=\"col-xs-12\">\n {/* <a href=\"cart.html\" className=\"btn btn-default\" title=\"View Cart\">View Cart</a> */}\n <Link style={{width:'100%'}} to=\"/\" className=\"btn btn-default\">View Cart</Link>\n </div>\n </div>\n </li>\n </ul>\n </div>\n );\n }\n }", "title": "" }, { "docid": "a0317d2d454b7f2fb207fe670f305ad4", "score": "0.63722783", "text": "launchProductCartPage() {\n let view = new ProductCartView;\n view.render();\n }", "title": "" }, { "docid": "711ecd4630c44b6e38171216c6060083", "score": "0.63700634", "text": "function renderCart(cart, container){\n\t\tvar template = $('.stuff-template');\n\t\tvar idx, item;\n\t\tvar sum = 0;\n\t\tvar total = 0;\n\n\t\t$(\".cart\").show();\n\t\tcontainer.empty();\n\n\t\tfor(idx = 0; idx < cart.items.length; ++idx){\n\t\t\titem = cart.items[idx];\n\t\t\tsum += parseInt(item.price);\n\t\t\tvar but = $(\"<button></button>\");\n\n\t\t\tif(item.type == \"pizza\"){\n\t\t\t\tbut.html(item.name + \" \" + item.size + \" \" + \"$\" + item.price);\n\t\t\t\t\n\t\t\t}else{\n\t\t\t\tbut.html(item.name + \" \" + \"$\" + item.price);\n\t\t\t}\n\t \n\t\t but.attr('data-name', item.name);\n\t\t but.attr('data-type', item.type);\n\n\t\t console.log(item.type);\n\t\t but.attr('data-size', item.size);\n\t\t but.attr('data-price', item.price);\n\t\t but.attr('class', \"btn remove\");\n\t\t but.attr('data-index', idx);\n\n\t\t container.append(but);\n\t\t}\n\n\t\t//calculates the subtotal and total (with tax)\n\t\tsubTotal = sum;\n\t\tconsole.log(sum);\n\t\t$(\".subtotal\").html(\"Subtotal: $\" + sum);\n\t\ttotal = sum * 1.095;\n\t\t$(\".dah-total\").html(\"Total (includes 0.095% tax): $\" + total.toFixed(2));\n\n\t\t//removes items that are unwanted\n\t\t$('.remove').click(function(){\n\t\t\tvar idxToRemove = this.getAttribute('.data-index');\n\t\t\tcart.items.splice(idxToRemove, 1);\n\n\t\t\trenderCart(cart, $('.cart-container'));\n\t\t})\n\t}", "title": "" }, { "docid": "db7432feecf501cdfffd4ebd26663d4b", "score": "0.6360854", "text": "function addToCart(product) {\n //get cart object from local storage, unstring it\n var pbh_cart = JSON.parse(localStorage.pbh_cart);\n \n //check if the item is already in the cart\n var isItemInCart = false;\n pbh_cart.products.forEach(function(p) {\n if(p.itemProductID == product.itemProductID) {\n p.itemQty += product.itemQty;\n isItemInCart = true;\n }\n \n });\n \n //add product to cart object, \n if(!isItemInCart) { pbh_cart.products.push(product)};\n \n //update the shopping cart icon\n var cartQty = Number($(\"#cart_qty\").text());\n cartQty += product.itemQty;\n \n $(\"#cart_qty\").text(cartQty);\n \n //return cart data to local storage, restring it\n localStorage.setItem (\"pbh_cart\", JSON.stringify(pbh_cart));\n \n \n }", "title": "" }, { "docid": "d732bf0f209b6e55b035fe4461f98a8e", "score": "0.63572836", "text": "async productShow(req, res) {\n const result = await UserModel.getProduct(req, res);\n\n if (req.cookies.cart !== undefined) {\n res.render(\"../views/user/show\", { product: result, cart: UserModel.cartTotal });\n return;\n }\n res.render(\"../views/user/show\", { product: result });\n }", "title": "" }, { "docid": "ef325675e8d80badae59948b8c0dc912", "score": "0.6337352", "text": "function templateCart(product)\n{\n\n let price = 0\n \n if (product.quantity > 1) {\n price = (product.price / 100) * product.quantity\n }else {\n price = product.price / 100\n }\n\n const cartList = document.getElementById('table-products')\n\n // Get template article\n const template = document.getElementById('table-cart')\n\n // Clone template article\n const cloneTemplate = document.importNode(template.content, true)\n\n // Insert data in template\n cloneTemplate.getElementById('table-img').innerHTML = '<img id=\"cart--img\" src=\"' + product.imageUrl + '\" alt=\"\" width=\"80%\"><p>' + product.name + '</p> <p>' + product.lense + '</p>'\n cloneTemplate.getElementById('table-quantity').textContent = product.quantity\n cloneTemplate.getElementById('table-amount').textContent = price + '.00€'\n cloneTemplate.getElementById('cart--trash').setAttribute('onclick', 'deleteProductToCart(\\'' + product._id + '\\')')\n\n // Display template with data\n cartList.appendChild(cloneTemplate)\n\n}", "title": "" }, { "docid": "2f62f172dbfe9ac1494334e17f7d0ed8", "score": "0.6328633", "text": "function displayCart() {\n\t// get cart items\n\t$.post(\"../Model/requestHandler.php\",\n\t\t{\n\t\t\trequest:\"getCartItems\"\n\n\t\t},\n\t\tfunction(data, status){\n\t\t\t// get first product\n\t\t\tvar items = JSON.parse(data);\n\n\t\t\t// todo: add to cart animation\n\t\t\t$('.popuptext').html('');\n\t\t\tvar total = 0;\n\t\t\tfor(var i = 0; i < items.length; i++) {\n\t\t\t\ttotal = total + items[i].total;\n\n\t\t\t\t// templatize\n\t\t\t\tvar htmlTemplate = buildCartItemTemplate(items[i]);\n\n\t\t\t\t$('.popuptext').append(htmlTemplate);\n\t\t\t}\n\n\t\t\tvar cartTotalXs = \"<div>\" +\n\t\t\t\t\t\t\t \"<strong>Total: </strong>\" +\n\t\t\t\t\t\t\t \"<label>$\" + total + \"</label>\" +\n\t\t\t\t\t\t\t \"</div>\" +\n\t\t\t\t\t\t\t \"<button class='form-button-xs' \" +\n\t\t\t\t\t\t\t \t\t \"onclick='window.location.href=\\\"product_cart.php\\\"'>Check Out\" +\n\t\t\t\t\t\t \t \"</button>\";\n\t\t\t$('.popuptext').append(cartTotalXs);\n\n\n\t\t\tvar popup = document.getElementById(\"myPopup\");\n\t\t\tpopup.classList.toggle(\"show\");\n\n\t\t\t$('#myPopup').show('fast');\n\n\t\t\t$('.cover').css('z-index', 3);\n\t\t}\n\t);\n}", "title": "" }, { "docid": "ef797bf3ad9586cc6224eb64bac0c332", "score": "0.6327176", "text": "function viewCart() {\n if (cart === null) {\n let item = products[i];\n return (document.getElementById(\n \"cart\"\n ).innerHTML = `<div>Your cart is empty.</div>`);\n } else {\n cart.forEach(item => {\n return (document.getElementById(\"cart\").innerHTML = `<li>${cart}</li>`);\n });\n }\n console.log(cart);\n}", "title": "" }, { "docid": "bebfec80e478e37e8ef1206b33a5b14f", "score": "0.63203746", "text": "function displayItems(data){\n $(\"#cart-size\").text(data.quantity);\n $(\".top-cart-items\").empty();\n $.each(data.products, function (index, product) {\n var name = product.name;\n var price = product.price;\n var quantity = product.quantity;\n var image = product.images[0].imageUrl;\n $(\".top-cart-items\").append(`<div class=\"top-cart-item clearfix\">\n <div class=\"top-cart-item-image\">\n <a href=\"#\"><img src=\"/images/${image}\" alt=\"${name}\"></a>\n </div><div class=\"top-cart-item-desc\">\n <a href=\"#\" class=\"t400\">${name}</a>\n <span class=\"top-cart-item-price\">$${price}</span>\n <span class=\"top-cart-item-quantity t600\">x ${quantity}</span>\n </div>\n </div>`);\n\n\n });\n $(\"#cart-total\").text(`$${data.cartSubtotal}`);\n}", "title": "" }, { "docid": "d311bcb1bb2e9d7b332541b62e754c0a", "score": "0.6303981", "text": "function renderCart(cart, container) {\n var idx, item;\n var template = $('.cart-item-template');\n var clonedTemplate;\n\n //empty the container of whatever is there currently\n container.empty();\n\n //for each item in the cart...\n for (idx = 0; idx < cart.items.length; ++idx) {\n item = cart.items[idx];\n\n //TODO: code to render the cart item\n clonedTemplate = template.clone();\n if (item.type == 'pizza') {\n clonedTemplate.find('.title').html(item.name + \" (\" + item.size + \")\"); \n } else {\n clonedTemplate.find('.title').html(item.name); \n }\n clonedTemplate.find('.price').html(item.price);\n clonedTemplate.removeClass('cart-item-template');\n container.append(clonedTemplate);\n } //for each cart item\n\n //TODO: code to render sub-total price of the cart\n //the tax amount (see instructions), \n //and the grand total\n var subtotal = $('.subtotal'); \n var tax = $('.tax'); \n var grandTotal = $('.grand-total'); \n var totalPrice = 0;\n for (idx = 0; idx < cart.items.length; ++idx) {\n totalPrice = parseInt(totalPrice) + parseInt(cart.items[idx].price);\n }\n subtotal.html(totalPrice);\n var taxTotal = totalPrice * .095; \n tax.html(taxTotal.toFixed(2));\n var allTotal = totalPrice + taxTotal; \n grandTotal.html(allTotal.toFixed(2)); \n\n} //renderCart()", "title": "" }, { "docid": "f77fffe26253c47812e98a4ae6d1cd00", "score": "0.6293974", "text": "function addToBag({product}){\n var cartProducts =[];\n var cartCount = 0;\n var prodAlreadyInCart = \"false\";\n let cartObject = JSON.parse(localStorage.getItem(\"cart\"));\n let cartItems =\"\";\n if (cartObject != null) {\n cartItems = cartObject.cartItems;\n console.log(\"products: \"+ product);\n cartItems.map(cartItem => {\n cartCount = cartCount+1;\n //Check if the product already exist in the cart\n if (prodAlreadyInCart === \"false\"){\n if(cartItem.product.productID !== null && cartItem.product.productID === product.productID){\n //Product found in cart\n prodAlreadyInCart = \"true\"; \n console.log(\"Product is already in your cart...\");\n }\n }\n });\n } \n //If the product doesn't exist in the cart, add it to the cart.\n if (prodAlreadyInCart === \"false\"){\n //When the product is added to cart from outside PDP, quantity will be 1 and color will be the SKU color.\n //Since color and SKU selection is provided in PDP alone.\n cartItems.push({\"product\": product, \"quantity\": \"1\", \"color\":product.filterableFacets.Color});\n cartCount = cartCount +1;\n //Update the shopping cart with the products in localstorage.\n UpdateCart(\"updateProducts\", cartItems);\n //Keep the cart product count in localstorage to display on the badge.\n localStorage.setItem(\"cartCount\",JSON.stringify(cartCount));\n }\n}", "title": "" }, { "docid": "9111c82f290da07bb6cd128e19445eb9", "score": "0.62864345", "text": "function renderDetails(product){\n\n $exit.classList.add('thumbnail', 'exit', 'text-center', 'rounded')\n $exit.addEventListener('click', function(){\n $container.classList.remove('filter')\n $exit.classList.remove('exit', 'thumbnail')\n $exit.innerHTML = ''\n })\n var $exitButton = document.createElement('button')\n $exitButton.classList.add('btn','btn-default', 'exit-btn')\n $exitButton.textContent = 'X'\n\n var $addButton = document.createElement('button')\n $addButton.classList.add('btn', 'btn-default', 'add-button')\n $addButton.textContent = 'Add To Cart'\n\n $addButton.addEventListener('click', function(){\n cart.push(product)\n counter ++\n priceHolder = priceHolder + product.price\n $cartIcon.appendChild($circleIcon)\n renderCart(product)\n $cart.classList.add('disappear')\n $circleIcon.classList.add('fa', 'fa-circle')\n $circleIcon.setAttribute('aria-hidden', 'true')\n })\n\n var $details = document.createElement('div')\n $details.classList.add('card-body', 'rounded')\n\n var $title = document.createElement('h2')\n $title.textContent = product.name\n $title.classList.add('card-title')\n\n var $table = document.createElement('table')\n\n var $row = document.createElement('tr')\n\n var $originCell = document.createElement('td')\n $originCell.textContent = 'Origin: '\n\n var $originContent = document.createElement('td')\n $originContent.textContent = product.details.origin\n\n var $rowTwo = document.createElement('tr')\n\n var $descriptionCell = document.createElement('td')\n $descriptionCell.textContent = 'Description: '\n\n var $descriptionContent= document.createElement('td')\n $descriptionContent.textContent = product.details.description\n\n var $rowThree = document.createElement('tr')\n\n var $aromaCell = document.createElement('td')\n $aromaCell.textContent = 'Aromas: '\n\n var $aromaContent = document.createElement('td')\n $aromaContent.textContent = product.details.aroma\n\n var $rowFour = document.createElement('tr')\n\n var $ammountCell = document.createElement('td')\n $ammountCell.textContent = 'Quantity: '\n\n var $ammountContent = document.createElement('td')\n $ammountContent.textContent = product.details.ammount\n\n var $price = document.createElement('p')\n $price.textContent = 'Price: ' + product.price\n $price.classList.add('details-price')\n\n $exit.appendChild($exitButton)\n $exit.appendChild($title)\n $exit.appendChild($details)\n $exit.appendChild($price)\n $exit.appendChild($addButton)\n $details.appendChild($table)\n $table.appendChild($row)\n $row.appendChild($originCell)\n $row.appendChild($originContent)\n $table.appendChild($rowTwo)\n $rowTwo.appendChild($descriptionCell)\n $rowTwo.appendChild($descriptionContent)\n $table.appendChild($rowThree)\n $rowThree.appendChild($aromaCell)\n $rowThree.appendChild($aromaContent)\n $table.appendChild($rowFour)\n $rowFour.appendChild($ammountCell)\n $rowFour.appendChild($ammountContent)\n\n return $exit\n}", "title": "" }, { "docid": "d6541a3ad77531add7906c5df9f4d153", "score": "0.6274961", "text": "function displayProducts(products) {\n let result = \"\";\n products.forEach(product => {\n result += `\n <!-- single product --> \n <article class=\"product\">\n <div class=\"img-container\">\n <img src=\"${product.image}\" alt=\"product\" class=\"product-img\" height=\"50px\" width=\"50px\">\n <button class=\"bag-btn\" data-id=${product.id}>\n <i class=\"fas fa-shopping-cart\">add to bag</i>\n </button>\n </div>\n <h3>${product.title}</h3>\n <h4>$${product.price}</h4>\n </article>\n <!-- end of single product -->\n `;\n });\n productsDOM.innerHTML = result;\n}", "title": "" }, { "docid": "e722857dc846d92544f926e8a9db836b", "score": "0.6274122", "text": "function createShoppingCart(product) {\n const shoppingCard = document.createElement(\"div\");\n shoppingCard.classList.add(\"shopping-cart\");\n\n const shoppingCardFigure = document.createElement(\"figure\");\n const image = document.createElement(\"img\");\n image.setAttribute(\"src\", product.images[0]);\n image.setAttribute(\"alt\", \"Imagen del producto\");\n\n const shoppingCardPrice = document.createElement(\"p\");\n shoppingCardPrice.innerHTML = \"$ \"+ product.price;\n\n const shoppingCardName = document.createElement(\"p\");\n shoppingCardName.innerHTML = product.title;\n\n const iconClose = document.createElement(\"img\");\n iconClose.setAttribute(\"src\", \"./icons/icon_close.png\");\n iconClose.setAttribute(\"alt\", \"close\");\n iconClose.classList.add(\"removeCartIcon\");\n iconClose.addEventListener(\"click\", () => { removeProductToCart(product);});\n\n shoppingCardFigure.appendChild(image);\n shoppingCard.appendChild(shoppingCardFigure);\n shoppingCard.appendChild(shoppingCardName);\n shoppingCard.appendChild(shoppingCardPrice);\n shoppingCard.appendChild(iconClose);\n\n return shoppingCard;\n}", "title": "" }, { "docid": "3b6386587adb6819cdd37085ad2390f0", "score": "0.62664723", "text": "renderProducts() {\n this.products.forEach( ( product ) => {\n product.render();\n } );\n }", "title": "" }, { "docid": "e2d7eff6244ad55c0cffcdcbb3e74b5f", "score": "0.62609345", "text": "function renderCart(productNumber,cartDeletionClass,productName,productImgSrc,gameQty){\n $('#showCart'+productNumber).html(\"<div class='container \"+cartDeletionClass+\"'>\" +\n \"<div class='row'>\" +\n \"<div class='col'>\" +\n \"<img src='cartItemImage/\"+productImgSrc+\"' class='img img-thumbnail img-cart'>\" +\n \"<br>\"+\n \"<span><b>\"+productName+\"</b></span>\" +\n \"</div>\" +\n\n \"<div class='col'>\" +\n \"<button onclick='upQtyButton(\"+productNumber+\")' class=' btnGame1Up a'><i class=\\\"fas fa-arrow-up\\\"></i></button>\" +\n\n \"<input type='number' readonly class='game\"+productNumber+\"QtyInput qtyInputCart'>\" +\n\n \"<button onclick='downQtyButton(\"+productNumber+\")' class=' btnGame1Down a'><i class=\\\"fas fa-arrow-down\\\"></i></button>\" +\n \"</div>\" +\n \"<div class='col'>\" +\n \"<span onclick='deleteCart(\"+productNumber+\")'><i class='btn btn-danger fa fa-trash'></i></span>\" +\n \"</div>\" +\n \"</div>\" +\n \"</div>\");\n\n\n $('.game'+productNumber+'QtyInput').val(gameQty);\n totalPriceCart();\n}", "title": "" }, { "docid": "bbf90237b9d205b5f192edb9e34a8a9e", "score": "0.6257432", "text": "async addProductCart(productId) {\n //Obtains product's details from model (product class)\n const details = await this.model.getDetails(productId);\n const txtQuantity = document.getElementById('detail-cart-quantity').value;\n const quantityProduct = parseInt(txtQuantity, 10);\n\n let item = {};\n //If the cart has products actually\n if (Array.isArray(this.cart.items) && this.cart.items.length) {\n //Search at the cart the product by ProductId received by param\n const element = this.cart.items.filter(i => i.idProduct === productId);\n\n //If this product exist at cart, updated this quantity and subtotal\n if (Array.isArray(element) && element.length) {\n element[0].quantity += parseInt(quantityProduct, 10);\n element[0].subtotal += parseInt(quantityProduct, 10) * parseInt(details.price, 10);\n\n //If product don't exist at cart, create a object Item\n }else {\n item = {\n idProduct: details.id,\n nameProduct: details.name,\n image: details.image,\n price: parseInt(details.price, 10),\n quantity: parseInt(quantityProduct, 10),\n subtotal: parseInt(quantityProduct, 10) * parseInt(details.price, 10)\n };\n //Add the object to array cart.items\n this.cart.items.push(item);\n }\n\n // If the cart is empty, create a object Item and insert to array cart.items\n }else {\n item = {\n idProduct: details.id,\n nameProduct: details.name,\n image: details.image,\n price: parseInt(details.price, 10),\n quantity: parseInt(quantityProduct, 10),\n subtotal: parseInt(quantityProduct, 10) * parseInt(details.price, 10)\n };\n this.cart.items.push(item);\n }\n\n //Update the object with total and quantitys\n this.cart.quantity += parseInt(quantityProduct, 10);\n this.cart.total += parseInt(quantityProduct, 10) * parseInt(details.price, 10);\n \n //Save at localstorage the cart object.\n localStorage.setItem('cart', JSON.stringify(this.cart));\n\n //Updated the show Quantity at header\n this.showQuantity();\n //Show a message of success\n this.showAlert();\n }", "title": "" }, { "docid": "da3514883de7a1ca1f8ef08e0d75b08a", "score": "0.62564963", "text": "function addToCart(product) {\n setItem([\n ...storedItem,\n { ...product, tprice: product.currentprice, sqty: 1, save: false },\n ]);\n }", "title": "" }, { "docid": "1a09fea19ef74867108fcaae7147970b", "score": "0.62520856", "text": "function updateCartPreview() {\n // TODO: Get the item and quantity from the form\n const selectedItem = document.getElementById('items').value;\n const itemQuantity = document.getElementById('quantity').value;\n // TODO: Add a new element to the cartContents div with that information\n const cartContentsElem = document.createElement('p');\n const containerElem = document.getElementById('cartContents');\n containerElem.appendChild(cartContentsElem);\n cartContentsElem.textContent = `Item in cart: ${selectedItem} Quantity: ${itemQuantity}`;\n\n}", "title": "" }, { "docid": "d7f761b6a908c44b101a002a368993bb", "score": "0.62467515", "text": "generateProducts() {\n const { products } = this.state;\n return (\n <>\n <ul className=\"store-products-grid\">\n {products.map((item, i) => {\n return (\n <li key={i}>\n <div className=\"products-info\">\n <div className=\"products-info-overlay\">\n <button\n className=\"details-btn\"\n onClick={() => this.showDetailsPage(products[i]._id)}\n >\n Details\n </button>\n </div>\n <img className=\"products-info-image\" src={products[i].imageUrl} alt=\"img\" />\n <div className=\"products-info-text\">\n <p className=\"products-info-name\">{products[i].name}</p>\n <p className=\"products-info-price\">{products[i].price}$</p>\n {this.props.isLoggedIn && (\n <button onClick={() => this.addItemToCart(products[i]._id)}>\n Add to cart\n </button>\n )}\n </div>\n </div>\n </li>\n );\n })}\n </ul>\n {this.pagination()}\n </>\n );\n }", "title": "" }, { "docid": "3aeccfcb549f637619d0ed0b42368134", "score": "0.62459236", "text": "function DisplayCart(element){\n\tlet div=document.createElement('DIV');\n\tdiv.className='row item';\n\n\t// Get image\n\tlet divImg=document.createElement('IMG');\n\tdivImg.src=element.Image;\n\tdivImg.className='col-md-3 cart-image';\n\n\t// Get name\n\tlet div2=document.createElement('DIV');\n\tdiv2.className='col-md-2 cart-text';\n\tdiv2.innerHTML=element.Name;\n\n\t// Get price\n\tlet div3=document.createElement('DIV');\n\tdiv3.className='col-md-2 cart-text';\n\tdiv3.innerHTML=element.Price + ' €';\n\n\t// Get quantity\n\tlet div4=document.createElement('DIV');\n\tdiv4.className='col-md-2 cart-text';\n\tdiv4.innerHTML=element.Color;\n\n\t// Get quantity\n\tlet div5=document.createElement('DIV');\n\tdiv5.className='col-md-2 cart-text';\n\tdiv5.innerHTML='Quantité : ' + element.Qty;\n\tcurrentNumber += element.Qty;\n\n\t// Get minus quantity button\n\tlet div6=document.createElement('BUTTON');\n\tdiv6.className='btn btn-primary cart-btn';\n\tdiv6.innerHTML='-';\n\t\n\t// Substract 1 on click\n\tdiv6.addEventListener('click', (event)=>{\n\t\tevent.preventDefault();\n\t\telement.Qty--;\n\t\tcurrentNumber--;\n\t\tDisplayNumberInCart();\n\t\tdiv5.innerHTML='Quantité : ' + element.Qty;\n\t\tcurrentPrice-=element.Price;\n\t\ttotalPrice.innerHTML=currentPrice + ' €';\n\t\t\n\t\tfor (let i=0; i<panier.length; i++){\n\t\t\tif(panier[i].Id==element.Id && panier[i].Color==element.Color){\n\t\t\t\tlocalStorage.removeItem('monPanier');\n\t\t\t\tif(element.Qty==0){\n\t\t\t\t\tdiv.style.display='none';\n\t\t\t\t\tpanier.splice(i, 1);\n\t\t\t\t}\n\t\t\t\tlocalStorage.setItem('monPanier', JSON.stringify(panier));\n\t\t\t\tif(panier.length===0){\n\t\t\t\t\tlocalStorage.removeItem('monPanier');\n\t\t\t\t\tEmptyCart();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\n\t// Append section\n\tdiv.appendChild(divImg);\n\tdiv.appendChild(div2);\n\tdiv.appendChild(div3);\n\tdiv.appendChild(div4);\n\tdiv.appendChild(div5);\n\tdiv.appendChild(div6);\n\tmain.appendChild(div);\n\n\t// Get total price\n\tcurrentPrice+=element.Price*element.Qty;\n\ttotalPrice.innerHTML=currentPrice + ' €';\n\tproducts.push(element.Id);\n}", "title": "" }, { "docid": "2e75e15f89534e9a83f6edc444f62e45", "score": "0.624385", "text": "sendProductToCart(product){\n\t\tthis.setState({productAux: product});\n\t}", "title": "" }, { "docid": "5d5601051d0023d91e09a89560361c3d", "score": "0.62427855", "text": "render(){\n const cartEl = document.createElement('section');\n //innerhtml to create the class instance body\n cartEl.innerHTML = `\n <h2>Total: \\$${0}</h2>\n <button>Order Now!</button>\n `;\n cartEl.className = 'cart';\n return cartEl; // Whereever we create the shoppingcart we can append it to the DOM\n }", "title": "" }, { "docid": "e1b5de99fc45ba9a120d7443d4d39172", "score": "0.62421364", "text": "function addToCart(product) {\r\n addProduct(product);\r\n quickUpdateCart();\r\n }", "title": "" } ]
8bc38831ef1a9fa8ba6cf8b01af5d20f
write a function that returns the average age of developers (rounded to the nearest integer). I
[ { "docid": "4d9238a54e6bb11fd7bc1eb6d2e4dacc", "score": "0.73328465", "text": "function getAverageAge(list) {\n let age = 0\n let length = list.length\n list.forEach(item => age += item.age)\n \n return Math.round(age/length)\n}", "title": "" } ]
[ { "docid": "811f53e0e49f46e968ce2a88b475b832", "score": "0.7746635", "text": "function getAverageAge(data) {\n let age = 0;\n for(let i = 0; i < data.length; i++) {\n let total = data[i]['age']\n age += total\n }\n return Math.trunc(age / getProfileCount(data))\n}", "title": "" }, { "docid": "b93228b9b43da578022c5a3e930aa134", "score": "0.7559024", "text": "function getAverageAge(users) {\n return users.map(user => user.age).reduce( (sum, userAge) => sum + userAge) / users.length;\n}", "title": "" }, { "docid": "c167076d59a1f9d954fcd488b9a831fe", "score": "0.7413775", "text": "function averageAge(arr) {\n\n const currentAge = arr.map(cur => new Date().getFullYear() - cur.buildYear);\n\n function add(a, b) {\n return a + b;\n }\n\n const totalAge = currentAge.reduce(add, 0);\n const average = totalAge / arr.length;\n\n console.log(`Our ${arr.length} parks have an average age of ${average} years.`);\n}", "title": "" }, { "docid": "c5a15bdda26f35f1b0edc50268b7a944", "score": "0.7330188", "text": "function avgAge(person){\n let totalAge = 0;\n person.forEach(element => {\n totalAge = totalAge + element.age;\n });\n return totalAge/person.length;\n }", "title": "" }, { "docid": "cd01d405449b730b3000ce33e02ba200", "score": "0.7315302", "text": "function getAverageAge(arr) {\n return arr.reduce((acc, item) => acc + item.age, 0) / arr.length;\n}", "title": "" }, { "docid": "832e03f370cf543833bf3ade26f52629", "score": "0.72417295", "text": "function getAverageAge (arr) {\n return arr.reduce((acc, cur) => acc+cur.age, 0);\n}", "title": "" }, { "docid": "3de171430421919c276af1b3ab768010", "score": "0.7196222", "text": "function avgAge (arr)\n{\n// debugger\nvar total = arr.reduce( (total, x) => \n{ var y =x.age;\n return total+ y;\n}, 0 )\nvar avg = total/(arr.length);\n\nreturn avg;\n}", "title": "" }, { "docid": "8dba8784762ee97dadc36464a837c7ba", "score": "0.71894825", "text": "function avgAge(...parks) {\n let totalAge = 0;\n parks.forEach(park => totalAge += new Date().getFullYear() - park.builtYear);\n console.log(`Our ${parks.length} parks have an average age of ${(totalAge / parks.length).toFixed(2)} years.`)\n}", "title": "" }, { "docid": "2f4ff16116dc75c0617a86e61307996f", "score": "0.71279526", "text": "function avgAge(peopleArr) {\n // initialize average\n let average = 0;\n // loop through each element\n peopleArr.forEach(element => {\n // add each age to average\n average += element.age;\n });\n // divide average by amount of people\n average = Math.floor(average / peopleArr.length);\n return average\n}", "title": "" }, { "docid": "7ca0541e7d478abd046f962ff40ba230", "score": "0.7105924", "text": "function getAverageAge(personArray){\n\n let totalAge = 0;\n \n for (let i=0; i< personArray.length; i++) {\n //console.log(personArray[i].age)\n totalAge = totalAge + personArray[i].age;\n }\n return totalAge /personArray.length;\n}", "title": "" }, { "docid": "7ca0541e7d478abd046f962ff40ba230", "score": "0.7105924", "text": "function getAverageAge(personArray){\n\n let totalAge = 0;\n \n for (let i=0; i< personArray.length; i++) {\n //console.log(personArray[i].age)\n totalAge = totalAge + personArray[i].age;\n }\n return totalAge /personArray.length;\n}", "title": "" }, { "docid": "495fbcc1217976e25f053e9086c7b209", "score": "0.702467", "text": "function calculateAge(yearOfBirth) {\n var age = parseFloat(2018 - yearOfBirth);\n return age\n}", "title": "" }, { "docid": "76f6a444eedba3e6ffbf36bfe74d33c8", "score": "0.7009727", "text": "function averageAge(obj) {\n var sum = 0;\n for (let i = 0; i < obj.length; i++) {\n sum += obj[i].age;\n }\n return sum / obj.length;\n}", "title": "" }, { "docid": "a8222f3e3f53d06f07a9be801108017a", "score": "0.6997182", "text": "function averageAge(persons)\n{ var i;\n var sum=0;\n\n for(i=0;i<persons.length;i++)\n {\n sum+= persons[i].age;\n }\n console.log(sum/i);\n\n}", "title": "" }, { "docid": "eb2c80fe8a92814f738f5d7308f2874f", "score": "0.6994524", "text": "function averageAge(object) {\n var age = object.reduce((current, next) => current + next.age, 0);\n var averageAge = age / object.length\n return averageAge\n}", "title": "" }, { "docid": "793b9ca11dad7112ccd83730f36b3764", "score": "0.6983705", "text": "function averageAge(people) { \n var sumAvg =0;\n for (i=0 ; i<people.length ; i++){\n if (person.age > 18 && person.age <50 ){\n \tsumAvg = sumAvg + person.age / people.length \n }\n }\n return sumAge;\n }", "title": "" }, { "docid": "1f4ce938350c11ccbf510cb44b8efd15", "score": "0.6958946", "text": "function calculateAge(birthYear){\n return 2019 - birthYear;\n}", "title": "" }, { "docid": "380104568d5fd6d705bec54b58aeccdf", "score": "0.69520855", "text": "function calcAge(year) {\n\tconsole.log(2016 - year);\n}", "title": "" }, { "docid": "c21bd46db973d842ab1a9b1d78ecb88c", "score": "0.69405335", "text": "function totAge() {\n let sum = 0;\n for (i = 0; i < devs.length; i++) {\n sum = devs[i].age + sum;\n }\n return sum;\n }", "title": "" }, { "docid": "37289fae982b2cae7039ae3aeb0ebcba", "score": "0.6925191", "text": "function dogToHumanYears(dogAge) {\n let humanAge = (dogAge - 2) * 4 + 21;\n return humanAge;\n}", "title": "" }, { "docid": "0f0cf73ed9f9531d549672397bd43b6f", "score": "0.6925035", "text": "function famAgeAvg(person) {\n const famAvgAge = famTotalAge(person) / person.length;\n return famAvgAge;\n}", "title": "" }, { "docid": "ba3d1c13ca01885caa99af53696b433e", "score": "0.6910402", "text": "function dogToHumanYears(dogAge) {\n return (dogAge - 2) * 4 + 21;\n}", "title": "" }, { "docid": "4c8d1ef9cedcdc43a79d7ef7a85f570f", "score": "0.69012356", "text": "ageEarthYears() {\n const birthdate = new Date(this.dob);\n let today = new Date();\n let calcAge = today - birthdate; \n let ageInYears = Math.floor(calcAge/(365.25 * 24 * 60 * 60 * 1000 )); // year * day * minutes per hour * seconds per minute * 1000 millisecs per sec // I am 30 years old\n\n return ageInYears;\n }", "title": "" }, { "docid": "8414f417a116d05637acd2c7c2e30066", "score": "0.68688303", "text": "function bestYearAvg() {}", "title": "" }, { "docid": "8414f417a116d05637acd2c7c2e30066", "score": "0.68688303", "text": "function bestYearAvg() {}", "title": "" }, { "docid": "8414f417a116d05637acd2c7c2e30066", "score": "0.68688303", "text": "function bestYearAvg() {}", "title": "" }, { "docid": "8414f417a116d05637acd2c7c2e30066", "score": "0.68688303", "text": "function bestYearAvg() {}", "title": "" }, { "docid": "8414f417a116d05637acd2c7c2e30066", "score": "0.68688303", "text": "function bestYearAvg() {}", "title": "" }, { "docid": "8414f417a116d05637acd2c7c2e30066", "score": "0.68688303", "text": "function bestYearAvg() {}", "title": "" }, { "docid": "8414f417a116d05637acd2c7c2e30066", "score": "0.68688303", "text": "function bestYearAvg() {}", "title": "" }, { "docid": "ac3c2fc2f75ba609a5836b7fc449b3d6", "score": "0.685062", "text": "function averageAgeByCentury() \n{\n\tlet cent = []\n\tlet avg = []\n\tlet c = 0\n\n\tfor (let i in ancestry)\n\t{\n\t\tc = Math.ceil(ancestry[i].died / 100)\n\t\tif(cent.hasOwnProperty(c) == false) \n\t\t{\n\t\t\tcent[c] = []\n\t\t}\n\t\tcent[c].push(ancestry[i].died - ancestry[i].born)\n }\n\n for(let i in cent)\n {\n \t\tavg[i] = average(cent[i])\n }\n\n return avg\n}", "title": "" }, { "docid": "55cb96acd20ddae97658f8df36387e29", "score": "0.68492985", "text": "calcAge() {\n console.log(2037 - this.birthYear);\n }", "title": "" }, { "docid": "aad3ea053150f276a0ff0537a92663ca", "score": "0.6847895", "text": "calcAge() {\n console.log(2037 - this.birthYear);\n }", "title": "" }, { "docid": "aad3ea053150f276a0ff0537a92663ca", "score": "0.6847895", "text": "calcAge() {\n console.log(2037 - this.birthYear);\n }", "title": "" }, { "docid": "77dba35e65fb84a488929d8c0c2d9b1f", "score": "0.68472236", "text": "function calculateAge(yearBirth) {\n console.log(2017-yearBirth);\n}", "title": "" }, { "docid": "5bc8c0d5a0df6339203e80bff515f813", "score": "0.683434", "text": "function calculateAge(year) {\n console.log(2020 - year);\n}", "title": "" }, { "docid": "57b75f15ffbccae978de574ceda9dc2f", "score": "0.68336564", "text": "function calcAge(year){\n console.log(2019 - year);\n}", "title": "" }, { "docid": "046a9d5b86d295c8bbe1ed0be74cf5a3", "score": "0.68222046", "text": "function findAverage(array) {\n const sumElementsAgesArray = (accumulator, currentValue) => accumulator + currentValue;\n const averageAge = array.reduce(sumElementsAgesArray, 0) / array.length;\n return averageAge;\n}", "title": "" }, { "docid": "4a51b3be23c60892878fd11eb9f92fd9", "score": "0.6817757", "text": "calcAge() {\n\t\tconsole.log(2021 - this.birthYear);\n\t}", "title": "" }, { "docid": "0bc20ac1760a2ab441434ca63ba81ef8", "score": "0.6808421", "text": "function calcAge1(birthYear) {\r\n // const age = 2021 - birthYear\r\n // return age\r\n return 2021 - birthYear;\r\n}", "title": "" }, { "docid": "29b80a49cc936d72f68b7f52049d4917", "score": "0.6774531", "text": "function calculateAge(yearOfBirth) {\n var currentYear = new Date().getFullYear();\n var age = currentYear - yearOfBirth;\n return age;\n}", "title": "" }, { "docid": "fd7ba2476af77e4fe6483fc602d82654", "score": "0.6771371", "text": "calcAge() {\n console.log(2037 - this.birthYear);\n }", "title": "" }, { "docid": "fd7ba2476af77e4fe6483fc602d82654", "score": "0.6771371", "text": "calcAge() {\n console.log(2037 - this.birthYear);\n }", "title": "" }, { "docid": "fd7ba2476af77e4fe6483fc602d82654", "score": "0.6771371", "text": "calcAge() {\n console.log(2037 - this.birthYear);\n }", "title": "" }, { "docid": "fd7ba2476af77e4fe6483fc602d82654", "score": "0.6771371", "text": "calcAge() {\n console.log(2037 - this.birthYear);\n }", "title": "" }, { "docid": "458744473fd9f4742992985af5b0791f", "score": "0.6768374", "text": "function calculateAge(year) {\n console.log(2019 - year);\n}", "title": "" }, { "docid": "a18a6a08c5bed660f632271932bc7ee9", "score": "0.6711164", "text": "calculateAge() {\n let date_1 = new Date(age);\n let diff = Date.now() - date_1.getTime();\n var age_date = new Date(diff);\n return Math.abs(age_date.getUTCFullYear() - 1970); \n }", "title": "" }, { "docid": "b10de9b86325b2ede0040addc0da6c16", "score": "0.67072016", "text": "function calculateAge(year){\nconsole.log(2018-year); \n}", "title": "" }, { "docid": "5f2de25e82ef071dd7ea5cbeb4a185d8", "score": "0.6703045", "text": "mercuryYears(age) {\n let mercuryAge = age * 0.24;\n return mercuryAge;\n }", "title": "" }, { "docid": "4b2a4e7d0c11f769a0af663c8aa4c9b0", "score": "0.66780716", "text": "function calculateAge(birthYear) {\n return 2019 - birthYear; \n //# return in equation\n }", "title": "" }, { "docid": "b5a03102382102b60203b127b25f44ef", "score": "0.6668708", "text": "function bestYearAvg() {\n \n}", "title": "" }, { "docid": "70cfe66ffdf88dd1c093b2a4ca10268d", "score": "0.6651239", "text": "function calcAge(birthYear) {\n let age = 2019 - birthYear;\n console.log(`Age is ${age}`);\n}", "title": "" }, { "docid": "7b78b154ec6c9a719f12384f4767b05c", "score": "0.664794", "text": "function bestYearAvg() {\n\n}", "title": "" }, { "docid": "57bc0df69419a3ccc7a4629b7a73d892", "score": "0.66427463", "text": "function calculateAge (bornAge){\n return 2020-bornAge;\n}", "title": "" }, { "docid": "05e36e6b1608d401ee35a0fcb3d8e811", "score": "0.6641746", "text": "function getAge(birth){\n birth = new Date(birth);\n let today = new Date();\n return Math.floor((today - birth) / (365.25 * 24 * 60 * 60 * 1000)).toString();\n }", "title": "" }, { "docid": "dd1a1dde30be077df98e2a7375bb7f3b", "score": "0.6616901", "text": "function yourAge(birthYear){\nvar now = new Date();\n var thisYear = now.getFullYear();\n return (thisYear - birthYear);\n}", "title": "" }, { "docid": "490058058dc2cab030a1105c630062f8", "score": "0.66133153", "text": "function averageNumberObj(arr){\n let total=arr.reduce((acc,item)=> acc + item.age,0);\n return total/arr.length;\n}", "title": "" }, { "docid": "7a0c832745a3c14ecae24ebb1c1e0580", "score": "0.6607216", "text": "function getAge(people) {\n let dayToday = new Date().getDate();\n let monthToday = new Date().getMonth();\n let yearToday = new Date().getFullYear();\n for (let i = 0; i < people.length; i++) {\n let birthDate = people[i].dob;\n let birthDateSplit = people[i].dob.split(\"/\");\n birthDateSplit[0] -= 1;\n let splitDiff = [];\n splitDiff[0] = monthToday - birthDateSplit[0];\n splitDiff[1] = dayToday - birthDateSplit[1];\n splitDiff[2] = yearToday - birthDateSplit[2];\n if (splitDiff[0] < 0 || (splitDiff[0] == 0 && splitDiff[1] < 0)) {\n splitDiff[2]--;\n }\n people[i].age = splitDiff[2];\n }\n}", "title": "" }, { "docid": "bf99f42eb1ce971da0052c34cec87384", "score": "0.658837", "text": "function calcAge1(birthYear) {\n return 2037 - birthYear;\n}", "title": "" }, { "docid": "d2fef6cb5d37e13947cc28e7912d02eb", "score": "0.6576925", "text": "function calculateAge(birth_year) {\n var today = new Date();\n var year = today.getFullYear();\n\n console.log (\"You are \" + (year - birth_year) + \" years old.\")\n}", "title": "" }, { "docid": "7bb62b91f565acec2b3b4b6f50693b00", "score": "0.65652925", "text": "function calculateDogAge(age) {\n var dogYears = 7 * age;\n console.log(\"Your doggie is \" + dogYears + \" years old in dog years!\");\n}", "title": "" }, { "docid": "fddfc0adde66416f71193996278093d5", "score": "0.65643793", "text": "function averageAgeByCentury() {\n //assign each person to a century\n var avgAgeExpectancy = {};\n var century;\n\n ancestry.forEach(function(person) {\n century = Math.ceil(person.died / 100).toString();\n if(!avgAgeExpectancy.hasOwnProperty(century)) { avgAgeExpectancy[century] = []; }\n avgAgeExpectancy[century].push(person.died - person.born);\n });\n\n for (var cent in avgAgeExpectancy) {\n avgAgeExpectancy[cent] = average(avgAgeExpectancy[cent]);\n }\n\n return avgAgeExpectancy;\n}", "title": "" }, { "docid": "6ce141754bb8686d40e650cc5e845652", "score": "0.6558405", "text": "calculateAge(){\n return new Date().getFullYear() - this.birthYear;\n }", "title": "" }, { "docid": "6c7ce83c45da3df6d8323d4c1b53abf9", "score": "0.655488", "text": "calcAge() {\n console.log(2020 - this.birthYear);\n }", "title": "" }, { "docid": "6c7ce83c45da3df6d8323d4c1b53abf9", "score": "0.655488", "text": "calcAge() {\n console.log(2020 - this.birthYear);\n }", "title": "" }, { "docid": "3179cf6f5b0839a9d1278bf19eb0b40c", "score": "0.6549125", "text": "howOld(birthday){\n \n // convert birthday into a numeric value\n\n // convert current date into a numeric value\n\n // subtract birthday numeric value from current date value to get the numeric value of time elapsed\n\n // convert the time elapsed value into years\n\n // round down the converted years value\n\n // return the rounded years value\n\n let date = new Date().getFullYear();\n let age = date-birthyear\n \n return age;\n return -1;\n }", "title": "" }, { "docid": "1bd3cc41f566a5fb486d0f9b884f176c", "score": "0.65427804", "text": "calcAge()\n {\n var age = new Date().getFullYear() - this.yearOfBirth;\n console.log(age);\n }", "title": "" }, { "docid": "fe95a93df106de4e0e623cc49e800bf6", "score": "0.653951", "text": "calcAge () {\n var age = new Date().getFullYear() - this.buildYear;\n return age;\n }", "title": "" }, { "docid": "4c03ef8ff26e805e870bcc2b3c4fac0b", "score": "0.6539299", "text": "calcAge() {\n console.log(2021 - this.birthYear);\n }", "title": "" }, { "docid": "4c03ef8ff26e805e870bcc2b3c4fac0b", "score": "0.6539299", "text": "calcAge() {\n console.log(2021 - this.birthYear);\n }", "title": "" }, { "docid": "5e2229529e2839f1b00b4eba0e4bc007", "score": "0.65386426", "text": "function getDogAge(age){\n return age * 7;\n}", "title": "" }, { "docid": "58d6fb8bb118b430625031a00297894a", "score": "0.65247744", "text": "function dogToHumanYears(years)\n{\n let humanYears = 0;\n\n //ages 1-3 - 10 human years to dog years\n if (years <= 3)\n {\n humanYears = years * 10;\n }\n //other ages - 7 human years to dog years\n else\n {\n humanYears = 30; //first three dog years\n years -= 3;\n humanYears += (years * 7);\n }\n return humanYears;\n}", "title": "" }, { "docid": "69eaa1087786d009b27d7bb26f95a4bd", "score": "0.65172946", "text": "ageJupiter() {\n let jovianAge = parseInt(this.ageEarthYears()/11.86); // I am 2.5 years old\n return jovianAge;\n }", "title": "" }, { "docid": "5160f794d48e2afec589e4c69c10f328", "score": "0.65116227", "text": "ageVenus() {\n let venusianAge = parseInt(this.ageEarthYears()/0.62); //I am 48 years old\n return venusianAge;\n }", "title": "" }, { "docid": "33604fde0f1063afee17aeb940c7982a", "score": "0.6510836", "text": "function calculateAge(){\n var dob = $(\"#dob\").attr('value');\n var dayOfBirth = dob.substring(0,2);\n var monthOfBirth = dob.substring(3,5);\n var yearOfBirth = dob.substring(6,10);\n\n //Variables containg values of current date\n var today = new Date();\n var dayOfToday = parseInt(today.getDate());\n var monthOfToday = today.getMonth() + 1;\n var yearOfToday = today.getFullYear();\n\n //Variables required to calculate age.\n var yearDiff;\n if (monthOfToday > monthOfBirth){\n yearDiff = yearOfToday - yearOfBirth;\n }\n else if (monthOfToday == monthOfBirth) {\n if((dayOfToday == dayOfBirth) || (dayOfToday > dayOfBirth)) {\n yearDiff = yearOfToday - yearOfBirth;\n }\n else\n yearDiff = yearOfToday - yearOfBirth - 1;\n }\n else {\n yearDiff = yearOfToday - yearOfBirth - 1;\n }\n return yearDiff;\n}", "title": "" }, { "docid": "fc399586d507809236e9469f6bd206ff", "score": "0.6506431", "text": "function getAge() {\n year = born.slice(0, born.indexOf(\"-\"));\n month = born.slice(5, 7);\n day = born.slice(8);\n var today = new Date();\n var age = today.getFullYear() - year;\n var m = today.getMonth() - month;\n if (m < 0 || (m === 0 && today.getDate() < day)) {\n age--;\n }\n return age;\n }", "title": "" }, { "docid": "8789dc35f2867ca388207b7f12386462", "score": "0.65053993", "text": "function getAge(birth) {\r\n const today = new Date();\r\n\r\n const nowyear = today.getFullYear();\r\n const nowmonth = today.getMonth();\r\n const nowday = today.getDay();\r\n\r\n const birthyear = birth.getFullYear();\r\n const birthmonth = birth.getMonth();\r\n const birthday = birth.getDay();\r\n\r\n let age = 0;\r\n if( nowyear > birthyear ){\r\n age = nowyear - birthyear;\r\n if( nowmonth < birthmonth ){\r\n age -= 1;\r\n }\r\n else if( nowmonth === birthmonth ){\r\n if( nowday < birthday ){\r\n age -= 1;\r\n }\r\n }\r\n }\r\n\r\n return age;\r\n}", "title": "" }, { "docid": "e1ec4f666aa2f3a5d03a1eb02dbd0274", "score": "0.6504333", "text": "function calculateMyAge(birthYear) {\n // Input: birth year\n // Output: age\n // Validation: input data\n if (birthYear < 0) {\n console.log('You troll me!!! :P');\n return -1;\n }\n\n const myAge = 2019 - birthYear;\n return myAge;\n}", "title": "" }, { "docid": "73a80269b4b034a1a75af86d7c78e9a2", "score": "0.6500861", "text": "function calculateAge(el) {\r\n return 2016 - el;\r\n}", "title": "" }, { "docid": "3cd35072eb3b506dfc59f115eff05b93", "score": "0.64973557", "text": "function calculateAge (birthYear, currentYear){\n\tvar age = currentYear- birthYear;\n\n\tconsole.log(\"You are either \" + age + \" or \" + (age-1));\n\n}", "title": "" }, { "docid": "fd44763c17b93aca653eee18b38ee7c1", "score": "0.64963496", "text": "function calculateDogAge(rate, age){\n\n var years = rate * age\n return \"Your doggie is \" + years + \" years old in dog years\"\n\n}", "title": "" }, { "docid": "7fa66105fa88888962f87e7d57a54cf7", "score": "0.6485115", "text": "ageMars() {\n let martianAge = parseInt(this.ageEarthYears()/1.88); //I am 15 years old\n return martianAge;\n }", "title": "" }, { "docid": "df7c470f61c64f4649fb0d1cbe30c30d", "score": "0.64836943", "text": "function averageAgeByCentury() {\n let data = {};\n for (let name in byName) {\n let person = byName[name];\n let century = (parseInt(person.died.toString().substr(0, 2)) + 1).toString();\n data[century] = data[century] || [];\n data[century].push(person.died - person.born);\n }\n Object.keys(data).forEach( x => data[x] = average(data[x]));\n return data;\n}", "title": "" }, { "docid": "574c0ca8f0aa78b0ced2ab8d3e13eaa0", "score": "0.6476085", "text": "function calculateDogAge (dogAge, conversionRate) {\n var ageInHumanYears = dogAge * conversionRate; \n console.log(ageInHumanYears); \n\n calculateDogAge(7, 7);\n calculateDogAge(3, 5);\n}", "title": "" }, { "docid": "b985cc70ef7ee0e091ac45ebaa7a5628", "score": "0.64652264", "text": "function calculateDogAge(dogAge) {\n let humanYears = 7 * dogAge;\n console.log(`Your doggie is ${humanYears} years old in human years!`);\n}", "title": "" }, { "docid": "8c46b0ea86af2ed6a21e0ef650a37fa2", "score": "0.6463989", "text": "function averageMomChildAgeDiff() {\n // Your code here\n let diffs = [];\n for (let p in byName) {\n let person = byName[p];\n let mom = byName[person.mother];\n if (mom == undefined) continue;\n diffs.push(person.born - mom.born);\n }\n return average(diffs);\n}", "title": "" }, { "docid": "faafacecff9a4b8e552f6ea42a881838", "score": "0.64489585", "text": "calculateAge(yearOfBirth) {\n\tvar now = new Date();\n\tvar currentYear = now.getFullYear();\n\tvar age = currentYear - this.yearOfBirth;\n\treturn `${age} years old` ;\n}", "title": "" }, { "docid": "f75a4d0b35ed17e80d5e7bfc5223c510", "score": "0.6445723", "text": "function calculateDogAge(humanYear) {\r\n let dogAge = 7 * humanYear;\r\n console.log(`Your doggie is ${dogAge} years old in dog years!`);\r\n}", "title": "" }, { "docid": "f6ead27bb86bfe4a891be13d0076cd48", "score": "0.64308196", "text": "function getYears(age) {\n var currentTime = new Date();\n var currentYear = currentTime.getFullYear();\n return currentYear - age;\n}", "title": "" }, { "docid": "5f4850433e57524bb6dfa3ff1f888b05", "score": "0.64060676", "text": "function totalExperience(){\n\tlet total = users.reduce((accumulator, currentValue) => {\n\t\tconsole.log(`accumulator: ${accumulator}`);\n\t\tconsole.log(`currentValue: ${currentValue.yearsOfExperience}`);\n\t\treturn accumulator + currentValue.yearsOfExperience;\n\t},0)\n\t\tconsole.log('total ' + total);\n\treturn total / users.length;\n}", "title": "" }, { "docid": "64b8886719fc902efcc20182004f3b64", "score": "0.6404388", "text": "function calculateAge (birthYear, currentYear){\n var actualAge = currentYear - birthYear;\n var anotherAge = actualAge - 1;\n console.log(\"You are either \"+ actualAge + ' or '+ anotherAge);\n}", "title": "" }, { "docid": "ab1f365e4bff2951b2010e316111afde", "score": "0.6401937", "text": "function computeAge(i) \n {\n var todaysDate = new Date();\n var birthD = $(\"#booking_tickets_\"+ i +\"_birthdate_day\").val();\n var birthM = $(\"#booking_tickets_\"+ i +\"_birthdate_month\").val();\n var birthY = $(\"#booking_tickets_\"+ i +\"_birthdate_year\").val();\n\n if((birthM < todaysDate.getMonth()) || ((birthM == todaysDate.getMonth()) && (birthD <= todaysDate.getDate())))\n {\n var age = todaysDate.getFullYear() - birthY;\n }\n else\n {\n var age = todaysDate.getFullYear() - birthY - 1;\n } \n\n return age;\n }", "title": "" }, { "docid": "d0e06f6e0e1c7d46354472426f22f0de", "score": "0.6400943", "text": "function calcAge1(birthYear1) {\n return 2037 - birthYear1;\n}", "title": "" }, { "docid": "176ee8275429c8470f1139d534b2c7be", "score": "0.63979965", "text": "age(year){\n const y = new Date().getFullYear();\n if(year<y||year>2200){\n console.log(`Enter a valid year to return person's age`);\n }else{\n age = (year-y)+this._age;\n return age;\n }\n }", "title": "" }, { "docid": "568ce32b420dccb8c03b3300184c6eeb", "score": "0.63902897", "text": "function totalAge(){\n let total = 0\n\n devs.forEach(item => {\n total += item.age\n })\n return total \n }", "title": "" }, { "docid": "76e1124e4248df9823424817b61be95e", "score": "0.6388087", "text": "function calculateAge(p) {\n var currentDate = new Date().getTime();\n var birth = new Date(p.birthDate).getTime();\n var day = 1000 * 60 * 60 * 24;\n var diff = currentDate - birth;\n\n var days = Math.floor(diff / day);\n var months = Math.floor(days / 31);\n var years = Math.floor(months / 12);\n\n console.log(p.name + ' tiene ' + years + ' años');\n}", "title": "" }, { "docid": "1b4ecf62e8100c15d3a00cc281eaa0f3", "score": "0.63797057", "text": "function averageMomChildAgeDiff() {\n var difference = ancestry.filter(function(person) {\n return byName[person.mother] != null;\n }).map(function(person) {\n return person.born - byName[person.mother].born;\n });\n\n return average(difference);\n}", "title": "" }, { "docid": "7f42b71ab2de4946f2f330825c441737", "score": "0.63765275", "text": "function averageAge(map) {\n var sum = void 0,\n numOfParks = 0,\n a = [];\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = map[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var _step$value = _slicedToArray(_step.value, 2),\n key = _step$value[0],\n value = _step$value[1];\n\n numOfParks++;\n a.push(value.age);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n sum = parseFloat(a.reduce(function (a, b) {\n return a + b;\n }, 0) / numOfParks).toFixed(2);\n return sum;\n}", "title": "" }, { "docid": "df1c36dacbf84ae2f5d0d486fab0bff5", "score": "0.63760847", "text": "function averageAgeByCentury() {\n var centuries = {};\n var century;\n ancestry.forEach(function(person){\n century = Math.ceil(person.died/100);\n if(!(century in centuries)){\n centuries[century] = [];\n }\n centuries[century].push(person.died - person.born);\n });\n\n for(var key in centuries){\n centuries[key] = average(centuries[key]);\n }\n \n return centuries;\t\n}", "title": "" }, { "docid": "e9f68f5ecb411b89bf40fc8dd84b4acb", "score": "0.63689756", "text": "function getAge(birthday) {\n var birthdayYear = new Date(birthday * 1000).getFullYear();\n var currentYear = new Date().getFullYear();\n return currentYear-birthdayYear;\n}", "title": "" } ]
b94f215c7193de37904d906c6be2def0
Evento para borrar un elemento del carrito
[ { "docid": "bd2cf1045a211ca2f4b2319d28db0fe1", "score": "0.66818076", "text": "function borrarItemCarrito(evento) {\n // Obtenemos el producto ID que hay en el boton pulsado\n const id = evento.target.dataset.item;\n // Borramos todos los productos\n carrito = carrito.filter((carritoId) => {\n return carritoId !== id;\n });\n\n renderizarCarrito();\n // Calculamos de nuevo el precio\n calcularTotal();\n guardarCarritoEnLocalStorage();\n\n }", "title": "" } ]
[ { "docid": "98eb85190117531d4fdc5be10fe07b93", "score": "0.70252645", "text": "function eliminar(evento){\n\tlet miID=evento.target.id;\n\t//alert(evento.target.id);\n\t// Obtenemos el elemento\n\tlet elemento=document.getElementById(miID);\n\t//Eliminamos el elemento desde su padre\n\telemento.parentNode.removeChild(elemento);\n}", "title": "" }, { "docid": "526b621ecc571fa5633cf69623e3151f", "score": "0.6907882", "text": "function eliminarCarrito(e) {\n console.log(e.target.id);\n let posicion = carrito.findIndex(p => p.id == e.target.id);\n carrito.splice(posicion, 1);\n console.log(carrito);\n // GENERAR NUEVAMENTE INTERFAZ\n carritoUI(carrito);\n // GUARDAR EN STORAGE EL NUEVO CARRITO\n localStorage.setItem(\"carrito\", JSON.stringify(carrito));\n}", "title": "" }, { "docid": "ddc71b4b61dee79740db829969b9a630", "score": "0.6853637", "text": "function eliminar(evento) {\n var miID = evento.target.id;\n //alert(evento.target.id);\n // Obtenemos el elemento\n var elemento = document.getElementById(miID);\n //Eliminamos el elemento desde su padre\n elemento.parentNode.removeChild(elemento);\n}", "title": "" }, { "docid": "4009c75054a092f7686084ddad1b3ace", "score": "0.6835602", "text": "_deleteTheChore() {\n const element = document.getElementById(this.chore.id);\n // Removes the element from the DOM\n element.remove();\n const choresArray = instanceOfChoreState.chores;\n const removeIndex = choresArray.map((item) => item.id).indexOf(element);\n // Removes it from the Array\n choresArray.splice(removeIndex, 1);\n }", "title": "" }, { "docid": "43c058565ae8394d54f7b57fb082cbe8", "score": "0.68291557", "text": "function eliminarElemento(event){\n event.preventDefault();\n let padre = event.target.parentNode.parentNode;\n let idElement = padre.firstElementChild.getAttribute(\"data-id\");\n let typeElement = padre.firstElementChild.getAttribute(\"data-type\");\n $.ajax({\n type: \"DELETE\",\n url: '/api/v1/' + typeElement + '/' + idElement,\n headers: {\"Authorization\": logeado},\n // dataType: 'json',\n success: function (data) {\n //eliminar relaciones\n }\n })\n padre.remove();\n}", "title": "" }, { "docid": "4a5de378e6af67a30da1de4afeb91728", "score": "0.6762269", "text": "function borrarItemCarrito(evento) {\r\n\r\n // Obtengo el producto ID que hay en el boton pulsado\r\n const id = evento.target.dataset.item;\r\n\r\n // Borro todos los productos\r\n carrito = carrito.filter((carritoId) => {\r\n return carritoId !== id;\r\n });\r\n\r\n // Vuevlo a renderizar\r\n renderizarCarrito();\r\n\r\n // Calculo de nuevo el precio\r\n calcularTotal();\r\n\r\n // Actualizo el LocalStorage\r\n guardarCarritoEnLocalStorage();\r\n\r\n }", "title": "" }, { "docid": "3bd8579be0cc8a44374ff9d6d77ebde7", "score": "0.67091537", "text": "function borrarCita(e) {\r\n let citaID = Number(e.target.parentElement.getAttribute('data-cita-id') );\r\n\r\n // Eliminando las transacciones en IndexedDB\r\n let transaction = DB.transaction(['citas'], 'readwrite');\r\n let objectStore = transaction.objectStore('citas');\r\n\r\n // console.log(objectStore);\r\n let peticion = objectStore.delete(citaID);\r\n\r\n // quitando las citas del DOM\r\n transaction.oncomplete = () => {\r\n e.target.parentElement.parentElement.removeChild( e.target.parentElement );\r\n\r\n if (!citas.firstChild) {\r\n headingAdministra.textContent = 'Agrega una Cita ';\r\n headingAdministra.classList.add('text-primary')\r\n let listado = document.createElement('p');\r\n listado.classList.add('text-center', 'bg-warning');\r\n listado.textContent = ' No hay Registros Aún';\r\n citas.appendChild(listado);\r\n } else {\r\n headingAdministra.textContent = 'Administra tus Citas '\r\n headingAdministra.classList.add('text-secondary')\r\n }\r\n }\r\n }", "title": "" }, { "docid": "477e3d4988fc3e62531cb2566414944e", "score": "0.6667192", "text": "function Borrar(indice){\n\t\n\tvar idTupla = document.getElementsByTagName(\"tr\")[indice+1].getElementsByTagName(\"td\")[0].textContent;\n\t\n\tvar Clientes = Parse.Object.extend(\"Clientes\");\n\tvar query = new Parse.Query(Clientes);\n\tquery.get(idTupla, {\n\t success: function(cliente) {\n\t cliente.destroy({\n\t\t success: function(cliente) {\n\t\t //alert(\"El elemento \"+ idTupla + \" se ha eliminado correctamente\");\n\t\t Listar();\n\t\t },\n\t\t error: function(cliente, error) {\n\t\t alert(\"Error: \"+error+\" al eliminar el elemento: \"+idTupla);\n\t\t }\n\t });\n\t },\n\t error: function(object, error) {\n\t alert(\"Error recuperando el objeto\");\n\t }\n\t});\n}", "title": "" }, { "docid": "1f4111a2933a33f249c595b8d3ea053e", "score": "0.6621234", "text": "function eliminarDelCarrito(e) {\n if ( e.target.classList.contains('borrar-curso')) {\n const cursoId = e.target.getAttribute('data-id');\n\n carritoLleno = carritoLleno.filter(curso => curso.id !== cursoId);\n\n carritoHTML();\n }\n}", "title": "" }, { "docid": "2d9809c1118a1e1ca2137852ee50e6e2", "score": "0.66181934", "text": "function eliminarProd(event, idx)\n{\n event.preventDefault();\n //console.log('ELIMINAR EYTER');\n detalles[idx].estado = 0;\n detalles.splice(idx, 1);//removemos el indice del objeto\n listarDetalles();\n}", "title": "" }, { "docid": "58eba9ee11d2d63fc1107704893ff47b", "score": "0.66161656", "text": "function eliminarCurso(e) {\n // Si el elemento contiene la clase borrar-curso\n if(e.target.classList.contains('borrar-curso')) {\n // Obtiene el atributo único data-id del curso\n const cursoId = e.target.getAttribute('data-id');\n\n // Selecciona todos menos el curso seleccionado para borrar\n articulosCarrito = articulosCarrito.filter( curso => curso.id !== cursoId)\n\n // llama a la función, para que muestre los cursos en el HTML\n carritoHTML();\n }\n}", "title": "" }, { "docid": "236060f3ccd2986b63160f7ca6c327c4", "score": "0.66095096", "text": "function callBackBorrado(nodo) {\n\n\n var nodoPadre = nodo.parent();\n //id del padre\n var idPadre = nodoPadre.attr(\"id\");\n //cantidad ha quitar\n var cantQuitar = nodoPadre.find(\".cantidad\").attr(\"value\");\n //sacamos el id del producto\n var id = idPadre.substring(1);\n //sacamos el stock\n var stock = parseInt(getStock($(\"#\" + id).find(\".stock\").text())) + parseInt(cantQuitar);\n //si stock 0 quitamos la clase agotado\n $(\"#\" + id).find(\".stock\").removeClass(\"agotado\");\n //lo añadimos al stock del producto\n $(\"#\" + id).find(\".stock\").text(\"Stock \" + stock);\n //quitamos un producto del total de productos\n quitarProductos(cantQuitar);\n //restar el precio del producto al total\n quitarPrecio($(\"#\" + id), cantQuitar);\n nodo.parent().remove();\n\n ponerDobleClick($(\"#\" + id));\n comprobarTamanho();\n mostrarNavegacion();\n\n }", "title": "" }, { "docid": "f14bca5f7a3bdf8ca2b1d36d650dd001", "score": "0.6588189", "text": "function removeElement(e){\n let li = this.parentNode; // El papa del boton, es el li (this == al boton)\n \n //console.log(li.childNodes[0].nodeValue); // Esto de aqui seria util para borrar el elemento por valor, pero que pasa si se repite el valor?\n // Lo que se me ocurre es poner un id = a la pos del elemento en el arreglo, a cada boton de delete, y asi borrar el elemento del arreglo en base al id del boton\n li.remove(); // Borra al papa (y por consecuente, al hijo)\n}", "title": "" }, { "docid": "7ff4da8c77b77f3b75f3b85e3ea9b75e", "score": "0.65635645", "text": "function eliminarPrenda(e) {\n e.preventDefault();\n if(e.target.classList.contains('borrar-curso') ) {\n // e.target.parentElement.parentElement.remove();\n const prendaId = e.target.getAttribute('data-id')\n \n // Eliminar del arreglo del carrito\n articulosCarrito = articulosCarrito.filter(prenda => {\n if(prenda.id === prendaId){\n if(prenda.cantidad > 1){\n prenda.cantidad--;\n return prenda;\n }else{\n delete prenda;\n }\n }else{\n return prenda;\n }\n });\n\n carritoHTML();\n }\n}", "title": "" }, { "docid": "b3006d009de3a3efaa19db9fe14a901e", "score": "0.65526384", "text": "function deleteEvent()\n{\n\tsocket.emit('borrarEvento', this.dataset.evento_id)\n}", "title": "" }, { "docid": "240e457694d82604d0d781b71e6f1ebc", "score": "0.6540702", "text": "function deleteEvent(){\n this.parentNode.remove();\n}", "title": "" }, { "docid": "e427094dba904b22bd9563b035fe1615", "score": "0.65248907", "text": "function deleteHandler(event) {\r\n event.srcElement.parentElement.remove();\r\n}", "title": "" }, { "docid": "8171b830f5725b1f3d18ce29d69a2308", "score": "0.65153646", "text": "function borrarCarrito(e)\r\n{\r\n // se obtiene el id del button\r\n var id_button = e.target.id;\r\n // el id de los botones para borrar productos comprados tiene el formato 'xxx_delete'\r\n // donde 'xxx'='id es el id del producto'.\r\n var idNroBoton = id_button.replace('_delete', '');\r\n // se obtiene el indice de un producto de acuerdo a su id.\r\n var index = ProdComp.findIndex(p => p.id == idNroBoton);\r\n // se borra el producto deseado del vector.\r\n ProdComp.splice(index, 1);\r\n\r\n // a partir de su id obtenemos el button\r\n var button = document.getElementById(id_button);\r\n // a partir del button obtenemos <td> -> <tr>\r\n var nodoTr = button.parentNode.parentNode; // <tr>\r\n\r\n // se obtienen todos los nodos del <tr> y se van borrando uno a uno\r\n nodoTr.childNodes.forEach(nodoTd => \r\n {\r\n // se obtienen todos los nodos del <td> y se van borrando uno a uno\r\n nodoTd.childNodes.forEach(n =>\r\n {\r\n nodoTd.removeChild(n);\r\n });\r\n });\r\n\r\n // se actualiza el total de la compra.\r\n\r\n}", "title": "" }, { "docid": "86136464b0d8442b1df9d70307cdf4f5", "score": "0.64857525", "text": "function deleteElement() {\n $(this).parent().remove();\n }", "title": "" }, { "docid": "93c49412e5c2b68b99d102d788e786b2", "score": "0.6482817", "text": "function n(e){e.remove()}", "title": "" }, { "docid": "18d428001a9711aca19d8a2c9994dad3", "score": "0.64799607", "text": "removerHijo(componente){\n componenteIndex = this.hijos.indexOf(componente);\n this.hijos.splice(componenteIndex,1);\n componente.setParent(null);\n }", "title": "" }, { "docid": "1ef1104bd3814048e5f0926320c07f87", "score": "0.6468213", "text": "function deleteElement() {\n context.clearRect(0, canvas.height - canvas.height / 5.7, canvas.width, canvas.height / 5.7);\n object.forEach((element, value) => {\n if (element.name == arguments[0]) {\n object.splice(value, 1)\n }\n });\n addElement();\n }", "title": "" }, { "docid": "3d3bfc1652375f73823b0583e1f07047", "score": "0.64596784", "text": "function EliminarElemento (idElemento) {\r\n\r\n}", "title": "" }, { "docid": "627cc5adc6e67bd58b0889f4e6373ee6", "score": "0.6453874", "text": "function eliminar(boton) {\n boton.parentNode.parentNode.remove();\n var index = productos.indexOf(boton.parentNode.parentNode.querySelector('.nombre').innerText);\n console.log(index);\n if (index !== -1) {\n productos.splice(index, 1);\n }\n calcularTotal();\n}", "title": "" }, { "docid": "f423e35e6e1fad09c85c6c3f16c58fcb", "score": "0.6408857", "text": "remove() { this.element.remove() }", "title": "" }, { "docid": "809d9ccae3228308a86ed35ef34cb943", "score": "0.6396531", "text": "function deleteItem(e) {\n let deleteElem = e.target.previousSibling.innerText;\n setMovieList(prev => new Set([...prev].filter(p => p != deleteElem)));\n }", "title": "" }, { "docid": "d66020f44f8be47aa83800656a4b4352", "score": "0.6389406", "text": "function borrar(e) {\n //prevent the event\n e.preventDefault();\n // show a message of confirm\n if (confirm('¿Desea eliminar el registro?')) {\n fetch(url_server + '/' + this.value, {\n method: 'DELETE'\n }).then(res => {\n // refresh the data in the table\n tbody();\n // clean the forma\n clear();\n // show a message that teh record was deleted\n alert('El registro fue eliminado');\n });\n } else {\n return false;\n }\n}", "title": "" }, { "docid": "68af7e8dadab321015ccbdb57373b628", "score": "0.63888264", "text": "function eliminarRegistro(){\n $(document).one('click','button[type=\"button\"]', function(event){\n let id=this.id;\n var lista=[];\n $('#listaProductos').each(function(){\n var celdas=$(this).find('tr,Reg_A'+id);\n celdas.each(function(){\n var registro=$(this).find('span.mid');\n registro.each(function(){\n lista.push($(this).html())\n });\n });\n });\n nuevoId=lista[0].substr(1);\n db.transaction(function(transaction){\n var sql=\"DELETE FROM productos WHERE id=\"+nuevoId+\";\"\n transaction.executeSql(sql,undefined,function(){\n alert(\"Registro borrado satisfactoriamente, por favor actualice la tabla\")\n }, function(transaction, err){\n alert(err.message);\n })\n })\n });\n}", "title": "" }, { "docid": "11ac0a53062e791ec7aac26bcc2badcc", "score": "0.6384295", "text": "remove() {}", "title": "" }, { "docid": "11ac0a53062e791ec7aac26bcc2badcc", "score": "0.6384295", "text": "remove() {}", "title": "" }, { "docid": "d5321f1bd8a2a1f170fd706857574af9", "score": "0.6357377", "text": "function eliminar() {\n document.getElementById(\"mostrarTareas\").removeChild(this);\n}", "title": "" }, { "docid": "3fbfd2b3f7954ff597ab60110e2407e9", "score": "0.6355089", "text": "function fBorrar() { \n\n //Quitamos las filas seleccionadas de la lista y reenumeramos los registros\n \n\t if (listado1.numSelecc() > 0 ) {\n\t \tlistado1.eliminarSelecc();\n\t \t//Modificamos posicionDetalle\n\t \tlistado1.actualizaDat(); \n \tvar datosFinal = listado1.datos;\n \tif (datosFinal.length == 0) btnProxy(4, 0);\n \tfor (i = 0; i < datosFinal.length; i++) {\n \t\tvar posicionDetalle = i + 1;\n \t\tdatosFinal[i][0]= posicionDetalle;\n \t\tdatosFinal[i][2]= posicionDetalle;\n \t}\n \tvar datos = new Array();\n\t\t\tlistado1.setDatos(datos);\n\t\t\tlistado1.reajusta();\n\t\t\tlistado1.actualizaDat();\n\t\t\tfor(j = 0; j < datosFinal.length; j++){\n\t\t\t\tvar fila = datosFinal[j];\n\t\t\t\tlistado1.insertar(fila);\n\t\t\t}\n\t\t\t\n \t//listado1.setDatos(datosFinal);\n \tlistado1.reajusta();\n\t }\n\t else {\n\t GestionarMensaje('50');\n\t }\n}", "title": "" }, { "docid": "4f49ff8de932d9cd8f79762bdf07e002", "score": "0.63510877", "text": "function deleteElement(){\n\t\tlet butItems = containerTodo.querySelectorAll('.todo__but');\n\t\t// catch the click on the button\n\t\tbutItems.forEach((item)=>{\n\t\t\titem.addEventListener('click', function(e){\t\n\t\t\t\t// find element in local Storage AND remove this el. in array\n\t\t\t\tlet labelV = e.target.parentNode.querySelector('label').innerHTML;\n\t\t\t\ttodoList.forEach(function(item,index){\n\t\t\t\t\tif(item.todo === labelV && item.checked){\n\t\t\t\t\t\ttodoList.splice(index,1);\n\t\t\t\t\t\t// out to page HTML\n\t\t\t\t\t\tdisplayMessages();\n\t\t\t\t\t\t// save data \n\t\t\t\t\t\tlocalStorage.setItem('todo', JSON.stringify(todoList));\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t})\n\t\t})\n\t}", "title": "" }, { "docid": "b5d84a245fc7e281fc9967d0a2c218e9", "score": "0.63501716", "text": "function borrarItem(pos){\n //le digo que en dicha pos me borre 1 objeto unicamente\n articulosPrecargados.articles.splice(pos, 1);\n //luego muestro, calculo\n mostrarArticulos();\n calcularCostoCarrito();\n modificarItemCarrito(\"cant0\", 0);\n cantidadItemsCarrito();\n }", "title": "" }, { "docid": "12336a9b01bc48032cb14dbe67072c13", "score": "0.63437897", "text": "function remove(el){\n var text = el.parentNode.childNodes[3].innerText\n data.todo.splice(data.todo.indexOf(text),1)\n el.parentNode.parentNode.removeChild(el.parentNode);\n dataUpdated()\n }", "title": "" }, { "docid": "f5da5dadf1dbf978c1919d2d68909c2d", "score": "0.63401955", "text": "function Delete(event) {\n\t// console.log('delete', event.target);\n\t// eventAdd = event.target.parentElement; \n\t// eventAdd.parentNode.removeChild(event.target.parentNode);\t\t\t\t\nevent.target.parentElement.parentNode.removeChild(event.target.parentNode)\n}", "title": "" }, { "docid": "17d1c53f39f8a3437f90e300d39526ae", "score": "0.63302827", "text": "remove() {\n \n }", "title": "" }, { "docid": "5c74f89a27219520fe78ffa669ac0f0b", "score": "0.63252854", "text": "delete() {\n $(this.DOMelement).remove();\n }", "title": "" }, { "docid": "29b353790f926fc7640085e8c0b0982e", "score": "0.63252455", "text": "function addEventoRemoverElementos() {\n\ttabela.addEventListener(\"dblclick\", function(event) {\n\t\tevent.target.parentNode.classList.add(\"fadeOut\");\n\t\tsetTimeout(function() {\n \t event.target.parentNode.remove();\n \t}, 500);\n\t // var alvoEvento = event.target;\n\t // var paiDoAlvo = alvoEvento.parentNode;\n\n\t paiDoAlvo.remove();\n\t});\n}", "title": "" }, { "docid": "38687bab25d5259e8eb37b1557b9018d", "score": "0.6325082", "text": "function removeHijo(e, divRow) {\n e.preventDefault();\n e.stopPropagation();\n // deleting from #div formadd the child #divRow\n document.getElementById(\"formadd\").removeChild(divRow);\n // seeting the global counter to -1\n numeroHijos = numeroHijos - 1;\n console.log(\"removeHijos\", divRow);\n}", "title": "" }, { "docid": "e45288a777837cd4e2ccbb7f026d20be", "score": "0.63158315", "text": "function eliminarUnidadDesdeCarrito(e) {\n\te.preventDefault();\n\tlet productoCarrito = carrito.filter(prod => prod.id == e.target.id);\n\tfor (producto of productoCarrito) {\n\t\tif (producto.cantidad > 1) {\n\t\t\tproducto.cantidad--\n\t\t}\n\t}\n\tmostrarItemsCarrito(carrito);\n\tvaloresDelCarrito(carrito);\n}", "title": "" }, { "docid": "22d2a03183df940b087f3eba2d761445", "score": "0.63101435", "text": "onDelete() {\n\t\tconst data = this.props.data.dictionary;\n\t\tconst state = this.props.state;\n\t\tconst selected = state.selected;\n\n\t\t// Change the selected element.\n\t\tstate.selected = Math.max(state.selected - 1, 0);\n\t\tstate._update();\n\n\t\t// Remove the definition.\n\t\tdata._.splice(selected, 1);\n\t\tthis.props.data._update();\n\t}", "title": "" }, { "docid": "4ada319eb5815a55e28d9e69755cd0f7", "score": "0.62900054", "text": "function removeItem(e) {\n e.target.remove()\n}", "title": "" }, { "docid": "ffe974e694ea9f43167c28ded3e87dc7", "score": "0.6288032", "text": "function eliminarFicha(boton) {\n boton.parentNode.remove();\n}", "title": "" }, { "docid": "c6dc9473f3e7249f4a76be434482ece8", "score": "0.6282242", "text": "function Borrar(){\n\tcccCuentCorriBancaRemoveSelection();\n}", "title": "" }, { "docid": "33b413cba2205f9a853e6fc39f581fc4", "score": "0.6279263", "text": "function remove(e) {\n let parentElement = document.getElementById(e.srcElement.getAttribute(\"removeid\"));\n $(\"#\" + parentElement.id).remove()\n save();\n setCounter();\n}", "title": "" }, { "docid": "c6374f899f9589f35d4170b03f521c17", "score": "0.6260056", "text": "function eliminarTareaDOM(e) {\n e.preventDefault();\n if (e.target.classList.contains('borrar-tarea')) {\n // console.log('Click en boton eliminar');\n console.log(e.target.parentElement.remove());\n console.log('Tarea eliminada');\n elemento = e.target.parentElement.innerText;\n console.log(elemento);\n eliminarTareaLocalStorage(elemento);\n }\n}", "title": "" }, { "docid": "23beac5b27b5aa5f9ff1acd088d231f3", "score": "0.6255989", "text": "function eliminarCurso(e) {\n if(e.target.classList.contains(\"borrar-curso\")) {\n let idCursoABorrar = e.target.getAttribute(\"data-id\")\n \n //eliminando el curso\n articulosCarrito = articulosCarrito.filter(curso => curso.id !== idCursoABorrar)\n //aqui llamamos esta funcion porque iterara de nuevo en articulosCarrito que ya esta modificado y los pintara\n addCursosCarrito() \n }\n}", "title": "" }, { "docid": "5ebb2578a69376c50a1e884465fe8ce9", "score": "0.62438285", "text": "function borrarAlumno(event) {\n let i = 0\n let j = 1\n app.grupos.forEach(grupo => {\n grupo.estudiantes.forEach(estudiante => {\n if (estudiante._id == event.id) {\n app.$http.delete(`/api/grupos/${grupo._id}/estudiantes/${estudiante._id}`).then(response => {\n if (response.body.estado) {\n //app.obtenerTodosGrupos()\n\t\t\tapp.borrarAlumno(grupo, estudiante)\n }\n }, response => {\n // codigo error\n });\n }\n j = j + 1\n })\n j = 0\n i = i + 1\n })\n}", "title": "" }, { "docid": "798144b01b6e34ac78d261e40d730f32", "score": "0.62393624", "text": "function eliminarUnidad(e) {\n\tlet posicion = carrito.findIndex(producto => producto.id == e.target.id);\n\t//Utilizo el splice para que me elimine el producto del carrito (metodo splice, busco la posicion con el findIndex y elimino uno para adelante desde ahi)\n\tcarrito.splice(posicion, 1);\n\t$(\".numeroDeItems\").text(0);\n\tvaloresDelCarrito(carrito)\n\tmostrarItemsCarrito()\n\tlocalStorage.setItem(\"Carrito\", JSON.stringify(carrito));\n\tif (carrito.length === 0) {\n\t\t$(\".clear-cart\").hide()\n\t\t$(\".display-carritoVacio\").show();\n\t\t$(\".contenedor-total-carrito\").hide()\n\t} else {$(\".contenedor-total-carrito\").show()}\n}", "title": "" }, { "docid": "08b2691e7e413e28baa4ee55419572cb", "score": "0.6239241", "text": "deleteElement() {\n try {\n if (this.elements.includes(this.currentElement)) {\n this.div.removeChild(this.currentElement);\n this.elements.splice(this.elements.indexOf(this.currentElement), 1);\n this.currentElement = null;//????\n }\n }\n catch {\n console.error(\"Could not remove element\");\n }\n }", "title": "" }, { "docid": "b20cbc90795e23ee8907ad09dd37a926", "score": "0.62369853", "text": "function eliminar_curso(event) {\n event.preventDefault();\n //console.log(\"eliminando..\");\n let curso, curso_id;\n if (event.target.classList.contains('borrar-curso')) {\n //eliminar el <tr></tr>\n event.target.parentElement.parentElement.remove();\n curso = event.target.parentElement.parentElement;\n //console.log(curso);\n\n //tomar el data-id\n curso_id = curso.querySelector('a').getAttribute('data-id');\n\n eliminar_curso_local_storage(curso_id);\n }\n}", "title": "" }, { "docid": "36f1f0c4387ea7fbcba5e68b77108ed0", "score": "0.6233744", "text": "function delToDo(e) {\r\n e.target.parentElement.parentElement.remove()\r\n}", "title": "" }, { "docid": "33b77b94796dd66633fcb4d2f61e73b9", "score": "0.62270373", "text": "remove() {\n this.element.parentNode.removeChild(this.element)\n }", "title": "" }, { "docid": "9241819f4d3b955f474535e1daea55f0", "score": "0.6223135", "text": "undo() {\n this.parentItem.removeChild(this.parentItem.getChildIndex(this.geomItem))\n }", "title": "" }, { "docid": "6115831a08a2adc082df72a96285491b", "score": "0.6209958", "text": "function eliminarCurso(e) {\n \n if (e.target.classList.contains('borrar-curso')) {\n const dataID = e.target.getAttribute('data-id')\n\n //eliminamos el curso seleccionado\n articuloEliminar = articulosCarrito.find(curso => curso.id === dataID )\n \n if (articuloEliminar.cantidad > 1 ) {\n articuloEliminar.cantidad--\n articuloEliminar.precio = articuloEliminar.cantidad * articuloEliminar.precioBase\n } else {\n articulosCarrito = articulosCarrito.filter(curso => curso.id !== dataID)\n }\n \n mostrarHTML()\n \n }\n \n}", "title": "" }, { "docid": "0417ecf4fdd9a1719c92a56ab83f89da", "score": "0.6206359", "text": "borrarNota(id){\n //Elimina la nota seleccionada por id\n document.getElementById('tablero').removeChild(document.getElementById(id));\n this.controlador.lista.notas.splice(this.controlador.lista.notas[id], 1);\n this.controlador.saveLocalStorage();\n }", "title": "" }, { "docid": "2d21cee5e7f7f135a9810088003dd803", "score": "0.6205062", "text": "onRemove() {}", "title": "" }, { "docid": "81a1925e10f3eb77553c16e336cc0bc7", "score": "0.6198736", "text": "function removeItem(idorden) {\n var elem = document.getElementById(\"item\" + idorden);\n elem.remove();\n contarordenes = contarordenes - 1;\n validarOrdenes();\n}", "title": "" }, { "docid": "a373e4be25ef57a5f2b6f177de8893ad", "score": "0.61946005", "text": "deleteElement(evt) {\n this.collection.remove(this._getId(evt));\n }", "title": "" }, { "docid": "220656a631cff2b62f68501128ca4190", "score": "0.61939156", "text": "remove() {\n if (typeof this[_element].parentNode !== \"undefined\") {\n this[_element].parentNode.removeChild(this[_element]);\n }\n }", "title": "" }, { "docid": "3560500b22aef383556aebd9f58204b6", "score": "0.6191122", "text": "function eliminarCurso(e){\n if(e.target.classList.contains('borrar-curso')){\n const cursoId = e.target.getAttribute('data-id');\n\n //Filtra todos los elementos del arreglo menos \n //el de CursoID que seria el Data-id que se selecciono\n articulosCarrito = articulosCarrito.filter(curso => curso.id !== cursoId);\n carritoHtml(); //iteramos de nuevo el carrito y si html\n }\n}", "title": "" }, { "docid": "0fbeb7e5331b429b0c54f5b92215a266", "score": "0.618987", "text": "function deleteSuccess(ev) {\n $(ev.target).parent().remove();\n }", "title": "" }, { "docid": "c129e2ba61e74c04acf95337d51353a4", "score": "0.61884195", "text": "borrarProducto(elemento){\n //verificacion si esa propiedad tiene el name de eliminar(pertenece al boton) y si es asi procede a eliminar \n if(elemento.name === 'eliminar'){\n //logramos acceder completamente al div que contiene todo el producto y se elimina con el metodo remove \n elemento.parentElement.parentElement.parentElement.remove();\n this.mostrarMensaje('producto eliminado correctamente', 'danger')\n } \n }", "title": "" }, { "docid": "e83ed726bd86e5bc04e8a9d6753c0803", "score": "0.6184362", "text": "function deletaTarefaDaLista(event) {\n let itemLixo = event.target;\n if(itemLixo.attributes[0].textContent.indexOf('lixo') !== -1) {\n itemLixo.offsetParent.remove();\n };\n}", "title": "" }, { "docid": "81a45c304074bac4b2c041188024f5c8", "score": "0.61836714", "text": "function borrarAnuncio(){\n let id = obtenerId(frm);\n \n for(i = 0; i < arrayAnuncios.length; i++)\n {\n if(arrayAnuncios[i].id == id)\n {\n arrayAnuncios.splice(i, 1);\n }\n }\n \n localStorage.setItem(\"Anuncios\", JSON.stringify(arrayAnuncios));\n limpiarForm();\n cargarTabla(arrayAnuncios);\n}", "title": "" }, { "docid": "0fc2e2548a39b3fc52a9b3208b4793b0", "score": "0.61831504", "text": "function eliminarInventario()\n{\n $(\"#equiposDinamicos\").on(\"click\", \".btn.btn-danger.px-3\", function () \n {\n $(this).closest(\".row.mb-3\").remove();\n });\n}", "title": "" }, { "docid": "bebcc1637ffe6e87e1d97b8f14b43af6", "score": "0.61820453", "text": "function deleteEvent() {\n\n }", "title": "" }, { "docid": "1bcc36286882c076c22dd07e204e058c", "score": "0.6179856", "text": "function removerOuvinte() {\n\tif (confirm(\"Deseja realmente descadastrar seu e-mail?\")) {\n\t\t_canal2.enviar({url: _url+\"removerOuvinte\", dados: {chave: _chave}, funcao: function (ok) {\n\t\t\tif (ok) {\n\t\t\t\tAviso.avisar(\"Cadastro excluído\", 3e3)\n\t\t\t\t_chave = \"\"\n\t\t\t} else\n\t\t\t\tAviso.falhar(\"Não foi possível excluir cadastro\", 3e3)\n\t\t}, metodo: \"POST\"})\n\t\t\n\t\t// Apaga o forms e a janela\n\t\tget(\"janela\").style.display = \"none\"\n\t\tget(\"conteudoJanela\").removeChild(get(\"formOuvinte\"))\n\t}\n}", "title": "" }, { "docid": "5051a9c49476d8eb44ba3f25d3cb9e7f", "score": "0.61785996", "text": "function eliminarCurso(e){\n e.preventDefault();\n let curso, \n cursoId;\n \n if(e.target.classList.contains('borrar-curso')){\n //hacemos doble parentelement para llegar a la etiqueta que nos interesa eliminar que es la tr\n e.target.parentElement.parentElement.remove();\n curso = e.target.parentElement.parentElement;\n cursoId = curso.querySelector('a').getAttribute('data-id');\n //console.log(cursoId);\n }\n eliminarCursoLocalStorage(cursoId);\n}", "title": "" }, { "docid": "83bb26437e6364c533d370927b4664c7", "score": "0.6177001", "text": "function deleteElements() {\n\t//variables\n\tlet botesbasura = document.querySelectorAll(\".fa-trash\"); //creamos el elemento para borrar\n\tfor (let botedebasura of botesbasura) {\n\t\tbotedebasura.addEventListener(\"click\", function(e) {\n\t\t\tlet item = e.target.parentElement;\n\t\t\tlet item2 = item.parentElement;\n\t\t\t//console.log(item2);\n\t\t\tseleccionar.removeChild(item2);\n\t\t});\n\t}\n}", "title": "" }, { "docid": "0676188c12d5026cf9b8d85f5b4fd687", "score": "0.6168411", "text": "function removeItem(e){\n //selects the item using the this. keyword\n //this is used for making current selections\n //we use parentNode twice to get to go 2 upper layers\n var item = this.parentNode.parentNode;\n //parent is used to select the parent node of item\n var parent = item.parentNode;\n var id = parent.id;\n\n var value = item.innerHTML;\n\n if(id === 'to-do'){\n //here, we are deleting the selected item from the todo array of object data\n data.todo.splice(data.todo.indexOf(value),1);\n }\n else{\n //here, we are reversing the order and first deleting it from the completed(current) array\n data.completed.splice(data.completed.indexOf(value),1);\n }\n\n //we are going to update the user's local storage using this function after \n //every add/remove/complete function\n dataObjectUpdated();\n\n parent.removeChild(item);\n}", "title": "" }, { "docid": "74553e4b4fa20648d672f99046821946", "score": "0.6167663", "text": "eliminar(num){\n this.losElementos.splice(this.dondeEsta(num), 1);\n }", "title": "" }, { "docid": "c45e55cb8dfbe46c2f0ddea31b99e67c", "score": "0.61634713", "text": "function eliminarCurso (event) {\n event.preventDefault();\n let curso, cursoId;\n // delegation al boton\n if (event.target.classList.contains('borrar-curso')) {\n event.target.parentElement.parentElement.remove();\n curso = event.target.parentElement.parentElement;\n cursoId = curso.querySelector('a').getAttribute('data-id');\n }\n eliminarCursoLocalStorage(cursoId);\n}", "title": "" }, { "docid": "6a8efc15af8eafa8c51f75d24655da7e", "score": "0.6154145", "text": "function combo_popup_remover_item(nome_combo, codigo, ordenar, naoChamarEvento) {\n var campo_select = document.getElementById(nome_combo);\n var removeu = false;\n for (var i = 0; i <= campo_select.length - 1; i++) {\n if (codigo == campo_select.options[i].value) {\n campo_select.options[i] = null;\n removeu = true;\n }\n }\n if (removeu && !naoChamarEvento) {\n var evento = campo_select.getAttribute('onpop');\n if (evento) {\n eval(evento);\n }\n }\n if (campo_select.options.length == 0) {\n campo_select.options[0] = new Option('Duplo clique para selecionar da lista', '', false, false);\n }\n if (ordenar == true) {\n sortSelect(campo_select);\n }\n}", "title": "" }, { "docid": "3a306c2444992d8acb0bdf27981ef0d9", "score": "0.61494815", "text": "function eliminarPersonaje(){\n var boton = $(event.target);\n //el boton es hijo de un td que a su vez es hijo del tr que quiero ocultar\n boton.parent().parent().fadeOut(\"slow\");\n}", "title": "" }, { "docid": "aaddab9389df21fa93c9c79788d04f81", "score": "0.6149283", "text": "'click .delete'() {\n Mechanics.remove(this._id);\n swal('Eliminado','Mecanico Eliminado Del Registro','success');\n console.log(\"PI-5: Eliminar Mecánicos\");\n console.log(\"PI-5.1: Mecánico eliminado\");\n }", "title": "" }, { "docid": "a32e3eb20264f813cad6bc642fdc7e69", "score": "0.614819", "text": "remove (event) {\n event.preventDefault()\n event.target.parentElement.remove()\n }", "title": "" }, { "docid": "e8b07ea23aedce4a9ebd5385592d7a4d", "score": "0.6147972", "text": "function removeItem(e) {\n e.target.parentElement.removeChild(e.target);\n }", "title": "" }, { "docid": "f9af5a04e6b9ae8d429c35e6d19fabdd", "score": "0.6147954", "text": "function removeTodo(element){\n element.parentNode.parentNode.removeChild(element.parentNode)\n\n LIST[element.id].trash = true\n \n\n}", "title": "" }, { "docid": "65a672e426f831004e982a7a624075fd", "score": "0.61440367", "text": "function eliminarNota(){\n const lista=document.getElementById(\"lista-notas\");\n lista.addEventListener(\"click\",(e)=>{\n if(e.target.className===\"borrar\"){\n e.target.parentElement.remove();\n }\n\n\n \n })\n\n}", "title": "" }, { "docid": "2e847a5fdc85a1cc77877806e61f4ab3", "score": "0.61430156", "text": "function borrarTweet (e) {\r\n e.preventDefault();\r\n if (e.target.className === 'borrar-tweet')\r\n e.target.parentElement.remove();\r\n borrarTweetLocalStorage(e.target.parentElement.innerText);\r\n alert('Tweet eliminado');\r\n\r\n}", "title": "" }, { "docid": "b3672248afd8f265f503275cdc982fe9", "score": "0.6141921", "text": "function unselectElement(key){\n for(var i=0; i<data_object.length; i++){\n if(data_object[i].key === key)\n data_object.splice(i,1);\n }\n console.log(\"data[delete]: \", data_object)\n }", "title": "" }, { "docid": "c032ec1ef40f339e63d3d5361281c604", "score": "0.6140593", "text": "function deleteItem() {\n //We get the element that launched the event\n var invoker = this;\n var tdParent = invoker.parentNode;\n var trParent = tdParent.parentNode;\n var tableParent = trParent.parentNode;\n tableParent.removeChild(trParent);\n updateItemCounter();\n}", "title": "" }, { "docid": "616521b8b37ab18ac8f49f627499462f", "score": "0.61309576", "text": "function deleteItem(evt){\n\n selectedItem = evt.target;\n\n if(confirm(\"Voulez-vous supprimer l'item?!\")){\n\n selectedItem.remove();\n\n }\n\n selectedItem = null;\n}", "title": "" }, { "docid": "ac812516a5b402f93f5c1d16f16a6837", "score": "0.6115861", "text": "function fncRemoveElement(e) {\r\n // console.log(e);\r\n if (!rmvElt){\r\n rmvElt = true;\r\n SOUND_SCRATCH.load();\r\n SOUND_SCRATCH.play();\r\n PARA_DATA.innerHTML = '';\r\n // const row = LctElmt.row;//setTimeoutのラグ対策\r\n // const clm = LctElmt.clm;\r\n e.srcElement.removeEventListener('mouseover', fncMouseOver);\r\n e.srcElement.removeEventListener('mouseout', fncMouseout);\r\n e.srcElement.removeEventListener('dblclick', fncRemoveElement);\r\n e.srcElement.removeEventListener('click', fncCommand);\r\n new Promise((resolve)=>{\r\n setTimeout(() => {\r\n // EData[row][clm][0] = 'blank';\r\n EData[LctElmt.row][LctElmt.clm][0] = 'blank'\r\n e.srcElement.remove();\r\n resolve();\r\n }, 250);\r\n })\r\n .then((result)=>{\r\n rmvElt = false;\r\n return result;\r\n })\r\n }\r\n}", "title": "" }, { "docid": "1af056810c9e3619d9e7f7e78b085d02", "score": "0.6112426", "text": "function excluir_tarefa(elemento)\n{\n var item = elemento.parentNode;\n item.parentNode.removeChild(item);\n return item;\n}", "title": "" }, { "docid": "6616a8e52f4fb70474281f1502a1a503", "score": "0.6111897", "text": "function removeStudent() {\n var i = lista_studenti.length - 1;\n lista_studenti.pop()\n document.getElementById(`p${i}`).remove();\n}", "title": "" }, { "docid": "964309b59a790d30172b7432b5b010e9", "score": "0.61117053", "text": "function borrar(){\n\tmensaje = document.getElementById(\"exito\");//obtiene el elemento\n\tmensaje.innerHTML = \"\";//A partir de DOM le da un texto\n\tmensaje.setAttribute(\"class\", \"saveExito\");//con el metodo le asigna una clase\n\t}", "title": "" }, { "docid": "5413eb8535ea0f1742d4da11d2605b54", "score": "0.6110736", "text": "function eliminarCurso(e) {\n if(e.target.classList.contains('borrar-curso')) {\n const cursoId = e.target.getAttribute('data-id');\n\n // elimina del arreglo articulosCarrito por el id\n articulosCarrito = articulosCarrito.filter( curso => curso.id !== cursoId);\n\n carritoHTML(); //irera sobre el carrito y muestra el html\n }\n}", "title": "" }, { "docid": "41af9cf375285ae22cab5e2c76daafe6", "score": "0.61075675", "text": "function borrarCapa()\n{\n\tthis.parentNode.parentNode.remove()\n}", "title": "" }, { "docid": "d872afa1f31bbc82697ef58e6faefe09", "score": "0.61043894", "text": "removeOne(e) {\n e.stopPropagation();\n this.parent.removeOne(this.item);\n }", "title": "" }, { "docid": "66a98c62891829ea73152a56c700a4b7", "score": "0.61029583", "text": "eliminar() {\n $(\"h3\").remove(); //Dos elem h3 en mi .html \n }", "title": "" }, { "docid": "1aec9d9e13608d2581ff51a2b137e691", "score": "0.6100289", "text": "function eliminarCompra(arg_id) {\n \n let td = event.target.parentNode; \n let tr = td.parentNode; // fila a ser removida\n tr.parentNode.removeChild(tr);\n\n let eliminar = JSON.parse(window.localStorage.getItem(\"identificadoresLocalS\"));\n\n let i = 0;\n while( i < eliminar.length){\n\n if(eliminar[i].identificador == arg_id){\n\n eliminar.splice(i,1);\n\n } else{\n\n i++;\n\n } // fin del if-else\n } // fin del while\n\n window.localStorage.setItem(\"identificadoresLocalS\",JSON.stringify(eliminar));\n window.location.reload();\n\n}//eliminarCompra", "title": "" }, { "docid": "5ee390cbfae17879704a0fc7ce21474a", "score": "0.6093737", "text": "function removerItem(produto_id) {\n for (x = 0; x < qtdItens; x++) {\n if (idProdutosSeleconadosNotaFiscal[x] == produto_id) {\n idProdutosSeleconadosNotaFiscal[x] = \"removido\";\n }\n }\n $(\"#\" + produto_id).parent().parent().remove();\n}", "title": "" }, { "docid": "713b3ff111a21433c18a6cd47a102c1d", "score": "0.6092114", "text": "function eliminarModel(modelElegit) {\n let index = models.findIndex(model => model.nom == modelElegit);\n models.splice(index, 1);\n let cotxeIndex = cotxes.findIndex(cotxe => cotxe.model.nom == modelElegit);\n cotxes.splice(cotxeIndex, 1);\n alert(\"S'ha eliminat el model \" + modelElegit);\n}", "title": "" }, { "docid": "9c64bbdf43dfa4c169c1d811cef452a2", "score": "0.6085043", "text": "function removeTarefa() {\n // Remove tarefa e executa callback em seguida\n api.delete(`/${props.id}/`).then(props.aoRemover);\n }", "title": "" }, { "docid": "c6bf081d350915173f278f0879e8b172", "score": "0.60842425", "text": "function removeItem(e)\n{\n e.target.parentElement.removeChild(e.target);\n}", "title": "" }, { "docid": "3f1ef178efa9439cbbce6e61544a8736", "score": "0.60821635", "text": "function borrarbotones() {\n console.log('borrado')\n $('#tabla button').remove();\n\n}", "title": "" }, { "docid": "9c21a6290c5b9fcfc48b0f1be612a901", "score": "0.6075832", "text": "function deleteItem(e) {\n e.parentNode.remove();\n}", "title": "" } ]
fc7ddd93bb55beab43691e8f74b46ec1
This function checks if an input is a vowel
[ { "docid": "9c5cbbcc99f394f877a05de4b3789d30", "score": "0.82291627", "text": "function isVowel(ch){ \n\tif(ch === 'a' || ch === 'e' || ch === 'i' || ch ==='o' || ch === 'u' ) \n\t\treturn true ; \n\telse \n\t\treturn false;\n\t}", "title": "" } ]
[ { "docid": "e63eb9fd1810da5a1f9d96e9ee7df4da", "score": "0.8688127", "text": "static is_vowel(a_char) { return \"aeiou\".includes(a_char) }", "title": "" }, { "docid": "5b7dcc1eb019d67f99723cbb239738d4", "score": "0.85711324", "text": "function isVowel (c) {\n return /[aeiou]/i.test(c)\n}", "title": "" }, { "docid": "ac47ee287092d1409eab7beadcc99f3e", "score": "0.85641754", "text": "function isVowel(vowel){\n if(vowel == \"a\" || vowel == \"e\" || vowel == \"i\" || vowel == \"o\" || vowel == \"u\" || vowel == \"A\" || vowel == \"E\" || vowel == \"I\" || vowel == \"O\" || vowel == \"U\") {\n return true;\n }else {return false;}\n}", "title": "" }, { "docid": "80f4a067e809b790c902e56d11c0a645", "score": "0.851785", "text": "function isVowel(char) {\n return /[aeiou]/.test(char);\n\n //return(char==='a'||char==='e'||char==='i'||char==='o'||char==='u');\n}", "title": "" }, { "docid": "b7c20a395576d41cb2e624673e569e14", "score": "0.8470853", "text": "function isVowel(c){\n\tif (c==='A' || c==='E' ||c==='I' ||c==='O' ||c==='U' || c==='a' || c==='e' ||c==='i' ||c==='o' ||c==='u') {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}", "title": "" }, { "docid": "314b2e7fd780fb2f9b29b60d3386c0ae", "score": "0.8463937", "text": "function isVowel(char){\n if (char === 'a' || char === 'e' || char === 'i' || char === 'o' || char === 'u') {\n return true;\n } else {\n return false;\n }\n}", "title": "" }, { "docid": "0ccc1dc37268de9aed7e71f3ad39a828", "score": "0.8454096", "text": "function isVowel(char){\n return char === 'a' || char === 'e' || char === 'i' || char === 'o' || char === 'u' || false;\n}", "title": "" }, { "docid": "5ca4ec51e4f1c06514a8dbf870d622a8", "score": "0.8447089", "text": "function isVowel(char){\n return \"aeiou\".includes(char);\n }", "title": "" }, { "docid": "0a49a49188343cef8f0b4f6fa4f66d6b", "score": "0.84370995", "text": "function isVowel(char) {\n if(char == \"a\"||char== \"e\"|| char == \"i\"|| char == \"o\"|| char == \"u\"){\n return true\n }else{\n\n return false}\n\n}", "title": "" }, { "docid": "87232a97cd2420a9c5500d602059004b", "score": "0.8435694", "text": "function isVowel(char){\n return (char === \"a\" || char === \"e\" || char === \"i\" || char === \"o\" || char === \"u\");\n}", "title": "" }, { "docid": "cc551df86709fe3d245c6d180fc410de", "score": "0.8423714", "text": "function isVowel(char){\n // Your answer here\n switch (char) {\n case a: case e: case i: case o: case u:\n return true;\n break;\n default:\n return false;\n }\n}", "title": "" }, { "docid": "9ffe8c48c307660942a77dcdd6503f14", "score": "0.84098226", "text": "function isVowel(char){\n if (char === \"a\" || char === \"e\" || char === \"i\" || char === \"o\" || char === \"u\") {\n return true;\n } else {\n return false;\n }\n}", "title": "" }, { "docid": "ff0c1ed1020db081327bed59c9e2b06d", "score": "0.84082353", "text": "function isVowel(letter){\n var letter = letter.toLowerCase();\n if (letter === \"a\" || letter === \"e\" || letter === \"i\" || letter === \"o\" || letter === \"u\"){\n return true;\n } else {\n return false;\n }\n}", "title": "" }, { "docid": "1abd80ce0c21b66e24d77373d9955d55", "score": "0.8385644", "text": "function isVowel(x){\n \"use strict\";\n if (x == \"a\" || x == \"e\" || x == \"i\" || x == \"o\" || x == \"u\" ) {\n return true;\n } else {\n return false;\n }\n}", "title": "" }, { "docid": "70a5555ca25bafb88bbd5046508fac57", "score": "0.83812255", "text": "function isVowel(char){\n if (char === 'a' || char === 'e' || char === 'i' || char === 'o' || char === 'u' || char === 'y'){\n return true;\n }\n else {\n return false;\n }\n}", "title": "" }, { "docid": "ccb618cecdcf737e6b65462b42823a6c", "score": "0.8360019", "text": "function isVowel(c) {\n if (c == \"a\" || c == \"e\" || c == \"i\" || c == \"o\" || c == \"u\")\n \t{\n \t\treturn 1;\n \t}\n\t}", "title": "" }, { "docid": "ccb618cecdcf737e6b65462b42823a6c", "score": "0.8360019", "text": "function isVowel(c) {\n if (c == \"a\" || c == \"e\" || c == \"i\" || c == \"o\" || c == \"u\")\n \t{\n \t\treturn 1;\n \t}\n\t}", "title": "" }, { "docid": "fb01b2356a0116f85a754a5f6ff9c8b6", "score": "0.8356856", "text": "function isVowel(char){\n if(char === \"a\" || char === \"e\" || char === \"i\" || char === \"o\" || char === \"u\") {\n return true;\n }\n else if (char === \"A\" || char === \"E\" || char === \"I\" || char === \"O\" || char === \"U\") {\n return true;\n }\n else {\n return false;\n }\n}", "title": "" }, { "docid": "1fa14c5de41d028eb76db2f0913c25dc", "score": "0.8323714", "text": "function isVowel(x){\n var y = x.toLowerCase();\n if(y.length===1 && (y===\"a\" || y===\"e\" || y===\"i\" || y===\"o\" || y===\"u\")){\n return true;\n }else{\n return false;\n }\n }", "title": "" }, { "docid": "483b0999f9009f10368fe07c54f21f99", "score": "0.83146465", "text": "function isVowel(char){\n \"use strict\";\n //...\n if (char === 'a'\n ||char === 'e'\n ||char ==='i'\n ||char ==='o'\n ||char ==='u'){\n return true;\n }\n return false;\n}", "title": "" }, { "docid": "2975e8460174b3d087ba7d76a78dfd55", "score": "0.83055735", "text": "function isVowel(symbol){\n\nif ((symbol=== \"A\") || (symbol === \"a\") || (symbol === \"e\") || (symbol === \"E\")\n || (symbol === \"i\") || (symbol === \"I\") || (symbol === \"o\") || (symbol === \"O\") || (symbol === \"u\") || (symbol === \"U\")) {return true}\n else{\n return false}\n }", "title": "" }, { "docid": "1c2a472cf81006759a3847fb45289a22", "score": "0.83019394", "text": "function isVowel(char) {\n // Your answer here\n // let's make the character lowercase so we don't have to check against upper and lower case letters\n char = char.toLowerCase();\n if (char == 'a' || char == 'e' || char == 'i' || char == 'o' || char == 'u') {\n return true;\n }\n\n return false;\n}", "title": "" }, { "docid": "8a467f6004e610554a958599d9b9a884", "score": "0.82882965", "text": "function isVowel(char) {\r\n switch (char) {\r\n case \"a\":\r\n case \"e\":\r\n case \"i\":\r\n case \"o\":\r\n case \"u\":\r\n return true;\r\n default:\r\n return false;\r\n }\r\n}", "title": "" }, { "docid": "3080da1b6298883d5ed6312f67693ebd", "score": "0.82760894", "text": "function isVowel(char){\n if (char==='a' || char==='e' || char==='i' || char==='o' || char==='u') {\n return true;\n } else if (char==='y') {\n return 'and sometimes y'\n } else {\n return false;\n }\n}", "title": "" }, { "docid": "bcefed7496d4e91469f4839655e1f76e", "score": "0.8274548", "text": "function isVowel(word) {\n switch (word.charAt(0)) {\n case 'a':\n case 'e':\n case 'i':\n case 'o':\n case 'u':\n return true;\n break;\n }\n return false;\n}", "title": "" }, { "docid": "acd2da2a914d34ae727c58c3ea07eb6c", "score": "0.8274535", "text": "function isVowel(char){\n \"use strict\";\n //...\n if ('aeiou'.indexOf(char) === -1) {\n return false;\n } else;\n return true;\n\n}", "title": "" }, { "docid": "c2c39ef8e08775a1039832577252b3c0", "score": "0.8252038", "text": "function isVowel(char) {\r\n return [\"a\", \"e\", \"i\", \"o\", \"u\"].includes(char);\r\n}", "title": "" }, { "docid": "e07a6468e481d998d62a30b2e0493bac", "score": "0.8245345", "text": "function isVowel(char) {\n return ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'].indexOf(char) !== -1;\n}", "title": "" }, { "docid": "ed7b5ef02902d99c9dd06ec45b926ece", "score": "0.8231289", "text": "function isVowel(s) {\n if (s > 'a' && s < 'z' || str > 'A' && s < 'Z') {\n if (s == 'a' || s == 'e' || s == 'i' || s == 'o' || s == 'u') {\n return true;\n }\n else if (s == 'A' || s == 'E' || s == 'I' || s == 'O' || s == 'U') {\n return true;\n } else {\n return false;\n }\n } else {\n return false;\n }\n}", "title": "" }, { "docid": "9d19915579d16746174f865caf8b5172", "score": "0.8217369", "text": "function isVowel(char){\n var vowels = \"aeiou\";\n var response = vowels.indexOf(char);\n if (respnose === -1){\n return false;\n }\n return true;\n}", "title": "" }, { "docid": "b1a7aad281970be4c6765eeae2fedf81", "score": "0.82129925", "text": "function isVowel(c) {\n if ((c == 'a') || (c == 'A')) { return true; }\n else if ((c == 'e') || (c == 'E')) { return true; }\n else if ((c == 'i') || (c == 'I')) { return true; }\n else if ((c == 'o') || (c == 'O')) { return true; }\n else if ((c == 'u') || (c == 'U')) { return true; }\n else if ((c == 'y') || (c == 'Y')) { return true; }\n else { return false; }\n}", "title": "" }, { "docid": "c4f75542cc477f34757643d836f018c2", "score": "0.81874204", "text": "function isVowel(letter) {\n if (letter == 'a' || letter == 'b' || letter == 'c' || letter == 'd' || letter == 'e') {\n return true;\n }else {\n return false;\n }\n}", "title": "" }, { "docid": "5339211b2ccfcc946e3452c7a5188e58", "score": "0.8173285", "text": "function isVowel(char) {\n var boolean = null;\n if (char.toLowerCase() === 'a') {\n boolean = true;\n } else if (char.toLowerCase() === 'e') {\n boolean = true;\n } else if (char.toLowerCase() === 'i') {\n boolean = true;\n } else if (char.toLowerCase() === 'o') {\n boolean = true;\n } else if (char.toLowerCase() === 'u') {\n boolean = true;\n } else {\n boolean = false;\n }\n return boolean;\n}", "title": "" }, { "docid": "060a001c3927cf519696d317392f60f4", "score": "0.81528753", "text": "function isVowel(c) {\n return ['a', 'e', 'i', 'o', 'u'].indexOf(c.toLowerCase()) !== -1;\n}", "title": "" }, { "docid": "825a6d26caaf621ab8f173bef4e47366", "score": "0.8143713", "text": "function isVowel(aChar) {\n var result;\n\n if (aChar == \"A\" || aChar == \"E\" || aChar == \"I\" || aChar == \"O\" || aChar == \"U\") {\n result = true;\n } else {\n result = false;\n }\n\n return result;\n}", "title": "" }, { "docid": "2b8145563934d9c18a89a368d4c2a154", "score": "0.81381327", "text": "function isVowel(char) {\n var vowel = false;\n if (char.toLowerCase() === 'a' || char.toLowerCase() === 'e' || char.toLowerCase() === 'i' || char.toLowerCase() === 'o' || char.toLowerCase() === 'u') {\n vowel = true;\n }\n return vowel;\n}", "title": "" }, { "docid": "9a48aa2aebffbb82e796a8cfe27281da", "score": "0.8091678", "text": "function isVowel(char){\n if (char === 'a') {\n return 'vowel';\n } else if (char === 'e') {\n return 'vowel';\n } else if (char === 'i') {\n return 'vowel';\n } else if (char === 'o') {\n return 'vowel';\n } else if (char === 'u') {\n return 'vowel';\n } else {\n return 'not vowel';\n }\n}", "title": "" }, { "docid": "2f7f59b66148a6b3bd008080dec70ec0", "score": "0.8080313", "text": "function isVowel(string) {\n\tvar character = string.toLowerCase();\n\tvar vowels = [\"a\",\"e\",\"i\",\"o\",\"u\"];\n\tif (vowels.includes(character)) {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t} \n}", "title": "" }, { "docid": "b68a19f11ae4264841f37b893fb53be8", "score": "0.8066368", "text": "function isVowel(char) {\n var result = '';\n //console.log('The Vowel is :', char);\n\n if (char == \"a\" || char == \"e\" || char == \"i\" || char == \"o\" || char == \"u\" || char == \"A\" || char == \"E\" || char == \"I\" || char == \"O\" || char == \"U\") {\n result = true;\n }\n else\n {\n result = false;\n }\n //console.log('Result is: ', result);\n return result;\n\n }", "title": "" }, { "docid": "f1bc3ae6eea6c0bc778cd32e95e927d0", "score": "0.805061", "text": "function isVowel(char){\n var vowels = \"a,e,i,o,u\";\n if (vowels.indexOf(char)> -1){\n return true;}\n else\n {\n return false;\n }\n }", "title": "" }, { "docid": "09d29d8e5269b12064b354845545c242", "score": "0.80354816", "text": "function isVowel(a) {\n if (a.length != 1) {\n console.log(\"must enter a string of length 1\");\n return false;\n } else {\n var vowels = ['a', 'e', 'i', 'o', 'u'];\n for (var x in vowels) {\n if (a === vowels[x]) {\n return true;\n } else { \n return false;\n }\n }\n }\n}", "title": "" }, { "docid": "90ff3349ea106ab4302be371f9e2f7c1", "score": "0.8028604", "text": "function isVowel(char){\n if (char === \"a\"|| char === \"e\"||char === \"i\"||char === \"o\"||char === \"u\"){\n return char + \" is a vowel\";\n } else if (char === \"y\") {\n return ( char + \" is sometimes a vowel\")\n }else {\n return (char + \" is not a vowel\");\n }\n}", "title": "" }, { "docid": "211388d15b5f21f576133ed7241d1aca", "score": "0.8002921", "text": "function isVowel(ch) {\n if (ch === 'a' || ch === 'e' || ch === 'i' || ch === 'o' || ch === 'u' || ch === 'A' || ch === 'E' || ch === 'I' || ch === 'O' || ch === 'U')\n return true;\n else\n return false;\n }", "title": "" }, { "docid": "9d6215072288dd01a44a5ae8cd8b5936", "score": "0.7989785", "text": "function isVowel(char){\n \"use strict\";\n var vowels = ['a', 'e', 'i', 'o', 'u'];\n if (vowels.indexOf(char) > -1) {\n return true;\n }\n else {\n return false;\n }\n\n\n}", "title": "" }, { "docid": "06dad55cd47814f62ebb9439cfeb4ea0", "score": "0.7938483", "text": "function isVowel(char){\n \"use strict\";\n var vowel = ['a', 'e', 'i', 'o', 'u', 'y'];\n if(vowel.indexOf(char) !== -1) {\n return true;\n }\n else{\n return false;\n }\n}", "title": "" }, { "docid": "d06d12606ee528f155b1f36518214f28", "score": "0.7906826", "text": "function vowel() {\n var vowel_string = \"aieouAIEOU\";\n input = prompt(\"Enter a character\");\n if (input.length == 1){\n if (vowel_string.contains(input)){\n alert(input + \" is a vowel\");\n }\n else {\n alert(\"Not a vowel\");\n }\n } \n}", "title": "" }, { "docid": "d056f71652577afea26567e2792194af", "score": "0.79061645", "text": "function isVowel (char, idx, s) {\n expect(s[idx]).toBe(char);\n\n return ~\"aeiouAEIOU\".indexOf(char);\n }", "title": "" }, { "docid": "b44f97394b6782722745b720a84cd5f2", "score": "0.79053277", "text": "function isVowel(character) { // function to check whether input character is a vowel\n const vowels = { 'a': true, 'e': true, 'i': true, 'o': true, 'u': true }; // use an object with vowels as keys\n\n return Boolean(vowels[character.toLocaleLowerCase()]);\n}", "title": "" }, { "docid": "34c951aa8d3dfe20ab3dbd17822546d6", "score": "0.7902537", "text": "function isVowel(char){\n var vowelsArray = [\n \"a\",\"e\",\"i\",\"o\",\"u\",\n \"A\",\"E\",\"I\",\"O\",\"U\"\n ];\n\n if(vowelsArray.indexOf(char) === -1){\n return false;\n } else{\n return true;\n }\n}", "title": "" }, { "docid": "2372b8fe413bcabd303d5789bd4f11c2", "score": "0.78949755", "text": "function isVowel(char){\n //...\n\n var vowel = [\"a\",\"e\",\"i\",\"o\",\"u\", \",\", \" \"]\n for(var i =0; i<vowel.length; i++)\n \n if (vowel[i] == char){\n \treturn true\n }else{\n \treturn false\n }\n}", "title": "" }, { "docid": "3c82937953418c0f84b528a9bb82ca40", "score": "0.789073", "text": "function isVowel (char) {\nvar vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"];\n for (var i = 0; i < vowels.length; i++) {\n if (char === vowels[i]) {\n return true;\n } else {\n return false;\n }\n }\n}", "title": "" }, { "docid": "325af53f4bb070ef7364d14028559ecc", "score": "0.7844035", "text": "function isVowel(letter) {\n var newLetter = letter.toString().toLowerCase()\n var vowels = \"aeiou\"\n\n return vowels.includes(newLetter)\n}", "title": "" }, { "docid": "705d17433497494dd3d26b66884adf05", "score": "0.7796621", "text": "function isCharAVowel(char){\n char = char.toLowerCase(); // <-- change to lowerCase\n return ('aeiouy'.indexOf(char) > -1); // <-- checking string 'aeiouy' for char passed in \n}", "title": "" }, { "docid": "24819c3880466574b81a494e6d408297", "score": "0.7786139", "text": "function isVowel(char){\n var vowels = [\"a\", \"e\" , \"i\" , \"o\" ,\"u\"];\n var isv = false;\n\n vowels.forEach(function(value){\n if (char === value){\n \tisv = true\n\n }\n});\n return isv; \n}", "title": "" }, { "docid": "1f8ebbdd3f6f91132fb2e435dfffc80c", "score": "0.7738298", "text": "function isVowel(s) {\n var arr = [\"a\",\"e\",\"i\",\"o\",\"u\",\"A\",\"E\",\"I\",\"O\",\"U\"];\n return arr.includes(s);\n}", "title": "" }, { "docid": "c0417a1c2c9eed64f861bc19061c963b", "score": "0.77353156", "text": "function isVowel(char){\n \"use strict\";\n\n var vowels = ['a', 'e', 'i', 'o', 'u'];\n for(var i = 0; i < vowels.length; i++){\n if(char === vowels[i]){\n return true;\n }\n }\n return false;\n}", "title": "" }, { "docid": "b0ab7e9b34fc57d81436f51ccf711476", "score": "0.7732962", "text": "function vowels(str) {\n if ((str.indexOf(\"a\") != -1) || (str.indexOf(\"e\") != -1) || (str.indexOf(\"i\") != -1) || (str.indexOf(\"o\") != -1) || (str.indexOf(\"u\") != -1)) {\n console.log(true);\n } else {\n console.log(false);\n }\n}", "title": "" }, { "docid": "c4f3a058aeb72f368499bd9b76b0680c", "score": "0.77325046", "text": "function isVowel(char){\n \"use strict\";\n\n var vowels = [\"a\", \"e\", \"i\", \"o\", \"u\", \" \"];\n\n for(var i = 0; i < vowels.length; i++){\n if(char === vowels[i]){\n return true;\n }\n }\n return false;\n}", "title": "" }, { "docid": "fb9aab62f52933997c23ddcfaf07a270", "score": "0.76203334", "text": "function isAVowel(letter) {\n let vowelState = false;\n if (letter == \"a\" || letter == \"i\" || letter == \"i\" || letter == \"o\" || letter == \"u\") {\n vowelState = true;\n }\n return vowelState;\n }", "title": "" }, { "docid": "54b1c7e5bab5912272998534e7db0a2e", "score": "0.75753564", "text": "function hasVowels(string){\n var strLow = string.toLowerCase();\n var counter = 0;\n for (var n = 0; n < strLow.length; n++){\n if(strLow[n] === \"a\" || strLow[n] ===\"e\" || strLow[n] === \"i\" || strLow[n] === \"o\" || strLow[n]=== \"u\") {\n counter++;\n }\n }\n if(counter > 0){\n return true;\n } else {\n return false;\n }\n}", "title": "" }, { "docid": "1d5cd78f88a1b570630ee1f4c86505d7", "score": "0.7504921", "text": "function isVowel(input){\r\n let vowel1 = ['A', 'E', 'I', 'O', 'U'];\r\n let vowel2 = ['a', 'e', 'i', 'o', 'u'];\r\n var res = vowel1.includes(input) || vowel2.includes(input) ;\r\n //document.getElementById(\"b4\").innerHTML = res;\r\n return res;\r\n }", "title": "" }, { "docid": "19e0529c4ca961609f9641dc88d5ff2b", "score": "0.74934006", "text": "function isCharacterAVowel(c) {\n\t// enter code here\n\n}", "title": "" }, { "docid": "5caf7d774b6f6f167a819ada6b8d5de5", "score": "0.74545705", "text": "function isVowel(char) {\n\n var vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"];\n return !!vowels.filter(function(vowel){\n return vowel === char;\n }).length;\n}", "title": "" }, { "docid": "3c035a177122900bdbfea1263ae89429", "score": "0.7449422", "text": "function isVowel(char){\n\n var vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"];\n for (var i = 0; i < vowels.length; i++) {\n if (vowels[i] === char) {\n return true; // can do true here because it's within the isVowel function\n }\n };\n return false;\n\n}", "title": "" }, { "docid": "6858670d08484ca350626c445982e356", "score": "0.74338204", "text": "function endsWithVowel(str){\n var lstLetter = str[str.length - 1];\n if(lstLetter === 'a' || lstLetter === 'e' || lstLetter === 'i' || lstLetter === 'o' || lstLetter === 'u') {\n return true;\n }\n return false;\n}", "title": "" }, { "docid": "761d6171eb08a38a4131dca606276e5d", "score": "0.7400002", "text": "function containsVowel(str, c){\r\tif(str.length === 0){\r\t\treturn 0;\r\t}\r\tif(str[0] === c) return 1\r\t\telse return containsVowel(str.slice(1), c);\r}", "title": "" }, { "docid": "be4e715c3ad4a39d517e5efeb6bb8f1d", "score": "0.7396522", "text": "function isCharacterAVowel(str)\r\n{\r\n if(str==\"a\" || str==\"e\" || str==\"i\" || str==\"o\" || str==\"u\")\r\n {\r\n return true;\r\n }\r\n else\r\n return false;\r\n}", "title": "" }, { "docid": "d4c2fada6b16f32fe324efdbf06a2f42", "score": "0.73445743", "text": "function isAVowel(char){\n const vowelList = [\"a\",\"e\",\"i\",\"o\",\"u\",'A','E','I','O','U'];\n for(letter of vowelList){\n if (letter === char.toLowerCase()){\n return true;\n }\n }\n return false;\n }", "title": "" }, { "docid": "b26cbe458f58055d7cd464d4314c23e9", "score": "0.7326326", "text": "function vowelCheck(c) {\n var result = \"AEIOUYaeiouy\".indexOf(c);\n if(result < 0)\n { \n return {isV:false,isC:false} \n }else{\n if(result < 6){\n return {isV:true,isC:true}\n }else{\n return {isV:true,isC:false}\n }\n } \n }", "title": "" }, { "docid": "5d7f634aa01702016d6f33b7149eabe5", "score": "0.731385", "text": "function isCharacterAVowel(character) {\n if(character == 'a' || character == 'A' || character == 'i'|| character == 'I'|| character == 'o'|| character == 'O'|| character == 'e'|| character == 'E'|| character == 'u'|| character == 'U')\n return true;\n else return false;\n }", "title": "" }, { "docid": "e5627677b24424615989dd303e43bae6", "score": "0.73120695", "text": "function startsAndEndsWithVowel(str){\n var fstLetter = str.charAt(0).toLowerCase();\n var lstLetter = str[str.length - 1];\n if((fstLetter === 'a' || fstLetter === 'e' || fstLetter === 'i' || fstLetter === 'o' || fstLetter === 'u') &&\n (lstLetter === 'a' || lstLetter === 'e' || lstLetter === 'i' || lstLetter === 'o' || lstLetter === 'u')) {\n return true;\n }\n return false;\n}", "title": "" }, { "docid": "78d187df4c3a1c2d5c482d8f03022bd0", "score": "0.7306245", "text": "function isCharAVowel(s) {\n if (s === 'a' || s === 'e' || s === 'i' || s === 'o' || s === 'u') {\n return true;\n }\n return false; \n}", "title": "" }, { "docid": "7138842444c6677c88e16f1b1f011889", "score": "0.72992235", "text": "function isCharacterAVowel(char) {\n let character = char;\n if (character === 'A' || character === 'E' || character === 'I' || character === 'O'|| character === 'U' ||\n character === 'a' || character === 'e' || character === 'i' || character === ''|| character === 'u') {\n return true;\n } else {\n return false;\n }\n}", "title": "" }, { "docid": "e11f6f43417d385a74eb52536df8e13f", "score": "0.7298165", "text": "function vowels(stg) {\n \n}", "title": "" }, { "docid": "da5884b5c812f04582786490ad1c17d8", "score": "0.7253957", "text": "function isCharacterAVowel(string) {\n let vowels = ['a', 'e', 'i', 'o', 'u', 'y'];\n for (let i = 0; i < vowels.length; i++) {\n const char = vowels[i];\n if (string === char) {\n return true;\n } else {\n return false;\n }\n }\n}", "title": "" }, { "docid": "241f313e07ffe56762665d61c3dfd5c6", "score": "0.72510654", "text": "function isAVowel(str) {\n // write a agrument for the length of the string and determine its a vowel\n let count = 0\n const vowels = \"abpurtRWKO\"\n for(var i = 0; i < str.length; i++){\n console.log(vowels.indexOf(str[i].toLowerCase()) > -1)\n }\n \n }", "title": "" }, { "docid": "f843aae71510c4925a6c9ee1bd28fbd4", "score": "0.7249599", "text": "function startsWithVowel(str) {\n var fstLetter = str.charAt(0).toLowerCase();\n if (fstLetter === 'a' || fstLetter === 'e' || fstLetter === 'i' || fstLetter === 'o' || fstLetter === 'u'){\n return true;\n }\n return false;\n}", "title": "" }, { "docid": "168b966d87e97426132fbb9e9deaa43e", "score": "0.72426534", "text": "function isCharacterAVowel(isLetter) {\n if (isLetter === 'a' || 'e' || 'i' || 'o' || 'u') {\n console.log(\"The Character is a vowel\");\n } else {\n console.log(\"This character is a consonant\");\n }\n\n}", "title": "" }, { "docid": "2ae392c54e5c70a1a4a4101af42af518", "score": "0.71775776", "text": "function isCharacterAVowel(letter) {\n\tvar vowels = [\"a\", \"e\", \"i\", \"o\",\"u\"]; \t\t\t//use array since it needs to go around it\n\t\tfor (var i = 0; i < vowels.length; i++){ \t//to loop in vowels\n\t\t\tif (letter == vowels[i]){ \t\t\t\t//to get value in vowels array\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n}", "title": "" }, { "docid": "fd05c199a38f2e61946e274d55446a27", "score": "0.7160831", "text": "function vowels(str){\n var matches;\n\n if (str && (matches = str.match( /[aeiou]/g))){\n return matches;\n }\n}", "title": "" }, { "docid": "f3732762fe54537add1aba7a6693292d", "score": "0.71275604", "text": "function matchStringVowel(theString) {\n //reg variable below finds/mathes a substring of length greater than 1 \n //that starts and ends with same character\n var reg = /(.).*\\1/; \n \n //-- using reg pattern literal\n //var myPattern = /(^[a,e,i,0,u]).*\\1/;\n //var re = myPattern.test('abcda');\n \n //--- using RegExp object literal\n var re = new RegExp('(^[a,e,i,0,u]).*\\\\1$');\n \n return re.test(theString);\n \n}", "title": "" }, { "docid": "da7e8a801312f603617528da27674f99", "score": "0.7045525", "text": "function isVowel(letter){\n var vowels = ['a','e','i','o','u','A','E','I','O','U']\n vowels.forEach(l => {\n if (letter == l){\n console.log(`${letter} is a vowel`);\n }\n });\n}", "title": "" }, { "docid": "5338066d96992e8151d531ed454e9c7a", "score": "0.698966", "text": "function wordStartsWithVowel(word) {\n //checks for vowel\n if (word.charAt(0) === \"a\" || word.charAt(0) === \"e\" || word.charAt(0) === \"i\" ||\n word.charAt(0) === \"o\" || word.charAt(0) === \"u\" ) {\n return(true);\n } else {\n return(false);\n }\n }", "title": "" }, { "docid": "22d2256718457aed8cc80930dedda20c", "score": "0.69895065", "text": "function vowel(str) {\n\t/*\n\t// turn the string into an array\n\tconst textArr = str.split(\"\");\n\n\t// filter them and return only if iteration matches a vowel\n\tconst filteredVowels = textArr.filter(char => {\n\t\tif (\n\t\t\tchar === \"a\" ||\n\t\t\tchar === \"e\" ||\n\t\t\tchar === \"i\" ||\n\t\t\tchar === \"o\" ||\n\t\t\tchar === \"u\"\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\t});\n\n\treturn filteredVowels.length;\n\t*/\n\n\t// Solution 2\n\t/*\n\tlet count = 0;\n\tconst vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"];\n\n\tfor (let char of str.toLowerCase()) {\n\t\tif (vowels.includes(char)) {\n\t\t\tcount++;\n\t\t}\n\t}\n\n\treturn count;\n\t*/\n\n\t// Solution 3\n\tconst matched = str.match(/[aeiou]/gi);\n\treturn matched ? matched.length : 0;\n}", "title": "" }, { "docid": "f6934af785aab40564b8e9e943b8368b", "score": "0.6983689", "text": "function containsVowel(words) {\n let vowels = ['a', 'e', 'i', 'o', 'u'];\n\n // 1. check each letter of the string \n for (let i = 0; i < words.length; i++) {\n // 2. check if current letter is one of the 'vowel' characters\n for (let j = 0; j < vowels.length; j++) {\n // 3. return true if we find one\n if (words[i] === vowels[j]) {\n return true;\n }\n }\n }\n\n return false;\n}", "title": "" }, { "docid": "78e33f235f1efa4ee0d2d1d67cfe76ce", "score": "0.6912332", "text": "function isVowel(oneChar) {\n var vowelArray = ['a', 'A', 'e', 'E', 'i', 'I', 'o', 'O', 'u', 'U'];\n\n if(vowelArray.indexOf(oneChar) !== -1);\n\n console.log(vowelArray.indexOf(oneChar));\n\n }", "title": "" }, { "docid": "ce23f822c0666991cb348ceed52f951e", "score": "0.6879655", "text": "function hasDoubleVowels2(str){\n \n if (str.toLowerCase().includes('aa') || str.toLowerCase().includes('ee') || str.toLowerCase().includes('ii') || str.toLowerCase().includes('oo') || str.toLowerCase().includes('uu')) {\n return str\n } else {\n return \"The input has no double vowels\" \n }\n}", "title": "" }, { "docid": "1f2db283ffc94bcd8a40e754d0b49670", "score": "0.685949", "text": "function vowelLinks(str) {\n\tlet strArr = str.toLowerCase().split(' ');\n\tlet isTrueArr = [];\n\tfor (let i = 0; i < strArr.length - 1; i++) {\n\t\tif (/(a|e|i|o|u)$/g.test(strArr[i]) && /^(a|e|i|o|u)/g.test(strArr[i + 1])) {\n\t\t\tisTrueArr.push(true)\n\t\t} else {\n\t\t\tisTrueArr.push(false)\n\t\t}\n\t}\n\treturn isTrueArr.includes(true);\n}", "title": "" }, { "docid": "c530579d5789e14616b63884a7d6e9ba", "score": "0.6857826", "text": "function startsWithVowel(_string) {\n var x = _string.charAt(0);\n return (\"aeéiouAEÉIOU\".indexOf(x) != -1); \n}", "title": "" }, { "docid": "c6cdf63a958fbdfac52bdfde771c6747", "score": "0.6857233", "text": "function checkForVowels(value) {\n const vowels = {\n a: 0,\n e: 0,\n i: 0,\n o: 0,\n u: 0\n }\n\n for (var character of value) {\n const formatted = character.toLowerCase()\n\n if (formatted in vowels) {\n vowels[formatted] += 1\n }\n\n if (vowels[character] > 1) {\n return false\n }\n }\n\n for (key in vowels) {\n if (vowels[key] != 1) return false\n }\n\n return true\n}", "title": "" }, { "docid": "3e497e25551a8bd4098beac1d401b391", "score": "0.6850123", "text": "function vowels(text) {\n var wordtext = text.match(/[aeiou]/gi).length;\n return \"There are \" + wordtext + \" vowels in this text area.\";\n }", "title": "" }, { "docid": "f9218083b835a494d654256ccaf39d47", "score": "0.6744751", "text": "function countVowels(string) {\n\tvar myCount = 0\n\tfor (var i = 0; i < string.length; i = i + 1) {\n\t\tif (string[i] === \"a\" || string[i] === \"e\" || string[i] === \"i\" || string[i] === \"o\" || string[i] === \"u\") {\n\t\t\tmyCount = myCount + 1\n\t\t}\n\t\treturn \"no vowels\"\n\t}\n\treturn myCount\n}", "title": "" }, { "docid": "4fd8caf02add6072a1f2c38545752f04", "score": "0.67112833", "text": "function vowels(str){\n var matches;\n\n if (str){\n // pull out all the vowels\n matches = str.match( /[aeiou]/g);\n\n if (matches) {\n return matches;\n }\n }\n}", "title": "" }, { "docid": "bf4b53a024b17398397aaca2ac42c4cf", "score": "0.669254", "text": "function checkVowel() {\n // Get the information from the INPUT.\n var text = document.querySelector(\".inputs\").value;\n\n var textLength = text.length;\n\n document.querySelector(\".inputs\").placeholder = \"Enter a piece of text\";\n\n // Logic for the Vowel Count.\n for (var i = 0; i < text.length; i++) {\n if (text.charAt(i) === \"a\") {\n vowelCount.push(1);\n } else if (text.charAt(i) === \"e\") {\n vowelCount.push(1);\n } else if (text.charAt(i) === \"i\") {\n vowelCount.push(1);\n } else if (text.charAt(i) === \"o\") {\n vowelCount.push(1);\n } else if (text.charAt(i) === \"u\") {\n vowelCount.push(1);\n } else if (text.charAt(i) === \"A\") {\n vowelCount.push(1);\n } else if (text.charAt(i) === \"E\") {\n vowelCount.push(1);\n } else if (text.charAt(i) === \"I\") {\n vowelCount.push(1);\n } else if (text.charAt(i) === \"O\") {\n vowelCount.push(1);\n } else if (text.charAt(i) === \"U\") {\n vowelCount.push(1);\n } else if (text.charAt(i) === \"á\") {\n vowelCount.push(1);\n } else if (text.charAt(i) === \"é\") {\n vowelCount.push(1);\n } else if (text.charAt(i) === \"í\") {\n vowelCount.push(1);\n } else if (text.charAt(i) === \"ó\") {\n vowelCount.push(1);\n } else if (text.charAt(i) === \"ú\") {\n vowelCount.push(1);\n }\n\n // Show the answer in an HTML.\n var h2 = document.querySelector(\".vowels\").innerHTML = \"There are \" + vowelCount.length + \" vowels in this text: \";\n var p = document.querySelector(\"h5\").innerHTML = text;\n // Reset everything to take another piece of text.\n document.querySelector(\"#placeH\").value = \"\";\n document.querySelector(\"#placeH\").placeholder;\n\n }\n}", "title": "" }, { "docid": "b0b46b02cca98468180388a972e02b7f", "score": "0.66886556", "text": "function vowels(str){\n const matches = str.match(/[aeiou]/gi)\n \n return matches ? matches.length : 0\n}", "title": "" }, { "docid": "57cafd42870f82c767a265540777fb05", "score": "0.66856116", "text": "function vowels(str){\n let matches = str.match(/[aeiou]/gi)\n\n return matches ? matches.length : 0\n}", "title": "" }, { "docid": "07bfe16abc242fc7dcae46fabcfb04c5", "score": "0.66747916", "text": "function vowelOrConsonant(letter) {\n\n switch(letter) {\n case 'a': console.log(\"It is a vowel\"); break;\n case 'e': console.log(\"It is a vowel\"); break;\n case 'i': console.log(\"It is a vowel\"); break;\n case 'o': console.log(\"It is a vowel\"); break;\n case 'u': console.log(\"It is a vowel\"); break;\n default: console.log(\"It is a consonant\"); break;\n }\n}", "title": "" }, { "docid": "e371c648fc1933b3a620d4863483b7bc", "score": "0.66440475", "text": "function itItNameCheck(name) {\n // true at the first occurence of a vowel\n var vowelflag = false; // true at the first occurence of an X AFTER vowel\n // (to properly handle last names with X as consonant)\n\n var xflag = false;\n\n for (var i = 0; i < 3; i++) {\n if (!vowelflag && /[AEIOU]/.test(name[i])) {\n vowelflag = true;\n } else if (!xflag && vowelflag && name[i] === 'X') {\n xflag = true;\n } else if (i > 0) {\n if (vowelflag && !xflag) {\n if (!/[AEIOU]/.test(name[i])) {\n return false;\n }\n }\n\n if (xflag) {\n if (!/X/.test(name[i])) {\n return false;\n }\n }\n }\n }\n\n return true;\n}", "title": "" }, { "docid": "703cec77aff8cc5d8bdd4c0f977c0451", "score": "0.6610425", "text": "function vowels(str) {\n //g means to keep going after first match\n //i means case insensitive\n //returns an array of matches or will return null\n const matches = str.match(/[aeiou]/gi);\n return matches ? matches.length: 0;\n}", "title": "" }, { "docid": "64c40cfe24ddc7187fc9ca03e425e3b0", "score": "0.6597438", "text": "function vowels(str) {\n //// the iterative solution\n // x = str.toLowerCase().split(\"\");\n // vowelArr = [];\n // for(i=0; i<x.length; i++) {\n // if (x[i] === 'a'||x[i] === 'e'||x[i] === 'i'||x[i] === 'o'||x[i] === 'u') {\n // vowelArr.push(x[i])\n // }\n // }\n\t// return vowelArr.length;\n\n //// the regex solution\n vowels = str.match(/[aeiou]/gi)\n if(vowels === null) {\n return 0\n } else {\n return vowels.length\n }\n}", "title": "" } ]
cb1c82eae2e10e6eed13cb582fa4aed3
START_DEBUG translate raw char position into line/column mapping
[ { "docid": "f70d14d3e8d33922cab70a8b1eae4d49", "score": "0.5830145", "text": "function lineCol(rawPos,fileID) {\n\t\trawPos = Math.max(0,rawPos);\n\t\tvar i, ret = { raw:rawPos, line:1, col:rawPos };\n\n\t\tfor (i=0; i<start_of_line_map[fileID].length; i++) {\n\t\t\tif (start_of_line_map[fileID][i] > rawPos) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tret.line = i + 1; // line numbers are 1-based\n\t\t\tret.col = rawPos - start_of_line_map[fileID][i];\n\t\t}\n\n\t\treturn ret;\n\t}", "title": "" } ]
[ { "docid": "23218730f42c093fc54b29793c977805", "score": "0.6841568", "text": "fixPos(event, index) {\n const text = event.raw.substr(0, index),\n arrLines = text.split(/\\r?\\n/),\n lineCount = arrLines.length - 1;\n let line = event.line,\n col;\n if (lineCount > 0) {\n line += lineCount;\n col = arrLines[lineCount].length + 1;\n } else {\n col = event.col + index;\n }\n return {\n line,\n col,\n };\n }", "title": "" }, { "docid": "33c4a4d2df5041f0f3b84fe844c35460", "score": "0.61498576", "text": "function getLineInfo(input,offset){for(var line=1,cur=0;;) {_whitespace.lineBreakG.lastIndex = cur;var match=_whitespace.lineBreakG.exec(input);if(match && match.index < offset){++line;cur = match.index + match[0].length;}else {return new Position(line,offset - cur);}}}", "title": "" }, { "docid": "bb742f0999a7ffdede988d6e9bdcd5f5", "score": "0.6133273", "text": "function getLocation(source, position) {\n let lastLineStart = 0;\n let line = 1;\n for (const match of source.body.matchAll(LineRegExp)) {\n typeof match.index === 'number' || (0, _invariant.invariant)(false);\n if (match.index >= position) {\n break;\n }\n lastLineStart = match.index + match[0].length;\n line += 1;\n }\n return {\n line,\n column: position + 1 - lastLineStart\n };\n}", "title": "" }, { "docid": "3f149053b7ac006b41ed8c4e3f33e4d7", "score": "0.6104204", "text": "function advancePositionWithMutation(pos,source,numberOfCharacters=source.length){let linesCount=0;let lastNewLinePos=-1;for(let i=0;i<numberOfCharacters;i++){if(source.charCodeAt(i)===10/* newline char code */){linesCount++;lastNewLinePos=i;}}pos.offset+=numberOfCharacters;pos.line+=linesCount;pos.column=lastNewLinePos===-1?pos.column+numberOfCharacters:numberOfCharacters-lastNewLinePos;return pos;}", "title": "" }, { "docid": "d74c7a650f90973432541aa0d49f67b6", "score": "0.60708123", "text": "function updatePosition(str) {\n var lines = str.match(/\\n/g);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf('\\n');\n column = ~i ? str.length - i : column + str.length;\n }", "title": "" }, { "docid": "d6b38a94deccfe1179e136292c6d4c4a", "score": "0.60704213", "text": "originalPositionFor(aArgs){const needle={generatedLine:util.getArg(aArgs,\"line\"),generatedColumn:util.getArg(aArgs,\"column\")};if(needle.generatedLine<1){throw new Error(\"Line numbers must be >= 1\");}if(needle.generatedColumn<0){throw new Error(\"Column numbers must be >= 0\");}let bias=util.getArg(aArgs,\"bias\",SourceMapConsumer.GREATEST_LOWER_BOUND);if(bias==null){bias=SourceMapConsumer.GREATEST_LOWER_BOUND;}let mapping;this._wasm.withMappingCallback(m=>mapping=m,()=>{this._wasm.exports.original_location_for(this._getMappingsPtr(),needle.generatedLine-1,needle.generatedColumn,bias);});if(mapping){if(mapping.generatedLine===needle.generatedLine){let source=util.getArg(mapping,\"source\",null);if(source!==null){source=this._sources.at(source);source=util.computeSourceURL(this.sourceRoot,source,this._sourceMapURL);}let name=util.getArg(mapping,\"name\",null);if(name!==null){name=this._names.at(name);}return {source,line:util.getArg(mapping,\"originalLine\",null),column:util.getArg(mapping,\"originalColumn\",null),name};}}return {source:null,line:null,column:null,name:null};}", "title": "" }, { "docid": "921974f8aed02e3287fa6bf6026c7edb", "score": "0.605389", "text": "function updatePosition(str) {\n var lines = str.match(/\\n/g);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf('\\n');\n column = ~i ? str.length - i : column + str.length;\n }", "title": "" }, { "docid": "921974f8aed02e3287fa6bf6026c7edb", "score": "0.605389", "text": "function updatePosition(str) {\n var lines = str.match(/\\n/g);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf('\\n');\n column = ~i ? str.length - i : column + str.length;\n }", "title": "" }, { "docid": "921974f8aed02e3287fa6bf6026c7edb", "score": "0.605389", "text": "function updatePosition(str) {\n var lines = str.match(/\\n/g);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf('\\n');\n column = ~i ? str.length - i : column + str.length;\n }", "title": "" }, { "docid": "921974f8aed02e3287fa6bf6026c7edb", "score": "0.605389", "text": "function updatePosition(str) {\n var lines = str.match(/\\n/g);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf('\\n');\n column = ~i ? str.length - i : column + str.length;\n }", "title": "" }, { "docid": "921974f8aed02e3287fa6bf6026c7edb", "score": "0.605389", "text": "function updatePosition(str) {\n var lines = str.match(/\\n/g);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf('\\n');\n column = ~i ? str.length - i : column + str.length;\n }", "title": "" }, { "docid": "921974f8aed02e3287fa6bf6026c7edb", "score": "0.605389", "text": "function updatePosition(str) {\n var lines = str.match(/\\n/g);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf('\\n');\n column = ~i ? str.length - i : column + str.length;\n }", "title": "" }, { "docid": "a3920bd16734aca8e369763c287aafa1", "score": "0.6043968", "text": "function updatePosition(str) {\n const lines = str.match(/\\n/g);\n if (lines) {\n lineno += lines.length;\n }\n let i = str.lastIndexOf('\\n');\n column = i === -1 ? column + str.length : str.length - i;\n }", "title": "" }, { "docid": "ec0931a24db8a5497e1d3de18340953f", "score": "0.6001454", "text": "set startCharIdx(value) {}", "title": "" }, { "docid": "ef8663df8a808ba44e4ecea92c483eb6", "score": "0.59990734", "text": "function convertStringPosToLineColumn(source, position) {\n var LINE_REGEX = /(^)[\\S\\s]/gm;\n var line = 0;\n var column = 0;\n var lastPosition = 0;\n var match = LINE_REGEX.exec(source);\n while (match) {\n if (match.index > position) {\n column = position - lastPosition;\n break;\n }\n lastPosition = match.index;\n line++;\n match = LINE_REGEX.exec(source);\n }\n return {\n line: line,\n column: column,\n };\n }", "title": "" }, { "docid": "9030912fbdcf83f55bd6d53d366cecbb", "score": "0.59977657", "text": "function getLocation(source, position) {\n\t var lineRegexp = /\\r\\n|[\\n\\r]/g;\n\t var line = 1;\n\t var column = position + 1;\n\t var match = void 0;\n\t while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n\t line += 1;\n\t column = position + 1 - (match.index + match[0].length);\n\t }\n\t return { line: line, column: column };\n\t}", "title": "" }, { "docid": "9030912fbdcf83f55bd6d53d366cecbb", "score": "0.59977657", "text": "function getLocation(source, position) {\n\t var lineRegexp = /\\r\\n|[\\n\\r]/g;\n\t var line = 1;\n\t var column = position + 1;\n\t var match = void 0;\n\t while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n\t line += 1;\n\t column = position + 1 - (match.index + match[0].length);\n\t }\n\t return { line: line, column: column };\n\t}", "title": "" }, { "docid": "16211b18a7e383c7d3f36b7c3c0ae4af", "score": "0.5980821", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match = void 0;\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n return { line: line, column: column };\n}", "title": "" }, { "docid": "16211b18a7e383c7d3f36b7c3c0ae4af", "score": "0.5980821", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match = void 0;\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n return { line: line, column: column };\n}", "title": "" }, { "docid": "16211b18a7e383c7d3f36b7c3c0ae4af", "score": "0.5980821", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match = void 0;\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n return { line: line, column: column };\n}", "title": "" }, { "docid": "16211b18a7e383c7d3f36b7c3c0ae4af", "score": "0.5980821", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match = void 0;\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n return { line: line, column: column };\n}", "title": "" }, { "docid": "16211b18a7e383c7d3f36b7c3c0ae4af", "score": "0.5980821", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match = void 0;\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n return { line: line, column: column };\n}", "title": "" }, { "docid": "16211b18a7e383c7d3f36b7c3c0ae4af", "score": "0.5980821", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match = void 0;\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n return { line: line, column: column };\n}", "title": "" }, { "docid": "16211b18a7e383c7d3f36b7c3c0ae4af", "score": "0.5980821", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match = void 0;\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n return { line: line, column: column };\n}", "title": "" }, { "docid": "16211b18a7e383c7d3f36b7c3c0ae4af", "score": "0.5980821", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match = void 0;\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n return { line: line, column: column };\n}", "title": "" }, { "docid": "16211b18a7e383c7d3f36b7c3c0ae4af", "score": "0.5980821", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match = void 0;\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n return { line: line, column: column };\n}", "title": "" }, { "docid": "cb3ac3b3ff2d1770712df7a231008371", "score": "0.5978444", "text": "function getLocation(source, position) {\n\t var lineRegexp = /\\r\\n|[\\n\\r]/g;\n\t var line = 1;\n\t var column = position + 1;\n\t var match = undefined;\n\t while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n\t line += 1;\n\t column = position + 1 - (match.index + match[0].length);\n\t }\n\t return { line: line, column: column };\n\t}", "title": "" }, { "docid": "bf8a3d197070834280b58050a8a01878", "score": "0.59473324", "text": "generatedPositionFor(aArgs){let source=util.getArg(aArgs,\"source\");source=this._findSourceIndex(source);if(source<0){return {line:null,column:null,lastColumn:null};}const needle={source,originalLine:util.getArg(aArgs,\"line\"),originalColumn:util.getArg(aArgs,\"column\")};if(needle.originalLine<1){throw new Error(\"Line numbers must be >= 1\");}if(needle.originalColumn<0){throw new Error(\"Column numbers must be >= 0\");}let bias=util.getArg(aArgs,\"bias\",SourceMapConsumer.GREATEST_LOWER_BOUND);if(bias==null){bias=SourceMapConsumer.GREATEST_LOWER_BOUND;}let mapping;this._wasm.withMappingCallback(m=>mapping=m,()=>{this._wasm.exports.generated_location_for(this._getMappingsPtr(),needle.source,needle.originalLine-1,needle.originalColumn,bias);});if(mapping){if(mapping.source===needle.source){let lastColumn=mapping.lastGeneratedColumn;if(this._computedColumnSpans&&lastColumn===null){lastColumn=Infinity;}return {line:util.getArg(mapping,\"generatedLine\",null),column:util.getArg(mapping,\"generatedColumn\",null),lastColumn};}}return {line:null,column:null,lastColumn:null};}", "title": "" }, { "docid": "0dbd929e0ea0ba500f9de01652a517a0", "score": "0.591884", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match;\n\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n\n return {\n line: line,\n column: column\n };\n}", "title": "" }, { "docid": "0dbd929e0ea0ba500f9de01652a517a0", "score": "0.591884", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match;\n\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n\n return {\n line: line,\n column: column\n };\n}", "title": "" }, { "docid": "0dbd929e0ea0ba500f9de01652a517a0", "score": "0.591884", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match;\n\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n\n return {\n line: line,\n column: column\n };\n}", "title": "" }, { "docid": "0dbd929e0ea0ba500f9de01652a517a0", "score": "0.591884", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match;\n\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n\n return {\n line: line,\n column: column\n };\n}", "title": "" }, { "docid": "0dbd929e0ea0ba500f9de01652a517a0", "score": "0.591884", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match;\n\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n\n return {\n line: line,\n column: column\n };\n}", "title": "" }, { "docid": "0dbd929e0ea0ba500f9de01652a517a0", "score": "0.591884", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match;\n\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n\n return {\n line: line,\n column: column\n };\n}", "title": "" }, { "docid": "0dbd929e0ea0ba500f9de01652a517a0", "score": "0.591884", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match;\n\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n\n return {\n line: line,\n column: column\n };\n}", "title": "" }, { "docid": "0dbd929e0ea0ba500f9de01652a517a0", "score": "0.591884", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match;\n\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n\n return {\n line: line,\n column: column\n };\n}", "title": "" }, { "docid": "0dbd929e0ea0ba500f9de01652a517a0", "score": "0.591884", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match;\n\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n\n return {\n line: line,\n column: column\n };\n}", "title": "" }, { "docid": "0dbd929e0ea0ba500f9de01652a517a0", "score": "0.591884", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match;\n\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n\n return {\n line: line,\n column: column\n };\n}", "title": "" }, { "docid": "0dbd929e0ea0ba500f9de01652a517a0", "score": "0.591884", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match;\n\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n\n return {\n line: line,\n column: column\n };\n}", "title": "" }, { "docid": "0dbd929e0ea0ba500f9de01652a517a0", "score": "0.591884", "text": "function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match;\n\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n\n return {\n line: line,\n column: column\n };\n}", "title": "" }, { "docid": "943f60d26e9036f12e40dc6e516ecf25", "score": "0.58967936", "text": "function Oc(e,t,n){return{line:e,column:t,offset:n}}", "title": "" }, { "docid": "d1d00e87328d5734081d6159ae184359", "score": "0.5857266", "text": "function cursorToPositionString(row, col) {\n return csi + row + \";\" + col + \"H\"\n}", "title": "" }, { "docid": "87175d6c7cc6d93a2ee0cd4a20f520a5", "score": "0.5836657", "text": "function test() {\n var result = pos({})\n\n line = current.line\n column = current.column\n value = subvalue + value\n\n return result.position\n }", "title": "" }, { "docid": "87175d6c7cc6d93a2ee0cd4a20f520a5", "score": "0.5836657", "text": "function test() {\n var result = pos({})\n\n line = current.line\n column = current.column\n value = subvalue + value\n\n return result.position\n }", "title": "" }, { "docid": "87175d6c7cc6d93a2ee0cd4a20f520a5", "score": "0.5836657", "text": "function test() {\n var result = pos({})\n\n line = current.line\n column = current.column\n value = subvalue + value\n\n return result.position\n }", "title": "" }, { "docid": "24fe57298615ccc4f60fe20b1a0d9c55", "score": "0.57824516", "text": "function parsePosition(raw) {\n if (sysTypes_1.isNumber(raw)) {\n return new vscode_1.Position(raw, 0);\n }\n\n if (raw === '') {\n return new vscode_1.Position(0, 0);\n }\n\n const parts = raw.split(':');\n\n if (parts.length > 2) {\n throw new Error(`invalid position ${raw}`);\n }\n\n let line = 0;\n\n if (parts[0] !== '') {\n if (!/^\\d+$/.test(parts[0])) {\n throw new Error(`invalid position ${raw}`);\n }\n\n line = +parts[0];\n }\n\n let col = 0;\n\n if (parts.length === 2 && parts[1] !== '') {\n if (!/^\\d+$/.test(parts[1])) {\n throw new Error(`invalid position ${raw}`);\n }\n\n col = +parts[1];\n }\n\n return new vscode_1.Position(line, col);\n}", "title": "" }, { "docid": "a586c87d2005f98800025b87fe82f035", "score": "0.5756483", "text": "function getPosition(opt) {\n let { line, linenr, colnr } = opt;\n let part = string_1.byteSlice(line, 0, colnr - 1);\n return {\n line: linenr - 1,\n character: part.length\n };\n}", "title": "" }, { "docid": "1b1b75ad0a7f3f4615491c7570b34a67", "score": "0.57510567", "text": "function updatePosition(str, ctx) {\n var lines = str.match(newlinere);\n ctx.lineNumber += lines ? lines.length : 0;\n var i = str.lastIndexOf(\"\\n\");\n ctx.columnNumber = str.length + (~i ? (-1 * i) : ctx.columnNumber);\n }", "title": "" }, { "docid": "15cbf2ffde96390e3545feeb2f6cc928", "score": "0.56941324", "text": "function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) {\n let linesCount = 0;\n let lastNewLinePos = -1;\n\n for (let i = 0; i < numberOfCharacters; i++) {\n if (source.charCodeAt(i) === 10\n /* newline char code */\n ) {\n linesCount++;\n lastNewLinePos = i;\n }\n }\n\n pos.offset += numberOfCharacters;\n pos.line += linesCount;\n pos.column = lastNewLinePos === -1 ? pos.column + numberOfCharacters : numberOfCharacters - lastNewLinePos;\n return pos;\n}", "title": "" }, { "docid": "6fe07ee0faa2d3d94674c9829b1cf336", "score": "0.56607974", "text": "function getLineInfo(input, offset) {\n\t for (var line = 1, cur = 0;;) {\n\t lineBreakG.lastIndex = cur\n\t var match = lineBreakG.exec(input)\n\t if (match && match.index < offset) {\n\t ++line\n\t cur = match.index + match[0].length\n\t } else {\n\t return new Position(line, offset - cur)\n\t }\n\t }\n\t }", "title": "" }, { "docid": "dba2a973ea36469640b7b7d67ca479df", "score": "0.5654013", "text": "get startCharIdx() {}", "title": "" }, { "docid": "43aba98b5e58bd0c73d1c118d6e119e3", "score": "0.5638956", "text": "originalPositionFor(aArgs) {\n const needle = {\n generatedLine: util.getArg(aArgs, \"line\"),\n generatedColumn: util.getArg(aArgs, \"column\")\n };\n\n if (needle.generatedLine < 1) {\n throw new Error(\"Line numbers must be >= 1\");\n }\n\n if (needle.generatedColumn < 0) {\n throw new Error(\"Column numbers must be >= 0\");\n }\n\n let bias = util.getArg(aArgs, \"bias\", SourceMapConsumer.GREATEST_LOWER_BOUND);\n if (bias == null) {\n bias = SourceMapConsumer.GREATEST_LOWER_BOUND;\n }\n\n let mapping;\n this._wasm.withMappingCallback(m => mapping = m, () => {\n this._wasm.exports.original_location_for(\n this._getMappingsPtr(),\n needle.generatedLine - 1,\n needle.generatedColumn,\n bias\n );\n });\n\n if (mapping) {\n if (mapping.generatedLine === needle.generatedLine) {\n let source = util.getArg(mapping, \"source\", null);\n if (source !== null) {\n source = this._sources.at(source);\n source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);\n }\n\n let name = util.getArg(mapping, \"name\", null);\n if (name !== null) {\n name = this._names.at(name);\n }\n\n return {\n source,\n line: util.getArg(mapping, \"originalLine\", null),\n column: util.getArg(mapping, \"originalColumn\", null),\n name\n };\n }\n }\n\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n }", "title": "" }, { "docid": "0a8d2af1748dec626814ede91e28dd0e", "score": "0.56373566", "text": "static normalizeOffset(src, offset) {\n const ch = src[offset];\n return !ch ? offset : ch !== '\\n' && src[offset - 1] === '\\n' ? offset - 1 : Node.endOfWhiteSpace(src, offset);\n }", "title": "" }, { "docid": "0a8d2af1748dec626814ede91e28dd0e", "score": "0.56373566", "text": "static normalizeOffset(src, offset) {\n const ch = src[offset];\n return !ch ? offset : ch !== '\\n' && src[offset - 1] === '\\n' ? offset - 1 : Node.endOfWhiteSpace(src, offset);\n }", "title": "" }, { "docid": "0a8d2af1748dec626814ede91e28dd0e", "score": "0.56373566", "text": "static normalizeOffset(src, offset) {\n const ch = src[offset];\n return !ch ? offset : ch !== '\\n' && src[offset - 1] === '\\n' ? offset - 1 : Node.endOfWhiteSpace(src, offset);\n }", "title": "" }, { "docid": "0a8d2af1748dec626814ede91e28dd0e", "score": "0.56373566", "text": "static normalizeOffset(src, offset) {\n const ch = src[offset];\n return !ch ? offset : ch !== '\\n' && src[offset - 1] === '\\n' ? offset - 1 : Node.endOfWhiteSpace(src, offset);\n }", "title": "" }, { "docid": "849141ac0cdb5bb56c516cda820675b9", "score": "0.56371105", "text": "generatedPositionFor(aArgs) {\n let source = util.getArg(aArgs, \"source\");\n source = this._findSourceIndex(source);\n if (source < 0) {\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n }\n\n const needle = {\n source,\n originalLine: util.getArg(aArgs, \"line\"),\n originalColumn: util.getArg(aArgs, \"column\")\n };\n\n if (needle.originalLine < 1) {\n throw new Error(\"Line numbers must be >= 1\");\n }\n\n if (needle.originalColumn < 0) {\n throw new Error(\"Column numbers must be >= 0\");\n }\n\n let bias = util.getArg(aArgs, \"bias\", SourceMapConsumer.GREATEST_LOWER_BOUND);\n if (bias == null) {\n bias = SourceMapConsumer.GREATEST_LOWER_BOUND;\n }\n\n let mapping;\n this._wasm.withMappingCallback(m => mapping = m, () => {\n this._wasm.exports.generated_location_for(\n this._getMappingsPtr(),\n needle.source,\n needle.originalLine - 1,\n needle.originalColumn,\n bias\n );\n });\n\n if (mapping) {\n if (mapping.source === needle.source) {\n let lastColumn = mapping.lastGeneratedColumn;\n if (this._computedColumnSpans && lastColumn === null) {\n lastColumn = Infinity;\n }\n return {\n line: util.getArg(mapping, \"generatedLine\", null),\n column: util.getArg(mapping, \"generatedColumn\", null),\n lastColumn,\n };\n }\n }\n\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n }", "title": "" }, { "docid": "be6f503fdb68db3ae4dc626bb1ce809c", "score": "0.5635051", "text": "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur);\n }\n }\n }", "title": "" }, { "docid": "16874f46beb5e4ec6ac25efd4e7bc293", "score": "0.56194234", "text": "function test() {\n var result = pos({});\n\n line = current.line;\n column = current.column;\n value = subvalue + value;\n\n return result.position\n }", "title": "" }, { "docid": "5f01b952853aaf3c6500408df7d79322", "score": "0.5614258", "text": "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur\n var match = lineBreakG.exec(input)\n if (match && match.index < offset) {\n ++line\n cur = match.index + match[0].length\n } else {\n return new Position(line, offset - cur)\n }\n }\n }", "title": "" }, { "docid": "5f01b952853aaf3c6500408df7d79322", "score": "0.5614258", "text": "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur\n var match = lineBreakG.exec(input)\n if (match && match.index < offset) {\n ++line\n cur = match.index + match[0].length\n } else {\n return new Position(line, offset - cur)\n }\n }\n }", "title": "" }, { "docid": "5f01b952853aaf3c6500408df7d79322", "score": "0.5614258", "text": "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur\n var match = lineBreakG.exec(input)\n if (match && match.index < offset) {\n ++line\n cur = match.index + match[0].length\n } else {\n return new Position(line, offset - cur)\n }\n }\n }", "title": "" }, { "docid": "ad429d7df0ee3f375bc469ec2c1a9169", "score": "0.5605716", "text": "function test() {\n var result = pos({});\n\n line = current.line;\n column = current.column;\n value = subvalue + value;\n\n return result.position\n }", "title": "" }, { "docid": "f75d1b3148b09d28df13c6ba82c59008", "score": "0.56001824", "text": "_toPosition(position) {\n return {\n line: position.line,\n column: position.ch\n };\n }", "title": "" }, { "docid": "77bcfbc4c460d943c6d8c258b30aab23", "score": "0.559786", "text": "function updatePosition(subvalue) {\n var lastIndex = -1\n var index = subvalue.indexOf('\\n')\n\n while (index !== -1) {\n line++\n lastIndex = index\n index = subvalue.indexOf('\\n', index + 1)\n }\n\n if (lastIndex === -1) {\n column += subvalue.length\n } else {\n column = subvalue.length - lastIndex\n }\n\n if (line in offset) {\n if (lastIndex !== -1) {\n column += offset[line]\n } else if (column <= offset[line]) {\n column = offset[line] + 1\n }\n }\n }", "title": "" }, { "docid": "77bcfbc4c460d943c6d8c258b30aab23", "score": "0.559786", "text": "function updatePosition(subvalue) {\n var lastIndex = -1\n var index = subvalue.indexOf('\\n')\n\n while (index !== -1) {\n line++\n lastIndex = index\n index = subvalue.indexOf('\\n', index + 1)\n }\n\n if (lastIndex === -1) {\n column += subvalue.length\n } else {\n column = subvalue.length - lastIndex\n }\n\n if (line in offset) {\n if (lastIndex !== -1) {\n column += offset[line]\n } else if (column <= offset[line]) {\n column = offset[line] + 1\n }\n }\n }", "title": "" }, { "docid": "77bcfbc4c460d943c6d8c258b30aab23", "score": "0.559786", "text": "function updatePosition(subvalue) {\n var lastIndex = -1\n var index = subvalue.indexOf('\\n')\n\n while (index !== -1) {\n line++\n lastIndex = index\n index = subvalue.indexOf('\\n', index + 1)\n }\n\n if (lastIndex === -1) {\n column += subvalue.length\n } else {\n column = subvalue.length - lastIndex\n }\n\n if (line in offset) {\n if (lastIndex !== -1) {\n column += offset[line]\n } else if (column <= offset[line]) {\n column = offset[line] + 1\n }\n }\n }", "title": "" }, { "docid": "75d22390328beffa7d99705630e075ab", "score": "0.5591474", "text": "function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) {\r\n let linesCount = 0;\r\n let lastNewLinePos = -1;\r\n for (let i = 0; i < numberOfCharacters; i++) {\r\n if (source.charCodeAt(i) === 10 /* newline char code */) {\r\n linesCount++;\r\n lastNewLinePos = i;\r\n }\r\n }\r\n pos.offset += numberOfCharacters;\r\n pos.line += linesCount;\r\n pos.column =\r\n lastNewLinePos === -1\r\n ? pos.column + numberOfCharacters\r\n : numberOfCharacters - lastNewLinePos;\r\n return pos;\r\n}", "title": "" }, { "docid": "1c35893556e3cc731f6c50bb3bb180c9", "score": "0.5584286", "text": "function updatePosition(subvalue) {\n var lastIndex = -1;\n var index = subvalue.indexOf('\\n');\n\n while (index !== -1) {\n line++;\n lastIndex = index;\n index = subvalue.indexOf('\\n', index + 1);\n }\n\n if (lastIndex === -1) {\n column += subvalue.length;\n } else {\n column = subvalue.length - lastIndex;\n }\n\n if (line in offset) {\n if (lastIndex !== -1) {\n column += offset[line];\n } else if (column <= offset[line]) {\n column = offset[line] + 1;\n }\n }\n }", "title": "" }, { "docid": "9602565925c6e3a17979f92287cac25d", "score": "0.55808836", "text": "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n }", "title": "" }, { "docid": "9602565925c6e3a17979f92287cac25d", "score": "0.55808836", "text": "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n }", "title": "" }, { "docid": "9602565925c6e3a17979f92287cac25d", "score": "0.55808836", "text": "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n }", "title": "" }, { "docid": "9602565925c6e3a17979f92287cac25d", "score": "0.55808836", "text": "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n }", "title": "" }, { "docid": "7c5ce7c724f578be4bb56d8d818098ee", "score": "0.55793387", "text": "getPositionAt(offset) {\n const { ch, line } = this.doc.posFromIndex(offset);\n return { line, column: ch };\n }", "title": "" }, { "docid": "21cc00f81580c70dee21d02df19d501f", "score": "0.5575194", "text": "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur);\n }\n } // istanbul ignore next\n\n\n throw new Error(\"Unreachable\");\n}", "title": "" }, { "docid": "a796abd7e6b9c1008b6ad6c6248b9fe1", "score": "0.55709326", "text": "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur);\n }\n }\n }", "title": "" }, { "docid": "c9e86659efd651a88779e52a6ee7ea49", "score": "0.5565335", "text": "function getLineInfo(input, offset) {\n\t\t for (var line = 1, cur = 0;;) {\n\t\t _whitespace.lineBreakG.lastIndex = cur;\n\t\t var match = _whitespace.lineBreakG.exec(input);\n\t\t if (match && match.index < offset) {\n\t\t ++line;\n\t\t cur = match.index + match[0].length;\n\t\t } else {\n\t\t return new Position(line, offset - cur);\n\t\t }\n\t\t }\n\t\t}", "title": "" }, { "docid": "c9e86659efd651a88779e52a6ee7ea49", "score": "0.5565335", "text": "function getLineInfo(input, offset) {\n\t\t for (var line = 1, cur = 0;;) {\n\t\t _whitespace.lineBreakG.lastIndex = cur;\n\t\t var match = _whitespace.lineBreakG.exec(input);\n\t\t if (match && match.index < offset) {\n\t\t ++line;\n\t\t cur = match.index + match[0].length;\n\t\t } else {\n\t\t return new Position(line, offset - cur);\n\t\t }\n\t\t }\n\t\t}", "title": "" }, { "docid": "57861237a3572cf870b0021810eb3136", "score": "0.5559546", "text": "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur\n var match = lineBreakG.exec(input)\n if (match && match.index < offset) {\n ++line\n cur = match.index + match[0].length\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "title": "" }, { "docid": "57861237a3572cf870b0021810eb3136", "score": "0.5559546", "text": "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur\n var match = lineBreakG.exec(input)\n if (match && match.index < offset) {\n ++line\n cur = match.index + match[0].length\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "title": "" }, { "docid": "57861237a3572cf870b0021810eb3136", "score": "0.5559546", "text": "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur\n var match = lineBreakG.exec(input)\n if (match && match.index < offset) {\n ++line\n cur = match.index + match[0].length\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "title": "" }, { "docid": "57861237a3572cf870b0021810eb3136", "score": "0.5559546", "text": "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur\n var match = lineBreakG.exec(input)\n if (match && match.index < offset) {\n ++line\n cur = match.index + match[0].length\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "title": "" }, { "docid": "57861237a3572cf870b0021810eb3136", "score": "0.5559546", "text": "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur\n var match = lineBreakG.exec(input)\n if (match && match.index < offset) {\n ++line\n cur = match.index + match[0].length\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "title": "" }, { "docid": "57861237a3572cf870b0021810eb3136", "score": "0.5559546", "text": "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur\n var match = lineBreakG.exec(input)\n if (match && match.index < offset) {\n ++line\n cur = match.index + match[0].length\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "title": "" }, { "docid": "cc0fc15aae3a02dff3697a3086faeff9", "score": "0.5557416", "text": "function updatePosition(subvalue) {\n var lastIndex = -1;\n var index = subvalue.indexOf('\\n');\n\n while (index !== -1) {\n line++;\n lastIndex = index;\n index = subvalue.indexOf('\\n', index + 1);\n }\n\n if (lastIndex === -1) {\n column += subvalue.length;\n } else {\n column = subvalue.length - lastIndex;\n }\n\n if (line in offset) {\n if (lastIndex !== -1) {\n column += offset[line];\n } else if (column <= offset[line]) {\n column = offset[line] + 1;\n }\n }\n }", "title": "" }, { "docid": "cc0fc15aae3a02dff3697a3086faeff9", "score": "0.5557416", "text": "function updatePosition(subvalue) {\n var lastIndex = -1;\n var index = subvalue.indexOf('\\n');\n\n while (index !== -1) {\n line++;\n lastIndex = index;\n index = subvalue.indexOf('\\n', index + 1);\n }\n\n if (lastIndex === -1) {\n column += subvalue.length;\n } else {\n column = subvalue.length - lastIndex;\n }\n\n if (line in offset) {\n if (lastIndex !== -1) {\n column += offset[line];\n } else if (column <= offset[line]) {\n column = offset[line] + 1;\n }\n }\n }", "title": "" }, { "docid": "cc0fc15aae3a02dff3697a3086faeff9", "score": "0.5557416", "text": "function updatePosition(subvalue) {\n var lastIndex = -1;\n var index = subvalue.indexOf('\\n');\n\n while (index !== -1) {\n line++;\n lastIndex = index;\n index = subvalue.indexOf('\\n', index + 1);\n }\n\n if (lastIndex === -1) {\n column += subvalue.length;\n } else {\n column = subvalue.length - lastIndex;\n }\n\n if (line in offset) {\n if (lastIndex !== -1) {\n column += offset[line];\n } else if (column <= offset[line]) {\n column = offset[line] + 1;\n }\n }\n }", "title": "" }, { "docid": "cc0fc15aae3a02dff3697a3086faeff9", "score": "0.5557416", "text": "function updatePosition(subvalue) {\n var lastIndex = -1;\n var index = subvalue.indexOf('\\n');\n\n while (index !== -1) {\n line++;\n lastIndex = index;\n index = subvalue.indexOf('\\n', index + 1);\n }\n\n if (lastIndex === -1) {\n column += subvalue.length;\n } else {\n column = subvalue.length - lastIndex;\n }\n\n if (line in offset) {\n if (lastIndex !== -1) {\n column += offset[line];\n } else if (column <= offset[line]) {\n column = offset[line] + 1;\n }\n }\n }", "title": "" }, { "docid": "cc0fc15aae3a02dff3697a3086faeff9", "score": "0.5557416", "text": "function updatePosition(subvalue) {\n var lastIndex = -1;\n var index = subvalue.indexOf('\\n');\n\n while (index !== -1) {\n line++;\n lastIndex = index;\n index = subvalue.indexOf('\\n', index + 1);\n }\n\n if (lastIndex === -1) {\n column += subvalue.length;\n } else {\n column = subvalue.length - lastIndex;\n }\n\n if (line in offset) {\n if (lastIndex !== -1) {\n column += offset[line];\n } else if (column <= offset[line]) {\n column = offset[line] + 1;\n }\n }\n }", "title": "" }, { "docid": "cc0fc15aae3a02dff3697a3086faeff9", "score": "0.5557416", "text": "function updatePosition(subvalue) {\n var lastIndex = -1;\n var index = subvalue.indexOf('\\n');\n\n while (index !== -1) {\n line++;\n lastIndex = index;\n index = subvalue.indexOf('\\n', index + 1);\n }\n\n if (lastIndex === -1) {\n column += subvalue.length;\n } else {\n column = subvalue.length - lastIndex;\n }\n\n if (line in offset) {\n if (lastIndex !== -1) {\n column += offset[line];\n } else if (column <= offset[line]) {\n column = offset[line] + 1;\n }\n }\n }", "title": "" }, { "docid": "cc0fc15aae3a02dff3697a3086faeff9", "score": "0.5557416", "text": "function updatePosition(subvalue) {\n var lastIndex = -1;\n var index = subvalue.indexOf('\\n');\n\n while (index !== -1) {\n line++;\n lastIndex = index;\n index = subvalue.indexOf('\\n', index + 1);\n }\n\n if (lastIndex === -1) {\n column += subvalue.length;\n } else {\n column = subvalue.length - lastIndex;\n }\n\n if (line in offset) {\n if (lastIndex !== -1) {\n column += offset[line];\n } else if (column <= offset[line]) {\n column = offset[line] + 1;\n }\n }\n }", "title": "" }, { "docid": "8d707bd359b1c4cf538ba0d31c394f2c", "score": "0.55543274", "text": "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0; ; ) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur);\n }\n }\n }", "title": "" }, { "docid": "38f9706026141ef176ea0efe31f2ce14", "score": "0.555052", "text": "toStringWithSourceMap(aArgs) {\n const generated = {\n code: \"\",\n line: 1,\n column: 0\n };\n const map = new SourceMapGenerator(aArgs);\n let sourceMappingActive = false;\n let lastOriginalSource = null;\n let lastOriginalLine = null;\n let lastOriginalColumn = null;\n let lastOriginalName = null;\n this.walk(function(chunk, original) {\n generated.code += chunk;\n if (original.source !== null\n && original.line !== null\n && original.column !== null) {\n if (lastOriginalSource !== original.source\n || lastOriginalLine !== original.line\n || lastOriginalColumn !== original.column\n || lastOriginalName !== original.name) {\n map.addMapping({\n source: original.source,\n original: {\n line: original.line,\n column: original.column\n },\n generated: {\n line: generated.line,\n column: generated.column\n },\n name: original.name\n });\n }\n lastOriginalSource = original.source;\n lastOriginalLine = original.line;\n lastOriginalColumn = original.column;\n lastOriginalName = original.name;\n sourceMappingActive = true;\n } else if (sourceMappingActive) {\n map.addMapping({\n generated: {\n line: generated.line,\n column: generated.column\n }\n });\n lastOriginalSource = null;\n sourceMappingActive = false;\n }\n for (let idx = 0, length = chunk.length; idx < length; idx++) {\n if (chunk.charCodeAt(idx) === NEWLINE_CODE) {\n generated.line++;\n generated.column = 0;\n // Mappings end at eol\n if (idx + 1 === length) {\n lastOriginalSource = null;\n sourceMappingActive = false;\n } else if (sourceMappingActive) {\n map.addMapping({\n source: original.source,\n original: {\n line: original.line,\n column: original.column\n },\n generated: {\n line: generated.line,\n column: generated.column\n },\n name: original.name\n });\n }\n } else {\n generated.column++;\n }\n }\n });\n this.walkSourceContents(function(sourceFile, sourceContent) {\n map.setSourceContent(sourceFile, sourceContent);\n });\n\n return { code: generated.code, map };\n }", "title": "" }, { "docid": "d082eb6687dcfd57863db99107def241", "score": "0.55475956", "text": "function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) {\n let linesCount = 0;\n let lastNewLinePos = -1;\n for (let i = 0; i < numberOfCharacters; i++) {\n if (source.charCodeAt(i) === 10 /* newline char code */) {\n linesCount++;\n lastNewLinePos = i;\n }\n }\n pos.offset += numberOfCharacters;\n pos.line += linesCount;\n pos.column =\n lastNewLinePos === -1\n ? pos.column + numberOfCharacters\n : numberOfCharacters - lastNewLinePos;\n return pos;\n}", "title": "" }, { "docid": "d082eb6687dcfd57863db99107def241", "score": "0.55475956", "text": "function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) {\n let linesCount = 0;\n let lastNewLinePos = -1;\n for (let i = 0; i < numberOfCharacters; i++) {\n if (source.charCodeAt(i) === 10 /* newline char code */) {\n linesCount++;\n lastNewLinePos = i;\n }\n }\n pos.offset += numberOfCharacters;\n pos.line += linesCount;\n pos.column =\n lastNewLinePos === -1\n ? pos.column + numberOfCharacters\n : numberOfCharacters - lastNewLinePos;\n return pos;\n}", "title": "" }, { "docid": "d082eb6687dcfd57863db99107def241", "score": "0.55475956", "text": "function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) {\n let linesCount = 0;\n let lastNewLinePos = -1;\n for (let i = 0; i < numberOfCharacters; i++) {\n if (source.charCodeAt(i) === 10 /* newline char code */) {\n linesCount++;\n lastNewLinePos = i;\n }\n }\n pos.offset += numberOfCharacters;\n pos.line += linesCount;\n pos.column =\n lastNewLinePos === -1\n ? pos.column + numberOfCharacters\n : numberOfCharacters - lastNewLinePos;\n return pos;\n}", "title": "" }, { "docid": "d082eb6687dcfd57863db99107def241", "score": "0.55475956", "text": "function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) {\n let linesCount = 0;\n let lastNewLinePos = -1;\n for (let i = 0; i < numberOfCharacters; i++) {\n if (source.charCodeAt(i) === 10 /* newline char code */) {\n linesCount++;\n lastNewLinePos = i;\n }\n }\n pos.offset += numberOfCharacters;\n pos.line += linesCount;\n pos.column =\n lastNewLinePos === -1\n ? pos.column + numberOfCharacters\n : numberOfCharacters - lastNewLinePos;\n return pos;\n}", "title": "" }, { "docid": "d082eb6687dcfd57863db99107def241", "score": "0.55475956", "text": "function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) {\n let linesCount = 0;\n let lastNewLinePos = -1;\n for (let i = 0; i < numberOfCharacters; i++) {\n if (source.charCodeAt(i) === 10 /* newline char code */) {\n linesCount++;\n lastNewLinePos = i;\n }\n }\n pos.offset += numberOfCharacters;\n pos.line += linesCount;\n pos.column =\n lastNewLinePos === -1\n ? pos.column + numberOfCharacters\n : numberOfCharacters - lastNewLinePos;\n return pos;\n}", "title": "" }, { "docid": "d082eb6687dcfd57863db99107def241", "score": "0.55475956", "text": "function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) {\n let linesCount = 0;\n let lastNewLinePos = -1;\n for (let i = 0; i < numberOfCharacters; i++) {\n if (source.charCodeAt(i) === 10 /* newline char code */) {\n linesCount++;\n lastNewLinePos = i;\n }\n }\n pos.offset += numberOfCharacters;\n pos.line += linesCount;\n pos.column =\n lastNewLinePos === -1\n ? pos.column + numberOfCharacters\n : numberOfCharacters - lastNewLinePos;\n return pos;\n}", "title": "" }, { "docid": "d082eb6687dcfd57863db99107def241", "score": "0.55475956", "text": "function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) {\n let linesCount = 0;\n let lastNewLinePos = -1;\n for (let i = 0; i < numberOfCharacters; i++) {\n if (source.charCodeAt(i) === 10 /* newline char code */) {\n linesCount++;\n lastNewLinePos = i;\n }\n }\n pos.offset += numberOfCharacters;\n pos.line += linesCount;\n pos.column =\n lastNewLinePos === -1\n ? pos.column + numberOfCharacters\n : numberOfCharacters - lastNewLinePos;\n return pos;\n}", "title": "" } ]
7d30dfbf7dcf0692d808cb2bf4082cfe
A function to display button input in the display of calculator
[ { "docid": "1543d721241a8d71156620c4849ada4e", "score": "0.6638205", "text": "function displayNumber() {\n\t// append the display's inner text with the innerText of the button clicked\n\n\tif (centerDisplay.innerText === \"\") {\n\t\tif(this.innerText == \".\"){\n\t\t\tif(leftDisplay.innerText.indexOf(\".\") == -1){\n\t\t\t\tleftDisplay.innerText += this.innerText;\n\t\t\t}\n\t\t}else{\n\t\t\tleftDisplay.innerText += this.innerText;\n\t\t}\n\t} else {\n\t\tif(this.innerText == \".\"){\n\t\t\tif(rightDisplay.innerText.indexOf(\".\") == -1){\n\t\t\t\trightDisplay.innerText += this.innerText;\n\t\t\t}\n\t\t}else{\n\t\t\trightDisplay.innerText += this.innerText;\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "7c788495266b798b0d508378bb46d6fe", "score": "0.76004195", "text": "function ShowValue(btn) {\r\n input += btn.value;\r\n output.innerHTML = input;\r\n}", "title": "" }, { "docid": "7cfe431376ef077b1f422088beec3c28", "score": "0.7405221", "text": "function operationButtonClicked(operationType) {\n if (calculator.currentState == 1) {\n calculator.firstOperand = Number(\n document.getElementById(\"result\").innerText);\n } else if (calculator.currentState == 3) {\n calculator.secondOperand = Number(\n document.getElementById(\"result\").innerText);\n\n let calculatedResult = function () {\n switch (calculator.operator) {\n case \"plus-equal\":\n return calculator.firstOperand + calculator.secondOperand;\n case \"subtract\":\n return calculator.firstOperand - calculator.secondOperand;\n case \"multiply\":\n return calculator.firstOperand * calculator.secondOperand;\n case \"divide\":\n return calculator.firstOperand / calculator.secondOperand;\n }\n }();\n\n document.getElementById(\n \"result\").innerText = function (value) {\n let renderedValue = value.toString();\n if (renderedValue.length > 10) {\n if (value >= 10000000000) {\n // exponentiate\n return value.toExponential(3);\n } else {\n // truncate\n return renderedValue.substr(0, 10);\n }\n } else {\n return renderedValue;\n }\n }(calculatedResult);\n\n calculator.firstOperand = calculatedResult;\n }\n calculator.currentState = 2;\n calculator.operator = operationType;\n }", "title": "" }, { "docid": "00b3af50418ceea165b9add93a4939db", "score": "0.72464293", "text": "function pushBtn(obj){\n var display = obj.innerHTML; \n \n if(display == '='){\n input.innerHTML = eval(input.innerHTML);\n }\n else if (display == 'C'){\n input.innerHTML = '0';\n } else {\n if(input.innerHTML == \"0\"){\n input.innerHTML = display;\n } else {\n input.innerHTML += display;\n }\n }\n}", "title": "" }, { "docid": "00ae7e2cabf0c7d24ae09b9b4ccff115", "score": "0.720656", "text": "function displayNewOperand (button) {\n newOperandText.textContent += button.textContent;\n newOperand = newOperandText.textContent;\n}", "title": "" }, { "docid": "51f268016f3112d243900a8c5a61b1f3", "score": "0.719901", "text": "function updateDisplay() {\n const wrapper = document.getElementById('wrapper');\n let inputNumber = null;\n let storedNumber = null;\n let operatorClick = null;\n\n// define a nested function to display the results on the calculator screen\n\n function displayResults() {\n return document.getElementById('result').value = storedNumber;\n };\n\n wrapper.addEventListener('click', (event) => {\n const isButton = event.target.nodeName === 'BUTTON';\n if (!isButton) {\n return;\n };\n\n// firstly, if a series of numbers are pressed before an operator, store and display the number(s)\n if (event.target.className === 'numbers' && operatorClick === null) {\n inputNumber = parseInt(document.getElementById('result').value += event.target.value);\n storedNumber = inputNumber;\n displayResults();\n\n// if a number is pressed after an operator, store the new input number, then operate on the stored and input numbers to calculate the new stored number\n } else if (event.target.className === 'numbers' && operatorClick !== null) {\n inputNumber = parseInt(document.getElementById('result').value += event.target.value);\n storedNumber = operate(operatorClick, storedNumber, inputNumber);\n displayResults();\n\n// if an operator is pressed, record the operator id and clear the display\n } else if (event.target.className === 'operators') {\n operatorClick = event.target.id.toString();\n clearDisplay();\n\n// if the equals button is pressed, show the latest calculation results\n } else if (event.target.className === 'equals' && operatorClick !== null) {\n displayResults();\n }\n });\n}", "title": "" }, { "docid": "3b89d8b9d399494ef2343a65b5f0113f", "score": "0.7154313", "text": "function numberLogic(button) {\n\n if(clearedValue && firstOperand === undefined){\n tracker.textContent = '';\n }\n\n if (clearedValue) {\n display.textContent = button;\n clearedValue = false;\n } else {\n if (display.textContent.length <= 14) {\n display.textContent += button;\n }\n }\n\n if(operator !== undefined){\n secondOperand = display.textContent;\n }\n}", "title": "" }, { "docid": "b6cb13823a59a1cea69f53ad9aad0d9a", "score": "0.7102901", "text": "function handleButtonClick() {\n // get button press\n let input = this.textContent\n switch (input) {\n case '+':\n // this is to not allow a user to be able to do 3 + 1 + 1\n // if operation var is not null, then clear the screen so they have to start again\n if (operation === null) {\n // add the function to the global and updated the input div\n operation = sum\n inputScreen.textContent += ` ${input} ` \n } else {\n clear()\n }\n break;\n case '-':\n if (operation === null) {\n // add the function to the global and updated the input div\n operation = minus\n inputScreen.textContent += ` ${input} ` \n } else {\n clear()\n }\n break;\n case '×':\n if (operation === null) {\n // add the function to the global and updated the input div\n operation = multiply\n inputScreen.textContent += ` ${input} ` \n } else {\n clear()\n }\n break;\n case '÷':\n if (operation === null) {\n // add the function to the global and updated the input div\n operation = divide\n inputScreen.textContent += ` ${input} ` \n } else {\n clear()\n }\n break;\n case 'AC':\n // clear the screen and global vars if they press this button\n clear()\n break;\n case 'DEL':\n // remove the last character from the input screen\n inputScreen.textContent = removeLastCharFromString(inputScreen.textContent);\n // check which global var to remove the last string from\n if (operation === null) \n num1 = removeLastCharFromString(num1);\n else \n num2 = removeLastCharFromString(num2);\n break;\n case '=':\n // calculate what the user wants\n // update the output div\n let result = performOperation(num1, num2, operation)\n outputScreen.textContent = result\n break;\n default:\n // this first statement handles the situation where if the a user has calculated something already\n // and goes to start another calculation, then clear everything for them \n if (outputScreen.textContent.length > 0) clear()\n inputScreen.textContent += input \n // determines which var to put the string into\n if (operation === null) \n num1 += input\n else \n num2 += input\n break;\n }\n}", "title": "" }, { "docid": "3c26561bf418a39c534094e958dcff04", "score": "0.7100722", "text": "function calculator (buttonName, status) {\n const current = status.current;\n const operation = status.operation;\n const storedNum = status.storedNum; //a number that is saved because user chose an operation.\n\n\n if(buttonName == '=') {\n if(operation && !storedNum) { //if user has a number on screen, has selected an operator, but not started entering another number\n return {\n current: operate(current, operation, current),\n storedNum: null,\n operation: null\n }\n }\n if(operation && storedNum) {\n return {\n current: operate(storedNum, operation, current),\n storedNum: null,\n operation: null\n }\n }\n if(current && !operation) {\n return {\n current: current,\n storedNum: storedNum,\n operation: operation\n }\n }\n }\n\n\n if(buttonName == '+/-' && current != 'Not a Number'){\n if(!/\\-/.test(status.current)) {\n return {\n current: '-' + current,\n storedNum: storedNum,\n operation: operation\n }\n } else {\n return {\n current: current.substring(1),\n storedNum: storedNum,\n operation: operation\n }\n }\n }\n\n if(buttonName == \".\" && current != 'Not a Number') {\n if(!/\\./.test(current)) {\n return {\n current: current + '.',\n storedNum: storedNum,\n operation: operation\n }\n }\n return {};\n }\n\n if(isNumber(buttonName)) {\n if(current && operation && !storedNum) { //if there's a current number and an operation, the next number entered should change the display to show the new number\n return {\n storedNum : current,\n current : buttonName,\n operation: operation\n }\n }\n if(current == '0' | current == 'Not a Number') { //if display is zero, replace the zero to prevent users from stacking zeros at front of numbers\n return {\n current: buttonName,\n storedNum: storedNum,\n operation: operation\n };\n }\n return {\n current: current + buttonName,\n storedNum: storedNum,\n operation: operation\n };\n //append number to current, unless number has reached max display size\n //ADD MAX DISPLAY SIZE CHECK\n }\n\n if(buttonName == 'AC') {\n return {\n current : 0,\n operation : null,\n storedNum : null\n };\n }\n\n else { //buttonName must be an operation\n if(!storedNum && current && current != 'Not a Number') { //if there's no stored number, the user needs to select an operation, or the user is updating the operation\n return {\n current: current,\n operation: buttonName,\n storedNum: storedNum\n };\n }\n if(operation && current && storedNum) { //if there are two numbers to operate with, evaluate operation\n return {\n current: operate(storedNum, operation, current),\n storedNum: null,\n operation: buttonName //since user initiated calc w/ an operation, save the operation\n }\n }\n //implicit: if no storedNum | current, do nothing\n return {\n current: current,\n storedNum: storedNum,\n operation: operation\n };\n }\n\n}", "title": "" }, { "docid": "60724ad27a91f8b4c998495aa7f1555a", "score": "0.7085693", "text": "updateDisplay() {\n this.currentOperandTextElement.innerText = this.currentOperand;\n if (this.operation != \"\") {\n this.previousOperandTextElement.innerText = `${this.previousOperand} ${this.operation}`;\n } else {\n previousOperandTextElement.innerText = this.previousOperand;\n }\n }", "title": "" }, { "docid": "1b7e4752aa3a6677dac85885986b9396", "score": "0.7051028", "text": "function opBtnClicked(name) {\n\tlastOpClicked = name;\n\tif (enterKeyDown) {\n\t\treturn;\n\t}\n\tsetAc(false);\n\tswitch (name) {\n\t\tcase \"factorial\":\n\t\t\thandleUnaryOp(factorial);\n\t\t\tbreak;\n\t\tcase \"negate\": //Special case: Has more to do with number entry than operations\n\t\t\tif (enteringValue.startsWith(\"-\")) {\n\t\t\t\tenteringValue = enteringValue.substring(1);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tenteringValue = \"-\" + enteringValue;\n\t\t\t}\n\t\t\tupdateView(enteringValue);\n\t\t\teqPressedLast = false;\n\t\t\tbreak;\n\t\tcase \"modulo\":\n\t\t\t//Here is an example of how we handle dual operand operations\n\t\t\t//modulo(num, modulus) is a function defined in the model.\n\t\t\thandleBinaryOp(modulo);\n\t\t\tlastOpSymbol = \"%\";\n\t\t\tbreak;\n\t\tcase \"square\":\n\t\t\t//Here is an example of how we handle single operand operations\n\t\t\t//square(num) is a function defined in the model.\n\t\t\thandleUnaryOp(square);\n\t\t\tlastOpSymbol = \"^\";\n\t\t\tbreak;\n\t\tcase \"sqrt\":\n\t\t\thandleUnaryOp(square_root);\n\t\t\tbreak;\n\t\tcase \"addition\":\n\t\t\thandleBinaryOp(plus);\n\t\t\tlastOpSymbol = \"+\";\n\t\t\tbreak;\n\t\tcase \"subtraction\":\n\t\t\tif (enteringValue.endsWith(\"E\")) {\n\t\t\t\tenteringValue = enteringValue + \"-\";\n\t\t\t} else if ((enteringValue == \"0\" || enteringValue == \"-0\") && !opPressedLast) {\n\t\t\t\topBtnClicked(\"negate\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\thandleBinaryOp(minus);\n\t\t\t}\n\t\t\tlastOpSymbol = \"-\";\n\t\t\tbreak;\n\t\tcase \"multiplication\":\n\t\t\thandleBinaryOp(times);\n\t\t\tlastOpSymbol = '\\u00D7';\n\t\t\tbreak;\n\t\tcase \"division\":\n\t\t\thandleBinaryOp(divide);\n\t\t\tlastOpSymbol = '\\u00F7';\n\t\t\tbreak;\n\t\tcase \"cubrt\":\n\t\t\thandleUnaryOp(cube_root);\n\t\t\tbreak;\n\t\tcase \"recip\":\n\t\t\thandleUnaryOp(one_fraction);\n\t\t\tbreak;\n\t\tcase \"powerten\":\n\t\t\thandleUnaryOp(ten_power);\n\t\t\tbreak;\n\t\tcase \"xtoy\":\n\t\t\thandleBinaryOp(power);\n\t\t\tlastOpSymbol = \"^\";\n\t\t\tbreak;\n\t\tcase \"e_power\":\n\t\t\thandleUnaryOp(e_power);\n\t\t\tlastOpSymbol = \"-\";\n\t\t\tbreak;\n\t\tcase \"cube\":\n\t\t\thandleUnaryOp(cube);\n\t\t\tlastOpSymbol = \"^\";\n\t\t\tbreak;\n\t\tcase \"nroot\":\n\t\t\thandleBinaryOp(n_root);\n\t\t\tlastOpSymbol = \"\";\n\t\t\tbreak;\n\t\tcase \"natlog\":\n\t\t\thandleUnaryOp(natural_log);\n\t\t\tlastOpSymbol = \"-\";\n\t\t\tbreak;\n\t\tcase \"logten\":\n\t\t\thandleUnaryOp(log_ten);\n\t\t\tlastOpSymbol = \"-\";\n\t\t\tbreak;\n\t\tcase \"e\":\n\t\t\tinsertValue(e_value());\n\t\t\tbreak;\n\t\tcase \"sin\":\n\t\t\thandleUnaryOp(sine);\n\t\t\tlastOpSymbol = \"sin\";\n\t\t\tbreak;\n\t\tcase \"cos\":\n\t\t\thandleUnaryOp(cosine);\n\t\t\tlastOpSymbol = \"cos\";\n\t\t\tbreak;\n\t\tcase \"tan\":\n\t\t\thandleUnaryOp(tangent);\n\t\t\tlastOpSymbol = \"tan\";\n\t\t\tbreak;\n\t\tcase \"pi\":\n\t\t\tinsertValue(pi_value());\n\t\t\tlastOpSymbol = \"-\";\n\t\t\tbreak;\n\t\tcase \"invsin\":\n\t\t\thandleUnaryOp(inverseSine);\n\t\t\tlastOpSymbol = \"-\";\n\t\t\tbreak;\n\t\tcase \"invcos\":\n\t\t\thandleUnaryOp(inverseCosine);\n\t\t\tlastOpSymbol = \"-\";\n\t\t\tbreak;\n\t\tcase \"invtan\":\n\t\t\thandleUnaryOp(inverseTangent);\n\t\t\tlastOpSymbol = \"-\";\n\t\t\tbreak;\n\t\tcase \"decimalToBinary\":\n\t\t\thandleUnaryOp(decimal_to_binary);\n\t\t\tlastOpSymbol = \"-\";\n\t\t\tbreak;\n\t\tcase \"binaryToDecimal\":\n\t\t\thandleUnaryOp(binary_to_decimal);\n\t\t\tlastOpSymbol = \"-\";\n\t\t\tbreak;\n\t\tcase \"decimalToHex\":\n\t\t\thandleUnaryOp(decimal_to_Hex);\n\t\t\tlastOpSymbol = \"-\";\n\t\t\tbreak;\n\t\tcase \"decimalToOctal\":\n\t\t\thandleUnaryOp(decimal_to_Octal);\n\t\t\tlastOpSymbol = \"-\";\n\t\t\tbreak;\n\t}\n}", "title": "" }, { "docid": "e43af5b9140552e339f05719ed9214ee", "score": "0.7012408", "text": "updateDisplay() {\n this.currentOperandTextElement.innerText =\n this.getDisplayNumber(this.currentOperand)\n if (this.operation != null) {\n this.previousOperandTextElement.innerText =\n `${this.getDisplayNumber(this.previousOperand)} ${this.operation}`\n } else {\n this.previousOperandTextElement.innerText = ''\n }\n }", "title": "" }, { "docid": "f2705976e7448e19e2caafaaca2e72a6", "score": "0.7011741", "text": "function calculate (event){\n const clickedButtonValue = event.target.value;\n\nif(clickedButtonValue === '='){\n if(display.value !== ''){\n display.value = eval(display.value);\n }\n}else if (clickedButtonValue === 'C'){\n display.value ='';\n\n}else {\n display.value += clickedButtonValue;\n}\n}", "title": "" }, { "docid": "95dfc936a781247788361d6c2368703e", "score": "0.69782346", "text": "function display(){\n currOperand.innerHTML = format(currentOperand);\n if (operator != null){\n preOperand.innerHTML = `${format(previousOperand)} ${operator}`;\n }\n else {\n preOperand.innerHTML = '';\n }\n}", "title": "" }, { "docid": "2b2bffd26ea5cc27d27f108a7c93185e", "score": "0.69608444", "text": "function buttonToDisplay(e) \r\n {\r\n buttonTxt = e.target.textContent;\r\n if (displayEmpty && pwr == true) \r\n {\r\n display.textContent = buttonTxt;\r\n displayEmpty = false;\r\n }\r\n else if(pwr == true)\r\n {\r\n display.textContent += buttonTxt;\r\n }\r\n }", "title": "" }, { "docid": "496b3527f9dfdfbebb16303015125808", "score": "0.6948487", "text": "updateDisplay() {\r\n this.currentOperandTextElement.innerText = this.getDisplayNumber(this.currentOperand);\r\n\r\n // update previous operand to show all the operations we've done\r\n if (this.operation != null) {\r\n this.previousOperandTextElement.innerText = `${this.getDisplayNumber(this.previousOperand)} ${this.operation}`;\r\n } else {\r\n this.previousOperandTextElement.innerText = '';\r\n }\r\n\r\n \r\n }", "title": "" }, { "docid": "28bfc885723cfb6c2e17f556c97d5061", "score": "0.6938744", "text": "function output() {\r\n const val = document.querySelector('.calculator-output');\r\n val.value = calculator.valueDisplay;\r\n}", "title": "" }, { "docid": "e090382e31a46a15a1610bc72fcfcd90", "score": "0.69345224", "text": "function my_f(button) {\n calstr = calstr + button\n calcDisplay.innerHTML = calstr\n console.log(calstr);\n}", "title": "" }, { "docid": "d733db6b5b128bdab0077495d2727a1b", "score": "0.6932825", "text": "function numberButton(number) {\n\tif (lastButtonPressed == 'operator'){\n\t\tdisplayNumber = 0;\n\t}\n\n\telse if (lastButtonPressed == 'equals') {\n\t\tdisplayNumber = 0;\n\t\tnumbers = [];\n\t}\n\n\tdisplayNumber = \"\" + displayNumber + number;\n\tdisplayNumber = parseInt(displayNumber);\n\tlastButtonPressed = 'number';\n\n\trender(numbers.join(\" \") + \" \" + displayNumber);\n\n}", "title": "" }, { "docid": "fc3016063585d57d1196df1bcb144d7d", "score": "0.69037396", "text": "function displayOutput(operator, initialResult,calcResult,inputNumber){\n console.log(inputNumber)\n document.getElementById('display').innerHTML=\"The Calulation is \"+`${initialResult} ${operator} ${inputNumber}`\n document.getElementById('Result').innerHTML=\"The total Result is \"+ `${calcResult}`\n}", "title": "" }, { "docid": "8a9f1af193b002c9871f1a03a1aa45ad", "score": "0.68864524", "text": "function compute(){\n \n operatorBtns.forEach(operator => operator.addEventListener('click', (e) =>{\n pendingValue = displayValue;\n if (pendingValue !== undefined){\n displayValue = '0';\n currentDisplayValue.innerText = displayValue;\n pendingDisplayValue.innerText = pendingValue;\n op = e.currentTarget.textContent;\n }\n \n \n \n }));\n\n //Step 6 - Equals button\n //When the user clicks - equals button the current displayValue will be stored into the displayValue;\n //Then call the operate function which will call the relevant function dependant on the value of the operator;\n equalsBtn.addEventListener('click', (e) => {\n displayValue = currentDisplayValue.textContent;\n operate(op, pendingValue, displayValue);\n console.log(result);\n pendingValue = '';\n pendingDisplayValue.innerText = pendingValue\n currentDisplayValue.textContent = displayValue;\n displayValue = result;\n if (result === 0){\n return displayValue = result.toString(); //this will convert the result to string so that backspace can be used on it;\n }\n displayValue = result.toString()\n currentDisplayValue.textContent = displayValue;\n \n \n\n \n });\n \n}", "title": "" }, { "docid": "ad3c769c10a66c58b4503b97343140d3", "score": "0.688146", "text": "function my_f(button) {\n\t//console.log(button);\n\tcalstr = calstr + button\n\tcalcDisplay.innerHTML = calstr\n\tconsole.log(calstr);\n\n}", "title": "" }, { "docid": "62a461ae501d1baa67d61ac34b6f324c", "score": "0.6872987", "text": "function updateUI() {\n\n display.value = calculator.operations;\n // .split(\"\").reverse().join(\"\");\n}", "title": "" }, { "docid": "a0375a136b36979d44a48ecb27c6e61b", "score": "0.68512213", "text": "function _displayCurrentOpMode() {\n _formatZeros(); // formatting for _operand1 (final result)\n // indicate did not press equal button as default\n // to prevent clearing display\n _pressedEqual = false;\n switch(_op) {\n case \"add\":\n message.innerText += \" +\";\n break;\n case \"subtract\":\n message.innerText += \" -\";\n break;\n case \"multiply\":\n message.innerText += \" ×\";\n break;\n case \"divide\":\n message.innerText += \" ÷\";\n break;\n case \"equal\":\n message.innerText = \"= \" + message.innerText;\n _pressedEqual = true; // indicate pressed equal button\n }\n clear.innerText = \"all clear\";\n }", "title": "" }, { "docid": "ed7c1056e3d042afea32e2dfc0dda6ae", "score": "0.68408865", "text": "function mainOperationsButtons() {\n checkValues(this.textContent);\n operatorMiseAjour(this.textContent);\n operation(this.textContent);\n clearAll(this.textContent);\n}", "title": "" }, { "docid": "d03206b9006ae27591b0929eba20120f", "score": "0.6836442", "text": "function signButtonClick(id) {\n operatorSign = document.getElementById(id).value;\n\n display.value += document.getElementById(id).value;\n\n\n}", "title": "" }, { "docid": "9169ed4d535ba07a7efe976927e4ea6f", "score": "0.68261355", "text": "function updateDisplay() {\r\n document.querySelector(\"#displayNumber\").innerText = calculator.displayNumber;\r\n}", "title": "" }, { "docid": "d24d14572cc266f131f2f651dd9afdd7", "score": "0.68222815", "text": "function numBtnClicked(num) {\n\tif (enterKeyDown) {\n\t\treturn;\n\t}\n\tif (opPressedLast) {\n\t\tenteringValue = \"\";\n\t}\n\tif (eqPressedLast) {\n\t nextOp = undefined;\n\t}\n\tsetAc(false);\n\topPressedLast = false;\n\tif (enteringValue == \"0\") {\n\t\tenteringValue = num.toString();\n\t}\n\telse if (enteringValue == \"-0\") {\n\t\tenteringValue = \"-\" + num.toString();\n\t}\n\telse {\n\t\tenteringValue = enteringValue + num.toString();\n\t}\n\tupdateView(enteringValue);\n\teqPressedLast = false;\n}", "title": "" }, { "docid": "655a7324d77111f8dac42dd25ab83f43", "score": "0.6819868", "text": "function buttonClicked(val){\n switch(val){\n case \"+\":\n case \"-\":\n case \"x\":\n case \"/\":\n operatorClicked(val);\n break;\n case \"=\":\n calculate();\n operator = '';\n break;\n case \".\":\n decimalClicked(val);\n break;\n case \"AC\":\n allClear();\n break;\n case \"CE\":\n clear();\n break;\n default:\n numberClicked(val);\n\n }\n}", "title": "" }, { "docid": "1d81bda05bebeac6a69f0cd1ca568acb", "score": "0.68193114", "text": "function display(){\ndocument.querySelector('.display').value = number1 + operator + number2;\n\tif(number1 && operator && number2){\n\t\t switch(operator) {\n case \"+\":\n document.querySelector('.result').value = '= '+String(parseFloat(number1)+parseFloat(number2));\n break;\n case \"-\":\n document.querySelector('.result').value = '= '+String(parseFloat(number1)-parseFloat(number2));\n break;\n case \"*\":\n document.querySelector('.result').value = '= '+String(parseFloat(number1)*parseFloat(number2));\n break;\n case \"/\":\n document.querySelector('.result').value = '= '+String(parseFloat(number1)/parseFloat(number2));\n break;\n case \"^\":\n document.querySelector('.result').value = '= '+String(parseFloat(number1)**parseFloat(number2));\n break;\n \t\t}\n\t}\n\telse {\n\t document.querySelector('.result').value = '';\n\t\n\t}\n}", "title": "" }, { "docid": "ff572149ed024207a89f0113895a25ee", "score": "0.68157554", "text": "function button(operator) {\n //insert operator into expression box\n var currentExp = document.getElementById('txtExpr').value;\n var symbol = getSymbol(operator);\n\n if (currentExp == \"Input expression\" || symbol == \"\") {\n document.getElementById('txtExpr').value = symbol;\n } else {\n insertAtCaret(document.getElementById('txtExpr'), symbol);\n }\n}", "title": "" }, { "docid": "389288691ec7895fcadc18722f543308", "score": "0.6809772", "text": "function Input_Digit(digit) {\n const {Display_Value, Wait_Second_Operand} = Calculator;\n // checking to see if Wait_Second_Operand is true\n // and setting Display_Value to button clicked\n if (Wait_Second_Operand === true) {\n Calculator.Display_Value = digit;\n Calculator.Wait_Second_Operand = false;\n }\n else {\n // this overwrites Display_Value if the current value is \n // 0, otherwise it adds onto it\n Calculator.Display_Value = Display_Value === '0' ? digit : Display_Value + digit;\n }\n}", "title": "" }, { "docid": "8ebdac07baf8fa02d3b90ef1cc81730c", "score": "0.6793543", "text": "render() {\n return (\n <div className=\"Calculator\">\n <Card>\n <h1>JavaScript Calculator</h1>\n <h2>{this.state.warning}</h2>\n <div className=\"Calculator_contents\">\n <button onClick={this.processClear}>C</button>\n <div className=\"Calculator_display\">{this.state.display}</div>\n {[\n \"7\",\n \"8\",\n \"9\",\n \"+\",\n \"4\",\n \"5\",\n \"6\",\n \"-\",\n \"1\",\n \"2\",\n \"3\",\n \"*\",\n \"0\",\n \".\",\n \"=\",\n \"/\"\n ].map(button => (\n <button key={button} value={button} onClick={this.processEntry}>\n {button}\n </button>\n ))}\n </div>\n </Card>\n </div>\n );\n }", "title": "" }, { "docid": "e8bcb5c6692122f3276167fa9a760a96", "score": "0.67676115", "text": "function buttonClick(value) {\n if(isNaN(value)) {\n // no number was pressed \n handleSymbol(value);\n } else {\n // number was pressed\n handleNumber(value);\n }\n\n // display accordingly\n screen.innerText = input;\n}", "title": "" }, { "docid": "924bd5188522246b0f9d65d103f5f8a3", "score": "0.67149734", "text": "function getButtonValue(val)\r\n{\r\n\tdocument.getElementById(\"display\").value+=val;\r\n}", "title": "" }, { "docid": "41c3125c9119f3c0023ce23a5f2384b3", "score": "0.6714138", "text": "function numberButtonClicked(buttonId) {\n if (calculator.currentState == 2) {\n document.getElementById(\"result\").innerText = buttonId;\n calculator.currentState = 3;\n } else if (document.getElementById(\"result\").innerText.length > 9) {\n return;\n } else if (document.getElementById(\"result\").innerText == \"0\") {\n document.getElementById(\"result\").innerText = buttonId;\n } else {\n document.getElementById(\"result\").innerText += buttonId;\n }\n }", "title": "" }, { "docid": "e3a64595708d9906f536c9bd2945363f", "score": "0.6684612", "text": "function decimal() {\n displayValue.textContent += decimalButton.textContent;\n}", "title": "" }, { "docid": "75b8ae659554e9be27d0301d07048416", "score": "0.66648835", "text": "function operatorClicked() {\n console.log(\"operatorClicked\");\n\n var operatorValue = $(this).val();\n\n // Only respond to operator clicks when we\n // expect an operator.\n\n if (!calc.hasResult() && !calc.hasBothNumbers()) {\n switch(operatorValue) {\n case \"plus\": $(\"#operator\").append(\"+\"); break;\n case \"minus\": $(\"#operator\").append(\"-\"); break;\n case \"times\": $(\"#operator\").append(\"*\"); break;\n case \"divide\": $(\"#operator\").append(\"/\"); break;\n case \"power\": $(\"#operator\").append(\"^\"); break;\n default:\n console.log(\"operatorClicked: bad operator:\", operatorValue);\n console.log(\"operatorClicked: punting\")\n return;\n break;\n }\n } else {\n console.log(\"operatorClicked: ignoring input:\", operatorValue);\n console.log(\"operatorClicked: not expecting an operator now\");\n return;\n }\n calc.setOperator(operatorValue);\n}", "title": "" }, { "docid": "79c4bf292884434ddd06c6a66ac31fab", "score": "0.66638994", "text": "function on_click() {\n var button_clicked;\n var result;\n var last_index = button_storage_array.length - 1;\n var last_item = button_storage_array[last_index];\n button_clicked = {\n type: find_type($(this).text()),\n value: $(this).text()\n };\n if(button_storage_array.length === 0) {\n if(button_clicked.type === \"equalSign\") {\n $('.calculator_display').text(\"Ready\");\n } else if(button_clicked.type === \"number\") {\n button_storage_array.push(button_clicked);\n }\n }\n else if (button_storage_array.length > 0) {\n if (button_clicked.type === \"number\" && last_item.type === \"number\"){\n if(last_item.value.indexOf(\".\") > -1 && button_clicked.value === \".\"){\n return;\n } else{\n last_item.value += button_clicked.value ;\n }\n }\n else if (button_clicked.type === \"operator\" && last_item.type === \"operator\"){\n last_item.value = button_clicked.value;\n }\n else if (button_clicked.type === \"equalSign\") {\n result = handle_equals(last_index, last_item);\n }\n else {\n button_storage_array.push(button_clicked);\n }\n }\n speak_entry($(this).data(\"string\"));\n handle_clear_or_equals(button_clicked.value, result, last_index);\n}", "title": "" }, { "docid": "900edb0f161e8d79ecf9547e9a7644b8", "score": "0.6662718", "text": "function opAddButtonClicked() {\n console.log(\"addition\")\n operation(\"+\");\n}", "title": "" }, { "docid": "c1247eed2aeeb0ae4ee7b29ea7b25ab8", "score": "0.664086", "text": "function click(){\r\n 'use strict';\r\n audio.play();\r\n valueBtn = this.value;\r\n outputNumber = output.textContent;\r\n\r\n if(valueBtn == '.'){\r\n dot();\r\n }else if(valueBtn == 'c'){ //clear output\r\n output.textContent = '-';\r\n document.getElementById('dot').disabled = false;\r\n isOneDot = true;\r\n }else if(valueBtn == 'Backspace'){ //for backspae\r\n \r\n if(outputNumber[outputNumber.length-1]=='.'){\r\n document.getElementById('dot').disabled = false;\r\n isOneDot = true;\r\n }\r\n \r\n if(outputNumber == ''){\r\n output.innerHTML = '-';\r\n // backspace.disabled= true;\r\n isOneDot = true;\r\n document.getElementById('dot').disabled = false;\r\n }else if(outputNumber == '-'){}\r\n else{\r\n output.textContent = outputNumber.slice(0, -1);\r\n }\r\n }else if(isNaN(valueBtn) && valueBtn != '.'){ // input operator\r\n if(output.textContent == '-'){ //if input was operator and output was impety\r\n alert(\"Choose a Number\");\r\n \r\n }else if(outputNumber.slice(-1) == \"+\" || outputNumber.slice(-1) == \"-\" || outputNumber.slice(-1) == \"*\" || outputNumber.slice(-1) == \"/\" || outputNumber.slice(-1) == \"=\"){\r\n alert('Use a Number Between The Two Operator');\r\n }else if(valueBtn == '='){ // if input was \"=\"\r\n equal();\r\n }else{//operator\r\n lengthFunction();\r\n document.getElementById('dot').disabled = false;\r\n isOneDot = true;\r\n }\r\n }else{ // input number\r\n lengthFunction(); \r\n }\r\n \r\n sizeResult();\r\n \r\n} // End Function Click", "title": "" }, { "docid": "3d9ee7aac5b22586521e2e46d169d874", "score": "0.66407615", "text": "function evaluateOperator(e) {\r\n if (e.key === \"Backspace\") {\r\n removeLastNumber();\r\n return;\r\n }\r\n\r\n if (e.key === \"Escape\") {\r\n clearDisplay();\r\n return;\r\n }\r\n\r\n let operIdFromParent;\r\n\r\n if (isKeyUp(e) && !keypressIsOperator(e)) {return}\r\n else if (isClick(e)) {\r\n operIdFromParent = e.target.parentElement.id;\r\n if (operatorClickArray.indexOf(operIdFromParent) < 0) {return}\r\n }\r\n\r\n operatorActive = true;\r\n dotEnabled = false;\r\n\r\n if (previousNumber != null && currentNumber != null) {\r\n let result;\r\n switch (currentButton) {\r\n case 'add':\r\n case '+':\r\n result = currentNumber + previousNumber;\r\n break;\r\n case 'subtract':\r\n case \"-\":\r\n result = previousNumber - currentNumber;\r\n break;\r\n case 'multiply':\r\n case \"*\":\r\n result = currentNumber * previousNumber;\r\n break;\r\n case \"powerOf\":\r\n result = previousNumber ** currentNumber;\r\n break;\r\n case 'divide':\r\n case '/':\r\n result = previousNumber / currentNumber;\r\n break;\r\n case 'equals':\r\n case \"Enter\":\r\n result = currentNumber;\r\n break;\r\n }\r\n\r\n //update previous number display to show expression\r\n if (currentButton !== 'Enter' && currentButton !== 'equals') {\r\n if (currentButton.length > 2) {\r\n prevNumberDisplay.textContent = `(${previousNumber}${clickOperatorMapping[currentButton]}${currentNumber})`;\r\n } else {\r\n prevNumberDisplay.textContent = `(${previousNumber}${currentButton}${currentNumber})`;\r\n }\r\n prevDispIsExpression = true;\r\n }\r\n\r\n //Show error on certain results. User required to clear if error.\r\n if (result > 999999999999 || result < -99999999999 || isNaN(result)) {\r\n numberDisplayedElement.textContent = 'ERROR, CLEAR!';\r\n errorMode = true;\r\n disableMostButtons();\r\n return;\r\n } else if (convertToformNumber(result).length > 10) result = result.toFixed(11);\r\n\r\n currentNumber = +(convertToformNumber(result).replace(/,/g,''));\r\n currentNumberIsAResult = true;\r\n localStorage.setItem('result', currentNumber);\r\n updateDisplay();\r\n previousNumber = null;\r\n }\r\n\r\n if (isKeyUp(e) && keypressIsOperator(e)) {\r\n currentButton = e.key;\r\n } else if (operatorClickArray.indexOf(operIdFromParent) > -1) {\r\n currentButton = operIdFromParent;\r\n }\r\n updateOperatorDisplayed();\r\n\r\n if (operatorActive && currentNumber != null) {\r\n previousNumber = currentNumber;\r\n currentNumber = null;\r\n }\r\n}", "title": "" }, { "docid": "d7fd03d7112393b650840fc44bcf699c", "score": "0.66375667", "text": "function inputDigit(digit) {\r\n //We set displayValue to be equal to calculator:\r\n //We also added waitingForSecondOperand so that we can set it to true when a digit is clicked after a firstOperand and an operator.\r\n const { displayValue, waitingForSecondOperand } = calculator;\r\n //This checks to see if the if the waitingForSecondOperand property is set to true, the displayValue property is overwritten with the digit that was clicked:\r\n if (waitingForSecondOperand === true) {\r\n calculator.displayValue = digit;\r\n calculator.waitingForSecondOperand = false;\r\n }\r\n //Otherwise, if the waitingForSecondOperand property is NOT set to true; then we override `displayValue` if the current value of calculator is '0', otherwise we append the digit to the end of it:\r\n else{\r\n calculator.displayValue = displayValue === '0' ? digit : displayValue + digit\r\n }\r\n console.log(calculator)\r\n}", "title": "" }, { "docid": "eb48eff565e067f2cff6c91bd37117e8", "score": "0.6637427", "text": "function updateAndDisplayOperator(){\n\toperator= this.value;\n\tdisplay.value=operator;\n\n}", "title": "" }, { "docid": "0bfc03eefd11dee1e0aebb5b6b3740ef", "score": "0.66332424", "text": "handleClick(button){\n \n /************** HANDLE DIGIT AND DECIMAL PLACE INPUT ******************************/\n\n if(parseFloat(button) || button === '0' || button === '.'){ // only acceptable values are integers and decimal points\n if(parseFloat(button) || button === '0'){ // handle integers\n this.display(button);\n } else{\n if(this.state.display.indexOf('.') === -1) // if decimal point has not been entered previously\n this.display(button);\n }\n }\n\n /*********************** HANDLE OPERATOR INPUT **************************************/\n switch(button){\n case 'x':\n case '/':\n case '+':\n case '-':\n case '=':\n this.operation(button);\n this.setState({\n hasEnteredValue: false\n });\n break;\n case '+/-':\n this.negate();\n break;\n case '%':\n this.percentage();\n break;\n default: \n break;\n }\n }", "title": "" }, { "docid": "55cb6220dc71245fa23921632975c745", "score": "0.6632255", "text": "function operate(operator) {\n if (operator == 'c') {\n // clear screen\n clearAll();\n return;\n }\n // if another operator is clicked without any operand before it remove the old operator and add the new one\n if (!oprCon) {\n operators.shift();\n operators.push(operator);\n return;\n }\n // the number on the screen can take a point now\n point = false;\n // add an operator if the operators array is empty\n if (operator != \"=\" && operators.length == 0) {\n operators.push(operator);\n // if there is an error in calculations set the total number to 0 other wise set it to the number on the screen\n total = screen.value == \"Error\" ? 0 : parseFloat(screen.value);\n // the next operator doesn't have operand before it\n oprCon = false;\n // make the next number we enter replace the number on the screen\n sClear = true;\n return;\n }\n // if the operator is = we will not do any thing , the same value will still on the screen\n if (operator == \"=\" && operators.length == 0)\n return;\n // store the number on the screen temporarily to make calculation on it\n temp = parseFloat(screen.value);\n switch (operators[0]) {\n case '+':\n add(temp);\n break;\n case '-':\n subtract(temp);\n break;\n case '*':\n multiply(temp);\n break;\n case '/':\n divide(temp);\n break;\n }\n // if there is an old error in calculations we will not do any other calculations\n if (screen.value == \"Error\")\n return;\n // after calculations we will put the result on the screen\n screen.value = total;\n // finally we remove the old operator from the array to be perpared for the new operator and calculations\n operators.shift();\n // make the next number we enter replace the number on the screen\n sClear = true;\n // if the old operator is = we can add a new operator without any addition steps\n if (operator === '=') {\n oprCon = true;\n return;\n }\n // add the new operator the array to calculate result next time if a number has been intered\n operators.push(operator);\n // the next operator doesn't have operand before it so we have to replace the old one with it\n oprCon = false;\n}", "title": "" }, { "docid": "cd1b70fc2ebecaddd7dbd5f9855dc491", "score": "0.66307145", "text": "handleBtnClick() {\n // only one operator is allowed between numbers\n if (Number.isNaN(Number(calculator.values[calculator.values.length - 1])) // FIXME: 5 * -2 should work, but doesn't\n && this.dataset.operator\n && calculator.values.length > 0) {\n console.log('Please enter only one operator at a time');\n } else {\n // push all values into array that are not the \"=\" character\n if (this.dataset.value !== '=' && this.dataset.value !== 'back') calculator.addValue(this.dataset.value);\n ui.displayResult(this.dataset.value, true);\n if (this.dataset.value === '=') calculator.solveEquation();\n if (this.dataset.value === 'C') calculator.resetCalc();\n if (this.dataset.value === 'back') calculator.delLastVal();\n }\n }", "title": "" }, { "docid": "813a9a6d0ce305d44f523ee47cedca93", "score": "0.6626213", "text": "function clickDigit (num){\n\n /**\n * check if we previously selected an operator\n * if so: we know that our first number has been stored to the memory and we\n * are now starting the new number (set input to new number)\n * if not: we know that we are just adding up to the current input, so just\n * add digit\n */\n if(number == input) input = num;\n else input += num;\n\n // show current input on screen\n $('.screen').html(input);\n}", "title": "" }, { "docid": "563f18909fa4bd7dc053c814a60eb0fc", "score": "0.6616798", "text": "function _pressNumButton(button) {\n _clearOpMode();\n _append(button.innerText);\n _display();\n _checkDecimal();\n }", "title": "" }, { "docid": "9257f448097f07f4fe5fbc2ff5e986d9", "score": "0.6616786", "text": "function displayOperators() {\n $(\".operator\").click(function () {\n let operatorBtns = [\"/\", \"*\", \"-\", \"+\"];\n for (let index = 0; index < operatorBtns.length; index++) {\n if (operatorBtns[index] === $(this).data(\"operator\")) {\n $(\"#history\").append(operatorBtns[index]);\n $(\"#answer\").append(operatorBtns[index]);\n };\n };\n });\n }", "title": "" }, { "docid": "df686fc5079a2625b8d12e7e056a7375", "score": "0.66165465", "text": "function numberPressed() {\n // Value of current button\n var currVal = this.getAttribute(\"func\");\n // Convert currNumber to string, add new number,\n // convert back to integer\n var stringNum = currNumber.toString();\n // If a decimal was entered on last press, add\n // a decimal before the current number being added.\n if (prevDecimal) {\n stringNum += (\".\" + currVal)\n currNumber = parseFloat(stringNum);\n // Stops other decimals being added to currNumber\n prevDecimal = false;\n } else {\n // If a decimal was added, change addDecimal to true\n // This will add a decimal ro currNumber the next\n // time a button is added\n if (currVal == \".\" && addDecimal == true) {\n prevDecimal = true;\n addDecimal = false;\n } else if (currVal == \".\") {\n return;\n }\n stringNum += currVal.toString();\n currNumber = parseInt(stringNum);\n }\n // Show current number on number screen\n numberScreen.value = stringNum;\n}", "title": "" }, { "docid": "f9446e2215336d3452a7303093a49603", "score": "0.66116816", "text": "function mathButPress(mathSign) {\r\n //if no previous calculation done\r\n if (!finalVal) {\r\n oldVal = newVal;\r\n //reset newVal to allow new number to be stored\r\n newVal = \"\";\r\n //reset final value to 0\r\n finalVal = \"\";\r\n //store operator pressed\r\n operator = mathSign;\r\n } else {\r\n //if previously calculation done, continue from there\r\n oldVal = newVal;\r\n //reset newVal to allow new number to be stored\r\n newVal = \"\";\r\n //reset final value to 0\r\n finalVal = \"\";\r\n //store operator pressed\r\n operator = mathSign;\r\n }\r\n document.getElementById(\"entry\").value = oldVal + mathSign;\r\n\r\n}", "title": "" }, { "docid": "07a8b1d4faf9607976d1b8d75b47f13c", "score": "0.66072696", "text": "function setOperator(number){\n operator = number;\n var opString = \"\";\n flag = true;\n if(operator === 4){\n display.innerHTML += \" / \";\n opString = \" / \";\n }else if(operator === 3){\n display.innerHTML += \" * \";\n opString = \" * \";\n }else if(operator === 2){\n display.innerHTML += \" - \";\n opString = \" - \";\n }else if(operator === 1){\n display.innerHTML += \" + \";\n opString = \" + \";\n }\n\n //for getting rid of multiple operators\n if(flag === true){\n display.innerHTML = num1 + opString + num2;\n }\n\n //does not let us do an operation before entering a num1\n if(flag === true && num1 === \"\"){\n clearButton();\n }\n\n if(equalTo === true){\n clearButton();\n }\n\n if(operator === 5){\n equalClick();\n }else if(operator === 6){\n equalClick();\n }else if(operator === 7){\n equalClick();\n }\n}", "title": "" }, { "docid": "b8f98d4968c4c4eb6626903d0564ad09", "score": "0.6602457", "text": "function clickedOperators(){\n display.value = \"\";\n operator = this.innerHTML;\n oldOperant = parseFloat(currentOperant);\n console.log(this.innerText);\n}", "title": "" }, { "docid": "11a1cbe5ef887ef2d69f710d7d7cbc28", "score": "0.6595955", "text": "function operator(button) {\r\n firstNumber = document.getElementById(\"a\").value;\r\n firstNumber = parseInt(firstNumber, 10)\r\n \r\n secondNumber = document.getElementById(\"b\").value;\r\n secondNumber = parseInt(secondNumber, 10);\r\n\r\n if (button === \"Add\") {\r\n var answer = firstNumber + secondNumber;\r\n }\r\n \r\n else if(button === \"Subtract\") {\r\n answer = firstNumber - secondNumber;\r\n }\r\n \r\n else if(button === \"Multiply\") {\r\n answer = firstNumber * secondNumber;\r\n }\r\n \r\n else if(button === \"Divide\") {\r\n answer = firstNumber / secondNumber;\r\n }\r\n \r\n document.getElementById(\"c\").value = answer;\r\n}", "title": "" }, { "docid": "b10645174125dd4a38b82d04d874afae", "score": "0.6576808", "text": "function operate() {\n if (currentNumber === \"\" || currentNumber === \"0\" || displayedNumber === \"\") {\n inputBox.placeholder = currentNumber;\n } else {\n switch (operator) {\n case 0:\n return; // If `operator` === 0 and user hits `equals` will do nothing. \n case 1:\n add(currentNumber, displayedNumber);\n break;\n case 2:\n subtract(currentNumber, displayedNumber);\n break;\n case 3:\n multiply(currentNumber, displayedNumber);\n break;\n case 4:\n divide(currentNumber, displayedNumber);\n break;\n default:\n inputBox.placeholder = \"An Error Has Ocurred :(\";\n }\n }\n}", "title": "" }, { "docid": "ce717068b82c3b5f33674f9c6cd8f041", "score": "0.65616524", "text": "function addNum(e) {\r\n if (e.target.classList.contains('button')) {\r\n let value = parseInt(e.target.textContent);\r\n input.value += value;\r\n sol.push(value);\r\n } else if (e.target.classList.contains('add')) {\r\n let value = e.target.textContent;\r\n input.value += '+';\r\n sol.push(value);\r\n } else if (e.target.classList.contains('minus')) {\r\n let value = e.target.textContent;\r\n input.value += '-';\r\n sol.push(value);\r\n } else if (e.target.classList.contains('multiply')) {\r\n let value = e.target.textContent;\r\n input.value += '*';\r\n sol.push(value);\r\n } else if (e.target.classList.contains('divide')) {\r\n let value = e.target.textContent;\r\n input.value += '%';\r\n sol.push(value);\r\n } else if (e.target.classList.contains('dot')) {\r\n let value = e.target.textContent;\r\n input.value += '.';\r\n sol.push(value);\r\n } else if (e.target.classList.contains('clear')) {\r\n input.value = '';\r\n sol = [];\r\n } else {\r\n return;\r\n }\r\n}", "title": "" }, { "docid": "5b9ae8f525e78299074f3564b79cbc99", "score": "0.6559443", "text": "function onOperatorButtonClick(event) {\n if (!isOperator) {\n const operator = event.target.innerText;\n\n updateOperator(operator);\n isFirstZero = true;\n }\n}", "title": "" }, { "docid": "9629bb5b37a8783cb71596408b06ef7f", "score": "0.6550183", "text": "function displayButton(){\r\n/* let meme=document.getElementById(\"Bonergif3\").style.display=\"\"; */ \r\nlet boner=document.getElementById(\"button4\").style.display=\"\";\r\nlet boner2=document.getElementById(\"button5\").style.display=\"\"; \r\nreturn boner +boner2;\r\n}", "title": "" }, { "docid": "055b9633176d020d78e022218f3cebad", "score": "0.6542502", "text": "function clickedNumbers() {\n display.value = display.value + this.innerText;\n currentOperant = parseFloat(display.value);\n console.log(this.innerHTML);\n}", "title": "" }, { "docid": "7d6499cac8c8e685261f37b2369b8e83", "score": "0.65419036", "text": "function operatorLogic(button) {\n \n checkOperandPosition();\n\n // if operator was already set solve the operation\n if (operator !== undefined && secondOperand !== undefined) {\n solveDisplay();\n secondOperand = undefined;\n }\n\n operator = button; \n\n if(operator !== undefined){\n tracker.textContent = firstOperand + ' ' + operator;\n }\n}", "title": "" }, { "docid": "c2c209b4407c6d474dc6e95e88d675e7", "score": "0.6540271", "text": "function buttonClick(displayValue) {\n // display.textContent = displayValue || \"0\";\n console.log(`click! ${this.id}`);\n\n if (firstNumberStore === undefined) {\n firstNumberStore = Number(displayValue);\n } else if (secondNumberStore === undefined) {\n secondNumberStore = Number(displayValue);\n } else {\n displayValue = operate(operandStore, firstNumberStore, secondNumberStore);\n display.textContent = displayValue;\n }\n}", "title": "" }, { "docid": "ff9b0f358fb066e5551dd2ef1053727c", "score": "0.6515152", "text": "function updateDisplay() {\n const display = document.querySelector(\".output-screen\");\n display.value = calculator.outputValue;\n}", "title": "" }, { "docid": "187a032b057d976eff128c190df1c381", "score": "0.6514343", "text": "function getButtonValue() {\n let buttonVal = event.target.value; //gets the value of clicked thing\n if (!isNaN(buttonVal) || buttonVal === \".\") number(buttonVal);\n else if (buttonVal === \"AC\") allClear();\n else if (buttonVal === \"CE\") clearEntry();\n else if (buttonVal === \"=\") calculate();\n else storeNumber(buttonVal)\n}", "title": "" }, { "docid": "82039ac3d30fd9e210f05ba56d504f1b", "score": "0.65085477", "text": "function setUpCalculator(){\n\n // Adds an event listen for all keyboard keys with a corresponding calculator input\n // Excludes AC, and +/- calculator buttons\n window.addEventListener('keypress', e => {\n // The pressed key is stored as the input\n const input = document.querySelector(`[data-key=\"${e.key}\"]`)\n \n // If the input is a num-input key populate the corresponding number into the display\n if(input.className == 'num-input'){\n input.classList.add('num-input-pressed')\n populate(input.textContent)\n }\n\n // If the input is an operator perform or select the operation depending on if an operation can already be performed\n else if(input.className == 'operator' ){\n // Performs a specific action depending on which operator was pressed\n switch(input.getAttribute('data-function')){\n case 'multiply':\n // Check to see if an operation can already be performed\n if(!canOperate()){\n storedValues.firstNum = parseFloat(display.textContent) \n canOverwriteDisp = true\n }\n // If an operation can already be performed, perform that operation in chaining mode \n else{\n storedValues.secondNum = parseFloat(display.textContent)\n operate(true)\n }\n // Select this operation and unselect all other operations\n storedValues.operation = multiply\n input.classList.add('operator-clicked')\n unselectOtherOperations()\n input.classList.add('operator-selected')\n break\n // Do the same for each other operation as in multiply \n case 'divide':\n if(!canOperate()){\n storedValues.firstNum = parseFloat(display.textContent) \n canOverwriteDisp = true\n }else{\n storedValues.secondNum = parseFloat(display.textContent)\n operate(true)\n }\n \n storedValues.operation = divide\n input.classList.add('operator-clicked')\n unselectOtherOperations()\n input.classList.add('operator-selected')\n break\n case 'subtract':\n if(!canOperate()){\n storedValues.firstNum = parseFloat(display.textContent) \n canOverwriteDisp = true\n }else{\n storedValues.secondNum = parseFloat(display.textContent)\n operate(true)\n }\n storedValues.operation = subtract\n input.classList.add('operator-clicked')\n unselectOtherOperations()\n input.classList.add('operator-selected')\n break\n case 'add':\n if(!canOperate()){\n storedValues.firstNum = parseFloat(display.textContent) \n canOverwriteDisp = true\n }else{\n storedValues.secondNum = parseFloat(display.textContent)\n operate(true)\n }\n \n storedValues.operation = add\n input.classList.add('operator-clicked')\n unselectOtherOperations()\n input.classList.add('operator-selected')\n break\n case 'equals':\n if(storedValues.operation != null){\n storedValues.secondNum = parseFloat(display.textContent) \n operate(false)\n }\n input.classList.add('operator-clicked')\n break \n }\n }\n })\n\n // Gets a list of all html elements corresponding to a keyboard key and removes the completed animation class from each of their classLists\n const keys = Array.from(document.querySelectorAll('[name=\"key\"]'))\n keys.forEach(key => {\n key.addEventListener('animationend', e =>{\n const baseClass = e.target.classList[0]\n e.target.classList.remove(baseClass + '-pressed',baseClass+\"-clicked\");\n })\n })\n \n // Gets a list of all num-input keys and adds a onclick event listener to each of them similar to the on press event listener\n let numButtons = Array.from(document.querySelectorAll('.num-input'))\n numButtons.forEach(button => {\n button.addEventListener('click', e => {\n e.target.classList.add('num-input-clicked')\n populate(e.target.textContent)\n })\n })\n\n // Adds functionality for the AC button on clicks\n document.querySelector('[data-function=\"clear\"]').addEventListener('click', e =>{\n e.target.classList.add('special-function-clicked')\n clear()\n })\n\n // Adds functionality for the +/- button on clicks\n document.querySelector('[data-function=\"negate\"]').addEventListener('click', e =>{\n e.target.classList.add('special-function-clicked')\n negate()\n })\n\n // Adds functionality for the % button on clicks\n document.querySelector('[data-function=\"percent\"]').addEventListener('click', e =>{\n e.target.classList.add('special-function-clicked')\n toPercent()\n })\n \n // Adds an on click event listener to all the operation buttons on the calculator similar to their corresponding keypress event listener functionality\n operationButtons.forEach(button => {\n switch(button.getAttribute('data-function')){\n case 'multiply':\n button.addEventListener('click', e => {\n if(!canOperate()){\n storedValues.firstNum = parseFloat(display.textContent) \n canOverwriteDisp = true\n }else{\n storedValues.secondNum = parseFloat(display.textContent)\n operate(true)\n }\n\n storedValues.operation = multiply\n button.classList.add('operator-clicked')\n unselectOtherOperations()\n button.classList.add('operator-selected')\n \n })\n break\n case 'divide':\n button.addEventListener('click', e => {\n if(!canOperate()){\n storedValues.firstNum = parseFloat(display.textContent) \n canOverwriteDisp = true\n }else{\n storedValues.secondNum = parseFloat(display.textContent)\n operate(true)\n }\n\n storedValues.operation = divide\n button.classList.add('operator-clicked')\n unselectOtherOperations()\n button.classList.add('operator-selected')\n })\n break\n case 'subtract':\n button.addEventListener('click', e => {\n if(!canOperate()){\n storedValues.firstNum = parseFloat(display.textContent) \n canOverwriteDisp = true\n }else{\n storedValues.secondNum = parseFloat(display.textContent)\n operate(true)\n }\n\n storedValues.operation = subtract\n button.classList.add('operator-clicked')\n unselectOtherOperations()\n button.classList.add('operator-selected')\n })\n break\n case 'add':\n button.addEventListener('click', e => {\n if(!canOperate()){\n storedValues.firstNum = parseFloat(display.textContent) \n canOverwriteDisp = true\n }else{\n storedValues.secondNum = parseFloat(display.textContent)\n operate(true)\n }\n\n storedValues.operation = add\n button.classList.add('operator-clicked')\n unselectOtherOperations()\n button.classList.add('operator-selected')\n })\n break\n case 'equals':\n button.addEventListener('click' , e => {\n if(storedValues.operation != null){\n storedValues.secondNum = parseFloat(display.textContent) \n operate(false)\n }\n button.classList.add('operator-clicked')\n })\n break \n }\n })\n}", "title": "" }, { "docid": "7ab267efa773243212deb6e2244af063", "score": "0.650754", "text": "function buttonClick(whatButton) {\n if(isNaN(whatButton)) {\n symbolRep(whatButton)\n } else {\n numberRep(whatButton)\n }\n render() //updates the screen with the render function declared bottom\n}", "title": "" }, { "docid": "0066e993c11d713640a15584fa49f972", "score": "0.64701265", "text": "function setValue(number){\n if(equalTo ===1){\n //if equal to button clicked or true\n clearButton();\n }\n if(flag == 0){\n num1+=number;\n //alert(num1); \n display.innerHTML+= number;\n }\n else{\n //operator button clicked\n num2+=number;\n display.innerHTML+=number;\n }\n if(num1.length > 10 || num2.length > 10)\n {\n display.innerHTML =\"MAX limit of digits reached\";\n }\n}", "title": "" }, { "docid": "a0a04ceb81bd8438b9437449bea580f4", "score": "0.6468693", "text": "function inputDigit(digit) {\n const { displayValue, waitingForSecondOperand } = calculator;\n // It operates when the user enters second operand value\n if (waitingForSecondOperand === true) {\n calculator.displayValue = digit;\n calculator.waitingForSecondOperand = false;\n }\n // It operates when the user enters first operand value(appending the digits, in case of more than one digit)\n else {\n\n calculator.displayValue = displayValue === '0' ? digit : displayValue + digit;\n }\n\n console.log(calculator);\n}", "title": "" }, { "docid": "36fe8d67a1b526b64713b3868fcf64ce", "score": "0.6459639", "text": "onInputClick(inputOnDisplay, inputForCalculation) {\n const input = inputForCalculation || inputOnDisplay;\n\n if (input === EVALUATE) {\n this.props.evaluateInputs();\n } else if (input === CLEAR) {\n this.props.clearInputs();\n } else if (input === PREV) {\n this.props.revertToPrevInputs();\n } else if (input === BACKSPACE) {\n this.props.removeInput();\n } else if (input === LEFT_ARROW) {\n this.props.moveCursor(-1);\n } else if (input === RIGHT_ARROW) {\n this.props.moveCursor(+1);\n } else if (input === RAD) {\n this.props.changeDegreeFormat(RADIANS);\n } else if (input === DEG) {\n this.props.changeDegreeFormat(DEGREES);\n } else {\n this.props.addInput(input);\n }\n }", "title": "" }, { "docid": "5aad419c6b7975d25e10144447f60a35", "score": "0.64444315", "text": "function clickHandler(number) {\n //Check if operation key was pressed before this\n if (lastPressed === 'add' || lastPressed === 'sub' || lastPressed === 'mul' || lastPressed === 'div') {\n //Wipe old display value and overwrite with new input\n if (inputValue[inputValue.length-1] !== '.') {\n inputValue = [];\n displayValue = 0;\n updateStoredOperator();\n }\n //If user inputs a decimal, allow it if there isn't one already\n if (number === '.') {\n if (inputValue.length === 0) {\n inputValue.push(0);\n }\n if (!inputValue.includes('.')) {\n inputValue.push(number);\n displayValue = inputValue.join('');\n }\n display.innerHTML = numberWithCommas(displayValue);\n lastPressed === '.';\n return;\n }\n }\n //Check if = was pressed before this\n else if (lastPressed === 'calc') {\n //Start a new calculation\n inputValue = [];\n newDisplayValue = displayValue; //Save for sub edge case\n displayValue = 0;\n storedValue = 0;\n stored.innerHTML = '';\n if (number === '.') {\n if (inputValue.length === 0) {\n inputValue.push(0);\n }\n if (!inputValue.includes('.')) {\n inputValue.push(number);\n displayValue = inputValue.join('');\n }\n display.innerHTML = numberWithCommas(displayValue);\n lastPressed = '.';\n return;\n }\n }\n //Check if user is just inputting a decimal, in which case add a leading 0.\n else if (number === '.') {\n if (inputValue.length === 0) {\n inputValue.push(0);\n }\n if (!inputValue.includes('.')) {\n inputValue.push(number);\n displayValue = inputValue.join('');\n }\n //Don't round, as it causes issues here\n display.innerHTML = numberWithCommas(displayValue);\n lastPressed = '.';\n return;\n }\n //Check if user is inputting multiple leading zeroes.\n else if (number === 0 && lastPressed === '.') {\n //Only allow an input of nine 0's after decimal\n if (inputValue.length < 11) {\n inputValue.push(0);\n displayValue = inputValue.join('');\n //Don't round, as it causes issues here\n display.innerHTML = numberWithCommas(displayValue);\n }\n return;\n }\n //Limit numbers to trillions place\n else if (inputValue.length > 12) {\n return;\n }\n else if (inputValue.includes('.')) {\n if (checkPrecisionOverflow()) return;\n }\n //Store input in displayValue\n else {\n displayValue[0] = number;\n }\n lastPressed = 'num';\n //Combine the input sequence into displayValue and display.\n inputValue.push(number);\n displayValue = inputValue.join('');\n displayValue = parseFloat(displayValue);\n \n updateDisplay();\n updatePrecisionColor('white');\n enableOperators();\n}", "title": "" }, { "docid": "aff7bc8bef1ee97fdb36817c56504f3e", "score": "0.644165", "text": "function Input_Digit(digit) {\n const {Display_Value, Wait_Second_Operand } = Calculator\n // We are checking to see if waitSecondOperand is true and\n // set display_value to the key that was clicked\n if (Wait_Second_Operand === true) {\n Calculator.Display_Value = digit;\n Calculator.Wait_Second_Operand = false;\n } else {\n Calculator.Display_Value = Display_Value === \"0\" ? digit : Display_Value + digit;\n }\n}", "title": "" }, { "docid": "efdd2b5f1dcddba5b169dd927d1ccba7", "score": "0.64401275", "text": "function pressedOperator() {\n console.log(this.name)\n actualOperation = this.name;\n visor.innerHTML = numIntroduced;\n divOperator.innerHTML = actualOperation;\n\n if (arrOperations.length === 0) {\n addNumberToArr(numIntroduced);\n }\n else {\n if (numIntroduced == '') {\n addNumberToArr(arrOperations[arrOperations.length - 1]);\n }\n else {\n arrOperations.push(+numIntroduced);\n }\n }\n}", "title": "" }, { "docid": "872483f76eaa84c05db162bcf22f265a", "score": "0.64317685", "text": "onOperandButtonPress(input) {\n\t\tswitch (this.state.inputState) {\n\t\t\tcase inputState.integer:\n\t\t\t\tthis.inputInteger(input);\n\t\t\t\tbreak;\n\t\t\tcase inputState.decimal:\n\t\t\t\tthis.inputDecimal(input);\n\t\t\t\tbreak;\n\t\t\tcase inputState.display:\n\t\t\t\tthis.clear();\n\t\t\t\tthis.inputInteger(input);\n\t\t\t\tbreak;\n\t\t}\n\t}", "title": "" }, { "docid": "b7b94a94b538cc531d5458f6116e1285", "score": "0.64270604", "text": "function onButtonClick(event) {\n\t\t// Cache target button and it's values\n\t\tvar $target = $(event.target);\n\t\tvar buttonValue = $target.text().toLowerCase();\n\t\tvar buttonCharCode = buttonValue.charCodeAt(0);\n\n\t\t// Replace operator's special charachter with a real operation\n\t\tif (buttonCharCode === 247) {\n\t\t\tbuttonValue = \"/\";\n\t\t} else if (buttonCharCode === 215) {\n\t\t\tbuttonValue = \"*\";\n\t\t}\n\n\t\t// Delegate button action\n\t\tif (buttonValue === \"c\") {\n\t\t\treset();\n\t\t} else if (buttonValue === \"=\") {\n\t\t\tcalculateValue();\n\t\t} else if (operators.indexOf(buttonValue) > -1) {\n\t\t\tsetOperator(buttonValue);\n\t\t} else {\n\t\t\tappendInput(buttonValue);\n\t\t}\n\t}", "title": "" }, { "docid": "85bdcd952ea1ae58c878ab69dc5fcc92", "score": "0.6418476", "text": "function operat(sign) {\n oprateSign = sign\n display.innerHTML = oprateSign\n}", "title": "" }, { "docid": "78feb80cad914dadf48aeb7c2ced1275", "score": "0.6414862", "text": "function button(x) {\n if(x != '=') {\n let numAdd = numList.push(x);\n let calDisplay = numList.join('');\n document.getElementById('calcDisplay').innerHTML = calDisplay;\n } else {\n let sumNum = numList.join('');\n let sumTotal = eval(sumNum);\n document.getElementById('calcDisplay').innerHTML = sumTotal;\n numList.length = 0;\n numList.push(sumTotal);\n }\n}", "title": "" }, { "docid": "ff1a98feee018aaa37bff0ed1f87b880", "score": "0.64106905", "text": "function getOperationButton(){\n let operation = $(this).attr('id');\n calculatorObject.operationInput = operation;\n //console.log(`operator selected:`, operation)\n //console.log(calculatorObject)\n}", "title": "" }, { "docid": "5b1f84e8cac9c4bff4e870be39c74b6b", "score": "0.6406341", "text": "function buttonClick(value) {\n if (isNaN(parseInt(value))) {\n //it is a symbol, do the function Symbol\n handleSymbol(value);\n } else {\n //it is a number, do the function Number\n handleNumber(value);\n }\n showOnScreen();\n console.log(\"running Total\", runningTotal);\n console.log(\"buffer\", buffer);\n}", "title": "" }, { "docid": "6d41768385a47e535f75cc5b85497c7c", "score": "0.6403799", "text": "function keyOperators(e){\n var key = e.target; \n var keyContent = key.value; \n \n var action = key.dataset.action; \n if(action ===\"add\"\n || action===\"minus\"||\n action ===\"divide\" ||\n action ===\"multiply\"||\n action === \"mod\"){ \n displayedNum = displayedNum + keyContent;\n display.innerHTML = displayedNum;\n }\n \n }", "title": "" }, { "docid": "ac8f507ea6013812ca9762e210d8220a", "score": "0.6402744", "text": "function displayOperation(){\n let display = \"\";\n\n operand.forEach((item,index)=>{\n display += `${item}`;\n if(operator[index]){\n display += ` ${operator[index]} `;\n }\n })\n\n operationsDisplay.textContent = display;\n}", "title": "" }, { "docid": "5169878adff1b58a3adefc6d327b6078", "score": "0.63996285", "text": "function clickOperator(op){\n\n // check if we already have a number in our memory\n // if so, calculate the number in memory with the one in our input string\n if(number) calc();\n\n // save current number into memory by transforming input string into number\n else number = (decimal) ? parseFloat(input) : parseInt(input);\n\n // set operator to +, -, *, or /\n operator = op;\n decimal = false;\n}", "title": "" }, { "docid": "ff46c3b39e475244e6342deb911ffd18", "score": "0.63986105", "text": "function onEqualButtonClick() {\n // TODO : Update comment\n // expressions ready ex) [1, +, ]\n if (expressions.length == 2) {\n expressions.push(currentNumber);\n\n // TODO : Is this right code?\n const result = calculate(expressions[0], expressions[1], expressions[2]);\n\n currentNumber = STRING_EMPTY;\n cleanExpressions();\n expressions.push(result);\n updateInputDisplay(result);\n isOperator = false;\n // TODO : Update Output\n }\n}", "title": "" }, { "docid": "cba68d18b09774161757fa5034e99d63", "score": "0.63960254", "text": "function btnNumPress() {\n const btnArray = document.querySelectorAll('.btnNum');\n\n btnArray.forEach((btn) => {\n btn.addEventListener('click', () => {\n // alert(btn.value);\n // A check to make sure number doesn't get too large for display\n getNumbersDisplay(btn.value);\n // calcDisplayText.textContent = btn.value;\n })\n })\n}", "title": "" }, { "docid": "c0841a38f30865a4e472cfd558027000", "score": "0.63946325", "text": "function operate() {\n if (equalPressed || !operandA || !operandCandidate) {\n return;\n }\n equalPressed = true;\n operandB = operandCandidate;\n // Truncate number to fit display\n let answer = calculate(operandA, operatorSymbol, operandB);\n answer = answer.toString().substring(0, displayWidth);\n updateDisplay(answer);\n\n // Reset variables and clear display\n operandCandidate = undefined;\n operandA = undefined;\n operandB = undefined;\n operatorSymbol = undefined;\n updateOperation(operatorSymbol);\n}", "title": "" }, { "docid": "bd0764da47a4abe6349845cb6625d1ad", "score": "0.63943857", "text": "function operate(){\n backspaceOn = false;\n makeNegativeOn = false;\n\n if(additionOn === true){\n secondNumber = Number(SCREEN.textContent);\n result = add(firstNumber,secondNumber);\n SCREEN.textContent = `= ${result}`;\n firstNumber = result;\n firstNumberOn = \"yes\"\n secondNumberOn = \"no\"\n additionOn = false;\n removeNumberButtonFunctionality();\n addAfterOperateButtonFunctionality();\n }\n if(subtractionOn === true){\n secondNumber = Number(SCREEN.textContent);\n result = subtract(firstNumber,secondNumber);\n SCREEN.textContent = `= ${result}`;\n firstNumber = result;\n firstNumberOn = \"yes\"\n secondNumberOn = \"no\"\n subtractionOn = false;\n removeNumberButtonFunctionality();\n addAfterOperateButtonFunctionality();\n } \n if(multiplicationOn === true){\n secondNumber = Number(SCREEN.textContent);\n result = multiply(firstNumber,secondNumber);\n SCREEN.textContent = `= ${result}`;\n firstNumber = result;\n firstNumberOn = \"yes\"\n secondNumberOn = \"no\"\n multiplicationOn = false;\n removeNumberButtonFunctionality();\n addAfterOperateButtonFunctionality();\n }\n if(divisionOn === true){\n secondNumber = Number(SCREEN.textContent);\n result = divide(firstNumber,secondNumber);\n SCREEN.textContent = `= ${result}`;\n firstNumber = result;\n firstNumberOn = \"yes\"\n secondNumberOn = \"no\"\n divisionOn = false;\n\n if (SCREEN.textContent === \"= Nice Try\"){\n removeAllButtonFunctionExceptClear();\n }else{\n removeNumberButtonFunctionality();\n addAfterOperateButtonFunctionality();\n }\n }\n}", "title": "" }, { "docid": "af8a1f7cf962d1f369d244b9a422450f", "score": "0.63926774", "text": "function operatorClicked(val){\n\n if(numbArray[0] === \"\"){\n return;\n }\n\n if(numbArray[1] !== ''){\n calculate();\n }\n displayText(val);\n index++;\n console.log(numbArray[0]);\n\n}", "title": "" }, { "docid": "61b886a3f30be73f8c4b88023fe8b22d", "score": "0.6389927", "text": "function listener(textContent) {\n const display = document.querySelector(\".display\");\n const val = textContent;\n if (!isNaN(val) || val == \".\") { //if foo is a number or \".\"\n if (display.textContent == output.result) {\n display.textContent = \"\";\n }\n\n // Set display limit to 10 characters\n if ((val == \".\" && display.textContent.includes(\".\")) || display.textContent.length >= 10) {\n display.textContent = display.textContent;\n } else {\n display.textContent += val;\n }\n } else if (val == \"+/-\") {\n if (display.textContent.includes(\"-\")) {\n display.textContent = display.textContent.slice(1);\n } else {\n display.textContent = \"-\".concat(display.textContent);\n }\n\n } else if (val == \"+\" || val == \"-\" || val == \"*\" || val == \"/\" || val == \"=\" || val == \"Enter\") {\n\n //Set operand1 to display text\n if (display.textContent.includes(\".\")) {\n output.operand1 = parseFloat(display.textContent);\n } else {\n output.operand1 = parseInt(display.textContent);\n }\n\n //calculate current result\n if (output.result == null) {\n output.result = output.operand1;\n } else {\n output.operand1 = operate(output.result, output.operand1, output.operation);\n if ((output.operand1.toString().length >= 10)) {\n output.result = output.operand1.toPrecision(10);\n } else {\n output.result = output.operand1;\n }\n display.textContent = output.result;\n }\n console.log(`operand1 = ${output.operand1}`);\n console.log(`operation = ${output.operation}`);\n console.log(`result = ${output.result}`);\n\n //store operation\n if (val != \"=\") { output.operation = val; }\n\n if (val == \"=\" || val == \"Enter\") {\n display.textContent = output.result;\n output.operand1 = output.result;\n output.result = null;\n }\n }\n\n // Clear all user data\n if (val == \"AC\") {\n output.operand1 = null;\n output.operation = \"\";\n output.result = null;\n display.textContent = \"\";\n }\n}", "title": "" }, { "docid": "89ed4065fd860cb8b7978eea47bded57", "score": "0.6373087", "text": "function displayVal() {\n var calButtonArr = document.getElementsByClassName(\"calButton\");\n for (var i = 0, len = calButtonArr.length; i < len; i++) {\n calButtonArr[i].addEventListener(\"click\", function returnValue(e) {\n var disNow = e.currentTarget.getElementsByTagName(\"span\")[0].innerHTML;\n //when input num display num rather than displaying \"0\"+num;\n if (distxtval.innerHTML === \"0\" && disNow !== \"AC\" && disNow !== '.') {\n distxtval.innerHTML = e.currentTarget.getElementsByTagName(\"span\")[0].innerHTML;\n }\n //not the 1st time input value\n else {\n var regEx = /[+\\-*/]/gi;\n var dotreg = /[.]/gi;\n //when press AC set the screen as 0;\n if (disNow === \"AC\") {\n distxtval.innerHTML = 0;\n return false;\n }\n //when press \"=\" calculator the answer;\n else if (disNow === \"%\") {\n distxtval.innerHTML = (distxtval.innerHTML * 100).toFixed(2) + \"%\";\n }\n else if (disNow === \"+/-\") {\n distxtval.innerHTML = 0 - distxtval.innerHTML;\n }\n else if (disNow === \"=\") {\n distxtval.innerHTML = eval(distxtval.innerHTML);\n }\n //the part before the \"||\" is used to unqiue the symbol \"+-*/\" and the another part is to unique the dot;\n else if (regEx.test(disNow) && disNow === distxtval.innerHTML[distxtval.innerHTML.length - 1] || (dotreg.test(distxtval.innerHTML) && disNow === \".\")) {\n distxtval.innerHTML = distxt.innerHTML;\n }\n else if(disNow !== \"=\") {\n distxtval.innerHTML = distxt.innerHTML + disNow;\n }\n }\n }, false);\n }\n}", "title": "" }, { "docid": "dbc12b16507d202a38c36c00eb8886bb", "score": "0.636661", "text": "function operandClick(operation)\n{\n let currentDisplay = parseFloat(document.getElementById('result').innerHTML)\n //Saves the number\n if(!firstNumber || currentDisplay == 0)\n savedNumber += currentDisplay;\n \n //Determine the operation\n state = operation; \n\n //The next number will be the first in the sequence\n firstNumber = true;\n\n if(savedNumber.toString().length > 7)\n {\n savedNumber = savedNumber.toExponential(3);\n }\n document.getElementById('result').innerHTML = savedNumber;\n\n}", "title": "" }, { "docid": "8feb7f09c63ebaffffbd8d1cb27e900c", "score": "0.63651794", "text": "function buttonClick(value){\r\n console.log(value);\r\n if(isNaN(parseFloat(value))){\r\n calc.operator(value);\r\n }else{\r\n calc.number(value);\r\n }\r\n}", "title": "" }, { "docid": "4c1ec0f0bb9122192789ac657c9f3407", "score": "0.63635457", "text": "function handleSymbol(symbol) {\n switch(symbol) {\n case 'C':\n // cancel button\n // input and currentTotal reset\n input = \"0\";\n currentTotal = 0;\n break;\n\n case '=':\n // equals button \n if (previousOperator === null) {\n // no operator in the current input -> nothing to calculate\n return;\n }\n\n // else: do calculations with the given input\n calculateResult(input);\n\n // display answer\n // -> displaying is handled by buttonClick\n // -> updating the input to the result, which would be the currentTotal\n input = currentTotal;\n\n // reseting previousOperator and currentTotal\n previousOperator = null;\n currentTotal = \"0\";\n break;\n \n case '←':\n // delete button\n if (input.length === 1) {\n // when user has only selected one number and then presses delete\n // -> reset input \n input = '0'\n } else {\n // remove last added digit\n input = input.substring(0, input.length - 1);\n }\n break;\n \n case '+':\n case '−':\n case '×':\n case '÷':\n calculateOperator(symbol);\n break;\n }\n}", "title": "" }, { "docid": "116e3ef8129ba69f752a4bae886acd00", "score": "0.636348", "text": "function number () {\n\n if (!isNaN(enterNumber.value) && enterNumber.value > 0 && enterNumber.value < 6) {\n\n userNumber = parseInt(enterNumber.value);\n userNumberMessage.innerHTML = userNumber;\n\n test2 = true;\n\n if (test1) {\n formBox.innerHTML = \"<button onclick=\\\"calculator()\\\">Play</button><button onclick=\\\"reset()\\\">Reset</button>\";\n }\n\n }\n\n}", "title": "" }, { "docid": "03cb9c2ae9eda3e563b9496d20c35093", "score": "0.635745", "text": "function numberButton(num) {\n if(resultValue) {\n newValue = num;\n resultValue = \"\";\n } else {\n // Prevent multiple decimals\n if(num === '.'){\n if(decimalClicked != true){\n newValue += num;\n decimalClicked = true;\n }\n } else {\n newValue += num;\n }\n }\n document.getElementById(\"entry\").value = newValue;\n}", "title": "" }, { "docid": "cce79dec48d23cf6d9115093928c112a", "score": "0.6348188", "text": "function Input_Digit(digit) {\n const { Display_Value, Wait_Second_Operand } = Calculator;\n // we are checking to see if Wait_Second_Operand is true and set\n // Display_Value to the key that was clicked.\n if (Wait_Second_Operand === true) {\n Calculator.Display_Value = digit;\n Calculator.Wait_Second_Operand = false;\n } else {\n //this overwrites Display_Value if the current value is 0\n // otherwise it adds onto it\n Calculator.Display_Value = Display_Value === '0' ? digit : Display_Value + digit;\n }\n}", "title": "" }, { "docid": "79725992c2e7f2d9110ad9e7e372b673", "score": "0.6345817", "text": "function btnClicked(e) {\n\n // Stores value of the button clicked\n let btnClicked = e.target.value;\n\n // If C is clicked everythig gets cleared\n if(btnClicked === 'c') {\n calculationField.innerText = '0';\n totalResult = 0;\n calculationsArray = [];\n numberClicked = [];\n numberClickedSecond = [];\n active = true;\n //If a number is clicked we print it out and stores the values in array and join the to one. \n }else if(btnClicked === '0' || btnClicked === '1' || btnClicked === '2' || btnClicked === '3' || btnClicked === '4' || btnClicked === '5' || btnClicked === '6' || btnClicked === '7' || btnClicked === '8' || btnClicked === '9' || btnClicked === '.' ) {\n\n\n // Checks if desimal is clicked\n if(btnClicked === '.'){\n //Push decimal to numberClicked\n numberClicked.push(btnClicked);\n //Prints out number clicked + decimal\n calculationField.innerText = joinedNumbers + '.';\n }else{\n //Push each number to numberClicked\n numberClicked.push(btnClicked);\n //Join numbers to one integer\n joinedNumbers = +numberClicked.join('');\n //Prints out numbers clicked\n calculationField.innerText = joinedNumbers;\n }\n\n // Adds latest number and clicked operators to calculationArray \n } else if(btnClicked === \"+\" || btnClicked === \"-\" || btnClicked === \"x\" || btnClicked === \"/\"){\n //Clears numbersClicked\n numberClicked = [];\n //Push joinNumbers to CalculateArray\n calculationsArray.push(joinedNumbers);\n //Clears joinedNumbers\n joinedNumbers = [];\n //Adds operator to calculationsArray\n calculationsArray.push(btnClicked);\n //Print out the operator to field\n calculationField.innerText = btnClicked;\n \n // Goes thru the calculationsArray and calculate all the number depending on operator in array \n } else if(btnClicked === '=') {\n //Adds last number input to calculationsArray\n calculationsArray.push(joinedNumbers);\n //Clears numberClicked\n numberClicked = [];\n //Adds first number value in calculationArray to totalResult\n totalResult = calculationsArray[0];\n\n //Loops thru numbers and operators and store it in totalResult.\n for (let i = 0; i < calculationsArray.length; i++) {\n\n if(calculationsArray[i] === '+'){\n console.log('Operator',calculationsArray[i]);\n totalResult += calculationsArray[i +1]\n } else if(calculationsArray[i] === '-'){\n console.log('Operator',calculationsArray[i]);\n totalResult -= calculationsArray[i +1]\n } else if(calculationsArray[i] === 'x'){\n console.log('Operator',calculationsArray[i]);\n totalResult *= calculationsArray[i +1]\n } else if(calculationsArray[i] === '/'){\n console.log('Operator',calculationsArray[i]);\n totalResult /= calculationsArray[i +1]\n } \n \n }\n // Check if totalResult is number without decimal\n if (totalResult == Math.floor(totalResult)) {\n //Prints out result without decimal.\n calculationField.innerText = totalResult\n }else {\n //Print out result in field with maximum 2 numbers after decimal\n calculationField.innerText = totalResult.toFixed(2);\n }\n } \n}", "title": "" }, { "docid": "6bde6ebaf1692fce66f01c06a3ff201e", "score": "0.63444847", "text": "function updateDisplay() {\n const display = document.querySelector('.calculator-screen');\n display.value = calculator.displayValue;\n}", "title": "" }, { "docid": "d9a1f78779217b0ebfa64f8a60ec5967", "score": "0.6340753", "text": "function equalsPressed() {\n\tlet lastInput = getInput();\n\toperationArray.push(lastInput);\n\tif (operationArray.length == 0 || storedInput.innerHTML.includes('=')) {\n\t\tstoredInput.innerHTML = lastInput + '=';\n\t\toperationArray = [];\n\t\treturn;\n\t}\n\tstoredInput.innerHTML = storedInput.innerHTML + lastInput + '=';\n\t// Do multiplication and division.\n\twhile (operationArray.includes('*') || operationArray.includes('/')) {\n\t\tlet nextOperationIndex = operationArray.findIndex((a) => {\n\t\t\treturn (a == '*') || (a == '/'); \n\t\t})\n\t\tlet newOutput = 0;\n\t\tif (operationArray[nextOperationIndex] == '*') {\n\t\t\tnewOutput = multiply(Number(operationArray[nextOperationIndex - 1]),\n\t\t\t\tNumber(operationArray[nextOperationIndex + 1]));\n\t\t}\n\t\telse {\n\t\t\tif (Number(operationArray[nextOperationIndex + 1]) == 0) {\n\t\t\t\talert(\"Hey you! Don't divide by zero, guy!\");\n\t\t\t\tclearEntryPressed();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tnewOutput = divide(Number(operationArray[nextOperationIndex - 1]),\n\t\t\t\tNumber(operationArray[nextOperationIndex + 1]));\n\t\t}\n\t\toperationArray.splice(nextOperationIndex - 1, 3, String(newOutput));\n\t}\n\t// Do addition and subtraction.\n\twhile (operationArray.includes('+') || operationArray.includes('-')) {\n\t\tlet nextOperationIndex = operationArray.findIndex((a) => {\n\t\t\treturn (a == '+') || (a == '-'); \n\t\t})\n\t\tlet newOutput = 0;\n\t\tif (operationArray[nextOperationIndex] == '+') {\n\t\t\tnewOutput = add(Number(operationArray[nextOperationIndex - 1]),\n\t\t\t\tNumber(operationArray[nextOperationIndex + 1]));\n\t\t}\n\t\telse {\n\t\t\tnewOutput = subtract(Number(operationArray[nextOperationIndex - 1]),\n\t\t\t\tNumber(operationArray[nextOperationIndex + 1]));\n\t\t}\n\t\toperationArray.splice(nextOperationIndex - 1, 3, String(newOutput));\n\t}\n\t// Display output (or error if program messes up - shouldn't happen).\n\tif (operationArray.length > 1) {\n\t\talert(\"ERROR - Math didn't parse correctly!\");\n\t\tclearEntryPressed();\n\t\treturn;\n\t}\n\tcurrentInput.innerHTML = operationArray[0];\n\toperationArray = [];\n}", "title": "" }, { "docid": "e9cfc8baf9364211fd57ad2064f88303", "score": "0.6338932", "text": "function answer() {\n x = box.value;\n x = eval(x); //Evaluate String. Simply means do the math for each button string parameter.\n box.value = x;\n}", "title": "" }, { "docid": "7bfdc6ac5b70fa549ee89995d3bf3c9d", "score": "0.6335626", "text": "function askForOperator() {\r\n calcInterface.question('Enter operation (+-*/, q to quit): ', userInput => { \r\n calculateLogic(userInput); \r\n });\r\n}", "title": "" }, { "docid": "a149e9983d9ea55a1b3aa1f5b4b96565", "score": "0.63238525", "text": "function addTxt(){\r\n var targ = event.target || event.srcElement;\r\n var targCont = targ.textContent||targ.innerText;\r\n var currCont = document.getElementById(\"textArea\").value;\r\n //Validation if '=' selected from the buttons\r\n if(targCont === '='){\r\n calculateTot();\r\n document.getElementById(\"textArea\").focus();\r\n return; // To not go further if '=' is clicked returning the function\r\n }\r\n if(targCont === 'CLR'){\r\n document.getElementById(\"textArea\").value = '';\r\n document.getElementById(\"textArea\").focus();\r\n }\r\n else{\r\n //Validation for button input of special characters +,-,÷,×\r\n if(targCont === '+' || targCont === '-' || targCont === '\\u00F7' || targCont === '\\u00D7' || targCont === 'modulus'){\r\n if(currCont === '' && targCont === '-')\r\n document.getElementById(\"textArea\").value += targ.textContent || targ.innerText;\r\n if(currCont != '' && (currCont[currCont.length-1] != '+') && (currCont[currCont.length-1] != '-') && (currCont[currCont.length-1] != '\\u00F7') && (currCont[currCont.length-1] != '\\u00D7') && (currCont[currCont.length-1] != '%') &&(currCont[currCont.length-1] != '.')){\r\n if(targCont != 'modulus')\r\n document.getElementById(\"textArea\").value += targ.textContent || targ.innerText;\r\n else\r\n document.getElementById(\"textArea\").value += '%'\r\n }\r\n //Validation if input is a symbol and the current last char is '.'\r\n if(currCont[currCont.length-1] == '.'){\r\n let temp = [];\r\n for(let i=0;i<currCont.length-1;i++){\r\n temp.push(currCont[i]);\r\n }\r\n if(targCont != 'modulus')\r\n document.getElementById(\"textArea\").value = temp.join('') + targCont;\r\n else\r\n document.getElementById(\"textArea\").value = temp.join('') + '%';\r\n }\r\n }\r\n else{\r\n //Validation for button input of '.'\r\n if(targCont === '.'){\r\n if(currCont === '0'){\r\n document.getElementById(\"textArea\").value += targ.textContent || targ.innerText;\r\n }\r\n else{\r\n if(currCont != '' && (currCont[currCont.length-1] != '+') && (currCont[currCont.length-1] != '-') && (currCont[currCont.length-1] != '\\u00F7') && (currCont[currCont.length-1] != '\\u00D7') && (currCont[currCont.length-1] != '%') && (currCont[currCont.length-1] != '.')){\r\n let i;\r\n for(i=0;i<currCont.length;i++){\r\n if((currCont[currCont.length-1-i] === '+') || (currCont[currCont.length-1-i] === '-') || (currCont[currCont.length-1-i] === '\\u00F7') || (currCont[currCont.length-1-i] === '\\u00D7') || (currCont[currCont.length-1-i] === '%')){\r\n console.log(currCont[currCont.length-1-i])\r\n document.getElementById(\"textArea\").value += targ.textContent || targ.innerText;\r\n break;\r\n }\r\n if((currCont[currCont.length-1-i] === '.'))\r\n break; \r\n }\r\n if(!currCont[currCont.length-1-i])\r\n document.getElementById(\"textArea\").value += targ.textContent || targ.innerText;\r\n }\r\n }\r\n }\r\n else{\r\n //Validation for button input of 0\r\n if(targCont === '0'){\r\n if(currCont === ''){\r\n document.getElementById(\"textArea\").value += targ.textContent || targ.innerText;\r\n }\r\n else{\r\n if(currCont[currCont.length-1] === '0'){\r\n for(let i=0;i<currCont.length;i++){\r\n if((currCont[currCont.length-1-i] === '+') || (currCont[currCont.length-1-i] === '-') || (currCont[currCont.length-1-i] === '\\u00F7') || (currCont[currCont.length-1-i] === '\\u00D7') || (currCont[currCont.length-1-i] === '%')){\r\n break;\r\n }\r\n console.log(parseInt(currCont[currCont.length-1-i]));\r\n if((currCont[currCont.length-1-i] === '.') || parseInt(currCont[currCont.length-1-i])){\r\n document.getElementById(\"textArea\").value += targ.textContent || targ.innerText;\r\n break;\r\n }\r\n }\r\n }\r\n else{\r\n document.getElementById(\"textArea\").value += targ.textContent || targ.innerText;\r\n }\r\n } \r\n }\r\n else{\r\n //validation to remove unecessary zeroes while entering a non-zero digit\r\n if(currCont === '0' ){\r\n document.getElementById(\"textArea\").value = targ.textContent || targ.innerText;\r\n }\r\n else{\r\n if((currCont[currCont.length-1] === '0') && (currCont[currCont.length-2] === '+' || currCont[currCont.length-2] === '-' || currCont[currCont.length-2] === '\\u00F7' || currCont[currCont.length-2] === '\\u00D7' || currCont[currCont.length-2] === '%')){\r\n console.log(\"going\")\r\n let temp = [];\r\n for(let i=0;i<currCont.length-1;i++){\r\n temp.push(currCont[i]);\r\n }\r\n document.getElementById(\"textArea\").value = temp.join('') + targCont;\r\n }\r\n else{\r\n document.getElementById(\"textArea\").value += targ.textContent || targ.innerText;\r\n }\r\n }\r\n }\r\n \r\n }\r\n }\r\n \r\n document.getElementById(\"textArea\").focus();\r\n }\r\n \r\n}", "title": "" }, { "docid": "6a28e43adc4032c16733b99813426be1", "score": "0.632064", "text": "function displayNumber(e){\n if(pushOperator){\n setDisplay( e.currentTarget.childNodes[0].innerHTML); \n setPushOperator(false);\n } else {\n setDisplay(display + e.currentTarget.childNodes[0].innerHTML); \n }\n }", "title": "" } ]
130345654baca4cd9cd8b1b4f18940ad
Remove all listeners on the transport and on self
[ { "docid": "bf7c6a8f0534670505719757b8aee6aa", "score": "0.75297624", "text": "function cleanup() {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" } ]
[ { "docid": "495acb0fee59a10e102fc8320f847fb3", "score": "0.7635474", "text": "function cleanup(){\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "495acb0fee59a10e102fc8320f847fb3", "score": "0.7635474", "text": "function cleanup(){\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "495acb0fee59a10e102fc8320f847fb3", "score": "0.7635474", "text": "function cleanup(){\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "495acb0fee59a10e102fc8320f847fb3", "score": "0.7635474", "text": "function cleanup(){\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "495acb0fee59a10e102fc8320f847fb3", "score": "0.7635474", "text": "function cleanup(){\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "495acb0fee59a10e102fc8320f847fb3", "score": "0.7635474", "text": "function cleanup(){\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "495acb0fee59a10e102fc8320f847fb3", "score": "0.7635474", "text": "function cleanup(){\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "495acb0fee59a10e102fc8320f847fb3", "score": "0.7635474", "text": "function cleanup(){\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "495acb0fee59a10e102fc8320f847fb3", "score": "0.7635474", "text": "function cleanup(){\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "495acb0fee59a10e102fc8320f847fb3", "score": "0.7635474", "text": "function cleanup(){\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "495acb0fee59a10e102fc8320f847fb3", "score": "0.7635474", "text": "function cleanup(){\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "495acb0fee59a10e102fc8320f847fb3", "score": "0.7635474", "text": "function cleanup(){\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "b92cace361b8f032d1774c31ae0a481c", "score": "0.7556297", "text": "function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "8fcbbac837bc1f258464a0b92b4459d6", "score": "0.7545886", "text": "function cleanup() {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "8fcbbac837bc1f258464a0b92b4459d6", "score": "0.7545886", "text": "function cleanup() {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "29cfb9c7c97973350ca1d252a887209e", "score": "0.7538333", "text": "function cleanup(){\r\n\t transport.removeListener('open', onTransportOpen);\r\n\t transport.removeListener('error', onerror);\r\n\t transport.removeListener('close', onTransportClose);\r\n\t self.removeListener('close', onclose);\r\n\t self.removeListener('upgrading', onupgrade);\r\n\t }", "title": "" }, { "docid": "07a7cc7c898675ac690753d61d1d11f0", "score": "0.7496292", "text": "function cleanup() {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }", "title": "" }, { "docid": "512a83d21b8b6342ff93b56f5a7ad1d0", "score": "0.74889475", "text": "function cleanup(){\n\t transport.removeListener('open', onTransportOpen);\n\t transport.removeListener('error', onerror);\n\t transport.removeListener('close', onTransportClose);\n\t self.removeListener('close', onclose);\n\t self.removeListener('upgrading', onupgrade);\n\t }", "title": "" }, { "docid": "512a83d21b8b6342ff93b56f5a7ad1d0", "score": "0.74889475", "text": "function cleanup(){\n\t transport.removeListener('open', onTransportOpen);\n\t transport.removeListener('error', onerror);\n\t transport.removeListener('close', onTransportClose);\n\t self.removeListener('close', onclose);\n\t self.removeListener('upgrading', onupgrade);\n\t }", "title": "" }, { "docid": "512a83d21b8b6342ff93b56f5a7ad1d0", "score": "0.74889475", "text": "function cleanup(){\n\t transport.removeListener('open', onTransportOpen);\n\t transport.removeListener('error', onerror);\n\t transport.removeListener('close', onTransportClose);\n\t self.removeListener('close', onclose);\n\t self.removeListener('upgrading', onupgrade);\n\t }", "title": "" }, { "docid": "512a83d21b8b6342ff93b56f5a7ad1d0", "score": "0.74889475", "text": "function cleanup(){\n\t transport.removeListener('open', onTransportOpen);\n\t transport.removeListener('error', onerror);\n\t transport.removeListener('close', onTransportClose);\n\t self.removeListener('close', onclose);\n\t self.removeListener('upgrading', onupgrade);\n\t }", "title": "" }, { "docid": "512a83d21b8b6342ff93b56f5a7ad1d0", "score": "0.74889475", "text": "function cleanup(){\n\t transport.removeListener('open', onTransportOpen);\n\t transport.removeListener('error', onerror);\n\t transport.removeListener('close', onTransportClose);\n\t self.removeListener('close', onclose);\n\t self.removeListener('upgrading', onupgrade);\n\t }", "title": "" }, { "docid": "512a83d21b8b6342ff93b56f5a7ad1d0", "score": "0.74889475", "text": "function cleanup(){\n\t transport.removeListener('open', onTransportOpen);\n\t transport.removeListener('error', onerror);\n\t transport.removeListener('close', onTransportClose);\n\t self.removeListener('close', onclose);\n\t self.removeListener('upgrading', onupgrade);\n\t }", "title": "" }, { "docid": "512a83d21b8b6342ff93b56f5a7ad1d0", "score": "0.74889475", "text": "function cleanup(){\n\t transport.removeListener('open', onTransportOpen);\n\t transport.removeListener('error', onerror);\n\t transport.removeListener('close', onTransportClose);\n\t self.removeListener('close', onclose);\n\t self.removeListener('upgrading', onupgrade);\n\t }", "title": "" }, { "docid": "318f4633abf25337fdc4f898231e3ab0", "score": "0.74821204", "text": "function cleanup() {\n transport.removeListener(\"open\", onTransportOpen);\n transport.removeListener(\"error\", onerror);\n transport.removeListener(\"close\", onTransportClose);\n self.removeListener(\"close\", onclose);\n self.removeListener(\"upgrading\", onupgrade);\n }", "title": "" }, { "docid": "318f4633abf25337fdc4f898231e3ab0", "score": "0.74821204", "text": "function cleanup() {\n transport.removeListener(\"open\", onTransportOpen);\n transport.removeListener(\"error\", onerror);\n transport.removeListener(\"close\", onTransportClose);\n self.removeListener(\"close\", onclose);\n self.removeListener(\"upgrading\", onupgrade);\n }", "title": "" }, { "docid": "318f4633abf25337fdc4f898231e3ab0", "score": "0.74821204", "text": "function cleanup() {\n transport.removeListener(\"open\", onTransportOpen);\n transport.removeListener(\"error\", onerror);\n transport.removeListener(\"close\", onTransportClose);\n self.removeListener(\"close\", onclose);\n self.removeListener(\"upgrading\", onupgrade);\n }", "title": "" }, { "docid": "e38e9b2ac3ffeb67ee1fad447ff94050", "score": "0.7448759", "text": "destroy() {\n // Remove all listeners from the client\n for (const [event, listener] of this.listeners) this.client.removeListener(event, listener);\n this.listeners.clear();\n }", "title": "" }, { "docid": "9c21882ac8b1f6a1dd9ac2386bc2f866", "score": "0.7440551", "text": "function cleanup () {\n\t transport.removeListener('open', onTransportOpen);\n\t transport.removeListener('error', onerror);\n\t transport.removeListener('close', onTransportClose);\n\t self.removeListener('close', onclose);\n\t self.removeListener('upgrading', onupgrade);\n\t }", "title": "" }, { "docid": "9c21882ac8b1f6a1dd9ac2386bc2f866", "score": "0.7440551", "text": "function cleanup () {\n\t transport.removeListener('open', onTransportOpen);\n\t transport.removeListener('error', onerror);\n\t transport.removeListener('close', onTransportClose);\n\t self.removeListener('close', onclose);\n\t self.removeListener('upgrading', onupgrade);\n\t }", "title": "" }, { "docid": "9c21882ac8b1f6a1dd9ac2386bc2f866", "score": "0.7440551", "text": "function cleanup () {\n\t transport.removeListener('open', onTransportOpen);\n\t transport.removeListener('error', onerror);\n\t transport.removeListener('close', onTransportClose);\n\t self.removeListener('close', onclose);\n\t self.removeListener('upgrading', onupgrade);\n\t }", "title": "" }, { "docid": "9c21882ac8b1f6a1dd9ac2386bc2f866", "score": "0.7440551", "text": "function cleanup () {\n\t transport.removeListener('open', onTransportOpen);\n\t transport.removeListener('error', onerror);\n\t transport.removeListener('close', onTransportClose);\n\t self.removeListener('close', onclose);\n\t self.removeListener('upgrading', onupgrade);\n\t }", "title": "" }, { "docid": "9c21882ac8b1f6a1dd9ac2386bc2f866", "score": "0.7440551", "text": "function cleanup () {\n\t transport.removeListener('open', onTransportOpen);\n\t transport.removeListener('error', onerror);\n\t transport.removeListener('close', onTransportClose);\n\t self.removeListener('close', onclose);\n\t self.removeListener('upgrading', onupgrade);\n\t }", "title": "" }, { "docid": "9c21882ac8b1f6a1dd9ac2386bc2f866", "score": "0.7440551", "text": "function cleanup () {\n\t transport.removeListener('open', onTransportOpen);\n\t transport.removeListener('error', onerror);\n\t transport.removeListener('close', onTransportClose);\n\t self.removeListener('close', onclose);\n\t self.removeListener('upgrading', onupgrade);\n\t }", "title": "" }, { "docid": "9c21882ac8b1f6a1dd9ac2386bc2f866", "score": "0.7440551", "text": "function cleanup () {\n\t transport.removeListener('open', onTransportOpen);\n\t transport.removeListener('error', onerror);\n\t transport.removeListener('close', onTransportClose);\n\t self.removeListener('close', onclose);\n\t self.removeListener('upgrading', onupgrade);\n\t }", "title": "" }, { "docid": "9d4fe4c8c93ad4f40531971f96370c23", "score": "0.74392813", "text": "function cleanup() {\n\t transport.removeListener('open', onTransportOpen);\n\t transport.removeListener('error', onerror);\n\t transport.removeListener('close', onTransportClose);\n\t self.removeListener('close', onclose);\n\t self.removeListener('upgrading', onupgrade);\n\t }", "title": "" }, { "docid": "e26fa727101bf56e0a720868b2cf456c", "score": "0.73922676", "text": "clearListeners() {\n messageListeners.length = 0;\n }", "title": "" }, { "docid": "ea166f1a133468aeb7b15ed66cc6da0f", "score": "0.73668474", "text": "unlistenAll() {\n super.unlistenAll();\n }", "title": "" }, { "docid": "ea166f1a133468aeb7b15ed66cc6da0f", "score": "0.73668474", "text": "unlistenAll() {\n super.unlistenAll();\n }", "title": "" }, { "docid": "1bc8ec175cea8108a92a95acf651f210", "score": "0.7206409", "text": "revoke() {\n this.removeListeners();\n }", "title": "" }, { "docid": "970ccadf8958635555e387a6c52dbbf6", "score": "0.7192923", "text": "deregisterListeners() {\n this.eventManager.clearEvents(true);\n }", "title": "" }, { "docid": "17c73cd6c7b93ac18940a92c85334a49", "score": "0.717525", "text": "destroy() {\n this.socket.removeAllListeners('close');\n this.socket.removeAllListeners('connect');\n this.socket.removeAllListeners('data');\n this.socket.removeAllListeners('error');\n this.socket.destroy();\n this.id = null;\n this.socket = null;\n }", "title": "" }, { "docid": "4dec6b4a707e0593599b874e195292d4", "score": "0.7167753", "text": "clearListeners() {\n\t\tvar listeners = this.listeners, i = listeners.length;\n\n\t\twhile (i--) {\n\t\t\tthis.removeListener(listeners[i].fn, listeners[i].scope);\n\t\t}\n\t}", "title": "" }, { "docid": "1fba14e953b14b945b0a8488d9c264c9", "score": "0.7113848", "text": "removeAllListeners() {\r\n this.listeners = [];\r\n }", "title": "" }, { "docid": "81a5b549dfd8e268987cecfbcc9e79e1", "score": "0.7094811", "text": "onDestroy() {\n for(var topic in this.listeners) {\n this.removeTopic(topic);\n }\n super.onDestroy();\n }", "title": "" }, { "docid": "9c13b6d503f788ffdb28bb3dc3b466e5", "score": "0.7090372", "text": "destroy () {\n for (const event in this.events) {\n this.events[event] = {}\n }\n this.forEach(listener => {\n if (typeof listener.unload === 'function') {\n listener.unload()\n }\n listener = null\n })\n this.clear()\n return this\n }", "title": "" }, { "docid": "08ae39d0cedc3a2898f13ee1cf579d80", "score": "0.7039201", "text": "clearAll() {\n\n for (const listenerList of this.onListeners.values()) {\n listenerList.clearAll();\n }\n this.onListeners.clear();\n\n\n for (const listenerMap of this.onlyListeners.values()) {\n listenerMap.clearAll();\n }\n this.onlyListeners.clear();\n\n\n this.childEventEmitters = [];\n\n this.onAnyListener=null;\n }", "title": "" }, { "docid": "41fc10b6975e27effa4135fd7713fcb7", "score": "0.70215356", "text": "cleanup() {\n logger_1.default.system.info(\"WindowEventManager.cleanup\", this.windowName);\n //removes listeners added to the event emitter.\n this.removeAllListeners();\n //removes listeners added to the RouterClient.\n let eventSubscriptions = Object.keys(this.remoteEventSubscriptions);\n logger_1.default.system.info(\"WRAP CLOSE. WindowEventManager.cleanup. Removing router subscriptions\", this.windowName, eventSubscriptions);\n eventSubscriptions.forEach(channelName => {\n let handlers = this.remoteEventSubscriptions[channelName];\n handlers.forEach(handler => {\n routerClientInstance_1.default.removeListener(channelName, handler);\n });\n });\n }", "title": "" }, { "docid": "a906af9d61e14a914395d20fc3768171", "score": "0.7007859", "text": "destroy() { // eslint-disable-line class-methods-use-this\n for (let i = 0; i < listeners.length; i += 1) {\n const listener = listeners[i];\n listener.destroy();\n }\n }", "title": "" }, { "docid": "df7e6d6c7bfc36572114ecc5a4374ca2", "score": "0.6989741", "text": "removeListeners() {\n\n const removeListeners = el => {\n\n if (this.el.listeners) {\n\n el.listeners.forEach(listener => {\n const { type, eventHandler, opts } = listener;\n el.removeEventListener(type, eventHandler, opts);\n });\n\n el.listeners.splice(0); // empty the array without redeclaring it\n\n }\n\n };\n\n removeListeners(this.el);\n\n for (const el in this.nodes) {\n removeListeners(this.nodes[el]);\n }\n\n this.emit('removeListeners');\n\n }", "title": "" }, { "docid": "c0726ad84c4dc6656ddfb416b8340369", "score": "0.6959289", "text": "clearTransport() {\n let cleanup;\n const toCleanUp = this.cleanupFn.length;\n for (let i = 0; i < toCleanUp; i++) {\n cleanup = this.cleanupFn.shift();\n cleanup();\n }\n // silence further transport errors and prevent uncaught exceptions\n this.transport.on(\"error\", function () {\n debug(\"error triggered by discarded transport\");\n });\n // ensure transport won't stay open\n this.transport.close();\n (0, timers_1.clearTimeout)(this.pingTimeoutTimer);\n }", "title": "" }, { "docid": "1122c8261d28b6954f6966a967f1eeea", "score": "0.69470435", "text": "clearAllEventListeners(){\n Object.keys(this.eventListeners).forEach((eventName) => {\n this.eventListeners[eventName].clear();\n delete this.eventListeners;\n });\n }", "title": "" }, { "docid": "419bf9e97efba72a23771d2f58b1e371", "score": "0.6944512", "text": "destroy() {\n\t\tif (this.connection !== undefined) {\n\t\t\tthis.connection.removeAllListeners();\n\t\t\tthis.connection.destroy();\n\t\t\tdelete this.connection;\n\t\t}\n\t\t\n\t\tif (this.projector !== undefined) {\n\t\t\tthis.projector.removeAllListeners();\n\t\t\tdelete this.projector;\n\t\t}\n\n\t\tdebug(\"destroy\", this.id);\n\t}", "title": "" }, { "docid": "1ecc11dd052bc4cab502685223efe292", "score": "0.69316536", "text": "detachAllListeners() {\n\t\tfor (var selector in this.eventHandles_) {\n\t\t\tif (this.eventHandles_[selector]) {\n\t\t\t\tthis.eventHandles_[selector].removeAllListeners();\n\t\t\t}\n\t\t}\n\t\tthis.eventHandles_ = {};\n\t\tthis.listenerCounts_ = {};\n\t}", "title": "" }, { "docid": "e6df196bce949b0f753cd44363426641", "score": "0.68943137", "text": "cleanup() {\n this.set('timelineChart', null);\n\n // unsubscribe from all services\n this.get('listeners').forEach(([service, event, listenerFunction]) => {\n this.get(service).off(event, listenerFunction);\n });\n this.set('listeners', null);\n }", "title": "" }, { "docid": "37c8b134dcbb483f70663aed961a0b5f", "score": "0.68594074", "text": "function detach() {\n proxySocket.removeListener('end', listeners.onIncomingClose);\n proxySocket.removeListener('data', listeners.onIncoming);\n reverseProxy.incoming.socket.removeListener('end', listeners.onOutgoingClose);\n reverseProxy.incoming.socket.removeListener('data', listeners.onOutgoing);\n }", "title": "" }, { "docid": "15cdbcdc69ed474929e1a28f336d7977", "score": "0.68271494", "text": "_stopListeners() {\n /*\n Serve para receber a nova hora/min digitada pelo usuario.\n Ocorre apos o _callbackQueryUpdateReg, porque onReplyToMessage nao funciona \n https://github.com/yagop/node-telegram-bot-api/issues/113\n */\n try {\n bot.removeTextListener(CMD.P1);\n bot.removeTextListener(CMD.P2);\n bot.removeTextListener(CMD.P3);\n bot.removeTextListener(CMD.P4);\n bot.removeTextListener(CMD.SHORTCUT);\n bot.removeTextListener(CMD.EDIT);\n bot.removeListener('callback_query');\n bot.removeTextListener(CMD.EXPT);\n bot.removeTextListener(CMD.LIST);\n bot.removeTextListener(CMD.HELP);\n } catch (err) {\n logger.error(['Bot > _stopListener -> Erro ao desativar listeners', err]);\n }\n }", "title": "" }, { "docid": "8eaf98c7139d23a2dd70730290a21d0f", "score": "0.68229526", "text": "destroy () {\n //first, remove the dispatch listener\n this.__Dispatch.unregister(this._dispatchToken);\n //next, remove all of our flux actions\n this.fluxActions = null;\n //now, loop through and remove each change listener\n for (let i=0; i<this.listenerTokens.length; i++) {\n this.listenerTokens[i].remove();\n }\n //finally, remove our listener tokens\n this.listenerTokens = null;\n }", "title": "" }, { "docid": "3789d6989f97cba92f980d1a6fbf1e3f", "score": "0.6818492", "text": "async cancelListening() {\n clearTimeout(this.timeoutHandle);\n for (const hub of this.connectedHubs) {\n hub.unregisterTxEvent(this.txId);\n }\n }", "title": "" }, { "docid": "0b5e30aaa58e474f7661d00a9992866a", "score": "0.67506623", "text": "unbind() {\n Object.keys(this.events).forEach(event => {\n this.events[event].forEach(callback => {\n this.socket.removeListener(event, callback);\n });\n delete this.events[event];\n });\n }", "title": "" }, { "docid": "ebb17c3d554ee9a0a7b21503ab17e611", "score": "0.6739297", "text": "removeAllListeners() {\n this.tinyEmitter.removeAllListeners();\n }", "title": "" }, { "docid": "ce7edd4293078e7c3607f35a82796991", "score": "0.6700954", "text": "function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('close', cleanup);\n }", "title": "" }, { "docid": "8ae1f51aec976962818593e6a9f88a73", "score": "0.6685846", "text": "function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n dest.removeListener('close', cleanup);\n }", "title": "" }, { "docid": "577b2707770f6e5a56f09452c4d74aad", "score": "0.6684768", "text": "function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('end', cleanup);\n dest.removeListener('close', cleanup);\n }", "title": "" }, { "docid": "e5836d4e7b704a99fc435566aee732af", "score": "0.668315", "text": "function cleanup() {\n\t\t source.removeListener('data', ondata);\n\t\t dest.removeListener('drain', ondrain);\n\t\t\n\t\t source.removeListener('end', onend);\n\t\t source.removeListener('close', onclose);\n\t\t\n\t\t source.removeListener('error', onerror);\n\t\t dest.removeListener('error', onerror);\n\t\t\n\t\t source.removeListener('end', cleanup);\n\t\t source.removeListener('close', cleanup);\n\t\t\n\t\t dest.removeListener('close', cleanup);\n\t\t }", "title": "" }, { "docid": "6ed773bb6f954b6e2e4de112997f6d16", "score": "0.667223", "text": "destroy() {\n\t\tthis._listener.stopListening();\n\t}", "title": "" }, { "docid": "2696523588bbb445ba3f6d60617a2e3b", "score": "0.66712415", "text": "function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('close', cleanup);\n }", "title": "" }, { "docid": "1ed81b31d7755b63b570b41e4ed4c0eb", "score": "0.6665387", "text": "clear()\n {\n this.m_listeners.clear();\n }", "title": "" }, { "docid": "13e3c210677cbc064ee73ef1259b5a31", "score": "0.66576916", "text": "function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n dest.removeListener('pause', onpause);\n dest.removeListener('resume', onresume);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('end', cleanup);\n dest.removeListener('close', cleanup);\n }", "title": "" }, { "docid": "13e3c210677cbc064ee73ef1259b5a31", "score": "0.66576916", "text": "function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n dest.removeListener('pause', onpause);\n dest.removeListener('resume', onresume);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('end', cleanup);\n dest.removeListener('close', cleanup);\n }", "title": "" }, { "docid": "8d2bed31935597f4bb7fa21b19de4673", "score": "0.6656691", "text": "function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('close', cleanup);\n }", "title": "" }, { "docid": "cda76349f422780febce2dea37d413ec", "score": "0.6654069", "text": "function cleanup() {\n source.removeListener('data', ondata);dest.removeListener('drain', ondrain);source.removeListener('end', onend);source.removeListener('close', onclose);source.removeListener('error', onerror);dest.removeListener('error', onerror);source.removeListener('end', cleanup);source.removeListener('close', cleanup);dest.removeListener('close', cleanup);\n }", "title": "" }, { "docid": "e40653847498d804e2d324ea913e1805", "score": "0.66526866", "text": "function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('close', cleanup);\n }", "title": "" }, { "docid": "7958c89072de689d8dec1d09e0513b08", "score": "0.6648366", "text": "destroy () {\n logger.debug(`destroy()`)\n this.removeAllListeners()\n this._flora.deinit()\n this._end = true\n }", "title": "" }, { "docid": "eb7d4f4b672356f42b4acb03a4810d80", "score": "0.66483307", "text": "function cleaner() {\n\t\tif (this.removeEventListener) {\n\t\t\tfor(var n in mListeners) {\n\t\t\t\tthis.removeEventListener(n, mListeners[n], bBubble);\n\t\t\t\tdelete mListeners[n];\n\t\t\t}\n\t\t} else {\n\t\t\tfor(var n in mListeners) {\n\t\t\t\tthis.detachEvent('on'+ n, mListeners[n]);\n\t\t\t\tdelete mListeners[n];\n\t\t\t}\n\t\t}\n\t}", "title": "" } ]
af0c00a59546d27605d9f7542a4ba033
This function populates news array from the UL list
[ { "docid": "fcf98abef07ef40ca550dc0f7bd17195", "score": "0.7774685", "text": "function populateNews()\n\t\t\t{\n\t\t\t\tvar tagType = $(newsID).get(0).tagName; \n\t\t\t\t\n\t\t\t\tif (tagType != 'UL' ) {\n\t\t\t\t\tdebugError('Cannot use <' + tagType.toLowerCase() + '> type of element for this plugin - must of type <ul> or <ol>');\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif($(newsID + ' LI').length > 0) {\n\t\t\t\t\t$(newsID + ' LI').each(function (i) {\n\t\t\t\t\t\t// Populating the news array from LI elements\n\t\t\t\t\t\tsettings.newsArr[i] = { type: options.titleText, content: $(this).html()};\n\t\t\t\t\t});\t\t\n\t\t\t\t}\t\n\t\t\t\telse {\n\t\t\t\t\tdebugError('There are no news in UL tag!');\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (countSize(settings.newsArr < 1)) {\n\t\t\t\t\tdebugError('Couldn\\'t find any content from the UL news!');\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tsettings.contentLoaded = true;\n\t\t\t}", "title": "" } ]
[ { "docid": "e8e6820d6d312e9b462e973fd7029b44", "score": "0.6866485", "text": "function addLatestNews(selector, results_data, number_of_items) {\n console.log(results_data);\n var listItems = '';\n for (var i = 0; i < number_of_items; i++) {\n post = results_data[i];\n listItems += '<a href=\"' + post.url + '\" class=\"list-group-item\">';\n listItems += '<h3 class=\"official-news-title\">' + post.title + '</h3>';\n listItems += '<span class=\"date\">' + formatDate(Date.parse(extractDateString(post.date_published))) + '</span>';\n listItems += '</a>';\n }\n $(selector).html(listItems);\n}", "title": "" }, { "docid": "03b8edc894d43717e38602d592a0c349", "score": "0.6733839", "text": "function fill() {\n\t\t\tvar ul = document.getElementsByClassName('sp-list-posts')[0];\n\t\t\tclear();\n\t\t\tif (items.length === 0) {\n\t\t\t\tvar p = document.createElement('li');\n\t\t\t\tp.innerHTML = 'There are not posts yet';\n\t\t\t\tul.appendChild(p);\n\t\t\t} else {\n\t\t\t\tvar i = index,\n\t\t\t\t\tj = 0;\n\t\t\t\twhile (j < step) {\n\t\t\t\t\tif (items[i]) {\n\t\t\t\t\t\tvar li = document.createElement('li'),\n\t\t\t\t\t\t\ta = document.createElement('a');\n\t\t\t\t\t\ta.innerHTML = items[i].title;\n\t\t\t\t\t\ta.setAttribute('href', 'post.html?id=' + items[i].folder);\n\t\t\t\t\t\tli.appendChild(a);\n\t\t\t\t\t\tul.appendChild(li);\n\t\t\t\t\t}\n\t\t\t\t\ti = i + 1;\n\t\t\t\t\tj = j + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "bc64618e37619f13d1ff0ee16e91de27", "score": "0.65812665", "text": "function loadNews() {\n news = [];\n $.ajax({\n url: \"https://newsapi.org/v2/top-headlines?country=at&apiKey=\" + NEWS_API_KEY,\n success: function(data) {\n data.articles.forEach(function(element) {\n news.push(new News(element.title, element.description, element.author, element.publishedAt, element.url, element.source.name));\n refreshNewsData();\n });\n }\n });\n}", "title": "" }, { "docid": "4fd8fbd4bad195a9c5b0ba01d9a7cae1", "score": "0.6556382", "text": "function populateData(arrData) {\n doc.getElementById('content-feed').innerHTML = '';\n arrData.forEach(function(data) {\n var li = doc.createElement('li');\n var anc = doc.createElement('a');\n var article = doc.createElement('article');\n var p = doc.createElement('p');\n anc.href = data.url;\n anc.target = '_blank';\n anc.innerHTML = data.title;\n p.innerHTML = data.description + \" - <em>\" + data.domain + \"</em>\";\n article.appendChild(anc);\n article.appendChild(p);\n li.appendChild(article);\n li.dataset['dateCreated'] = data.date_created;\n doc.getElementById('content-feed').appendChild(li);\n });\n\n }", "title": "" }, { "docid": "18ea85d4a0f494a32a33793873abec52", "score": "0.64734703", "text": "function getListOfNews() {\n if ($(\"#newsContainer\").length > 0) {\n\n $.fn.inc = function (prop, val) {\n return this.each(function () {\n var data = $(this).data();\n if (!(prop in data)) {\n data[prop] = 0;\n }\n data[prop] += val;\n });\n }\n\n var $template = $('#newsPattern').html();\n var $newsList = $(\"#newsContainer\");\n\n var $newspapersList = $('#newspapersList').val();\n var $tagList = $('#tagsList').val();\n\n var $whatNews = $('.whatNewsFilter').dropdown('get value');\n var $whatPeriod = $('.whatPeriodFilter').dropdown('get value');\n\n\n var $page = $('#newPageButton').data('id');\n\n //Main page filtering\n var $MainPage = $('#MainPage').data('id');\n\n\n if ($tagList.length > 0) {\n var arrListTag = $tagList.split(',');\n }\n else {\n var arrListTag = [];\n }\n\n if ($newspapersList.length > 0) {\n var arrList = $newspapersList.split(',');\n }\n else {\n var arrList = [];\n }\n\n var model = {\n NewspapersList: arrList,\n TagsList: arrListTag,\n WhatNews: $whatNews,\n Period: $whatPeriod,\n Page: $page,\n MainPage: $MainPage\n };\n\n $('#newPageButton').val(\"... wczytywanie ...\");\n $.ajax({\n url: '/Main/Get',\n type: \"POST\",\n data: model,\n success: function (result) {\n\n $('#loadingImage').removeClass(\"hidden\");\n $.each(result, function (key, val) {\n var $template = $('#newsPattern').html();\n\n var i;\n var $htmlList = '';\n for (i = 0; i < val.tagList.length; ++i) {\n $htmlList = $htmlList + '<span class=\"ui teal basic label\">' + val.tagList[i] + '</span>';\n }\n\n fulfillNewsListTemplate($template, $newsList, val.urlActionLink, val.newspaperPictureLink, val.newsPictureLink, val.newsTitle, val.newsDescription, val.numberOfVisitors, val.numberOfComments, val.dateAdded, val.ratingClass, val.ratingValue, val.newsID, $htmlList, val.faktValue, val.fakeValue, val.manipulatedValue);\n\n var resultRemaining = val.remainingRows;\n\n if (resultRemaining >= 10) {\n $('#newPageButton').removeClass(\"hidden\");\n $('#newPageButton').val(\"Pokaż kolejne 10 z \" + resultRemaining + \" pozostałych.\");\n }\n else if (resultRemaining > 0) {\n $('#newPageButton').removeClass(\"hidden\");\n $('#newPageButton').val(\"Pokaż kolejne \" + resultRemaining + \" z \" + resultRemaining + \" pozostałych.\");\n }\n else {\n $('#newPageButton').addClass(\"hidden\");\n }\n });\n\n $('#loadingImage').addClass(\"hidden\");\n $('#newPageButton').fadeIn('slow');\n\n if (result.length === 0) {\n $('#newPageButton').removeClass(\"hidden\");\n $('#newPageButton').val(\"Brak wyników dla wybranych filtrów.\");\n }\n\n $('#newPageButton').inc('id', 1);\n },\n error: function () {\n\n $whereAppend = $('#newsContainer')\n showNotification('negative', 'Newsy', 'Wystąpił błąd podczas wyświetlania newsów.', $whereAppend)\n }\n });\n }\n}", "title": "" }, { "docid": "b66a803913b382aa34b9cb53298df3db", "score": "0.6467678", "text": "function getNewsData() {\r\n var dataItems = [];\r\n for (var i = 0; i < COUNT_NEWS; i++) {\r\n var placeholder = {\r\n group: groups[GROUP_KEY_NEWS],\r\n title: \"\",\r\n subtitle: \"\",\r\n description: \"\",\r\n content: \"\",\r\n backgroundImage: uwBG\r\n };\r\n dataItems.push(placeholder);\r\n }\r\n\r\n $.get(NEWS_RSS_URL, function (data) {\r\n var $xml = $($.parseXML(data));\r\n var xmlItems = $xml.find(\"item\");\r\n for (var i = 0; i < dataItems.length; i++) {\r\n if (i < xmlItems.length) { // if there are enough news items available to fill this item\r\n var di = dataItems[i];\r\n var $xi = $(xmlItems[i]);\r\n di.title = $xi.find(\"title\").text();\r\n di.link = $xi.find(\"link\").text();\r\n di.description = $xi.find(\"description\").text();\r\n di.content = $xi.find(\"description\").text();\r\n di.subtitle = $xi.find(\"pubDate\").text();\r\n\r\n // scrape photo and content from news.wisc.edu article\r\n\r\n var yqlUrl = \"http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22\" +\r\n encodeURIComponent(di.link) +\r\n \"%22%20and%20xpath%3D'%2F%2Fdiv%5B%40id%3D%22story_content%22%5D'\";\r\n\r\n var contentCallback = function (dataItem) { // need to create a closure since $.get is async\r\n return function (contentData) {\r\n var $contentData = $(contentData);\r\n // scrape photo (if there is one)\r\n var imgSrc = $($contentData.find(\".photo img\")[0]).attr(\"src\");\r\n if (imgSrc !== undefined && imgSrc !== null) {\r\n dataItem.backgroundImage = imgSrc;\r\n }\r\n\r\n dataItem.content = \"\";\r\n // scrape text from article\r\n\r\n var paras = $contentData.find(\"#story_content\").children(\"p\");\r\n paras.each(function (p) {\r\n dataItem.content += \"<p>\" + $(paras[p]).text() + \"</p>\";\r\n });\r\n\r\n list.notifyReload(); // necessary to refresh dataItems\r\n }\r\n }\r\n var imgDataFn = contentCallback(di);\r\n $.get(yqlUrl, imgDataFn);\r\n }\r\n else { // not enough news items; delete an item from the end; doesn't actually work because list itself doesn't refresh\r\n dataItems.splice(dataItems.length - 1, 1);\r\n }\r\n }\r\n });\r\n\r\n return dataItems;\r\n }", "title": "" }, { "docid": "d51663fd880df4c3c46a016bc88a5503", "score": "0.64359945", "text": "function initilize() {\r\n\tdocument.getElementById(\"info-main-section-text\").innerHTML = newsPiece.section;\r\n\tinfoArray = [];\r\n\tcurrentInfoIndex = -1;\r\n\tjson.then(\r\n\t\tjson => {\r\n\t\t\tdocument.getElementById(\"article\").appendChild(getNewLinksHTMLTag(json.results));\r\n\t\t\tfor (let val of json.results) {\r\n\t\t\t\tinfoArray.push(val);\r\n\t\t\t}\r\n\t\t}\r\n\t)\r\n}", "title": "" }, { "docid": "3480b956654020b0e3866d5bfe01910d", "score": "0.639355", "text": "function setarticlelist(articles)\n{\n\tfor(var i = 0; i<articles.count;i++)\n\t{\n\t\tinsertarticlelisting(articles.data[i], i);\n\t\t//console.log(articles.data[i].metadata.headline);\n\t}\n}", "title": "" }, { "docid": "2034ced3d013e3544662d11d444682d9", "score": "0.6343606", "text": "function returnNews(i) {\n const location= dataArray[i].location;\n const newsUrl= dataArray[i].newsUrl;\n const description= dataArray[i].description;\n console.log(dataArray);\n const newDescription=seperateParagraphs(description);\n $('#results-list').empty();\n $('#results-list').append(`\n <li><h2>${location}</h2><p>${newDescription}</p><a href='${newsUrl}'>${location}</a></li>\n `)\n $('#results').removeClass('hidden')\n}", "title": "" }, { "docid": "223837bbba081cca0f772bfebb6ed31f", "score": "0.6328055", "text": "function showData(posts) {\n\n let ul_element = document.createElement('ol')\n\n let posts_element = document.querySelector('.posts')\n\n posts.forEach(item => {\n\n let title_element = document.createElement('li')\n\n title_element.innerHTML = item.title\n\n ul_element.appendChild(title_element)\n\n })\n\n posts_element.appendChild(ul_element)\n\n}", "title": "" }, { "docid": "b03ce3f7aee6a19873dbcc3b83ba358c", "score": "0.62095183", "text": "function displayNewsItems() {\n\n // Just in case the data isn't in local storage yet.\n verifyData();\n\n // Get news from local storage.\n let newsData = JSON.parse(Storage.getData(\"news\"));\n // Parse news data and create tag elements to attach to DOM.\n for (let i = 0; i < newsData.length; i++) {\n let news = newsData[i];\n\n // Create the container for the news items\n let colDiv = $('<div class=\"col\"></div> <!-- /.col -->');\n\n // Create and attach date span tag.\n let dateTag = $('<span class=\"date\">' + news.date + '</span>');\n $(colDiv).append($(dateTag));\n\n // Create and attach news title.\n let titleTag = $('<b class=\"title\">' + news.title + '</b>');\n $(colDiv).append($(titleTag));\n\n // Create and attach excerpt.\n let excerptTag = $('<span>' + news.excerpt + '</span><br/>');\n $(colDiv).append($(excerptTag));\n\n // Create and attach link to news.\n let link = news.date;\n link = link.replace(/ /g, \"-\");\n let linkTag = $('<a href=\"index.php?' + link + '\" class=\"continue\">Continue Reading</a>');\n $(colDiv).append($(linkTag));\n\n let newsDiv = $('<div class=\"row news\"></div> <!-- /.news -->');\n $(newsDiv).append($(colDiv));\n\n $('.fill').append($(newsDiv));\n }\n }", "title": "" }, { "docid": "89ede31856cca70bde69f9884460b947", "score": "0.6158411", "text": "function getNewsListData(that,list_type){\r\n var url = until.config.News_List;\r\n var list_type = list_type ? list_type : that.data.list_type;\r\n var item = list_type == 1 ? that.data.lpdg : that.data.rmzx;\r\n var data = {\r\n city : that.data.city,\r\n page : item.page,\r\n pagesize : item.page == 1 ? (item.pagesize*2) : item.pagesize,\r\n channel : list_type\r\n }\r\n if(item.is_post == true) return false;\r\n item.is_post = true;setThatData(that,item,list_type);//请求排队中\r\n //请求数据\r\n until.ajax_curl(url,data,function(res){\r\n var result = res.data;\r\n if(result.result==1 && result.data.length>0){\r\n item.page = data.page==1 ? (data.page+2) : (data.page+1);\r\n item.list_data = item.list_data.concat(result.data);//合并数据\r\n setThatData(that,item,list_type);\r\n if(result.data.length < data.pagesize){\r\n item.no_more = true;setThatData(that,item,list_type);//数据小于分量,没有了\r\n }else{\r\n item.no_more = false;setThatData(that,item,list_type);\r\n }\r\n }else if(result.result==0 || result.data.length==0){\r\n if(data.page == 1) item.nodata = true;//第一页就没有数据\r\n else item.no_more = true;\r\n setThatData(that,item,list_type);//没有数据\r\n }\r\n item.is_post = false;setThatData(that,item,list_type);//退出请求排队\r\n });\r\n}", "title": "" }, { "docid": "b191cf7620aadc244d6b7ec1b7994cb3", "score": "0.6144109", "text": "function parseNews(data){\r\n\tif(!data || !data.query || !data.query.results || !data.query.results.json || !data.query.results.json.results) {\r\n\t\tvar newNode = $(\"<div></div>\");\r\n \tnewNode.append(\"<p class='title'>\" + \"Your search did not match any documents.\" + \"</p>\" );\r\n \t$(\"#headlines\").append(newNode);\r\n \treturn;\t\r\n\t}\r\n\tvar results = data.query.results.json.results;\r\n console.log(results);\r\n for(var i = 0; i < results.length; i++){\r\n \tvar title = results[i].title;\r\n \tvar byline = results[i].byline;\r\n \tvar date = parseDate(results[i].date);\r\n //error checking\r\n if(title === null || \r\n byline === null ||\r\n date === null) \r\n continue;\r\n \tvar url = results[i].url;\r\n \tvar body = results[i].body;\r\n \r\n //NEED TO FIND WAY AROUND THIS!\r\n \tvar link = $(\"<a href='#' class='linkref' id='\" + url + \"'> More<a><br>\");\r\n \tlink.url = url;\r\n \r\n \tlink.click (function(event) {\r\n \t\t\tvar linkobj = event.target;\r\n \t\t\tconsole.log(linkobj);\r\n \t\t\topenArticle(linkobj.id);\r\n \t\t\treturn false;\r\n\t\t});\t \r\n \tvar newNode = $(\"<div class='headline'></div>\");\r\n \tnewNode.append(\"<p class='title'>\" + title + \"</p>\" );\r\n \tnewNode.append(\"<p class='author'>\" + byline + \" Published: \" + date + \"</p>\" );\r\n \tnewNode.append(\"<p class='description'>\" + body + \"...</p>\");\r\n \tnewNode.append(link );\r\n $(\"#headlines\").append(newNode);\r\n }\r\n}", "title": "" }, { "docid": "a84b8704de284dc14f526e1971213e00", "score": "0.6140705", "text": "function loadLists() {\n\tfor (var i = 0; i < listArray.length; i++) {\n\t\taddListToDom(listArray[i].id, listArray[i].title, listArray[i].tasks, listArray[i].urgent);\n\t}\n}", "title": "" }, { "docid": "0c6dc1d7cf22ea38cdb5f100b36350ea", "score": "0.6133209", "text": "function fillArticleList() {\r\n\tvar templateElement = document.getElementById(\"template\");\r\n\tvar template = templateElement.innerHTML;\r\n\tvar articles = [\r\n\t\t{\r\n\t\t\timageSource: \"https://res.cloudinary.com/spotlightuk/image/fetch/w_400,c_limit/https://spotlight-cmsmedia.s3-eu-west-1.amazonaws.com/media/1656/6063491826_b22879c63b_o.jpg\",\r\n\t\t\ttitle:\"An Actor's Guide to Fulfilling Your Potential\",\r\n\t\t\tcategory:\"Tips and Advice\",\r\n\t\t\thref:\"someotherpage.html\"\r\n\t\t},\r\n\t\t{\r\n\t\t\timageSource: \"https://res.cloudinary.com/spotlightuk/image/fetch/w_400,c_limit/https://spotlight-cmsmedia.s3-eu-west-1.amazonaws.com/media/1650/spotlight-roomslaunchparty-web-026.jpg\",\r\n\t\t\ttitle:\"Edinburgh Fringe: A Survival Guide\",\r\n\t\t\tcategory:\"Tips and Advice\",\r\n\t\t\thref:\"someotherpage.html\"\r\n\t\t},\r\n\t\t{\r\n\t\t\timageSource: \"https://res.cloudinary.com/spotlightuk/image/fetch/w_400,c_limit/https://spotlight-cmsmedia.s3-eu-west-1.amazonaws.com/media/1467/umbraco-header.jpg\",\r\n\t\t\ttitle:\"Supercalifragilisticexpialidocious\",\r\n\t\t\tcategory:\"Tips and Advice\",\r\n\t\t\thref:\"someotherpage.html\"\r\n\t\t},\r\n\t\t{\r\n\t\t\timageSource: \"https://res.cloudinary.com/spotlightuk/image/fetch/w_400,c_limit/https://spotlight-cmsmedia.s3-eu-west-1.amazonaws.com/media/1649/spotlightdaythree-32.jpg\",\r\n\t\t\ttitle:\"BBC Launches Opportunity for Disabled Actors\",\r\n\t\t\tcategory:\"News\",\r\n\t\t\thref:\"someotherpage.html\"\r\n\t\t},\r\n\t\t{\r\n\t\t\timageSource: \"https://res.cloudinary.com/spotlightuk/image/fetch/w_400,c_limit/https://spotlight-cmsmedia.s3-eu-west-1.amazonaws.com/media/1170/spotlight-roomslaunchparty-web-004.jpg\",\r\n\t\t\ttitle:\"How to Stay Motivated\",\r\n\t\t\tcategory:\"Interviews & Podcasts\",\r\n\t\t\thref:\"someotherpage.html\"\r\n\t\t},\r\n\t\t{\r\n\t\t\timageSource: \"https://res.cloudinary.com/spotlightuk/image/fetch/w_400,c_limit/https://spotlight-cmsmedia.s3-eu-west-1.amazonaws.com/media/1571/day-1-audience-laughing-2.jpg\",\r\n\t\t\ttitle:\"Spotlight Career Advice - August 2017\",\r\n\t\t\tcategory:\"Events\",\r\n\t\t\thref:\"someotherpage.html\"\r\n\t\t},\r\n\t\t{\r\n\t\t\timageSource: \"https://res.cloudinary.com/spotlightuk/image/fetch/w_400,c_limit/https://spotlight-cmsmedia.s3-eu-west-1.amazonaws.com/media/1656/6063491826_b22879c63b_o.jpg\",\r\n\t\t\ttitle:\"Edinburgh Fringe: A Survival Guide\",\r\n\t\t\tcategory:\"Tips and Advice\",\r\n\t\t\thref:\"someotherpage.html\"\r\n\t\t},\r\n\t\t{\r\n\t\t\timageSource: \"https://res.cloudinary.com/spotlightuk/image/fetch/w_400,c_limit/https://spotlight-cmsmedia.s3-eu-west-1.amazonaws.com/media/1656/6063491826_b22879c63b_o.jpg\",\r\n\t\t\ttitle:\"Edinburgh Fringe: A Survival Guide\",\r\n\t\t\tcategory:\"Tips and Advice\",\r\n\t\t\thref:\"someotherpage.html\"\r\n\t\t}\r\n\t];\r\n\t\r\n\tvar markup = articles.map(function (x) { \r\n\t\t\treturn (\r\n\t\t\t\ttemplate.\r\n\t\t\t\treplace(/IMAGESOURCE/,x.imageSource).\r\n\t\t\t\treplace(/TITLE/,x.title).\r\n\t\t\t\treplace(/HREF/,x.href).\r\n\t\t\t\treplace(/CATEGORY/g,x.category)\r\n\t\t\t);\r\n\t\t}).join(\"\");\r\n\t\r\n\ttemplateElement.parentNode.innerHTML = markup;\r\n}", "title": "" }, { "docid": "859f180a945cccc659cd512fd39a02fa", "score": "0.61087644", "text": "function newsFeed(jsonData){\r\n $(\"#news\").empty();\r\n var data=jsonData.News;\r\n var html=\"\";\r\n for(var l=0; l<data.author.length;l++){\r\n html+=\"<div class='newsDiv cborder rounded'>\";\r\n html+=\"<div class='newsPad newsHead'><a id='newsLink' href='\"+data.url[l][0]+\"' target='_blank'>\"+data.title[l][0]+\"</a></div><br>\"\r\n html+=\"<div class='newsPad newsText'>Author: \"+data.author[l][0]+\"</div>\";\r\n html+=\"<div class='newsPad newsText'>Date: \"+data.date[l]+\"</div>\";\r\n html+=\"</div>\";\r\n }\r\n $('#news').append(html);\r\n\r\n}", "title": "" }, { "docid": "6787177227d0fe4258735b17ffcee772", "score": "0.60476816", "text": "function handleSuccess(data) {\n var newsItems = $.map(data.appnews.newsitems, function(val, i) {\n return new NewsItem(val).generateHTML();\n });\n\n $(\".news-container\").html(newsItems);\n }", "title": "" }, { "docid": "8bebc28931e0922c0274edde1e32c504", "score": "0.6046701", "text": "function assignItemList () {\r\n\t\tidItemList=0;\r\n\t\t$(\".oni_filter\").parent().children(\".oni_contentFilter\").each(function () {\r\n\t\t\t$(this).append(itemList[idItemList].content);\r\n\t\t\tidItemList++;\r\n\t\t});\r\n\t}", "title": "" }, { "docid": "51a8feee06dd0260747205600107b84d", "score": "0.600007", "text": "getNewsfeed() {\n\t \tlet followed_stories = JSON.parse(localStorage.getItem(\"keywords\"));\n\n\t \tif (followed_stories){\n\t \t\tlet articles = [];\n\t \t\tfor (var i=0; i<followed_stories.length; i++){\n\t\t \t\tlet url = \"https://newsapi.org/v2/everything?q=\" + encodeURI(followed_stories[i]) + \"&apiKey=\" + apiKey + \"&sortBy=publishedAt\";\n\t\t \t\tlet req = $.get(url);\n\t\t \t\tarticles.push(req);\n\t \t\t}\n\t \t\treturn articles;\n\n\t \t} else {\n\t return;\n\t }\n\t}", "title": "" }, { "docid": "79d2ecf683456ab42d859c08c2d8671b", "score": "0.59887135", "text": "function loadNews() {\n // TODO: change to calamaria when going public\n let gitData = \"https://api.github.com/repos/azeam/SunnyMPC/releases\";\n let year, day, month, date;\n $.getJSON(gitData, function(result){\n $.each(result, function(i, data){\n date = new Date(data.published_at);\n day = date.getDate();\n month = date.getMonth();\n month = month += 1;\n year = date.getFullYear();\n\n $(\"#releases\").append(\"<li><article><a href='\" + data.html_url + \"' class='externalAlwaysDark' target='_blank'>\" + \n data.tag_name + \n \"</a><br><br><h3>\" + data.name + \"</h3><span class='smallText'>\" + day + \".\" + month + \".\" + year + \n \"</span><br><br><p>\" + data.body + \"</p></article></li>\").fadeIn(500);\n // max 5 releases?\n if (i === 5) {\n return false;\n }\n });\n });\n}", "title": "" }, { "docid": "1a3d5e0c0b7d3b4c1ed0dd7ee1d0fa74", "score": "0.5979556", "text": "function getNews(topic) {\n var div = document.createElement('div');//this is the div that holds each news list\n var h3 = document.createElement('h3');//these are subheadings for each news list\n var error_text = document.createElement('h1');//these are subheadings for each news list\n div.setAttribute('id', topic);\n div.classList.add('company-news');\n\n //build out the news list headings \n h3.textContent = topic; //sets the subheading text to the companies' names\n newsList.appendChild(div);\n div.appendChild(h3);\n //c3add341256eba19d065d37cf36b8cd6\n //fb7a02aa4ae9237a19c62f1378f9ad6f\n let url = `https://gnews.io/api/v3/search?q=${topic}&token=fb7a02aa4ae9237a19c62f1378f9ad6f`;\n\n fetch(url).then(response => {\n return response.json();\n }).then(data => {\n\n if (data.articleCount < 1) {\n error_text.classList.add('error-text');\n error_text.textContent = 'No news articles were found for ' + topic;\n div.appendChild(error_text);\n\n } else {\n //we're building out each list item for each article here\n for (const element of data.articles) {\n var article = document.createElement('li'); //each article\n var text = document.createElement('div'); //holds all the text (i.e: heading, desc...)\n var caption = document.createElement('p'); //for the source and time\n var desc = document.createElement('p'); //for the description\n var title = document.createElement('h1');\n var link = document.createElement('a');\n var imgwrap = document.createElement('div');\n var img = document.createElement('img');\n\n imgwrap.classList.add('imgwrap');\n\n //sets the href to the url of the article\n link.setAttribute('href', element.url);\n link.setAttribute('target', '_blank');\n img.setAttribute('src', element.image)\n\n let fixDateForAllBrowsers = element.publishedAt.replace(/-/g, '/');\n\n //sets p's content to name of source\n caption.textContent = element.source.name + ' ― ' + moment(fixDateForAllBrowsers).fromNow();\n //the content in h1 style is the title\n title.textContent = element.title;\n desc.textContent = element.description;\n\n //div contains all of these items --> div(a(li(p, h))))\n div.appendChild(link);\n //the list items are placed inside the a tag --> a(li)\n link.appendChild(article);\n //p and h are placed inside the list item --> a(li(p, h))\n text.appendChild(caption);\n text.appendChild(title);\n text.appendChild(desc);\n\n article.appendChild(text);\n\n //if there is an image, add it\n if (element.image) {\n imgwrap.appendChild(img);\n article.appendChild(imgwrap);\n }\n }\n }\n })\n}", "title": "" }, { "docid": "b79dc70a4e655d649f93f9e1f3efc01b", "score": "0.5970448", "text": "function get_news(code,reqstring,thedate){\nvar np_list_html='';\n\nvar settings = {\n \"async\": true,\n \"crossDomain\": true,\n \"url\": \"\"+reqstring+\"\",\n \"method\": \"GET\",\n \"headers\": {\n \"polarisdate\": \"\"+thedate+\"\",\n \"authorization\": \"\"+code+\"\",\n \"content-type\": \"application/json\"\n }\n}\n\n$.ajax(settings).done(function (response) {\n\nvar selection= ['Title', 'Author', 'PublicationDate', 'Description', 'PrimaryTypeOfMaterial'];\n$( \"#news\" ).empty();\nvar np_list_html='';\n \n$.each(response.BibSearchRows, function(key, value) {\ncont_no=value.ControlNumber;\nmedia=value.PrimaryTypeOfMaterial;\nISBN=value.ISBN;\nUPC=value.UPC;\nif(ISBN){cover_no=ISBN;}else{cover_no=UPC;}\n\nif(UPC!=''){\nselection= ['Title', 'PublicationDate', 'Description', 'PrimaryTypeOfMaterial'];\n}\n\nif(cover_no==''){\nswitch(media){\n\tcase 35: np_list_html +='<table class=\"bibtbl\"><tr><td class=\"picbox\"><img src=\"img/cd_icon.png\" /></td ><td class=\"txtbox\">'; break;\n\tcase 40: np_list_html +='<table class=\"bibtbl\"><tr><td class=\"picbox\"><img src=\"img/blueray_icon.png\" /></td ><td class=\"txtbox\">'; break;\n\tcase 33: np_list_html +='<table class=\"bibtbl\"><tr><td class=\"picbox\"><img src=\"img/dvd_icon.png\" /></td ><td class=\"txtbox\">'; break;\n\tdefault: np_list_html +='<table class=\"bibtbl\"><tr><td class=\"picbox\"><img src=\"img/book_icon.png\" /></td ><td class=\"txtbox\">'; break;\n}\n}else{\t\nnp_list_html +='<table class=\"bibtbl\"><tr><td class=\"picbox\"><img src=\"http://contentcafe2.btol.com/ContentCafe/Jacket.aspx?Return=T&Type=S&Value='+cover_no+'&userID=MAIN37789&password=CC10073\" /></td ><td class=\"txtbox\">';\n}\n\n$.each(value, function(key2, value2) {\n\t\n\tif(jQuery.inArray( key2, selection )!== -1){\n\tswitch(key2){\n\t\tcase \"PublicationDate\":\n\t\tkey2=\"Publication Date\";\n\t\tbreak;\n\t\tcase \"PrimaryTypeOfMaterial\":\n\t\tkey2=\"Media Type\";\n\t\tvalue2=matconv(value2);\n\t\tbreak;\n\t}\n\tnp_list_html += key2 + \": \" + value2 + \"<br>\";\n\t}\n\n});\nnp_list_html +=\"<p class='trail'><a id=\" + cont_no + \" href='#bib_detail' data-role='button' data-inline='true' data-mini='true' data-icon='arrow-r' data-theme='a'>Detail</a></p>\";\nnp_list_html +=\"</td></tr></table>\";\n\n$('.trail a[data-role=button]').button();\n$('.trail a').button('refresh');\n\n});\n$( \"#news\" ).append(np_list_html);\n$('.trail a').button();\nstop_spin();\nalert(page_counter);\nif(page_counter==1){\nnext_batch_news +=\"<a href='#' id='fwd_btn' class='ui-btn ui-corner-all ui-icon-cloud ui-btn-icon-left'>...next 20 results</a>\";\n$( \"#news\" ).append(next_batch_news);\n}\nif(page_counter>1){\nnext_batch_news +=\"<div data-role='controlgroup' data-type='horizontal' data-mini='true'><a href='#' id='rev_btn' class='ui-btn ui-corner-all ui-icon-carat-l ui-btn-icon-left'>show last 20</a><a href='#' id='fwd_btn' class='ui-btn ui-corner-all ui-icon-carat-r ui-btn-icon-left'>show next 20</a></div>\";\n$( \"#news\" ).append(next_batch_news);\n}\n});\n}", "title": "" }, { "docid": "0fc8f296daa1b76d88c0d7bcce799ff0", "score": "0.5962981", "text": "function gettingNews(newsdata) {\n\n if (newsdata.totalResults != 0) {\n let newsSection = '';\n let NewsSegment = ''\n\n\n newsdata.articles.forEach((article) => {\n\n if (article.urlToImage == null) {\n article.urlToImage = 'https://www.freeiconspng.com/uploads/no-image-icon-13.png\" alt=\"Png Transparent No';\n }\n\n NewsSegment = `\n <div class=\"card text-white mb-3\">\n <div class=\"row g-0\">\n <div class=\"col-md-12 col-lg-4\">\n <div class=\"bgImg\" style=\"background-image: url('${article.urlToImage}') ;\"></div>\n </div>\n <div class=\"col-md-12 col-lg-8\">\n <div class=\"card-body\">\n <h5 class=\"card-title country name\"><a href=\"${article.url}\">${article.title}</a></h5>\n <p class=\"card-text capital\">${article.title}</p>\n <h5 class=\"card-text Neighbors text-end\">${article.source.name}<span>${article.publishedAt}</span></h5>\n </div>\n </div>\n </div>\n </div>`;\n\n newsSection += NewsSegment;\n\n });\n let listOfNews = document.querySelector('.list-of-news');\n listOfNews.innerHTML = newsSection;\n\n } else {\n NewsSegment = `\n <h2 class=\"text-white text-center mt-4 mb-4\">No Current News</h2>\n `;\n let listOfNews = document.querySelector('.list-of-news');\n listOfNews.innerHTML = NewsSegment;\n }\n\n }", "title": "" }, { "docid": "dee3641be97f19fd5334dfdd9ad18582", "score": "0.59614307", "text": "function listBlogs(blogList) {\n let itemCount = 0;\n let newHtml = \"\";\n for (let item of blogList) {\n let categories = checkCategories(item._embedded[\"wp:term\"][0]);\n let authorName = item._embedded.author[0].name;\n let images = sortEmbedded(item);\n let date = dateHandler(item.date);\n let link = \"./post.html?id=\" + item.id + \"&category=\" + categories.id;\n let excerpt = item.excerpt.rendered;\n excerpt = excerpt.replace(/(<([^>]+)>)/gi, \"\");\n if (itemCount < 10) {\n itemCount++;\n newHtml += `\n <li data-view=\"visible\" data-time=\"${date.time}\" data-title=\"${item.title.rendered}\">\n <article class=\"article__item article__item--listed\">\n <a href=\"${link}\" tabindex=\"-1\">\n <div class=\"article__imagewrap\">\n <img\n class=\"article__image article__image--listed\"\n srcset=\"${images.medium} 1x, ${images.desktop} 2x\"\n src=\"${images.medium}\"\n alt=\"${images.alt}\"\n />\n </div>\n </a>\n <div class=\"article__textblock\">\n <div class=\"article__info infotext\">\n <div class=\"article__tag article__tag--${categories.name.toLowerCase()} tagtext\">${categories.name}</div>\n <div class=\"article__infotext\">\n <div class=\"article__author\">\n <span class=\"fas fa-user\"></span>\n <p>${authorName}</p>\n </div>\n <div class=\"article__date\">\n <span class=\"fas fa-calendar-alt\"></span>\n <p>${date.day + \" \" + date.month + \" \" + date.year}</p>\n </div>\n </div>\n </div>\n <h3 class=\"article__title h3big\">\n <a class=\"links\" href=\"${link}\">${item.title.rendered}</a>\n </h3>\n <p class=\"article__excerpt bodytext\">${excerpt}</p>\n <a href=\"${link}\" class=\"article__link links links--blue buttontext\">\n Read More<span class=\"fas fa-chevron-right\"></span>\n </a>\n </div>\n </article>\n </li>`;\n } else {\n newHtml += `\n <li style=\"display: none;\" data-view=\"hidden\" data-time=\"${date.time}\" data-title=\"${item.title.rendered}\">\n <article class=\"article__item article__item--listed\">\n <a href=\"${link}\" tabindex=\"-1\">\n <div class=\"article__imagewrap\">\n <img\n class=\"article__image article__image--listed\"\n srcset=\"${images.medium} 1x, ${images.desktop} 2x\"\n src=\"${images.medium}\"\n alt=\"${images.alt}\"\n />\n </div>\n </a>\n <div class=\"article__textblock\">\n <div class=\"article__info infotext\">\n <div class=\"article__tag article__tag--${categories.name.toLowerCase()} tagtext\">${categories.name}</div>\n <div class=\"article__infotext\">\n <div class=\"article__author\">\n <span class=\"fas fa-user\"></span>\n <p>${authorName}</p>\n </div>\n <div class=\"article__date\">\n <span class=\"fas fa-calendar-alt\"></span>\n <p>${date.day + \" \" + date.month + \" \" + date.year}</p>\n </div>\n </div>\n </div>\n <h3 class=\"article__title h3big\">\n <a class=\"links\" href=\"${link}\">${item.title.rendered}</a>\n </h3>\n <p class=\"article__excerpt bodytext\">${excerpt}</p>\n <a href=\"${link}\" class=\"article__link links links--blue buttontext\">\n Read More<span class=\"fas fa-chevron-right\"></span>\n </a>\n </div>\n </article>\n </li>`;\n }\n }\n if (itemCount < 10) button.style.display = \"none\";\n out.innerHTML = newHtml;\n sortBy();\n}", "title": "" }, { "docid": "b55106c415923d68c1c476db214d8bf3", "score": "0.5957589", "text": "function news_list() {\n var node = this,\n skeleton = this.querySelector('.news-content-wrapper'),\n pager = new cr.Pager(cr.model.News, '/?limit=15'),\n cover = new Image(),\n cover_id = cr.model.SiteSettings.getField('header_image').value;\n document.title = \"Home | Film Society, HKUSTSU\";\n routerManager.markTracker();\n\n cover.onload = function (e) {\n var homepage = cr.ui.template.render_template(\"home_template.html\", {\n url: this.src\n });\n skeleton.appendChild(homepage);\n skeleton.removeAttribute('hidden');\n setTimeout(function () {\n node.classList.remove('loading');\n }, 0);\n var news_container = homepage.querySelector('.news-list');\n homepage.scrollList = new cr.ui.scrollList(news_container, homepage, pager, {\n onfirstload: function (obj_list) {\n if (obj_list.length == 0) {\n this.anchor_element.textContent = \"No News at the time\";\n }\n },\n onload: function (obj, idx) {\n var dateObj = new Date(toISODate(obj.create_log.created_at)),\n date = m_names[dateObj.getMonth()] + ' ' + pad(dateObj.getDate(), 2),\n time = pad(dateObj.getHours(), 2) + ':' + pad(dateObj.getMinutes(), 2),\n entry = cr.ui.template.render_template('home_news_item.html', {\n news: obj,\n date: date,\n time: time\n });\n this.elem.insertBefore(entry, this.anchor_element);\n setTimeout((function () {\n this.classList.remove('loading');\n }).bind(entry), 100 * idx);\n },\n deleteAnchor: false\n });\n\n\n //Scroll Image\n var cHeight = skeleton.clientHeight,\n h = this.height * homepage.querySelector('.home-cover-wrapper').clientWidth / this.width,\n toY = h - (cHeight >> 1);\n if (toY > 0) {\n homepage.addEventListener('scroll', preventer);\n homepage.addEventListener('mousewheel', preventer);\n homepage.classList.add('scrolling');\n var scroll_manager = new cr.ui.Scroller(homepage);\n setTimeout(scroll_manager.scrollTo.bind(scroll_manager, 0, toY, 3000, function () {\n homepage.removeEventListener('scroll', preventer);\n homepage.removeEventListener('mousewheel', preventer);\n homepage.classList.remove('scrolling');\n homepage.scrollList.load();\n }, new cr.ui.UnitBezier(0.5, 0, 0.6, 1)), 700); //ease-out\n } else {\n homepage.scrollList.load();\n }\n\n function preventer(e) {\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n };\n cover.onerror = function () {\n cr.errorHandler({\n recObj: {\n errno: 500,\n error: \"Unable to load\"\n }\n });\n };\n cr.model.File.get(cover_id, function (cover_obj) {\n cover.src = cr.settings.resource_base + 'upload/' + cover_obj.url;\n });\n }", "title": "" }, { "docid": "83c2f6e23e48e247e11783b455aa59d7", "score": "0.59273225", "text": "function populateAnnouncements() {\n // Reset to avoid holdovers.\n titles = [];\n contents = [];\n\n // We fill in the order Main, [Library], Calendar.\n titles = mainTitles;\n contents = mainContents;\n\n if (showLibrary) {\n titles = titles.concat(libraryTitles);\n contents = contents.concat(libraryContents);\n }\n\n titles = titles.concat(calendarTitles);\n contents = contents.concat(calendarContents);\n\n // Reset the temporary announcement arrays to avoid holdovers.\n\n mainTitles = [];\n mainContents = [];\n libraryTitles = [];\n libraryContents = [];\n calendarTitles = [];\n calendarContents = [];\n}", "title": "" }, { "docid": "735159f521442a47272eaa7b3327dcf6", "score": "0.5924826", "text": "function getNews(){\r\n fetch(popularNewsURL)\r\n .then(res=>{return res.json()})\r\n .then(data=>{\r\n var bgArr = document.querySelectorAll('.popular');\r\n bgArr.forEach((bg,index)=>{\r\n bg.href = `${data.articles[index].url}`;\r\n bg.querySelector('img').src = `${data.articles[index].urlToImage}`;\r\n bg.querySelector('.title').innerHTML = `${data.articles[index].title}`;\r\n bg.querySelector('.source-box').innerHTML=`${data.articles[index].source.name}`;\r\n if(bg.querySelector('.credits')){\r\n var author = data.articles[index].author;\r\n if(author){\r\n var arr = author.split(' ');\r\n arr.splice(2,arr.length);\r\n author = arr.join(\" \");\r\n }else{\r\n author = \"\";\r\n }\r\n \r\n var date = new Date(`${data.articles[index].publishedAt}`);\r\n var dateStr = date.toDateString();\r\n var dateArr = dateStr.split(' ');\r\n dateArr.splice(0,1);\r\n dateStr = dateArr.join(\" \")\r\n bg.querySelector('.credits').innerHTML=`<span>${author}</span>${dateStr} `;\r\n if(author=\"\"){\r\n bg.querySelector('span').style.marginRight=\"0px\";\r\n }\r\n }\r\n })\r\n })\r\n .catch(err=>{\r\n alert(\"Failed to load the resource\");\r\n })\r\n \r\n var urlNewsLatest = \"https://newsapi.org/v2/everything?q=(covid%20OR%20corona)&pageSize=20&language=en&sortBy=publishedAt&apiKey=06d643609e7e4d3da735fb808ca1df76\";\r\n fetch(urlNewsLatest)\r\n .then(res=>{\r\n return res.json()\r\n })\r\n .then(data=>{\r\n var i=0;\r\n var brkCtr=0;\r\n var html;\r\n var parentNews = document.querySelector('.news-cards-container');\r\n\r\n var observer;\r\n var options = {\r\n root: null,\r\n rootMargin: \"0px\",\r\n threshold: 0.5\r\n };\r\n var loader = document.querySelector('.loader');\r\n observer = new IntersectionObserver(entries=>{\r\n entries.forEach(entry=>{\r\n if(entry.intersectionRatio>0){\r\n //put function hear\r\n setTimeout(()=>{\r\n for(i;i<data.articles.length;i++){\r\n if(data.articles[i].description===null){\r\n continue;\r\n }\r\n\r\n if(data.articles[i].description!=null || data.articles[i].description!==\" \"|| data.articles[i].description!==\"\"||data.articles[i].description!=\"null\"){\r\n if(data.articles[i].description.includes(\"<\"))continue;\r\n else{\r\n var date = new Date(`${data.articles[i].publishedAt}`);\r\n var dateStr = date.toDateString();\r\n var dateArr = dateStr.split(' ');\r\n dateArr.splice(0,1);\r\n dateStr = dateArr.join(\" \");\r\n \r\n var imgSrc = data.articles[i].urlToImage;\r\n if(imgSrc==null || imgSrc==\"\"){\r\n imgSrc= \"../IMAGES/component.png\";\r\n }\r\n html = `<a href=\"${data.articles[i].url}\" class=\"news-card\"><div class=\"news-card-image-box\"><img src=\"${imgSrc}\"></div><div class=\"source\">${data.articles[i].source.name}</div><div class=\"news-card-text-box\"><p class=\"date\">${dateStr}</p><h2 class=\"title\">${data.articles[i].title}</h2><p class=\"description\">${data.articles[i].description}</p></div></a>`;\r\n parentNews.insertAdjacentHTML('beforeend',html);\r\n brkCtr++;\r\n if(brkCtr ===9){\r\n i++;\r\n brkCtr=0;\r\n break;\r\n }\r\n }\r\n }else{\r\n continue\r\n }\r\n\r\n }\r\n },1000)\r\n\r\n if(i == data.articles.length ){\r\n loader.style.display=\"none\";\r\n document.querySelector('footer').classList.remove('hidden')\r\n }\r\n }\r\n })\r\n }, options);\r\n observer.observe(loader);\r\n\r\n \r\n })\r\n\r\n}", "title": "" }, { "docid": "2482f43af3c59c4ff2d9f09f823f0f27", "score": "0.591394", "text": "function getNewsByCategory(category) {\n\n // Define API's URL\n var url = 'http://newsapi.org/v2/top-headlines?' +\n 'country=ie&' +\n 'category=' + category + '&' +\n 'apiKey=4cf06e310e25466dabb55f9ace0f417d';\n\n // Request through jQuery Ajax GET method\n $.get(url, function (data) { // data is the returned object\n\n var news = [];\n\n // For each article returned, map the information\n data.articles.forEach(article => {\n\n if (!checkTitleInArray(article.title)) {\n\n //Create a JSON object with only the information that will be showed\n var json = {\n title: article.title,\n description: article.description != null ? article.description : \"\", // null treatment\n urlToImage: article.urlToImage,\n datetime: article.publishedAt\n };\n\n // Add the JSON object into news Array\n news.push(json);\n }\n });\n\n setItemOnLocalStorage(news, category);\n\n }, \"json\");\n}", "title": "" }, { "docid": "9d5cdec900b3b3f768229bc526f4e593", "score": "0.59039897", "text": "function appendStoriesToList(dataList) {\n\t\n\tdataList.forEach(function(data) {\n\t\tvar storyDOMElement = $('#story-dom-element').clone().removeClass('hidden').removeAttr('id');\n\t\t\n\t\tstoryDOMElement.attr('data-story-id', data.id);\n\t\tstoryDOMElement.find('a').attr('href', '/story/' + data.id + '/');\n\t\t\n\t\tif (data.has_image) {\n\t\t\timageURL = data.image_url;\n\t\t\timageURL = imageURL.replace('/upload/', '/upload/w_360,h_120,c_thumb/');\n\t\t\t\n\t\t\t// Use lazy loading for image\n\t\t\tstoryDOMElement.find('img').attr('data-original', imageURL).lazyload({\n\t\t\t\teffect: 'fadeIn',\n\t\t\t\tevent: 'inview',\n\t\t\t});\n\t\t} else {\n // Update background color of fake block randomly\n storyDOMElement.find('.fake-block').css(\n 'background-color',\n '#' + Math.floor(Math.random() * 16777215).toString(16)\n );\n }\n\t\t\n\t\tstoryDOMElement.find('.caption-title').text(data.title);\n\t\t\n\t\tif (data.contributors_count > 1) {\n\t\t\tstoryDOMElement.find('.caption-contributors').text(data.author_nickname + '님 외 ' + \n\t\t\t\tparseInt(data.contributors_count - 1) + '명이 함께 만듭니다');\n\t\t} else {\n\t\t\tstoryDOMElement.find('.caption-contributors').text(data.author_nickname + '님이 시작하셨습니다');\n\t\t}\n\t\t\n\t\tstoryTags = data.tags; \n\t\tif (storyTags == null || storyTags.length == 0) {\n storyDOMElement.find('.caption-tags').addClass('hidden');\n } else {\n\t\t\tstoryTags.forEach(function(tag) { \n\t\t\t\tstoryDOMElement.find('.caption-tags').append('#' + tag + ' ');\n\t\t\t});\n\t\t}\n\t\t\n\t\tstoryDOMElement.find('.hits').text(data.hits);\n\t\tstoryDOMElement.find('.comments-count').text(data.comments_count);\n\t\tstoryDOMElement.find('.favorites-count').text(data.favorites_count);\n\t\t\n\t\t$('#story-list').append(storyDOMElement);\n\t});\n}", "title": "" }, { "docid": "c12f64469616ffe5d9db0ee22024c4ae", "score": "0.5860225", "text": "function homeArticles(data){\n for(var i=0 ; i<data.length ;i++){\n $(\".blog-content__wrapper\").append($(\"<article>\").append($('<h2>').html(data[i].title)));\n $(\"article:last\").append($('<p>').html(data[i].body));\n }\n }", "title": "" }, { "docid": "56af102987fe2f22ac619fb8b35ca0c2", "score": "0.5857641", "text": "function createList(data) {\n var $ul = $('ul.list-group');\n $.each(data, function (idx, val) {\n var $li = new $('<li>');\n if (val.date > moment()) { // ----------------------------------------------future\n $li.text(moment(val.date).format('D') + ' ' + moment(val.date).format('MMMM'));\n } else { // ----------------------------------------------past\n var $a = new $('<a>');\n $a.attr(\"href\", \"#\");\n $a.text(moment(val.date).format('D') + ' ' + moment(val.date).format('MMMM'));\n $a.click(function () { // load List\n $.ajax({\n url: \"data/rankings/\" + val.id + \".json\",\n type: 'HEAD',\n error: function () {\n //file not exists\n alert(\"This ranking wasn't yet provided\");\n },\n success: function () {\n //file exists\n $(\"#main-content\").load(\"./partials/list.html\", null, function () {\n setTimeout(function () {\n removeAds();\n }, 400);\n List.getInstance().init(val.id);\n });\n }\n });\n\n\n });\n $a.appendTo($li);\n }\n\n $li.addClass('list-group-item');\n $li.appendTo($ul);\n });\n }", "title": "" }, { "docid": "7c805c05b05b6405f6a561a7b8c7ada7", "score": "0.5845278", "text": "function searchNews () {\n var search = localStorage.getItem(\"state-name\");\n var url = \"https://api.nytimes.com/svc/search/v2/articlesearch.json\";\n // var search = $(\"#states option\").value(); //$(\"#states option\").value();\n url += '?' + $.param({\n 'api-key': \"352588500d894acf9e98863456d5095f\",\n 'q': search + \"+politics\"\n });\n $.ajax({\n url: url,\n method: \"GET\"\n }).then(function (x) {\n // console.log(x.response.docs[0].web_url);\n // console.log(x.response.docs[0].headline.main);\n var articleIndex = x.response.docs\n \n for(var i = 0; i < articleIndex.length; i++){\n var newsUrl = articleIndex[i].web_url\n var newsTitle = articleIndex[i].headline.main\n var link = \"<li><a href =' \" + newsUrl + \" '>\" + newsTitle + \"</a></li>\";\n // console.log(link);\n $(\"#topStories\").append(link); \n }\n });\n }", "title": "" }, { "docid": "de067f5f4f9653b8cb402af5252a1c86", "score": "0.5842594", "text": "function DisplayNewNews ({newNews}) {\n\n return (\n <ul className=\"newsContainer\">\n {newNews.map((news) => {\n return newsEntry(news)\n })}\n </ul>\n )\n}", "title": "" }, { "docid": "6ebd5b71e0a9b2c3117e566514a01235", "score": "0.5826569", "text": "function news(){\n\t\tpresentation.showLoader();\n\t\tapi.getNews().then(function(json){\n\t\t\tconst indexNews = randomIndex(20);\n\t\t\tpresentation.newsToDom(json.results[indexNews]);\n\t\t\tpresentation.showLoader();\n\t\t})\n\t\t.catch(function(error){\n\t\t\tconsole.log(error); \n\t\t\tpresentation.showLoader();\n \t\t});\n\t}", "title": "" }, { "docid": "7dfaf16f100a20a8964f603e5fab7095", "score": "0.5826084", "text": "function buildNotificationList(data){\n\t$(\"#list-push\").empty();\n\tfor(var i in data.results){\n\t\tvar objectID=data.results[i].objectId;\n\t\tvar link=addParameter('news.html','objectID',objectID);\n\t\tvar push = '<a href=\"'+link+'\" rel=\"external\" class=\"list-group-item\"> <h4 class=\"list-group-item-heading\">'+data.results[i].title+'</h4><span class=\"glyphicon glyphicon-chevron-right pull-right\"></span><p class=\"list-group-item-text\">'+data.results[i].message.substring(0,50)+'</p> </a>';\n\t\t$(\"#list-push\").append(push);\n\t}\t \n\t$('#list-push').show();\n}", "title": "" }, { "docid": "ffa23025316d9e747b8c4e574600ed66", "score": "0.581701", "text": "function loadAllEntries() {\n var allEntriesURL = django_js_utils.urls.resolve(\"get-all-stories-with-title\");\n $.getJSON(allEntriesURL, function (data) {\n var entryList = $(\"section#list-section ul\");\n $.each(data, function (index, value) {\n entryList.append(\"<li><a href='#' class='open-entry' data-location='\" + value[\"location\"] + \"' data-entry='\" + value[\"id\"] + \"'>\" + value[\"title\"] + \"</a></li>\");\n });\n $(\"img#load-more-list\").hide();\n addOpenEntryEvent();\n });\n}", "title": "" }, { "docid": "e0c069a0747c3733a417205ce693a719", "score": "0.57915324", "text": "function getNews() {\n var requestNewUrl = \"https://api.nytimes.com/svc/search/v2/articlesearch.json?q=\" + \"sports\" + \"&api-key=3XNPIhbw16I5OElGvNEztFieigRzON44\"\n fetch(requestNewUrl)\n .then(function (response) {\n return response.json();\n })\n .then(function (detail) {\n var getArticles = detail.response.docs;\n let outputNews = `<div class=\"row plate flex\">\n <img src=\"assets/img/football-banner.jpg\" class=\"team-Box-Icon\">\n \n <div class=\"row flex\">\n <div class=\"col s12 m12 l12\">\n <h4><span class=\"stat-header\">Latest Sports News:</span></h4>\n </div>\n </div>\n <div class=\"row flex\">\n <div class=\"col s12 m12 l12\"> \n `\n ;\n $.each(getArticles, function (i, val) {\n if (i > 5) return;\n outputNews += ` \n <a target=\"_blank\" href=\"${this.web_url}\"><p>${this.headline.main}\n <i class=\"tiny material-icons\">launch</i></a></p>\n \n `;\n\n \n\n })\n $('#teamDetails').before(outputNews);\n })\n }", "title": "" }, { "docid": "2429bb77ed14462be9b5cdace0699836", "score": "0.5786048", "text": "function listItems(items) {\n //get the area for posts\n var itemList = document.querySelector('#item-list');\n itemList.innerHTML = ''; // clear current results\n\n for (var i = 0; i < items.length; i++) {\n addItem(itemList, items[i]); // List all the content\n }\n }", "title": "" }, { "docid": "b840ca45e9cc9339c5e09df455d4728f", "score": "0.5776913", "text": "function appendList(arrayBlogItems){\n const blogList = arrayBlogItems.map( (blog_entry) =>{\n let node = createBlogNode(blog_entry);\n document.querySelector(\"#blog-posts\").appendChild(node)\n return createBlogNode(node);\n });\n document.querySelector(\"#most-recent\").appendChild(\n createBlogNode(FEATURED)\n );\n console.log(blogList);\n\n}", "title": "" }, { "docid": "499516d0e04b230a904f2db008c6591e", "score": "0.5774161", "text": "function updateLists() {\n while(listDiv.hasChildNodes()) {\n listDiv.removeChild(listDiv.lastChild);\n }\n //var list = listArray[0];\n\nfunction addHTMLForList(list, index) {\n var aElement = document.createElement(\"a\");\naElement.classList.add(\"list-group-item\");\naElement.classList.add(\"list-group\");\naElement.classList.add(\"list-group-item-action\");\n\naElement.setAttribute(\"data-index\", index);\n\nvar textNode = document.createTextNode(list.name);\naElement.appendChild(textNode);\n\nconsole.log(aElement);\nlistDiv.appendChild(aElement);\n\n\n}\n\nlistArray.forEach(addHTMLForList);\n\n\n\n\n\n}", "title": "" }, { "docid": "56c8302c27a1d389b9cb82513219320e", "score": "0.576535", "text": "function displayStockNews(json) {\n console.log('made-it');\n for (let i = 0; i < json.length; i++) {\n $('.stock-news').append(`<li class=\"news\"><p>${json[i].source} | ${json[i].datetime.slice(0,10)} </p><h4>${json[i].headline} </h4>\n </li>`)\n }\n\n}", "title": "" }, { "docid": "2e66539e69e97188587dd6ff4574c6b8", "score": "0.57630783", "text": "function getTopNews() {\n const newsURL = \n \"https://gnews.io/api/v3/top-news?token=672f4bdf76c091ef3a5381267aa41020\"\n fetch(newsURL)\n .then(function(response) {\n return response.json();\n })\n .then(function(data) {\n console.log(data)\n for (i = 0; i < 5; i++) {\n this[\"article\" + i] = document.getElementById(\"article-\" + i)\n this[\"article\" + i].textContent = data.articles[i].title\n this[\"article\" + i].href = data.articles[i].url;\n \n \n\n }\n \n })\n }", "title": "" }, { "docid": "560e8561813668db40428670eb962cc6", "score": "0.57499427", "text": "function updateTopList(data, community_id, list_id){\n let wikiroot = \"https://en.wikipedia.org/wiki/\";\n\n let top_list_data = data.filter(function(d) {\n return d.louvain_community == community_id;\n });\n let topListElement = document.getElementById(list_id);\n\n // remove any existing data\n while (topListElement.firstChild) {\n topListElement.removeChild(topListElement.firstChild);\n }\n\n top_list_data.forEach(function(row) {\n let formatted_title = row[\"title\"].replace(/_/g,' ');\n if (formatted_title.length > 32) {\n formatted_title = formatted_title.substring(0, 32) + \"...\";\n }\n let html = \"<a href='\" + wikiroot + row[\"title\"]\n + \"' target='_blank'>\" + formatted_title + \"</a>\";\n let newListItem = document.createElement(\"li\");\n newListItem.innerHTML = html;\n topListElement.appendChild(newListItem);\n });\n\n }", "title": "" }, { "docid": "1d75e24fd6cb7233d2c835c825102318", "score": "0.5748387", "text": "function ListCreator() {\n for (section of AllSections){\n Name = section.getAttribute(\"data-nav\"); // take the name of the section\n Link = section.getAttribute(\"id\"); // the the id of the section\n Item = document.createElement(\"li\"); // create a new list in the (ul)\n Item.setAttribute(\"class\", \"nav-item active\"); // adding bootsrap class to (li)\n Item.innerHTML = `<a class='menu__link nav-link' data-nav='${Link}' href='#${Link}'>${Name}</a>`; // create the link of the section\n ListItem.appendChild(Item); // add the child (li) to (ul)\n }\n}", "title": "" }, { "docid": "c541965829f2e8fff194cbda329f23e1", "score": "0.57478696", "text": "async getLocalNews() {\n try {\n this.setState({ nytNews: [] });\n this.setState({ localNews: [] });\n this.setState({ movies: [] });\n this.setState({ tvShows: [] });\n this.setState({ localSportNews: [] });\n\n const response = await fetch(\n `https://newsapi.org/v2/top-headlines?country=${this.state.ipInfo.country.toLowerCase()}&apiKey=${LnewsApi}`\n );\n const data = await response.json();\n\n // console.log('Local News Api',data.articles)\n this.setState({\n localNews: data.articles,\n widgetSearchRequestText: \"Local News\",\n widgetSearchRequestURL: \"Local News\",\n });\n } catch (err) {\n console.log(\"localnews ooooooops\", err);\n }\n }", "title": "" }, { "docid": "f8b0cb34f3710479fac1c005c321a635", "score": "0.5731781", "text": "function showCategories(){\n //step 1 : get the categories ul from the html document\n let categoryList = document.getElementById('categoryList');\n //bonus step : clear the previouse items in the list\n categoryList.innerHTML =``;\n //step 2 : loop through categories array \n for (let index = 0; index < categories.length; index++) {\n \n\n //step 3 : to create a 'li' for each elemnt in the array categories and add it to the categoryList 'ul'\n categoryList.innerHTML += `<li>${categories[index]}</li>`; \n }\n }", "title": "" }, { "docid": "3b85b16182d0f8550065e142ff0ba74e", "score": "0.5727054", "text": "function newsApi() {\n $.get(`https://accesscontrolalloworiginall.herokuapp.com/https://newsapi.org/v2/top-headlines?country=ca&apiKey=${newsApiKey}`).then((response) => { \n $newsApiArray4 = response.articles;\n console.log(\" News Api\" , $newsApiArray4); \n let $list = $(\"#getNewsApi\");\n $.each($newsApiArray4, function (index) {\n let url_n = this.url;\n let showTitle = this.title;\n let description = this.description;\n let news = this.source.name;\n let newsPhoto = this.urlToImage;\n let publishedAt = this.publishedAt;\n let fallBackImage = `./images/mineralwater-blueberry.jpg`;\n \n let $getList = $('<li> </li>').addClass('product-item');\n let $showIndex = $(`<div>${index + 1}</div>`).addClass('show-index');\n let $vElement = $('<img>').attr('src', this.urlToImage || fallBackImage).addClass('product-image');\n $getList.append($showIndex)\n .append($vElement); \n $list.append($getList);\n \n // create up vote element\n let $upVoteElement = $('<i class=\"fa fa-thumbs-up pull-right\"></i>');\n $( \".fa-thumbs-up\" ).attr( \"title\", \"Like\" );\n $upVoteElement.on('click', function (evt) {\n evt.preventDefault();\n updateDisplay(evt);\n evt.target.focus();\n });\n \n // create down vote element\n let $downVoteElement = $('<i class=\"fa fa-thumbs-down pull-right\"></i><span></span>');\n $( \".fa-thumbs-down\" ).attr( \"title\", \"Dislike\" );\n $downVoteElement.on('click', function (evt) {\n evt.preventDefault();\n updateDownVote(evt);\n \n });\n let $lftIcon = $('<span class=\"material-icons\">format_color_fill</span>').addClass('vote');\n\n $lftIcon.on('click', function () {\n var fontColors = [ '#9aa0a6', '#ffffff' ];\n fontColors.reverse();\n var font_random_colors = fontColors[Math.floor(Math.random() * fontColors.length)];\n var bgColors = [ '#202124', '#3f51b5', '#673ab7', '#6200ee' ];\n var bg_random_color = bgColors[Math.floor(Math.random() * bgColors.length)];\n $(\"header, .product-name, .show-vote, .show-index\").css({backgroundColor: bg_random_color, color: font_random_colors});\n });\n \n function updateDownVote(evt){\n let $count_down = 1;\n let current_count = $count_down++;\n if (!$count_down) {\n alert(\"Hey, Down Vote not working\");\n } else { \n $(evt.target).text(`${current_count}`);\n evt.target.focus();\n }\n console.log('counter', current_count)\n }\n\n function updateDisplay(evt){\n let $count_up = 1; \n let current_count = $count_up++;\n if (!$count_up) {\n alert(\"Hey, Like vote not working\");\n } else {\n $(evt.target).text(`${current_count}`);\n evt.target.focus();\n }\n console.log('counter', current_count)\n };\n\n \n let $getDescription = $(`<section> \n <article class=\"first-row\"><div>${index + 1}</div><div>${news}</div></article>\n <p>${description}</p>\n <a href=\"${url_n}\" class=\"readMore\" target=\"_blank\">Read more</a>\n </section>`).addClass('product-name');\n $getList.append($getDescription); \n\n let $rateRow = $(`<div\"></div>`).addClass('show-vote');\n $( \".vote\" ).attr( \"title\", \"Change Theme\");\n\n $getList.append($rateRow); \n $rateRow.append($lftIcon)\n .append($upVoteElement)\n .append($downVoteElement)\n });\n\n });\n }", "title": "" }, { "docid": "53a4ce4801ed4c7013c9ca77df8b5502", "score": "0.5723327", "text": "function HomePageNews()\r\n{\r\n /* Load All News Articles */\r\n $.getJSON('data/LJFDNews.txt', \r\n\t\tfunction(data)\r\n\t\t{\r\n News = data;\r\n\t\t\t/* Display the Active Headlines on the Home Page */\r\n\t\t\t$('#homeNews').html('<div class=\"grey-header\">HEADLINES</div>' +\r\n\t\t\t\t'<ul id=\"news\" class=\"niceList\">');\r\n\t\t\t$.each(News, function(index, data)\r\n\t\t\t\t{\r\n if (this.Display == 'Y' || this.Display == 'y')\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$('ul#news').append('<li><a class=\"faq\" href=\"#\" onClick=\"displayNews('+index+')\">' + this.Heading + '</a></li>');\r\n\t\t\t\t\t};\r\n\t\t\t\t});\r\n// \t \t$('ul#news').append('<li><a class=\"faq\" href=\"#\">News Archives...</a></li>');\r\n\t\t\t$('#homeNews').append('</ul>');\r\n\t\t});\r\n}", "title": "" }, { "docid": "db3fc498966080852df6d3d8623f28a9", "score": "0.5717663", "text": "function createEls(){\n\t\tif(arrayLS.length === 0) container.innerHTML='';\n\t\tlet li = '';\n\t\t// create and add\n\t\tarrayLS.forEach((item,index)=>{\n\t\t\tli += `<li class=\"photo__item js__item\"><img src=\"${item.src}\" alt=\"photo\"></li>`;\n\t\t\tcontainer.innerHTML = li;\n\t\t})\n\t}", "title": "" }, { "docid": "44b02f5f8116db8e3a187cb43bbd2cff", "score": "0.5716852", "text": "function pillaUpdateMainlist(items) {\n\t\t$('#pilla_main_list').empty();\n\t\tfor (i = 0; i < items.length; i++) {\n\t\t\tvar liEntry = $('<li data-icon=\"carat-r\">').html('<a href=\"#\" class=\"pilla_a_plName\">' + items[i].name + '<span class=\"ui-li-count\">' + items[i].count + '</span></a><a href=\"#\" class=\"pilla_a_plLink\">link</a>');\n\t\t\tif (items[i].default === 1) {\n\t\t\t\tliEntry.attr('data-theme', 'b');\n\t\t\t}\n\t\t\tliEntry.data(items[i]);\n\n\t\t\t$('#pilla_main_list').append(liEntry);\n\t\t}\n\t\t$('#pilla_main_list').listview('refresh');\n\t}", "title": "" }, { "docid": "63eb2f337d241c281152dffc3f6b23ea", "score": "0.57005036", "text": "function getNews(item){\n \n var URL = 'https://newsapi.org/v2/everything?q=' + item + 's&apiKey=d53b18e6f2bb4408bb4b79dd3dfb406b'\n \n $.ajax({\n url: URL,\n method: \"GET\"\n })\n .then(function(response){\n \n for(i = 0; i < 5; i++){\n var newsURL = response.articles[i].url;\n var title = response.articles[i].title;\n var dates = response.articles[i].publishedAt.substr(0,10);\n var author = response.articles[i].author;\n // replaces the special characters in the string company name so it can be used for class names\n var itemval=item.replace(/[^a-zA-Z ]/g, \"\").split(\" \").join(\"\");\n \n var tbody = $(\"#newsArticles\");\n var name = $(\"<td>\").text('Click here for latest news for '+item);\n var newslink = $(\"<td>\").html('<a href=\"'+newsURL+'\" target=\"blank\">'+title+' (Date: '+dates+') '+'Author: '+author+'</a>');\n var mainrow = $(\"<tr>\").append(name, \"<br>\").attr(\"val\", itemval).addClass(\"newslinks\");\n \n var table = $(\"<tr class=\"+itemval+\">\").append(newslink, \"<br>\");\n if(i==0){\n tbody.append(mainrow);\n }\n tbody.append(table);\n $('.'+itemval).hide(); \n $(\".newslinks\").unbind().on(\"click\", function(){ \n var click1 = \".\"+$(this).attr(\"val\");\n \n if(!clicked){\n $(click1).hide();\n clicked = true;\n }else if(clicked){\n $(click1).show();\n clicked = false;\n }\n }); \n };\n \n });\n }", "title": "" }, { "docid": "821604d03c7b5a8ac93c65d1bb3fde5b", "score": "0.5699512", "text": "function getNewestNewsTitle()\n{\n for (var i = 0; i < thisPageList.length; i++) getNewsTitle(i);\n}", "title": "" }, { "docid": "cf2a1436bd5dfa7edc68e2f1b9343f14", "score": "0.56985223", "text": "function getNews() {\n db.collection(\"News\")\n .orderBy(\"date\", \"desc\")\n .get()\n .then(function (snap) {\n\n var news = snap.docs;\n //console.log(news.length);\n\n news.forEach(newsItem => {\n //console.log(newsItem.data().link);\n //console.log(newsItem.id);\n\n let mainContainer = $(\"<div id = 'mainContainer' data-reference = \" + newsItem.id + \"></div>\");\n\n let titleContainer = $(\"<div id = 'titleContainer'></div>\");\n titleContainer.append(\"<h1>\" + newsItem.data().title + \"</h1>\");\n\n let bodyContainer = $(\"<div id = 'bodyContainer'></div>\");\n bodyContainer.append(newsItem.data().body);\n\n if (newsItem.data().link != null) {\n var linkContainer = $(\"<a id = 'linkContainer' href= \" + newsItem.data().link + \" >Link</a>\");\n }\n\n let timeContainer = $(\"<div id ='timeContainer'></div>\");\n timeContainer.append(newsItem.data().date.toDate());\n\n if (newsItem.data().link != null) {\n mainContainer.append(titleContainer, bodyContainer, linkContainer, timeContainer);\n } else {\n mainContainer.append(titleContainer, bodyContainer, timeContainer);\n }\n\n $(\"#newsContent\").append(mainContainer);\n });\n });\n }", "title": "" }, { "docid": "0602e4f79cb0659b613c4a53bb3650b8", "score": "0.5690965", "text": "function loadTitles() {\n $('.all_lessons').empty()\n $.each(lessonTitles, function (index, value) {\n $('<li><a href=\"#\" title=\"' + value + '\">' + value + '</a></li>').appendTo('.all_lessons').click(function () {\n curSlide = $(this).index() + 1\n loadContent(slide_src[curSlide - 1]);\n })\n })\n $('.all_lessons li').first().addClass('current')\n}", "title": "" }, { "docid": "e3c3367fff5ac4d74c985b0bace09bd7", "score": "0.56881374", "text": "function onLoad() {\n\t/* Get the latest news */\n\n}", "title": "" }, { "docid": "acaeb97bf55ac7e15d83a9b1e8d89937", "score": "0.5681935", "text": "function populateContent() {\n\n // Empty content string\n var postContent = '';\n\n // jQuery AJAX call for JSON\n $.getJSON( '/api/posts', function( data ) {\n\n postListData = data;\n\n $.each(data, function(){\n postContent += '<article>';\n postContent += '<h2>' + this.title + '</h2>';\n postContent += '<a class=\"edit\" href=\"#\" rel=\"' + this._id +'\">Edit</a>';\n postContent += '</article>';\n });\n\n $('#blogList').html(postContent);\n});\n}", "title": "" }, { "docid": "dedb401fcad51db2d6030ec29c4910bb", "score": "0.568189", "text": "function getDetails(index) {\n var i = 0;\n for(i = 0; i < index.length ; i++) {\n $.ajax({\n url: \"https://hacker-news.firebaseio.com/v0/item/\" + index[i] + \".json?print=pretty\",\n // Handle as Text\n dataType: \"text\",\n success: function(data) {\n // Parse JSON file\n var json = $.parseJSON(data);\n newsTime = json.time;\n date = new Date(newsTime * 1000);\n newsTime = date;\n var curr_date = newsTime.getDate();\n var curr_month = newsTime.getMonth() + 1; //Months are zero based\n var curr_year = newsTime.getFullYear();\n var newsDate = curr_date + \"-\" + curr_month + \"-\" + curr_year;\n \n $( \"#filters\" ).change(function() {\n $('.all-news-container').show();\n $('.favourites-container').hide();\n if($( \"#filters option:selected\" ).text() == \"All\") {\n $(\"#last_one_month\").html(\"\");\n $(\"#last_week\").html(\"\");\n $(\"#all_news\").append(\"<li><div class='title'><a href='\" + json.url + \"' target='_blank'>\"+json.title+\"</a></div><span class='points'>\"+json.score+\" points by \"+ json.by+ \" \" + newsDate + \"</span><div class='clearfix'></div><div class='add-to-fav fav-\"+json.id+\"' onclick='storeLocal(\\\"\" +json.url + \"\\\",\\\"\" +json.title + \"\\\",\\\"fav-\" +json.id + \"\\\");'>Add to favourites</div></li>\");\n } else if ($( \"#filters option:selected\" ).text() == \"Top Articles (Last Week)\") {\n var Todaysdate = new Date();\n var backDate = Todaysdate.setDate(Todaysdate.getDate() - 7);\n var dateString = backDate / 1000;\n $(\"#all_news\").html(\"\");\n $(\"#last_one_month\").html(\"\");\n if((json.time > dateString) && (json.score >= 250)) {\n $(\"#last_week\").append(\"<li><div class='title'><a href='\" + json.url + \"' target='_blank'>\"+json.title+\"</a></div><span class='points'>\"+json.score+\" points by \"+ json.by+ \" \" + newsDate + \"</span><div class='clearfix'></div><div class='add-to-fav fav-\"+json.id+\"' onclick='storeLocal(\\\"\" +json.url + \"\\\",\\\"\" +json.title + \"\\\",\\\"fav-\" +json.id + \"\\\");'>Add to favourites</div></li>\");\n }\n }\n else if($( \"#filters option:selected\" ).text() == \"Top Articles (Last Month)\") {\n var Todaysdate = new Date();\n var backDate = Todaysdate.setDate(Todaysdate.getDate() - 30);\n var dateString = backDate / 1000;\n $(\"#all_news\").html(\"\");\n $(\"#last_week\").html(\"\");\n if((json.time > dateString) && (json.score >= 250)) {\n $(\"#last_one_month\").append(\"<li><div class='title'><a href='\" + json.url + \"' target='_blank'>\"+json.title+\"</a></div><span class='points'>\"+json.score+\" points by \"+ json.by+ \" \" + newsDate + \"</span><div class='clearfix'></div><div class='add-to-fav fav-\"+json.id+\"' onclick='storeLocal(\\\"\" +json.url + \"\\\",\\\"\" +json.title + \"\\\",\\\"fav-\" +json.id + \"\\\");'>Add to favourites</div></li>\");\n }\n }\n });\n $(\"#all_news\").append(\"<li><div class='title'><a href='\" + json.url + \"' target='_blank'>\"+json.title+\"</a></div><span class='points'>\"+json.score+\" points by \"+ json.by+ \" \" + newsDate + \"</span><div class='clearfix'></div><div class='add-to-fav fav-\"+json.id+\"' onclick='storeLocal(\\\"\" +json.url + \"\\\",\\\"\" +json.title + \"\\\",\\\"fav-\" +json.id + \"\\\");'>Add to favourites</div></li>\");\n assignButtonText(json.title, \"fav-\" +json.id);\n }\n });\n i++;\n }\n }", "title": "" }, { "docid": "f51aac0482358a1b51ca264436c72e0e", "score": "0.5679681", "text": "function displayNewsResults(responseNewsJson, maxResults) {\n $('#news').empty();\n for (let i = 0; i < responseNewsJson.articles.length & i < maxResults; i++) {\n $('#news').append(\n\n `<br>\n <article class=\"media\">\n <figure class=\"media-left\">\n <p class=\"image is-128x128\">\n <img src='${responseNewsJson.articles[i].urlToImage ? responseNewsJson.articles[i].urlToImage : 'https://upload.wikimedia.org/wikipedia/commons/thumb/e/e4/Comic_image_missing.svg/948px-Comic_image_missing.svg.png'}'> \n </p>\n </figure>\n <div class=\"media-content\">\n <div class=\"content\">\n <p>\n <a target=\"blank\" href=\"${responseNewsJson.articles[i].url}\"><strong>${responseNewsJson.articles[i].title}</strong></a> \n <br>\n <br>\n ${responseNewsJson.articles[i].description}\n </p>\n </div>\n </div>\n </article>\n <hr>`\n )\n };\n}", "title": "" }, { "docid": "8d6f456e4e947c47858de6d855a7f775", "score": "0.5677001", "text": "function populateAnimalList(obj) {\n var animalObjAry = obj.animalArray;\n for (var i = 1; i <= animalObjAry.length; i++) {\n var newLi = $(\"<li>\");\n var newImg = $(\"<img>\");\n newImg.addClass(\"mr-3 thumbnail\").attr(\"src\", animalObjAry[i].imgURL).attr(\"alt\", animalObjAry[i].name).attr(\"style\", \"min-width: 65px;\");\n var newDiv = $(\"<div>\");\n newDiv.addClass(\"media-body\");\n var newH5 = $(\"<h5>\");\n newH5.addClass(\"mt-0 mb-1\").text(animalObjAry[i].name);\n var newAnchor = $(\"<a>\");\n newAnchor.attr(\"href\", animalObjAry[i].wikiLink).attr(\"target\", \"_blank\").addClass(\"wiki-link\").text(animalObjAry[i].wikiLink);\n newDiv.append(\n newH5,\n newAnchor\n );\n newLi.addClass(\"media\").append(\n newImg,\n newDiv\n );\n $(\"#animal-list\").append(newLi);\n }\n}", "title": "" }, { "docid": "82bc0e11ad86894370a9abdf4989dc00", "score": "0.567317", "text": "function createList() {\n for (let element of sections) {\n let navbarList = document.createElement('li');\n navbarList.className = 'menu__link';\n navbarList.dataset.nav = element.id;\n navbarList.innerText = element.dataset.nav;\n navbar.appendChild(navbarList);\n }\n}", "title": "" }, { "docid": "7099fb0ba0dd9515de928f753e17ae2c", "score": "0.5654963", "text": "function createListItemFromArticle(objFromApi, numInList) {\n\t// the more complicated stuff are the date and the url\n\n\t// objFromApi.publishDate is a formatted string, so parse it\n\tvar publishDate = objFromApi.publishDate;\n\tpublishDate = publishDate.substring(0, 10) + \" \" +\n\t\tpublishDate.substring(11, 19);\n\tvar date = new Date(publishDate.replace(/-/g, \"/\"));\n\t// format of the date is month/day/year\n\t// may change later\n\tvar time = \"\" + (date.getMonth() + 1) + \"/\" + date.getDate() + \"/\" +\n\t\tdate.getFullYear();\n\n\t// the URL is based on objFromApi.slug, and the above date\n\tvar month = (date.getMonth >= 9) ? (\"\" + (date.getMonth() + 1))\n\t\t: (\"0\" + (date.getMonth() + 1));\n\tvar url = \"http://www.ign.com/articles/\" + date.getFullYear() +\n\t\t\"/\" + month + \"/\" + date.getDate() + \"/\" +\n\t\tobjFromApi.slug;\n\n\t// now just add in other parameters\n\treturn new ListItem(numInList, true, objFromApi.headline,\n\t\tobjFromApi.subHeadline, time, url);\n}", "title": "" }, { "docid": "ac577f3c43114423108f65864d2242c7", "score": "0.5653199", "text": "function initNews(city) {\n const filterEl = document.querySelector('filter-list');\n if (filterEl) {\n let articles = [`Warning: you need to evacuate`, `Evacuation notice sent for greater ${city} area`, `${city} in peril`, `Find your temporary safe shelter`, `Water levels increasing as hurricane approaches`, `10 suggestions for better hurricane names`, `What our previous hurricanes can teach us`, `National Guard on standby for relief efforts`, `Searching for a place to sleep`, `Where to expect the worst floods`, 'What to pack and what not to pack when evacuating', `List of evacuation shelters near ${city}`, 'How to take care of your pets during a disaster'];\n\n filterEl.items = articles;\n }\n}", "title": "" }, { "docid": "77b5b1dcfbdb7909489b95a8ba0ea839", "score": "0.5646762", "text": "function CreateElements () {\n\n for(let i=0; i<list.length; i++)\n {\n const newElement = document.createElement('li');\n const newElement_a = document.createElement('a');\n newElement_a.setAttribute('class', 'menu__link'); \n newElement_a.classList.add(`section${i+1}`);\n const content = mysection[i].getAttributeNode(\"data-nav\").value;\n newElement_a.textContent = content;\n \n newElement.appendChild(newElement_a); \n menu.appendChild(newElement); \n } \n}", "title": "" }, { "docid": "70805eeae2a9877286fa9ac958e5a62f", "score": "0.5641227", "text": "function getNews(searchTerm) {\n\n // fetch news based on searchTerm entered by user through on-click input\n fetch(url + searchTerm + '&' + newsKL).then(function(response) {\n if (response.ok) {\n response.json()\n .then(function(response) {\n\n // retrieves information from searchList, if there are articles found, it begins to sort them\n if (!searchList.includes(response.response.docs)) {\n\n /* clears arrays before for-loop is utilized */\n articles.splice(0, articles.length);\n noImgArt.splice(0, noImgArt.length);\n\n for (var i = 0; i < response.response.docs.length; i++) {\n // console.log(response.response.docs[i].abstract);\n\n // if image is available, push to articles array\n if (response.response.docs[i].multimedia.length > 0) { \n\n // if images are found in article, it is pushed to articles array\n articles.push(\n {\"headline\" : response.response.docs[i].headline.main, \n \"image\" : response.response.docs[i].multimedia[0].url, \n \"url\" : response.response.docs[i].web_url}\n );\n \n /* for debugging purposes */\n //console.log(response.response.docs[i].headline.main + response.response.docs[i].multimedia[0].url + response.response.docs[i].web_url);\n }\n \n // if image is not available, they're pushed to noImgArt array\n else { \n noImgArt.push(\n {\"headline\" : response.response.docs[i].headline.main, \n \"url\" : response.response.docs[i].web_url,\n \"abstract\" : response.response.docs[i].abstract}\n );\n\n /* for debugging purposes */\n //console.log(response.response.docs[i].headline.main + response.response.docs[i].web_url);\n }\n }\n\n // provides information for the #newsResults & #otherNews elements\n makeCard()\n }\n })\n }\n })\n}", "title": "" }, { "docid": "0525947a9508f1a72d1e3818beb1d111", "score": "0.56406593", "text": "function fillblogtable() {\r\n // clear the table so we don't repeat information\r\n clearBlogTable();\r\n var blogtable = $('#blogtable');\r\n // grab HTML element into which we're going to load the data\r\n var recentnumber = 0;\r\n var bList = $('#recent' + recentnumber++);\r\n // iterate through each of the JSON objects in the test data and render\r\n // them into the list\r\n $.ajax({\r\n url: 'blogs'\r\n }).success(function (data, status) {\r\n do {\r\n $.ajax({\r\n url: '/sidebarfragment'\r\n }).success(function (data, status) {\r\n $.each(data,function (index,blog) {\r\n bList.append( $('ol')\r\n .append($('li')\r\n .append($('<a>')\r\n .attr({'data-blog-id': blog.blogId, 'data-target': '#blogtable'})\r\n .text(blog.blogTitle)\r\n )\r\n )\r\n );\r\n });\r\n\r\n });\r\n recentnumber++;\r\n } while (recentnumber < 5 + 1);\r\n });\r\n}", "title": "" }, { "docid": "061dabc3c20419b06cf1e028725c40c1", "score": "0.56382823", "text": "function createLi(){\n // for loop to create list item according to number of sections\n for ( section of sections){\n\n let secNam = section.getAttribute('data-nav');\n\n let secLink = section.getAttribute('id');\n\n let listItem = document.createElement('li');\n\n // add the link in the item to scroll from nav\n listItem.innerHTML = `<a class=\"menu__link\" href=\"#${secLink}\">${secNam}</a>`;\n navUl.appendChild(listItem);\n }\n}", "title": "" }, { "docid": "6826a4b40c80e87fcb55470ee650a918", "score": "0.5638203", "text": "function updateList () {\n // empty out list\n var list = DOM('list')\n list.innerHTML = \"\"\n\n const data = fetch(\"/entry\")\n .then(response => {\n return response.json()\n }).then(json => {\n json.forEach(item => {\n appendListItem(item)\n })\n // recalculate pages\n pageManager.checkHeight()\n }).catch(error => {\n console.log(error);\n });\n}", "title": "" }, { "docid": "81afa03790e916d73b56b510dd3bcb15", "score": "0.5637117", "text": "function createListItem(){\n for (section of sections){\n // get the data nav attribute to use it as a name for the item\n itemName = section.getAttribute(\"data-nav\");\n // creat new item for each section\n newItem = document.createElement(\"li\");\n // connect the name and link attributes to the new created item\n newItem.innerHTML = `<a class='menu__link' href='#${section.id}' data-id='${section.id}'> ${itemName} </a>`;\n // add the item to the DOM\n document.getElementById(\"navbar__list\").appendChild(newItem);\n }\n}", "title": "" }, { "docid": "e334b93b8f717e5aaa7316984b2dede7", "score": "0.56348586", "text": "function renderNewsArticles(articles) {\n if (articles.length > 0) {\n $(\"#articles-list\").html(\"\").hide();\n var articlesParsed = articles;\n $.each(articlesParsed, function(key,value){\n var template = \n `<div class='article'>\n <a target='_blank' href=\"${ value.link }\">\n <h3>${ value.date }</h3>\n <h2 class='article-title'>${ value.title }</h2>\n <div class='article-desc'>${ value.desc }</div>\n <div class='article-foot'>Source: ${ value.url }<br>${ value.word }</div>\n </a>\n </div>`;\n $(\"#articles-list\").append(template);\n });\n $(\"#articles-list\").fadeIn();\n } else {\n $(\"#articles-list\").fadeOut();\n }\n}", "title": "" }, { "docid": "fc2bc3fcb0e0d4ff2463f2e40e415653", "score": "0.5634138", "text": "function computePageNews()\n{\n thisPageList.length = 0;\n if (currentPage < pageAmount)\n for (var i = 0; i < 5; i++)\n thisPageList.push(existNews[newsAmount - 5 * (currentPage - 1) - i - 1]);\n else\n {\n if (newsAmount % 5 != 0)\n for (var i = 0; i < (newsAmount % 5); i++)\n thisPageList.push(existNews[newsAmount - 5 * (currentPage - 1) - i - 1]);\n else\n for (var i = 0; i < 5; i++)\n thisPageList.push(existNews[newsAmount - 5 * (currentPage - 1) - i - 1]);\n }\n\n getCarouselImg();\n getNewestNewsTitle();\n\n for (var i = 0; i < thisPageList.length; i++)\n document.getElementById(\"newsTitle\" + i).style.display = \"block\";\n for (var i = thisPageList.length; i < 5; i++)\n document.getElementById(\"newsTitle\" + i).style.display = \"none\";\n}", "title": "" }, { "docid": "62f1f342aa9e4c9ca772d906ab6f7ae3", "score": "0.5627821", "text": "function loadRSSData(data, sport) {\r\n\t\tvar items = data.querySelectorAll(\"item\");\r\n\t\tfor (var i = 0; i < items.length; i++) {\r\n\t\t\tvar item = new newsItem(items[i], sport);\r\n\t\t\taddNewsItem(item);\r\n\t\t}\r\n\t}", "title": "" }, { "docid": "c9de2c6d6a2095600903b6f3aaa86a70", "score": "0.5627056", "text": "function formatData() {\n var $items, listItems, usersList;\n\n $items = $('#listItems li');\n listItems = [];\n\n for (var i = 0; i < $items.length; i++) {\n listItems[i] = {\n name: $($items[i]).text(),\n status: $($items[i]).attr(\"class\")\n }\n };\n usersList = {\n userName: userName,\n listItems: listItems\n }\n return usersList;\n}", "title": "" }, { "docid": "a3745c3fcd3c9537fabd6e7ffc160cd8", "score": "0.5618938", "text": "function RSS_updateDisplay() {\n var cls = news.children;\n for (var i = 0; i < RSS_ITEMS_DISPLAYED; i++) {\n var el = cls.item(i);\n var item = RSS_currentItems[i];\n \n if (item !== undefined) {\n var link = el.children.item(1);\n var title = ENT_htmlDecode(item.title);\n link.innerText = title;\n link.tooltip = title;\n link.href = item.link ? item.link : '';\n \n var date = el.children.item(2);\n if (item.pubDate) {\n var pubDate = new Date();\n pubDate.setTime(item.pubDate);\n date.innerText = MAIN_starDate(pubDate, ':', ' ');\n date.tooltip = pubDate.toLocaleString();\n } else {\n date.innerText = '';\n date.tooltip = '';\n }\n \n var feed = el.children.item(3);\n feed.innerText = item.feedTitle;\n feed.tooltip = item.feedTitle;\n feed.href = item.feedLink;\n \n el.visible = true;\n } else {\n el.visible = false;\n }\n }\n}", "title": "" }, { "docid": "d40c651ed6e634de991895577b190156", "score": "0.5611302", "text": "function fundsnews() {\n\n let funddata = {};\n request('https://www.wsj.com/news/types/hedge-funds', function(error, response, html) {\n if (!error && response.statusCode == 200) {\n let $ = cheerio.load(html);\n let funds = [];\n $('#move_2 li').each(function(i, element) {\n let fundsdate = $(this).find('.time-container').text().trim();\n let fundsheadline = $(this).find('.headline').text().trim();\n let fundsnews = $(this).find('.summary-container').text().trim();\n\n funddata.Time = fundsdate;\n funddata.Headline = fundsheadline;\n funddata.News = fundsnews;\n date = new Date();\n date = new Date();\n funddata.day = date.getDay();\n funddata.month = date.getMonth();\n funddata.year = date.getFullYear();\n\n let listoffund = new fundmodel(funddata)\n listoffund.save((err, data) => {\n if (err) {\n logger.error(\"error in getting funds list\");\n\n } else if (data) {\n\n }\n\n })\n });\n\n }\n })\n}", "title": "" }, { "docid": "876947f08d73c3651a86e1185b7b0fb0", "score": "0.5611245", "text": "function buildList() {\n // If the list doesn't exist then build it.\n if (atomListSequence.length == 0) {\n // Extract the list of atoms from the html\n for (let e in elements) {\n let element = elements[e];\n if (includeIsotopes) {\n for (let i in element.isotopes) {\n if (element.isotopes.hasOwnProperty(i)) {\n if (element.isotopes[i].field_approval_value != 'stats') {\n atomListSequence.push(element.isotopes[i].nid);\n }\n }\n }\n } else {\n atomListSequence.push(element.default_atom_nid);\n }\n }\n }\n }", "title": "" }, { "docid": "cf2934d619125f729e31c9697958dd90", "score": "0.5610974", "text": "function loadNews() {\n return new Promise((resolve, reject) => {\n const distroData = DistroManager.getDistribution()\n const newsFeed = distroData.getRSS()\n if (!newsFeed) {\n resolve({\n articles: null\n })\n return\n }\n const newsHost = new URL(newsFeed).origin + '/'\n $.ajax(\n {\n url: newsFeed,\n success: (data) => {\n const items = $(data).find('item')\n const articles = []\n\n for (let i = 0; i < items.length; i++) {\n // JQuery Element\n const el = $(items[i])\n\n // Resolve date.\n const date = new Date(el.find('pubDate').text()).toLocaleDateString('en-US', {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n hour: 'numeric',\n minute: 'numeric'\n })\n\n // Resolve comments.\n let comments = el.find('slash\\\\:comments').text() || '0'\n comments = comments + ' Comment' + (comments === '1' ? '' : 's')\n\n // Fix relative links in content.\n // let content = el.find('content\\\\:encoded').text()\n let content = el.find('description').text()\n let regex = /src=\"(?!http:\\/\\/|https:\\/\\/)(.+?)\"/g\n let matches\n while ((matches = regex.exec(content))) {\n content = content.replace(`\"${matches[1]}\"`, `\"${newsHost + matches[1]}\"`)\n }\n\n let link = el.find('link').text()\n let title = el.find('title').text()\n let author = el.find('dc\\\\:creator').text()\n\n // Generate article.\n articles.push(\n {\n link,\n title,\n date,\n author,\n content,\n comments,\n commentsLink: link + '#comments'\n }\n )\n }\n resolve({\n articles\n })\n },\n timeout: 2500\n }\n ).catch(err => {\n resolve({\n articles: null\n })\n })\n })\n}", "title": "" }, { "docid": "9fae5bebb6c690987f88bb6a013466b5", "score": "0.56108236", "text": "function catItems(jsonObj)\r\n{\r\n\tlet catItems = jsonObj.catItems;\r\n\tlet section = document.querySelector('section');\r\n\tfor(let i = 0; i < catItems.length; i++)\r\n\t{\r\n\t\t//build HTML elements\r\n\t\tlet article = document.createElement('article');\r\n\r\n\t\tlet h2 = document.createElement('h2');\r\n\r\n\t\tlet img = document.createElement('img');\r\n\r\n\t\tlet p1 = document.createElement('p');\r\n\r\n\t\tlet ul = document.createElement('ul');\r\n\r\n\r\n\r\n\t\timg.setAttribute('src', 'https://msotera.github.io/lab4/img/' + catItems[i].image);\r\n\r\n\t\timg.setAttribute('alt', catItems[i].image);\r\n\r\n\t\th2.textContent = catItems[i].name;\r\n\r\n\t\tp1.textContent = 'Price ' + catItems[i].price;\r\n\r\n\t\t\r\n\r\n\t\tlet details = catItems[i].details;\r\n\r\n\t\tfor(let j =0; j < details.length; j++)\r\n\t\t{\r\n\t\t\tlet listItem = document.createElement('li');\r\n\t\t\tlistItem.textContent = details[j];\r\n\t\t\tul.appendChild(listItem);\r\n\t\t}\r\n\r\n\t\t\r\n\r\n\t\tarticle.appendChild(img);\r\n\t\tarticle.appendChild(h2);\r\n\t\tarticle.appendChild(p1);\r\n\t\tarticle.appendChild(ul);\r\n\t\tsection.appendChild(article);\r\n\r\n\r\n\t}\t\r\n}", "title": "" }, { "docid": "b4bf871b38444792d739f4ff8f202908", "score": "0.56073636", "text": "function getNewsFoundData() {\n newspaper.forEach(newspaper =>{\n const paperForm = { newspaper: newspaper };\n postFormWithResponse(\"../service/scraping-service/scraping-new-data-service.php\",\n paperForm, function(response){\n try {\n const newsFound = JSON.parse(response);\n newsFound.map(newsFound =>{\n newsFound.newspaper = newspaper;\n });\n dateFilter(newsFound);\n } catch (error) {\n console.error(error);\n }\n });\n });\n }", "title": "" }, { "docid": "2cd072f297ae1e9d062d268e03bb2596", "score": "0.5603699", "text": "function getNavList (){\n for (let sec of sections){\n \n const listItem = document.createElement('li');\n const navA = document.createElement('a');\n const navData = sec.getAttribute('data-nav');\n const navLinkText = document.createTextNode(navData); \n\n //linking anchor link to related section\n smoothScroll(navA, sec);\n \n //building anchor link\n navA.appendChild(navLinkText);\n navA.setAttribute('class', 'menu__link');\n \n //build navigation list items\n listItem.appendChild(navA); \n navPostsFragment.appendChild(listItem);\n }\n navList.appendChild(navPostsFragment);\n}", "title": "" }, { "docid": "2c40be84be3557dcf3149d8c64a53d39", "score": "0.559858", "text": "function nav_bulid(){\n for(let i = 0; i <= items_num-1; i++){\n // set an array to store the return values from Section_info Function\n let arr = Section_info(sections[i]);\n // Create new list element in ul\n let listItem = document.createElement('li');\n // add anchor into each list with (data-id = id & value = section name)\n listItem.innerHTML = `<a class='menu__link' data-id='${arr[0]}'>${arr[1]}</a>`;\n \n\n //Add the New list to Navbar\n navbar.appendChild(listItem);\n }\n}", "title": "" }, { "docid": "833b60d96c38dd44fd008be3a9ddf1ad", "score": "0.5598098", "text": "populateSatelliteList(HTMLlist, satellites, startIndex) {\n for (let i=0; i < 3; i++) {\n const li = HTMLlist[i];\n const name = li.children[0];\n const date = li.children[1];\n if ((startIndex + i) < satellites.length) {\n name.innerHTML = `${satellites[startIndex + i].satname}`;\n date.innerHTML = `Launched ${satellites[startIndex + i].launchDate}`;\n } else {\n name.innerHTML = 'N/A';\n date.innerHTML = 'N/A';\n }\n }\n }", "title": "" }, { "docid": "aecf424a3f0d9443ccb70e5a0520d141", "score": "0.55950826", "text": "populateList() {\n list = document.getElementById(\"list-space\");\n list.innerHTML= \"\";\n for(i = 0;i<ToDoListApp.arrayTodo.length;i++) { \n \n titleInstance = ToDoListApp.arrayTodo[i].title;\n descriptionInstance = ToDoListApp.arrayTodo[i].description;\n dateAndTime = ToDoListApp.arrayTodo[i].timeAdded;\n divBlock = ToDoListApp.divBlockItem(\n titleInstance,dateAndTime,descriptionInstance,i)\n list.appendChild(divBlock);\n }\n ToDoListApp.setDeleteButtonListeners();\n }", "title": "" }, { "docid": "66ea1c238523345615d6d093ec8f92c6", "score": "0.55856425", "text": "function buildNewList(item, index) {\n console.log(item);\n var listItem = $('<li>' + listItemString + '</li>');\n var listItemTitle = $('.title', listItem);\n listItemTitle.html(item.name);\n var listItemLocation = $('.location', listItem);\n listItemLocation.html(item.location.address);\n $('#dataList').append(listItem);\n }", "title": "" }, { "docid": "43be5e2cc05ee228e3c5b3cf6f371aa2", "score": "0.556891", "text": "function sportsSectionArticles(arrWithSources) {\n let sportsSection = document.getElementById(\"sportsSection\");\n for (let i = 1; i < arrWithSources.length; i++) {\n let sourcesUrl = arrWithSources[i].url;\n\n function jSonArr(url) {\n $.getJSON(url, function (result) {\n // console.log(result);\n });\n }\n jSonArr(sourcesUrl);\n\n let sportsArticle = document.createElement(\"article\");\n sportsArticle.className += \"sportsArticleClass\";\n // sportsArticle.className += \" transform\"; //not needed because I am not applying special effect\n arrWithSources[i] = sportsArticle;\n apiData(i, sourcesUrl);\n sportsSection.appendChild(sportsArticle);\n }\n}", "title": "" }, { "docid": "a056ce93699a95c3d1a85db53b112c8c", "score": "0.55660814", "text": "function updateList()\n{\n\t$(\"#list\").html(\"\");\n\tfor (var i in notes)\n\t{\n\t\taddNote(notes[i].split(\"\\n\")[0], i);\n\t}\n\t//Needed to account for dom update delay. \n\tsetTimeout(function()\n\t{\n\t\tselectItem(current);\n\t}, 1);\n\n}", "title": "" }, { "docid": "b327fe1a621c2bf3d2799f44a10a0e00", "score": "0.55557543", "text": "function creationOfListItem(){\n\n /* Creating a Loop to select and apply all for each section in HTML */\n \n for (section of navbarSections){\n \n /* Get name of Section by a specific way to hunt the actual name store in (data-nav) in HTML */\n\n nameOfSection = section.getAttribute('data-nav');\n\n /* Get link of Section by attribute (ID) in HTML */\n\n linkOfSection = section.getAttribute('id');\n\n /* Creating List to contain all sections that in HTML */\n\n createListItem = document.createElement('li');\n\n /* Passing Section Name and Section Link by (Template Literals) from HTML to JS to make it dynamic as much we can */\n\n createListItem.innerHTML = `<a class = 'menu__link' href = '#${linkOfSection}'> ${nameOfSection} </a> `;\n\n /* After Creation of List item we pass it to Menulist of Sections */\n\n menuList.appendChild(createListItem);\n } \n\n}", "title": "" }, { "docid": "7be2ca2793bbbecb2b20be2e67b2f7ef", "score": "0.5553094", "text": "function buildList(data, i) {\n var node = document.createElement('li');\n var sec_num = i + 1;\n node.textContent = data;\n node.classList.add(\"menu__link\");\n node.addEventListener(\"click\", function (event) {\n scrollID(\"section\" + sec_num);\n event.preventDefault();\n });\n nav.appendChild(node);\n}", "title": "" }, { "docid": "7cab0490a40f0a119644576aa93bd063", "score": "0.55526966", "text": "async function fetchNews(searchUrl) {\n const res = await fetch(\n `https://newsapi.org/v2/${searchUrl}&apiKey=74fcd3dc0e724283943b64b4c43fbf1b`\n );\n const data = await res.json();\n\n if (data.totalResults > 0) {\n var output = \"\";\n output += '<ul id=\"news-articles\">';\n //array to fetch elements\n data.articles.forEach((i) => {\n output += `<li class=\"article\">\n <img src=${i.urlToImage} alt=${i.source.name} style=\"width:100%;margin-top:5px;\" class=\"article-img\">\n \n <h2 class=\"article-title\"><b>${i.title}</b></h2> \n <p class=\"article-description\">${i.description}</p> \n <span class=\"article-author\">`;\n if (i.author != null) {\n output += `- ${i.author}</span>`;\n } else {\n output += `-N.A</span>`;\n }\n\n output += `<br> <a href=${i.url} class=\"article-link\" target='_blank'><em>Read More At: ${i.source.name}</em></a>\n \n </li>`;\n });\n output += \"</ul>\";\n\n document.getElementById(\"news-section\").innerHTML = output;\n } else if (data.totalResults === 0) {\n var invalidData = document.getElementById(\"news-section\");\n invalidData.innerHTML =\n \"<h3>No article was found based on the search.</h3>\";\n invalidData.style.color = \"red\";\n invalidData.classList.add(\"not-found\");\n }\n}", "title": "" }, { "docid": "82163cd2e767789ccb20d75ca83f000b", "score": "0.5542066", "text": "function fillblogtable() {\r\n // clear the table so we don't repeat information\r\n clearBlogTable();\r\n var blogtable = $(\r\n '#blogtable');\r\n // grab HTML element into which we're going to load the data\r\n var recentnumber = 0;\r\n var bList = $('#recent' + recentnumber++);\r\n // iterate through each of the JSON objects in the test data and render\r\n // them into the list\r\n $.ajax({\r\n url: 'blogs'\r\n }).\r\n success(function (data,status) {\r\n do {\r\n $.ajax(\r\n {\r\n url: '/sidebarfragment'\r\n }).\r\n success(function (data, status) {\r\n $.each(data, function (\r\n index, blog) {\r\n bList.append(\r\n $('ol').append(\r\n $('li').append(\r\n $('<a>').attr(\r\n {'data-blog-id': blog.blogId, 'data-target': '#blogtable'})\r\n .text(blog.blogTitle)\r\n )\r\n )\r\n );\r\n });\r\n\r\n });\r\n recentnumber++;\r\n } while (recentnumber < 5 + 1);\r\n });\r\n}", "title": "" }, { "docid": "adb483bf11014ce6f1f0bdf448e6ee75", "score": "0.5520046", "text": "function getNews() {\r\nvar SelectedView = \"#\";\r\n$(\"#newsfeed\").load(SelectedView+\" #WebPartWPQ2 .ms-listviewtable\",function() {\r\n$(\"#newsfeed *\").removeAttr(\"onclick\");\r\n$(\"#newsfeed *\").removeAttr(\"onfocus\");\r\n$(\"#newsfeed *\").removeAttr(\"onmouseover\");\r\n$(\"#newsfeed *\").removeAttr(\"iid\");\r\n$(\".ms-vh2\").css(\"display\",\"none\");\r\n\r\n$(\".ms-listviewtable *\").css(\"cursor\",\"default\");\r\n$(\"a.ms-listviewtable *\").css(\"cursor\",\"pointer\");\r\n$(\"td.ms-listviewtable\").css(\"padding\",\"0px\").css(\"margin\",\"0px\");\r\n$(\".ms-listviewtable *\").css(\"background\",\"white\");\r\n$(\".ms-listviewtable *\").css(\"border\",\"none\");\r\n$(\".ms-listviewtable *\").css(\"color\",\"#676767\");\r\n$(\".ms-vh-icon\").css(\"display\",\"none\");\r\n$(\".s4-itm-cbx\").css(\"display\",\"none\");\r\n});\r\n}", "title": "" }, { "docid": "2a98da6bc2e8780c35fb9d108ef18e04", "score": "0.55172527", "text": "function setObjects() {\r\n\titems = document.querySelectorAll(\"ul li\");\r\n\tfor (var i = 0, len = items.length; i < len; ++ i) {\r\n\t\tsetObject(i);\r\n\t}\r\n}", "title": "" }, { "docid": "a9dd862e098e9c1972934112cf1ef09e", "score": "0.5515934", "text": "function populate(){\n for ( let i = 0; i < data[1].length; i++ ){\n\n let title = document.querySelector(`#title${i}`),\n description = document.querySelector(`#description${i}`),\n link = document.querySelector(`#link${i}`),\n results = document.querySelector(`#results${i}`);\n \n title.textContent = \"\";\n title.textContent = resultTitle[i];\n description.textContent = \"\";\n description.textContent = resultDescription[i];\n link.removeAttribute(\"hidden\");\n link.setAttribute(\"href\", `${resultLink[i]}`);\n } \n }", "title": "" }, { "docid": "7e83e0fff7a1105f2f9cf0d23a308e00", "score": "0.5514166", "text": "addListItems() {\n for (let i = 0; i < this.textArray.length; i++) {\n let li = document.createElement(\"li\");\n li.setAttribute(\"data-section\", \"\" + i + \"\");\n if (i === 0) {\n li.classList.add('active');\n }\n this.list.appendChild(li);\n }\n }", "title": "" }, { "docid": "4397848369ef9b25d9858a664ded5406", "score": "0.5510471", "text": "function displaySourceNewsOf(id) {\n // https://newsapi.org/v2/top-headlines?sources=bbc-news&apiKey=c14a1b7c3a48476c91ed11170d0aa481\n $.get({\n type: 'get',\n url: searchURL + 'top-headlines',\n data: {\n apiKey: apiKey,\n sources: id\n },\n dataType: 'json',\n success: function (data) {\n console.log(data);\n\n const feed = $('#feed');\n feed.empty();\n\n var h1El = $('<h1>');\n h1El.text(id);\n feed.append(h1El);\n\n data.articles.forEach(function (article) {\n var divEl = $('<div>');\n divEl.attr('class', 'article');\n\n var h2El = $('<h2>');\n h2El.text(article.title);\n\n var pEl = $('<p>');\n pEl.text(article.description);\n\n var pEl2 = $('<p>');\n pEl2.text(article.author);\n\n var imgEl = $('<img>');\n imgEl.attr('src', article.urlToImage);\n\n var aEl = $('<a>');\n aEl.attr('href', article.url);\n aEl.attr('target', '_blank');\n aEl.text('>>');\n\n\n divEl.append(h2El);\n divEl.append(imgEl);\n divEl.append(pEl);\n divEl.append(pEl2);\n divEl.append(aEl);\n feed.append(divEl);\n });\n\n\n },\n error: function (e) {\n console.error(e);\n }\n });\n }", "title": "" }, { "docid": "491cc329de92b88e14925d482da14c5e", "score": "0.55091864", "text": "async function fillNews(item, index) {\n const response = await fetch(\"https://newsapi.org/v2/top-headlines?language=en\", {\n headers: {\n \"X-Api-Key\": \"d6e9eca6a9e4407cb8c19ed7dd38b910\"\n }\n })\n data = await response.json()\n\n\n\n item.children[0].textContent = data.articles[index].title\n item.children[1].textContent = data.articles[index].description\n item.children[2].firstElementChild.src = data.articles[index].urlToImage\n if(index === topRated.length-1){\n loading--;\n removeLoading();\n }\n \n}", "title": "" }, { "docid": "d90053cf43677e79fca2cef1f249568e", "score": "0.5508009", "text": "function constructList() {\r\r\n var output;\r\r\n var arr = swimmerArr;\r\r\n for (var i = 0; i < arr.length; i++) {\r\r\n\r\r\n output = \"<div class='item'><span class='day'>\" + (i + 1) + \".</span><span class='swimmer'>\" + arr[i].Swimmer + \"</span>\";\r\r\n $(\"#list\").append(output);\r\r\n }\r\r\n}", "title": "" }, { "docid": "5f7a3030e484d4eb06f45446ccb0ee17", "score": "0.5507989", "text": "function loadList() {\n list();\n\n function list() {\n try {\n var html = '';\n var htmlprolist = '';\n var htmlnew = ''; // $.get(`http://jx.xuzhixiang.top/ap/api/allproductlist.php?pagesize=20&pagenum=${pagenum}`, {}, function(data) {\n\n $.get(\"http://localhost:3000/prolist\", {}, function (dat) {\n console.log(dat);\n var data = dat.slice(0, 4);\n var datanew = data.slice(0, 2);\n dat.forEach(function (v) {\n htmlprolist += \"\\n <li>\\n <h2>\".concat(v.pname, \"</h2>\\n <a href=\\\"spe.html?pid=\").concat(v.pid, \"\\\"> <img src=\\\"\").concat(v.pimg, \"\\\"></a> \\n </li>\\n \");\n });\n data.forEach(function (v) {\n html += \"\\n <li>\\n <h2>\".concat(v.pname, \"</h2>\\n <a href=\\\"spe.html?pid=\").concat(v.pid, \"\\\"> <img src=\\\"\").concat(v.pimg, \"\\\"></a> \\n </li>\\n \");\n });\n datanew.forEach(function (v) {\n htmlnew += \"\\n <li>\\n <h2>\".concat(v.pname, \"</h2>\\n <a href=\\\"spe.html?pid=\").concat(v.pid, \"\\\"> <img src=\\\"\").concat(v.pimg, \"\\\"></a> \\n </li>\\n \");\n $('.showli').html(html); //jQuery拼接HTML标签元素\n\n $('.prolist-ul').html(htmlprolist);\n $('.new-prolist-ul').html(htmlnew);\n });\n });\n } catch (error) {\n console.log(error);\n }\n }\n}", "title": "" }, { "docid": "093b25b77b11d60aa51f6b0b95eacffa", "score": "0.5507032", "text": "function fillUl(ul, data, clickTarg, clickTrk) {\n\t\tvar name = null;\t\n\t\tfor (var i = 0; i < data.length; i++) {\n\t\t\t// check for duplicate names\n\t\t\t// if they're in there, forget em\n\t\t\tif (name == data[i].name) \n\t\t\t {continue;}\n\t\t\telse \n\t\t\t {name = data[i].name;}\n\t\t\t\n\t\t\tvar item = document.createElement(\"LI\");\n\t\t\tvar itemText = document.createTextNode(data[i].name);\n\t\t\titem.appendChild(itemText);\n\t\t\tul.appendChild(item);\n\n\t\t\t// add onclick function to\n\t\t\t// add value to element\n\t\t\titem.onclick = function(e) {\n\t\t\t\te.stopPropagation();\n\t\t\t\t// get element\n\t\t\t\tvar elem = e.target;\n\n\t\t\t\t//alert (e.target.tagName);\n\t\t\t\t// check if we've got a bold tag by accident\n\t\t\t\t// if so, get the parent (li) \n\t\t\t\tif (elem.tagName == 'B')\n\t\t\t\t\telem = elem.parentNode;\n\n\t\t\t\t// remove tags\n\t\t\t\tvar value = elem.innerHTML.replace(/(<([^>]+)>)/ig,\"\");\n\n\t\t\t\t// change value of target\n\t\t\t\tclickTarg.value = value;\n\n\t\t\t\t// change value of track\n\t\t\t\tclickTrk.value = 1;\n\n\t\t\t\t// mark down topic if we're varUl\n\t\t\t\tif (e.target.parentNode.id == 's-var') {\n\t\t\t\t\t// get type from parallel list\n\t\t\t\t\tvar children = e.target.parentNode.childNodes;\n\t\t\t\t\tvar i = 0;\n\t\t\t\t\tfor (; i < children.length; i++) \n\t\t\t\t\t\tif (e.target == children[i]) \n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t// set type\n\t\t\t\t\ttopic.value = data[i].type;\n\t\t\t\t}\n\t\t\t\t// disappear parent\n\t\t\t\tul.style.display = 'none';\n\n\t\t\t\t// clear ul\n\t\t\t\tclearUl(ul);\n\t\t\t}\n\t\t}\n\t}", "title": "" }, { "docid": "ed143b5f665fce4caeeec2fa0f9c57a0", "score": "0.5501412", "text": "createUstensilList(array) {\n for (let i = 0; i < array.length; i++) {\n document.querySelector(this.selector_id_list).innerHTML += array[i].getUstensilHTML();\n }\n\n }", "title": "" }, { "docid": "120947963a4b34174a4e39dbedd66b43", "score": "0.54960155", "text": "function getFeedData(data) {\n\thngrdata = {items:[]};\n\t$.each(data.data, function(i, rssitem) {\n\t\t// reformat from timestamp\n\t\tvar d = new Date();\n\t\td.setTime(rssitem.published * 1000);\n\t\t// push to array\n\t\thngrdata.items.push({\n\t\t\tlinks: { href: rssitem.url },\n\t\t\tpublished: d,\n\t\t\ttitle: '<h5>' + rssitem.name + '</h5>' + rssitem.text.substring(0,100)\n\t\t});\n\t});\n}", "title": "" } ]
64d223e59477e98563d164d2effee1b5
Create an stdin widget.
[ { "docid": "acbb41d3c47dbb7cb25732958a823dd4", "score": "0.82587063", "text": "createStdin(options) {\n return new widget_Stdin(options);\n }", "title": "" } ]
[ { "docid": "0c6538d11cb9d136f2693e69cb0549a9", "score": "0.6931401", "text": "static createStdinInterface (stdout, settings) {\n let options = {\n input: process.stdin,\n output: stdout,\n terminal: true\n };\n if (settings.completer) options.completer = settings.completer;\n else if (settings.completions) options.completer = MutePrompt.createCompleter(settings);\n return ReadLine.createInterface(options);\n }", "title": "" }, { "docid": "89b301f5565f104c034f20784d2661c4", "score": "0.68631953", "text": "onInputRequest(msg, future) {\n // Add an output widget to the end.\n let factory = this.contentFactory;\n let stdinPrompt = msg.content.prompt;\n let password = msg.content.password;\n let panel = new widgets_lib[\"Panel\"]();\n panel.addClass(OUTPUT_AREA_ITEM_CLASS);\n panel.addClass(OUTPUT_AREA_STDIN_ITEM_CLASS);\n let prompt = factory.createOutputPrompt();\n prompt.addClass(OUTPUT_AREA_PROMPT_CLASS);\n panel.addWidget(prompt);\n let input = factory.createStdin({ prompt: stdinPrompt, password, future });\n input.addClass(OUTPUT_AREA_OUTPUT_CLASS);\n panel.addWidget(input);\n let layout = this.layout;\n layout.addWidget(panel);\n /**\n * Wait for the stdin to complete, add it to the model (so it persists)\n * and remove the stdin widget.\n */\n void input.value.then(value => {\n // Use stdin as the stream so it does not get combined with stdout.\n this.model.add({\n output_type: 'stream',\n name: 'stdin',\n text: value + '\\n'\n });\n panel.dispose();\n });\n }", "title": "" }, { "docid": "8fd66a05dfed8f86416b3ffaac66b7b8", "score": "0.65679705", "text": "function createInputWidgetNode(prompt, password) {\n let node = document.createElement('div');\n let promptNode = document.createElement('pre');\n promptNode.className = STDIN_PROMPT_CLASS;\n promptNode.textContent = prompt;\n let input = document.createElement('input');\n input.className = STDIN_INPUT_CLASS;\n if (password) {\n input.type = 'password';\n }\n node.appendChild(promptNode);\n promptNode.appendChild(input);\n return node;\n }", "title": "" }, { "docid": "a6a6231f7829747e47a9c15013f4ca01", "score": "0.5848205", "text": "static create() {\n const form = document.createElement('form')\n form.id = 'textInputForm'\n form.setAttribute('onsubmit', 'cs.Input.close() return false')\n form.setAttribute('autocomplete', 'off')\n const input = document.createElement('input')\n input.id = 'textInputText'\n input.setAttribute('autocomplete', 'off')\n input.type = 'text'\n\n const button = document.createElement('button')\n button.type = 'submit'\n button.innerHTML = 'Enter'\n\n form.appendChild(input)\n form.appendChild(button)\n document.body.appendChild(form)\n\n this.form = form\n this.input = input\n this.button = button\n }", "title": "" }, { "docid": "6dfc0ab36edb88edbd33abc017c447a7", "score": "0.5810959", "text": "set onStdin(cb) {\n this._stdin = cb;\n }", "title": "" }, { "docid": "7f5ef506deb565241fcd97f0bd43ea5a", "score": "0.5682227", "text": "createInputPrompt() {\n return new inputarea_InputPrompt();\n }", "title": "" }, { "docid": "7f5ef506deb565241fcd97f0bd43ea5a", "score": "0.5682227", "text": "createInputPrompt() {\n return new inputarea_InputPrompt();\n }", "title": "" }, { "docid": "8bef035d7ad4f36104ca9548f368e243", "score": "0.56555545", "text": "async attachStdin() {\n const attach_opts = {stream: true, stdin: true, stdout: true, stderr: true};\n return new Promise((resolve, reject) => {\n log.debug('=> Attaching stdin')\n this.container.attach(attach_opts, async (err, stream) => {\n if(err) return reject(err);\n this._connectStd(stream);\n\n this._resize();\n process.stdout.on('resize', () => this._resize());\n\n await this.container.wait();\n this._exit(stream);\n resolve();\n });\n });\n }", "title": "" }, { "docid": "50143ca506b991f8e64fc98d64075f0f", "score": "0.56554586", "text": "function readInput() {\n\tprocess.stdin.setEncoding('utf8');\n\treadline.createInterface({\n\t input: process.stdin,\n\t terminal: true\n\t}).on('line', readLine);\n}", "title": "" }, { "docid": "e241d9d8f9be65bdf4bbec5fb88f88ea", "score": "0.56204957", "text": "constructor(data = {}, styles = {}) {\n super(document.createElement('div'), styles, data.focus)\n this.inputNode = document.createElement('textarea')\n this.inputNode.id = getUniqueId('textMultiLine')\n this.addClass('input-text-multiLine')\n\n if (typeof label === 'string') {\n this.node.appendChild(document.createElement('label'))\n this.node.firstChild.textContent = label\n\n this.node.firstChild.setAttribute('for', this.inputNode.id)\n }\n\n this.node.appendChild(this.inputNode)\n\n this.disabled = data.disabled\n\n this.tooltip = data.tooltip\n this.placeholder = data.placeholder\n\n if (typeof data.value === 'string') {\n this.inputNode.value = data.value\n }\n\n this.inputNode.addEventListener(\n 'contextmenu',\n exports.contextMenu.enable.bind(null, 'edit')\n )\n\n this.inputNode.addEventListener('focus', () => {\n this._focused = true\n\n if (this._globalFocus) {\n body.inputFocused(this, !this._codeFocused)\n }\n\n sendEventTo(\n {\n fromUser: !this._codeFocused,\n from: this\n },\n this.events.focus\n )\n this._codeFocused = false\n })\n\n this.inputNode.addEventListener('blur', () => {\n this._focused = false\n sendEventTo(\n {\n fromUser: true,\n from: this\n },\n this.events.blur\n )\n })\n\n this._oldValue = this.inputNode.value\n this.inputNode.addEventListener('input', () => {\n this._oldValue = this.inputNode.value\n\n sendEventTo(\n {\n value: this.inputNode.value,\n oldValue: this._oldValue,\n\n fromUser: true,\n from: this\n },\n this.events.change\n )\n })\n }", "title": "" }, { "docid": "05a30a25f03a1fb323d76d6366a40310", "score": "0.5558293", "text": "function create_input_element(kwargs)\n{\n if (!kwargs.events)\n kwargs.events = [];\n kwargs.events.push({name: 'keypress', func: input_keypress_handler, bind: true});\n kwargs.events.push({name: 'focusin', func: input_focus_handler, bind: true});\n let value = kwargs.value;\n delete kwargs.value;\n if (value === undefined)\n value = '';\n kwargs.contenteditable = true;\n kwargs.children = [value];\n return create_element('span', kwargs);\n}", "title": "" }, { "docid": "57dd8b7f1188b8d0fe0bfcdd85e273b0", "score": "0.5544846", "text": "createTagInput() {\n let layout = this.layout;\n let input = new AddWidget();\n input.id = 'add-tag';\n layout.insertWidget(0, input);\n }", "title": "" }, { "docid": "c6a1bc2da33ed33dba3af1f92d7d7f9b", "score": "0.55440456", "text": "createNewWidget(context, kernel) {\n const widget = new DocWidget(context);\n this.widgetCreated.emit(widget);\n return widget;\n }", "title": "" }, { "docid": "8a69f55a730dd4225c61dabebaa9e47f", "score": "0.55291235", "text": "get onStdin() {\n return this._stdin;\n }", "title": "" }, { "docid": "d41a9bbcceff19a6fa9072d4b84ef36a", "score": "0.5496644", "text": "createOutputPrompt() {\n return new widget_OutputPrompt();\n }", "title": "" }, { "docid": "d41a9bbcceff19a6fa9072d4b84ef36a", "score": "0.5496644", "text": "createOutputPrompt() {\n return new widget_OutputPrompt();\n }", "title": "" }, { "docid": "73b914a2322ef9799888b20f807950d8", "score": "0.5495462", "text": "function create_chat_pane() {\n\tinput = createInput();\n\tinput.position((resolutionW*(0.7/20)), (resolutionH*(19.1/20)));\n\n\tbutton = createButton('Enter');\n\tbutton.position(input.x + input.width, (resolutionH*(19.1/20)));\n\tbutton.mousePressed(chatin);\n}", "title": "" }, { "docid": "53355161a58b1bfff830b30207d8c569", "score": "0.547807", "text": "function CommandPrompt (){ \n var width = (arguments[0] ? arguments[0] : cmd_default_width);\n var height = (arguments[1] ? arguments[1] : cmd_default_height);\n var forecolor = (arguments[2] ? arguments[2] : cmd_default_forecolor);\n var backcolor = (arguments[3] ? arguments[3] : cmd_default_backcolor);\n var bordercolor = (arguments[4] ? arguments[4] : cmd_default_bordercolor);\n \n \n var uniqueName = toolkit_getUniqueName();\n var HTML = \"<input type='text' name='\" + uniqueName + \"cmdText' id='\" + uniqueName + \"cmdText' onkeypress=\\\"cmd_handleKeyPress('\"+uniqueName+\"', event.keyCode)\\\" />\";\n \n var object_HTML = cmd_renderHTMLCmdObject(uniqueName, HTML, width, height, forecolor, backcolor, bordercolor);\n\tdocument.write(object_HTML);\n}", "title": "" }, { "docid": "ad820b22abd7df8d00a12e297a089513", "score": "0.5446319", "text": "constructor(options) {\n super({\n node: widget_Private.createInputWidgetNode(options.prompt, options.password)\n });\n this._future = null;\n this._input = null;\n this._promise = new coreutils_lib[\"PromiseDelegate\"]();\n this.addClass(STDIN_CLASS);\n this._input = this.node.getElementsByTagName('input')[0];\n this._input.focus();\n this._future = options.future;\n this._value = options.prompt + ' ';\n }", "title": "" }, { "docid": "6c730e2232f54cf51d4549d271670ddd", "score": "0.54315215", "text": "function input() {\n const input = blessed.textbox({\n top: \"100%-3\",\n height: 3,\n tags: true,\n width: \"100%\",\n border: {\n type: \"line\"\n }\n });\n\n input.getLabelText = () => {\n const label = input.children[0];\n if (!label) return \"\";\n return blessed.stripTags(label.content);\n };\n\n // will not clear errors unless force=true\n input.clear = force => {\n if (!force && input.getLabelText() === \"Error\") return;\n input.removeLabel();\n input.clearValue();\n };\n\n const errorDisplayTime = 2000;\n input.setError = msg => {\n input.setLabel(\"{red-fg}{bold}Error{/}\");\n input.setValue(msg);\n\n // error auto disappear after errorDisplayTime\n clearTimeout(input.errorTimeout);\n input.errorTimeout = setTimeout(() => {\n if (input.getLabelText() === \"Error\") {\n input.clear(true);\n }\n }, errorDisplayTime);\n };\n\n input.read = () => {\n return new Promise(resolve => {\n input.readInput((err, val) => {\n if (err) {\n return resolve(\"\");\n }\n\n resolve(val || \"\");\n });\n });\n };\n\n input.readObject = async () => {\n const val = await input.read();\n if (!val) return null;\n\n try {\n return util.stringToObject(val);\n } catch (e) {\n input.setError(\"Object is malformed, aborting\");\n return null;\n }\n };\n\n input.readString = async () => {\n const val = await input.read();\n\n if (val[0] === '\"' && val[val.length - 1] === '\"') {\n return val.substr(1, val.length - 2);\n }\n return val;\n };\n\n return input;\n}", "title": "" }, { "docid": "3aba7b7e43704d5cfd3ffebe9f4004e0", "score": "0.54244703", "text": "function createTextInput() {\n var element = document.createElement(\"INPUT\");\n element.setAttribute(\"type\",\"text\");\n return element;\n}", "title": "" }, { "docid": "056d9514b1d94c44ae06e3e18c471275", "score": "0.53993595", "text": "createNewWidget(context) {\n const rendermime = this._rendermime.clone({\n resolver: context.urlResolver\n });\n const renderer = rendermime.createRenderer(MIMETYPE);\n const content = new widget_MarkdownViewer({ context, renderer });\n content.title.iconClass = this._fileType.iconClass;\n content.title.iconLabel = this._fileType.iconLabel;\n const widget = new widget_MarkdownDocument({ content, context });\n return widget;\n }", "title": "" }, { "docid": "e3fb1e7652c25c8dc5751cde0e859381", "score": "0.5372092", "text": "function createWidget(htmlType, className, textContent) {\n let widget = document.createElement(htmlType);\n if (className !== undefined) {\n widget.className = className;\n }\n if (textContent !== undefined) {\n if (htmlType == \"input\") {\n widget.value = textContent;\n } else {\n widget.appendChild(document.createTextNode(textContent));\n }\n }\n return widget;\n}", "title": "" }, { "docid": "345c587d5e1487419231f9b10382d06d", "score": "0.5355379", "text": "constructor(data = {}, styles = {}) {\n super(document.createElement('div'), {}, data.focus)\n this.inputNode = document.createElement('input')\n this.inputNode.id = getUniqueId(this.inputNode.tagName)\n this.inputNode.type = 'text'\n\n if (typeof data.label === 'string') {\n this.node.appendChild(document.createElement('label'))\n this.node.firstChild.textContent = data.label\n\n this.node.firstChild.setAttribute('for', this.inputNode.id)\n\n this.inputNode.title = data.label\n } else {\n this.inputNode.title = ' '\n }\n\n this.node.appendChild(this.inputNode)\n\n this.addClass('input-text')\n\n addStyles(this, styles)\n\n this.autoFocusNext = false\n\n if (typeof data.autoFocusNext === 'boolean') {\n this.autoFocusNext = data.autoFocusNext\n }\n\n this.disabled = data.disabled\n\n this._maxLength = Infinity\n\n this.tooltip = data.tooltip\n this.placeholder = data.placeholder\n\n this.maxLength = data.maxLength\n\n //the get/set also sends events, so just set the value directly\n if (typeof data.value === 'string') {\n this.inputNode.value = data.value\n }\n\n this.inputNode.addEventListener(\n 'contextmenu',\n exports.contextMenu.enable.bind(null, 'edit')\n )\n\n this.inputNode.addEventListener('focus', () => {\n this._focused = true\n\n if (this._globalFocus === true) {\n body.inputFocused(this, !this._codeFocused)\n }\n\n sendEventTo(\n {\n fromUser: !this._codeFocused,\n from: this\n },\n this.events.focus\n )\n\n this._codeFocused = false\n })\n this.inputNode.addEventListener('blur', () => {\n this._focused = false\n\n sendEventTo(\n {\n fromUser: true,\n from: this\n },\n this.events.blur\n )\n })\n\n this._oldValue = this.inputNode.value\n\n this.inputNode.addEventListener('input', () => {\n if (this.inputNode.value.length > this._maxLength) {\n this.inputNode.value = this.inputNode.value.slice(\n 0,\n this._maxLength\n )\n\n if (this.inputNode.value === this._oldValue) {\n return false\n }\n }\n\n sendEventTo(\n {\n value: this.inputNode.value,\n oldValue: this._oldValue,\n\n fromUser: true,\n from: this\n },\n this.events.change\n )\n\n this._oldValue = this.inputNode.value\n })\n\n this.inputNode.addEventListener('keydown', keyEvent => {\n if (keyEvent.key === 'Enter') {\n sendEventTo(\n {\n value: this.inputNode.value,\n\n fromUser: true,\n from: this\n },\n this.events.enter\n )\n\n this.blur()\n\n if (this.autoFocusNext === true && this.parent) {\n let index = this.parent.items.indexOf(this)\n\n while (index < this.parent.items.length) {\n if (\n typeof this.parent.items[index + 1].focus ===\n 'function'\n ) {\n this.parent.items[index + 1].focus()\n\n break\n } else {\n let exit = true\n\n for (\n let i = 0;\n i < inputAutoFocusSkipClasses.length;\n i++\n ) {\n if (\n this.parent.items[index + 1] instanceof\n inputAutoFocusSkipClasses[i]\n ) {\n index += 1\n exit = false\n\n continue\n }\n }\n\n if (exit) {\n break\n }\n }\n }\n }\n }\n })\n }", "title": "" }, { "docid": "41416e73c90c116c38f7905ee4e7b220", "score": "0.5350606", "text": "produceTerminal() {\n let os = getOS();\n if (os === \"Android\")\n return(<textarea onInput={this.handleTerminalInput} onMouseUp={this.handleTerminalMouseUp} onMouseDown={this.handleTerminalMouseDown} name=\"textarea1\" id=\"terminal\" className=\"form-control\" rows=\"30\" placeholder=\"\" value={this.state.inputText}/>);\n else\n return(<textarea onKeyDown={this.handleTerminalKeyDown} onMouseUp={this.handleTerminalMouseUp} onMouseDown={this.handleTerminalMouseDown} name=\"textarea1\" id=\"terminal\" className=\"form-control\" rows=\"30\" placeholder=\"\" value={this.state.inputText}/>);\n }", "title": "" }, { "docid": "6aafe3eeada37fb072a0f0bf4e92c527", "score": "0.53473675", "text": "function InputAreaWidget(options) {\n var _this = _super.call(this) || this;\n _this.addClass(INPUT_CLASS);\n var editor = _this._editor = options.editor;\n editor.addClass(EDITOR_CLASS);\n _this.layout = new widgets_1.PanelLayout();\n var prompt = _this._prompt = new widgets_2.Widget();\n prompt.addClass(PROMPT_CLASS);\n var layout = _this.layout;\n layout.addWidget(prompt);\n layout.addWidget(editor);\n return _this;\n }", "title": "" }, { "docid": "90ffce923e128da77b94f993686abcf2", "score": "0.534581", "text": "function createInputContainer(args, className, tagClass, tag, internalCreateElement) {\n var makeElement = !sf.base.isNullOrUndefined(internalCreateElement) ? internalCreateElement : sf.base.createElement;\n var container;\n\n if (!sf.base.isNullOrUndefined(args.customTag)) {\n container = makeElement(args.customTag, {\n className: className\n });\n container.classList.add(tagClass);\n } else {\n container = makeElement(tag, {\n className: className\n });\n }\n\n container.classList.add('e-control-wrapper');\n return container;\n }", "title": "" }, { "docid": "48b3d4077fc44173347f7b653aefe92b", "score": "0.5331619", "text": "function Console(onData) {\n this.stdin = process.openStdin();\n tty.setRawMode(true);\n this.line = '';\n this.pause = true;\n var self = this;\n this.stdin.on('keypress', function (chunk, key) {\n if (key && key.ctrl && key.name == 'c') self.emit('break');\n else if (key && key.name == 'enter') {\n if (self.line.length > 0) {\n process.stdout.write('\\n');\n var line = self.line;\n self.line = '';\n process.stdout.write(chunk);\n self.emit('data', line);\n }\n }\n else if (key && key.name == 'backspace') {\n if (self.line.length > 0) {\n self.line = self.line.substr(0, self.line.length - 1);\n process.stdout.write('\\033[1D \\033[1D');\n }\n }\n else if (typeof chunk != 'undefined' && !self.pause){\n self.line += chunk;\n process.stdout.write(chunk);\n }\n });\n}", "title": "" }, { "docid": "fd1d5d4596602ffd2dd8c93e8285790d", "score": "0.53248215", "text": "function InteractiveWidget() {}", "title": "" }, { "docid": "98011a0ec8a8d2db424aec3779d11408", "score": "0.53099465", "text": "start () {\n process.stdin.resume();\n readline.emitKeypressEvents(process.stdin);\n process.stdin.setRawMode(true);\n\n if (this.hideCursor)\n process.stderr.write('\\x1B[?25l');\n }", "title": "" }, { "docid": "135f75a44c3dbf333e5a5edb4e7f9fdf", "score": "0.5306519", "text": "function read() {\n\t\t\tconsole.log('');\n\t\t\tstdout.write('\t\\033[33mEnter your choice: \\033[39m');\n\t\t\tstdin.resume();\n\t\t\tstdin.setEncoding('utf8');\n\t\t\tstdin.on('data', option);\n\t\t}", "title": "" }, { "docid": "e86d87face25c6b2a02dfe6c35673966", "score": "0.5298396", "text": "function init() {\n keypress(process.stdin)\n process.stdin.on('keypress', (ch, key) => {\n q.push(key)\n })\n process.stdin.setRawMode(true)\n process.stdin.resume()\n}", "title": "" }, { "docid": "94af12854b1b7dd8c0b78751903494c3", "score": "0.5175129", "text": "startInputWidgets() {\n this.paramsNode = document.createElement('div');\n this.paramsBus = this.runtime\n .bus()\n .makeChannelBus({ description: 'Parent comm bus for parameters widget' });\n\n this.paramsBus.on('parameter-changed', (message) => {\n this.updateModelParameterValue(message);\n });\n\n this.paramsWidget = ParamsWidget.make({\n bus: this.paramsBus,\n workspaceId: this.runtime.workspaceId(),\n paramIds: this.internalModel.getItem(['inputs', 'otherParamIds']),\n initialParams: this.internalModel.getItem(['params']),\n initialDisplay: {},\n });\n\n return this.paramsWidget.start({\n node: this.paramsNode,\n parameters: this.spec.getSpec().parameters,\n });\n }", "title": "" }, { "docid": "f7761865dac5bea864a1ced29c2bb426", "score": "0.51676553", "text": "function createTextBox() {\n // if textbox already exists on current tab\n if (document.getElementById(\"deepl-ext-container\")) {\n return;\n }\n\n var container = document.createElement(\"div\");\n container.id = \"deepl-ext-container\";\n\n createHeader(container);\n createBody(container);\n \n document.body.appendChild(container);\n makeDraggable(container);\n}", "title": "" }, { "docid": "ee38765d042ed75a56eabf553cf6758d", "score": "0.5161822", "text": "createNewWidget(context) {\n let func = this._services.factoryService.newDocumentEditor;\n let factory = options => {\n return func(options);\n };\n const content = new FileEditor({\n factory,\n context,\n mimeTypeService: this._services.mimeTypeService\n });\n const widget = new _jupyterlab_docregistry__WEBPACK_IMPORTED_MODULE_1__[/* DocumentWidget */ \"d\"]({ content, context });\n return widget;\n }", "title": "" }, { "docid": "6b67f443b3a51f92eeba004b48687569", "score": "0.5143492", "text": "createNewWidget(context) {\n const delimiter = '\\t';\n return new widget_CSVDocumentWidget({ context, delimiter });\n }", "title": "" }, { "docid": "1580b24cec7ee164c9a4381936359659", "score": "0.5128859", "text": "createNewWidget(context) {\n const ft = this._fileType;\n const mimeType = ft.mimeTypes.length ? ft.mimeTypes[0] : 'text/plain';\n const rendermime = this._rendermime.clone({\n resolver: context.urlResolver\n });\n const renderer = rendermime.createRenderer(mimeType);\n const content = new MimeContent({\n context,\n renderer,\n mimeType,\n renderTimeout: this._renderTimeout,\n dataType: this._dataType\n });\n content.title.iconClass = ft.iconClass;\n content.title.iconLabel = ft.iconLabel;\n const widget = new MimeDocument({ content, context });\n return widget;\n }", "title": "" }, { "docid": "87701de2ee00b6d9286b741a5abc1413", "score": "0.51266104", "text": "function createInputbox() {\n var boxDiv = document.createElement('div');\n\n // var label = \"<svg><circle cx=10 cy=10 r=10 fill='#AAAA00'/></svg>\"\n // cursor.innerHTML = '<div style=\"width:20px; line-height:20px; color:' + client.color\n // + '; font-size: 19px; font-weight:bold; text-align:center; vertical-align:middle;\">' + label + '</div>';\n\n boxDiv.innerHTML = \"<input autofocus type='text' id='msg-input'/><button id='send-msg-button' type='button'>Send</button>\";\n boxDiv.style.height = '60px';\n boxDiv.style.width = '400px';\n boxDiv.style.left = '100px';\n boxDiv.style.top = '100px';\n boxDiv.style.position = 'absolute';\n boxDiv.style.zIndex = 999;\n boxDiv.id = divBoxId;\n\n document.body.appendChild(boxDiv);\n\n console.log(\"Made an input box with id: \" + boxDiv.id);\n }", "title": "" }, { "docid": "d7e0e9af7d78873184f92c7e2d904787", "score": "0.51160395", "text": "function buildGuiPiping(){\n\t //ioDevice.filter.pipe( nl.filter ).pipe( text.filter ).pipe( MOOSE.shell.filter ).pipe( ioDevice.filter );\n\tioDevice.filter.pipe( MOOSE.shell.filter ).pipe( ioDevice.filter );\n\t// process.stdin.pipe( nl.filter ).pipe( text.filter ).pipe( MOOSE.shell.filter ).pipe( process.stdout );\n\n}", "title": "" }, { "docid": "1ecff993501f55202670a69198121b3a", "score": "0.5107343", "text": "static createInterfaces (settings = {}) {\n let stdout = MutePrompt.createStdoutInterface();\n MutePrompt.unmuteStdout(stdout);\n let stdin = MutePrompt.createStdinInterface(stdout, settings);\n return { stdout, stdin };\n }", "title": "" }, { "docid": "e5c2eee74bfc332648ce9c2ecb2b0dbb", "score": "0.5107061", "text": "function createInput(obj) {\n var input = document.createElement(\"input\");\n input.type = \"text\";\n input.id = obj.id;\n input.value = obj.value;\n input.className = obj.class;\n input.style.width = obj.w + \"px\";\n input.style.height = obj.h + \"px\";\n input.style.fontSize = obj.fontSize + \"px\";\n input.style.color = obj.colour;\n return input;\n}", "title": "" }, { "docid": "ebf9cd55de49b4d29cbea361a388e975", "score": "0.5104196", "text": "createConsole(options) {\n return new widget_CodeConsole(options);\n }", "title": "" }, { "docid": "b0dccbc0f6ffce7f7d51e0da3e479704", "score": "0.50740516", "text": "function setupInputBox() {\r\n\r\n }", "title": "" }, { "docid": "f67490a5ffb1bdecced5704e8ff970c9", "score": "0.5067311", "text": "renderInput(widget) {\n let layout = this.layout;\n if (this._rendered) {\n this._rendered.parent = null;\n }\n this._editor.hide();\n this._rendered = widget;\n layout.addWidget(widget);\n }", "title": "" }, { "docid": "9732d0c7b0994abf15de898eaced2d44", "score": "0.50671136", "text": "function createInputContainer(args, className, tagClass, tag, internalCreateElement) {\n var makeElement = !Object(__WEBPACK_IMPORTED_MODULE_0__syncfusion_ej2_base__[\"M\" /* isNullOrUndefined */])(internalCreateElement) ? internalCreateElement : __WEBPACK_IMPORTED_MODULE_0__syncfusion_ej2_base__[\"A\" /* createElement */];\n var container;\n if (!Object(__WEBPACK_IMPORTED_MODULE_0__syncfusion_ej2_base__[\"M\" /* isNullOrUndefined */])(args.customTag)) {\n container = makeElement(args.customTag, { className: className });\n container.classList.add(tagClass);\n }\n else {\n container = makeElement(tag, { className: className });\n }\n container.classList.add('e-control-wrapper');\n return container;\n }", "title": "" }, { "docid": "e6f1047b5849bd7f7a96e9536d53fb87", "score": "0.506626", "text": "function doWithStdin(f) {\n var buf = '';\n process.stdin.setEncoding('utf8');\n process.stdin.on('data', data => buf += data.toString());\n process.stdin.on('end', () => f(buf));\n}", "title": "" }, { "docid": "f79282a1f1fe71592af7d7c9d45e01cb", "score": "0.5062605", "text": "function stdioe(){\n var stdin = new stream.Readable({ read:function(size) {} });\n var io = new stream.Duplex({\n allowHalfOpen:false,\n read: function(size) { },\n write:function(chunk, encoding, callback) {\n stdin.push(chunk);\n callback()\n }\n })\n var stdout = new stream.Writable({\n write:function(chunk, encoding, callback) {\n io.push(chunk);\n callback()\n }\n });\n var stderr = new stream.Writable({\n write:function(chunk, encoding, callback) {\n io.push(chunk);\n callback()\n }\n });\n //TTY stream\n stdout.setTTYMode = function(value) {\n stdout.isTTY = !!value;\n if(stdout.isTTY){\n stdout.columns = 80\n stdout.rows = 24\n }\n \n };\n stdout.setMouseMode = function(value) {\n stdout.isMouse = !!value;\n if(stdout.isMouse){\n stdout.write('\\x1b[?1000h')\n }else{\n stdout.write('\\x1b[?1000l');\n }\n \n };\n stdout.setSize = function(size){\n stdout.columns = size.columns\n stdout.rows = size.rows\n stdout.emit('resize')\n }\n stdout.setTTYMode(true)\n stdout.setMouseMode(false)\n \n io.on('pipe',function(source){\n var kill = function(){};\n if(source===process.stdin){\n kill = process.exit\n }else{\n source.setRawMode = function(value) {\n source.isRaw = !!value;\n };\n }\n source.setRawMode(true)\n source.isTTY = true\n io.exit = function(){\n io.end();\n source.setRawMode(false);\n source.end();\n kill();\n };\n })\n io.on('close',function(){\n stdin.destroy()\n stdout.destroy()\n stderr.destroy()\n })\n io.stdin = stdin;\n io.stdout = stdout;\n io.stderr = stderr;\n io.id = uuidV4()\n return io\n}", "title": "" }, { "docid": "506bbf8e61205442360a9434b4eb33f9", "score": "0.5042482", "text": "createNewWidget(context) {\n return new widget_CSVDocumentWidget({ context });\n }", "title": "" }, { "docid": "ae56dcb0975c25528c21e1b6c6dd2639", "score": "0.50407237", "text": "constructor (settings) {\n let { stdout, stdin } = MutePrompt.createInterfaces(settings);\n this.stdout = stdout;\n this.stdin = stdin;\n }", "title": "" }, { "docid": "0f5c98d2853efd5399fb927278544fc0", "score": "0.50398415", "text": "function new_input(){\n let input = document.createElement(\"input\");\n input.setAttribute(\"type\", \"text\");\n input.setAttribute(\"id\", \"input\");\n input.addEventListener(\"keyup\",function(event){\n if(event.which == 13){\n on_input(input);\n }\n });\n document.getElementById(\"input_div\").appendChild(input);\n}", "title": "" }, { "docid": "ea5c5e5eca7ae9e1376dec815bbd1a5c", "score": "0.50155497", "text": "listen() {\n\t\t// add event listener to the stdin stream\n\t\tprocess.stdin.on('data', (response) => {\n\t\t\t// call the input callback with the users input when the event is triggered\n\t\t\tthis.input(response);\n\t\t});\n\t}", "title": "" }, { "docid": "50443811aa14577f5a4344479cc34351", "score": "0.5014999", "text": "function enterText() {\n events.EventEmitter.call(this);\n}", "title": "" }, { "docid": "6ac0e0b54fdc4ce390ac791e39998dfc", "score": "0.5010883", "text": "function create_input(anchor, input_id, value){\n\t\tvar in_box = new Element('input', \n\t\t\t{'id': input_id,\n\t\t\t'type': 'text',\n\t\t\t'autocomplete': 'off',\n\t\t\t'value': value }\n\t\t).inject($(anchor), 'after'); // find parental div container\n // block click events on input box \n in_box.addEvent('click', function(e){ e.stopPropagation(); }) \n }", "title": "" }, { "docid": "0c8705f426cf5f0429444d4986b325a6", "score": "0.5010877", "text": "createNewWidget(context) {\n return new lib_HTMLViewer({ context });\n }", "title": "" }, { "docid": "d3c2ef4a95fdbb9129b93a2e3e1b6208", "score": "0.49905014", "text": "function InputWrapper() {\n}", "title": "" }, { "docid": "8ba5d3fdb6acbbbf16c200f06a26eee6", "score": "0.497058", "text": "startExternalEditor() {\n // Pause Readline to prevent stdin and stdout from being modified while the editor is showing\n this.rl.pause();\n editAsync(this.currentText, this.endExternalEditor.bind(this));\n }", "title": "" }, { "docid": "8ba5d3fdb6acbbbf16c200f06a26eee6", "score": "0.497058", "text": "startExternalEditor() {\n // Pause Readline to prevent stdin and stdout from being modified while the editor is showing\n this.rl.pause();\n editAsync(this.currentText, this.endExternalEditor.bind(this));\n }", "title": "" }, { "docid": "e074ad8dbd0461f04b08e450a6b42bd7", "score": "0.49644566", "text": "function CreateTemplateCommand(input) {\n var _this = \n // Start section: command_constructor\n _super.call(this) || this;\n _this.input = input;\n return _this;\n // End section: command_constructor\n }", "title": "" }, { "docid": "dc4ccf8e14f00446c8f07adf1dcfb722", "score": "0.4962627", "text": "constructor(options) {\n super();\n this._banner = null;\n this._executed = new signaling_lib[\"Signal\"](this);\n this._mimetype = 'text/x-ipython';\n this._msgIds = new Map();\n this._msgIdCells = new Map();\n this._promptCellCreated = new signaling_lib[\"Signal\"](this);\n this._dragData = null;\n this._drag = null;\n this._focusedCell = null;\n this.addClass(CONSOLE_CLASS);\n this.node.dataset[KERNEL_USER] = 'true';\n this.node.dataset[CODE_RUNNER] = 'true';\n this.node.tabIndex = -1; // Allow the widget to take focus.\n // Create the panels that hold the content and input.\n const layout = (this.layout = new widgets_lib[\"PanelLayout\"]());\n this._cells = new observablelist[\"a\" /* ObservableList */]();\n this._content = new widgets_lib[\"Panel\"]();\n this._input = new widgets_lib[\"Panel\"]();\n this.contentFactory =\n options.contentFactory || widget_CodeConsole.defaultContentFactory;\n this.modelFactory = options.modelFactory || widget_CodeConsole.defaultModelFactory;\n this.rendermime = options.rendermime;\n this.session = options.session;\n this._mimeTypeService = options.mimeTypeService;\n // Add top-level CSS classes.\n this._content.addClass(CONTENT_CLASS);\n this._input.addClass(INPUT_CLASS);\n // Insert the content and input panes into the widget.\n layout.addWidget(this._content);\n layout.addWidget(this._input);\n this._history = new history_ConsoleHistory({\n session: this.session\n });\n this._onKernelChanged();\n this.session.kernelChanged.connect(this._onKernelChanged, this);\n this.session.statusChanged.connect(this._onKernelStatusChanged, this);\n }", "title": "" }, { "docid": "b38e9b70b6a4bee7dbb698f4267fc0e4", "score": "0.49576798", "text": "function listen(cb) {\n //only do init on stdin once\n if (!isListenSet) {\n //without this, we would only get streams once enter is pressed\n stdin.setRawMode(true);\n\n //i don't want binary, do you?\n stdin.setEncoding('hex');\n\n isListenSet = true;\n\n listenFn = function _listenFn(hex) {\n return cb(hex);\n };\n }\n\n //on any data into stdin\n stdin.on('data', listenFn);\n}", "title": "" }, { "docid": "4448f5345949f513c3aea4c9b1ca15fb", "score": "0.49568626", "text": "renderInput(widget) {\n this.addClass(RENDERED_CLASS);\n this.inputArea.renderInput(widget);\n }", "title": "" }, { "docid": "e98ade753c74ad68808dd710838d38f0", "score": "0.49426782", "text": "static createTextInput(className){\n let textInput = createElementComplete('input', '', className, '');\n textInput.type = \"text\";\n return textInput;\n }", "title": "" }, { "docid": "c0a527753b7ba2eb653405cafc97671c", "score": "0.49287763", "text": "function InputBox(todomanager, buttons, database) {\n this.dbObject = database;\n this.todomanagerObj = todomanager;\n this.buttonsObj = buttons;\n this.create();\n this.addEvent();\n}", "title": "" }, { "docid": "781fa817865d73c4568eefb1b6f5196f", "score": "0.4916818", "text": "createWidget(factory, context) {\n let widget = factory.createNew(context);\n Private.factoryProperty.set(widget, factory);\n // Handle widget extensions.\n let disposables = new disposable_1.DisposableSet();\n algorithm_1.each(this._registry.widgetExtensions(factory.name), extender => {\n disposables.add(extender.createNew(widget, context));\n });\n Private.disposablesProperty.set(widget, disposables);\n widget.disposed.connect(this._onWidgetDisposed, this);\n this.adoptWidget(context, widget);\n context.fileChanged.connect(this._onFileChanged, this);\n context.pathChanged.connect(this._onPathChanged, this);\n context.ready.then(() => {\n this.setCaption(widget);\n });\n return widget;\n }", "title": "" }, { "docid": "07fcbf90c4bf6ee41766ff6c13f428f2", "score": "0.4912926", "text": "function Input() {\n\n\t}", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" }, { "docid": "f2b9b579b237ed11986ff9337b9cf367", "score": "0.4905882", "text": "constructor(input) {\n // Start section: command_constructor\n super();\n this.input = input;\n // End section: command_constructor\n }", "title": "" } ]